@sapiom/harness 0.8.8 → 0.9.0

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 (88) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +11 -1
  3. package/dist/core/agent-project-discovery.d.ts +235 -1
  4. package/dist/core/agent-project-discovery.d.ts.map +1 -1
  5. package/dist/core/agent-project-discovery.js +303 -1
  6. package/dist/core/agent-project-discovery.js.map +1 -1
  7. package/dist/core/canvas-interconnections.d.ts +31 -0
  8. package/dist/core/canvas-interconnections.d.ts.map +1 -1
  9. package/dist/core/canvas-interconnections.js +294 -21
  10. package/dist/core/canvas-interconnections.js.map +1 -1
  11. package/dist/core/canvas-render.d.ts +32 -0
  12. package/dist/core/canvas-render.d.ts.map +1 -1
  13. package/dist/core/canvas-render.js +50 -41
  14. package/dist/core/canvas-render.js.map +1 -1
  15. package/dist/core/definition-name.d.ts +12 -0
  16. package/dist/core/definition-name.d.ts.map +1 -1
  17. package/dist/core/definition-name.js +14 -5
  18. package/dist/core/definition-name.js.map +1 -1
  19. package/dist/core/system-graph-inventory.d.ts +68 -0
  20. package/dist/core/system-graph-inventory.d.ts.map +1 -0
  21. package/dist/core/system-graph-inventory.js +312 -0
  22. package/dist/core/system-graph-inventory.js.map +1 -0
  23. package/dist/core/system-graph-relationships.d.ts +41 -0
  24. package/dist/core/system-graph-relationships.d.ts.map +1 -0
  25. package/dist/core/system-graph-relationships.js +98 -0
  26. package/dist/core/system-graph-relationships.js.map +1 -0
  27. package/dist/core/system-graph-store.d.ts +45 -0
  28. package/dist/core/system-graph-store.d.ts.map +1 -0
  29. package/dist/core/system-graph-store.js +222 -0
  30. package/dist/core/system-graph-store.js.map +1 -0
  31. package/dist/core/system-graph-watcher.d.ts +51 -0
  32. package/dist/core/system-graph-watcher.d.ts.map +1 -0
  33. package/dist/core/system-graph-watcher.js +448 -0
  34. package/dist/core/system-graph-watcher.js.map +1 -0
  35. package/dist/core/system-graph.d.ts +43 -0
  36. package/dist/core/system-graph.d.ts.map +1 -0
  37. package/dist/core/system-graph.js +321 -0
  38. package/dist/core/system-graph.js.map +1 -0
  39. package/dist/core/workflow-registry.d.ts +84 -6
  40. package/dist/core/workflow-registry.d.ts.map +1 -1
  41. package/dist/core/workflow-registry.js +191 -91
  42. package/dist/core/workflow-registry.js.map +1 -1
  43. package/dist/core/workspace-watcher.d.ts +21 -13
  44. package/dist/core/workspace-watcher.d.ts.map +1 -1
  45. package/dist/core/workspace-watcher.js +79 -81
  46. package/dist/core/workspace-watcher.js.map +1 -1
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js.map +1 -1
  50. package/dist/profiles/default.d.ts.map +1 -1
  51. package/dist/profiles/default.js +4 -2
  52. package/dist/profiles/default.js.map +1 -1
  53. package/dist/server/agent-move.d.ts +134 -0
  54. package/dist/server/agent-move.d.ts.map +1 -0
  55. package/dist/server/agent-move.js +343 -0
  56. package/dist/server/agent-move.js.map +1 -0
  57. package/dist/server/index.d.ts.map +1 -1
  58. package/dist/server/index.js +275 -22
  59. package/dist/server/index.js.map +1 -1
  60. package/dist/server/rest.d.ts +3 -0
  61. package/dist/server/rest.d.ts.map +1 -1
  62. package/dist/server/rest.js +3 -0
  63. package/dist/server/rest.js.map +1 -1
  64. package/dist/server/studio-rail.d.ts +76 -0
  65. package/dist/server/studio-rail.d.ts.map +1 -0
  66. package/dist/server/studio-rail.js +234 -0
  67. package/dist/server/studio-rail.js.map +1 -0
  68. package/dist/server/system-graph.d.ts +14 -0
  69. package/dist/server/system-graph.d.ts.map +1 -0
  70. package/dist/server/system-graph.js +40 -0
  71. package/dist/server/system-graph.js.map +1 -0
  72. package/dist/server/workflow-graph.d.ts +43 -0
  73. package/dist/server/workflow-graph.d.ts.map +1 -0
  74. package/dist/server/workflow-graph.js +200 -0
  75. package/dist/server/workflow-graph.js.map +1 -0
  76. package/dist/shared/system-graph.d.ts +59 -0
  77. package/dist/shared/system-graph.d.ts.map +1 -0
  78. package/dist/shared/system-graph.js +76 -0
  79. package/dist/shared/system-graph.js.map +1 -0
  80. package/dist/shared/types.d.ts +45 -0
  81. package/dist/shared/types.d.ts.map +1 -1
  82. package/dist/shared/types.js.map +1 -1
  83. package/dist/web/assets/index-2Fab6dzf.js +508 -0
  84. package/dist/web/assets/index-D0doaFvT.css +32 -0
  85. package/dist/web/index.html +2 -2
  86. package/package.json +5 -5
  87. package/dist/web/assets/index-DrTPW10E.js +0 -494
  88. package/dist/web/assets/index-jGBbXx9R.css +0 -32
@@ -0,0 +1,508 @@
1
+ var oR=Object.defineProperty;var lR=(e,t,n)=>t in e?oR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var gm=(e,t,n)=>lR(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function cR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vm={exports:{}},Kl={};/**
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 Gb;function uR(){if(Gb)return Kl;Gb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var l in o)l!=="key"&&(c[l]=o[l])}else c=o;return o=c.ref,{$$typeof:e,type:r,key:h,ref:o!==void 0?o:null,props:c}}return Kl.Fragment=t,Kl.jsx=n,Kl.jsxs=n,Kl}var Wb;function dR(){return Wb||(Wb=1,vm.exports=uR()),vm.exports}var d=dR(),_m={exports:{}},ht={};/**
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 Kb;function hR(){if(Kb)return ht;Kb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),h=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),S=Symbol.iterator;function w($){return $===null||typeof $!="object"?null:($=S&&$[S]||$["@@iterator"],typeof $=="function"?$:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,y={};function b($,H,U){this.props=$,this.context=H,this.refs=y,this.updater=U||A}b.prototype.isReactComponent={},b.prototype.setState=function($,H){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,H,"setState")},b.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function v(){}v.prototype=b.prototype;function _($,H,U){this.props=$,this.context=H,this.refs=y,this.updater=U||A}var k=_.prototype=new v;k.constructor=_,E(k,b.prototype),k.isPureReactComponent=!0;var C=Array.isArray;function x(){}var T={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function M($,H,U){var P=U.ref;return{$$typeof:e,type:$,key:H,ref:P!==void 0?P:null,props:U}}function D($,H){return M($.type,H,$.props)}function L($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var H={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(U){return H[U]})}var F=/\/+/g;function Y($,H){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):H.toString(36)}function Q($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(x,x):($.status="pending",$.then(function(H){$.status==="pending"&&($.status="fulfilled",$.value=H)},function(H){$.status==="pending"&&($.status="rejected",$.reason=H)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function G($,H,U,P,W){var se=typeof $;(se==="undefined"||se==="boolean")&&($=null);var X=!1;if($===null)X=!0;else switch(se){case"bigint":case"string":case"number":X=!0;break;case"object":switch($.$$typeof){case e:case t:X=!0;break;case g:return X=$._init,G(X($._payload),H,U,P,W)}}if(X)return W=W($),X=P===""?"."+Y($,0):P,C(W)?(U="",X!=null&&(U=X.replace(F,"$&/")+"/"),G(W,H,U,"",function(oe){return oe})):W!=null&&(L(W)&&(W=D(W,U+(W.key==null||$&&$.key===W.key?"":(""+W.key).replace(F,"$&/")+"/")+X)),H.push(W)),1;X=0;var V=P===""?".":P+":";if(C($))for(var ce=0;ce<$.length;ce++)P=$[ce],se=V+Y(P,ce),X+=G(P,H,U,se,W);else if(ce=w($),typeof ce=="function")for($=ce.call($),ce=0;!(P=$.next()).done;)P=P.value,se=V+Y(P,ce++),X+=G(P,H,U,se,W);else if(se==="object"){if(typeof $.then=="function")return G(Q($),H,U,P,W);throw H=String($),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return X}function ee($,H,U){if($==null)return $;var P=[],W=0;return G($,P,"","",function(se){return H.call(U,se,W++)}),P}function ne($){if($._status===-1){var H=$._result;H=H(),H.then(function(U){($._status===0||$._status===-1)&&($._status=1,$._result=U)},function(U){($._status===0||$._status===-1)&&($._status=2,$._result=U)}),$._status===-1&&($._status=0,$._result=H)}if($._status===1)return $._result.default;throw $._result}var z=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},B={map:ee,forEach:function($,H,U){ee($,function(){H.apply(this,arguments)},U)},count:function($){var H=0;return ee($,function(){H++}),H},toArray:function($){return ee($,function(H){return H})||[]},only:function($){if(!L($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return ht.Activity=p,ht.Children=B,ht.Component=b,ht.Fragment=n,ht.Profiler=o,ht.PureComponent=_,ht.StrictMode=r,ht.Suspense=u,ht.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,ht.__COMPILER_RUNTIME={__proto__:null,c:function($){return T.H.useMemoCache($)}},ht.cache=function($){return function(){return $.apply(null,arguments)}},ht.cacheSignal=function(){return null},ht.cloneElement=function($,H,U){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var P=E({},$.props),W=$.key;if(H!=null)for(se in H.key!==void 0&&(W=""+H.key),H)!R.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(P[se]=H[se]);var se=arguments.length-2;if(se===1)P.children=U;else if(1<se){for(var X=Array(se),V=0;V<se;V++)X[V]=arguments[V+2];P.children=X}return M($.type,W,P)},ht.createContext=function($){return $={$$typeof:h,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:c,_context:$},$},ht.createElement=function($,H,U){var P,W={},se=null;if(H!=null)for(P in H.key!==void 0&&(se=""+H.key),H)R.call(H,P)&&P!=="key"&&P!=="__self"&&P!=="__source"&&(W[P]=H[P]);var X=arguments.length-2;if(X===1)W.children=U;else if(1<X){for(var V=Array(X),ce=0;ce<X;ce++)V[ce]=arguments[ce+2];W.children=V}if($&&$.defaultProps)for(P in X=$.defaultProps,X)W[P]===void 0&&(W[P]=X[P]);return M($,se,W)},ht.createRef=function(){return{current:null}},ht.forwardRef=function($){return{$$typeof:l,render:$}},ht.isValidElement=L,ht.lazy=function($){return{$$typeof:g,_payload:{_status:-1,_result:$},_init:ne}},ht.memo=function($,H){return{$$typeof:m,type:$,compare:H===void 0?null:H}},ht.startTransition=function($){var H=T.T,U={};T.T=U;try{var P=$(),W=T.S;W!==null&&W(U,P),typeof P=="object"&&P!==null&&typeof P.then=="function"&&P.then(x,z)}catch(se){z(se)}finally{H!==null&&U.types!==null&&(H.types=U.types),T.T=H}},ht.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},ht.use=function($){return T.H.use($)},ht.useActionState=function($,H,U){return T.H.useActionState($,H,U)},ht.useCallback=function($,H){return T.H.useCallback($,H)},ht.useContext=function($){return T.H.useContext($)},ht.useDebugValue=function(){},ht.useDeferredValue=function($,H){return T.H.useDeferredValue($,H)},ht.useEffect=function($,H){return T.H.useEffect($,H)},ht.useEffectEvent=function($){return T.H.useEffectEvent($)},ht.useId=function(){return T.H.useId()},ht.useImperativeHandle=function($,H,U){return T.H.useImperativeHandle($,H,U)},ht.useInsertionEffect=function($,H){return T.H.useInsertionEffect($,H)},ht.useLayoutEffect=function($,H){return T.H.useLayoutEffect($,H)},ht.useMemo=function($,H){return T.H.useMemo($,H)},ht.useOptimistic=function($,H){return T.H.useOptimistic($,H)},ht.useReducer=function($,H,U){return T.H.useReducer($,H,U)},ht.useRef=function($){return T.H.useRef($)},ht.useState=function($){return T.H.useState($)},ht.useSyncExternalStore=function($,H,U){return T.H.useSyncExternalStore($,H,U)},ht.useTransition=function(){return T.H.useTransition()},ht.version="19.2.7",ht}var Yb;function Av(){return Yb||(Yb=1,_m.exports=hR()),_m.exports}var O=Av(),ym={exports:{}},Yl={},bm={exports:{}},Sm={};/**
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 Xb;function fR(){return Xb||(Xb=1,(function(e){function t(G,ee){var ne=G.length;G.push(ee);e:for(;0<ne;){var z=ne-1>>>1,B=G[z];if(0<o(B,ee))G[z]=ee,G[ne]=B,ne=z;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var ee=G[0],ne=G.pop();if(ne!==ee){G[0]=ne;e:for(var z=0,B=G.length,$=B>>>1;z<$;){var H=2*(z+1)-1,U=G[H],P=H+1,W=G[P];if(0>o(U,ne))P<B&&0>o(W,U)?(G[z]=W,G[P]=ne,z=P):(G[z]=U,G[H]=ne,z=H);else if(P<B&&0>o(W,ne))G[z]=W,G[P]=ne,z=P;else break e}}return ee}function o(G,ee){var ne=G.sortIndex-ee.sortIndex;return ne!==0?ne:G.id-ee.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var h=Date,l=h.now();e.unstable_now=function(){return h.now()-l}}var u=[],m=[],g=1,p=null,S=3,w=!1,A=!1,E=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function k(G){for(var ee=n(m);ee!==null;){if(ee.callback===null)r(m);else if(ee.startTime<=G)r(m),ee.sortIndex=ee.expirationTime,t(u,ee);else break;ee=n(m)}}function C(G){if(E=!1,k(G),!A)if(n(u)!==null)A=!0,x||(x=!0,q());else{var ee=n(m);ee!==null&&Q(C,ee.startTime-G)}}var x=!1,T=-1,R=5,M=-1;function D(){return y?!0:!(e.unstable_now()-M<R)}function L(){if(y=!1,x){var G=e.unstable_now();M=G;var ee=!0;try{e:{A=!1,E&&(E=!1,v(T),T=-1),w=!0;var ne=S;try{t:{for(k(G),p=n(u);p!==null&&!(p.expirationTime>G&&D());){var z=p.callback;if(typeof z=="function"){p.callback=null,S=p.priorityLevel;var B=z(p.expirationTime<=G);if(G=e.unstable_now(),typeof B=="function"){p.callback=B,k(G),ee=!0;break t}p===n(u)&&r(u),k(G)}else r(u);p=n(u)}if(p!==null)ee=!0;else{var $=n(m);$!==null&&Q(C,$.startTime-G),ee=!1}}break e}finally{p=null,S=ne,w=!1}ee=void 0}}finally{ee?q():x=!1}}}var q;if(typeof _=="function")q=function(){_(L)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,Y=F.port2;F.port1.onmessage=L,q=function(){Y.postMessage(null)}}else q=function(){b(L,0)};function Q(G,ee){T=b(function(){G(e.unstable_now())},ee)}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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(G){switch(S){case 1:case 2:case 3:var ee=3;break;default:ee=S}var ne=S;S=ee;try{return G()}finally{S=ne}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(G,ee){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var ne=S;S=G;try{return ee()}finally{S=ne}},e.unstable_scheduleCallback=function(G,ee,ne){var z=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?z+ne:z):ne=z,G){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=ne+B,G={id:g++,callback:ee,priorityLevel:G,startTime:ne,expirationTime:B,sortIndex:-1},ne>z?(G.sortIndex=ne,t(m,G),n(u)===null&&G===n(m)&&(E?(v(T),T=-1):E=!0,Q(C,ne-z))):(G.sortIndex=B,t(u,G),A||w||(A=!0,x||(x=!0,q()))),G},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(G){var ee=S;return function(){var ne=S;S=ee;try{return G.apply(this,arguments)}finally{S=ne}}}})(Sm)),Sm}var Jb;function pR(){return Jb||(Jb=1,bm.exports=fR()),bm.exports}var wm={exports:{}},fn={};/**
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 Zb;function mR(){if(Zb)return fn;Zb=1;var e=Av();function t(u){var m="https://react.dev/errors/"+u;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+u+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(u,m,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:u,containerInfo:m,implementation:g}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,m){if(u==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,fn.createPortal=function(u,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return c(u,m,null,g)},fn.flushSync=function(u){var m=h.T,g=r.p;try{if(h.T=null,r.p=2,u)return u()}finally{h.T=m,r.p=g,r.d.f()}},fn.preconnect=function(u,m){typeof u=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(u,m))},fn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},fn.preinit=function(u,m){if(typeof u=="string"&&m&&typeof m.as=="string"){var g=m.as,p=l(g,m.crossOrigin),S=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?r.d.S(u,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:p,integrity:S,fetchPriority:w}):g==="script"&&r.d.X(u,{crossOrigin:p,integrity:S,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},fn.preinitModule=function(u,m){if(typeof u=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=l(m.as,m.crossOrigin);r.d.M(u,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(u)},fn.preload=function(u,m){if(typeof u=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,p=l(g,m.crossOrigin);r.d.L(u,g,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},fn.preloadModule=function(u,m){if(typeof u=="string")if(m){var g=l(m.as,m.crossOrigin);r.d.m(u,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(u)},fn.requestFormReset=function(u){r.d.r(u)},fn.unstable_batchedUpdates=function(u,m){return u(m)},fn.useFormState=function(u,m,g){return h.H.useFormState(u,m,g)},fn.useFormStatus=function(){return h.H.useHostTransitionStatus()},fn.version="19.2.7",fn}var Qb;function Qx(){if(Qb)return wm.exports;Qb=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(),wm.exports=mR(),wm.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 e1;function gR(){if(e1)return Yl;e1=1;var e=pR(),t=Av(),n=Qx();function r(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var i=s,a=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(a=i.return),s=i.return;while(s)}return i.tag===3?a:null}function h(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function l(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function u(s){if(c(s)!==s)throw Error(r(188))}function m(s){var i=s.alternate;if(!i){if(i=c(s),i===null)throw Error(r(188));return i!==s?null:s}for(var a=s,f=i;;){var j=a.return;if(j===null)break;var N=j.alternate;if(N===null){if(f=j.return,f!==null){a=f;continue}break}if(j.child===N.child){for(N=j.child;N;){if(N===a)return u(j),s;if(N===f)return u(j),i;N=N.sibling}throw Error(r(188))}if(a.return!==f.return)a=j,f=N;else{for(var I=!1,K=j.child;K;){if(K===a){I=!0,a=j,f=N;break}if(K===f){I=!0,f=j,a=N;break}K=K.sibling}if(!I){for(K=N.child;K;){if(K===a){I=!0,a=N,f=j;break}if(K===f){I=!0,f=N,a=j;break}K=K.sibling}if(!I)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?s:i}function g(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=g(s),i!==null)return i;s=s.sibling}return null}var p=Object.assign,S=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),_=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function q(s){return s===null||typeof s!="object"?null:(s=L&&s[L]||s["@@iterator"],typeof s=="function"?s:null)}var F=Symbol.for("react.client.reference");function Y(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===F?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case E:return"Fragment";case b:return"Profiler";case y:return"StrictMode";case C:return"Suspense";case x:return"SuspenseList";case M:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case A:return"Portal";case _:return s.displayName||"Context";case v:return(s._context.displayName||"Context")+".Consumer";case k:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case T:return i=s.displayName||null,i!==null?i:Y(s.type)||"Memo";case R:i=s._payload,s=s._init;try{return Y(s(i))}catch{}}return null}var Q=Array.isArray,G=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},z=[],B=-1;function $(s){return{current:s}}function H(s){0>B||(s.current=z[B],z[B]=null,B--)}function U(s,i){B++,z[B]=s.current,s.current=i}var P=$(null),W=$(null),se=$(null),X=$(null);function V(s,i){switch(U(se,i),U(W,s),U(P,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?mb(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=mb(i),s=gb(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}H(P),U(P,s)}function ce(){H(P),H(W),H(se)}function oe(s){s.memoizedState!==null&&U(X,s);var i=P.current,a=gb(i,s.type);i!==a&&(U(W,s),U(P,a))}function Z(s){W.current===s&&(H(P),H(W)),X.current===s&&(H(X),ql._currentValue=ne)}var te,pe;function ye(s){if(te===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);te=i&&i[1]||"",pe=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+te+s+pe}var Ee=!1;function Ie(s,i){if(!s||Ee)return"";Ee=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(i){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(we){var ve=we}Reflect.construct(s,[],Re)}else{try{Re.call()}catch(we){ve=we}s.call(Re.prototype)}}else{try{throw Error()}catch(we){ve=we}(Re=s())&&typeof Re.catch=="function"&&Re.catch(function(){})}}catch(we){if(we&&ve&&typeof we.stack=="string")return[we.stack,ve.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var j=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");j&&j.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=f.DetermineComponentFrameRoot(),I=N[0],K=N[1];if(I&&K){var ie=I.split(`
44
+ `),ge=K.split(`
45
+ `);for(j=f=0;f<ie.length&&!ie[f].includes("DetermineComponentFrameRoot");)f++;for(;j<ge.length&&!ge[j].includes("DetermineComponentFrameRoot");)j++;if(f===ie.length||j===ge.length)for(f=ie.length-1,j=ge.length-1;1<=f&&0<=j&&ie[f]!==ge[j];)j--;for(;1<=f&&0<=j;f--,j--)if(ie[f]!==ge[j]){if(f!==1||j!==1)do if(f--,j--,0>j||ie[f]!==ge[j]){var Ce=`
46
+ `+ie[f].replace(" at new "," at ");return s.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",s.displayName)),Ce}while(1<=f&&0<=j);break}}}finally{Ee=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?ye(a):""}function Pe(s,i){switch(s.tag){case 26:case 27:case 5:return ye(s.type);case 16:return ye("Lazy");case 13:return s.child!==i&&i!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return ye("Activity");default:return""}}function Fe(s){try{var i="",a=null;do i+=Pe(s,a),a=s,s=s.return;while(s);return i}catch(f){return`
47
+ Error generating stack: `+f.message+`
48
+ `+f.stack}}var je=Object.prototype.hasOwnProperty,Ue=e.unstable_scheduleCallback,Ye=e.unstable_cancelCallback,jt=e.unstable_shouldYield,rt=e.unstable_requestPaint,Ct=e.unstable_now,dt=e.unstable_getCurrentPriorityLevel,Lt=e.unstable_ImmediatePriority,mt=e.unstable_UserBlockingPriority,Ut=e.unstable_NormalPriority,Ss=e.unstable_LowPriority,Yt=e.unstable_IdlePriority,ms=e.log,_t=e.unstable_setDisableYieldValue,$s=null,as=null;function Et(s){if(typeof ms=="function"&&_t(s),as&&typeof as.setStrictMode=="function")try{as.setStrictMode($s,s)}catch{}}var It=Math.clz32?Math.clz32:In,Hs=Math.log,Xs=Math.LN2;function In(s){return s>>>=0,s===0?32:31-(Hs(s)/Xs|0)|0}var Gs=256,ot=262144,Us=4194304;function os(s){var i=s&42;if(i!==0)return i;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function js(s,i,a){var f=s.pendingLanes;if(f===0)return 0;var j=0,N=s.suspendedLanes,I=s.pingedLanes;s=s.warmLanes;var K=f&134217727;return K!==0?(f=K&~N,f!==0?j=os(f):(I&=K,I!==0?j=os(I):a||(a=K&~s,a!==0&&(j=os(a))))):(K=f&~N,K!==0?j=os(K):I!==0?j=os(I):a||(a=f&~s,a!==0&&(j=os(a)))),j===0?0:i!==0&&i!==j&&(i&N)===0&&(N=j&-j,a=i&-i,N>=a||N===32&&(a&4194048)!==0)?i:j}function un(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function Js(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 _n(){var s=Us;return Us<<=1,(Us&62914560)===0&&(Us=4194304),s}function Pn(s){for(var i=[],a=0;31>a;a++)i.push(s);return i}function ls(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function mi(s,i,a,f,j,N){var I=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var K=s.entanglements,ie=s.expirationTimes,ge=s.hiddenUpdates;for(a=I&~a;0<a;){var Ce=31-It(a),Re=1<<Ce;K[Ce]=0,ie[Ce]=-1;var ve=ge[Ce];if(ve!==null)for(ge[Ce]=null,Ce=0;Ce<ve.length;Ce++){var we=ve[Ce];we!==null&&(we.lane&=-536870913)}a&=~Re}f!==0&&xs(s,f,0),N!==0&&j===0&&s.tag!==0&&(s.suspendedLanes|=N&~(I&~i))}function xs(s,i,a){s.pendingLanes|=i,s.suspendedLanes&=~i;var f=31-It(i);s.entangledLanes|=i,s.entanglements[f]=s.entanglements[f]|1073741824|a&261930}function kn(s,i){var a=s.entangledLanes|=i;for(s=s.entanglements;a;){var f=31-It(a),j=1<<f;j&i|s[f]&i&&(s[f]|=i),a&=~j}}function gi(s,i){var a=i&-i;return a=(a&42)!==0?1:Ze(a),(a&(s.suspendedLanes|i))!==0?0:a}function Ze(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Zs(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function tt(){var s=ee.p;return s!==0?s:(s=window.event,s===void 0?32:Bb(s.type))}function jn(s,i){var a=ee.p;try{return ee.p=s,i()}finally{ee.p=a}}var Ds=Math.random().toString(36).slice(2),kt="__reactFiber$"+Ds,Xt="__reactProps$"+Ds,dn="__reactContainer$"+Ds,Rs="__reactEvents$"+Ds,hn="__reactListeners$"+Ds,Rn="__reactHandles$"+Ds,Qs="__reactResources$"+Ds,Fs="__reactMarker$"+Ds;function ws(s){delete s[kt],delete s[Xt],delete s[Rs],delete s[hn],delete s[Rn]}function re(s){var i=s[kt];if(i)return i;for(var a=s.parentNode;a;){if(i=a[dn]||a[kt]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(s=xb(s);s!==null;){if(a=s[kt])return a;s=xb(s)}return i}s=a,a=s.parentNode}return null}function he(s){if(s=s[kt]||s[dn]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function be(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(r(33))}function xe(s){var i=s[Qs];return i||(i=s[Qs]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Ae(s){s[Fs]=!0}var ze=new Set,st={};function We(s,i){Rt(s,i),Rt(s+"Capture",i)}function Rt(s,i){for(st[s]=i,s=0;s<i.length;s++)ze.add(i[s])}var le=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]*$"),De={},fe={};function Le(s){return je.call(fe,s)?!0:je.call(De,s)?!1:le.test(s)?fe[s]=!0:(De[s]=!0,!1)}function Me(s,i,a){if(Le(i))if(a===null)s.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var f=i.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+a)}}function Qe(s,i,a){if(a===null)s.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+a)}}function it(s,i,a,f){if(f===null)s.removeAttribute(a);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttributeNS(i,a,""+f)}}function St(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ge(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Je(s,i,a){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var j=f.get,N=f.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return j.call(this)},set:function(I){a=""+I,N.call(this,I)}}),Object.defineProperty(s,i,{enumerable:f.enumerable}),{getValue:function(){return a},setValue:function(I){a=""+I},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function lt(s){if(!s._valueTracker){var i=Ge(s)?"checked":"value";s._valueTracker=Je(s,i,""+s[i])}}function wt(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var a=i.getValue(),f="";return s&&(f=Ge(s)?s.checked?"true":"false":s.value),s=f,s!==a?(i.setValue(s),!0):!1}function Bt(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Jn=/[\n"\\]/g;function gt(s){return s.replace(Jn,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function gs(s,i,a,f,j,N,I,K){s.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.type=I:s.removeAttribute("type"),i!=null?I==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+St(i)):s.value!==""+St(i)&&(s.value=""+St(i)):I!=="submit"&&I!=="reset"||s.removeAttribute("value"),i!=null?sl(s,I,St(i)):a!=null?sl(s,I,St(a)):f!=null&&s.removeAttribute("value"),j==null&&N!=null&&(s.defaultChecked=!!N),j!=null&&(s.checked=j&&typeof j!="function"&&typeof j!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?s.name=""+St(K):s.removeAttribute("name")}function Ha(s,i,a,f,j,N,I,K){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(s.type=N),i!=null||a!=null){if(!(N!=="submit"&&N!=="reset"||i!=null)){lt(s);return}a=a!=null?""+St(a):"",i=i!=null?""+St(i):a,K||i===s.value||(s.value=i),s.defaultValue=i}f=f??j,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=K?s.checked:!!f,s.defaultChecked=!!f,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(s.name=I),lt(s)}function sl(s,i,a){i==="number"&&Bt(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Ii(s,i,a,f){if(s=s.options,i){i={};for(var j=0;j<a.length;j++)i["$"+a[j]]=!0;for(a=0;a<s.length;a++)j=i.hasOwnProperty("$"+s[a].value),s[a].selected!==j&&(s[a].selected=j),j&&f&&(s[a].defaultSelected=!0)}else{for(a=""+St(a),i=null,j=0;j<s.length;j++){if(s[j].value===a){s[j].selected=!0,f&&(s[j].defaultSelected=!0);return}i!==null||s[j].disabled||(i=s[j])}i!==null&&(i.selected=!0)}}function Ua(s,i,a){if(i!=null&&(i=""+St(i),i!==s.value&&(s.value=i),a==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=a!=null?""+St(a):""}function zc(s,i,a,f){if(i==null){if(f!=null){if(a!=null)throw Error(r(92));if(Q(f)){if(1<f.length)throw Error(r(93));f=f[0]}a=f}a==null&&(a=""),i=a}a=St(i),s.defaultValue=a,f=s.textContent,f===a&&f!==""&&f!==null&&(s.value=f),lt(s)}function mr(s,i){if(i){var a=s.firstChild;if(a&&a===s.lastChild&&a.nodeType===3){a.nodeValue=i;return}}s.textContent=i}var nl=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 il(s,i,a){var f=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?f?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":f?s.setProperty(i,a):typeof a!="number"||a===0||nl.has(i)?i==="float"?s.cssFloat=a:s[i]=(""+a).trim():s[i]=a+"px"}function Hc(s,i,a){if(i!=null&&typeof i!="object")throw Error(r(62));if(s=s.style,a!=null){for(var f in a)!a.hasOwnProperty(f)||i!=null&&i.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var j in i)f=i[j],i.hasOwnProperty(j)&&a[j]!==f&&il(s,j,f)}else for(var N in i)i.hasOwnProperty(N)&&il(s,N,i[N])}function Fa(s){if(s.indexOf("-")===-1)return!1;switch(s){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 bf=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"]]),rl=/^[\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(s){return rl.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function An(){}var Va=null;function al(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var gr=null,Pi=null;function ol(s){var i=he(s);if(i&&(s=i.stateNode)){var a=s[Xt]||null;e:switch(s=i.stateNode,i.type){case"input":if(gs(s,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=s;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+gt(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var f=a[i];if(f!==s&&f.form===s.form){var j=f[Xt]||null;if(!j)throw Error(r(90));gs(f,j.value,j.defaultValue,j.defaultValue,j.checked,j.defaultChecked,j.type,j.name)}}for(i=0;i<a.length;i++)f=a[i],f.form===s.form&&wt(f)}break e;case"textarea":Ua(s,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&Ii(s,!!a.multiple,i,!1)}}}var Ga=!1;function ll(s,i,a){if(Ga)return s(i,a);Ga=!0;try{var f=s(i);return f}finally{if(Ga=!1,(gr!==null||Pi!==null)&&(Cu(),gr&&(i=gr,s=Pi,Pi=gr=null,ol(i),s)))for(i=0;i<s.length;i++)ol(s[i])}}function vr(s,i){var a=s.stateNode;if(a===null)return null;var f=a[Xt]||null;if(f===null)return null;a=f[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(a&&typeof a!="function")throw Error(r(231,i,typeof a));return a}var Zn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wa=!1;if(Zn)try{var _r={};Object.defineProperty(_r,"passive",{get:function(){Wa=!0}}),window.addEventListener("test",_r,_r),window.removeEventListener("test",_r,_r)}catch{Wa=!1}var vi=null,Ka=null,Jr=null;function cl(){if(Jr)return Jr;var s,i=Ka,a=i.length,f,j="value"in vi?vi.value:vi.textContent,N=j.length;for(s=0;s<a&&i[s]===j[s];s++);var I=a-s;for(f=1;f<=I&&i[a-f]===j[N-f];f++);return Jr=j.slice(s,1<f?1-f:void 0)}function Zr(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Qr(){return!0}function ul(){return!1}function en(s){function i(a,f,j,N,I){this._reactName=a,this._targetInst=j,this.type=f,this.nativeEvent=N,this.target=I,this.currentTarget=null;for(var K in s)s.hasOwnProperty(K)&&(a=s[K],this[K]=a?a(N):N[K]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?Qr:ul,this.isPropagationStopped=ul,this}return p(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Qr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Qr)},persist:function(){},isPersistent:Qr}),i}var Ri={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ea=en(Ri),yr=p({},Ri,{view:0,detail:0}),Uc=en(yr),Ya,J,Se,Ne=p({},yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sf,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Se&&(Se&&s.type==="mousemove"?(Ya=s.screenX-Se.screenX,J=s.screenY-Se.screenY):J=Ya=0,Se=s),Ya)},movementY:function(s){return"movementY"in s?s.movementY:J}}),Ve=en(Ne),pt=p({},Ne,{dataTransfer:0}),vs=en(pt),Jt=p({},yr,{relatedTarget:0}),br=en(Jt),ck=p({},Ri,{animationName:0,elapsedTime:0,pseudoElement:0}),uk=en(ck),dk=p({},Ri,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),hk=en(dk),fk=p({},Ri,{data:0}),y_=en(fk),pk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mk={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"},gk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vk(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=gk[s])?!!i[s]:!1}function Sf(){return vk}var _k=p({},yr,{key:function(s){if(s.key){var i=pk[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=Zr(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?mk[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sf,charCode:function(s){return s.type==="keypress"?Zr(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Zr(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),yk=en(_k),bk=p({},Ne,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),b_=en(bk),Sk=p({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sf}),wk=en(Sk),xk=p({},Ri,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ck=en(xk),Ek=p({},Ne,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),kk=en(Ek),jk=p({},Ri,{newState:0,oldState:0}),Rk=en(jk),Ak=[9,13,27,32],wf=Zn&&"CompositionEvent"in window,dl=null;Zn&&"documentMode"in document&&(dl=document.documentMode);var Tk=Zn&&"TextEvent"in window&&!dl,S_=Zn&&(!wf||dl&&8<dl&&11>=dl),w_=" ",x_=!1;function C_(s,i){switch(s){case"keyup":return Ak.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E_(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Xa=!1;function Nk(s,i){switch(s){case"compositionend":return E_(i);case"keypress":return i.which!==32?null:(x_=!0,w_);case"textInput":return s=i.data,s===w_&&x_?null:s;default:return null}}function Mk(s,i){if(Xa)return s==="compositionend"||!wf&&C_(s,i)?(s=cl(),Jr=Ka=vi=null,Xa=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return S_&&i.locale!=="ko"?null:i.data;default:return null}}var $k={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 k_(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!$k[s.type]:i==="textarea"}function j_(s,i,a,f){gr?Pi?Pi.push(f):Pi=[f]:gr=f,i=Nu(i,"onChange"),0<i.length&&(a=new ea("onChange","change",null,a,f),s.push({event:a,listeners:i}))}var hl=null,fl=null;function Dk(s){cb(s,0)}function Fc(s){var i=be(s);if(wt(i))return s}function R_(s,i){if(s==="change")return i}var A_=!1;if(Zn){var xf;if(Zn){var Cf="oninput"in document;if(!Cf){var T_=document.createElement("div");T_.setAttribute("oninput","return;"),Cf=typeof T_.oninput=="function"}xf=Cf}else xf=!1;A_=xf&&(!document.documentMode||9<document.documentMode)}function N_(){hl&&(hl.detachEvent("onpropertychange",M_),fl=hl=null)}function M_(s){if(s.propertyName==="value"&&Fc(fl)){var i=[];j_(i,fl,s,al(s)),ll(Dk,i)}}function Ok(s,i,a){s==="focusin"?(N_(),hl=i,fl=a,hl.attachEvent("onpropertychange",M_)):s==="focusout"&&N_()}function Lk(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Fc(fl)}function Ik(s,i){if(s==="click")return Fc(i)}function Pk(s,i){if(s==="input"||s==="change")return Fc(i)}function Bk(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var Bn=typeof Object.is=="function"?Object.is:Bk;function pl(s,i){if(Bn(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var a=Object.keys(s),f=Object.keys(i);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var j=a[f];if(!je.call(i,j)||!Bn(s[j],i[j]))return!1}return!0}function $_(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function D_(s,i){var a=$_(s);s=0;for(var f;a;){if(a.nodeType===3){if(f=s+a.textContent.length,s<=i&&f>=i)return{node:a,offset:i-s};s=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=$_(a)}}function O_(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?O_(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function L_(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=Bt(s.document);i instanceof s.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)s=i.contentWindow;else break;i=Bt(s.document)}return i}function Ef(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var zk=Zn&&"documentMode"in document&&11>=document.documentMode,Ja=null,kf=null,ml=null,jf=!1;function I_(s,i,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;jf||Ja==null||Ja!==Bt(f)||(f=Ja,"selectionStart"in f&&Ef(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),ml&&pl(ml,f)||(ml=f,f=Nu(kf,"onSelect"),0<f.length&&(i=new ea("onSelect","select",null,i,a),s.push({event:i,listeners:f}),i.target=Ja)))}function ta(s,i){var a={};return a[s.toLowerCase()]=i.toLowerCase(),a["Webkit"+s]="webkit"+i,a["Moz"+s]="moz"+i,a}var Za={animationend:ta("Animation","AnimationEnd"),animationiteration:ta("Animation","AnimationIteration"),animationstart:ta("Animation","AnimationStart"),transitionrun:ta("Transition","TransitionRun"),transitionstart:ta("Transition","TransitionStart"),transitioncancel:ta("Transition","TransitionCancel"),transitionend:ta("Transition","TransitionEnd")},Rf={},P_={};Zn&&(P_=document.createElement("div").style,"AnimationEvent"in window||(delete Za.animationend.animation,delete Za.animationiteration.animation,delete Za.animationstart.animation),"TransitionEvent"in window||delete Za.transitionend.transition);function sa(s){if(Rf[s])return Rf[s];if(!Za[s])return s;var i=Za[s],a;for(a in i)if(i.hasOwnProperty(a)&&a in P_)return Rf[s]=i[a];return s}var B_=sa("animationend"),z_=sa("animationiteration"),H_=sa("animationstart"),Hk=sa("transitionrun"),Uk=sa("transitionstart"),Fk=sa("transitioncancel"),U_=sa("transitionend"),F_=new Map,Af="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(" ");Af.push("scrollEnd");function _i(s,i){F_.set(s,i),We(i,[s])}var qc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Qn=[],Qa=0,Tf=0;function Vc(){for(var s=Qa,i=Tf=Qa=0;i<s;){var a=Qn[i];Qn[i++]=null;var f=Qn[i];Qn[i++]=null;var j=Qn[i];Qn[i++]=null;var N=Qn[i];if(Qn[i++]=null,f!==null&&j!==null){var I=f.pending;I===null?j.next=j:(j.next=I.next,I.next=j),f.pending=j}N!==0&&q_(a,j,N)}}function Gc(s,i,a,f){Qn[Qa++]=s,Qn[Qa++]=i,Qn[Qa++]=a,Qn[Qa++]=f,Tf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Nf(s,i,a,f){return Gc(s,i,a,f),Wc(s)}function na(s,i){return Gc(s,null,null,i),Wc(s)}function q_(s,i,a){s.lanes|=a;var f=s.alternate;f!==null&&(f.lanes|=a);for(var j=!1,N=s.return;N!==null;)N.childLanes|=a,f=N.alternate,f!==null&&(f.childLanes|=a),N.tag===22&&(s=N.stateNode,s===null||s._visibility&1||(j=!0)),s=N,N=N.return;return s.tag===3?(N=s.stateNode,j&&i!==null&&(j=31-It(a),s=N.hiddenUpdates,f=s[j],f===null?s[j]=[i]:f.push(i),i.lane=a|536870912),N):null}function Wc(s){if(50<Il)throw Il=0,zp=null,Error(r(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var eo={};function qk(s,i,a,f){this.tag=s,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zn(s,i,a,f){return new qk(s,i,a,f)}function Mf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Bi(s,i){var a=s.alternate;return a===null?(a=zn(s.tag,i,s.key,s.mode),a.elementType=s.elementType,a.type=s.type,a.stateNode=s.stateNode,a.alternate=s,s.alternate=a):(a.pendingProps=i,a.type=s.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=s.flags&65011712,a.childLanes=s.childLanes,a.lanes=s.lanes,a.child=s.child,a.memoizedProps=s.memoizedProps,a.memoizedState=s.memoizedState,a.updateQueue=s.updateQueue,i=s.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=s.sibling,a.index=s.index,a.ref=s.ref,a.refCleanup=s.refCleanup,a}function V_(s,i){s.flags&=65011714;var a=s.alternate;return a===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,i=a.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Kc(s,i,a,f,j,N){var I=0;if(f=s,typeof s=="function")Mf(s)&&(I=1);else if(typeof s=="string")I=Yj(s,a,P.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case M:return s=zn(31,a,i,j),s.elementType=M,s.lanes=N,s;case E:return ia(a.children,j,N,i);case y:I=8,j|=24;break;case b:return s=zn(12,a,i,j|2),s.elementType=b,s.lanes=N,s;case C:return s=zn(13,a,i,j),s.elementType=C,s.lanes=N,s;case x:return s=zn(19,a,i,j),s.elementType=x,s.lanes=N,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case _:I=10;break e;case v:I=9;break e;case k:I=11;break e;case T:I=14;break e;case R:I=16,f=null;break e}I=29,a=Error(r(130,s===null?"null":typeof s,"")),f=null}return i=zn(I,a,i,j),i.elementType=s,i.type=f,i.lanes=N,i}function ia(s,i,a,f){return s=zn(7,s,f,i),s.lanes=a,s}function $f(s,i,a){return s=zn(6,s,null,i),s.lanes=a,s}function G_(s){var i=zn(18,null,null,0);return i.stateNode=s,i}function Df(s,i,a){return i=zn(4,s.children!==null?s.children:[],s.key,i),i.lanes=a,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var W_=new WeakMap;function ei(s,i){if(typeof s=="object"&&s!==null){var a=W_.get(s);return a!==void 0?a:(i={value:s,source:i,stack:Fe(i)},W_.set(s,i),i)}return{value:s,source:i,stack:Fe(i)}}var to=[],so=0,Yc=null,gl=0,ti=[],si=0,Sr=null,Ai=1,Ti="";function zi(s,i){to[so++]=gl,to[so++]=Yc,Yc=s,gl=i}function K_(s,i,a){ti[si++]=Ai,ti[si++]=Ti,ti[si++]=Sr,Sr=s;var f=Ai;s=Ti;var j=32-It(f)-1;f&=~(1<<j),a+=1;var N=32-It(i)+j;if(30<N){var I=j-j%5;N=(f&(1<<I)-1).toString(32),f>>=I,j-=I,Ai=1<<32-It(i)+j|a<<j|f,Ti=N+s}else Ai=1<<N|a<<j|f,Ti=s}function Of(s){s.return!==null&&(zi(s,1),K_(s,1,0))}function Lf(s){for(;s===Yc;)Yc=to[--so],to[so]=null,gl=to[--so],to[so]=null;for(;s===Sr;)Sr=ti[--si],ti[si]=null,Ti=ti[--si],ti[si]=null,Ai=ti[--si],ti[si]=null}function Y_(s,i){ti[si++]=Ai,ti[si++]=Ti,ti[si++]=Sr,Ai=i.id,Ti=i.overflow,Sr=s}var tn=null,cs=null,Ot=!1,wr=null,ni=!1,If=Error(r(519));function xr(s){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vl(ei(i,s)),If}function X_(s){var i=s.stateNode,a=s.type,f=s.memoizedProps;switch(i[kt]=s,i[Xt]=f,a){case"dialog":Tt("cancel",i),Tt("close",i);break;case"iframe":case"object":case"embed":Tt("load",i);break;case"video":case"audio":for(a=0;a<Bl.length;a++)Tt(Bl[a],i);break;case"source":Tt("error",i);break;case"img":case"image":case"link":Tt("error",i),Tt("load",i);break;case"details":Tt("toggle",i);break;case"input":Tt("invalid",i),Ha(i,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Tt("invalid",i);break;case"textarea":Tt("invalid",i),zc(i,f.value,f.defaultValue,f.children)}a=f.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||f.suppressHydrationWarning===!0||fb(i.textContent,a)?(f.popover!=null&&(Tt("beforetoggle",i),Tt("toggle",i)),f.onScroll!=null&&Tt("scroll",i),f.onScrollEnd!=null&&Tt("scrollend",i),f.onClick!=null&&(i.onclick=An),i=!0):i=!1,i||xr(s,!0)}function J_(s){for(tn=s.return;tn;)switch(tn.tag){case 5:case 31:case 13:ni=!1;return;case 27:case 3:ni=!0;return;default:tn=tn.return}}function no(s){if(s!==tn)return!1;if(!Ot)return J_(s),Ot=!0,!1;var i=s.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=s.type,a=!(a!=="form"&&a!=="button")||tm(s.type,s.memoizedProps)),a=!a),a&&cs&&xr(s),J_(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));cs=wb(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));cs=wb(s)}else i===27?(i=cs,Ir(s.type)?(s=am,am=null,cs=s):cs=i):cs=tn?ri(s.stateNode.nextSibling):null;return!0}function ra(){cs=tn=null,Ot=!1}function Pf(){var s=wr;return s!==null&&($n===null?$n=s:$n.push.apply($n,s),wr=null),s}function vl(s){wr===null?wr=[s]:wr.push(s)}var Bf=$(null),aa=null,Hi=null;function Cr(s,i,a){U(Bf,i._currentValue),i._currentValue=a}function Ui(s){s._currentValue=Bf.current,H(Bf)}function zf(s,i,a){for(;s!==null;){var f=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,f!==null&&(f.childLanes|=i)):f!==null&&(f.childLanes&i)!==i&&(f.childLanes|=i),s===a)break;s=s.return}}function Hf(s,i,a,f){var j=s.child;for(j!==null&&(j.return=s);j!==null;){var N=j.dependencies;if(N!==null){var I=j.child;N=N.firstContext;e:for(;N!==null;){var K=N;N=j;for(var ie=0;ie<i.length;ie++)if(K.context===i[ie]){N.lanes|=a,K=N.alternate,K!==null&&(K.lanes|=a),zf(N.return,a,s),f||(I=null);break e}N=K.next}}else if(j.tag===18){if(I=j.return,I===null)throw Error(r(341));I.lanes|=a,N=I.alternate,N!==null&&(N.lanes|=a),zf(I,a,s),I=null}else I=j.child;if(I!==null)I.return=j;else for(I=j;I!==null;){if(I===s){I=null;break}if(j=I.sibling,j!==null){j.return=I.return,I=j;break}I=I.return}j=I}}function io(s,i,a,f){s=null;for(var j=i,N=!1;j!==null;){if(!N){if((j.flags&524288)!==0)N=!0;else if((j.flags&262144)!==0)break}if(j.tag===10){var I=j.alternate;if(I===null)throw Error(r(387));if(I=I.memoizedProps,I!==null){var K=j.type;Bn(j.pendingProps.value,I.value)||(s!==null?s.push(K):s=[K])}}else if(j===X.current){if(I=j.alternate,I===null)throw Error(r(387));I.memoizedState.memoizedState!==j.memoizedState.memoizedState&&(s!==null?s.push(ql):s=[ql])}j=j.return}s!==null&&Hf(i,s,a,f),i.flags|=262144}function Xc(s){for(s=s.firstContext;s!==null;){if(!Bn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function oa(s){aa=s,Hi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function sn(s){return Z_(aa,s)}function Jc(s,i){return aa===null&&oa(s),Z_(s,i)}function Z_(s,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Hi===null){if(s===null)throw Error(r(308));Hi=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Hi=Hi.next=i;return a}var Vk=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(a,f){s.push(f)}};this.abort=function(){i.aborted=!0,s.forEach(function(a){return a()})}},Gk=e.unstable_scheduleCallback,Wk=e.unstable_NormalPriority,Os={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uf(){return{controller:new Vk,data:new Map,refCount:0}}function _l(s){s.refCount--,s.refCount===0&&Gk(Wk,function(){s.controller.abort()})}var yl=null,Ff=0,ro=0,ao=null;function Kk(s,i){if(yl===null){var a=yl=[];Ff=0,ro=Gp(),ao={status:"pending",value:void 0,then:function(f){a.push(f)}}}return Ff++,i.then(Q_,Q_),i}function Q_(){if(--Ff===0&&yl!==null){ao!==null&&(ao.status="fulfilled");var s=yl;yl=null,ro=0,ao=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function Yk(s,i){var a=[],f={status:"pending",value:null,reason:null,then:function(j){a.push(j)}};return s.then(function(){f.status="fulfilled",f.value=i;for(var j=0;j<a.length;j++)(0,a[j])(i)},function(j){for(f.status="rejected",f.reason=j,j=0;j<a.length;j++)(0,a[j])(void 0)}),f}var ey=G.S;G.S=function(s,i){I0=Ct(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Kk(s,i),ey!==null&&ey(s,i)};var la=$(null);function qf(){var s=la.current;return s!==null?s:ns.pooledCache}function Zc(s,i){i===null?U(la,la.current):U(la,i.pool)}function ty(){var s=qf();return s===null?null:{parent:Os._currentValue,pool:s}}var oo=Error(r(460)),Vf=Error(r(474)),Qc=Error(r(542)),eu={then:function(){}};function sy(s){return s=s.status,s==="fulfilled"||s==="rejected"}function ny(s,i,a){switch(a=s[a],a===void 0?s.push(i):a!==i&&(i.then(An,An),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ry(s),s;default:if(typeof i.status=="string")i.then(An,An);else{if(s=ns,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=i,s.status="pending",s.then(function(f){if(i.status==="pending"){var j=i;j.status="fulfilled",j.value=f}},function(f){if(i.status==="pending"){var j=i;j.status="rejected",j.reason=f}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ry(s),s}throw ua=i,oo}}function ca(s){try{var i=s._init;return i(s._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ua=a,oo):a}}var ua=null;function iy(){if(ua===null)throw Error(r(459));var s=ua;return ua=null,s}function ry(s){if(s===oo||s===Qc)throw Error(r(483))}var lo=null,bl=0;function tu(s){var i=bl;return bl+=1,lo===null&&(lo=[]),ny(lo,s,i)}function Sl(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function su(s,i){throw i.$$typeof===S?Error(r(525)):(s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function ay(s){function i(de,ae){if(s){var me=de.deletions;me===null?(de.deletions=[ae],de.flags|=16):me.push(ae)}}function a(de,ae){if(!s)return null;for(;ae!==null;)i(de,ae),ae=ae.sibling;return null}function f(de){for(var ae=new Map;de!==null;)de.key!==null?ae.set(de.key,de):ae.set(de.index,de),de=de.sibling;return ae}function j(de,ae){return de=Bi(de,ae),de.index=0,de.sibling=null,de}function N(de,ae,me){return de.index=me,s?(me=de.alternate,me!==null?(me=me.index,me<ae?(de.flags|=67108866,ae):me):(de.flags|=67108866,ae)):(de.flags|=1048576,ae)}function I(de){return s&&de.alternate===null&&(de.flags|=67108866),de}function K(de,ae,me,ke){return ae===null||ae.tag!==6?(ae=$f(me,de.mode,ke),ae.return=de,ae):(ae=j(ae,me),ae.return=de,ae)}function ie(de,ae,me,ke){var et=me.type;return et===E?Ce(de,ae,me.props.children,ke,me.key):ae!==null&&(ae.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===R&&ca(et)===ae.type)?(ae=j(ae,me.props),Sl(ae,me),ae.return=de,ae):(ae=Kc(me.type,me.key,me.props,null,de.mode,ke),Sl(ae,me),ae.return=de,ae)}function ge(de,ae,me,ke){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==me.containerInfo||ae.stateNode.implementation!==me.implementation?(ae=Df(me,de.mode,ke),ae.return=de,ae):(ae=j(ae,me.children||[]),ae.return=de,ae)}function Ce(de,ae,me,ke,et){return ae===null||ae.tag!==7?(ae=ia(me,de.mode,ke,et),ae.return=de,ae):(ae=j(ae,me),ae.return=de,ae)}function Re(de,ae,me){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ae=$f(""+ae,de.mode,me),ae.return=de,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case w:return me=Kc(ae.type,ae.key,ae.props,null,de.mode,me),Sl(me,ae),me.return=de,me;case A:return ae=Df(ae,de.mode,me),ae.return=de,ae;case R:return ae=ca(ae),Re(de,ae,me)}if(Q(ae)||q(ae))return ae=ia(ae,de.mode,me,null),ae.return=de,ae;if(typeof ae.then=="function")return Re(de,tu(ae),me);if(ae.$$typeof===_)return Re(de,Jc(de,ae),me);su(de,ae)}return null}function ve(de,ae,me,ke){var et=ae!==null?ae.key:null;if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return et!==null?null:K(de,ae,""+me,ke);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case w:return me.key===et?ie(de,ae,me,ke):null;case A:return me.key===et?ge(de,ae,me,ke):null;case R:return me=ca(me),ve(de,ae,me,ke)}if(Q(me)||q(me))return et!==null?null:Ce(de,ae,me,ke,null);if(typeof me.then=="function")return ve(de,ae,tu(me),ke);if(me.$$typeof===_)return ve(de,ae,Jc(de,me),ke);su(de,me)}return null}function we(de,ae,me,ke,et){if(typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint")return de=de.get(me)||null,K(ae,de,""+ke,et);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case w:return de=de.get(ke.key===null?me:ke.key)||null,ie(ae,de,ke,et);case A:return de=de.get(ke.key===null?me:ke.key)||null,ge(ae,de,ke,et);case R:return ke=ca(ke),we(de,ae,me,ke,et)}if(Q(ke)||q(ke))return de=de.get(me)||null,Ce(ae,de,ke,et,null);if(typeof ke.then=="function")return we(de,ae,me,tu(ke),et);if(ke.$$typeof===_)return we(de,ae,me,Jc(ae,ke),et);su(ae,ke)}return null}function qe(de,ae,me,ke){for(var et=null,zt=null,Ke=ae,yt=ae=0,$t=null;Ke!==null&&yt<me.length;yt++){Ke.index>yt?($t=Ke,Ke=null):$t=Ke.sibling;var Ht=ve(de,Ke,me[yt],ke);if(Ht===null){Ke===null&&(Ke=$t);break}s&&Ke&&Ht.alternate===null&&i(de,Ke),ae=N(Ht,ae,yt),zt===null?et=Ht:zt.sibling=Ht,zt=Ht,Ke=$t}if(yt===me.length)return a(de,Ke),Ot&&zi(de,yt),et;if(Ke===null){for(;yt<me.length;yt++)Ke=Re(de,me[yt],ke),Ke!==null&&(ae=N(Ke,ae,yt),zt===null?et=Ke:zt.sibling=Ke,zt=Ke);return Ot&&zi(de,yt),et}for(Ke=f(Ke);yt<me.length;yt++)$t=we(Ke,de,yt,me[yt],ke),$t!==null&&(s&&$t.alternate!==null&&Ke.delete($t.key===null?yt:$t.key),ae=N($t,ae,yt),zt===null?et=$t:zt.sibling=$t,zt=$t);return s&&Ke.forEach(function(Ur){return i(de,Ur)}),Ot&&zi(de,yt),et}function nt(de,ae,me,ke){if(me==null)throw Error(r(151));for(var et=null,zt=null,Ke=ae,yt=ae=0,$t=null,Ht=me.next();Ke!==null&&!Ht.done;yt++,Ht=me.next()){Ke.index>yt?($t=Ke,Ke=null):$t=Ke.sibling;var Ur=ve(de,Ke,Ht.value,ke);if(Ur===null){Ke===null&&(Ke=$t);break}s&&Ke&&Ur.alternate===null&&i(de,Ke),ae=N(Ur,ae,yt),zt===null?et=Ur:zt.sibling=Ur,zt=Ur,Ke=$t}if(Ht.done)return a(de,Ke),Ot&&zi(de,yt),et;if(Ke===null){for(;!Ht.done;yt++,Ht=me.next())Ht=Re(de,Ht.value,ke),Ht!==null&&(ae=N(Ht,ae,yt),zt===null?et=Ht:zt.sibling=Ht,zt=Ht);return Ot&&zi(de,yt),et}for(Ke=f(Ke);!Ht.done;yt++,Ht=me.next())Ht=we(Ke,de,yt,Ht.value,ke),Ht!==null&&(s&&Ht.alternate!==null&&Ke.delete(Ht.key===null?yt:Ht.key),ae=N(Ht,ae,yt),zt===null?et=Ht:zt.sibling=Ht,zt=Ht);return s&&Ke.forEach(function(aR){return i(de,aR)}),Ot&&zi(de,yt),et}function es(de,ae,me,ke){if(typeof me=="object"&&me!==null&&me.type===E&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case w:e:{for(var et=me.key;ae!==null;){if(ae.key===et){if(et=me.type,et===E){if(ae.tag===7){a(de,ae.sibling),ke=j(ae,me.props.children),ke.return=de,de=ke;break e}}else if(ae.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===R&&ca(et)===ae.type){a(de,ae.sibling),ke=j(ae,me.props),Sl(ke,me),ke.return=de,de=ke;break e}a(de,ae);break}else i(de,ae);ae=ae.sibling}me.type===E?(ke=ia(me.props.children,de.mode,ke,me.key),ke.return=de,de=ke):(ke=Kc(me.type,me.key,me.props,null,de.mode,ke),Sl(ke,me),ke.return=de,de=ke)}return I(de);case A:e:{for(et=me.key;ae!==null;){if(ae.key===et)if(ae.tag===4&&ae.stateNode.containerInfo===me.containerInfo&&ae.stateNode.implementation===me.implementation){a(de,ae.sibling),ke=j(ae,me.children||[]),ke.return=de,de=ke;break e}else{a(de,ae);break}else i(de,ae);ae=ae.sibling}ke=Df(me,de.mode,ke),ke.return=de,de=ke}return I(de);case R:return me=ca(me),es(de,ae,me,ke)}if(Q(me))return qe(de,ae,me,ke);if(q(me)){if(et=q(me),typeof et!="function")throw Error(r(150));return me=et.call(me),nt(de,ae,me,ke)}if(typeof me.then=="function")return es(de,ae,tu(me),ke);if(me.$$typeof===_)return es(de,ae,Jc(de,me),ke);su(de,me)}return typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint"?(me=""+me,ae!==null&&ae.tag===6?(a(de,ae.sibling),ke=j(ae,me),ke.return=de,de=ke):(a(de,ae),ke=$f(me,de.mode,ke),ke.return=de,de=ke),I(de)):a(de,ae)}return function(de,ae,me,ke){try{bl=0;var et=es(de,ae,me,ke);return lo=null,et}catch(Ke){if(Ke===oo||Ke===Qc)throw Ke;var zt=zn(29,Ke,null,de.mode);return zt.lanes=ke,zt.return=de,zt}finally{}}}var da=ay(!0),oy=ay(!1),Er=!1;function Gf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wf(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function kr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function jr(s,i,a){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(Ft&2)!==0){var j=f.pending;return j===null?i.next=i:(i.next=j.next,j.next=i),f.pending=i,i=Wc(s),q_(s,null,a),i}return Gc(s,f,i,a),Wc(s)}function wl(s,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var f=i.lanes;f&=s.pendingLanes,a|=f,i.lanes=a,kn(s,a)}}function Kf(s,i){var a=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var j=null,N=null;if(a=a.firstBaseUpdate,a!==null){do{var I={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};N===null?j=N=I:N=N.next=I,a=a.next}while(a!==null);N===null?j=N=i:N=N.next=i}else j=N=i;a={baseState:f.baseState,firstBaseUpdate:j,lastBaseUpdate:N,shared:f.shared,callbacks:f.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=i:s.next=i,a.lastBaseUpdate=i}var Yf=!1;function xl(){if(Yf){var s=ao;if(s!==null)throw s}}function Cl(s,i,a,f){Yf=!1;var j=s.updateQueue;Er=!1;var N=j.firstBaseUpdate,I=j.lastBaseUpdate,K=j.shared.pending;if(K!==null){j.shared.pending=null;var ie=K,ge=ie.next;ie.next=null,I===null?N=ge:I.next=ge,I=ie;var Ce=s.alternate;Ce!==null&&(Ce=Ce.updateQueue,K=Ce.lastBaseUpdate,K!==I&&(K===null?Ce.firstBaseUpdate=ge:K.next=ge,Ce.lastBaseUpdate=ie))}if(N!==null){var Re=j.baseState;I=0,Ce=ge=ie=null,K=N;do{var ve=K.lane&-536870913,we=ve!==K.lane;if(we?(Mt&ve)===ve:(f&ve)===ve){ve!==0&&ve===ro&&(Yf=!0),Ce!==null&&(Ce=Ce.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var qe=s,nt=K;ve=i;var es=a;switch(nt.tag){case 1:if(qe=nt.payload,typeof qe=="function"){Re=qe.call(es,Re,ve);break e}Re=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=nt.payload,ve=typeof qe=="function"?qe.call(es,Re,ve):qe,ve==null)break e;Re=p({},Re,ve);break e;case 2:Er=!0}}ve=K.callback,ve!==null&&(s.flags|=64,we&&(s.flags|=8192),we=j.callbacks,we===null?j.callbacks=[ve]:we.push(ve))}else we={lane:ve,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ce===null?(ge=Ce=we,ie=Re):Ce=Ce.next=we,I|=ve;if(K=K.next,K===null){if(K=j.shared.pending,K===null)break;we=K,K=we.next,we.next=null,j.lastBaseUpdate=we,j.shared.pending=null}}while(!0);Ce===null&&(ie=Re),j.baseState=ie,j.firstBaseUpdate=ge,j.lastBaseUpdate=Ce,N===null&&(j.shared.lanes=0),Mr|=I,s.lanes=I,s.memoizedState=Re}}function ly(s,i){if(typeof s!="function")throw Error(r(191,s));s.call(i)}function cy(s,i){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;s<a.length;s++)ly(a[s],i)}var co=$(null),nu=$(0);function uy(s,i){s=Ji,U(nu,s),U(co,i),Ji=s|i.baseLanes}function Xf(){U(nu,Ji),U(co,co.current)}function Jf(){Ji=nu.current,H(co),H(nu)}var Hn=$(null),ii=null;function Rr(s){var i=s.alternate;U(As,As.current&1),U(Hn,s),ii===null&&(i===null||co.current!==null||i.memoizedState!==null)&&(ii=s)}function Zf(s){U(As,As.current),U(Hn,s),ii===null&&(ii=s)}function dy(s){s.tag===22?(U(As,As.current),U(Hn,s),ii===null&&(ii=s)):Ar()}function Ar(){U(As,As.current),U(Hn,Hn.current)}function Un(s){H(Hn),ii===s&&(ii=null),H(As)}var As=$(0);function iu(s){for(var i=s;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||im(a)||rm(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Fi=0,vt=null,Zt=null,Ls=null,ru=!1,uo=!1,ha=!1,au=0,El=0,ho=null,Xk=0;function Cs(){throw Error(r(321))}function Qf(s,i){if(i===null)return!1;for(var a=0;a<i.length&&a<s.length;a++)if(!Bn(s[a],i[a]))return!1;return!0}function ep(s,i,a,f,j,N){return Fi=N,vt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,G.H=s===null||s.memoizedState===null?Ky:mp,ha=!1,N=a(f,j),ha=!1,uo&&(N=fy(i,a,f,j)),hy(s),N}function hy(s){G.H=Rl;var i=Zt!==null&&Zt.next!==null;if(Fi=0,Ls=Zt=vt=null,ru=!1,El=0,ho=null,i)throw Error(r(300));s===null||Is||(s=s.dependencies,s!==null&&Xc(s)&&(Is=!0))}function fy(s,i,a,f){vt=s;var j=0;do{if(uo&&(ho=null),El=0,uo=!1,25<=j)throw Error(r(301));if(j+=1,Ls=Zt=null,s.updateQueue!=null){var N=s.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}G.H=Yy,N=i(a,f)}while(uo);return N}function Jk(){var s=G.H,i=s.useState()[0];return i=typeof i.then=="function"?kl(i):i,s=s.useState()[0],(Zt!==null?Zt.memoizedState:null)!==s&&(vt.flags|=1024),i}function tp(){var s=au!==0;return au=0,s}function sp(s,i,a){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~a}function np(s){if(ru){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}ru=!1}Fi=0,Ls=Zt=vt=null,uo=!1,El=au=0,ho=null}function yn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ls===null?vt.memoizedState=Ls=s:Ls=Ls.next=s,Ls}function Ts(){if(Zt===null){var s=vt.alternate;s=s!==null?s.memoizedState:null}else s=Zt.next;var i=Ls===null?vt.memoizedState:Ls.next;if(i!==null)Ls=i,Zt=s;else{if(s===null)throw vt.alternate===null?Error(r(467)):Error(r(310));Zt=s,s={memoizedState:Zt.memoizedState,baseState:Zt.baseState,baseQueue:Zt.baseQueue,queue:Zt.queue,next:null},Ls===null?vt.memoizedState=Ls=s:Ls=Ls.next=s}return Ls}function ou(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function kl(s){var i=El;return El+=1,ho===null&&(ho=[]),s=ny(ho,s,i),i=vt,(Ls===null?i.memoizedState:Ls.next)===null&&(i=i.alternate,G.H=i===null||i.memoizedState===null?Ky:mp),s}function lu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return kl(s);if(s.$$typeof===_)return sn(s)}throw Error(r(438,String(s)))}function ip(s){var i=null,a=vt.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var f=vt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(i={data:f.data.map(function(j){return j.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=ou(),vt.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(s),f=0;f<s;f++)a[f]=D;return i.index++,a}function qi(s,i){return typeof i=="function"?i(s):i}function cu(s){var i=Ts();return rp(i,Zt,s)}function rp(s,i,a){var f=s.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=a;var j=s.baseQueue,N=f.pending;if(N!==null){if(j!==null){var I=j.next;j.next=N.next,N.next=I}i.baseQueue=j=N,f.pending=null}if(N=s.baseState,j===null)s.memoizedState=N;else{i=j.next;var K=I=null,ie=null,ge=i,Ce=!1;do{var Re=ge.lane&-536870913;if(Re!==ge.lane?(Mt&Re)===Re:(Fi&Re)===Re){var ve=ge.revertLane;if(ve===0)ie!==null&&(ie=ie.next={lane:0,revertLane:0,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),Re===ro&&(Ce=!0);else if((Fi&ve)===ve){ge=ge.next,ve===ro&&(Ce=!0);continue}else Re={lane:0,revertLane:ge.revertLane,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},ie===null?(K=ie=Re,I=N):ie=ie.next=Re,vt.lanes|=ve,Mr|=ve;Re=ge.action,ha&&a(N,Re),N=ge.hasEagerState?ge.eagerState:a(N,Re)}else ve={lane:Re,revertLane:ge.revertLane,gesture:ge.gesture,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},ie===null?(K=ie=ve,I=N):ie=ie.next=ve,vt.lanes|=Re,Mr|=Re;ge=ge.next}while(ge!==null&&ge!==i);if(ie===null?I=N:ie.next=K,!Bn(N,s.memoizedState)&&(Is=!0,Ce&&(a=ao,a!==null)))throw a;s.memoizedState=N,s.baseState=I,s.baseQueue=ie,f.lastRenderedState=N}return j===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function ap(s){var i=Ts(),a=i.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=s;var f=a.dispatch,j=a.pending,N=i.memoizedState;if(j!==null){a.pending=null;var I=j=j.next;do N=s(N,I.action),I=I.next;while(I!==j);Bn(N,i.memoizedState)||(Is=!0),i.memoizedState=N,i.baseQueue===null&&(i.baseState=N),a.lastRenderedState=N}return[N,f]}function py(s,i,a){var f=vt,j=Ts(),N=Ot;if(N){if(a===void 0)throw Error(r(407));a=a()}else a=i();var I=!Bn((Zt||j).memoizedState,a);if(I&&(j.memoizedState=a,Is=!0),j=j.queue,cp(vy.bind(null,f,j,s),[s]),j.getSnapshot!==i||I||Ls!==null&&Ls.memoizedState.tag&1){if(f.flags|=2048,fo(9,{destroy:void 0},gy.bind(null,f,j,a,i),null),ns===null)throw Error(r(349));N||(Fi&127)!==0||my(f,i,a)}return a}function my(s,i,a){s.flags|=16384,s={getSnapshot:i,value:a},i=vt.updateQueue,i===null?(i=ou(),vt.updateQueue=i,i.stores=[s]):(a=i.stores,a===null?i.stores=[s]:a.push(s))}function gy(s,i,a,f){i.value=a,i.getSnapshot=f,_y(i)&&yy(s)}function vy(s,i,a){return a(function(){_y(i)&&yy(s)})}function _y(s){var i=s.getSnapshot;s=s.value;try{var a=i();return!Bn(s,a)}catch{return!0}}function yy(s){var i=na(s,2);i!==null&&Dn(i,s,2)}function op(s){var i=yn();if(typeof s=="function"){var a=s;if(s=a(),ha){Et(!0);try{a()}finally{Et(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:s},i}function by(s,i,a,f){return s.baseState=a,rp(s,Zt,typeof f=="function"?f:qi)}function Zk(s,i,a,f,j){if(hu(s))throw Error(r(485));if(s=i.action,s!==null){var N={payload:j,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){N.listeners.push(I)}};G.T!==null?a(!0):N.isTransition=!1,f(N),a=i.pending,a===null?(N.next=i.pending=N,Sy(i,N)):(N.next=a.next,i.pending=a.next=N)}}function Sy(s,i){var a=i.action,f=i.payload,j=s.state;if(i.isTransition){var N=G.T,I={};G.T=I;try{var K=a(j,f),ie=G.S;ie!==null&&ie(I,K),wy(s,i,K)}catch(ge){lp(s,i,ge)}finally{N!==null&&I.types!==null&&(N.types=I.types),G.T=N}}else try{N=a(j,f),wy(s,i,N)}catch(ge){lp(s,i,ge)}}function wy(s,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(f){xy(s,i,f)},function(f){return lp(s,i,f)}):xy(s,i,a)}function xy(s,i,a){i.status="fulfilled",i.value=a,Cy(i),s.state=a,i=s.pending,i!==null&&(a=i.next,a===i?s.pending=null:(a=a.next,i.next=a,Sy(s,a)))}function lp(s,i,a){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do i.status="rejected",i.reason=a,Cy(i),i=i.next;while(i!==f)}s.action=null}function Cy(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function Ey(s,i){return i}function ky(s,i){if(Ot){var a=ns.formState;if(a!==null){e:{var f=vt;if(Ot){if(cs){t:{for(var j=cs,N=ni;j.nodeType!==8;){if(!N){j=null;break t}if(j=ri(j.nextSibling),j===null){j=null;break t}}N=j.data,j=N==="F!"||N==="F"?j:null}if(j){cs=ri(j.nextSibling),f=j.data==="F!";break e}}xr(f)}f=!1}f&&(i=a[0])}}return a=yn(),a.memoizedState=a.baseState=i,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ey,lastRenderedState:i},a.queue=f,a=Vy.bind(null,vt,f),f.dispatch=a,f=op(!1),N=pp.bind(null,vt,!1,f.queue),f=yn(),j={state:i,dispatch:null,action:s,pending:null},f.queue=j,a=Zk.bind(null,vt,j,N,a),j.dispatch=a,f.memoizedState=s,[i,a,!1]}function jy(s){var i=Ts();return Ry(i,Zt,s)}function Ry(s,i,a){if(i=rp(s,i,Ey)[0],s=cu(qi)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var f=kl(i)}catch(I){throw I===oo?Qc:I}else f=i;i=Ts();var j=i.queue,N=j.dispatch;return a!==i.memoizedState&&(vt.flags|=2048,fo(9,{destroy:void 0},Qk.bind(null,j,a),null)),[f,N,s]}function Qk(s,i){s.action=i}function Ay(s){var i=Ts(),a=Zt;if(a!==null)return Ry(i,a,s);Ts(),i=i.memoizedState,a=Ts();var f=a.queue.dispatch;return a.memoizedState=s,[i,f,!1]}function fo(s,i,a,f){return s={tag:s,create:a,deps:f,inst:i,next:null},i=vt.updateQueue,i===null&&(i=ou(),vt.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=s.next=s:(f=a.next,a.next=s,s.next=f,i.lastEffect=s),s}function Ty(){return Ts().memoizedState}function uu(s,i,a,f){var j=yn();vt.flags|=s,j.memoizedState=fo(1|i,{destroy:void 0},a,f===void 0?null:f)}function du(s,i,a,f){var j=Ts();f=f===void 0?null:f;var N=j.memoizedState.inst;Zt!==null&&f!==null&&Qf(f,Zt.memoizedState.deps)?j.memoizedState=fo(i,N,a,f):(vt.flags|=s,j.memoizedState=fo(1|i,N,a,f))}function Ny(s,i){uu(8390656,8,s,i)}function cp(s,i){du(2048,8,s,i)}function ej(s){vt.flags|=4;var i=vt.updateQueue;if(i===null)i=ou(),vt.updateQueue=i,i.events=[s];else{var a=i.events;a===null?i.events=[s]:a.push(s)}}function My(s){var i=Ts().memoizedState;return ej({ref:i,nextImpl:s}),function(){if((Ft&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function $y(s,i){return du(4,2,s,i)}function Dy(s,i){return du(4,4,s,i)}function Oy(s,i){if(typeof i=="function"){s=s();var a=i(s);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function Ly(s,i,a){a=a!=null?a.concat([s]):null,du(4,4,Oy.bind(null,i,s),a)}function up(){}function Iy(s,i){var a=Ts();i=i===void 0?null:i;var f=a.memoizedState;return i!==null&&Qf(i,f[1])?f[0]:(a.memoizedState=[s,i],s)}function Py(s,i){var a=Ts();i=i===void 0?null:i;var f=a.memoizedState;if(i!==null&&Qf(i,f[1]))return f[0];if(f=s(),ha){Et(!0);try{s()}finally{Et(!1)}}return a.memoizedState=[f,i],f}function dp(s,i,a){return a===void 0||(Fi&1073741824)!==0&&(Mt&261930)===0?s.memoizedState=i:(s.memoizedState=a,s=B0(),vt.lanes|=s,Mr|=s,a)}function By(s,i,a,f){return Bn(a,i)?a:co.current!==null?(s=dp(s,a,f),Bn(s,i)||(Is=!0),s):(Fi&42)===0||(Fi&1073741824)!==0&&(Mt&261930)===0?(Is=!0,s.memoizedState=a):(s=B0(),vt.lanes|=s,Mr|=s,i)}function zy(s,i,a,f,j){var N=ee.p;ee.p=N!==0&&8>N?N:8;var I=G.T,K={};G.T=K,pp(s,!1,i,a);try{var ie=j(),ge=G.S;if(ge!==null&&ge(K,ie),ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var Ce=Yk(ie,f);jl(s,i,Ce,Vn(s))}else jl(s,i,f,Vn(s))}catch(Re){jl(s,i,{then:function(){},status:"rejected",reason:Re},Vn())}finally{ee.p=N,I!==null&&K.types!==null&&(I.types=K.types),G.T=I}}function tj(){}function hp(s,i,a,f){if(s.tag!==5)throw Error(r(476));var j=Hy(s).queue;zy(s,j,i,ne,a===null?tj:function(){return Uy(s),a(f)})}function Hy(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:ne},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:a},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function Uy(s){var i=Hy(s);i.next===null&&(i=s.alternate.memoizedState),jl(s,i.next.queue,{},Vn())}function fp(){return sn(ql)}function Fy(){return Ts().memoizedState}function qy(){return Ts().memoizedState}function sj(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var a=Vn();s=kr(a);var f=jr(i,s,a);f!==null&&(Dn(f,i,a),wl(f,i,a)),i={cache:Uf()},s.payload=i;return}i=i.return}}function nj(s,i,a){var f=Vn();a={lane:f,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},hu(s)?Gy(i,a):(a=Nf(s,i,a,f),a!==null&&(Dn(a,s,f),Wy(a,i,f)))}function Vy(s,i,a){var f=Vn();jl(s,i,a,f)}function jl(s,i,a,f){var j={lane:f,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(hu(s))Gy(i,j);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=i.lastRenderedReducer,N!==null))try{var I=i.lastRenderedState,K=N(I,a);if(j.hasEagerState=!0,j.eagerState=K,Bn(K,I))return Gc(s,i,j,0),ns===null&&Vc(),!1}catch{}finally{}if(a=Nf(s,i,j,f),a!==null)return Dn(a,s,f),Wy(a,i,f),!0}return!1}function pp(s,i,a,f){if(f={lane:2,revertLane:Gp(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hu(s)){if(i)throw Error(r(479))}else i=Nf(s,a,f,2),i!==null&&Dn(i,s,2)}function hu(s){var i=s.alternate;return s===vt||i!==null&&i===vt}function Gy(s,i){uo=ru=!0;var a=s.pending;a===null?i.next=i:(i.next=a.next,a.next=i),s.pending=i}function Wy(s,i,a){if((a&4194048)!==0){var f=i.lanes;f&=s.pendingLanes,a|=f,i.lanes=a,kn(s,a)}}var Rl={readContext:sn,use:lu,useCallback:Cs,useContext:Cs,useEffect:Cs,useImperativeHandle:Cs,useLayoutEffect:Cs,useInsertionEffect:Cs,useMemo:Cs,useReducer:Cs,useRef:Cs,useState:Cs,useDebugValue:Cs,useDeferredValue:Cs,useTransition:Cs,useSyncExternalStore:Cs,useId:Cs,useHostTransitionStatus:Cs,useFormState:Cs,useActionState:Cs,useOptimistic:Cs,useMemoCache:Cs,useCacheRefresh:Cs};Rl.useEffectEvent=Cs;var Ky={readContext:sn,use:lu,useCallback:function(s,i){return yn().memoizedState=[s,i===void 0?null:i],s},useContext:sn,useEffect:Ny,useImperativeHandle:function(s,i,a){a=a!=null?a.concat([s]):null,uu(4194308,4,Oy.bind(null,i,s),a)},useLayoutEffect:function(s,i){return uu(4194308,4,s,i)},useInsertionEffect:function(s,i){uu(4,2,s,i)},useMemo:function(s,i){var a=yn();i=i===void 0?null:i;var f=s();if(ha){Et(!0);try{s()}finally{Et(!1)}}return a.memoizedState=[f,i],f},useReducer:function(s,i,a){var f=yn();if(a!==void 0){var j=a(i);if(ha){Et(!0);try{a(i)}finally{Et(!1)}}}else j=i;return f.memoizedState=f.baseState=j,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:j},f.queue=s,s=s.dispatch=nj.bind(null,vt,s),[f.memoizedState,s]},useRef:function(s){var i=yn();return s={current:s},i.memoizedState=s},useState:function(s){s=op(s);var i=s.queue,a=Vy.bind(null,vt,i);return i.dispatch=a,[s.memoizedState,a]},useDebugValue:up,useDeferredValue:function(s,i){var a=yn();return dp(a,s,i)},useTransition:function(){var s=op(!1);return s=zy.bind(null,vt,s.queue,!0,!1),yn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,a){var f=vt,j=yn();if(Ot){if(a===void 0)throw Error(r(407));a=a()}else{if(a=i(),ns===null)throw Error(r(349));(Mt&127)!==0||my(f,i,a)}j.memoizedState=a;var N={value:a,getSnapshot:i};return j.queue=N,Ny(vy.bind(null,f,N,s),[s]),f.flags|=2048,fo(9,{destroy:void 0},gy.bind(null,f,N,a,i),null),a},useId:function(){var s=yn(),i=ns.identifierPrefix;if(Ot){var a=Ti,f=Ai;a=(f&~(1<<32-It(f)-1)).toString(32)+a,i="_"+i+"R_"+a,a=au++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Xk++,i="_"+i+"r_"+a.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:fp,useFormState:ky,useActionState:ky,useOptimistic:function(s){var i=yn();i.memoizedState=i.baseState=s;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=pp.bind(null,vt,!0,a),a.dispatch=i,[s,i]},useMemoCache:ip,useCacheRefresh:function(){return yn().memoizedState=sj.bind(null,vt)},useEffectEvent:function(s){var i=yn(),a={impl:s};return i.memoizedState=a,function(){if((Ft&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},mp={readContext:sn,use:lu,useCallback:Iy,useContext:sn,useEffect:cp,useImperativeHandle:Ly,useInsertionEffect:$y,useLayoutEffect:Dy,useMemo:Py,useReducer:cu,useRef:Ty,useState:function(){return cu(qi)},useDebugValue:up,useDeferredValue:function(s,i){var a=Ts();return By(a,Zt.memoizedState,s,i)},useTransition:function(){var s=cu(qi)[0],i=Ts().memoizedState;return[typeof s=="boolean"?s:kl(s),i]},useSyncExternalStore:py,useId:Fy,useHostTransitionStatus:fp,useFormState:jy,useActionState:jy,useOptimistic:function(s,i){var a=Ts();return by(a,Zt,s,i)},useMemoCache:ip,useCacheRefresh:qy};mp.useEffectEvent=My;var Yy={readContext:sn,use:lu,useCallback:Iy,useContext:sn,useEffect:cp,useImperativeHandle:Ly,useInsertionEffect:$y,useLayoutEffect:Dy,useMemo:Py,useReducer:ap,useRef:Ty,useState:function(){return ap(qi)},useDebugValue:up,useDeferredValue:function(s,i){var a=Ts();return Zt===null?dp(a,s,i):By(a,Zt.memoizedState,s,i)},useTransition:function(){var s=ap(qi)[0],i=Ts().memoizedState;return[typeof s=="boolean"?s:kl(s),i]},useSyncExternalStore:py,useId:Fy,useHostTransitionStatus:fp,useFormState:Ay,useActionState:Ay,useOptimistic:function(s,i){var a=Ts();return Zt!==null?by(a,Zt,s,i):(a.baseState=s,[s,a.queue.dispatch])},useMemoCache:ip,useCacheRefresh:qy};Yy.useEffectEvent=My;function gp(s,i,a,f){i=s.memoizedState,a=a(f,i),a=a==null?i:p({},i,a),s.memoizedState=a,s.lanes===0&&(s.updateQueue.baseState=a)}var vp={enqueueSetState:function(s,i,a){s=s._reactInternals;var f=Vn(),j=kr(f);j.payload=i,a!=null&&(j.callback=a),i=jr(s,j,f),i!==null&&(Dn(i,s,f),wl(i,s,f))},enqueueReplaceState:function(s,i,a){s=s._reactInternals;var f=Vn(),j=kr(f);j.tag=1,j.payload=i,a!=null&&(j.callback=a),i=jr(s,j,f),i!==null&&(Dn(i,s,f),wl(i,s,f))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var a=Vn(),f=kr(a);f.tag=2,i!=null&&(f.callback=i),i=jr(s,f,a),i!==null&&(Dn(i,s,a),wl(i,s,a))}};function Xy(s,i,a,f,j,N,I){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,N,I):i.prototype&&i.prototype.isPureReactComponent?!pl(a,f)||!pl(j,N):!0}function Jy(s,i,a,f){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,f),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,f),i.state!==s&&vp.enqueueReplaceState(i,i.state,null)}function fa(s,i){var a=i;if("ref"in i){a={};for(var f in i)f!=="ref"&&(a[f]=i[f])}if(s=s.defaultProps){a===i&&(a=p({},a));for(var j in s)a[j]===void 0&&(a[j]=s[j])}return a}function Zy(s){qc(s)}function Qy(s){console.error(s)}function e0(s){qc(s)}function fu(s,i){try{var a=s.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(f){setTimeout(function(){throw f})}}function t0(s,i,a){try{var f=s.onCaughtError;f(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(j){setTimeout(function(){throw j})}}function _p(s,i,a){return a=kr(a),a.tag=3,a.payload={element:null},a.callback=function(){fu(s,i)},a}function s0(s){return s=kr(s),s.tag=3,s}function n0(s,i,a,f){var j=a.type.getDerivedStateFromError;if(typeof j=="function"){var N=f.value;s.payload=function(){return j(N)},s.callback=function(){t0(i,a,f)}}var I=a.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(s.callback=function(){t0(i,a,f),typeof j!="function"&&($r===null?$r=new Set([this]):$r.add(this));var K=f.stack;this.componentDidCatch(f.value,{componentStack:K!==null?K:""})})}function ij(s,i,a,f,j){if(a.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(i=a.alternate,i!==null&&io(i,a,j,!0),a=Hn.current,a!==null){switch(a.tag){case 31:case 13:return ii===null?Eu():a.alternate===null&&Es===0&&(Es=3),a.flags&=-257,a.flags|=65536,a.lanes=j,f===eu?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([f]):i.add(f),Fp(s,f,j)),!1;case 22:return a.flags|=65536,f===eu?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([f])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([f]):a.add(f)),Fp(s,f,j)),!1}throw Error(r(435,a.tag))}return Fp(s,f,j),Eu(),!1}if(Ot)return i=Hn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=j,f!==If&&(s=Error(r(422),{cause:f}),vl(ei(s,a)))):(f!==If&&(i=Error(r(423),{cause:f}),vl(ei(i,a))),s=s.current.alternate,s.flags|=65536,j&=-j,s.lanes|=j,f=ei(f,a),j=_p(s.stateNode,f,j),Kf(s,j),Es!==4&&(Es=2)),!1;var N=Error(r(520),{cause:f});if(N=ei(N,a),Ll===null?Ll=[N]:Ll.push(N),Es!==4&&(Es=2),i===null)return!0;f=ei(f,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,s=j&-j,a.lanes|=s,s=_p(a.stateNode,f,s),Kf(a,s),!1;case 1:if(i=a.type,N=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&($r===null||!$r.has(N))))return a.flags|=65536,j&=-j,a.lanes|=j,j=s0(j),n0(j,s,a,f),Kf(a,j),!1}a=a.return}while(a!==null);return!1}var yp=Error(r(461)),Is=!1;function nn(s,i,a,f){i.child=s===null?oy(i,null,a,f):da(i,s.child,a,f)}function i0(s,i,a,f,j){a=a.render;var N=i.ref;if("ref"in f){var I={};for(var K in f)K!=="ref"&&(I[K]=f[K])}else I=f;return oa(i),f=ep(s,i,a,I,N,j),K=tp(),s!==null&&!Is?(sp(s,i,j),Vi(s,i,j)):(Ot&&K&&Of(i),i.flags|=1,nn(s,i,f,j),i.child)}function r0(s,i,a,f,j){if(s===null){var N=a.type;return typeof N=="function"&&!Mf(N)&&N.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=N,a0(s,i,N,f,j)):(s=Kc(a.type,null,f,i,i.mode,j),s.ref=i.ref,s.return=i,i.child=s)}if(N=s.child,!jp(s,j)){var I=N.memoizedProps;if(a=a.compare,a=a!==null?a:pl,a(I,f)&&s.ref===i.ref)return Vi(s,i,j)}return i.flags|=1,s=Bi(N,f),s.ref=i.ref,s.return=i,i.child=s}function a0(s,i,a,f,j){if(s!==null){var N=s.memoizedProps;if(pl(N,f)&&s.ref===i.ref)if(Is=!1,i.pendingProps=f=N,jp(s,j))(s.flags&131072)!==0&&(Is=!0);else return i.lanes=s.lanes,Vi(s,i,j)}return bp(s,i,a,f,j)}function o0(s,i,a,f){var j=f.children,N=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((i.flags&128)!==0){if(N=N!==null?N.baseLanes|a:a,s!==null){for(f=i.child=s.child,j=0;f!==null;)j=j|f.lanes|f.childLanes,f=f.sibling;f=j&~N}else f=0,i.child=null;return l0(s,i,N,a,f)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Zc(i,N!==null?N.cachePool:null),N!==null?uy(i,N):Xf(),dy(i);else return f=i.lanes=536870912,l0(s,i,N!==null?N.baseLanes|a:a,a,f)}else N!==null?(Zc(i,N.cachePool),uy(i,N),Ar(),i.memoizedState=null):(s!==null&&Zc(i,null),Xf(),Ar());return nn(s,i,j,a),i.child}function Al(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function l0(s,i,a,f,j){var N=qf();return N=N===null?null:{parent:Os._currentValue,pool:N},i.memoizedState={baseLanes:a,cachePool:N},s!==null&&Zc(i,null),Xf(),dy(i),s!==null&&io(s,i,f,!0),i.childLanes=j,null}function pu(s,i){return i=gu({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function c0(s,i,a){return da(i,s.child,null,a),s=pu(i,i.pendingProps),s.flags|=2,Un(i),i.memoizedState=null,s}function rj(s,i,a){var f=i.pendingProps,j=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(Ot){if(f.mode==="hidden")return s=pu(i,f),i.lanes=536870912,Al(null,s);if(Zf(i),(s=cs)?(s=Sb(s,ni),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:Sr!==null?{id:Ai,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},a=G_(s),a.return=i,i.child=a,tn=i,cs=null)):s=null,s===null)throw xr(i);return i.lanes=536870912,null}return pu(i,f)}var N=s.memoizedState;if(N!==null){var I=N.dehydrated;if(Zf(i),j)if(i.flags&256)i.flags&=-257,i=c0(s,i,a);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(r(558));else if(Is||io(s,i,a,!1),j=(a&s.childLanes)!==0,Is||j){if(f=ns,f!==null&&(I=gi(f,a),I!==0&&I!==N.retryLane))throw N.retryLane=I,na(s,I),Dn(f,s,I),yp;Eu(),i=c0(s,i,a)}else s=N.treeContext,cs=ri(I.nextSibling),tn=i,Ot=!0,wr=null,ni=!1,s!==null&&Y_(i,s),i=pu(i,f),i.flags|=4096;return i}return s=Bi(s.child,{mode:f.mode,children:f.children}),s.ref=i.ref,i.child=s,s.return=i,s}function mu(s,i){var a=i.ref;if(a===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(s===null||s.ref!==a)&&(i.flags|=4194816)}}function bp(s,i,a,f,j){return oa(i),a=ep(s,i,a,f,void 0,j),f=tp(),s!==null&&!Is?(sp(s,i,j),Vi(s,i,j)):(Ot&&f&&Of(i),i.flags|=1,nn(s,i,a,j),i.child)}function u0(s,i,a,f,j,N){return oa(i),i.updateQueue=null,a=fy(i,f,a,j),hy(s),f=tp(),s!==null&&!Is?(sp(s,i,N),Vi(s,i,N)):(Ot&&f&&Of(i),i.flags|=1,nn(s,i,a,N),i.child)}function d0(s,i,a,f,j){if(oa(i),i.stateNode===null){var N=eo,I=a.contextType;typeof I=="object"&&I!==null&&(N=sn(I)),N=new a(f,N),i.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=vp,i.stateNode=N,N._reactInternals=i,N=i.stateNode,N.props=f,N.state=i.memoizedState,N.refs={},Gf(i),I=a.contextType,N.context=typeof I=="object"&&I!==null?sn(I):eo,N.state=i.memoizedState,I=a.getDerivedStateFromProps,typeof I=="function"&&(gp(i,a,I,f),N.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(I=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),I!==N.state&&vp.enqueueReplaceState(N,N.state,null),Cl(i,f,N,j),xl(),N.state=i.memoizedState),typeof N.componentDidMount=="function"&&(i.flags|=4194308),f=!0}else if(s===null){N=i.stateNode;var K=i.memoizedProps,ie=fa(a,K);N.props=ie;var ge=N.context,Ce=a.contextType;I=eo,typeof Ce=="object"&&Ce!==null&&(I=sn(Ce));var Re=a.getDerivedStateFromProps;Ce=typeof Re=="function"||typeof N.getSnapshotBeforeUpdate=="function",K=i.pendingProps!==K,Ce||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(K||ge!==I)&&Jy(i,N,f,I),Er=!1;var ve=i.memoizedState;N.state=ve,Cl(i,f,N,j),xl(),ge=i.memoizedState,K||ve!==ge||Er?(typeof Re=="function"&&(gp(i,a,Re,f),ge=i.memoizedState),(ie=Er||Xy(i,a,ie,f,ve,ge,I))?(Ce||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(i.flags|=4194308)):(typeof N.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=f,i.memoizedState=ge),N.props=f,N.state=ge,N.context=I,f=ie):(typeof N.componentDidMount=="function"&&(i.flags|=4194308),f=!1)}else{N=i.stateNode,Wf(s,i),I=i.memoizedProps,Ce=fa(a,I),N.props=Ce,Re=i.pendingProps,ve=N.context,ge=a.contextType,ie=eo,typeof ge=="object"&&ge!==null&&(ie=sn(ge)),K=a.getDerivedStateFromProps,(ge=typeof K=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(I!==Re||ve!==ie)&&Jy(i,N,f,ie),Er=!1,ve=i.memoizedState,N.state=ve,Cl(i,f,N,j),xl();var we=i.memoizedState;I!==Re||ve!==we||Er||s!==null&&s.dependencies!==null&&Xc(s.dependencies)?(typeof K=="function"&&(gp(i,a,K,f),we=i.memoizedState),(Ce=Er||Xy(i,a,Ce,f,ve,we,ie)||s!==null&&s.dependencies!==null&&Xc(s.dependencies))?(ge||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(f,we,ie),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(f,we,ie)),typeof N.componentDidUpdate=="function"&&(i.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof N.componentDidUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=1024),i.memoizedProps=f,i.memoizedState=we),N.props=f,N.state=we,N.context=ie,f=Ce):(typeof N.componentDidUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=1024),f=!1)}return N=f,mu(s,i),f=(i.flags&128)!==0,N||f?(N=i.stateNode,a=f&&typeof a.getDerivedStateFromError!="function"?null:N.render(),i.flags|=1,s!==null&&f?(i.child=da(i,s.child,null,j),i.child=da(i,null,a,j)):nn(s,i,a,j),i.memoizedState=N.state,s=i.child):s=Vi(s,i,j),s}function h0(s,i,a,f){return ra(),i.flags|=256,nn(s,i,a,f),i.child}var Sp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wp(s){return{baseLanes:s,cachePool:ty()}}function xp(s,i,a){return s=s!==null?s.childLanes&~a:0,i&&(s|=qn),s}function f0(s,i,a){var f=i.pendingProps,j=!1,N=(i.flags&128)!==0,I;if((I=N)||(I=s!==null&&s.memoizedState===null?!1:(As.current&2)!==0),I&&(j=!0,i.flags&=-129),I=(i.flags&32)!==0,i.flags&=-33,s===null){if(Ot){if(j?Rr(i):Ar(),(s=cs)?(s=Sb(s,ni),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:Sr!==null?{id:Ai,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},a=G_(s),a.return=i,i.child=a,tn=i,cs=null)):s=null,s===null)throw xr(i);return rm(s)?i.lanes=32:i.lanes=536870912,null}var K=f.children;return f=f.fallback,j?(Ar(),j=i.mode,K=gu({mode:"hidden",children:K},j),f=ia(f,j,a,null),K.return=i,f.return=i,K.sibling=f,i.child=K,f=i.child,f.memoizedState=wp(a),f.childLanes=xp(s,I,a),i.memoizedState=Sp,Al(null,f)):(Rr(i),Cp(i,K))}var ie=s.memoizedState;if(ie!==null&&(K=ie.dehydrated,K!==null)){if(N)i.flags&256?(Rr(i),i.flags&=-257,i=Ep(s,i,a)):i.memoizedState!==null?(Ar(),i.child=s.child,i.flags|=128,i=null):(Ar(),K=f.fallback,j=i.mode,f=gu({mode:"visible",children:f.children},j),K=ia(K,j,a,null),K.flags|=2,f.return=i,K.return=i,f.sibling=K,i.child=f,da(i,s.child,null,a),f=i.child,f.memoizedState=wp(a),f.childLanes=xp(s,I,a),i.memoizedState=Sp,i=Al(null,f));else if(Rr(i),rm(K)){if(I=K.nextSibling&&K.nextSibling.dataset,I)var ge=I.dgst;I=ge,f=Error(r(419)),f.stack="",f.digest=I,vl({value:f,source:null,stack:null}),i=Ep(s,i,a)}else if(Is||io(s,i,a,!1),I=(a&s.childLanes)!==0,Is||I){if(I=ns,I!==null&&(f=gi(I,a),f!==0&&f!==ie.retryLane))throw ie.retryLane=f,na(s,f),Dn(I,s,f),yp;im(K)||Eu(),i=Ep(s,i,a)}else im(K)?(i.flags|=192,i.child=s.child,i=null):(s=ie.treeContext,cs=ri(K.nextSibling),tn=i,Ot=!0,wr=null,ni=!1,s!==null&&Y_(i,s),i=Cp(i,f.children),i.flags|=4096);return i}return j?(Ar(),K=f.fallback,j=i.mode,ie=s.child,ge=ie.sibling,f=Bi(ie,{mode:"hidden",children:f.children}),f.subtreeFlags=ie.subtreeFlags&65011712,ge!==null?K=Bi(ge,K):(K=ia(K,j,a,null),K.flags|=2),K.return=i,f.return=i,f.sibling=K,i.child=f,Al(null,f),f=i.child,K=s.child.memoizedState,K===null?K=wp(a):(j=K.cachePool,j!==null?(ie=Os._currentValue,j=j.parent!==ie?{parent:ie,pool:ie}:j):j=ty(),K={baseLanes:K.baseLanes|a,cachePool:j}),f.memoizedState=K,f.childLanes=xp(s,I,a),i.memoizedState=Sp,Al(s.child,f)):(Rr(i),a=s.child,s=a.sibling,a=Bi(a,{mode:"visible",children:f.children}),a.return=i,a.sibling=null,s!==null&&(I=i.deletions,I===null?(i.deletions=[s],i.flags|=16):I.push(s)),i.child=a,i.memoizedState=null,a)}function Cp(s,i){return i=gu({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function gu(s,i){return s=zn(22,s,null,i),s.lanes=0,s}function Ep(s,i,a){return da(i,s.child,null,a),s=Cp(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function p0(s,i,a){s.lanes|=i;var f=s.alternate;f!==null&&(f.lanes|=i),zf(s.return,i,a)}function kp(s,i,a,f,j,N){var I=s.memoizedState;I===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:j,treeForkCount:N}:(I.isBackwards=i,I.rendering=null,I.renderingStartTime=0,I.last=f,I.tail=a,I.tailMode=j,I.treeForkCount=N)}function m0(s,i,a){var f=i.pendingProps,j=f.revealOrder,N=f.tail;f=f.children;var I=As.current,K=(I&2)!==0;if(K?(I=I&1|2,i.flags|=128):I&=1,U(As,I),nn(s,i,f,a),f=Ot?gl:0,!K&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&p0(s,a,i);else if(s.tag===19)p0(s,a,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(j){case"forwards":for(a=i.child,j=null;a!==null;)s=a.alternate,s!==null&&iu(s)===null&&(j=a),a=a.sibling;a=j,a===null?(j=i.child,i.child=null):(j=a.sibling,a.sibling=null),kp(i,!1,j,a,N,f);break;case"backwards":case"unstable_legacy-backwards":for(a=null,j=i.child,i.child=null;j!==null;){if(s=j.alternate,s!==null&&iu(s)===null){i.child=j;break}s=j.sibling,j.sibling=a,a=j,j=s}kp(i,!0,a,null,N,f);break;case"together":kp(i,!1,null,null,void 0,f);break;default:i.memoizedState=null}return i.child}function Vi(s,i,a){if(s!==null&&(i.dependencies=s.dependencies),Mr|=i.lanes,(a&i.childLanes)===0)if(s!==null){if(io(s,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,a=Bi(s,s.pendingProps),i.child=a,a.return=i;s.sibling!==null;)s=s.sibling,a=a.sibling=Bi(s,s.pendingProps),a.return=i;a.sibling=null}return i.child}function jp(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&Xc(s)))}function aj(s,i,a){switch(i.tag){case 3:V(i,i.stateNode.containerInfo),Cr(i,Os,s.memoizedState.cache),ra();break;case 27:case 5:oe(i);break;case 4:V(i,i.stateNode.containerInfo);break;case 10:Cr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Zf(i),null;break;case 13:var f=i.memoizedState;if(f!==null)return f.dehydrated!==null?(Rr(i),i.flags|=128,null):(a&i.child.childLanes)!==0?f0(s,i,a):(Rr(i),s=Vi(s,i,a),s!==null?s.sibling:null);Rr(i);break;case 19:var j=(s.flags&128)!==0;if(f=(a&i.childLanes)!==0,f||(io(s,i,a,!1),f=(a&i.childLanes)!==0),j){if(f)return m0(s,i,a);i.flags|=128}if(j=i.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),U(As,As.current),f)break;return null;case 22:return i.lanes=0,o0(s,i,a,i.pendingProps);case 24:Cr(i,Os,s.memoizedState.cache)}return Vi(s,i,a)}function g0(s,i,a){if(s!==null)if(s.memoizedProps!==i.pendingProps)Is=!0;else{if(!jp(s,a)&&(i.flags&128)===0)return Is=!1,aj(s,i,a);Is=(s.flags&131072)!==0}else Is=!1,Ot&&(i.flags&1048576)!==0&&K_(i,gl,i.index);switch(i.lanes=0,i.tag){case 16:e:{var f=i.pendingProps;if(s=ca(i.elementType),i.type=s,typeof s=="function")Mf(s)?(f=fa(s,f),i.tag=1,i=d0(null,i,s,f,a)):(i.tag=0,i=bp(null,i,s,f,a));else{if(s!=null){var j=s.$$typeof;if(j===k){i.tag=11,i=i0(null,i,s,f,a);break e}else if(j===T){i.tag=14,i=r0(null,i,s,f,a);break e}}throw i=Y(s)||s,Error(r(306,i,""))}}return i;case 0:return bp(s,i,i.type,i.pendingProps,a);case 1:return f=i.type,j=fa(f,i.pendingProps),d0(s,i,f,j,a);case 3:e:{if(V(i,i.stateNode.containerInfo),s===null)throw Error(r(387));f=i.pendingProps;var N=i.memoizedState;j=N.element,Wf(s,i),Cl(i,f,null,a);var I=i.memoizedState;if(f=I.cache,Cr(i,Os,f),f!==N.cache&&Hf(i,[Os],a,!0),xl(),f=I.element,N.isDehydrated)if(N={element:f,isDehydrated:!1,cache:I.cache},i.updateQueue.baseState=N,i.memoizedState=N,i.flags&256){i=h0(s,i,f,a);break e}else if(f!==j){j=ei(Error(r(424)),i),vl(j),i=h0(s,i,f,a);break e}else{switch(s=i.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(cs=ri(s.firstChild),tn=i,Ot=!0,wr=null,ni=!0,a=oy(i,null,f,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ra(),f===j){i=Vi(s,i,a);break e}nn(s,i,f,a)}i=i.child}return i;case 26:return mu(s,i),s===null?(a=jb(i.type,null,i.pendingProps,null))?i.memoizedState=a:Ot||(a=i.type,s=i.pendingProps,f=Mu(se.current).createElement(a),f[kt]=i,f[Xt]=s,rn(f,a,s),Ae(f),i.stateNode=f):i.memoizedState=jb(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return oe(i),s===null&&Ot&&(f=i.stateNode=Cb(i.type,i.pendingProps,se.current),tn=i,ni=!0,j=cs,Ir(i.type)?(am=j,cs=ri(f.firstChild)):cs=j),nn(s,i,i.pendingProps.children,a),mu(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&Ot&&((j=f=cs)&&(f=Lj(f,i.type,i.pendingProps,ni),f!==null?(i.stateNode=f,tn=i,cs=ri(f.firstChild),ni=!1,j=!0):j=!1),j||xr(i)),oe(i),j=i.type,N=i.pendingProps,I=s!==null?s.memoizedProps:null,f=N.children,tm(j,N)?f=null:I!==null&&tm(j,I)&&(i.flags|=32),i.memoizedState!==null&&(j=ep(s,i,Jk,null,null,a),ql._currentValue=j),mu(s,i),nn(s,i,f,a),i.child;case 6:return s===null&&Ot&&((s=a=cs)&&(a=Ij(a,i.pendingProps,ni),a!==null?(i.stateNode=a,tn=i,cs=null,s=!0):s=!1),s||xr(i)),null;case 13:return f0(s,i,a);case 4:return V(i,i.stateNode.containerInfo),f=i.pendingProps,s===null?i.child=da(i,null,f,a):nn(s,i,f,a),i.child;case 11:return i0(s,i,i.type,i.pendingProps,a);case 7:return nn(s,i,i.pendingProps,a),i.child;case 8:return nn(s,i,i.pendingProps.children,a),i.child;case 12:return nn(s,i,i.pendingProps.children,a),i.child;case 10:return f=i.pendingProps,Cr(i,i.type,f.value),nn(s,i,f.children,a),i.child;case 9:return j=i.type._context,f=i.pendingProps.children,oa(i),j=sn(j),f=f(j),i.flags|=1,nn(s,i,f,a),i.child;case 14:return r0(s,i,i.type,i.pendingProps,a);case 15:return a0(s,i,i.type,i.pendingProps,a);case 19:return m0(s,i,a);case 31:return rj(s,i,a);case 22:return o0(s,i,a,i.pendingProps);case 24:return oa(i),f=sn(Os),s===null?(j=qf(),j===null&&(j=ns,N=Uf(),j.pooledCache=N,N.refCount++,N!==null&&(j.pooledCacheLanes|=a),j=N),i.memoizedState={parent:f,cache:j},Gf(i),Cr(i,Os,j)):((s.lanes&a)!==0&&(Wf(s,i),Cl(i,null,null,a),xl()),j=s.memoizedState,N=i.memoizedState,j.parent!==f?(j={parent:f,cache:f},i.memoizedState=j,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=j),Cr(i,Os,f)):(f=N.cache,Cr(i,Os,f),f!==j.cache&&Hf(i,[Os],a,!0))),nn(s,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Gi(s){s.flags|=4}function Rp(s,i,a,f,j){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(j&335544128)===j)if(s.stateNode.complete)s.flags|=8192;else if(F0())s.flags|=8192;else throw ua=eu,Vf}else s.flags&=-16777217}function v0(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Mb(i))if(F0())s.flags|=8192;else throw ua=eu,Vf}function vu(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?_n():536870912,s.lanes|=i,vo|=i)}function Tl(s,i){if(!Ot)switch(s.tailMode){case"hidden":i=s.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?s.tail=null:a.sibling=null;break;case"collapsed":a=s.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function us(s){var i=s.alternate!==null&&s.alternate.child===s.child,a=0,f=0;if(i)for(var j=s.child;j!==null;)a|=j.lanes|j.childLanes,f|=j.subtreeFlags&65011712,f|=j.flags&65011712,j.return=s,j=j.sibling;else for(j=s.child;j!==null;)a|=j.lanes|j.childLanes,f|=j.subtreeFlags,f|=j.flags,j.return=s,j=j.sibling;return s.subtreeFlags|=f,s.childLanes=a,i}function oj(s,i,a){var f=i.pendingProps;switch(Lf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return us(i),null;case 1:return us(i),null;case 3:return a=i.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),i.memoizedState.cache!==f&&(i.flags|=2048),Ui(Os),ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(s===null||s.child===null)&&(no(i)?Gi(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Pf())),us(i),null;case 26:var j=i.type,N=i.memoizedState;return s===null?(Gi(i),N!==null?(us(i),v0(i,N)):(us(i),Rp(i,j,null,f,a))):N?N!==s.memoizedState?(Gi(i),us(i),v0(i,N)):(us(i),i.flags&=-16777217):(s=s.memoizedProps,s!==f&&Gi(i),us(i),Rp(i,j,s,f,a)),null;case 27:if(Z(i),a=se.current,j=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==f&&Gi(i);else{if(!f){if(i.stateNode===null)throw Error(r(166));return us(i),null}s=P.current,no(i)?X_(i):(s=Cb(j,f,a),i.stateNode=s,Gi(i))}return us(i),null;case 5:if(Z(i),j=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==f&&Gi(i);else{if(!f){if(i.stateNode===null)throw Error(r(166));return us(i),null}if(N=P.current,no(i))X_(i);else{var I=Mu(se.current);switch(N){case 1:N=I.createElementNS("http://www.w3.org/2000/svg",j);break;case 2:N=I.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;default:switch(j){case"svg":N=I.createElementNS("http://www.w3.org/2000/svg",j);break;case"math":N=I.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;case"script":N=I.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof f.is=="string"?I.createElement("select",{is:f.is}):I.createElement("select"),f.multiple?N.multiple=!0:f.size&&(N.size=f.size);break;default:N=typeof f.is=="string"?I.createElement(j,{is:f.is}):I.createElement(j)}}N[kt]=i,N[Xt]=f;e:for(I=i.child;I!==null;){if(I.tag===5||I.tag===6)N.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===i)break e;for(;I.sibling===null;){if(I.return===null||I.return===i)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}i.stateNode=N;e:switch(rn(N,j,f),j){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Gi(i)}}return us(i),Rp(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,a),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==f&&Gi(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(r(166));if(s=se.current,no(i)){if(s=i.stateNode,a=i.memoizedProps,f=null,j=tn,j!==null)switch(j.tag){case 27:case 5:f=j.memoizedProps}s[kt]=i,s=!!(s.nodeValue===a||f!==null&&f.suppressHydrationWarning===!0||fb(s.nodeValue,a)),s||xr(i,!0)}else s=Mu(s).createTextNode(f),s[kt]=i,i.stateNode=s}return us(i),null;case 31:if(a=i.memoizedState,s===null||s.memoizedState!==null){if(f=no(i),a!==null){if(s===null){if(!f)throw Error(r(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[kt]=i}else ra(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;us(i),s=!1}else a=Pf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return i.flags&256?(Un(i),i):(Un(i),null);if((i.flags&128)!==0)throw Error(r(558))}return us(i),null;case 13:if(f=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(j=no(i),f!==null&&f.dehydrated!==null){if(s===null){if(!j)throw Error(r(318));if(j=i.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(r(317));j[kt]=i}else ra(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;us(i),j=!1}else j=Pf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=j),j=!0;if(!j)return i.flags&256?(Un(i),i):(Un(i),null)}return Un(i),(i.flags&128)!==0?(i.lanes=a,i):(a=f!==null,s=s!==null&&s.memoizedState!==null,a&&(f=i.child,j=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(j=f.alternate.memoizedState.cachePool.pool),N=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(N=f.memoizedState.cachePool.pool),N!==j&&(f.flags|=2048)),a!==s&&a&&(i.child.flags|=8192),vu(i,i.updateQueue),us(i),null);case 4:return ce(),s===null&&Xp(i.stateNode.containerInfo),us(i),null;case 10:return Ui(i.type),us(i),null;case 19:if(H(As),f=i.memoizedState,f===null)return us(i),null;if(j=(i.flags&128)!==0,N=f.rendering,N===null)if(j)Tl(f,!1);else{if(Es!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(N=iu(s),N!==null){for(i.flags|=128,Tl(f,!1),s=N.updateQueue,i.updateQueue=s,vu(i,s),i.subtreeFlags=0,s=a,a=i.child;a!==null;)V_(a,s),a=a.sibling;return U(As,As.current&1|2),Ot&&zi(i,f.treeForkCount),i.child}s=s.sibling}f.tail!==null&&Ct()>wu&&(i.flags|=128,j=!0,Tl(f,!1),i.lanes=4194304)}else{if(!j)if(s=iu(N),s!==null){if(i.flags|=128,j=!0,s=s.updateQueue,i.updateQueue=s,vu(i,s),Tl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!N.alternate&&!Ot)return us(i),null}else 2*Ct()-f.renderingStartTime>wu&&a!==536870912&&(i.flags|=128,j=!0,Tl(f,!1),i.lanes=4194304);f.isBackwards?(N.sibling=i.child,i.child=N):(s=f.last,s!==null?s.sibling=N:i.child=N,f.last=N)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=Ct(),s.sibling=null,a=As.current,U(As,j?a&1|2:a&1),Ot&&zi(i,f.treeForkCount),s):(us(i),null);case 22:case 23:return Un(i),Jf(),f=i.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(a&536870912)!==0&&(i.flags&128)===0&&(us(i),i.subtreeFlags&6&&(i.flags|=8192)):us(i),a=i.updateQueue,a!==null&&vu(i,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==a&&(i.flags|=2048),s!==null&&H(la),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Ui(Os),us(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function lj(s,i){switch(Lf(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ui(Os),ce(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return Z(i),null;case 31:if(i.memoizedState!==null){if(Un(i),i.alternate===null)throw Error(r(340));ra()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(Un(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ra()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return H(As),null;case 4:return ce(),null;case 10:return Ui(i.type),null;case 22:case 23:return Un(i),Jf(),s!==null&&H(la),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Ui(Os),null;case 25:return null;default:return null}}function _0(s,i){switch(Lf(i),i.tag){case 3:Ui(Os),ce();break;case 26:case 27:case 5:Z(i);break;case 4:ce();break;case 31:i.memoizedState!==null&&Un(i);break;case 13:Un(i);break;case 19:H(As);break;case 10:Ui(i.type);break;case 22:case 23:Un(i),Jf(),s!==null&&H(la);break;case 24:Ui(Os)}}function Nl(s,i){try{var a=i.updateQueue,f=a!==null?a.lastEffect:null;if(f!==null){var j=f.next;a=j;do{if((a.tag&s)===s){f=void 0;var N=a.create,I=a.inst;f=N(),I.destroy=f}a=a.next}while(a!==j)}}catch(K){Gt(i,i.return,K)}}function Tr(s,i,a){try{var f=i.updateQueue,j=f!==null?f.lastEffect:null;if(j!==null){var N=j.next;f=N;do{if((f.tag&s)===s){var I=f.inst,K=I.destroy;if(K!==void 0){I.destroy=void 0,j=i;var ie=a,ge=K;try{ge()}catch(Ce){Gt(j,ie,Ce)}}}f=f.next}while(f!==N)}}catch(Ce){Gt(i,i.return,Ce)}}function y0(s){var i=s.updateQueue;if(i!==null){var a=s.stateNode;try{cy(i,a)}catch(f){Gt(s,s.return,f)}}}function b0(s,i,a){a.props=fa(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(f){Gt(s,i,f)}}function Ml(s,i){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof a=="function"?s.refCleanup=a(f):a.current=f}}catch(j){Gt(s,i,j)}}function Ni(s,i){var a=s.ref,f=s.refCleanup;if(a!==null)if(typeof f=="function")try{f()}catch(j){Gt(s,i,j)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(j){Gt(s,i,j)}else a.current=null}function S0(s){var i=s.type,a=s.memoizedProps,f=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&f.focus();break e;case"img":a.src?f.src=a.src:a.srcSet&&(f.srcset=a.srcSet)}}catch(j){Gt(s,s.return,j)}}function Ap(s,i,a){try{var f=s.stateNode;Tj(f,s.type,a,i),f[Xt]=i}catch(j){Gt(s,s.return,j)}}function w0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ir(s.type)||s.tag===4}function Tp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||w0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ir(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Np(s,i,a){var f=s.tag;if(f===5||f===6)s=s.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(s),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=An));else if(f!==4&&(f===27&&Ir(s.type)&&(a=s.stateNode,i=null),s=s.child,s!==null))for(Np(s,i,a),s=s.sibling;s!==null;)Np(s,i,a),s=s.sibling}function _u(s,i,a){var f=s.tag;if(f===5||f===6)s=s.stateNode,i?a.insertBefore(s,i):a.appendChild(s);else if(f!==4&&(f===27&&Ir(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(_u(s,i,a),s=s.sibling;s!==null;)_u(s,i,a),s=s.sibling}function x0(s){var i=s.stateNode,a=s.memoizedProps;try{for(var f=s.type,j=i.attributes;j.length;)i.removeAttributeNode(j[0]);rn(i,f,a),i[kt]=s,i[Xt]=a}catch(N){Gt(s,s.return,N)}}var Wi=!1,Ps=!1,Mp=!1,C0=typeof WeakSet=="function"?WeakSet:Set,Ws=null;function cj(s,i){if(s=s.containerInfo,Qp=Bu,s=L_(s),Ef(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var j=f.anchorOffset,N=f.focusNode;f=f.focusOffset;try{a.nodeType,N.nodeType}catch{a=null;break e}var I=0,K=-1,ie=-1,ge=0,Ce=0,Re=s,ve=null;t:for(;;){for(var we;Re!==a||j!==0&&Re.nodeType!==3||(K=I+j),Re!==N||f!==0&&Re.nodeType!==3||(ie=I+f),Re.nodeType===3&&(I+=Re.nodeValue.length),(we=Re.firstChild)!==null;)ve=Re,Re=we;for(;;){if(Re===s)break t;if(ve===a&&++ge===j&&(K=I),ve===N&&++Ce===f&&(ie=I),(we=Re.nextSibling)!==null)break;Re=ve,ve=Re.parentNode}Re=we}a=K===-1||ie===-1?null:{start:K,end:ie}}else a=null}a=a||{start:0,end:0}}else a=null;for(em={focusedElem:s,selectionRange:a},Bu=!1,Ws=i;Ws!==null;)if(i=Ws,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Ws=s;else for(;Ws!==null;){switch(i=Ws,N=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a<s.length;a++)j=s[a],j.ref.impl=j.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&N!==null){s=void 0,a=i,j=N.memoizedProps,N=N.memoizedState,f=a.stateNode;try{var qe=fa(a.type,j);s=f.getSnapshotBeforeUpdate(qe,N),f.__reactInternalSnapshotBeforeUpdate=s}catch(nt){Gt(a,a.return,nt)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,a=s.nodeType,a===9)nm(s);else if(a===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":nm(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,Ws=s;break}Ws=i.return}}function E0(s,i,a){var f=a.flags;switch(a.tag){case 0:case 11:case 15:Yi(s,a),f&4&&Nl(5,a);break;case 1:if(Yi(s,a),f&4)if(s=a.stateNode,i===null)try{s.componentDidMount()}catch(I){Gt(a,a.return,I)}else{var j=fa(a.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(j,i,s.__reactInternalSnapshotBeforeUpdate)}catch(I){Gt(a,a.return,I)}}f&64&&y0(a),f&512&&Ml(a,a.return);break;case 3:if(Yi(s,a),f&64&&(s=a.updateQueue,s!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{cy(s,i)}catch(I){Gt(a,a.return,I)}}break;case 27:i===null&&f&4&&x0(a);case 26:case 5:Yi(s,a),i===null&&f&4&&S0(a),f&512&&Ml(a,a.return);break;case 12:Yi(s,a);break;case 31:Yi(s,a),f&4&&R0(s,a);break;case 13:Yi(s,a),f&4&&A0(s,a),f&64&&(s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(a=_j.bind(null,a),Pj(s,a))));break;case 22:if(f=a.memoizedState!==null||Wi,!f){i=i!==null&&i.memoizedState!==null||Ps,j=Wi;var N=Ps;Wi=f,(Ps=i)&&!N?Xi(s,a,(a.subtreeFlags&8772)!==0):Yi(s,a),Wi=j,Ps=N}break;case 30:break;default:Yi(s,a)}}function k0(s){var i=s.alternate;i!==null&&(s.alternate=null,k0(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&ws(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var _s=null,Tn=!1;function Ki(s,i,a){for(a=a.child;a!==null;)j0(s,i,a),a=a.sibling}function j0(s,i,a){if(as&&typeof as.onCommitFiberUnmount=="function")try{as.onCommitFiberUnmount($s,a)}catch{}switch(a.tag){case 26:Ps||Ni(a,i),Ki(s,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ps||Ni(a,i);var f=_s,j=Tn;Ir(a.type)&&(_s=a.stateNode,Tn=!1),Ki(s,i,a),Hl(a.stateNode),_s=f,Tn=j;break;case 5:Ps||Ni(a,i);case 6:if(f=_s,j=Tn,_s=null,Ki(s,i,a),_s=f,Tn=j,_s!==null)if(Tn)try{(_s.nodeType===9?_s.body:_s.nodeName==="HTML"?_s.ownerDocument.body:_s).removeChild(a.stateNode)}catch(N){Gt(a,i,N)}else try{_s.removeChild(a.stateNode)}catch(N){Gt(a,i,N)}break;case 18:_s!==null&&(Tn?(s=_s,yb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.stateNode),Eo(s)):yb(_s,a.stateNode));break;case 4:f=_s,j=Tn,_s=a.stateNode.containerInfo,Tn=!0,Ki(s,i,a),_s=f,Tn=j;break;case 0:case 11:case 14:case 15:Tr(2,a,i),Ps||Tr(4,a,i),Ki(s,i,a);break;case 1:Ps||(Ni(a,i),f=a.stateNode,typeof f.componentWillUnmount=="function"&&b0(a,i,f)),Ki(s,i,a);break;case 21:Ki(s,i,a);break;case 22:Ps=(f=Ps)||a.memoizedState!==null,Ki(s,i,a),Ps=f;break;default:Ki(s,i,a)}}function R0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Eo(s)}catch(a){Gt(i,i.return,a)}}}function A0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Eo(s)}catch(a){Gt(i,i.return,a)}}function uj(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new C0),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new C0),i;default:throw Error(r(435,s.tag))}}function yu(s,i){var a=uj(s);i.forEach(function(f){if(!a.has(f)){a.add(f);var j=yj.bind(null,s,f);f.then(j,j)}})}function Nn(s,i){var a=i.deletions;if(a!==null)for(var f=0;f<a.length;f++){var j=a[f],N=s,I=i,K=I;e:for(;K!==null;){switch(K.tag){case 27:if(Ir(K.type)){_s=K.stateNode,Tn=!1;break e}break;case 5:_s=K.stateNode,Tn=!1;break e;case 3:case 4:_s=K.stateNode.containerInfo,Tn=!0;break e}K=K.return}if(_s===null)throw Error(r(160));j0(N,I,j),_s=null,Tn=!1,N=j.alternate,N!==null&&(N.return=null),j.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)T0(i,s),i=i.sibling}var yi=null;function T0(s,i){var a=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Nn(i,s),Mn(s),f&4&&(Tr(3,s,s.return),Nl(3,s),Tr(5,s,s.return));break;case 1:Nn(i,s),Mn(s),f&512&&(Ps||a===null||Ni(a,a.return)),f&64&&Wi&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(a=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=a===null?f:a.concat(f))));break;case 26:var j=yi;if(Nn(i,s),Mn(s),f&512&&(Ps||a===null||Ni(a,a.return)),f&4){var N=a!==null?a.memoizedState:null;if(f=s.memoizedState,a===null)if(f===null)if(s.stateNode===null){e:{f=s.type,a=s.memoizedProps,j=j.ownerDocument||j;t:switch(f){case"title":N=j.getElementsByTagName("title")[0],(!N||N[Fs]||N[kt]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=j.createElement(f),j.head.insertBefore(N,j.querySelector("head > title"))),rn(N,f,a),N[kt]=s,Ae(N),f=N;break e;case"link":var I=Tb("link","href",j).get(f+(a.href||""));if(I){for(var K=0;K<I.length;K++)if(N=I[K],N.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&N.getAttribute("rel")===(a.rel==null?null:a.rel)&&N.getAttribute("title")===(a.title==null?null:a.title)&&N.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){I.splice(K,1);break t}}N=j.createElement(f),rn(N,f,a),j.head.appendChild(N);break;case"meta":if(I=Tb("meta","content",j).get(f+(a.content||""))){for(K=0;K<I.length;K++)if(N=I[K],N.getAttribute("content")===(a.content==null?null:""+a.content)&&N.getAttribute("name")===(a.name==null?null:a.name)&&N.getAttribute("property")===(a.property==null?null:a.property)&&N.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&N.getAttribute("charset")===(a.charSet==null?null:a.charSet)){I.splice(K,1);break t}}N=j.createElement(f),rn(N,f,a),j.head.appendChild(N);break;default:throw Error(r(468,f))}N[kt]=s,Ae(N),f=N}s.stateNode=f}else Nb(j,s.type,s.stateNode);else s.stateNode=Ab(j,f,s.memoizedProps);else N!==f?(N===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):N.count--,f===null?Nb(j,s.type,s.stateNode):Ab(j,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Ap(s,s.memoizedProps,a.memoizedProps)}break;case 27:Nn(i,s),Mn(s),f&512&&(Ps||a===null||Ni(a,a.return)),a!==null&&f&4&&Ap(s,s.memoizedProps,a.memoizedProps);break;case 5:if(Nn(i,s),Mn(s),f&512&&(Ps||a===null||Ni(a,a.return)),s.flags&32){j=s.stateNode;try{mr(j,"")}catch(qe){Gt(s,s.return,qe)}}f&4&&s.stateNode!=null&&(j=s.memoizedProps,Ap(s,j,a!==null?a.memoizedProps:j)),f&1024&&(Mp=!0);break;case 6:if(Nn(i,s),Mn(s),f&4){if(s.stateNode===null)throw Error(r(162));f=s.memoizedProps,a=s.stateNode;try{a.nodeValue=f}catch(qe){Gt(s,s.return,qe)}}break;case 3:if(Ou=null,j=yi,yi=$u(i.containerInfo),Nn(i,s),yi=j,Mn(s),f&4&&a!==null&&a.memoizedState.isDehydrated)try{Eo(i.containerInfo)}catch(qe){Gt(s,s.return,qe)}Mp&&(Mp=!1,N0(s));break;case 4:f=yi,yi=$u(s.stateNode.containerInfo),Nn(i,s),Mn(s),yi=f;break;case 12:Nn(i,s),Mn(s);break;case 31:Nn(i,s),Mn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,yu(s,f)));break;case 13:Nn(i,s),Mn(s),s.child.flags&8192&&s.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Su=Ct()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,yu(s,f)));break;case 22:j=s.memoizedState!==null;var ie=a!==null&&a.memoizedState!==null,ge=Wi,Ce=Ps;if(Wi=ge||j,Ps=Ce||ie,Nn(i,s),Ps=Ce,Wi=ge,Mn(s),f&8192)e:for(i=s.stateNode,i._visibility=j?i._visibility&-2:i._visibility|1,j&&(a===null||ie||Wi||Ps||pa(s)),a=null,i=s;;){if(i.tag===5||i.tag===26){if(a===null){ie=a=i;try{if(N=ie.stateNode,j)I=N.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none";else{K=ie.stateNode;var Re=ie.memoizedProps.style,ve=Re!=null&&Re.hasOwnProperty("display")?Re.display:null;K.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(qe){Gt(ie,ie.return,qe)}}}else if(i.tag===6){if(a===null){ie=i;try{ie.stateNode.nodeValue=j?"":ie.memoizedProps}catch(qe){Gt(ie,ie.return,qe)}}}else if(i.tag===18){if(a===null){ie=i;try{var we=ie.stateNode;j?bb(we,!0):bb(ie.stateNode,!1)}catch(qe){Gt(ie,ie.return,qe)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}f&4&&(f=s.updateQueue,f!==null&&(a=f.retryQueue,a!==null&&(f.retryQueue=null,yu(s,a))));break;case 19:Nn(i,s),Mn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,yu(s,f)));break;case 30:break;case 21:break;default:Nn(i,s),Mn(s)}}function Mn(s){var i=s.flags;if(i&2){try{for(var a,f=s.return;f!==null;){if(w0(f)){a=f;break}f=f.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var j=a.stateNode,N=Tp(s);_u(s,N,j);break;case 5:var I=a.stateNode;a.flags&32&&(mr(I,""),a.flags&=-33);var K=Tp(s);_u(s,K,I);break;case 3:case 4:var ie=a.stateNode.containerInfo,ge=Tp(s);Np(s,ge,ie);break;default:throw Error(r(161))}}catch(Ce){Gt(s,s.return,Ce)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function N0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;N0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Yi(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)E0(s,i.alternate,i),i=i.sibling}function pa(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:Tr(4,i,i.return),pa(i);break;case 1:Ni(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&b0(i,i.return,a),pa(i);break;case 27:Hl(i.stateNode);case 26:case 5:Ni(i,i.return),pa(i);break;case 22:i.memoizedState===null&&pa(i);break;case 30:pa(i);break;default:pa(i)}s=s.sibling}}function Xi(s,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var f=i.alternate,j=s,N=i,I=N.flags;switch(N.tag){case 0:case 11:case 15:Xi(j,N,a),Nl(4,N);break;case 1:if(Xi(j,N,a),f=N,j=f.stateNode,typeof j.componentDidMount=="function")try{j.componentDidMount()}catch(ge){Gt(f,f.return,ge)}if(f=N,j=f.updateQueue,j!==null){var K=f.stateNode;try{var ie=j.shared.hiddenCallbacks;if(ie!==null)for(j.shared.hiddenCallbacks=null,j=0;j<ie.length;j++)ly(ie[j],K)}catch(ge){Gt(f,f.return,ge)}}a&&I&64&&y0(N),Ml(N,N.return);break;case 27:x0(N);case 26:case 5:Xi(j,N,a),a&&f===null&&I&4&&S0(N),Ml(N,N.return);break;case 12:Xi(j,N,a);break;case 31:Xi(j,N,a),a&&I&4&&R0(j,N);break;case 13:Xi(j,N,a),a&&I&4&&A0(j,N);break;case 22:N.memoizedState===null&&Xi(j,N,a),Ml(N,N.return);break;case 30:break;default:Xi(j,N,a)}i=i.sibling}}function $p(s,i){var a=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==a&&(s!=null&&s.refCount++,a!=null&&_l(a))}function Dp(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&_l(s))}function bi(s,i,a,f){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)M0(s,i,a,f),i=i.sibling}function M0(s,i,a,f){var j=i.flags;switch(i.tag){case 0:case 11:case 15:bi(s,i,a,f),j&2048&&Nl(9,i);break;case 1:bi(s,i,a,f);break;case 3:bi(s,i,a,f),j&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&_l(s)));break;case 12:if(j&2048){bi(s,i,a,f),s=i.stateNode;try{var N=i.memoizedProps,I=N.id,K=N.onPostCommit;typeof K=="function"&&K(I,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(ie){Gt(i,i.return,ie)}}else bi(s,i,a,f);break;case 31:bi(s,i,a,f);break;case 13:bi(s,i,a,f);break;case 23:break;case 22:N=i.stateNode,I=i.alternate,i.memoizedState!==null?N._visibility&2?bi(s,i,a,f):$l(s,i):N._visibility&2?bi(s,i,a,f):(N._visibility|=2,po(s,i,a,f,(i.subtreeFlags&10256)!==0||!1)),j&2048&&$p(I,i);break;case 24:bi(s,i,a,f),j&2048&&Dp(i.alternate,i);break;default:bi(s,i,a,f)}}function po(s,i,a,f,j){for(j=j&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var N=s,I=i,K=a,ie=f,ge=I.flags;switch(I.tag){case 0:case 11:case 15:po(N,I,K,ie,j),Nl(8,I);break;case 23:break;case 22:var Ce=I.stateNode;I.memoizedState!==null?Ce._visibility&2?po(N,I,K,ie,j):$l(N,I):(Ce._visibility|=2,po(N,I,K,ie,j)),j&&ge&2048&&$p(I.alternate,I);break;case 24:po(N,I,K,ie,j),j&&ge&2048&&Dp(I.alternate,I);break;default:po(N,I,K,ie,j)}i=i.sibling}}function $l(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=s,f=i,j=f.flags;switch(f.tag){case 22:$l(a,f),j&2048&&$p(f.alternate,f);break;case 24:$l(a,f),j&2048&&Dp(f.alternate,f);break;default:$l(a,f)}i=i.sibling}}var Dl=8192;function mo(s,i,a){if(s.subtreeFlags&Dl)for(s=s.child;s!==null;)$0(s,i,a),s=s.sibling}function $0(s,i,a){switch(s.tag){case 26:mo(s,i,a),s.flags&Dl&&s.memoizedState!==null&&Xj(a,yi,s.memoizedState,s.memoizedProps);break;case 5:mo(s,i,a);break;case 3:case 4:var f=yi;yi=$u(s.stateNode.containerInfo),mo(s,i,a),yi=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Dl,Dl=16777216,mo(s,i,a),Dl=f):mo(s,i,a));break;default:mo(s,i,a)}}function D0(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Ol(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var f=i[a];Ws=f,L0(f,s)}D0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)O0(s),s=s.sibling}function O0(s){switch(s.tag){case 0:case 11:case 15:Ol(s),s.flags&2048&&Tr(9,s,s.return);break;case 3:Ol(s);break;case 12:Ol(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,bu(s)):Ol(s);break;default:Ol(s)}}function bu(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var f=i[a];Ws=f,L0(f,s)}D0(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:Tr(8,i,i.return),bu(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,bu(i));break;default:bu(i)}s=s.sibling}}function L0(s,i){for(;Ws!==null;){var a=Ws;switch(a.tag){case 0:case 11:case 15:Tr(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var f=a.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:_l(a.memoizedState.cache)}if(f=a.child,f!==null)f.return=a,Ws=f;else e:for(a=s;Ws!==null;){f=Ws;var j=f.sibling,N=f.return;if(k0(f),f===a){Ws=null;break e}if(j!==null){j.return=N,Ws=j;break e}Ws=N}}}var dj={getCacheForType:function(s){var i=sn(Os),a=i.data.get(s);return a===void 0&&(a=s(),i.data.set(s,a)),a},cacheSignal:function(){return sn(Os).controller.signal}},hj=typeof WeakMap=="function"?WeakMap:Map,Ft=0,ns=null,At=null,Mt=0,Vt=0,Fn=null,Nr=!1,go=!1,Op=!1,Ji=0,Es=0,Mr=0,ma=0,Lp=0,qn=0,vo=0,Ll=null,$n=null,Ip=!1,Su=0,I0=0,wu=1/0,xu=null,$r=null,qs=0,Dr=null,_o=null,Zi=0,Pp=0,Bp=null,P0=null,Il=0,zp=null;function Vn(){return(Ft&2)!==0&&Mt!==0?Mt&-Mt:G.T!==null?Gp():tt()}function B0(){if(qn===0)if((Mt&536870912)===0||Ot){var s=ot;ot<<=1,(ot&3932160)===0&&(ot=262144),qn=s}else qn=536870912;return s=Hn.current,s!==null&&(s.flags|=32),qn}function Dn(s,i,a){(s===ns&&(Vt===2||Vt===9)||s.cancelPendingCommit!==null)&&(yo(s,0),Or(s,Mt,qn,!1)),ls(s,a),((Ft&2)===0||s!==ns)&&(s===ns&&((Ft&2)===0&&(ma|=a),Es===4&&Or(s,Mt,qn,!1)),Mi(s))}function z0(s,i,a){if((Ft&6)!==0)throw Error(r(327));var f=!a&&(i&127)===0&&(i&s.expiredLanes)===0||un(s,i),j=f?mj(s,i):Up(s,i,!0),N=f;do{if(j===0){go&&!f&&Or(s,i,0,!1);break}else{if(a=s.current.alternate,N&&!fj(a)){j=Up(s,i,!1),N=!1;continue}if(j===2){if(N=i,s.errorRecoveryDisabledLanes&N)var I=0;else I=s.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){i=I;e:{var K=s;j=Ll;var ie=K.current.memoizedState.isDehydrated;if(ie&&(yo(K,I).flags|=256),I=Up(K,I,!1),I!==2){if(Op&&!ie){K.errorRecoveryDisabledLanes|=N,ma|=N,j=4;break e}N=$n,$n=j,N!==null&&($n===null?$n=N:$n.push.apply($n,N))}j=I}if(N=!1,j!==2)continue}}if(j===1){yo(s,0),Or(s,i,0,!0);break}e:{switch(f=s,N=j,N){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Or(f,i,qn,!Nr);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(j=Su+300-Ct(),10<j)){if(Or(f,i,qn,!Nr),js(f,0,!0)!==0)break e;Zi=i,f.timeoutHandle=vb(H0.bind(null,f,a,$n,xu,Ip,i,qn,ma,vo,Nr,N,"Throttled",-0,0),j);break e}H0(f,a,$n,xu,Ip,i,qn,ma,vo,Nr,N,null,-0,0)}}break}while(!0);Mi(s)}function H0(s,i,a,f,j,N,I,K,ie,ge,Ce,Re,ve,we){if(s.timeoutHandle=-1,Re=i.subtreeFlags,Re&8192||(Re&16785408)===16785408){Re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:An},$0(i,N,Re);var qe=(N&62914560)===N?Su-Ct():(N&4194048)===N?I0-Ct():0;if(qe=Jj(Re,qe),qe!==null){Zi=N,s.cancelPendingCommit=qe(Y0.bind(null,s,i,N,a,f,j,I,K,ie,Ce,Re,null,ve,we)),Or(s,N,I,!ge);return}}Y0(s,i,N,a,f,j,I,K,ie)}function fj(s){for(var i=s;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var f=0;f<a.length;f++){var j=a[f],N=j.getSnapshot;j=j.value;try{if(!Bn(N(),j))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Or(s,i,a,f){i&=~Lp,i&=~ma,s.suspendedLanes|=i,s.pingedLanes&=~i,f&&(s.warmLanes|=i),f=s.expirationTimes;for(var j=i;0<j;){var N=31-It(j),I=1<<N;f[N]=-1,j&=~I}a!==0&&xs(s,a,i)}function Cu(){return(Ft&6)===0?(Pl(0),!1):!0}function Hp(){if(At!==null){if(Vt===0)var s=At.return;else s=At,Hi=aa=null,np(s),lo=null,bl=0,s=At;for(;s!==null;)_0(s.alternate,s),s=s.return;At=null}}function yo(s,i){var a=s.timeoutHandle;a!==-1&&(s.timeoutHandle=-1,$j(a)),a=s.cancelPendingCommit,a!==null&&(s.cancelPendingCommit=null,a()),Zi=0,Hp(),ns=s,At=a=Bi(s.current,null),Mt=i,Vt=0,Fn=null,Nr=!1,go=un(s,i),Op=!1,vo=qn=Lp=ma=Mr=Es=0,$n=Ll=null,Ip=!1,(i&8)!==0&&(i|=i&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=i;0<f;){var j=31-It(f),N=1<<j;i|=s[j],f&=~N}return Ji=i,Vc(),a}function U0(s,i){vt=null,G.H=Rl,i===oo||i===Qc?(i=iy(),Vt=3):i===Vf?(i=iy(),Vt=4):Vt=i===yp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Fn=i,At===null&&(Es=1,fu(s,ei(i,s.current)))}function F0(){var s=Hn.current;return s===null?!0:(Mt&4194048)===Mt?ii===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?s===ii:!1}function q0(){var s=G.H;return G.H=Rl,s===null?Rl:s}function V0(){var s=G.A;return G.A=dj,s}function Eu(){Es=4,Nr||(Mt&4194048)!==Mt&&Hn.current!==null||(go=!0),(Mr&134217727)===0&&(ma&134217727)===0||ns===null||Or(ns,Mt,qn,!1)}function Up(s,i,a){var f=Ft;Ft|=2;var j=q0(),N=V0();(ns!==s||Mt!==i)&&(xu=null,yo(s,i)),i=!1;var I=Es;e:do try{if(Vt!==0&&At!==null){var K=At,ie=Fn;switch(Vt){case 8:Hp(),I=6;break e;case 3:case 2:case 9:case 6:Hn.current===null&&(i=!0);var ge=Vt;if(Vt=0,Fn=null,bo(s,K,ie,ge),a&&go){I=0;break e}break;default:ge=Vt,Vt=0,Fn=null,bo(s,K,ie,ge)}}pj(),I=Es;break}catch(Ce){U0(s,Ce)}while(!0);return i&&s.shellSuspendCounter++,Hi=aa=null,Ft=f,G.H=j,G.A=N,At===null&&(ns=null,Mt=0,Vc()),I}function pj(){for(;At!==null;)G0(At)}function mj(s,i){var a=Ft;Ft|=2;var f=q0(),j=V0();ns!==s||Mt!==i?(xu=null,wu=Ct()+500,yo(s,i)):go=un(s,i);e:do try{if(Vt!==0&&At!==null){i=At;var N=Fn;t:switch(Vt){case 1:Vt=0,Fn=null,bo(s,i,N,1);break;case 2:case 9:if(sy(N)){Vt=0,Fn=null,W0(i);break}i=function(){Vt!==2&&Vt!==9||ns!==s||(Vt=7),Mi(s)},N.then(i,i);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:sy(N)?(Vt=0,Fn=null,W0(i)):(Vt=0,Fn=null,bo(s,i,N,7));break;case 5:var I=null;switch(At.tag){case 26:I=At.memoizedState;case 5:case 27:var K=At;if(I?Mb(I):K.stateNode.complete){Vt=0,Fn=null;var ie=K.sibling;if(ie!==null)At=ie;else{var ge=K.return;ge!==null?(At=ge,ku(ge)):At=null}break t}}Vt=0,Fn=null,bo(s,i,N,5);break;case 6:Vt=0,Fn=null,bo(s,i,N,6);break;case 8:Hp(),Es=6;break e;default:throw Error(r(462))}}gj();break}catch(Ce){U0(s,Ce)}while(!0);return Hi=aa=null,G.H=f,G.A=j,Ft=a,At!==null?0:(ns=null,Mt=0,Vc(),Es)}function gj(){for(;At!==null&&!jt();)G0(At)}function G0(s){var i=g0(s.alternate,s,Ji);s.memoizedProps=s.pendingProps,i===null?ku(s):At=i}function W0(s){var i=s,a=i.alternate;switch(i.tag){case 15:case 0:i=u0(a,i,i.pendingProps,i.type,void 0,Mt);break;case 11:i=u0(a,i,i.pendingProps,i.type.render,i.ref,Mt);break;case 5:np(i);default:_0(a,i),i=At=V_(i,Ji),i=g0(a,i,Ji)}s.memoizedProps=s.pendingProps,i===null?ku(s):At=i}function bo(s,i,a,f){Hi=aa=null,np(i),lo=null,bl=0;var j=i.return;try{if(ij(s,j,i,a,Mt)){Es=1,fu(s,ei(a,s.current)),At=null;return}}catch(N){if(j!==null)throw At=j,N;Es=1,fu(s,ei(a,s.current)),At=null;return}i.flags&32768?(Ot||f===1?s=!0:go||(Mt&536870912)!==0?s=!1:(Nr=s=!0,(f===2||f===9||f===3||f===6)&&(f=Hn.current,f!==null&&f.tag===13&&(f.flags|=16384))),K0(i,s)):ku(i)}function ku(s){var i=s;do{if((i.flags&32768)!==0){K0(i,Nr);return}s=i.return;var a=oj(i.alternate,i,Ji);if(a!==null){At=a;return}if(i=i.sibling,i!==null){At=i;return}At=i=s}while(i!==null);Es===0&&(Es=5)}function K0(s,i){do{var a=lj(s.alternate,s);if(a!==null){a.flags&=32767,At=a;return}if(a=s.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(s=s.sibling,s!==null)){At=s;return}At=s=a}while(s!==null);Es=6,At=null}function Y0(s,i,a,f,j,N,I,K,ie){s.cancelPendingCommit=null;do ju();while(qs!==0);if((Ft&6)!==0)throw Error(r(327));if(i!==null){if(i===s.current)throw Error(r(177));if(N=i.lanes|i.childLanes,N|=Tf,mi(s,a,N,I,K,ie),s===ns&&(At=ns=null,Mt=0),_o=i,Dr=s,Zi=a,Pp=N,Bp=j,P0=f,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,bj(Ut,function(){return eb(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||f){f=G.T,G.T=null,j=ee.p,ee.p=2,I=Ft,Ft|=4;try{cj(s,i,a)}finally{Ft=I,ee.p=j,G.T=f}}qs=1,X0(),J0(),Z0()}}function X0(){if(qs===1){qs=0;var s=Dr,i=_o,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=G.T,G.T=null;var f=ee.p;ee.p=2;var j=Ft;Ft|=4;try{T0(i,s);var N=em,I=L_(s.containerInfo),K=N.focusedElem,ie=N.selectionRange;if(I!==K&&K&&K.ownerDocument&&O_(K.ownerDocument.documentElement,K)){if(ie!==null&&Ef(K)){var ge=ie.start,Ce=ie.end;if(Ce===void 0&&(Ce=ge),"selectionStart"in K)K.selectionStart=ge,K.selectionEnd=Math.min(Ce,K.value.length);else{var Re=K.ownerDocument||document,ve=Re&&Re.defaultView||window;if(ve.getSelection){var we=ve.getSelection(),qe=K.textContent.length,nt=Math.min(ie.start,qe),es=ie.end===void 0?nt:Math.min(ie.end,qe);!we.extend&&nt>es&&(I=es,es=nt,nt=I);var de=D_(K,nt),ae=D_(K,es);if(de&&ae&&(we.rangeCount!==1||we.anchorNode!==de.node||we.anchorOffset!==de.offset||we.focusNode!==ae.node||we.focusOffset!==ae.offset)){var me=Re.createRange();me.setStart(de.node,de.offset),we.removeAllRanges(),nt>es?(we.addRange(me),we.extend(ae.node,ae.offset)):(me.setEnd(ae.node,ae.offset),we.addRange(me))}}}}for(Re=[],we=K;we=we.parentNode;)we.nodeType===1&&Re.push({element:we,left:we.scrollLeft,top:we.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<Re.length;K++){var ke=Re[K];ke.element.scrollLeft=ke.left,ke.element.scrollTop=ke.top}}Bu=!!Qp,em=Qp=null}finally{Ft=j,ee.p=f,G.T=a}}s.current=i,qs=2}}function J0(){if(qs===2){qs=0;var s=Dr,i=_o,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=G.T,G.T=null;var f=ee.p;ee.p=2;var j=Ft;Ft|=4;try{E0(s,i.alternate,i)}finally{Ft=j,ee.p=f,G.T=a}}qs=3}}function Z0(){if(qs===4||qs===3){qs=0,rt();var s=Dr,i=_o,a=Zi,f=P0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?qs=5:(qs=0,_o=Dr=null,Q0(s,s.pendingLanes));var j=s.pendingLanes;if(j===0&&($r=null),Zs(a),i=i.stateNode,as&&typeof as.onCommitFiberRoot=="function")try{as.onCommitFiberRoot($s,i,void 0,(i.current.flags&128)===128)}catch{}if(f!==null){i=G.T,j=ee.p,ee.p=2,G.T=null;try{for(var N=s.onRecoverableError,I=0;I<f.length;I++){var K=f[I];N(K.value,{componentStack:K.stack})}}finally{G.T=i,ee.p=j}}(Zi&3)!==0&&ju(),Mi(s),j=s.pendingLanes,(a&261930)!==0&&(j&42)!==0?s===zp?Il++:(Il=0,zp=s):Il=0,Pl(0)}}function Q0(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,_l(i)))}function ju(){return X0(),J0(),Z0(),eb()}function eb(){if(qs!==5)return!1;var s=Dr,i=Pp;Pp=0;var a=Zs(Zi),f=G.T,j=ee.p;try{ee.p=32>a?32:a,G.T=null,a=Bp,Bp=null;var N=Dr,I=Zi;if(qs=0,_o=Dr=null,Zi=0,(Ft&6)!==0)throw Error(r(331));var K=Ft;if(Ft|=4,O0(N.current),M0(N,N.current,I,a),Ft=K,Pl(0,!1),as&&typeof as.onPostCommitFiberRoot=="function")try{as.onPostCommitFiberRoot($s,N)}catch{}return!0}finally{ee.p=j,G.T=f,Q0(s,i)}}function tb(s,i,a){i=ei(a,i),i=_p(s.stateNode,i,2),s=jr(s,i,2),s!==null&&(ls(s,2),Mi(s))}function Gt(s,i,a){if(s.tag===3)tb(s,s,a);else for(;i!==null;){if(i.tag===3){tb(i,s,a);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&($r===null||!$r.has(f))){s=ei(a,s),a=s0(2),f=jr(i,a,2),f!==null&&(n0(a,f,i,s),ls(f,2),Mi(f));break}}i=i.return}}function Fp(s,i,a){var f=s.pingCache;if(f===null){f=s.pingCache=new hj;var j=new Set;f.set(i,j)}else j=f.get(i),j===void 0&&(j=new Set,f.set(i,j));j.has(a)||(Op=!0,j.add(a),s=vj.bind(null,s,i,a),i.then(s,s))}function vj(s,i,a){var f=s.pingCache;f!==null&&f.delete(i),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,ns===s&&(Mt&a)===a&&(Es===4||Es===3&&(Mt&62914560)===Mt&&300>Ct()-Su?(Ft&2)===0&&yo(s,0):Lp|=a,vo===Mt&&(vo=0)),Mi(s)}function sb(s,i){i===0&&(i=_n()),s=na(s,i),s!==null&&(ls(s,i),Mi(s))}function _j(s){var i=s.memoizedState,a=0;i!==null&&(a=i.retryLane),sb(s,a)}function yj(s,i){var a=0;switch(s.tag){case 31:case 13:var f=s.stateNode,j=s.memoizedState;j!==null&&(a=j.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(i),sb(s,a)}function bj(s,i){return Ue(s,i)}var Ru=null,So=null,qp=!1,Au=!1,Vp=!1,Lr=0;function Mi(s){s!==So&&s.next===null&&(So===null?Ru=So=s:So=So.next=s),Au=!0,qp||(qp=!0,wj())}function Pl(s,i){if(!Vp&&Au){Vp=!0;do for(var a=!1,f=Ru;f!==null;){if(s!==0){var j=f.pendingLanes;if(j===0)var N=0;else{var I=f.suspendedLanes,K=f.pingedLanes;N=(1<<31-It(42|s)+1)-1,N&=j&~(I&~K),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(a=!0,ab(f,N))}else N=Mt,N=js(f,f===ns?N:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(N&3)===0||un(f,N)||(a=!0,ab(f,N));f=f.next}while(a);Vp=!1}}function Sj(){nb()}function nb(){Au=qp=!1;var s=0;Lr!==0&&Mj()&&(s=Lr);for(var i=Ct(),a=null,f=Ru;f!==null;){var j=f.next,N=ib(f,i);N===0?(f.next=null,a===null?Ru=j:a.next=j,j===null&&(So=a)):(a=f,(s!==0||(N&3)!==0)&&(Au=!0)),f=j}qs!==0&&qs!==5||Pl(s),Lr!==0&&(Lr=0)}function ib(s,i){for(var a=s.suspendedLanes,f=s.pingedLanes,j=s.expirationTimes,N=s.pendingLanes&-62914561;0<N;){var I=31-It(N),K=1<<I,ie=j[I];ie===-1?((K&a)===0||(K&f)!==0)&&(j[I]=Js(K,i)):ie<=i&&(s.expiredLanes|=K),N&=~K}if(i=ns,a=Mt,a=js(s,s===i?a:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,a===0||s===i&&(Vt===2||Vt===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&Ye(f),s.callbackNode=null,s.callbackPriority=0;if((a&3)===0||un(s,a)){if(i=a&-a,i===s.callbackPriority)return i;switch(f!==null&&Ye(f),Zs(a)){case 2:case 8:a=mt;break;case 32:a=Ut;break;case 268435456:a=Yt;break;default:a=Ut}return f=rb.bind(null,s),a=Ue(a,f),s.callbackPriority=i,s.callbackNode=a,i}return f!==null&&f!==null&&Ye(f),s.callbackPriority=2,s.callbackNode=null,2}function rb(s,i){if(qs!==0&&qs!==5)return s.callbackNode=null,s.callbackPriority=0,null;var a=s.callbackNode;if(ju()&&s.callbackNode!==a)return null;var f=Mt;return f=js(s,s===ns?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(z0(s,f,i),ib(s,Ct()),s.callbackNode!=null&&s.callbackNode===a?rb.bind(null,s):null)}function ab(s,i){if(ju())return null;z0(s,i,!0)}function wj(){Dj(function(){(Ft&6)!==0?Ue(Lt,Sj):nb()})}function Gp(){if(Lr===0){var s=ro;s===0&&(s=Gs,Gs<<=1,(Gs&261888)===0&&(Gs=256)),Lr=s}return Lr}function ob(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:qa(""+s)}function lb(s,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,s.id&&a.setAttribute("form",s.id),i.parentNode.insertBefore(a,i),s=new FormData(s),a.parentNode.removeChild(a),s}function xj(s,i,a,f,j){if(i==="submit"&&a&&a.stateNode===j){var N=ob((j[Xt]||null).action),I=f.submitter;I&&(i=(i=I[Xt]||null)?ob(i.formAction):I.getAttribute("formAction"),i!==null&&(N=i,I=null));var K=new ea("action","action",null,f,j);s.push({event:K,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Lr!==0){var ie=I?lb(j,I):new FormData(j);hp(a,{pending:!0,data:ie,method:j.method,action:N},null,ie)}}else typeof N=="function"&&(K.preventDefault(),ie=I?lb(j,I):new FormData(j),hp(a,{pending:!0,data:ie,method:j.method,action:N},N,ie))},currentTarget:j}]})}}for(var Wp=0;Wp<Af.length;Wp++){var Kp=Af[Wp],Cj=Kp.toLowerCase(),Ej=Kp[0].toUpperCase()+Kp.slice(1);_i(Cj,"on"+Ej)}_i(B_,"onAnimationEnd"),_i(z_,"onAnimationIteration"),_i(H_,"onAnimationStart"),_i("dblclick","onDoubleClick"),_i("focusin","onFocus"),_i("focusout","onBlur"),_i(Hk,"onTransitionRun"),_i(Uk,"onTransitionStart"),_i(Fk,"onTransitionCancel"),_i(U_,"onTransitionEnd"),Rt("onMouseEnter",["mouseout","mouseover"]),Rt("onMouseLeave",["mouseout","mouseover"]),Rt("onPointerEnter",["pointerout","pointerover"]),Rt("onPointerLeave",["pointerout","pointerover"]),We("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),We("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),We("onBeforeInput",["compositionend","keypress","textInput","paste"]),We("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),We("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),We("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bl="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(" "),kj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Bl));function cb(s,i){i=(i&4)!==0;for(var a=0;a<s.length;a++){var f=s[a],j=f.event;f=f.listeners;e:{var N=void 0;if(i)for(var I=f.length-1;0<=I;I--){var K=f[I],ie=K.instance,ge=K.currentTarget;if(K=K.listener,ie!==N&&j.isPropagationStopped())break e;N=K,j.currentTarget=ge;try{N(j)}catch(Ce){qc(Ce)}j.currentTarget=null,N=ie}else for(I=0;I<f.length;I++){if(K=f[I],ie=K.instance,ge=K.currentTarget,K=K.listener,ie!==N&&j.isPropagationStopped())break e;N=K,j.currentTarget=ge;try{N(j)}catch(Ce){qc(Ce)}j.currentTarget=null,N=ie}}}}function Tt(s,i){var a=i[Rs];a===void 0&&(a=i[Rs]=new Set);var f=s+"__bubble";a.has(f)||(ub(i,s,2,!1),a.add(f))}function Yp(s,i,a){var f=0;i&&(f|=4),ub(a,s,f,i)}var Tu="_reactListening"+Math.random().toString(36).slice(2);function Xp(s){if(!s[Tu]){s[Tu]=!0,ze.forEach(function(a){a!=="selectionchange"&&(kj.has(a)||Yp(a,!1,s),Yp(a,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[Tu]||(i[Tu]=!0,Yp("selectionchange",!1,i))}}function ub(s,i,a,f){switch(Bb(i)){case 2:var j=eR;break;case 8:j=tR;break;default:j=dm}a=j.bind(null,i,a,s),j=void 0,!Wa||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(j=!0),f?j!==void 0?s.addEventListener(i,a,{capture:!0,passive:j}):s.addEventListener(i,a,!0):j!==void 0?s.addEventListener(i,a,{passive:j}):s.addEventListener(i,a,!1)}function Jp(s,i,a,f,j){var N=f;if((i&1)===0&&(i&2)===0&&f!==null)e:for(;;){if(f===null)return;var I=f.tag;if(I===3||I===4){var K=f.stateNode.containerInfo;if(K===j)break;if(I===4)for(I=f.return;I!==null;){var ie=I.tag;if((ie===3||ie===4)&&I.stateNode.containerInfo===j)return;I=I.return}for(;K!==null;){if(I=re(K),I===null)return;if(ie=I.tag,ie===5||ie===6||ie===26||ie===27){f=N=I;continue e}K=K.parentNode}}f=f.return}ll(function(){var ge=N,Ce=al(a),Re=[];e:{var ve=F_.get(s);if(ve!==void 0){var we=ea,qe=s;switch(s){case"keypress":if(Zr(a)===0)break e;case"keydown":case"keyup":we=yk;break;case"focusin":qe="focus",we=br;break;case"focusout":qe="blur",we=br;break;case"beforeblur":case"afterblur":we=br;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=Ve;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=vs;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=wk;break;case B_:case z_:case H_:we=uk;break;case U_:we=Ck;break;case"scroll":case"scrollend":we=Uc;break;case"wheel":we=kk;break;case"copy":case"cut":case"paste":we=hk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=b_;break;case"toggle":case"beforetoggle":we=Rk}var nt=(i&4)!==0,es=!nt&&(s==="scroll"||s==="scrollend"),de=nt?ve!==null?ve+"Capture":null:ve;nt=[];for(var ae=ge,me;ae!==null;){var ke=ae;if(me=ke.stateNode,ke=ke.tag,ke!==5&&ke!==26&&ke!==27||me===null||de===null||(ke=vr(ae,de),ke!=null&&nt.push(zl(ae,ke,me))),es)break;ae=ae.return}0<nt.length&&(ve=new we(ve,qe,null,a,Ce),Re.push({event:ve,listeners:nt}))}}if((i&7)===0){e:{if(ve=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",ve&&a!==Va&&(qe=a.relatedTarget||a.fromElement)&&(re(qe)||qe[dn]))break e;if((we||ve)&&(ve=Ce.window===Ce?Ce:(ve=Ce.ownerDocument)?ve.defaultView||ve.parentWindow:window,we?(qe=a.relatedTarget||a.toElement,we=ge,qe=qe?re(qe):null,qe!==null&&(es=c(qe),nt=qe.tag,qe!==es||nt!==5&&nt!==27&&nt!==6)&&(qe=null)):(we=null,qe=ge),we!==qe)){if(nt=Ve,ke="onMouseLeave",de="onMouseEnter",ae="mouse",(s==="pointerout"||s==="pointerover")&&(nt=b_,ke="onPointerLeave",de="onPointerEnter",ae="pointer"),es=we==null?ve:be(we),me=qe==null?ve:be(qe),ve=new nt(ke,ae+"leave",we,a,Ce),ve.target=es,ve.relatedTarget=me,ke=null,re(Ce)===ge&&(nt=new nt(de,ae+"enter",qe,a,Ce),nt.target=me,nt.relatedTarget=es,ke=nt),es=ke,we&&qe)t:{for(nt=jj,de=we,ae=qe,me=0,ke=de;ke;ke=nt(ke))me++;ke=0;for(var et=ae;et;et=nt(et))ke++;for(;0<me-ke;)de=nt(de),me--;for(;0<ke-me;)ae=nt(ae),ke--;for(;me--;){if(de===ae||ae!==null&&de===ae.alternate){nt=de;break t}de=nt(de),ae=nt(ae)}nt=null}else nt=null;we!==null&&db(Re,ve,we,nt,!1),qe!==null&&es!==null&&db(Re,es,qe,nt,!0)}}e:{if(ve=ge?be(ge):window,we=ve.nodeName&&ve.nodeName.toLowerCase(),we==="select"||we==="input"&&ve.type==="file")var zt=R_;else if(k_(ve))if(A_)zt=Pk;else{zt=Lk;var Ke=Ok}else we=ve.nodeName,!we||we.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?ge&&Fa(ge.elementType)&&(zt=R_):zt=Ik;if(zt&&(zt=zt(s,ge))){j_(Re,zt,a,Ce);break e}Ke&&Ke(s,ve,ge),s==="focusout"&&ge&&ve.type==="number"&&ge.memoizedProps.value!=null&&sl(ve,"number",ve.value)}switch(Ke=ge?be(ge):window,s){case"focusin":(k_(Ke)||Ke.contentEditable==="true")&&(Ja=Ke,kf=ge,ml=null);break;case"focusout":ml=kf=Ja=null;break;case"mousedown":jf=!0;break;case"contextmenu":case"mouseup":case"dragend":jf=!1,I_(Re,a,Ce);break;case"selectionchange":if(zk)break;case"keydown":case"keyup":I_(Re,a,Ce)}var yt;if(wf)e:{switch(s){case"compositionstart":var $t="onCompositionStart";break e;case"compositionend":$t="onCompositionEnd";break e;case"compositionupdate":$t="onCompositionUpdate";break e}$t=void 0}else Xa?C_(s,a)&&($t="onCompositionEnd"):s==="keydown"&&a.keyCode===229&&($t="onCompositionStart");$t&&(S_&&a.locale!=="ko"&&(Xa||$t!=="onCompositionStart"?$t==="onCompositionEnd"&&Xa&&(yt=cl()):(vi=Ce,Ka="value"in vi?vi.value:vi.textContent,Xa=!0)),Ke=Nu(ge,$t),0<Ke.length&&($t=new y_($t,s,null,a,Ce),Re.push({event:$t,listeners:Ke}),yt?$t.data=yt:(yt=E_(a),yt!==null&&($t.data=yt)))),(yt=Tk?Nk(s,a):Mk(s,a))&&($t=Nu(ge,"onBeforeInput"),0<$t.length&&(Ke=new y_("onBeforeInput","beforeinput",null,a,Ce),Re.push({event:Ke,listeners:$t}),Ke.data=yt)),xj(Re,s,ge,a,Ce)}cb(Re,i)})}function zl(s,i,a){return{instance:s,listener:i,currentTarget:a}}function Nu(s,i){for(var a=i+"Capture",f=[];s!==null;){var j=s,N=j.stateNode;if(j=j.tag,j!==5&&j!==26&&j!==27||N===null||(j=vr(s,a),j!=null&&f.unshift(zl(s,j,N)),j=vr(s,i),j!=null&&f.push(zl(s,j,N))),s.tag===3)return f;s=s.return}return[]}function jj(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function db(s,i,a,f,j){for(var N=i._reactName,I=[];a!==null&&a!==f;){var K=a,ie=K.alternate,ge=K.stateNode;if(K=K.tag,ie!==null&&ie===f)break;K!==5&&K!==26&&K!==27||ge===null||(ie=ge,j?(ge=vr(a,N),ge!=null&&I.unshift(zl(a,ge,ie))):j||(ge=vr(a,N),ge!=null&&I.push(zl(a,ge,ie)))),a=a.return}I.length!==0&&s.push({event:i,listeners:I})}var Rj=/\r\n?/g,Aj=/\u0000|\uFFFD/g;function hb(s){return(typeof s=="string"?s:""+s).replace(Rj,`
49
+ `).replace(Aj,"")}function fb(s,i){return i=hb(i),hb(s)===i}function Qt(s,i,a,f,j,N){switch(a){case"children":typeof f=="string"?i==="body"||i==="textarea"&&f===""||mr(s,f):(typeof f=="number"||typeof f=="bigint")&&i!=="body"&&mr(s,""+f);break;case"className":Qe(s,"class",f);break;case"tabIndex":Qe(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Qe(s,a,f);break;case"style":Hc(s,f,N);break;case"data":if(i!=="object"){Qe(s,"data",f);break}case"src":case"href":if(f===""&&(i!=="a"||a!=="href")){s.removeAttribute(a);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(a);break}f=qa(""+f),s.setAttribute(a,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(a==="formAction"?(i!=="input"&&Qt(s,i,"name",j.name,j,null),Qt(s,i,"formEncType",j.formEncType,j,null),Qt(s,i,"formMethod",j.formMethod,j,null),Qt(s,i,"formTarget",j.formTarget,j,null)):(Qt(s,i,"encType",j.encType,j,null),Qt(s,i,"method",j.method,j,null),Qt(s,i,"target",j.target,j,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(a);break}f=qa(""+f),s.setAttribute(a,f);break;case"onClick":f!=null&&(s.onclick=An);break;case"onScroll":f!=null&&Tt("scroll",s);break;case"onScrollEnd":f!=null&&Tt("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(a=f.__html,a!=null){if(j.children!=null)throw Error(r(60));s.innerHTML=a}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}a=qa(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(a,""+f):s.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(a,""):s.removeAttribute(a);break;case"capture":case"download":f===!0?s.setAttribute(a,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(a,f):s.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(a,f):s.removeAttribute(a);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(a):s.setAttribute(a,f);break;case"popover":Tt("beforetoggle",s),Tt("toggle",s),Me(s,"popover",f);break;case"xlinkActuate":it(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":it(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":it(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":it(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":it(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":it(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":it(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":it(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":it(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Me(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=bf.get(a)||a,Me(s,a,f))}}function Zp(s,i,a,f,j,N){switch(a){case"style":Hc(s,f,N);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(a=f.__html,a!=null){if(j.children!=null)throw Error(r(60));s.innerHTML=a}}break;case"children":typeof f=="string"?mr(s,f):(typeof f=="number"||typeof f=="bigint")&&mr(s,""+f);break;case"onScroll":f!=null&&Tt("scroll",s);break;case"onScrollEnd":f!=null&&Tt("scrollend",s);break;case"onClick":f!=null&&(s.onclick=An);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!st.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(j=a.endsWith("Capture"),i=a.slice(2,j?a.length-7:void 0),N=s[Xt]||null,N=N!=null?N[a]:null,typeof N=="function"&&s.removeEventListener(i,N,j),typeof f=="function")){typeof N!="function"&&N!==null&&(a in s?s[a]=null:s.hasAttribute(a)&&s.removeAttribute(a)),s.addEventListener(i,f,j);break e}a in s?s[a]=f:f===!0?s.setAttribute(a,""):Me(s,a,f)}}}function rn(s,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",s),Tt("load",s);var f=!1,j=!1,N;for(N in a)if(a.hasOwnProperty(N)){var I=a[N];if(I!=null)switch(N){case"src":f=!0;break;case"srcSet":j=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Qt(s,i,N,I,a,null)}}j&&Qt(s,i,"srcSet",a.srcSet,a,null),f&&Qt(s,i,"src",a.src,a,null);return;case"input":Tt("invalid",s);var K=N=I=j=null,ie=null,ge=null;for(f in a)if(a.hasOwnProperty(f)){var Ce=a[f];if(Ce!=null)switch(f){case"name":j=Ce;break;case"type":I=Ce;break;case"checked":ie=Ce;break;case"defaultChecked":ge=Ce;break;case"value":N=Ce;break;case"defaultValue":K=Ce;break;case"children":case"dangerouslySetInnerHTML":if(Ce!=null)throw Error(r(137,i));break;default:Qt(s,i,f,Ce,a,null)}}Ha(s,N,K,ie,ge,I,j,!1);return;case"select":Tt("invalid",s),f=I=N=null;for(j in a)if(a.hasOwnProperty(j)&&(K=a[j],K!=null))switch(j){case"value":N=K;break;case"defaultValue":I=K;break;case"multiple":f=K;default:Qt(s,i,j,K,a,null)}i=N,a=I,s.multiple=!!f,i!=null?Ii(s,!!f,i,!1):a!=null&&Ii(s,!!f,a,!0);return;case"textarea":Tt("invalid",s),N=j=f=null;for(I in a)if(a.hasOwnProperty(I)&&(K=a[I],K!=null))switch(I){case"value":f=K;break;case"defaultValue":j=K;break;case"children":N=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Qt(s,i,I,K,a,null)}zc(s,f,j,N);return;case"option":for(ie in a)if(a.hasOwnProperty(ie)&&(f=a[ie],f!=null))switch(ie){case"selected":s.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Qt(s,i,ie,f,a,null)}return;case"dialog":Tt("beforetoggle",s),Tt("toggle",s),Tt("cancel",s),Tt("close",s);break;case"iframe":case"object":Tt("load",s);break;case"video":case"audio":for(f=0;f<Bl.length;f++)Tt(Bl[f],s);break;case"image":Tt("error",s),Tt("load",s);break;case"details":Tt("toggle",s);break;case"embed":case"source":case"link":Tt("error",s),Tt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ge in a)if(a.hasOwnProperty(ge)&&(f=a[ge],f!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Qt(s,i,ge,f,a,null)}return;default:if(Fa(i)){for(Ce in a)a.hasOwnProperty(Ce)&&(f=a[Ce],f!==void 0&&Zp(s,i,Ce,f,a,void 0));return}}for(K in a)a.hasOwnProperty(K)&&(f=a[K],f!=null&&Qt(s,i,K,f,a,null))}function Tj(s,i,a,f){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var j=null,N=null,I=null,K=null,ie=null,ge=null,Ce=null;for(we in a){var Re=a[we];if(a.hasOwnProperty(we)&&Re!=null)switch(we){case"checked":break;case"value":break;case"defaultValue":ie=Re;default:f.hasOwnProperty(we)||Qt(s,i,we,null,f,Re)}}for(var ve in f){var we=f[ve];if(Re=a[ve],f.hasOwnProperty(ve)&&(we!=null||Re!=null))switch(ve){case"type":N=we;break;case"name":j=we;break;case"checked":ge=we;break;case"defaultChecked":Ce=we;break;case"value":I=we;break;case"defaultValue":K=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,i));break;default:we!==Re&&Qt(s,i,ve,we,f,Re)}}gs(s,I,K,ie,ge,Ce,N,j);return;case"select":we=I=K=ve=null;for(N in a)if(ie=a[N],a.hasOwnProperty(N)&&ie!=null)switch(N){case"value":break;case"multiple":we=ie;default:f.hasOwnProperty(N)||Qt(s,i,N,null,f,ie)}for(j in f)if(N=f[j],ie=a[j],f.hasOwnProperty(j)&&(N!=null||ie!=null))switch(j){case"value":ve=N;break;case"defaultValue":K=N;break;case"multiple":I=N;default:N!==ie&&Qt(s,i,j,N,f,ie)}i=K,a=I,f=we,ve!=null?Ii(s,!!a,ve,!1):!!f!=!!a&&(i!=null?Ii(s,!!a,i,!0):Ii(s,!!a,a?[]:"",!1));return;case"textarea":we=ve=null;for(K in a)if(j=a[K],a.hasOwnProperty(K)&&j!=null&&!f.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:Qt(s,i,K,null,f,j)}for(I in f)if(j=f[I],N=a[I],f.hasOwnProperty(I)&&(j!=null||N!=null))switch(I){case"value":ve=j;break;case"defaultValue":we=j;break;case"children":break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:j!==N&&Qt(s,i,I,j,f,N)}Ua(s,ve,we);return;case"option":for(var qe in a)if(ve=a[qe],a.hasOwnProperty(qe)&&ve!=null&&!f.hasOwnProperty(qe))switch(qe){case"selected":s.selected=!1;break;default:Qt(s,i,qe,null,f,ve)}for(ie in f)if(ve=f[ie],we=a[ie],f.hasOwnProperty(ie)&&ve!==we&&(ve!=null||we!=null))switch(ie){case"selected":s.selected=ve&&typeof ve!="function"&&typeof ve!="symbol";break;default:Qt(s,i,ie,ve,f,we)}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 nt in a)ve=a[nt],a.hasOwnProperty(nt)&&ve!=null&&!f.hasOwnProperty(nt)&&Qt(s,i,nt,null,f,ve);for(ge in f)if(ve=f[ge],we=a[ge],f.hasOwnProperty(ge)&&ve!==we&&(ve!=null||we!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,i));break;default:Qt(s,i,ge,ve,f,we)}return;default:if(Fa(i)){for(var es in a)ve=a[es],a.hasOwnProperty(es)&&ve!==void 0&&!f.hasOwnProperty(es)&&Zp(s,i,es,void 0,f,ve);for(Ce in f)ve=f[Ce],we=a[Ce],!f.hasOwnProperty(Ce)||ve===we||ve===void 0&&we===void 0||Zp(s,i,Ce,ve,f,we);return}}for(var de in a)ve=a[de],a.hasOwnProperty(de)&&ve!=null&&!f.hasOwnProperty(de)&&Qt(s,i,de,null,f,ve);for(Re in f)ve=f[Re],we=a[Re],!f.hasOwnProperty(Re)||ve===we||ve==null&&we==null||Qt(s,i,Re,ve,f,we)}function pb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nj(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,a=performance.getEntriesByType("resource"),f=0;f<a.length;f++){var j=a[f],N=j.transferSize,I=j.initiatorType,K=j.duration;if(N&&K&&pb(I)){for(I=0,K=j.responseEnd,f+=1;f<a.length;f++){var ie=a[f],ge=ie.startTime;if(ge>K)break;var Ce=ie.transferSize,Re=ie.initiatorType;Ce&&pb(Re)&&(ie=ie.responseEnd,I+=Ce*(ie<K?1:(K-ge)/(ie-ge)))}if(--f,i+=8*(N+I)/(j.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Qp=null,em=null;function Mu(s){return s.nodeType===9?s:s.ownerDocument}function mb(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function gb(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function tm(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var sm=null;function Mj(){var s=window.event;return s&&s.type==="popstate"?s===sm?!1:(sm=s,!0):(sm=null,!1)}var vb=typeof setTimeout=="function"?setTimeout:void 0,$j=typeof clearTimeout=="function"?clearTimeout:void 0,_b=typeof Promise=="function"?Promise:void 0,Dj=typeof queueMicrotask=="function"?queueMicrotask:typeof _b<"u"?function(s){return _b.resolve(null).then(s).catch(Oj)}:vb;function Oj(s){setTimeout(function(){throw s})}function Ir(s){return s==="head"}function yb(s,i){var a=i,f=0;do{var j=a.nextSibling;if(s.removeChild(a),j&&j.nodeType===8)if(a=j.data,a==="/$"||a==="/&"){if(f===0){s.removeChild(j),Eo(i);return}f--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")f++;else if(a==="html")Hl(s.ownerDocument.documentElement);else if(a==="head"){a=s.ownerDocument.head,Hl(a);for(var N=a.firstChild;N;){var I=N.nextSibling,K=N.nodeName;N[Fs]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&N.rel.toLowerCase()==="stylesheet"||a.removeChild(N),N=I}}else a==="body"&&Hl(s.ownerDocument.body);a=j}while(a);Eo(i)}function bb(s,i){var a=s;s=0;do{var f=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(s===0)break;s--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||s++;a=f}while(a)}function nm(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":nm(a),ws(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}s.removeChild(a)}}function Lj(s,i,a,f){for(;s.nodeType===1;){var j=a;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[Fs])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(N=s.getAttribute("rel"),N==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(N!==j.rel||s.getAttribute("href")!==(j.href==null||j.href===""?null:j.href)||s.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin)||s.getAttribute("title")!==(j.title==null?null:j.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(N=s.getAttribute("src"),(N!==(j.src==null?null:j.src)||s.getAttribute("type")!==(j.type==null?null:j.type)||s.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin))&&N&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var N=j.name==null?null:""+j.name;if(j.type==="hidden"&&s.getAttribute("name")===N)return s}else return s;if(s=ri(s.nextSibling),s===null)break}return null}function Ij(s,i,a){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ri(s.nextSibling),s===null))return null;return s}function Sb(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=ri(s.nextSibling),s===null))return null;return s}function im(s){return s.data==="$?"||s.data==="$~"}function rm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function Pj(s,i){var a=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||a.readyState!=="loading")i();else{var f=function(){i(),a.removeEventListener("DOMContentLoaded",f)};a.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function ri(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var am=null;function wb(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var a=s.data;if(a==="/$"||a==="/&"){if(i===0)return ri(s.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}s=s.nextSibling}return null}function xb(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var a=s.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return s;i--}else a!=="/$"&&a!=="/&"||i++}s=s.previousSibling}return null}function Cb(s,i,a){switch(i=Mu(a),s){case"html":if(s=i.documentElement,!s)throw Error(r(452));return s;case"head":if(s=i.head,!s)throw Error(r(453));return s;case"body":if(s=i.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Hl(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);ws(s)}var ai=new Map,Eb=new Set;function $u(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Qi=ee.d;ee.d={f:Bj,r:zj,D:Hj,C:Uj,L:Fj,m:qj,X:Gj,S:Vj,M:Wj};function Bj(){var s=Qi.f(),i=Cu();return s||i}function zj(s){var i=he(s);i!==null&&i.tag===5&&i.type==="form"?Uy(i):Qi.r(s)}var wo=typeof document>"u"?null:document;function kb(s,i,a){var f=wo;if(f&&typeof i=="string"&&i){var j=gt(i);j='link[rel="'+s+'"][href="'+j+'"]',typeof a=="string"&&(j+='[crossorigin="'+a+'"]'),Eb.has(j)||(Eb.add(j),s={rel:s,crossOrigin:a,href:i},f.querySelector(j)===null&&(i=f.createElement("link"),rn(i,"link",s),Ae(i),f.head.appendChild(i)))}}function Hj(s){Qi.D(s),kb("dns-prefetch",s,null)}function Uj(s,i){Qi.C(s,i),kb("preconnect",s,i)}function Fj(s,i,a){Qi.L(s,i,a);var f=wo;if(f&&s&&i){var j='link[rel="preload"][as="'+gt(i)+'"]';i==="image"&&a&&a.imageSrcSet?(j+='[imagesrcset="'+gt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(j+='[imagesizes="'+gt(a.imageSizes)+'"]')):j+='[href="'+gt(s)+'"]';var N=j;switch(i){case"style":N=xo(s);break;case"script":N=Co(s)}ai.has(N)||(s=p({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:s,as:i},a),ai.set(N,s),f.querySelector(j)!==null||i==="style"&&f.querySelector(Ul(N))||i==="script"&&f.querySelector(Fl(N))||(i=f.createElement("link"),rn(i,"link",s),Ae(i),f.head.appendChild(i)))}}function qj(s,i){Qi.m(s,i);var a=wo;if(a&&s){var f=i&&typeof i.as=="string"?i.as:"script",j='link[rel="modulepreload"][as="'+gt(f)+'"][href="'+gt(s)+'"]',N=j;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=Co(s)}if(!ai.has(N)&&(s=p({rel:"modulepreload",href:s},i),ai.set(N,s),a.querySelector(j)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Fl(N)))return}f=a.createElement("link"),rn(f,"link",s),Ae(f),a.head.appendChild(f)}}}function Vj(s,i,a){Qi.S(s,i,a);var f=wo;if(f&&s){var j=xe(f).hoistableStyles,N=xo(s);i=i||"default";var I=j.get(N);if(!I){var K={loading:0,preload:null};if(I=f.querySelector(Ul(N)))K.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":i},a),(a=ai.get(N))&&om(s,a);var ie=I=f.createElement("link");Ae(ie),rn(ie,"link",s),ie._p=new Promise(function(ge,Ce){ie.onload=ge,ie.onerror=Ce}),ie.addEventListener("load",function(){K.loading|=1}),ie.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Du(I,i,f)}I={type:"stylesheet",instance:I,count:1,state:K},j.set(N,I)}}}function Gj(s,i){Qi.X(s,i);var a=wo;if(a&&s){var f=xe(a).hoistableScripts,j=Co(s),N=f.get(j);N||(N=a.querySelector(Fl(j)),N||(s=p({src:s,async:!0},i),(i=ai.get(j))&&lm(s,i),N=a.createElement("script"),Ae(N),rn(N,"link",s),a.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},f.set(j,N))}}function Wj(s,i){Qi.M(s,i);var a=wo;if(a&&s){var f=xe(a).hoistableScripts,j=Co(s),N=f.get(j);N||(N=a.querySelector(Fl(j)),N||(s=p({src:s,async:!0,type:"module"},i),(i=ai.get(j))&&lm(s,i),N=a.createElement("script"),Ae(N),rn(N,"link",s),a.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},f.set(j,N))}}function jb(s,i,a,f){var j=(j=se.current)?$u(j):null;if(!j)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=xo(a.href),a=xe(j).hoistableStyles,f=a.get(i),f||(f={type:"style",instance:null,count:0,state:null},a.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=xo(a.href);var N=xe(j).hoistableStyles,I=N.get(s);if(I||(j=j.ownerDocument||j,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(s,I),(N=j.querySelector(Ul(s)))&&!N._p&&(I.instance=N,I.state.loading=5),ai.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ai.set(s,a),N||Kj(j,s,a,I.state))),i&&f===null)throw Error(r(528,""));return I}if(i&&f!==null)throw Error(r(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Co(a),a=xe(j).hoistableScripts,f=a.get(i),f||(f={type:"script",instance:null,count:0,state:null},a.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function xo(s){return'href="'+gt(s)+'"'}function Ul(s){return'link[rel="stylesheet"]['+s+"]"}function Rb(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function Kj(s,i,a,f){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=s.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),rn(i,"link",a),Ae(i),s.head.appendChild(i))}function Co(s){return'[src="'+gt(s)+'"]'}function Fl(s){return"script[async]"+s}function Ab(s,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var f=s.querySelector('style[data-href~="'+gt(a.href)+'"]');if(f)return i.instance=f,Ae(f),f;var j=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),Ae(f),rn(f,"style",j),Du(f,a.precedence,s),i.instance=f;case"stylesheet":j=xo(a.href);var N=s.querySelector(Ul(j));if(N)return i.state.loading|=4,i.instance=N,Ae(N),N;f=Rb(a),(j=ai.get(j))&&om(f,j),N=(s.ownerDocument||s).createElement("link"),Ae(N);var I=N;return I._p=new Promise(function(K,ie){I.onload=K,I.onerror=ie}),rn(N,"link",f),i.state.loading|=4,Du(N,a.precedence,s),i.instance=N;case"script":return N=Co(a.src),(j=s.querySelector(Fl(N)))?(i.instance=j,Ae(j),j):(f=a,(j=ai.get(N))&&(f=p({},a),lm(f,j)),s=s.ownerDocument||s,j=s.createElement("script"),Ae(j),rn(j,"link",f),s.head.appendChild(j),i.instance=j);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,Du(f,a.precedence,s));return i.instance}function Du(s,i,a){for(var f=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),j=f.length?f[f.length-1]:null,N=j,I=0;I<f.length;I++){var K=f[I];if(K.dataset.precedence===i)N=K;else if(N!==j)break}N?N.parentNode.insertBefore(s,N.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(s,i.firstChild))}function om(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function lm(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var Ou=null;function Tb(s,i,a){if(Ou===null){var f=new Map,j=Ou=new Map;j.set(a,f)}else j=Ou,f=j.get(a),f||(f=new Map,j.set(a,f));if(f.has(s))return f;for(f.set(s,null),a=a.getElementsByTagName(s),j=0;j<a.length;j++){var N=a[j];if(!(N[Fs]||N[kt]||s==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var I=N.getAttribute(i)||"";I=s+I;var K=f.get(I);K?K.push(N):f.set(I,[N])}}return f}function Nb(s,i,a){s=s.ownerDocument||s,s.head.insertBefore(a,i==="title"?s.querySelector("head > title"):null)}function Yj(s,i,a){if(a===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Mb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Xj(s,i,a,f){if(a.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var j=xo(f.href),N=i.querySelector(Ul(j));if(N){i=N._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=Lu.bind(s),i.then(s,s)),a.state.loading|=4,a.instance=N,Ae(N);return}N=i.ownerDocument||i,f=Rb(f),(j=ai.get(j))&&om(f,j),N=N.createElement("link"),Ae(N);var I=N;I._p=new Promise(function(K,ie){I.onload=K,I.onerror=ie}),rn(N,"link",f),a.instance=N}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=Lu.bind(s),i.addEventListener("load",a),i.addEventListener("error",a))}}var cm=0;function Jj(s,i){return s.stylesheets&&s.count===0&&Pu(s,s.stylesheets),0<s.count||0<s.imgCount?function(a){var f=setTimeout(function(){if(s.stylesheets&&Pu(s,s.stylesheets),s.unsuspend){var N=s.unsuspend;s.unsuspend=null,N()}},6e4+i);0<s.imgBytes&&cm===0&&(cm=62500*Nj());var j=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Pu(s,s.stylesheets),s.unsuspend)){var N=s.unsuspend;s.unsuspend=null,N()}},(s.imgBytes>cm?50:800)+i);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(j)}}:null}function Lu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pu(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Iu=null;function Pu(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Iu=new Map,i.forEach(Zj,s),Iu=null,Lu.call(s))}function Zj(s,i){if(!(i.state.loading&4)){var a=Iu.get(s);if(a)var f=a.get(null);else{a=new Map,Iu.set(s,a);for(var j=s.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<j.length;N++){var I=j[N];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(a.set(I.dataset.precedence,I),f=I)}f&&a.set(null,f)}j=i.instance,I=j.getAttribute("data-precedence"),N=a.get(I)||f,N===f&&a.set(null,j),a.set(I,j),this.count++,f=Lu.bind(this),j.addEventListener("load",f),j.addEventListener("error",f),N?N.parentNode.insertBefore(j,N.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(j,s.firstChild)),i.state.loading|=4}}var ql={$$typeof:_,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function Qj(s,i,a,f,j,N,I,K,ie){this.tag=1,this.containerInfo=s,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=Pn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pn(0),this.hiddenUpdates=Pn(null),this.identifierPrefix=f,this.onUncaughtError=j,this.onCaughtError=N,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.incompleteTransitions=new Map}function $b(s,i,a,f,j,N,I,K,ie,ge,Ce,Re){return s=new Qj(s,i,a,I,ie,ge,Ce,Re,K),i=1,N===!0&&(i|=24),N=zn(3,null,null,i),s.current=N,N.stateNode=s,i=Uf(),i.refCount++,s.pooledCache=i,i.refCount++,N.memoizedState={element:f,isDehydrated:a,cache:i},Gf(N),s}function Db(s){return s?(s=eo,s):eo}function Ob(s,i,a,f,j,N){j=Db(j),f.context===null?f.context=j:f.pendingContext=j,f=kr(i),f.payload={element:a},N=N===void 0?null:N,N!==null&&(f.callback=N),a=jr(s,f,i),a!==null&&(Dn(a,s,i),wl(a,s,i))}function Lb(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var a=s.retryLane;s.retryLane=a!==0&&a<i?a:i}}function um(s,i){Lb(s,i),(s=s.alternate)&&Lb(s,i)}function Ib(s){if(s.tag===13||s.tag===31){var i=na(s,67108864);i!==null&&Dn(i,s,67108864),um(s,67108864)}}function Pb(s){if(s.tag===13||s.tag===31){var i=Vn();i=Ze(i);var a=na(s,i);a!==null&&Dn(a,s,i),um(s,i)}}var Bu=!0;function eR(s,i,a,f){var j=G.T;G.T=null;var N=ee.p;try{ee.p=2,dm(s,i,a,f)}finally{ee.p=N,G.T=j}}function tR(s,i,a,f){var j=G.T;G.T=null;var N=ee.p;try{ee.p=8,dm(s,i,a,f)}finally{ee.p=N,G.T=j}}function dm(s,i,a,f){if(Bu){var j=hm(f);if(j===null)Jp(s,i,f,zu,a),zb(s,f);else if(nR(j,s,i,a,f))f.stopPropagation();else if(zb(s,f),i&4&&-1<sR.indexOf(s)){for(;j!==null;){var N=he(j);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var I=os(N.pendingLanes);if(I!==0){var K=N;for(K.pendingLanes|=2,K.entangledLanes|=2;I;){var ie=1<<31-It(I);K.entanglements[1]|=ie,I&=~ie}Mi(N),(Ft&6)===0&&(wu=Ct()+500,Pl(0))}}break;case 31:case 13:K=na(N,2),K!==null&&Dn(K,N,2),Cu(),um(N,2)}if(N=hm(f),N===null&&Jp(s,i,f,zu,a),N===j)break;j=N}j!==null&&f.stopPropagation()}else Jp(s,i,f,null,a)}}function hm(s){return s=al(s),fm(s)}var zu=null;function fm(s){if(zu=null,s=re(s),s!==null){var i=c(s);if(i===null)s=null;else{var a=i.tag;if(a===13){if(s=h(i),s!==null)return s;s=null}else if(a===31){if(s=l(i),s!==null)return s;s=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return zu=s,null}function Bb(s){switch(s){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(dt()){case Lt:return 2;case mt:return 8;case Ut:case Ss:return 32;case Yt:return 268435456;default:return 32}default:return 32}}var pm=!1,Pr=null,Br=null,zr=null,Vl=new Map,Gl=new Map,Hr=[],sR="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 zb(s,i){switch(s){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Br=null;break;case"mouseover":case"mouseout":zr=null;break;case"pointerover":case"pointerout":Vl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gl.delete(i.pointerId)}}function Wl(s,i,a,f,j,N){return s===null||s.nativeEvent!==N?(s={blockedOn:i,domEventName:a,eventSystemFlags:f,nativeEvent:N,targetContainers:[j]},i!==null&&(i=he(i),i!==null&&Ib(i)),s):(s.eventSystemFlags|=f,i=s.targetContainers,j!==null&&i.indexOf(j)===-1&&i.push(j),s)}function nR(s,i,a,f,j){switch(i){case"focusin":return Pr=Wl(Pr,s,i,a,f,j),!0;case"dragenter":return Br=Wl(Br,s,i,a,f,j),!0;case"mouseover":return zr=Wl(zr,s,i,a,f,j),!0;case"pointerover":var N=j.pointerId;return Vl.set(N,Wl(Vl.get(N)||null,s,i,a,f,j)),!0;case"gotpointercapture":return N=j.pointerId,Gl.set(N,Wl(Gl.get(N)||null,s,i,a,f,j)),!0}return!1}function Hb(s){var i=re(s.target);if(i!==null){var a=c(i);if(a!==null){if(i=a.tag,i===13){if(i=h(a),i!==null){s.blockedOn=i,jn(s.priority,function(){Pb(a)});return}}else if(i===31){if(i=l(a),i!==null){s.blockedOn=i,jn(s.priority,function(){Pb(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){s.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Hu(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var a=hm(s.nativeEvent);if(a===null){a=s.nativeEvent;var f=new a.constructor(a.type,a);Va=f,a.target.dispatchEvent(f),Va=null}else return i=he(a),i!==null&&Ib(i),s.blockedOn=a,!1;i.shift()}return!0}function Ub(s,i,a){Hu(s)&&a.delete(i)}function iR(){pm=!1,Pr!==null&&Hu(Pr)&&(Pr=null),Br!==null&&Hu(Br)&&(Br=null),zr!==null&&Hu(zr)&&(zr=null),Vl.forEach(Ub),Gl.forEach(Ub)}function Uu(s,i){s.blockedOn===i&&(s.blockedOn=null,pm||(pm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,iR)))}var Fu=null;function Fb(s){Fu!==s&&(Fu=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fu===s&&(Fu=null);for(var i=0;i<s.length;i+=3){var a=s[i],f=s[i+1],j=s[i+2];if(typeof f!="function"){if(fm(f||a)===null)continue;break}var N=he(a);N!==null&&(s.splice(i,3),i-=3,hp(N,{pending:!0,data:j,method:a.method,action:f},f,j))}}))}function Eo(s){function i(ie){return Uu(ie,s)}Pr!==null&&Uu(Pr,s),Br!==null&&Uu(Br,s),zr!==null&&Uu(zr,s),Vl.forEach(i),Gl.forEach(i);for(var a=0;a<Hr.length;a++){var f=Hr[a];f.blockedOn===s&&(f.blockedOn=null)}for(;0<Hr.length&&(a=Hr[0],a.blockedOn===null);)Hb(a),a.blockedOn===null&&Hr.shift();if(a=(s.ownerDocument||s).$$reactFormReplay,a!=null)for(f=0;f<a.length;f+=3){var j=a[f],N=a[f+1],I=j[Xt]||null;if(typeof N=="function")I||Fb(a);else if(I){var K=null;if(N&&N.hasAttribute("formAction")){if(j=N,I=N[Xt]||null)K=I.formAction;else if(fm(j)!==null)continue}else K=I.action;typeof K=="function"?a[f+1]=K:(a.splice(f,3),f-=3),Fb(a)}}}function qb(){function s(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(I){return j=I})},focusReset:"manual",scroll:"manual"})}function i(){j!==null&&(j(),j=null),f||setTimeout(a,20)}function a(){if(!f&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,j=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),j!==null&&(j(),j=null)}}}function mm(s){this._internalRoot=s}qu.prototype.render=mm.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));var a=i.current,f=Vn();Ob(a,f,s,i,null,null)},qu.prototype.unmount=mm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Ob(s.current,2,null,s,null,null),Cu(),i[dn]=null}};function qu(s){this._internalRoot=s}qu.prototype.unstable_scheduleHydration=function(s){if(s){var i=tt();s={blockedOn:null,target:s,priority:i};for(var a=0;a<Hr.length&&i!==0&&i<Hr[a].priority;a++);Hr.splice(a,0,s),a===0&&Hb(s)}};var Vb=t.version;if(Vb!=="19.2.7")throw Error(r(527,Vb,"19.2.7"));ee.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=m(i),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var rR={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vu.isDisabled&&Vu.supportsFiber)try{$s=Vu.inject(rR),as=Vu}catch{}}return Yl.createRoot=function(s,i){if(!o(s))throw Error(r(299));var a=!1,f="",j=Zy,N=Qy,I=e0;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(j=i.onUncaughtError),i.onCaughtError!==void 0&&(N=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError)),i=$b(s,1,!1,null,null,a,f,null,j,N,I,qb),s[dn]=i.current,Xp(s),new mm(i)},Yl.hydrateRoot=function(s,i,a){if(!o(s))throw Error(r(299));var f=!1,j="",N=Zy,I=Qy,K=e0,ie=null;return a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(j=a.identifierPrefix),a.onUncaughtError!==void 0&&(N=a.onUncaughtError),a.onCaughtError!==void 0&&(I=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(ie=a.formState)),i=$b(s,1,!0,i,a??null,f,j,ie,N,I,K,qb),i.context=Db(null),a=i.current,f=Vn(),f=Ze(f),j=kr(f),j.callback=null,jr(a,j,f),a=f,i.current.lanes=a,ls(i,a),Mi(i),s[dn]=i.current,Xp(s),new qu(i)},Yl.version="19.2.7",Yl}var t1;function vR(){if(t1)return ym.exports;t1=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(),ym.exports=gR(),ym.exports}var _R=vR();const eC="sapiom-harness-theme",Eg=new Set;function yR(){var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)===!0}function bR(){const e=typeof window<"u"?window.localStorage.getItem(eC):null;return e==="light"||e==="dark"?e:yR()?"dark":"light"}let Tv=bR();function nf(){return Tv}function SR(e){Tv=e,document.documentElement.dataset.theme=e,window.localStorage.setItem(eC,e),Eg.forEach(t=>t(e))}function tC(){SR(Tv==="dark"?"light":"dark")}function Nv(e){return Eg.add(e),()=>Eg.delete(e)}function Oa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yo(e,t){const n=new Set(t);return Object.keys(e).every(r=>n.has(r))}function wR(e){return!Oa(e)||!Yo(e,["id","agentKey","label"])||typeof e.id!="string"||typeof e.agentKey!="string"||typeof e.label!="string"?null:{id:e.id,agentKey:e.agentKey,label:e.label}}function xR(e){return!Oa(e)||!Yo(e,["from","to","kind","basis","mode"])||typeof e.from!="string"||typeof e.to!="string"||e.kind!=="invokes"||e.basis!=="static"||e.mode!=="blocking"&&e.mode!=="async"?null:{from:e.from,to:e.to,kind:"invokes",basis:"static",mode:e.mode}}const CR=new Set(["unresolved-target","dynamic-target","duplicate-edge","projection-failed","duplicate-agent-key","inventory-extraction-failed"]);function ER(e){return!Oa(e)||!Yo(e,["code","message","agentKey"])||typeof e.code!="string"||!CR.has(e.code)||typeof e.message!="string"||e.agentKey!==void 0&&typeof e.agentKey!="string"?null:{code:e.code,message:e.message,...typeof e.agentKey=="string"?{agentKey:e.agentKey}:{}}}const s1={blocking:0,async:1},n1=(e,t)=>e===t?0:e<t?-1:1;function sC(e){const t=new Map;for(const n of e){const r=`${n.from}\0${n.to}`,o=t.get(r)??{from:n.from,to:n.to,modes:new Set};o.modes.add(n.mode),t.set(r,o)}return[...t.values()].sort((n,r)=>n1(n.from,r.from)||n1(n.to,r.to)).map(({from:n,to:r,modes:o})=>({from:n,to:r,modes:[...o].sort((c,h)=>s1[c]-s1[h])}))}function kR(e){if(!Oa(e)||!Yo(e,["kind","scope","nodes","edges","warnings"]))throw new Error("Invalid system graph response");if(e.kind!=="system"||!Oa(e.scope))throw new Error("Invalid system graph response");if(!Yo(e.scope,["kind","workspaceKey"]))throw new Error("Invalid system graph response");if(e.scope.kind!=="working-tree"||typeof e.scope.workspaceKey!="string")throw new Error("Invalid system graph response");if(!Array.isArray(e.nodes)||!Array.isArray(e.edges)||!Array.isArray(e.warnings))throw new Error("Invalid system graph response");const t=e.nodes.map(wR),n=e.edges.map(xR),r=e.warnings.map(ER);if(t.some(u=>u===null)||n.some(u=>u===null)||r.some(u=>u===null))throw new Error("Invalid system graph response");const o=t,c=n,h=r,l=new Set(o.map(u=>u.id));if(l.size!==o.length||c.some(u=>!l.has(u.from)||!l.has(u.to)))throw new Error("Invalid system graph response");return{kind:"system",scope:{kind:"working-tree",workspaceKey:e.scope.workspaceKey},nodes:o,edges:c,warnings:h}}const jR=new Set(["building","ready","stale","degraded"]);function RR(e){if(!Oa(e)||!Yo(e,["workspaceKey","revision","state","graph"])||typeof e.workspaceKey!="string"||!Number.isSafeInteger(e.revision)||e.revision<0||typeof e.state!="string"||!jR.has(e.state)||e.graph!==null&&!Oa(e.graph))throw new Error("Invalid system graph response");const t=e.state,n=e.graph===null?null:kR(e.graph);if(t==="building"&&n!==null||(t==="ready"||t==="stale")&&n===null)throw new Error("Invalid system graph response");if(n&&n.scope.workspaceKey!==e.workspaceKey)throw new Error("Invalid system graph response");return{workspaceKey:e.workspaceKey,revision:e.revision,state:t,graph:n}}function nC(e){return e.includes("\\")?"\\":"/"}function Mv(e,t){return`${e.trim().replace(/[\\/]+$/,"")}${nC(e)}${t.trim()}`}function zs(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Pc(e){const t=e.replace(/[\\/]+$/,"");if(t===""||/^[A-Za-z]:$/.test(t))return null;const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));if(n<0)return null;const r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?r+t[n]:r||"/"}function La(e){const t=e.replace(/[\\/]+$/,"");return t===e?e:t===""?e[0]:/^[A-Za-z]:$/.test(t)?t+e[t.length]:t}function Cn(e,t){return La(e.replace(/\\/g,"/"))===La(t.replace(/\\/g,"/"))}function Li(e,t){const n=La(e.replace(/\\/g,"/")),r=La(t.replace(/\\/g,"/"));return r===n?!0:n.endsWith("/")?r.startsWith(n):r.startsWith(`${n}/`)}function AR(e){return e.startsWith("/")||e.startsWith("~")||/^[A-Za-z]:[\\/]/.test(e)}function TR(e){const t=nC(e),n=e.split(/[\\/]/).filter(Boolean);return n.length<=2?e:`${t==="\\"?"":t}${n[0]}${t}…${t}${n[n.length-1]}`}const dh="application/x-sapiom-agent-move";function NR(e,t,n){const r=zs(e),o=Mv(t,r);if(Cn(e,t))return{ok:!1,reason:`Can't move ${r} into itself.`};const c=Pc(e);if(c!=null&&Cn(c,t))return{ok:!1,reason:""};if(Li(e,t))return{ok:!1,reason:`Can't move ${r} inside itself.`};const h=l=>Li(e,l);return n.some(l=>!h(l)&&Li(o,l))?{ok:!1,reason:`${zs(t)} already has an agent called ${r}.`}:{ok:!0,from:e,to:o,name:r}}const iC=Date.now(),on=e=>new Date(iC-e*6e4).toISOString(),ct=e=>new Date(iC-e*24*60*6e4).toISOString(),i1="/Users/demo/acme-app";on(1),on(1),on(42),on(20),ct(2),ct(1),ct(1),ct(1),ct(3),ct(3),on(0),on(0),on(3),on(3);const rC=["design-eng","design-eng-fix","design-eng-ij","design-eng-main","worktrees/design-agent-port-pin","worktrees/design-agent-terminology"];function Rc(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("mockFixtures")==="flood"}const MR=()=>Object.fromEntries([...rC.flatMap(e=>{const t=e.split("/"),n=`/Users/demo/${e}`;return[...t.length>1?[[`/Users/demo/${t[0]}`,[t[1]]]]:[],[n,["ari"]],[`${n}/ari`,["orchestration","brain"]],[`${n}/ari/orchestration`,[]],[`${n}/ari/brain`,[]]]}),["/Users/demo/team-tools",["slack-notifier"]],["/Users/demo/other-tools",["slack-notifier"]],["/Users/demo/misc",Array.from({length:10},(e,t)=>`pkg${t+1}`)],...Array.from({length:10},(e,t)=>[`/Users/demo/misc/pkg${t+1}`,["agent"]])]);({"/Users/demo":[...Rc()?["design-eng","design-eng-fix","design-eng-ij","design-eng-main","worktrees","misc","team-tools","other-tools"]:[]],...Rc()?MR():{}});on(1),ct(1),ct(1),ct(3),ct(6),ct(45),ct(1);on(48),on(1),on(48),on(47),on(46),on(45),on(3),on(2),ct(1),ct(1),ct(1),ct(1),ct(1),ct(1),ct(1),ct(1),ct(1),ct(3),ct(3),ct(3),ct(3),ct(3),ct(3),ct(3),ct(3),ct(1),ct(1),ct(1),ct(1),ct(45),ct(45),ct(45),ct(45),ct(45),ct(45),ct(45),ct(45);const ui="/Users/demo/polsia",mn=(e,t,n={})=>({name:t,path:e,definitionId:null,definitionSlug:t,activeBuildRunId:null,activeBuildRunStatus:null,source:"scan",...n}),$R=[mn(`${ui}/backend/src/agents/ads`,"ads"),mn(`${ui}/backend/src/agents/outreach`,"outreach"),mn(`${ui}/scripts/tools/rollup`,"rollup",{definitionSlug:null}),mn(`${ui}/packages/harness/web/src/components/mailer`,"mailer",{definitionId:7701,activeBuildRunId:"build-mailer-ready",activeBuildRunStatus:"ready"}),mn(`${ui}/packages/harness/web/src/components/sender`,"sender"),mn(`${ui}/services/gateway`,"gateway"),mn(`${ui}/services/workers/ads`,"ads-worker"),mn(`${ui}/services/workers/queue`,"queue"),mn("/Users/demo/dashboard-keeper","dashboard-keeper")],DR=[mn(`${ui}/backend/src/pipelines/ingest`,"ingest"),mn(`${ui}/services/etl/ingest`,"ingest"),...rC.flatMap(e=>[mn(`/Users/demo/${e}/ari/orchestration`,"ari-grade-repo"),mn(`/Users/demo/${e}/ari/brain`,"brain-agent")]),mn("/Users/demo/team-tools/slack-notifier","@sapiom/example-slack-notifier"),mn("/Users/demo/other-tools/slack-notifier","@sapiom/example-slack-notifier"),...Array.from({length:10},(e,t)=>mn(`/Users/demo/misc/pkg${t+1}/agent`,`filler-${t+1}`))],OR=[ui,`${ui}/services/workers`,"/Users/demo/dashboard-keeper"];function aC(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("mockFixtures")==="deep"}[...aC()||Rc()?$R:[],...Rc()?DR:[]];[...[2,4,5].map((e,t)=>({agentSessionId:`search-standup-${t+1}`,harness:"claude-code",cwd:"/Users/demo/acme-app",title:"Standup summary for #eng",lastActiveAt:ct(e),source:"transcript",resumeMode:"rehydrate",turnCount:6-t})),ct(3),ct(1),ct(6)];[...aC()||Rc()?OR:[]];function oC(){return!1}function Ma(e){return(e==null?void 0:e.boundWorkflowPath)??null}class gn extends Error{constructor(n,r,o){super(r);gm(this,"status");gm(this,"reason");this.name="ApiError",this.status=n,this.reason=o}}function Fo(){const e=window.__HARNESS__;return e!=null&&e.token?e.token:new URLSearchParams(window.location.search).get("token")??""}class LR{startAuth(){return this.request("/api/auth/start",{method:"POST"})}disconnect(){return this.request("/api/auth/disconnect",{method:"POST"})}authStatus(){return this.request("/api/auth/status")}async response(t,n){const r=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":Fo(),...n==null?void 0:n.headers}});if(!r.ok){const o=await r.text().catch(()=>"");let c;try{const h=o?JSON.parse(o):void 0;h&&typeof h=="object"&&typeof h.error=="string"&&(c=h.error)}catch{}throw new gn(r.status,`${(n==null?void 0:n.method)??"GET"} ${t} → ${r.status}${o?`: ${o}`:""}`,c)}return r}async request(t,n){const r=await this.response(t,n);if(r.status!==204)return await r.json()}getState(){return this.request("/api/state")}async getSystemGraph(t,n={}){const r=`/api/workspaces/${encodeURIComponent(t)}/system-graph`,o=await this.response(n.refresh?`${r}/refresh`:r,n.refresh?{method:"POST"}:void 0),c=RR(await o.json());if(c.workspaceKey!==t)throw new Error("Invalid system graph response");return c}createSession(t){return this.request("/api/sessions",{method:"POST",body:JSON.stringify({theme:nf(),...t})})}attachFile(t,n){return this.request(`/api/sessions/${encodeURIComponent(t)}/attachments`,{method:"POST",body:JSON.stringify(n)})}listSessions(){return this.request("/api/sessions")}sessionHistory(t){return this.request(`/api/sessions/history?cwd=${encodeURIComponent(t)}`)}async sessionRecord(t){try{return await this.request(`/api/sessions/${encodeURIComponent(t)}/record`)}catch(n){if(n instanceof gn&&(n.status===404||n.status===501))return null;throw n}}resumeSession(t){return this.request(`/api/sessions/${encodeURIComponent(t)}/resume`,{method:"POST"})}adoptSession(t){return this.request("/api/sessions/adopt",{method:"POST",body:JSON.stringify(t)})}async killSession(t){await this.request(`/api/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async injectInput(t,n){await this.request(`/api/sessions/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(n)})}listWorkflows(){return this.request("/api/workflows")}getWorkflowInputContract(t){return this.request(`/api/workflows/${encodeURIComponent(t)}/input-contract`)}getWorkflowGraph(t){return this.request(`/api/workflows/${encodeURIComponent(t)}/graph`)}connectWorkflow(t){return this.request("/api/workflows/connect",{method:"POST",body:JSON.stringify({path:t})})}scanWorkflows(t){return this.request("/api/workflows/scan",{method:"POST",body:JSON.stringify({root:t})})}async moveAgent(t,n){await this.request("/api/agents/move",{method:"POST",body:JSON.stringify({from:t,to:n})})}listHarnesses(){return this.request("/api/harnesses")}async getRailState(t){return(await this.request(`/api/studio-rail?root=${encodeURIComponent(t)}`)).raw}async saveRailState(t,n){await this.request(`/api/studio-rail?root=${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({raw:n})})}async clearRailState(t){await this.request(`/api/studio-rail?root=${encodeURIComponent(t)}`,{method:"DELETE"})}async listLaunchEdges(){return(await this.request("/api/studio-rail/launch-edges")).edges}listMacros(){return this.request("/api/macros")}async runMacro(t,n){await this.request(`/api/macros/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(n)})}getSettings(){return this.request("/api/settings")}updateSettings(t){return this.request("/api/settings",{method:"PATCH",body:JSON.stringify(t)})}listDir(t){const n=t?`?path=${encodeURIComponent(t)}`:"";return this.request(`/api/fs/list${n}`)}bindWorkflow(t,n){const r={workflowPath:n};return this.request(`/api/sessions/${encodeURIComponent(t)}/workflow`,{method:"PATCH",body:JSON.stringify(r)})}listTemplates(){return this.request("/api/templates")}getTemplate(t){return this.request(`/api/templates/${encodeURIComponent(t)}`)}getAccountPlan(){return this.request("/api/account/plan")}getRunState(t){return this.request(`/api/runs/${encodeURIComponent(t)}/state`)}async runLocal(t,n){const r=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":Fo()},body:JSON.stringify(t)});if(!r.ok||!r.body){const u=await r.text().catch(()=>"");throw new gn(r.status,`POST /api/runs/local → ${r.status}${u?`: ${u}`:""}`,void 0)}const o=r.body.getReader(),c=new TextDecoder;let h="";const l=(u,m)=>{h+=u;const{lines:g,rest:p}=PR(h,m);h=p;for(const S of g){const w=BR(S);w&&n(w)}};for(;;){const{done:u,value:m}=await o.read();if(u)break;l(c.decode(m,{stream:!0}),!1)}l(c.decode(),!0)}async deploy(t,n){const r=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},n);return zR(r)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,n,r){const o=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":Fo(),...n.headers}});if(!o.ok||!o.body){const g=await o.text().catch(()=>"");let p;try{const S=g?JSON.parse(g):void 0;S&&typeof S=="object"&&typeof S.error=="string"&&(p=S.error)}catch{}throw new gn(o.status,`${n.method??"GET"} ${t} → ${o.status}${g?`: ${g}`:""}`,p)}const c=[],h=o.body.getReader(),l=new TextDecoder;let u="";const m=g=>{u+=g;let p=u.indexOf(`
50
+ `);for(;p!==-1;){const S=u.slice(0,p);u=u.slice(p+1);const w=IR(S);w!==void 0&&(c.push(w),r==null||r(w)),p=u.indexOf(`
51
+ `)}};for(;;){const{done:g,value:p}=await h.read();if(g)break;m(l.decode(p,{stream:!0}))}return m(l.decode()+`
52
+ `),c}}function IR(e){const t=e.trim();if(t==="")return;let n;try{n=JSON.parse(t)}catch{return}return n===null?void 0:n}function PR(e,t){const n=e.split(`
53
+ `);if(t)return{lines:n.filter(o=>o.trim()!==""),rest:""};const r=n.pop()??"";return{lines:n.filter(o=>o.trim()!==""),rest:r}}function BR(e){const t=e.trim();if(t==="")return null;let n;try{n=JSON.parse(t)}catch{return null}return typeof n!="object"||n===null||Array.isArray(n)?null:n}function zR(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.phase==="ready"||n.phase==="error")return n}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function Bc(){return new LR}function _c(e){var r,o;const t=(r=e.inputSchema)==null?void 0:r.properties;if(!t)return[];const n=new Set(((o=e.inputSchema)==null?void 0:o.required)??[]);return Object.entries(t).map(([c,h])=>({name:c,type:typeof(h==null?void 0:h.type)=="string"?h.type:"unknown",required:n.has(c)})).sort((c,h)=>Number(h.required)-Number(c.required))}function fr(e){return e<1e3?`${e}ms`:`${Math.round(e/100)/10}s`}function HR(e,t){const n=[],r=_c(e).length;r>0&&n.push(r===1?"1 input":`${r} inputs`);const o=t.filter(c=>c.from===e.id&&c.kind==="branching").length;return o>1&&n.push(`${o} branches`),e.timeoutMs&&e.timeoutMs>0&&n.push(`${fr(e.timeoutMs)} limit`),n}function UR(e){const t=e.nodes.filter(r=>r.kind==="terminal-success"||r.kind==="terminal-warn").length;return{steps:e.nodes.filter(r=>r.kind!=="terminal-success"&&r.kind!=="terminal-warn"&&r.kind!=="launched-workflow").length,exits:t}}function FR(e){const{steps:t,exits:n}=UR(e),r=[`${t} ${t===1?"step":"steps"}`];return n>0&&r.push(`${n} ${n===1?"exit":"exits"}`),r.join(" · ")}function lC(e){switch(e){case"entry":return"Entry step";case"pause":return"Pause";case"terminal-success":return"Terminal · success";case"terminal-warn":return"Terminal · needs attention";case"launched-workflow":return"Launched agent";default:return"Step"}}function kg(e,t=0){if(!(t>32)){if(e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>kg(n,t+1));if(typeof e=="object")return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,kg(r,t+1)]).filter(n=>n[1]!==void 0))}}function qR(e){if(!e||typeof e!="object")return null;const t=kg(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function VR(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const n=r=>typeof r=="string"?r:"";return{name:n(t.name),entry:n(t.entry),nodes:t.nodes.map(r=>({id:n(r.id),kind:n(r.kind),label:n(r.label),role:n(r.role),description:n(r.description),timeoutMs:typeof r.timeoutMs=="number"&&r.timeoutMs>0?r.timeoutMs:null,inputSchema:qR(r.inputSchema),capabilities:Array.isArray(r.capabilities)?r.capabilities.filter(o=>typeof o=="string"):[]})),edges:t.edges.map(r=>({from:n(r.from),to:n(r.to),kind:n(r.kind),label:n(r.label)})),groups:Array.isArray(t.groups)?t.groups.map(r=>({label:n(r.label),nodeIds:Array.isArray(r.nodeIds)?r.nodeIds.filter(o=>typeof o=="string"):[]})):[],warnings:Array.isArray(t.warnings)?t.warnings.filter(r=>typeof r=="string"):[]}}const cC="sapiom-harness-ui-prefs";function hi(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(cC);return e?JSON.parse(e):{}}catch{return{}}}function Ci(e){if(!(typeof window>"u"))try{window.localStorage.setItem(cC,JSON.stringify({...hi(),...e}))}catch{}}function $v(e,t){return!e||e.stubbed!==!0?!1:e.steps.some(n=>n.name===t)}function GR(e){if(!e)return null;const t={};return e.unusedStubs&&e.unusedStubs.length>0&&(t.unusedStubs=e.unusedStubs),e.stubWarnings&&e.stubWarnings.length>0&&(t.stubWarnings=e.stubWarnings),t.unusedStubs||t.stubWarnings?t:null}function rf(e,t){if(!e)return null;for(let n=e.steps.length-1;n>=0;n--)if(e.steps[n].name===t)return e.steps[n];return null}const r1=3e3,a1=2e3;function WR(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function o1(e){let t;if(typeof e=="string")t=e;else try{t=JSON.stringify(e,null,2)??String(e)}catch{t=String(e)}return t.length>a1?`${t.slice(0,a1)}
54
+ … (truncated, ${t.length} chars total)`:t}function KR(e,t,n){const r=[];r.push(`Step: ${e.name}`),r.push(`Status: ${e.status}`),e.latencyMs!=null&&r.push(`Latency: ${WR(e.latencyMs)}`),e.status==="failed"&&e.error&&r.push(`Error: ${e.error}`),(t==null?void 0:t.input)!==void 0&&r.push(`
55
+ Input:
56
+ ${o1(t.input)}`),(t==null?void 0:t.output)!==void 0&&r.push(`
57
+ Output:
58
+ ${o1(t.output)}`);const o=t==null?void 0:t.calls;if(o!==void 0)if(o.length>0){r.push(`
59
+ Capabilities called:`);for(const c of o){const h=c.stubUsed?" (stubbed)":"";r.push(` - ${c.capability}${h}`)}}else r.push(`
60
+ Capabilities called: none (the step made zero capability calls).`);else if(n!=null&&n.capabilities&&n.capabilities.length>0){r.push(`
61
+ Capabilities declared (no call trace):`);for(const c of n.capabilities)r.push(` - ${c}`)}if(t!=null&&t.unusedStubs&&t.unusedStubs.length>0){r.push(`
62
+ Unused stubs (supplied but matched no call):`);for(const c of t.unusedStubs)r.push(` - ${c}`)}if(t!=null&&t.stubWarnings&&t.stubWarnings.length>0){r.push(`
63
+ Stub warnings:`);for(const c of t.stubWarnings)r.push(` - ${c}`)}if(e.logSlice){const c=e.logSlice.trimEnd(),h=c.length>r1?c.slice(c.length-r1):c;r.push(`
64
+ Logs:
65
+ ${h}`)}return r.join(`
66
+ `)}const YR=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,XR=/https?:\/\/[^\s"'<>`\])\]]+/gi,JR=/[.,;:)\]}\s]+$/;function l1(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function ZR(e){const t=new Set,n=[],r=o=>{const c=o.matchAll(XR);for(const[h]of c){const l=h.replace(JR,"");if(!l||t.has(l))continue;t.add(l);const u=YR.test(l)?"image":"other";n.push({url:l,kind:u})}};if(e.output!==void 0&&r(l1(e.output)),e.logSlice&&r(e.logSlice),e.calls)for(const o of e.calls)o.result!==void 0&&r(l1(o.result));return n}const Dv="https://app.sapiom.ai",uC=`${Dv}/agents`,c1=`${Dv}/settings?tab=billing`,QR=Dv;function af(e){return`${uC}/${e}`}const eA="https://docs.sapiom.ai",tA=`${eA}/agents/quick-start`;function dC(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}/**
67
+ * @license lucide-react v1.23.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const hC=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
72
+ * @license lucide-react v1.23.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const sA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
77
+ * @license lucide-react v1.23.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const nA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
82
+ * @license lucide-react v1.23.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const u1=e=>{const t=nA(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
87
+ * @license lucide-react v1.23.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */var xm={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
92
+ * @license lucide-react v1.23.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const iA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},rA=O.createContext({}),aA=()=>O.useContext(rA),oA=O.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o="",children:c,iconNode:h,...l},u)=>{const{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:p=!1,color:S="currentColor",className:w=""}=aA()??{},A=r??p?Number(n??g)*24/Number(t??m):n??g;return O.createElement("svg",{ref:u,...xm,width:t??m??xm.width,height:t??m??xm.height,stroke:e??S,strokeWidth:A,className:hC("lucide",w,o),...!c&&!iA(l)&&{"aria-hidden":"true"},...l},[...h.map(([E,y])=>O.createElement(E,y)),...Array.isArray(c)?c:[c]])});/**
97
+ * @license lucide-react v1.23.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const He=(e,t)=>{const n=O.forwardRef(({className:r,...o},c)=>O.createElement(oA,{ref:c,iconNode:t,className:hC(`lucide-${sA(u1(e))}`,`lucide-${e}`,r),...o}));return n.displayName=u1(e),n};/**
102
+ * @license lucide-react v1.23.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const lA=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],cA=He("arrow-down",lA);/**
107
+ * @license lucide-react v1.23.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const uA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],dA=He("arrow-left",uA);/**
112
+ * @license lucide-react v1.23.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const hA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],fA=He("arrow-right",hA);/**
117
+ * @license lucide-react v1.23.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const pA=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],mA=He("arrow-up-right",pA);/**
122
+ * @license lucide-react v1.23.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const gA=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vA=He("arrow-up",gA);/**
127
+ * @license lucide-react v1.23.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const _A=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],yA=He("book-open",_A);/**
132
+ * @license lucide-react v1.23.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const bA=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],SA=He("brain",bA);/**
137
+ * @license lucide-react v1.23.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const wA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xA=He("check",wA);/**
142
+ * @license lucide-react v1.23.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const CA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],EA=He("chevron-down",CA);/**
147
+ * @license lucide-react v1.23.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const kA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jA=He("chevron-right",kA);/**
152
+ * @license lucide-react v1.23.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const RA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],AA=He("chevron-up",RA);/**
157
+ * @license lucide-react v1.23.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const TA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],NA=He("circle-check",TA);/**
162
+ * @license lucide-react v1.23.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const MA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],$A=He("circle-question-mark",MA);/**
167
+ * @license lucide-react v1.23.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const DA=[["path",{d:"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057",key:"1uxyv8"}],["path",{d:"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78",key:"99tcn7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],OA=He("cloud-off",DA);/**
172
+ * @license lucide-react v1.23.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const LA=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],IA=He("cloud-upload",LA);/**
177
+ * @license lucide-react v1.23.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const PA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],BA=He("cloud",PA);/**
182
+ * @license lucide-react v1.23.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const zA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],HA=He("code",zA);/**
187
+ * @license lucide-react v1.23.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const UA=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],FA=He("copy",UA);/**
192
+ * @license lucide-react v1.23.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const qA=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],VA=He("corner-down-right",qA);/**
197
+ * @license lucide-react v1.23.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const GA=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],WA=He("corner-left-up",GA);/**
202
+ * @license lucide-react v1.23.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const KA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],YA=He("ellipsis-vertical",KA);/**
207
+ * @license lucide-react v1.23.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const XA=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],JA=He("external-link",XA);/**
212
+ * @license lucide-react v1.23.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const ZA=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],QA=He("flask-conical",ZA);/**
217
+ * @license lucide-react v1.23.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const eT=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],tT=He("folder-open",eT);/**
222
+ * @license lucide-react v1.23.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const sT=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],nT=He("folder-plus",sT);/**
227
+ * @license lucide-react v1.23.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const iT=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],rT=He("folder",iT);/**
232
+ * @license lucide-react v1.23.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const aT=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],oT=He("frame",aT);/**
237
+ * @license lucide-react v1.23.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const lT=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],cT=He("git-branch",lT);/**
242
+ * @license lucide-react v1.23.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const uT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],dT=He("globe",uT);/**
247
+ * @license lucide-react v1.23.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const hT=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],fT=He("hammer",hT);/**
252
+ * @license lucide-react v1.23.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const pT=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],mT=He("history",pT);/**
257
+ * @license lucide-react v1.23.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const gT=[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],vT=He("image-up",gT);/**
262
+ * @license lucide-react v1.23.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const _T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],yT=He("info",_T);/**
267
+ * @license lucide-react v1.23.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const bT=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],ST=He("layout-template",bT);/**
272
+ * @license lucide-react v1.23.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const wT=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],xT=He("list-checks",wT);/**
277
+ * @license lucide-react v1.23.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const CT=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],ET=He("list",CT);/**
282
+ * @license lucide-react v1.23.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const kT=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],jT=He("loader",kT);/**
287
+ * @license lucide-react v1.23.0 - ISC
288
+ *
289
+ * This source code is licensed under the ISC license.
290
+ * See the LICENSE file in the root directory of this source tree.
291
+ */const RT=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],AT=He("log-out",RT);/**
292
+ * @license lucide-react v1.23.0 - ISC
293
+ *
294
+ * This source code is licensed under the ISC license.
295
+ * See the LICENSE file in the root directory of this source tree.
296
+ */const TT=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],NT=He("maximize-2",TT);/**
297
+ * @license lucide-react v1.23.0 - ISC
298
+ *
299
+ * This source code is licensed under the ISC license.
300
+ * See the LICENSE file in the root directory of this source tree.
301
+ */const MT=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],$T=He("menu",MT);/**
302
+ * @license lucide-react v1.23.0 - ISC
303
+ *
304
+ * This source code is licensed under the ISC license.
305
+ * See the LICENSE file in the root directory of this source tree.
306
+ */const DT=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],OT=He("message-square",DT);/**
307
+ * @license lucide-react v1.23.0 - ISC
308
+ *
309
+ * This source code is licensed under the ISC license.
310
+ * See the LICENSE file in the root directory of this source tree.
311
+ */const LT=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],IT=He("minimize-2",LT);/**
312
+ * @license lucide-react v1.23.0 - ISC
313
+ *
314
+ * This source code is licensed under the ISC license.
315
+ * See the LICENSE file in the root directory of this source tree.
316
+ */const PT=[["path",{d:"M5 12h14",key:"1ays0h"}]],BT=He("minus",PT);/**
317
+ * @license lucide-react v1.23.0 - ISC
318
+ *
319
+ * This source code is licensed under the ISC license.
320
+ * See the LICENSE file in the root directory of this source tree.
321
+ */const zT=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],HT=He("moon",zT);/**
322
+ * @license lucide-react v1.23.0 - ISC
323
+ *
324
+ * This source code is licensed under the ISC license.
325
+ * See the LICENSE file in the root directory of this source tree.
326
+ */const UT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],FT=He("panel-left-close",UT);/**
327
+ * @license lucide-react v1.23.0 - ISC
328
+ *
329
+ * This source code is licensed under the ISC license.
330
+ * See the LICENSE file in the root directory of this source tree.
331
+ */const qT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],VT=He("panel-left-open",qT);/**
332
+ * @license lucide-react v1.23.0 - ISC
333
+ *
334
+ * This source code is licensed under the ISC license.
335
+ * See the LICENSE file in the root directory of this source tree.
336
+ */const GT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],WT=He("panel-right-close",GT);/**
337
+ * @license lucide-react v1.23.0 - ISC
338
+ *
339
+ * This source code is licensed under the ISC license.
340
+ * See the LICENSE file in the root directory of this source tree.
341
+ */const KT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],YT=He("panel-right-open",KT);/**
342
+ * @license lucide-react v1.23.0 - ISC
343
+ *
344
+ * This source code is licensed under the ISC license.
345
+ * See the LICENSE file in the root directory of this source tree.
346
+ */const XT=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],JT=He("paperclip",XT);/**
347
+ * @license lucide-react v1.23.0 - ISC
348
+ *
349
+ * This source code is licensed under the ISC license.
350
+ * See the LICENSE file in the root directory of this source tree.
351
+ */const ZT=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],QT=He("pencil",ZT);/**
352
+ * @license lucide-react v1.23.0 - ISC
353
+ *
354
+ * This source code is licensed under the ISC license.
355
+ * See the LICENSE file in the root directory of this source tree.
356
+ */const eN=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],tN=He("play",eN);/**
357
+ * @license lucide-react v1.23.0 - ISC
358
+ *
359
+ * This source code is licensed under the ISC license.
360
+ * See the LICENSE file in the root directory of this source tree.
361
+ */const sN=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],nN=He("plug",sN);/**
362
+ * @license lucide-react v1.23.0 - ISC
363
+ *
364
+ * This source code is licensed under the ISC license.
365
+ * See the LICENSE file in the root directory of this source tree.
366
+ */const iN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],rN=He("plus",iN);/**
367
+ * @license lucide-react v1.23.0 - ISC
368
+ *
369
+ * This source code is licensed under the ISC license.
370
+ * See the LICENSE file in the root directory of this source tree.
371
+ */const aN=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],oN=He("radio",aN);/**
372
+ * @license lucide-react v1.23.0 - ISC
373
+ *
374
+ * This source code is licensed under the ISC license.
375
+ * See the LICENSE file in the root directory of this source tree.
376
+ */const lN=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],cN=He("refresh-cw",lN);/**
377
+ * @license lucide-react v1.23.0 - ISC
378
+ *
379
+ * This source code is licensed under the ISC license.
380
+ * See the LICENSE file in the root directory of this source tree.
381
+ */const uN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dN=He("search",uN);/**
382
+ * @license lucide-react v1.23.0 - ISC
383
+ *
384
+ * This source code is licensed under the ISC license.
385
+ * See the LICENSE file in the root directory of this source tree.
386
+ */const hN=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],fN=He("settings",hN);/**
387
+ * @license lucide-react v1.23.0 - ISC
388
+ *
389
+ * This source code is licensed under the ISC license.
390
+ * See the LICENSE file in the root directory of this source tree.
391
+ */const pN=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],mN=He("sliders-horizontal",pN);/**
392
+ * @license lucide-react v1.23.0 - ISC
393
+ *
394
+ * This source code is licensed under the ISC license.
395
+ * See the LICENSE file in the root directory of this source tree.
396
+ */const gN=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],vN=He("sparkles",gN);/**
397
+ * @license lucide-react v1.23.0 - ISC
398
+ *
399
+ * This source code is licensed under the ISC license.
400
+ * See the LICENSE file in the root directory of this source tree.
401
+ */const _N=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],yN=He("square-terminal",_N);/**
402
+ * @license lucide-react v1.23.0 - ISC
403
+ *
404
+ * This source code is licensed under the ISC license.
405
+ * See the LICENSE file in the root directory of this source tree.
406
+ */const bN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],SN=He("square",bN);/**
407
+ * @license lucide-react v1.23.0 - ISC
408
+ *
409
+ * This source code is licensed under the ISC license.
410
+ * See the LICENSE file in the root directory of this source tree.
411
+ */const wN=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],xN=He("sun",wN);/**
412
+ * @license lucide-react v1.23.0 - ISC
413
+ *
414
+ * This source code is licensed under the ISC license.
415
+ * See the LICENSE file in the root directory of this source tree.
416
+ */const CN=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],EN=He("tags",CN);/**
417
+ * @license lucide-react v1.23.0 - ISC
418
+ *
419
+ * This source code is licensed under the ISC license.
420
+ * See the LICENSE file in the root directory of this source tree.
421
+ */const kN=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jN=He("trash-2",kN);/**
422
+ * @license lucide-react v1.23.0 - ISC
423
+ *
424
+ * This source code is licensed under the ISC license.
425
+ * See the LICENSE file in the root directory of this source tree.
426
+ */const RN=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],AN=He("triangle-alert",RN);/**
427
+ * @license lucide-react v1.23.0 - ISC
428
+ *
429
+ * This source code is licensed under the ISC license.
430
+ * See the LICENSE file in the root directory of this source tree.
431
+ */const TN=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],NN=He("wand-sparkles",TN);/**
432
+ * @license lucide-react v1.23.0 - ISC
433
+ *
434
+ * This source code is licensed under the ISC license.
435
+ * See the LICENSE file in the root directory of this source tree.
436
+ */const MN=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],$N=He("workflow",MN);/**
437
+ * @license lucide-react v1.23.0 - ISC
438
+ *
439
+ * This source code is licensed under the ISC license.
440
+ * See the LICENSE file in the root directory of this source tree.
441
+ */const DN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ON=He("x",DN);/**
442
+ * @license lucide-react v1.23.0 - ISC
443
+ *
444
+ * This source code is licensed under the ISC license.
445
+ * See the LICENSE file in the root directory of this source tree.
446
+ */const LN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],IN=He("zap",LN);/**
447
+ * @license lucide-react v1.23.0 - ISC
448
+ *
449
+ * This source code is licensed under the ISC license.
450
+ * See the LICENSE file in the root directory of this source tree.
451
+ */const PN=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],BN=He("zoom-in",PN);/**
452
+ * @license lucide-react v1.23.0 - ISC
453
+ *
454
+ * This source code is licensed under the ISC license.
455
+ * See the LICENSE file in the root directory of this source tree.
456
+ */const zN=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],HN=He("zoom-out",zN),UN={ArrowDown:cA,ArrowLeft:dA,ArrowRight:fA,ArrowUp:vA,ArrowUpRight:mA,BookOpen:yA,Brain:SA,Check:xA,ChevronDown:EA,ChevronRight:jA,ChevronUp:AA,CircleCheck:NA,Cloud:BA,CloudOff:OA,CloudUpload:IA,Code:HA,Copy:FA,CornerDownRight:VA,CornerLeftUp:WA,ExternalLink:JA,FlaskConical:QA,Folder:rT,GitBranch:cT,FolderOpen:tT,FolderPlus:nT,Frame:oT,Globe:dT,Hammer:fT,History:mT,ImageUp:vT,Info:yT,LayoutTemplate:ST,List:ET,ListChecks:xT,Loader:jT,LogOut:AT,Maximize2:NT,Menu:$T,MessageSquare:OT,Minimize2:IT,Minus:BT,EllipsisVertical:YA,Moon:HT,PanelLeftClose:FT,PanelLeftOpen:VT,PanelRightClose:WT,PanelRightOpen:YT,Paperclip:JT,Pencil:QT,Play:tN,Plug:nN,Plus:rN,Radio:oN,RefreshCw:cN,Search:dN,Settings:fN,SlidersHorizontal:mN,Sparkles:vN,Square:SN,SquareTerminal:yN,Sun:xN,Tags:EN,Trash2:jN,TriangleAlert:AN,Wand2:NN,Workflow:$N,X:ON,Zap:IN,ZoomIn:BN,ZoomOut:HN};function ue({name:e,size:t=16}){const n=UN[e]??$A;return d.jsx(n,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}const FN="data-ph-capture-attribute-";function Dt(e){const t={};for(const[n,r]of Object.entries(e)){if(r==null)continue;const o=String(r);o.length!==0&&(t[`${FN}${n}`]=o)}return t}const ko=8,qN=1200,d1=12;function VN(e){return/<\/?(?:!doctype|html|head|body|style|script|main|section|article|div|span|img|svg|meta|link)\b/i.test(e)}function GN(e){const t=e.split(/\r?\n/),r=t.slice(0,d1).join(`
457
+ `).slice(0,qN),o=t.length>d1||e.length>r.length;return{kind:VN(e)?"html":"text",truncated:o,preview:o?`${r.trimEnd()}
458
+ …`:e,omittedCharacters:o?Math.max(0,e.length-r.length):0}}function WN(e){let t=null;try{return t=document.createElement("textarea"),t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy")}catch{return!1}finally{t==null||t.remove()}}function fC(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:null}catch{return null}}function KN(e){var t;return((t=e.pathname.split(".").pop())==null?void 0:t.toLowerCase())??""}function pC(e){const t=e.pathname.split("/").filter(Boolean).pop();if(!t)return e.hostname;try{return`${e.hostname} / ${decodeURIComponent(t)}`}catch{return`${e.hostname} / ${t}`}}function YN({url:e}){const[t,n]=O.useState(!1),r=KN(e),o=pC(e),c=["png","jpg","jpeg","gif","webp","avif","svg"].includes(r),h=["mp3","wav","ogg","m4a","aac"].includes(r),l=["mp4","webm","mov","m4v"].includes(r),u=["pdf","zip","csv","json","docx","xlsx","pptx","txt"].includes(r);return t||!c&&!h&&!l?d.jsxs("a",{className:"artifact-link",href:e.href,target:"_blank",rel:"noreferrer",download:u||void 0,children:[d.jsx(ue,{name:t?"TriangleAlert":u?"ArrowDown":"ExternalLink",size:13}),d.jsx("span",{children:t?`Preview unavailable · ${o}`:u?`Download · ${o}`:o})]}):c?d.jsxs("figure",{className:"artifact-media",children:[d.jsx("img",{src:e.href,alt:o,loading:"lazy",onError:()=>n(!0)}),d.jsx("figcaption",{children:d.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]}):h?d.jsxs("figure",{className:"artifact-media",children:[d.jsx("audio",{controls:!0,preload:"metadata",onError:()=>n(!0),children:d.jsx("source",{src:e.href})}),d.jsx("figcaption",{children:d.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]}):d.jsxs("figure",{className:"artifact-media",children:[d.jsx("video",{controls:!0,preload:"metadata",onError:()=>n(!0),children:d.jsx("source",{src:e.href})}),d.jsx("figcaption",{children:d.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]})}function Cm(e){const t=[],n=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|(https?:\/\/[^\s<]+)/g;let r=0,o;for(;o=n.exec(e);){o.index>r&&t.push(e.slice(r,o.index));const c=o[2]??o[3],h=c?fC(c.replace(/[.,;!?]+$/,"")):null;h?t.push(d.jsx("a",{href:h.href,target:"_blank",rel:"noreferrer",children:o[1]??pC(h)},`${o.index}-${h.href}`)):t.push(o[0]),r=n.lastIndex}return r<e.length&&t.push(e.slice(r)),t}function XN({text:e}){const t=e.split(/\r?\n/),n=[];let r=[],o=[];const c=()=>{if(r.length===0)return;const l=r.join(`
459
+ `);n.push(d.jsx("p",{children:Cm(l)},`p-${n.length}`)),r=[]},h=()=>{o.length!==0&&(n.push(d.jsx("ul",{children:o.map((l,u)=>d.jsx("li",{children:Cm(l)},u))},`l-${n.length}`)),o=[])};for(const l of t){const u=/^(#{1,3})\s+(.+)$/.exec(l),m=/^[-*]\s+(.+)$/.exec(l);if(u){c(),h();const g=Cm(u[2]);n.push(u[1].length===1?d.jsx("h3",{children:g},n.length):u[1].length===2?d.jsx("h4",{children:g},n.length):d.jsx("h5",{children:g},n.length))}else m?(c(),o.push(m[1])):l.trim()===""?(c(),h()):(h(),r.push(l))}return c(),h(),d.jsx("div",{className:"artifact-markdown",children:n})}function mC({text:e,forceSource:t=!1}){const[n,r]=O.useState(!1);O.useEffect(()=>r(!1),[e]);const o=GN(e),c=t||o.kind==="html",h=n?e:o.preview;return d.jsxs("div",{className:"artifact-text","data-kind":c?"source":"text",children:[c?d.jsx("pre",{className:"artifact-source",children:h}):d.jsx(XN,{text:h}),o.truncated&&d.jsxs("button",{type:"button",className:"btn-ghost artifact-text-more","aria-expanded":n,onClick:()=>r(l=>!l),children:[d.jsx(ue,{name:n?"ChevronUp":"ChevronDown",size:12}),n?"Show less":`Show full ${c?"HTML":"text"} · ${o.omittedCharacters.toLocaleString()} more characters`]})]})}function Em(e){return e!==null&&typeof e=="object"}function hh({value:e}){if(typeof e=="string"){const t=fC(e);return t?d.jsx(YN,{url:t},t.href):d.jsx(mC,{text:e})}if(e===null||typeof e=="number"||typeof e=="boolean")return d.jsx("code",{className:"artifact-scalar",children:String(e)});if(Array.isArray(e)){if(e.length===0)return d.jsx("code",{className:"artifact-scalar",children:"[]"});const t=e.slice(0,ko),n=e.slice(ko);return d.jsxs("div",{className:"artifact-list",children:[t.map((r,o)=>d.jsxs("div",{className:"artifact-list-item","data-composite":Em(r)||void 0,children:[d.jsx("span",{className:"artifact-list-index",children:o+1}),d.jsx(hh,{value:r})]},o)),n.length>0&&d.jsxs("details",{className:"artifact-collection-more",children:[d.jsxs("summary",{children:["Show ",n.length," more"]}),n.map((r,o)=>d.jsxs("div",{className:"artifact-list-item","data-composite":Em(r)||void 0,children:[d.jsx("span",{className:"artifact-list-index",children:o+ko+1}),d.jsx(hh,{value:r})]},o+ko))]})]})}if(typeof e=="object"){const t=Object.entries(e);if(t.length===0)return d.jsx("code",{className:"artifact-scalar",children:"{}"});const n=t.slice(0,ko),r=t.slice(ko),o=c=>c.map(([h,l])=>d.jsxs("div",{className:"artifact-field","data-composite":Em(l)||void 0,children:[d.jsx("div",{className:"artifact-field-label",children:h.replaceAll(/[_-]+/g," ")}),d.jsx("div",{className:"artifact-field-value",children:d.jsx(hh,{value:l})})]},h));return d.jsxs("div",{className:"artifact-object",children:[o(n),r.length>0&&d.jsxs("details",{className:"artifact-collection-more",children:[d.jsxs("summary",{children:["Show ",r.length," more fields"]}),o(r)]})]})}return d.jsx("code",{className:"artifact-scalar",children:String(e)})}function yc({value:e,label:t="Result",testId:n="run-artifact",defaultOpen:r=!0,onViewed:o,viewEventKey:c="default"}){const[h,l]=O.useState("rendered"),[u,m]=O.useState(r),[g,p]=O.useState(!1),S=O.useRef(null),w=O.useRef(null),A=O.useId(),E=O.useId(),y=O.useId(),b=O.useRef(null),v=O.useRef(null),_=dC(e);O.useEffect(()=>{!o||S.current===c||(S.current=c,o())},[o,c]),O.useEffect(()=>()=>{w.current&&window.clearTimeout(w.current)},[]);const k=x=>{l(x),m(!0)},C=x=>{var R;let T=null;x.key==="Home"&&(T="rendered"),x.key==="End"&&(T="raw"),["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(x.key)&&(T=h==="rendered"?"raw":"rendered"),T!==null&&(x.preventDefault(),k(T),(R=(T==="rendered"?b:v).current)==null||R.focus())};return d.jsxs("section",{className:"artifact-renderer","data-testid":n,"data-collapsed":!u||void 0,...Dt({object:"run"}),children:[d.jsxs("header",{className:"artifact-header",children:[d.jsxs("button",{type:"button",className:"artifact-disclosure","aria-expanded":u,"aria-controls":A,onClick:()=>m(x=>!x),children:[d.jsx(ue,{name:u?"ChevronDown":"ChevronRight",size:13}),d.jsx("span",{className:"artifact-title",children:t})]}),d.jsxs("div",{className:"artifact-actions",children:[d.jsxs("div",{className:"artifact-mode",role:"tablist","aria-label":`${t} display`,children:[d.jsx("button",{ref:b,id:E,type:"button",role:"tab","aria-controls":A,"aria-selected":h==="rendered",tabIndex:h==="rendered"?0:-1,onKeyDown:C,onClick:()=>k("rendered"),children:"Rendered"}),d.jsx("button",{ref:v,id:y,type:"button",role:"tab","aria-controls":A,"aria-selected":h==="raw",tabIndex:h==="raw"?0:-1,onKeyDown:C,onClick:()=>k("raw"),children:"Raw"})]}),d.jsxs("button",{type:"button",className:"btn-ghost artifact-copy",onClick:()=>void(async()=>{var T;let x=!1;try{(T=navigator.clipboard)!=null&&T.writeText&&(await navigator.clipboard.writeText(_),x=!0)}catch{}x||(x=WN(_)),x&&(p(!0),w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>p(!1),1500))})(),children:[d.jsx(ue,{name:g?"Check":"Copy",size:12})," ",g?"Copied":"Copy"]})]})]}),d.jsx("div",{className:"artifact-body",id:A,role:"tabpanel","aria-labelledby":h==="rendered"?E:y,hidden:!u,children:h==="rendered"?d.jsx(hh,{value:e}):d.jsx(mC,{text:_,forceSource:!0})})]})}function Ov(){return d.jsx("span",{className:"canvas-run-stub-chip","data-testid":"canvas-run-stub-chip","data-tooltip":"Sapiom capability calls in this local run were served by stubs — not real Sapiom calls",children:"stubbed"})}function Gr({label:e,value:t,testId:n}){return d.jsx(yc,{value:t,label:e,testId:n,defaultOpen:!1})}function JN({links:e,testid:t}){return d.jsx("div",{className:"canvas-links-list","data-testid":t,children:e.map(({url:n,kind:r})=>r==="image"?d.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:d.jsx("img",{src:n,alt:"",className:"canvas-link-thumb",loading:"lazy"})},n):d.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-item","data-testid":"canvas-link-other",children:[d.jsx(ue,{name:"ExternalLink",size:12}),d.jsx("span",{className:"canvas-link-url",children:"Open"})]},n))})}function gC({step:e}){const t=ZR(e);return t.length===0?null:d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-links",children:[d.jsx("h4",{children:"Links"}),d.jsx(JN,{links:t})]})}function ZN({status:e}){return e==="completed"?d.jsx("span",{className:"canvas-run-status is-passed","aria-label":"completed",children:d.jsx(ue,{name:"Check",size:11})}):e==="failed"?d.jsx("span",{className:"canvas-run-status is-failed","aria-label":"failed",children:d.jsx(ue,{name:"X",size:11})}):e==="cancelled"?d.jsx("span",{className:"canvas-run-status is-pending","aria-label":"cancelled",children:d.jsx(ue,{name:"Minus",size:11})}):d.jsx("span",{className:"canvas-run-status is-running","aria-label":"running"})}function QN({deployState:e,workflow:t,onDismiss:n,onOpenCode:r}){const o=(t==null?void 0:t.definitionId)!=null?af(t.definitionId):null,c=e.phase==="linking"||e.phase==="building",h=e.phase==="linking"?"Creating the agent on Sapiom…":e.phase==="building"?"Deploying — building on Sapiom…":e.phase==="ready"?"Deployed to Sapiom":"Deploy failed";return d.jsxs("section",{className:"deploy-status-banner is-"+e.phase,"data-testid":"deploy-status-banner","data-phase":e.phase,children:[d.jsxs("div",{className:"deploy-status-head",children:[c?d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}):d.jsx(ZN,{status:e.phase==="ready"?"completed":"failed"}),d.jsx("span",{className:"deploy-status-label",children:h}),d.jsx("button",{type:"button",className:"deploy-status-dismiss","data-testid":"deploy-status-dismiss","aria-label":"Dismiss",onClick:n,children:d.jsx(ue,{name:"X",size:12})})]}),e.phase==="error"&&e.message&&d.jsx("pre",{className:"canvas-run-error",children:e.message}),e.phase==="ready"&&d.jsxs("div",{className:"deploy-status-actions",children:[o&&d.jsxs("a",{className:"status-tag status-tag-action","data-testid":"deploy-open-dashboard",href:o,target:"_blank",rel:"noreferrer",children:[d.jsx(ue,{name:"Cloud",size:12}),"Open in Sapiom"]}),d.jsxs("button",{type:"button",className:"status-tag status-tag-action","data-testid":"deploy-open-code",onClick:r,children:[d.jsx(ue,{name:"Code",size:12}),"Trigger from your code"]})]})]})}function vC({step:e}){return!e.calls||e.calls.length===0?null:d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-capability-calls",children:[d.jsx("h4",{children:"Capability calls"}),d.jsx("div",{className:"canvas-capability-calls",children:e.calls.map((t,n)=>d.jsxs("div",{className:"canvas-capability-call",children:[d.jsxs("div",{className:"canvas-capability-call-head",children:[d.jsx("code",{className:"canvas-input-field",children:t.capability}),t.stubUsed&&d.jsx("span",{className:"canvas-run-stub-chip","data-testid":`canvas-call-stub-chip-${t.capability}`,children:"stubbed"})]}),t.args!==void 0&&d.jsx(Gr,{label:"Arguments",value:t.args,testId:`canvas-call-arguments-${t.capability}`}),t.result!==void 0&&d.jsx(Gr,{label:"Result",value:t.result,testId:`canvas-call-result-${t.capability}`})]},`${t.capability}-${n}`))})]})}function _C({run:e}){const t=GR(e);return t?d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-stub-notice",children:[d.jsx("h4",{children:"Stub notices"}),t.unusedStubs&&d.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-unused",children:[d.jsx("span",{className:"canvas-input-label",children:"Unused stubs"}),d.jsx("p",{className:"canvas-stub-notice-hint",children:"Supplied but matched no capability call — likely a typo or wrong path."}),d.jsx("ul",{className:"canvas-detail-warnings",children:t.unusedStubs.map(n=>d.jsxs("li",{children:[d.jsx("code",{className:"canvas-input-field",children:n.key})," in ",n.step]},`${n.step} ${n.key}`))})]}),t.stubWarnings&&d.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-warnings",children:[d.jsx("span",{className:"canvas-input-label",children:"Stub warnings"}),d.jsx("p",{className:"canvas-stub-notice-hint",children:"Matched a call but had the wrong shape."}),d.jsx("ul",{className:"canvas-detail-warnings",children:t.stubWarnings.map(n=>d.jsx("li",{children:n},n))})]})]}):null}function e3(e){return e?`${e} run`:"run"}function Lv({status:e}){return e==="passed"?d.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:d.jsx(ue,{name:"Check",size:11})}):e==="failed"?d.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:d.jsx(ue,{name:"X",size:11})}):e==="running"?d.jsx("span",{className:"canvas-run-status is-running","data-status":"running","aria-label":"running"}):d.jsx("span",{className:"canvas-run-status is-pending","data-status":"pending","aria-label":"pending"})}function Gu(e){return e.kind==="branching"?"branch":e.kind==="cross"?"pause resume":e.kind==="launch"?"launch":null}function t3({node:e}){const t=_c(e);return t.length===0?null:d.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-input-${e.id}`,children:[d.jsx("span",{className:"canvas-input-label",children:"Input"}),d.jsx("span",{className:"canvas-input-fields",children:t.map(n=>d.jsxs("code",{className:"canvas-input-field"+(n.required?" is-required":""),"aria-label":`${n.name}, ${n.type}${n.required?", required":""}`,...Dt({object:"run"}),children:[n.name,n.required&&d.jsx("span",{"aria-hidden":"true",children:"*"}),d.jsx("span",{className:"canvas-input-type",children:n.type})]},n.name))})]})}function s3({node:e}){return e.capabilities.length===0?null:d.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-capabilities-${e.id}`,children:[d.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),d.jsx("span",{className:"canvas-input-fields",children:e.capabilities.map(t=>d.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:t},t))})]})}function n3(e,t){return e.kind!=="launched-workflow"?null:t.find(n=>n.path===e.label)??t.find(n=>n.name===e.label)??t.find(n=>n.path.endsWith(`/${e.label}`))??null}function yC({node:e,workflows:t,onOpenWorkflow:n}){const r=n3(e,t);return r?d.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${e.id}`,"data-tooltip":`Switch to ${r.name}`,onClick:()=>n(r.path),children:["Open agent ",d.jsx(ue,{name:"ArrowRight",size:12})]}):null}function i3({graph:e,run:t,runTarget:n,workflows:r,onOpenWorkflow:o,onAskAgent:c,expandedId:h,onToggle:l}){const u=new Set(e.nodes.map(S=>S.id)),m=e.groups.filter(S=>S.nodeIds.length>0&&S.nodeIds.every(w=>u.has(w))),g=S=>{var w;return((w=m.find(A=>A.nodeIds.includes(S)))==null?void 0:w.label)??null},p=[];return e.nodes.forEach((S,w)=>{const A=g(S.id),E=p[p.length-1];E&&E.group===A?E.nodes.push({node:S,index:w}):p.push({group:A,nodes:[{node:S,index:w}]})}),d.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-steps-list",children:[d.jsxs("div",{className:"canvas-steps-label",children:["Steps",t&&d.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:e3(n)})]}),p.map((S,w)=>d.jsxs("div",{className:S.group?"canvas-step-band":void 0,children:[S.group&&d.jsx("div",{className:"canvas-step-group",children:S.group}),S.nodes.map(({node:A,index:E})=>{const y=h===A.id,b=HR(A,e.edges),v=rf(t,A.id),_=v?[v.latencyMs!==void 0?fr(v.latencyMs):null].filter(k=>k!==null):[];return d.jsxs("div",{className:"canvas-step-item"+(y?" is-open":""),children:[d.jsxs("button",{className:"canvas-step-row","data-testid":`canvas-step-row-${A.id}`,"aria-expanded":y,onClick:()=>l(A.id),children:[d.jsx("span",{className:"canvas-step-index",children:String(E+1).padStart(2,"0")}),v?d.jsx(Lv,{status:v.status}):d.jsx("span",{className:"canvas-step-dot dot--"+A.kind,"aria-hidden":"true"}),d.jsxs("span",{className:"canvas-step-copy",children:[d.jsx("span",{className:"canvas-step-name",children:A.label}),d.jsx("span",{className:"canvas-step-role",children:A.role})]}),v&&$v(t,A.id)&&d.jsx(Ov,{}),d.jsx("span",{className:"canvas-step-meta",children:(_.length>0?_:b).join(" · ")}),d.jsx("span",{className:"canvas-step-caret"+(y?" is-open":""),"aria-hidden":"true",children:d.jsx(ue,{name:"ChevronDown",size:13})})]}),y&&d.jsx("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${A.id}`,children:d.jsx(r3,{graph:e,node:A,run:t,workflows:r,onOpenWorkflow:o,onAskAgent:c})})]},A.id)})]},`${S.group??"ungrouped"}-${w}`))]})}function r3({graph:e,node:t,run:n,workflows:r,onOpenWorkflow:o,onAskAgent:c}){const h=rf(n,t.id),l=e.edges.filter(p=>p.from===t.id),u=e.edges.filter(p=>p.to===t.id),m=p=>{var S;return((S=e.nodes.find(w=>w.id===p))==null?void 0:S.label)??p},g=e.groups.filter(p=>p.nodeIds.includes(t.id));return d.jsx("div",{className:"canvas-detail","data-testid":"canvas-step-detail",children:d.jsxs("div",{className:"canvas-detail-body",children:[t.role&&d.jsx("p",{className:"canvas-detail-role",children:t.role}),t.description&&d.jsx("p",{className:"canvas-detail-desc",children:t.description}),g.length>0&&d.jsxs("p",{className:"canvas-detail-groups",children:["Part of ",g.map(p=>p.label).join(", ")]}),c&&d.jsxs("div",{className:"canvas-detail-actions",children:[d.jsxs("button",{type:"button",className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","data-tooltip":"Ask the coding agent in the terminal",onClick:()=>c(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[d.jsx(ue,{name:"MessageSquare",size:13}),"Ask coding agent"]}),d.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-modify","data-tooltip":"Ask the coding agent to change this step",onClick:()=>c(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),children:[d.jsx(ue,{name:"Wand2",size:13}),"Ask to modify"]}),d.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-copy-name","data-tooltip":"Copy the step name",onClick:()=>{var p;return void((p=navigator.clipboard)==null?void 0:p.writeText(t.label).catch(()=>{}))},children:[d.jsx(ue,{name:"Copy",size:13}),"Copy name"]})]}),d.jsx(yC,{node:t,workflows:r,onOpenWorkflow:o}),h&&d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-run",children:[d.jsx("h4",{children:"Agent run"}),d.jsxs("div",{className:"canvas-detail-contract",children:[d.jsx("span",{className:"canvas-input-label",children:"Status"}),d.jsxs("span",{className:"canvas-run-text is-"+h.status,children:[d.jsx(Lv,{status:h.status}),h.status,$v(n,t.id)&&d.jsx(Ov,{})]})]}),h.latencyMs!==void 0&&d.jsxs("div",{className:"canvas-detail-contract",children:[d.jsx("span",{className:"canvas-input-label",children:"Duration"}),d.jsx("span",{className:"canvas-detail-timeout",children:fr(h.latencyMs)})]}),h.input!==void 0&&d.jsx(Gr,{label:"Input",value:h.input,testId:`canvas-detail-run-input-${t.id}`}),h.output!==void 0&&d.jsx(Gr,{label:"Output",value:h.output,testId:`canvas-detail-run-output-${t.id}`}),h.error&&d.jsx("pre",{className:"canvas-run-error",children:h.error}),h.logSlice&&d.jsx(Gr,{label:"Logs",value:h.logSlice,testId:`canvas-detail-run-logs-${t.id}`})]}),h&&d.jsx(vC,{step:h}),h&&d.jsx(gC,{step:h}),d.jsx(_C,{run:n}),(_c(t).length>0||t.timeoutMs!==null||t.capabilities.length>0)&&d.jsxs("section",{className:"canvas-detail-section",children:[d.jsx("h4",{children:"Contract"}),t.capabilities.length>0&&d.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-capabilities",children:[d.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),d.jsx("span",{className:"canvas-input-fields",children:t.capabilities.map(p=>d.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:p},p))})]}),_c(t).length>0&&d.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-input",children:[d.jsx("span",{className:"canvas-input-label",children:"Input"}),d.jsx("span",{className:"canvas-input-fields",children:_c(t).map(p=>d.jsxs("code",{className:"canvas-input-field"+(p.required?" is-required":""),"aria-label":`${p.name}, ${p.type}${p.required?", required":""}`,"data-tooltip":p.required?"Required field":"Optional field",...Dt({object:"run"}),children:[p.name,p.required&&d.jsx("span",{"aria-hidden":"true",children:"*"}),d.jsx("span",{className:"canvas-input-type",children:p.type})]},p.name))})]}),t.timeoutMs!==null&&d.jsxs("div",{className:"canvas-detail-contract",children:[d.jsx("span",{className:"canvas-input-label",children:"Timeout"}),d.jsx("span",{className:"canvas-detail-timeout",children:fr(t.timeoutMs)})]})]}),d.jsxs("section",{className:"canvas-detail-section",children:[d.jsxs("h4",{children:["Leads to ",d.jsx("span",{className:"canvas-detail-count",children:l.length})]}),l.length===0?d.jsx("p",{className:"canvas-detail-empty",children:"Terminal step: nothing follows."}):d.jsx("ul",{className:"canvas-detail-edges",children:l.map(p=>d.jsx("li",{children:d.jsxs("div",{className:"canvas-detail-edge",children:[d.jsx(ue,{name:"CornerDownRight",size:13}),d.jsx("span",{className:"canvas-detail-edge-target",children:m(p.to)}),Gu(p)&&d.jsx("span",{className:"canvas-detail-edge-kind",children:Gu(p)}),p.label&&d.jsx("span",{className:"canvas-detail-edge-cond",children:p.label})]})},`${p.from}->${p.to}`))})]}),d.jsxs("section",{className:"canvas-detail-section",children:[d.jsxs("h4",{children:["Reached from ",d.jsx("span",{className:"canvas-detail-count",children:u.length})]}),u.length===0?d.jsx("p",{className:"canvas-detail-empty",children:t.kind==="entry"?"Entry point: the agent starts here.":"No step routes here."}):d.jsx("ul",{className:"canvas-detail-edges",children:u.map(p=>d.jsx("li",{children:d.jsxs("div",{className:"canvas-detail-edge",children:[d.jsx(ue,{name:"CornerLeftUp",size:13}),d.jsx("span",{className:"canvas-detail-edge-target",children:m(p.from)}),Gu(p)&&d.jsx("span",{className:"canvas-detail-edge-kind",children:Gu(p)}),p.label&&d.jsx("span",{className:"canvas-detail-edge-cond",children:p.label})]})},`${p.from}->${p.to}`))})]}),e.warnings.length>0&&d.jsxs("section",{className:"canvas-detail-section",children:[d.jsxs("h4",{children:["Graph warnings ",d.jsx("span",{className:"canvas-detail-count",children:e.warnings.length})]}),d.jsx("ul",{className:"canvas-detail-warnings",children:e.warnings.map(p=>d.jsx("li",{children:p},p))})]})]})})}function a3({node:e,run:t,workflows:n,onOpenWorkflow:r}){const o=rf(t,e.id);return d.jsxs("div",{className:"canvas-inspector","data-testid":"canvas-step-inspector",children:[e.role&&d.jsx("p",{className:"canvas-detail-role",children:e.role}),e.description&&d.jsx("p",{className:"canvas-step-desc",children:e.description}),d.jsx(t3,{node:e}),d.jsx(s3,{node:e}),e.timeoutMs!==null&&d.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-inspector-timeout-${e.id}`,children:[d.jsx("span",{className:"canvas-input-label",children:"Timeout"}),d.jsx("span",{className:"canvas-detail-timeout",children:fr(e.timeoutMs)})]}),d.jsx(yC,{node:e,workflows:n,onOpenWorkflow:r}),o&&d.jsxs("div",{className:"canvas-inspector-run","data-testid":"canvas-inspector-run",children:[d.jsx("span",{className:"canvas-input-label",children:"Agent run"}),d.jsxs("span",{className:"canvas-run-text is-"+o.status,children:[d.jsx(Lv,{status:o.status}),o.status,$v(t,e.id)&&d.jsx(Ov,{})]}),o.latencyMs!==void 0&&d.jsx("span",{className:"canvas-inspector-run-meta",children:fr(o.latencyMs)})]}),(o==null?void 0:o.input)!==void 0&&d.jsx(Gr,{label:"Input",value:o.input,testId:`canvas-inspector-run-input-${e.id}`}),(o==null?void 0:o.output)!==void 0&&d.jsx(Gr,{label:"Output",value:o.output,testId:`canvas-inspector-run-output-${e.id}`}),(o==null?void 0:o.error)&&d.jsx("pre",{className:"canvas-run-error",children:o.error}),(o==null?void 0:o.logSlice)&&d.jsx(Gr,{label:"Logs",value:o.logSlice,testId:`canvas-inspector-run-logs-${e.id}`}),o&&d.jsx(vC,{step:o}),o&&d.jsx(gC,{step:o}),d.jsx(_C,{run:t})]})}function o3({node:e,run:t,onInjectPrompt:n,onClose:r}){const o=e?rf(t,e.id):null,[c,h]=O.useState("");function l(m){var w;if(!e){n(m);return}const g=o?{input:o.input,output:o.output,calls:o.calls,unusedStubs:(w=t==null?void 0:t.unusedStubs)==null?void 0:w.map(A=>A.key),stubWarnings:t==null?void 0:t.stubWarnings}:void 0,p=e.capabilities.length>0?{capabilities:e.capabilities}:void 0,S=KR(o??{id:e.id,name:e.id,status:"pending"},g,p);n(`${S}
460
+
461
+ ${m}`)}function u(){const m=c.trim();m&&(l(m),h(""))}return d.jsxs("div",{className:"canvas-chat-panel","data-testid":"canvas-chat-panel",children:[d.jsxs("div",{className:"canvas-chat-head",children:[d.jsx("span",{className:"canvas-chat-title","data-testid":"canvas-chat-title",children:e?`Chat · ${e.label}`:"Chat"}),d.jsx("button",{className:"theme-toggle canvas-chat-close","data-testid":"canvas-chat-close","aria-label":"Close chat","data-tooltip":"Close chat",onClick:r,children:d.jsx(ue,{name:"X",size:13})})]}),d.jsxs("div",{className:"canvas-inspector-macros","data-testid":"canvas-inspector-macros",children:[e&&d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-slow",onClick:()=>l("Why is this step slow / stuck?"),children:"Why slow / stuck?"}),d.jsx("button",{className:"canvas-inspector-macro-btn "+((o==null?void 0:o.status)==="failed"?"btn-primary":"btn-ghost"),"data-testid":"canvas-macro-debug",onClick:()=>l("Debug this step"),children:"Debug this step"}),d.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-explain",onClick:()=>l("Explain this step"),children:"Explain this step"})]}),d.jsxs("div",{className:"canvas-inspector-freeform",children:[d.jsx("textarea",{className:"canvas-inspector-freeform-input","data-testid":"canvas-freeform-input",placeholder:e?"Ask about this step…":"Ask about this agent…",rows:1,value:c,onChange:m=>h(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),u())}}),d.jsx("button",{className:"btn-primary canvas-inspector-freeform-ask","data-testid":"canvas-freeform-ask",disabled:!c.trim(),onClick:u,children:"Ask"})]})]})]})}const h1=24;function l3({overview:e,selectedNode:t,graph:n,run:r,workflows:o,onOpenWorkflow:c,onOpenSteps:h,onDeselect:l,onCollapse:u,onDescribeWithAI:m,describing:g=!1}){var Q;const p=O.useRef(null),S=O.useRef(null),w=O.useRef(null),A=O.useRef(null),E=O.useRef(hi().canvasInspectorHeight??null),[y,b]=O.useState(null),[v,_]=O.useState(!1),[k,C]=O.useState(!1),x=k||g;O.useEffect(()=>{g&&C(!1)},[g]),O.useEffect(()=>{if(!k)return;const G=window.setTimeout(()=>C(!1),8e3);return()=>window.clearTimeout(G)},[k]);const T=()=>{var ee;const G=(ee=p.current)==null?void 0:ee.parentElement;return G?Math.round(G.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},R=()=>{var G;return(((G=S.current)==null?void 0:G.offsetHeight)??40)+1},M=O.useCallback(()=>{const G=S.current,ee=w.current,ne=A.current;if(!G||!ee||!ne)return;const z=T(),B=E.current,$=window.getComputedStyle(ee),H=(parseFloat($.paddingTop)||0)+(parseFloat($.paddingBottom)||0),U=G.offsetHeight+ne.offsetHeight+H+1,P=B!=null?Math.min(Math.max(B,R()),z):Math.min(U,z);b(P)},[]);O.useLayoutEffect(M),O.useEffect(()=>{var ne;if(typeof ResizeObserver>"u")return;const G=new ResizeObserver(M),ee=(ne=p.current)==null?void 0:ne.parentElement;return ee&&G.observe(ee),A.current&&G.observe(A.current),()=>G.disconnect()},[M]);const D=G=>{E.current=Math.round(Math.min(Math.max(G,R()),T())),M()},L=()=>{Ci({canvasInspectorHeight:E.current})},q=()=>{E.current=null,Ci({canvasInspectorHeight:null}),M()},F=G=>{if(G.button!==0)return;const ee=G.currentTarget,ne=p.current;if(!ne)return;try{ee.setPointerCapture(G.pointerId)}catch{}_(!0);const z=G.clientY,B=ne.getBoundingClientRect().height,$=U=>{D(B+(z-U.clientY))},H=()=>{_(!1),L(),window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H)};window.addEventListener("pointermove",$),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H)},Y=G=>{var ne;const ee=((ne=p.current)==null?void 0:ne.getBoundingClientRect().height)??0;G.key==="ArrowUp"?(G.preventDefault(),D(ee+h1),L()):G.key==="ArrowDown"?(G.preventDefault(),D(ee-h1),L()):G.key==="Home"&&(G.preventDefault(),q())};return d.jsxs("div",{ref:p,className:"canvas-overview"+(v?" is-resizing":"")+(t?" is-inspecting":""),"data-testid":"canvas-overview",style:y!=null?{height:y}:void 0,children:[d.jsx("div",{className:"canvas-overview-resize","data-testid":"canvas-overview-resize",role:"separator","aria-orientation":"horizontal","aria-label":"Resize the overview panel",tabIndex:0,onPointerDown:F,onDoubleClick:q,onKeyDown:Y}),d.jsx("div",{ref:S,className:"canvas-overview-head",children:t?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"canvas-step-dot dot--"+t.kind,"aria-hidden":"true"}),d.jsx("span",{className:"canvas-overview-title","data-testid":"canvas-inspector-title",children:t.label}),d.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:lC(t.kind)}),d.jsxs("button",{className:"status-tag status-tag-action canvas-inspector-open-steps","data-testid":"canvas-inspector-open-steps","data-tooltip":"Full details in the Steps tab",onClick:h,children:["Open step ",d.jsx(ue,{name:"ArrowRight",size:12})]}),d.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-inspector-close","aria-label":"Back to the agent overview","data-tooltip":"Back to the agent overview (Esc)",onClick:l,children:d.jsx(ue,{name:"X",size:13})})]}):d.jsxs(d.Fragment,{children:[d.jsx(ue,{name:"Radio",size:13}),"Overview",d.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-overview-toggle","aria-label":"Collapse agent overview","data-tooltip":"Collapse agent overview",onClick:u,children:d.jsx(ue,{name:"X",size:13})})]})}),d.jsx("div",{ref:w,className:"canvas-overview-body",children:d.jsx("div",{ref:A,className:"canvas-overview-content",children:t&&n?d.jsx(a3,{graph:n,node:t,run:r,workflows:o,onOpenWorkflow:c}):e&&d.jsxs(d.Fragment,{children:[(e.stats||e.badges&&e.badges.length>0)&&d.jsxs("div",{className:"canvas-overview-meta","data-testid":"canvas-overview-meta",children:[e.stats&&d.jsx("span",{className:"canvas-overview-stats",children:e.stats}),(Q=e.badges)==null?void 0:Q.map(G=>d.jsx("span",{className:"canvas-overview-badge",children:G},G))]}),e.description&&d.jsx("p",{className:"canvas-overview-desc",children:e.description}),m&&d.jsx("button",{type:"button",className:"canvas-describe-ai"+(x?" is-loading":""),"data-testid":"canvas-describe-ai",disabled:x,"aria-busy":x,onClick:()=>{e.description&&!window.confirm("Rewrite this agent's descriptions? The coding agent will edit the source and may replace text you wrote by hand.")||(C(!0),m())},"data-tooltip":"Runs a hidden coding-agent session that writes descriptions into the agent source — the canvas updates when it saves",children:x?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"canvas-describe-spinner","aria-hidden":"true"}),"Describing…"]}):d.jsxs(d.Fragment,{children:[d.jsx(ue,{name:"Sparkles",size:13}),e.description?"Rewrite descriptions with AI":"Describe with AI"]})}),e.notes.length>0&&d.jsx("ul",{className:"canvas-overview-notes",children:e.notes.map(G=>d.jsx("li",{children:G},G))}),e.legend&&e.legend.length>0&&d.jsx("div",{className:"canvas-overview-legend","data-testid":"canvas-overview-legend",children:e.legend.map(G=>d.jsxs("span",{className:"canvas-overview-legend-item",children:[d.jsx("span",{className:"canvas-step-dot dot--"+G.kind,"aria-hidden":"true"}),G.label]},G.kind))})]})})})]})}function wn({eyebrow:e,icon:t,title:n,body:r,cta:o,className:c,testId:h,children:l}){return d.jsxs("div",{className:"empty-state"+(c?` ${c}`:""),"data-empty-state":!0,"data-testid":h,children:[t&&d.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:d.jsx(ue,{name:t,size:18})}),e&&d.jsx("span",{className:"empty-state-eyebrow",children:e}),d.jsx("span",{className:"empty-state-title",children:n}),r&&d.jsx("span",{className:"empty-state-body",children:r}),o&&d.jsx("span",{className:"empty-state-cta",children:o}),l]})}function Wr(e){return e.replace(/^@[^/]+\//,"").replace(/^example-/,"").trim()||e}function c3(e,t=Date.now()){const n=Math.max(0,Math.round((t-e)/1e3));if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);return o<24?`${o}h ago`:`${Math.round(o/24)}d ago`}var bC=Qx();function za(e,{onDismiss:t,containerRef:n,triggerRef:r}){O.useEffect(()=>{if(!e)return;const o=h=>{var u;const l=n.current;!l||!(h.target instanceof Node)||l.contains(h.target)||(u=r==null?void 0:r.current)!=null&&u.contains(h.target)||t()},c=h=>{var l;h.key==="Escape"&&(t(),(l=r==null?void 0:r.current)==null||l.focus())};return document.addEventListener("mousedown",o),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",c)}},[e,t,n,r])}const Xl=4,wi=8;function u3(e,t,n,r,o){const c=e.getBoundingClientRect(),h={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto"};return o&&(h.overflowY="auto"),n&&(h.width=c.width),h.maxWidth=window.innerWidth-2*wi,t.startsWith("right")?(h.left=(r??e).getBoundingClientRect().right+Xl,t.endsWith("start")?(h.top=c.top,o&&(h.maxHeight=window.innerHeight-c.top-wi)):(h.bottom=window.innerHeight-c.bottom,o&&(h.maxHeight=c.bottom-wi)),h):(t.startsWith("down")?(h.top=c.bottom+Xl,o&&(h.maxHeight=window.innerHeight-c.bottom-Xl-wi)):(h.bottom=window.innerHeight-c.top+Xl,o&&(h.maxHeight=c.top-Xl-wi)),t.endsWith("start")?h.left=Math.max(wi,c.left):h.right=Math.max(wi,window.innerWidth-c.right),h)}function Ei({open:e,anchorRef:t,onDismiss:n,placement:r,matchWidth:o=!1,besideRef:c,noClip:h=!1,className:l,role:u,testid:m,children:g}){const p=O.useRef(null),[S,w]=O.useState(null);za(e,{onDismiss:n,containerRef:p,triggerRef:t});const A=O.useCallback(()=>{const E=t.current;E&&w(u3(E,r,o,(c==null?void 0:c.current)??null,!h))},[t,r,o,c,h]);return O.useLayoutEffect(()=>{e?A():w(null)},[e,A]),O.useLayoutEffect(()=>{if(!e||S==null)return;const E=p.current;if(!E)return;const y=E.getBoundingClientRect();let b=0;y.left<wi?b=wi-y.left:y.right>window.innerWidth-wi&&(b=window.innerWidth-wi-y.right),!(Math.abs(b)<.5)&&w(v=>v==null?v:{...v,left:typeof v.left=="number"?v.left+b:v.left,right:typeof v.right=="number"?v.right-b:v.right})},[e,S]),O.useEffect(()=>{if(e)return window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[e,A]),!e||S==null?null:bC.createPortal(d.jsx("div",{ref:p,className:l,role:u,"data-testid":m,style:S,children:g}),document.body)}function d3(e,t){return`${t?`${t} run`:"run"} ${e.status}`}function h3({workflow:e,detailStep:t,onBack:n,onAskAgent:r,surface:o,stepsSummary:c,run:h,runTarget:l,runs:u,onSelectRun:m}){const[g,p]=O.useState(!1),S=O.useRef(null),w=O.useCallback(()=>p(!1),[]),[A,E]=O.useState(!1),y=O.useRef(null),b=O.useCallback(()=>E(!1),[]);if(t)return d.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",...Dt({object:"run"}),children:[d.jsx("button",{className:"theme-toggle","data-testid":"canvas-detail-back",onClick:n,"aria-label":"Back to the steps list","data-tooltip":"Back to the steps list",children:d.jsx(ue,{name:"ArrowLeft",size:14})}),d.jsx("span",{className:"workflow-actions-name","data-testid":"canvas-detail-title",children:t.label}),d.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:lC(t.kind)}),d.jsxs("button",{className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","aria-label":"Ask coding agent","data-tooltip":"Ask the coding agent in the terminal",onClick:()=>r(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[d.jsx(ue,{name:"MessageSquare",size:13}),d.jsx("span",{className:"canvas-detail-ask-label",children:"Ask coding agent"})]}),d.jsxs("div",{className:"canvas-detail-menu-wrap",children:[d.jsx("button",{ref:S,className:"theme-toggle","data-testid":"canvas-detail-menu","aria-label":`More actions for ${t.label}`,"data-tooltip":"More actions","aria-haspopup":"menu","aria-expanded":g,onClick:()=>p(v=>!v),children:d.jsx(ue,{name:"EllipsisVertical",size:14})}),d.jsxs(Ei,{open:g,anchorRef:S,onDismiss:w,placement:"down-end",className:"canvas-detail-menu",role:"menu",testid:"canvas-detail-menu-popover",children:[d.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{r(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),w()},children:[d.jsx(ue,{name:"Wand2",size:13}),"Ask coding agent to modify"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var v;(v=navigator.clipboard)==null||v.writeText(t.label).catch(()=>{}),w()},children:[d.jsx(ue,{name:"Copy",size:13}),"Copy step name"]})]})]})]});if(o==="steps"){const v=h&&d.jsxs(d.Fragment,{children:[h.status==="running"&&d.jsx("span",{className:"canvas-run-status is-running","aria-hidden":"true"}),d3(h,l)]});return d.jsxs("div",{className:"workflow-actions-header"+(h?" has-run":""),"data-testid":"workflow-actions-header",...Dt({object:"agent"}),children:[d.jsx("span",{className:"workflow-actions-name",title:e.name,children:Wr(e.name)}),d.jsx("span",{className:"workflow-actions-count","data-testid":"canvas-steps-count",children:c??"no steps"}),h&&u.length<=1&&d.jsx("span",{className:"status-tag canvas-run-chip is-"+h.status,"data-testid":"canvas-run-chip",children:v}),h&&u.length>1&&d.jsxs("div",{className:"canvas-run-picker-wrap",children:[d.jsxs("button",{ref:y,className:"status-tag status-tag-action canvas-run-chip canvas-run-chip--picker is-"+h.status,"data-testid":"canvas-run-chip","aria-haspopup":"menu","aria-expanded":A,"aria-label":`Pick a run to inspect (${u.length} observed)`,"data-tooltip":"Pick a run to inspect",onClick:()=>E(_=>!_),children:[v,d.jsx(ue,{name:"ChevronDown",size:12})]}),d.jsx(Ei,{open:A,anchorRef:y,onDismiss:b,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...u].reverse().map((_,k)=>{const C=u.length-k,x=_.run.executionId===h.executionId,T=c3(_.observedAt);return d.jsxs("button",{role:"menuitemradio","aria-checked":x,className:"profile-menu-item"+(x?" is-selected":""),"data-testid":`canvas-run-option-${_.run.executionId}`,title:_.run.executionId,onClick:()=>{m(_.run.executionId),b()},children:[d.jsx(ue,{name:x?"Check":"Play",size:13}),d.jsx("span",{children:`run ${C} · ${_.run.status} · ${_.target}`}),d.jsx("span",{className:"canvas-run-option-meta",children:T})]},_.run.executionId)})})]})]})}return null}const Ta=[{id:"input",label:"Input"},{id:"output",label:"Output"},{id:"state",label:"State"},{id:"directive",label:"Directive"},{id:"logs",label:"Logs"},{id:"calls",label:"Calls"}];function f3(e){return e.map((t,n)=>({step:t,index:n})).sort((t,n)=>{const r=t.step.startedAt?Date.parse(t.step.startedAt):Number.NaN,o=n.step.startedAt?Date.parse(n.step.startedAt):Number.NaN;return Number.isFinite(r)&&Number.isFinite(o)&&r!==o?r-o:Number.isFinite(r)!==Number.isFinite(o)?Number.isFinite(r)?-1:1:t.index-n.index}).map(({step:t})=>t)}function p3(e){return e==="completed"?"Completed":e==="failed"?"Failed":e==="cancelled"?"Cancelled":"Running"}function m3(e){return e==="prod"?"Cloud":e==="local"?"Local":"Run"}function g3(e){if(e.startedAt&&e.finishedAt){const n=Date.parse(e.startedAt),r=Date.parse(e.finishedAt);if(Number.isFinite(n)&&Number.isFinite(r)&&r>=n)return r-n}const t=e.steps.reduce((n,r)=>n+(r.latencyMs??0),0);return t>0?t:null}function SC({status:e}){return e==="passed"?d.jsx(ue,{name:"Check",size:11}):e==="failed"?d.jsx(ue,{name:"X",size:11}):e==="running"?d.jsx("span",{className:"run-workspace-pulse"}):d.jsx("span",{className:"run-workspace-pending"})}function v3(e,t){if(!e.startedAt||!t.startedAt)return{left:0,width:e.latencyMs?100:12};const n=Date.parse(t.startedAt),r=Date.parse(e.startedAt),o=t.finishedAt?Date.parse(t.finishedAt):Date.now(),c=e.finishedAt?Date.parse(e.finishedAt):o;return![n,r,o,c].every(Number.isFinite)||o<=n?{left:0,width:e.latencyMs?100:12}:{left:Math.max(0,Math.min(96,(r-n)/(o-n)*100)),width:Math.max(4,Math.min(100,(c-r)/(o-n)*100))}}function f1({attempts:e,run:t,selectedId:n,onSelect:r}){const o=O.useRef([]);return d.jsxs("div",{className:"run-timeline",role:"listbox","aria-label":"Execution attempts","data-testid":"run-timeline",children:[d.jsxs("div",{className:"run-timeline-title",children:["Attempts ",d.jsx("span",{children:e.length})]}),e.map((c,h)=>{const l=v3(c,t);return d.jsxs("button",{ref:u=>{o.current[h]=u},type:"button",role:"option","aria-selected":n===c.id,tabIndex:n===c.id||n===null&&h===0?0:-1,className:"run-timeline-row","data-testid":`run-attempt-${c.id}`,"data-status":c.status,onClick:()=>r(c),onKeyDown:u=>{var g;if(!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();const m=u.key==="Home"?0:u.key==="End"?e.length-1:(h+(u.key==="ArrowDown"?1:-1)+e.length)%e.length;(g=o.current[m])==null||g.focus(),r(e[m])},children:[d.jsx("span",{className:"run-timeline-index",children:String(h+1).padStart(2,"0")}),d.jsx("span",{className:"run-timeline-status","aria-label":c.status,children:d.jsx(SC,{status:c.status})}),d.jsxs("span",{className:"run-timeline-copy",children:[d.jsx("strong",{children:c.name}),d.jsxs("small",{children:["Attempt ",c.attempt??1]})]}),d.jsx("span",{className:"run-timeline-duration",children:c.latencyMs!==void 0?fr(c.latencyMs):c.status}),d.jsx("span",{className:"run-timeline-track","aria-hidden":"true",children:d.jsx("span",{style:{left:`${l.left}%`,width:`${l.width}%`}})})]},c.id)})]})}function _3(e,t){return t==="input"?e.input:t==="output"?e.output:t==="state"?e.sharedState:t==="directive"?e.directive:t==="logs"?e.logSlice:e.calls}function y3({step:e,tab:t}){var r,o;const n=_3(e,t);return n===void 0||t==="calls"&&Array.isArray(n)&&n.length===0?d.jsxs("div",{className:"run-evidence-empty",children:[d.jsx(ue,{name:"Info",size:14})," ",(r=Ta.find(c=>c.id===t))==null?void 0:r.label," not recorded."]}):t==="calls"&&Array.isArray(n)?d.jsx("div",{className:"run-call-list",children:n.map((c,h)=>d.jsxs("article",{className:"run-call",children:[d.jsxs("header",{children:[d.jsx("code",{children:c.capability}),c.stubUsed&&d.jsx("span",{children:"stubbed"})]}),d.jsxs("div",{className:"run-call-pair",children:[d.jsx("section",{children:c.args===void 0?d.jsx("p",{children:"Arguments not recorded."}):d.jsx(yc,{value:c.args,label:"Arguments",testId:`run-call-arguments-${h}`,defaultOpen:!1})}),d.jsx("section",{children:c.result===void 0?d.jsx("p",{children:"Result not recorded."}):d.jsx(yc,{value:c.result,label:"Result",testId:`run-call-result-${h}`,defaultOpen:!1})})]})]},`${c.capability}-${h}`))}):t==="input"||t==="output"||t==="state"||t==="directive"||t==="logs"?d.jsx(yc,{value:n,label:(o=Ta.find(c=>c.id===t))==null?void 0:o.label,testId:"run-evidence-artifact"}):d.jsx("div",{className:"run-evidence-empty",children:"Evidence not recorded."})}function b3(e,t){var r;const n=(r=t.logSlice)==null?void 0:r.slice(-4e3);return JSON.stringify({executionId:e.executionId,runStatus:e.status,runInput:e.input,runOutput:e.output,runError:e.error,attempt:{step:t.name,number:t.attempt??1,status:t.status,startedAt:t.startedAt,finishedAt:t.finishedAt,input:t.input,output:t.output,state:t.sharedState,directive:t.directive,calls:t.calls,error:t.error,logTail:n}},null,2)}function p1({run:e,step:t,tab:n,onTab:r,onBack:o,onAskAgent:c}){const h=O.useRef([]),l=O.useId(),u=`${l}-panel`;return d.jsxs("section",{className:"run-attempt-inspector","aria-label":`${t.name} attempt ${t.attempt??1}`,...Dt({object:"run"}),children:[d.jsxs("header",{className:"run-attempt-head",children:[d.jsxs("button",{type:"button",className:"btn-ghost run-attempt-back",onClick:o,children:[d.jsx(ue,{name:"ArrowLeft",size:13})," Back"]}),d.jsxs("div",{children:[d.jsx("h3",{children:t.name}),d.jsxs("p",{children:[d.jsx("span",{"data-status":t.status,children:t.status})," · Attempt"," ",t.attempt??1,t.latencyMs!==void 0?` · ${fr(t.latencyMs)}`:""]})]}),d.jsxs("button",{type:"button",className:"btn-ghost run-attempt-debug",onClick:()=>c(`Help me inspect and improve this execution attempt.
462
+
463
+ ${b3(e,t)}`),children:[d.jsx(ue,{name:"MessageSquare",size:13})," Ask coding agent"]})]}),t.error&&d.jsxs("div",{className:"run-attempt-error",children:[d.jsx(ue,{name:"TriangleAlert",size:14}),d.jsx("span",{children:t.error})]}),d.jsx("div",{className:"run-evidence-tabs",role:"tablist","aria-label":"Attempt evidence",children:Ta.map((m,g)=>d.jsx("button",{ref:p=>{h.current[g]=p},type:"button",role:"tab",id:`${l}-${m.id}`,"aria-selected":n===m.id,"aria-controls":u,tabIndex:n===m.id?0:-1,"data-testid":`run-evidence-tab-${m.id}`,onClick:()=>r(m.id),onKeyDown:p=>{var w;if(!["ArrowLeft","ArrowRight","Home","End"].includes(p.key))return;p.preventDefault();const S=p.key==="Home"?0:p.key==="End"?Ta.length-1:(g+(p.key==="ArrowRight"?1:-1)+Ta.length)%Ta.length;r(Ta[S].id),(w=h.current[S])==null||w.focus()},children:m.label},m.id))}),d.jsx("div",{className:"run-evidence-panel",id:u,role:"tabpanel","aria-labelledby":`${l}-${n}`,children:d.jsx(y3,{step:t,tab:n})})]})}function S3({run:e}){const t=e.unusedStubs??[],n=e.stubWarnings??[];return t.length===0&&n.length===0?null:d.jsxs("details",{className:"run-stub-notices","data-testid":"run-stub-notices",children:[d.jsxs("summary",{children:["Stub notices ",d.jsx("span",{children:t.length+n.length})]}),t.length>0&&d.jsxs("section",{children:[d.jsx("h4",{children:"Unused stubs"}),d.jsx("ul",{children:t.map(r=>d.jsxs("li",{children:[d.jsx("code",{children:r.step})," · ",r.key]},`${r.step}:${r.key}`))})]}),n.length>0&&d.jsxs("section",{children:[d.jsx("h4",{children:"Warnings"}),d.jsx("ul",{children:n.map((r,o)=>d.jsx("li",{children:r},o))})]})]})}function w3(e){if(e.output!==void 0)return{value:e.output,label:"Result"};const t=[...e.steps].reverse().find(n=>n.status==="passed"&&n.output!==void 0);return t?{value:t.output,label:"Latest output"}:null}function m1({run:e,target:t,workflow:n,focus:r,onToggleFocus:o,onAskAgent:c,onInspectionOpened:h,onArtifactViewed:l,onDashboardOpened:u}){const m=O.useMemo(()=>f3(e.steps),[e.steps]),[g,p]=O.useState(null),[S,w]=O.useState("output"),A=O.useRef(!1),E=O.useRef(null),y=O.useRef(null),b=O.useRef(null),v=m.find(R=>R.id===g)??null,_=w3(e),k=g3(e);O.useEffect(()=>{A.current=!1,E.current=null,p(null),w("output")},[e.executionId]),O.useEffect(()=>{if(!(A.current||e.status==="running"))if(e.status==="failed"){const R=[...m].reverse().find(M=>M.status==="failed");R&&(p(R.id),w("logs"))}else e.status==="completed"&&p(null)},[e.status,m]),O.useEffect(()=>{if(!r||typeof document>"u")return;const R=document.getElementById("root");y.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const M=(R==null?void 0:R.getAttribute("aria-hidden"))??null,D=(R==null?void 0:R.inert)??!1;R&&(R.inert=!0,R.setAttribute("aria-hidden","true"));const L=window.requestAnimationFrame(()=>{var q;return(q=b.current)==null?void 0:q.focus()});return()=>{var q;window.cancelAnimationFrame(L),R&&(R.inert=D,M===null?R.removeAttribute("aria-hidden"):R.setAttribute("aria-hidden",M)),(q=y.current)==null||q.focus(),y.current=null}},[r]),O.useEffect(()=>{if(!r)return;const R=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopImmediatePropagation(),g!==null?p(null):o())};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[r,g,o]);const C=R=>{A.current=!0,p(R.id),w(R.status==="failed"?"logs":"output"),h==null||h()},x=d.jsxs("section",{className:"run-overview",children:[!r&&d.jsx(f1,{attempts:m,run:e,selectedId:g,onSelect:C}),_?d.jsx(yc,{value:_.value,label:_.label,viewEventKey:e.executionId,onViewed:()=>{E.current!==e.executionId&&(E.current=e.executionId,l==null||l())}}):e.status==="running"?d.jsxs("div",{className:"run-result-pending",children:[d.jsx("span",{className:"run-workspace-pulse"})," Waiting for the agent result…"]}):e.error!==void 0?d.jsxs("div",{className:"run-result-error",children:[d.jsx(ue,{name:"TriangleAlert",size:15}),d.jsx("pre",{children:dC(e.error)})]}):d.jsx("div",{className:"run-result-pending",children:"No result was recorded."}),d.jsx(S3,{run:e})]}),T=d.jsxs("div",{className:"run-workspace"+(r?" is-focus":""),"data-testid":"run-workspace",children:[d.jsxs("header",{className:"run-workspace-header",children:[d.jsxs("span",{className:"run-workspace-status","data-status":e.status,children:[d.jsx(SC,{status:e.status==="completed"?"passed":e.status==="failed"||e.status==="cancelled"?"failed":"running"}),p3(e.status)]}),k!==null&&d.jsx("span",{children:fr(k)}),d.jsx("span",{children:m3(t)}),d.jsx("span",{className:"run-workspace-spacer"}),(n==null?void 0:n.definitionId)!=null&&d.jsxs("a",{href:af(n.definitionId),target:"_blank",rel:"noreferrer",onClick:u,children:[d.jsx(ue,{name:"Cloud",size:12})," Dashboard"]}),r&&d.jsx("button",{ref:b,type:"button",className:"theme-toggle",onClick:o,"aria-label":"Exit Focus mode",children:d.jsx(ue,{name:"Minimize2",size:14})})]}),r?d.jsxs("div",{className:"run-workspace-focus-grid",children:[d.jsx(f1,{attempts:m,run:e,selectedId:g,onSelect:C}),d.jsx("div",{className:"run-workspace-inspector",children:v?d.jsx(p1,{run:e,step:v,tab:S,onTab:w,onBack:()=>p(null),onAskAgent:c}):x})]}):v?d.jsx(p1,{run:e,step:v,tab:S,onTab:w,onBack:()=>p(null),onAskAgent:c}):x]});return r&&typeof document<"u"?bC.createPortal(d.jsx("div",{className:"run-focus-layer","data-testid":"run-focus-layer",role:"dialog","aria-modal":"true","aria-label":"Execution Focus mode",children:T}),document.body):T}var _e=typeof window<"u"?window:void 0,vn=typeof globalThis<"u"?globalThis:_e,xn=vn==null?void 0:vn.navigator,Be=vn==null?void 0:vn.document,Ns=vn==null?void 0:vn.location,Iv=vn==null?void 0:vn.fetch,jg=vn!=null&&vn.XMLHttpRequest&&"withCredentials"in new vn.XMLHttpRequest?vn.XMLHttpRequest:void 0,g1=vn==null?void 0:vn.AbortController,x3=vn==null?void 0:vn.CompressionStream,On=xn==null?void 0:xn.userAgent;function wC(){return!(!_e||_e.navigator.onLine===!1)}var Jl=typeof globalThis<"u"?globalThis:_e;Jl&&typeof self>"u"&&(Jl.self=Jl),Jl&&typeof File>"u"&&(Jl.File=function(){});var Xe=_e??{},qt={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function v1(e,t,n,r,o,c,h){try{var l=e[c](h),u=l.value}catch(m){return void n(m)}l.done?t(u):Promise.resolve(u).then(r,o)}function hs(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var c=e.apply(t,n);function h(u){v1(c,r,o,h,l,"next",u)}function l(u){v1(c,r,o,h,l,"throw",u)}h(void 0)}))}}function Te(){return Te=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Te.apply(null,arguments)}function xC(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var _1=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function y1(e){return typeof e=="string"||e}function b1(e){return typeof e=="string"?e:void 0}var Zl,C3=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],or=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),S1=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),E3=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],k3=["token"],CC="NativeGzipValidationError",Rg=e=>e.length>=2&&e[0]===31&&e[1]===139,w1=(e,t)=>e===S1.GZipJS||t===S1.GZipJS||t==="gzip",x1=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Wu=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=CC,t},j3=(function(){var e=hs((function*(t,n){18>t.size&&Wu("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Rg(r)&&r[2]===8||Wu("invalid-header");var o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(h=>{for(var l=(()=>{if(Zl)return Zl;Zl=[];for(var g=0;256>g;g++){for(var p=g,S=0;8>S;S++)p=1&p?3988292384^p>>>1:p>>>1;Zl[g]=p>>>0}return Zl})(),u=4294967295,m=0;h.length>m;m++)u=l[255&(u^h[m])]^u>>>8;return(4294967295^u)>>>0})(n)&&Wu("invalid-crc");var c=n.length>>>0;o.getUint32(4,!0)!==c&&Wu("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Ag(){return Ag=hs((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),c=o.writable.getWriter(),h=c.write(r).then((()=>c.close())).catch((function(){var m=hs((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return m.apply(this,arguments)}})()),l=new Response(o.readable).blob(),u=(yield Promise.all([l,h]))[0];return yield j3(u,r),u}catch(m){if(n!=null&&n.rethrow)throw m;return t&&console.error("Failed to gzip compress data",m),null}})),Ag.apply(this,arguments)}var R3=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],C1=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return R3.concat(t).some((r=>{var o=r.toLowerCase();return n.indexOf(o)!==-1}))};function at(e,t){return e.indexOf(t)!==-1}var of=function(e){return e.trim()},Tg=function(e){return e.replace(/^\$/,"")};function EC(e){var t,n=[];return(t=JSON.stringify(e,(function(r,o){if(typeof o=="bigint")return o.toString();if(typeof o!="function"&&typeof o!="symbol"){if(o instanceof Error)return{name:o.name,message:o.message,stack:o.stack};if(o&&typeof o=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(o))return"[Circular]";n.push(o)}return o}})))!==null&&t!==void 0?t:"null"}var kC=Object.prototype,jC=kC.hasOwnProperty,lf=kC.toString,ut=Array.isArray||function(e){return lf.call(e)==="[object Array]"},Wn=e=>typeof e=="function",ds=e=>e===Object(e)&&!ut(e),Vr=e=>{if(ds(e)){for(var t in e)if(jC.call(e,t))return!1;return!0}return!1},$e=e=>e===void 0,ts=e=>lf.call(e)=="[object String]",Ng=e=>ts(e)&&e.trim().length===0,En=e=>e===null,ft=e=>$e(e)||En(e),cn=e=>lf.call(e)=="[object Number]"&&e==e,rr=e=>cn(e)&&e>0,xi=e=>lf.call(e)==="[object Boolean]",A3=e=>e instanceof FormData,T3=e=>at(E3,e),N3=e=>at(k3,e);function RC(e){return e===null||typeof e!="object"}function Eh(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Pv(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var M3=[!0,"true",1,"1","yes"],km=e=>at(M3,e),$3=[!1,"false",0,"0","no"];function Oi(e,t,n,r,o){return t>n&&(r.warn("min cannot be greater than max."),t=n),cn(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+o),Oi(o||n,t,n,r))}class D3{constructor(t){this.tt={},this.et=t.et,this.rt=Oi(t.bucketSize,0,100,t.it),this.nt=Oi(t.refillRate,0,this.rt,t.it),this.st=Oi(t.refillInterval,0,864e5,t.it)}ot(t,n){var r=Math.floor((n-t.lastAccess)/this.st);r>0&&(t.tokens=Math.min(t.tokens+r*this.nt,this.rt),t.lastAccess=t.lastAccess+r*this.st)}consumeRateLimit(t){var n,r=Date.now(),o=String(t),c=this.tt[o];return c?this.ot(c,r):this.tt[o]=c={tokens:this.rt,lastAccess:r},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.et)==null||n.call(this,t)),c.tokens===0)}stop(){this.tt={}}}var Xn="Mobile",kh="iOS",hr="Android",Xo="Tablet",AC=hr+" "+Xo,TC="iPad",NC="Apple",MC=NC+" Watch",bc="Safari",Jo="BlackBerry",$C="Samsung",DC=$C+"Browser",OC=$C+" Internet",Da="Chrome",O3=Da+" OS",LC=Da+" "+kh,Bv="Internet Explorer",IC=Bv+" "+Xn,zv="Opera",L3=zv+" Mini",Hv="Edge",PC="Microsoft "+Hv,qo="Firefox",BC=qo+" "+kh,Ac="Nintendo",Tc="PlayStation",Vo="Xbox",zC=hr+" "+Xn,HC=Xn+" "+bc,hc="Windows",Mg=hc+" Phone",E1="Nokia",$g="Ouya",UC="Generic",I3=UC+" "+Xn.toLowerCase(),FC=UC+" "+Xo.toLowerCase(),Dg="Konqueror",qC="Oculus Browser",jh="Vivaldi",VC="Yandex",Rh="Whale",Og="DuckDuckGo",GC="Pale Moon",Ah="Waterfox",Sc="Brave",WC="Google Search App",ys="(\\d+(\\.\\d+)?)",jm=new RegExp("Version/"+ys),P3=new RegExp(Vo,"i"),B3=new RegExp(Tc+" \\w+","i"),z3=new RegExp(Ac+" \\w+","i"),Uv=new RegExp(Jo+"|PlayBook|BB10","i"),H3={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},KC=function(e,t,n,r){t=t||"";var o=(function(c){return c!=null&&c.brave?Sc:null})(n);return o||(r!=null&&r.detectGoogleSearchApp&&at(e,"GSA/")?WC:at(e," OPR/")&&at(e,"Mini")?L3:at(e," OPR/")?zv:Uv.test(e)?Jo:at(e,"IE"+Xn)||at(e,"WPDesktop")?IC:at(e,"OculusBrowser")?qC:at(e,DC)?OC:at(e,Hv)||at(e,"Edg/")?PC:at(e,jh+"/")?jh:at(e,"YaBrowser/")?VC:at(e,Rh+"/")?Rh:at(e,Og+"/")||at(e,"Ddg/")?Og:at(e,"FBIOS")?"Facebook "+Xn:at(e,"UCWEB")||at(e,"UCBrowser")?"UC Browser":at(e,"CriOS")?LC:at(e,"CrMo")||at(e,Da)?Da:at(e,hr)&&at(e,bc)?zC:at(e,"FxiOS")?BC:at(e.toLowerCase(),Dg.toLowerCase())?Dg:at(e,Sc+"/")?Sc:((c,h)=>h&&at(h,NC)||(function(l){return at(l,bc)&&!at(l,Da)&&!at(l,hr)})(c))(e,t)?at(e,Xn)?HC:bc:at(e,"PaleMoon/")?GC:at(e,Ah+"/")?Ah:at(e,qo)?qo:at(e,"MSIE")||at(e,"Trident/")?Bv:at(e,"Gecko")?qo:"")},U3={[IC]:[new RegExp("rv:"+ys)],[PC]:[new RegExp(Hv+"?\\/"+ys)],[Da]:[new RegExp("("+Da+"|CrMo)\\/"+ys)],[LC]:[new RegExp("CriOS\\/"+ys)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ys)],[bc]:[jm],[HC]:[jm],[zv]:[new RegExp("(Opera|OPR)\\/"+ys)],[qo]:[new RegExp(qo+"\\/"+ys)],[BC]:[new RegExp("FxiOS\\/"+ys)],[Dg]:[new RegExp("Konqueror[:/]?"+ys,"i")],[Jo]:[new RegExp(Jo+" "+ys),jm],[zC]:[new RegExp("android\\s"+ys,"i")],[OC]:[new RegExp(DC+"\\/"+ys)],[qC]:[new RegExp("OculusBrowser\\/"+ys)],[jh]:[new RegExp(jh+"\\/"+ys)],[VC]:[new RegExp("YaBrowser\\/"+ys)],[Rh]:[new RegExp(Rh+"\\/"+ys)],[Sc]:[new RegExp(Sc+"\\/"+ys)],[Og]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ys)],[GC]:[new RegExp("PaleMoon\\/"+ys)],[Ah]:[new RegExp(Ah+"\\/"+ys)],[WC]:[new RegExp("GSA\\/"+ys)],[Bv]:[new RegExp("(rv:|MSIE )"+ys)],Mozilla:[new RegExp("rv:"+ys)]},F3=function(e,t,n,r){var o=KC(e,t,n,r),c=U3[o];if($e(c))return null;for(var h=0;c.length>h;h++){var l=e.match(c[h]);if(l)return parseFloat(l[l.length-2])}return null},k1=[[new RegExp(Vo+"; "+Vo+" (.*?)[);]","i"),e=>[Vo,e&&e[1]||""]],[new RegExp(Ac,"i"),[Ac,""]],[new RegExp(Tc,"i"),[Tc,""]],[Uv,[Jo,""]],[new RegExp(hc,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Mg,""];if(new RegExp(Xn).test(t)&&!/IEMobile\b/.test(t))return[hc+" "+Xn,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=H3[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[hc,r]}return[hc,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[kh,[e[3],e[4],e[5]||"0"].join(".")]:[kh,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=$e(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+hr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+hr+")","i"),e=>e&&e[2]?[hr,[e[2],e[3],e[4]||"0"].join(".")]:[hr,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[O3,""]],[/Linux|debian/i,["Linux",""]]],j1=function(e){return z3.test(e)?Ac:B3.test(e)?Tc:P3.test(e)?Vo:new RegExp($g,"i").test(e)?$g:new RegExp("("+Mg+"|WPDesktop)","i").test(e)?Mg:/iPad/.test(e)?TC:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?MC:Uv.test(e)?Jo:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(E1,"i").test(e)?E1:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Xn).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?hr:AC:new RegExp("(pda|"+Xn+")","i").test(e)?I3:new RegExp(Xo,"i").test(e)&&!new RegExp(Xo+" pc","i").test(e)?FC:""},q3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function R1(e,t){return typeof(n=e)=="string"&&q3.test(n)?e:t();var n}function Kr(e){return e&&e.split("#")[0]}function fh(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var V3=e=>e instanceof Error,YC={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},G3=YC.info;function XC(e){if(xi(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(ut(e))return{arrayValue:{values:e.map((t=>XC(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Th(e){var t=[];for(var n in e){var r=e[n];En(r)||$e(r)||t.push({key:n,value:XC(r)})}return t}function W3(e,t){var n=YC[e.level||"info"]||G3,r=n.text,o=n.number,c=String(Date.now())+"000000",h={};t.distinctId&&(h.posthogDistinctId=t.distinctId),t.sessionId&&(h.sessionId=t.sessionId),t.windowId&&(h["window.id"]=t.windowId),ft(t.sessionStartTimestamp)||(h.sessionStartTimestamp=String(t.sessionStartTimestamp)),ft(t.lastActivityTimestamp)||(h.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(h["url.full"]=t.currentUrl),t.screenName&&(h["screen.name"]=t.screenName),t.appState&&(h["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(h.feature_flags=t.activeFeatureFlags);var l=Te({},h,e.attributes||{}),u={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:o,severityText:r,body:{stringValue:e.body},attributes:Th(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),$e(e.trace_flags)||(u.flags=e.trace_flags),u}function JC(e,t,n){return Te({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function ZC(e,t,n,r){return{resourceLogs:[{resource:{attributes:Th(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let K3=class{constructor(e,t,n,r,o,c,h){var l;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Te=t,this.it=n,this.ut=r,this.ht=o,this.dt=c,this.ct=h,this.vt=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.xt=t.maxBufferSize,this.kt=Math.max((l=t.maxQueueSize)!==null&&l!==void 0?l:t.maxBufferSize,t.maxBufferSize),this.St=t.flushIntervalMs,this.Ct=t.maxBatchRecordsPerPost,this.Mt=t.rateCapWindowMs,this.It=t.maxLogsPerInterval}reset(){this.Tt(),this.vt=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Te.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.Et()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.Rt(e);if(t!==null)if(t.body){if(this.Pt()){var n={record:W3(t,this.ut())};this.ht((()=>this.Ot(n)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var n=ut(t)?t:[t],r=e;for(var o of n)try{var c=o(r);if(!c)return this.it.info("Log was rejected in beforeSend function"),null;r=c}catch(h){return this.it.error("Error in beforeSend function for log:",h),null}return r}Pt(){if(this.It===void 0)return!0;var e=Date.now(),t=e-this.bt;return this.Mt>t&&t>=0||(this.bt=e,this._t=0,this.wt=!1),this.It>this._t?(this._t++,!0):(this.wt||(this.it.warn("captureLog dropping logs: exceeded "+this.It+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var e=this;return hs((function*(){if(!e._instance.isDisabled)return e.vt||(e.vt=e.Ft().finally((()=>{e.vt=null}))),e.vt}))()}Ft(){var e=this;return hs((function*(){var t;e.Tt();var n=(t=e._instance.getPersistedProperty(or.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,o=0;n.length>0&&r>o;){var c,h;e.ft=0;var l=Math.min(n.length,e.Ct),u=n.slice(0,l),m=ZC(u.map((p=>p.record)),e.At(),(c=e.ct)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.$t(m);if(g.kind==="too-large"&&u.length>1)e.Ct=Math.max(1,Math.floor(u.length/2)),e.it.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+e.Ct);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.it.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):g.kind==="ok"&&e.Te.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Te.maxBatchRecordsPerPost,e.Ct+1)),yield e.Lt(u.length),n=(h=e._instance.getPersistedProperty(or.LogsQueue))!==null&&h!==void 0?h:[],o+=u.length,g.kind==="fatal"))throw g.error}}))()}Lt(e){var t=this;return hs((function*(){var n,r=Math.max(0,e-t.ft),o=(n=t._instance.getPersistedProperty(or.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(or.LogsQueue,o.slice(r)),yield t.dt()}))()}At(){return JC(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(or.LogsQueue))!==null&&t!==void 0?t:[];this.kt>n.length||(n.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(or.LogsQueue,n),this.xt>n.length?this.Dt():this.Et()}}Dt(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=fh((()=>{this.Nt=void 0,this.Et()}),e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(or.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return hs((function*(){t.Tt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((r=>fh(r,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return hs((function*(){var n=!1,r=t.flush(),o=new Promise((c=>fh((()=>{n=!0,c()}),e)));try{yield Promise.race([r,o])}finally{n&&r.catch((()=>{}))}}))()}Et(){this.flush().then((()=>{this.yt=0}),(e=>{this.yt++,this.it.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())}))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Rm=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function A1(e){return String(e)+"000000"}function T1(e,t,n,r){var o="";return r&&(o=Object.keys(r).sort().map((c=>JSON.stringify(c)+":"+JSON.stringify(r[c]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+o}let Y3=class{constructor(e,t,n){this._instance=e,this.Te=t,this.it=n,this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(e,t,n){t===void 0&&(t=1),this.Wt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Wt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Wt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.vt,n=(function(){var o=hs((function*(){t&&(yield t.catch((()=>{}))),yield e.Zt()}));return function(){return o.apply(this,arguments)}})(),r=n().finally((()=>{this.vt===r&&(this.vt=null)}));return this.vt=r,r}drainWindow(){if(this.Bt.size===0)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Vt++,this.Tt(),this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Wt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.it.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?Te({},t.attributes):void 0,r=T1(t.type,t.name,t.unit,n)}catch(h){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",h)}var o=this.Bt.get(r);if(!o){if(!this.Qt())return;o={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(r,o)}var c=this.Ut.get(t.name);c===void 0?this.Ut.set(t.name,t.type):c===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+c+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(o,t.value),this.Dt()}else this.it.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.it.warn("Dropping metric with empty name")}}Qt(){return this.Te.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.it.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Jt(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Rm.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[(function(o,c){for(var h=0;c.length>h;h++)if(c[h]>=o)return h;return c.length})(t,Rm)]+=1}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var n=ut(t)?t:[t],r=e;for(var o of n)try{var c=o(r);if(!c)return this.it.info("Metric was rejected in beforeSend function"),null;r=c}catch(h){return this.it.error("Error in beforeSend function for metric:",h),null}return r}Dt(){this.Nt||(this.Nt=fh((()=>{this.Nt=void 0,this.flush().catch((e=>{this.it.error("Metrics flush failed:",e)}))}),this.Te.flushIntervalMs))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var e=this;return hs((function*(){if(e.Bt.size!==0){var t=e.Bt;e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set;var n=e.Vt,r=yield e._instance.Kt(e.Gt(t));if(n===e.Vt)switch(r.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.Dt();case"too-large":return void e.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.it.error("Failed to send metrics batch:",r.error)}}}))()}Gt(e){return t=this.Xt(e),n=(function(c,h,l){return Te({},c.resourceAttributes,{"service.name":c.serviceName||"unknown_service"},c.environment&&{"deployment.environment":c.environment},c.serviceVersion&&{"service.version":c.serviceVersion},{"telemetry.sdk.name":h,"telemetry.sdk.version":l})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Th(n)},scopeMetrics:[{scope:{name:r,version:o},metrics:t}]}]};var t,n,r,o}Xt(e){var t=A1(Date.now()),n=new Map;for(var r of e.values()){var o,c=T1(r.type,r.name,r.unit,void 0),h=n.get(c);h||(h=Te({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?h.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?h.gauge={dataPoints:[]}:h.histogram={aggregationTemporality:1,dataPoints:[]},n.set(c,h));var l=Th((o=r.attributes)!==null&&o!==void 0?o:{}),u=A1(r.windowStartMs);if(r.type==="count"){var m,g={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:(m=r.total)!==null&&m!==void 0?m:0};h.sum.dataPoints.push(g)}else if(r.type==="gauge"){var p,S={attributes:l,timeUnixNano:t,asDouble:(p=r.last)!==null&&p!==void 0?p:0};h.gauge.dataPoints.push(S)}else r.hist&&h.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Rm})}return Array.from(n.values())}Yt(e){var t,n;for(var r of e){var o=r[0],c=r[1],h=this.Bt.get(o);if(h)switch(h.windowStartMs=Math.min(h.windowStartMs,c.windowStartMs),h.type){case"count":h.total=((t=h.total)!==null&&t!==void 0?t:0)+((n=c.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(c.hist)if(h.hist){h.hist.count+=c.hist.count,h.hist.sum+=c.hist.sum,h.hist.min=Math.min(h.hist.min,c.hist.min),h.hist.max=Math.max(h.hist.max,c.hist.max);for(var l=0;h.hist.bucketCounts.length>l;l++)h.hist.bucketCounts[l]+=c.hist.bucketCounts[l]}else h.hist=c.hist}else this.Qt()&&this.Bt.set(o,c)}}};var Ku,N1,Am;function X3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Am&&n.length===N1||(N1=n.length,Am=n.reduce(((r,o)=>{Ku||(Ku={});var c=Ku[o];if(c)r[c[0]]=c[1];else for(var h=e(o),l=h.length-1;l>=0;l--){var u=h[l],m=u==null?void 0:u.filename,g=t[o];if(m&&g){r[m]=g,Ku[o]=[m,g];break}}return r}),{})),Am}}class J3{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},o=this.buildCoercingContext(r,n,0).apply(t),c=this.buildParsingContext(n),h=this.parseStacktrace(o,c);return{$exception_list:this.convertToExceptionList(h,r),$exception_level:"error"}}modifyFrames(t){var n=this;return hs((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&ut(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,o;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(o=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),Te({},t,{cause:r,stack:o})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return hs((function*(){var r=t;for(var o of n.modifiers)r=yield o(r);return r}))()}convertToExceptionList(t,n){var r,o,c,h={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(o=n.handled)===null||o===void 0||o,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(h.stacktrace={type:"raw",frames:t.stack});var l=[h];return t.cause!=null&&l.push(...this.convertToExceptionList(t.cause,Te({},n,{handled:!0}))),l}buildParsingContext(t){var n;return{chunkIdMap:X3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var o=(c,h)=>{if(4>=h){var l=this.buildCoercingContext(t,n,h);return this.applyCoercers(c,l)}};return Te({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:c=>o(c,r),next:c=>o(c,r+1)})}}var Zo="?";function Lg(e,t,n,r,o){var c={platform:e,filename:t,function:n==="<anonymous>"?Zo:n,in_app:!0};return $e(r)||(c.lineno=r),$e(o)||(c.colno=o),c}var QC=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Zo,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Z3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Q3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,e4=/\((\S*)(?::(\d+))(?::(\d+))\)/,t4=(e,t)=>{var n=Z3.exec(e);if(n)return Lg(t,n[1],Zo,+n[2],+n[3]);var r=Q3.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var o=e4.exec(r[2]);o&&(r[2]=o[1],r[3]=o[2],r[4]=o[3])}var c=QC(r[1]||Zo,r[2]);return Lg(t,c[1],c[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},s4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,n4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,i4=(e,t)=>{var n=s4.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=n4.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var o=n[3],c=n[1]||Zo,h=QC(c,o);return Lg(t,o=h[1],c=h[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},M1=/\(error: (.*)\)/;class r4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=ts(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return Eh(t,"DOMException")}isDOMError(t){return Eh(t,"DOMError")}}class a4{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class o4{constructor(){}match(t){return Eh(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var r;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var l4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class c4{match(t){return typeof t=="string"}coerce(t,n){var r,o=this.getInfos(t),c=o[0],h=o[1];return{type:c??"Error",value:h??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,o=t.match(l4);return o&&(n=o[1],r=o[2]),[n,r]}}var u4=["fatal","error","warning","log","info","debug"];function eE(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var o=n.slice(0,r).join(", ");if(t>=o.length)return r===n.length?o:o.length>t?o.slice(0,t)+"...":o}return""}class d4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Pv(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+eE(t)}isSeverityLevel(t){return ts(t)&&!Ng(t)&&u4.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(V3(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class h4{match(t){return Pv(t)}coerce(t,n){var r,o=t.constructor.name;return{type:o,value:o+" captured as exception with keys: "+eE(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class f4{match(t){return RC(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class p4{match(t){return Eh(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Pv(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,o=this.getUnhandledRejectionReason(t);return RC(o)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(o),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(o)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Nh="$message",Mh="$timestamp",m4=new Set([Nh,Mh]),Tm={enabled:!0,max_bytes:32768};function $h(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Tm.enabled,max_bytes:v4(e.max_bytes,Tm.max_bytes)}:Te({},Tm)}class g4{constructor(t){this.$e=[],this.ze=0,this.Te=$h(t)}setConfig(t){this.Te=$h(t),this.Ze()}add(t){var n=(function(o){var c;try{c=EC(o)}catch{return}try{var h=JSON.parse(c);if(!ds(h))return;var l=h,u=l[Nh],m=l[Mh];return!ts(u)||u.trim().length===0||!ts(m)&&!cn(m)?void 0:{step:l,json:c}}catch{return}})(t);if(n){var r=(function(o){if(typeof TextEncoder<"u")return new TextEncoder().encode(o).length;for(var c=encodeURIComponent(o),h=0,l=0;c.length>l;l++)c[l]==="%"?(h+=1,l+=2):h+=1;return h})(n.json);r>this.Te.max_bytes||(this.$e.push({step:n.step,bytes:r}),this.ze+=r,this.Ze())}}getAttachable(){return this.$e.map((t=>t.step))}clear(){this.$e=[],this.ze=0}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var t=this.$e.shift();t&&(this.ze-=t.bytes)}}}function v4(e,t){if(!cn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var tE=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={k(o){if(_e&&(qt.DEBUG||_e.POSTHOG_DEBUG||n)&&!$e(_e.console)&&_e.console){for(var c=("__rrweb_original__"in _e.console[o])?_e.console[o].__rrweb_original__:_e.console[o],h=arguments.length,l=new Array(h>1?h-1:0),u=1;h>u;u++)l[u-1]=arguments[u];c(e,...l)}},debug(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("debug",...c)},info(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("log",...c)},warn(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("warn",...c)},error(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("error",...c)},critical(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];console.error(e,...c)},uninitializedWarning(o){r.error("You must initialize PostHog before calling "+o)},createLogger:(o,c)=>tE(e+" "+o,c)};return r},Oe=tE("[PostHog.js]"),ps=Oe.createLogger,_4=ps("[ExternalScriptsLoader]"),Nm=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return _4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Be==null?void 0:Be.querySelectorAll("script");if(r){for(var o,c=function(){if(r[h].src===t){var u=r[h];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",(m=>{u.__posthog_loading_callback_fired=!0,n(void 0,m)})),u.onerror=m=>n(m),{v:void 0})}},h=0;r.length>h;h++)if(o=c())return o.v}var l=()=>{if(!Be)return n("document not found");var u=Be.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=t,u.onload=p=>{u.__posthog_loading_callback_fired=!0,n(void 0,p)},u.onerror=p=>n(p),e.config.prepare_external_dependency_script&&(u=e.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Be.head.appendChild(u);else{var m,g=Be.querySelectorAll("body > script");g.length>0?(m=g[0].parentNode)==null||m.insertBefore(u,g[0]):Be.body.appendChild(u)}};Be!=null&&Be.body?l():Be==null||Be.addEventListener("DOMContentLoaded",l)};Xe.__PosthogExtensions__=Xe.__PosthogExtensions__||{},Xe.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r;if(e.config.strict_script_versioning)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var o="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;o=o+"&t="+Math.floor(Date.now()/c)*c}r=e.requestRouter.endpointFor("assets",o)}Nm(e,r,n)}else{var h=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Nm(e,h,n)}},Xe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Nm(e,r,n)};qt.DEBUG=!1,qt.LIB_VERSION="1.409.5",qt.LIB_NAME="web";var sE="$people_distinct_id",Nc="$device_id",Mm="$device_model",fc="__alias",pc="__timers",Ig="$autocapture_disabled_server_side",Pg="$heatmaps_enabled_server_side",Bg="$exception_capture_enabled_server_side",zg="$error_tracking_suppression_rules",Hg="$error_tracking_capture_extension_exceptions",Ug="$web_vitals_enabled_server_side",Fv="$dead_clicks_enabled_server_side",qv="$product_tours_enabled_server_side",Fg="$web_vitals_allowed_metrics",$a="$session_recording_remote_config",nE="$replay_sample_rate",iE="$replay_override_sampling",rE="$replay_override_linked_flag",aE="$replay_override_url_trigger",oE="$replay_override_event_trigger",Bo="$sesid",Vv="$session_is_sampled",Na="$enabled_feature_flags",ph="$active_feature_flags",mc="$early_access_features",qg="$feature_flag_details",mh="$feature_flag_payloads",Vg="$feature_flag_request_id",Dh="$minimal_flag_called_events",ar="$override_feature_flags",Lo="$override_feature_flag_payloads",ja="$stored_person_properties",Ra="$stored_group_properties",Gg="$surveys",Oh="$surveys_loaded_at",Wg="$surveys_activated",gh="$surveys_activated_session",gc="ph_product_tours",wc="$flag_call_reported",Kg="$flag_call_reported_session_id",Yg="$feature_flag_errors",Mc="$feature_flag_evaluated_at",ci="$user_state",Xg="$client_session_props",Jg="$capture_rate_limit",Zg="$initial_campaign_params",Qg="$initial_referrer_info",Lh="$initial_person_info",Ih="$epp",Yu="$posthog_cookieless",lE="$cookieless_mode",cE="$sdk_debug_extensions_init_method",uE="$sdk_debug_extensions_init_time_ms",dE="$sdk_debug_recording_script_not_loaded",Gv="PostHog loadExternalDependency extension not found.",Aa="on_reject",cr="always",jo="anonymous",ga="identified",ev="identified_only",Ph="visibilitychange",Bh="beforeunload",Io="$pageview",$m="$pageleave",Dm="$identify",$1="$groupidentify";function Xu(e,t){ut(e)&&e.forEach(t)}function ss(e,t){if(!ft(e))if(ut(e))e.forEach(t);else if(A3(e))e.forEach(((r,o)=>t(r,o)));else for(var n in e)jC.call(e,n)&&t(e[n],n)}var rs=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var o of n)for(var c in o)o[c]!==void 0&&(e[c]=o[c]);return e};function vh(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var D1=function(e){try{return e()}catch{return}},y4=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(o){Oe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Oe.critical(o)}}},Wv=function(e){var t={};return ss(e,(function(n,r){(ts(n)&&n.length>0||cn(n))&&(t[r]=n)})),t},b4=["herokuapp.com","vercel.app","netlify.app"];function S4(e){var t=e==null?void 0:e.hostname;if(!ts(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of b4)if(n===r)return!1;return!0}function bs(e,t,n,r){var o=r??{},c=o.capture,h=o.passive;e==null||e.addEventListener(t,n,{capture:c!==void 0&&c,passive:h===void 0||h})}function hE(e){return e.name==="ph_toolbar_internal"}var fE=e=>{if(Be){try{for(var t=e+"=",n=Be.cookie.split(";").filter((c=>c.length)),r=0;n.length>r;r++){for(var o=n[r];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return decodeURIComponent(o.substring(t.length,o.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return cn(e)&&isFinite(e)&&Math.floor(e)===e});class zh{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||0>t||0>n||0>r||0>o||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/256,c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|r>>>24,c[9]=r>>>16,c[10]=r>>>8,c[11]=r,c[12]=o>>>24,c[13]=o>>>16,c[14]=o>>>8,c[15]=o,new zh(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new zh(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class w4{generate(){var t=this.generateOrAbort();if(!$e(t))return t;this.S=0;var n=this.generateOrAbort();if($e(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.M++,this.M>4398046511103&&(this.S++,this.C())}return zh.fromFieldsV7(this.S,Math.trunc(this.M/Math.pow(2,30)),this.M&Math.pow(2,30)-1,this.I.nextUint32())}C(){this.M=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}constructor(){this.S=0,this.M=0,this.I=new x4}}var O1,pE=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};_e&&!$e(_e.crypto)&&crypto.getRandomValues&&(pE=e=>crypto.getRandomValues(e));class x4{nextUint32(){return this.R.length>this.O||(pE(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var lr=()=>C4().toString(),C4=()=>(O1||(O1=new w4)).generate(),Ql="",E4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ur={N:()=>!!Be,P(e){Oe.error("cookieStore error: "+e)},q:fE,F(e){var t;try{t=JSON.parse(ur.q(e))||{}}catch{}return t},A(e,t,n,r,o){if(!Be)return!1;try{var c="",h="",l=(function(g,p){if(p){var S=(function(A,E){if(E===void 0&&(E=Be),Ql)return Ql;if(!E||["localhost","127.0.0.1"].includes(A))return"";for(var y=A.split("."),b=Math.min(y.length,8),v="dmn_chk_"+lr();!Ql&&b--;){var _=y.slice(b).join("."),k=v+"=1;domain=."+_+";path=/";E.cookie=k+";max-age=3",E.cookie.includes(v)&&(E.cookie=k+";max-age=0",Ql=_)}return Ql})(g);if(!S){var w=(A=>{var E=A.match(E4);return E?E[0]:""})(g);w!==S&&Oe.info("Warning: cookie subdomain discovery mismatch",w,S),S=w}return S?"; domain=."+S:""}return""})(Be.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),c="; expires="+u.toUTCString()}o&&(h="; secure");var m=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+l+h;return m.length>3686.4&&Oe.warn("cookieStore warning: large cookie, len="+m.length),Be.cookie=m,!0}catch{return!1}},D(e,t){if(Be!=null&&Be.cookie)try{ur.A(e,"",-1,t)}catch{return}}},Om=null,is={N(){if(!En(Om))return Om;var e=!0;if($e(_e))e=!1;else try{var t="__mplssupport__";is.A(t,"xyz"),is.q(t)!=='"xyz"'&&(e=!1),is.D(t)}catch{e=!1}return e||Oe.error("localStorage unsupported; falling back to cookie store"),Om=e,e},P(e){Oe.error("localStorage error: "+e)},q(e){try{return _e==null?void 0:_e.localStorage.getItem(e)}catch(t){is.P(t)}return null},F(e){try{return JSON.parse(is.q(e))||{}}catch{}return null},A(e,t){try{return _e==null||_e.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){is.P(n)}return!1},D(e){try{_e==null||_e.localStorage.removeItem(e)}catch(t){is.P(t)}}},k4=[Nc,"distinct_id",Bo,Vv,Ih,Lh,ci],Ju={},j4={N:()=>!0,P(e){Oe.error("memoryStorage error: "+e)},q:e=>Ju[e]||null,F:e=>Ju[e]||null,A:(e,t)=>(Ju[e]=t,!0),D(e){delete Ju[e]}},va=null,ln={N(){if(!En(va))return va;if(va=!0,$e(_e))va=!1;else try{var e="__support__";ln.A(e,"xyz"),ln.q(e)!=='"xyz"'&&(va=!1),ln.D(e)}catch{va=!1}return va},P(e){Oe.error("sessionStorage error: ",e)},q(e){try{return _e==null?void 0:_e.sessionStorage.getItem(e)}catch(t){ln.P(t)}return null},F(e){try{return JSON.parse(ln.q(e))||null}catch{}return null},A(e,t){try{return _e==null||_e.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ln.P(n)}return!1},D(e){try{_e==null||_e.sessionStorage.removeItem(e)}catch(t){ln.P(t)}}};class R4{constructor(t){this._instance=t}get Te(){return this._instance.config}get consent(){return this.Ge()?0:this.Qe}isOptedOut(){return this.Te.cookieless_mode===cr||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===Aa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Je.A(this.Ke,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Je.D(this.Ke,this.Te.cross_subdomain_cookie)}get Ke(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Qe(){var t=this.Je.q(this.Ke);return km(t)?1:at($3,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?is:ur;if(!this.Ye||this.Ye!==n){this.Ye=n;var r=t==="localStorage"?ur:is;r.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(km(r.q(this.Ke))),r.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[xn==null?void 0:xn.doNotTrack,xn==null?void 0:xn.msDoNotTrack,Xe.doNotTrack].some((t=>km(t)))}}function mE(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Wn(r))return t;try{var o=r(t);return ts(o)&&o?o:t}catch(c){return Oe.error("Error in get_current_url, falling back to window.location.href",c),t}}var gE="__POSTHOG_TOOLBAR__",A4=1,T4=3,N4=11;function L1(e){return e instanceof Element&&(e.id===gE||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Yr(e){return!!e&&e.nodeType===A4}function Kn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function vE(e){return!!e&&e.nodeType===T4}function _E(e){return!!e&&e.nodeType===N4&&Yr(e.host)}var yE=1e3;function Kv(e){return e?of(e).split(/\s+/):[]}function I1(e,t){var n=(function(r){var o,c=_e==null||(o=_e.location)==null?void 0:o.href;return $e(c)?void 0:mE(r,c)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function Hh(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Kv(t)}function bE(e){return ft(e)?null:of(e).split(/(\s+)/).filter((t=>xc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $c(e){var t="";return sv(e)&&!CE(e)&&e.childNodes&&e.childNodes.length&&ss(e.childNodes,(function(n){var r;vE(n)&&n.textContent&&(t+=(r=bE(n.textContent))!==null&&r!==void 0?r:"")})),of(t)}function Lm(e){var t;return $e(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Yv=["a","button","form","input","select","textarea","label"];function tv(e,t){if($e(t))return!0;var n,r=function(c){if(t.some((h=>(function(l,u){var m=l.matches||l.matchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.webkitMatchesSelector||l.oMatchesSelector;try{return!!m&&m.call(l,u)}catch{return!1}})(c,h))))return{v:!0}};for(var o of e)if(n=r(o))return n.v;return!1}function SE(e){var t=e.parentNode;return!(!t||!Yr(t))&&t}var M4=[".ph-no-autocapture","[data-ph-no-autocapture]"],wE=["next","previous","prev",">","<"],$4=[...wE,"+","-","−","–"],P1=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,B1=[".ph-no-rageclick",".ph-no-capture"],D4=["","text","search","email","password","url","tel","number"];function z1(e,t){if(!_e||Xv(e))return!1;var n,r,o,c,h;if(xi(t)?(n=!!t&&B1,r=void 0,o=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:B1,r=t==null?void 0:t.content_ignorelist,o=(h=t==null?void 0:t.ignore_text_selection)!==null&&h!==void 0&&h),n===!1||o&&(function(u){return!(!u||!Yr(u))&&(!!Kn(u,"textarea")||(Kn(u,"input")?at(D4,(u.getAttribute("type")||"").toLowerCase()):(function(m){if(m.isContentEditable)return!0;var g=m.getAttribute==null?void 0:m.getAttribute("contenteditable");return g==="true"||g===""})(u)))})(e))return!1;var l=xE(e,!1).targetElementList;return!(function(u,m){if(u===!1||$e(u))return!1;var g;if(u===!0)g=wE;else{if(!ut(u))return!1;if(u.length>10)return Oe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=u.map((p=>p.toLowerCase()))}return m.some((p=>{var S=p.safeText,w=p.ariaLabel;return g.some((A=>P1(S,A)||P1(w,A)))}))})(r,l.map((u=>{var m;return{safeText:$c(u).toLowerCase(),ariaLabel:((m=u.getAttribute("aria-label"))==null?void 0:m.toLowerCase().trim())||""}})))&&!tv(l,n)}var Xv=e=>!e||Kn(e,"html")||!Yr(e),xE=(e,t)=>{if(!_e||Xv(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],o=e;o.parentNode&&!Kn(o,"body");)if(_E(o.parentNode))r.push(o.parentNode.host),o=o.parentNode.host;else{var c=SE(o);if(!c)break;if(t||Yv.indexOf(c.tagName.toLowerCase())>-1)n=!0;else try{var h=_e.getComputedStyle(c);h&&h.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(c),o=c}return{parentIsUsefulElement:n,targetElementList:r}};function sv(e){for(var t=new Set,n=0,r=e;r.parentNode&&!Kn(r,"body");r=r.parentNode){if(n++>=yE||t.has(r))return!1;t.add(r);var o=Hh(r);if(at(o,"ph-sensitive")||at(o,"ph-no-capture"))return!1}if(at(Hh(e),"ph-include"))return!0;var c=e.type||"";if(ts(c))switch(c.toLowerCase()){case"hidden":case"password":return!1}var h=e.name||e.id||"";return!ts(h)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(h.replace(/[^a-zA-Z0-9]/g,""))}function CE(e){return!!(Kn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Kn(e,"select")||Kn(e,"textarea")||e.getAttribute("contenteditable")==="true")}var H1=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),U1=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,O4=[16,15,14,13],L4=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),F1=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),q1=/[0-9A-Za-z_]/;function I4(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var o=e.charCodeAt(r)-48;n&&(o*=2)>9&&(o-=9),t+=o,n=!n}return t%10==0}function xc(e,t){if(t===void 0&&(t=!0),ft(e))return!1;if(ts(e)){e=of(e);var n=t?H1.test((e||"").replace(/[- ]/g,"")):(function(o){var c;for(U1.lastIndex=0;c=U1.exec(o);){var h=c[2];if(h)for(var l=h.replace(/[- ]/g,""),u=0;l.length>u;u++)for(var m of O4){var g=u+m;if(l.length>=g){var p=l.slice(u,g);if(H1.test(p)&&I4(p))return!0}}}return!1})(e);if(n)return!1;var r=t?L4.test(e):(function(o){var c;for(F1.lastIndex=0;c=F1.exec(o);){var h=c[1],l=c[3];if(!(h&&l&&q1.test(h)&&q1.test(l)))return!0}return!1})(e);if(r)return!1}return!0}function V1(e){var t=$c(e);return xc(t=(t+" "+EE(e)).trim())?t:""}function EE(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ss(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var o=$c(n);t=(t+" "+o).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+EE(n)).trim())}catch(c){Oe.error("[AutoCapture]",c)}})),t}function G1(e){return e.replace(/"|\\"/g,'\\"')}function P4(e){var t=e.attr__class;if(t)return ut(t)?t:Kv(t)}var Zu=ps("[Dead Clicks]"),B4=()=>!0,z4=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Fv)),r=e.instance.config.capture_dead_clicks;return xi(r)?r:!!ds(r)||n};class W1{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Fv]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var n,r;(n=Xe.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Xe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(o=>{o?Zu.error("failed to load script",o):t()}))}er(){var t;if(Be){if(!this.Xe&&(t=Xe.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=ds(this.instance.config.capture_dead_clicks)?Te({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xe=Xe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xe.start(Be),Zu.info("starting...")}}else Zu.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,Zu.info("stopping..."))}}var Im=ps("[SegmentIntegration]"),kE="posthog-js";function jE(e,t){var n=t===void 0?{}:t,r=n.organization,o=n.projectId,c=n.prefix,h=n.severityAllowList,l=h===void 0?["error"]:h,u=n.sendExceptionsToPostHog,m=u===void 0||u;return g=>{var p,S,w,A,E;if(l!=="*"&&!l.includes(g.level)||!e.__loaded)return g;g.tags||(g.tags={});var y=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());g.tags["PostHog Person URL"]=y,e.sessionRecordingStarted()&&(g.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var b,v=((p=g.exception)==null?void 0:p.values)||[],_=v.map((C=>Te({},C,{stacktrace:C.stacktrace?Te({},C.stacktrace,{type:"raw",frames:(C.stacktrace.frames||[]).map((x=>Te({},x,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((S=v[0])==null?void 0:S.value)||g.message,$exception_type:(w=v[0])==null?void 0:w.type,$exception_level:g.level,$exception_list:_,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:((A=v[0])==null?void 0:A.value)||g.message,$sentry_exception_type:(E=v[0])==null?void 0:E.type,$sentry_tags:g.tags};return r&&o&&(k.$sentry_url=(c||"https://sentry.io/organizations/")+r+"/issues/?project="+o+"&query="+g.event_id),m&&((b=e.exceptions)==null||b.sendExceptionEvent(k)),g}}class H4{constructor(t,n,r,o,c,h){this.name=kE,this.setupOnce=function(l){l(jE(t,{organization:n,projectId:r,prefix:o,severityAllowList:c,sendExceptionsToPostHog:h==null||h}))}}}class K1{constructor(t){this.rr=(n,r,o)=>{o&&(o.noSessionId||o.activityTimeout||o.sessionPastMaximumLength||o.crossTabAdoption)&&(Oe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:o}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.rr)}destroy(){var t;(t=this.sr)==null||t.call(this),this.sr=void 0}doPageView(t,n){var r,o=this.ar(t,n);return this.ir={pathname:(r=_e==null?void 0:_e.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),o}doPageLeave(t){var n;return this.ar(t,(n=this.ir)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,n){var r=this.ir;if(!r)return{$pageview_id:n};var o={$pageview_id:n,$prev_pageview_id:r.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var h=c.maxScrollHeight,l=c.lastScrollY,u=c.maxScrollY,m=c.maxContentHeight,g=c.lastContentY,p=c.maxContentY;if(!($e(h)||$e(l)||$e(u)||$e(m)||$e(g)||$e(p))){h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u),m=Math.ceil(m),g=Math.ceil(g),p=Math.ceil(p);var S=h>1?Oi(l/h,0,1,Oe):1,w=h>1?Oi(u/h,0,1,Oe):1,A=m>1?Oi(g/m,0,1,Oe):1,E=m>1?Oi(p/m,0,1,Oe):1;o=rs(o,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:S,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:w,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:A,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:E})}}return r.pathname&&(o.$prev_pageview_pathname=r.pathname),r.timestamp&&(o.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),o}}var Pm=["flags","surveys"],U4={[sE]:{exposure:"hidden"},[fc]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[pc]:{exposure:"hidden"},[Ig]:{exposure:"event"},[Pg]:{exposure:"hidden"},[Bg]:{exposure:"event"},[zg]:{exposure:"hidden"},[Hg]:{exposure:"event"},[Ug]:{exposure:"event"},[Fv]:{exposure:"event"},[qv]:{exposure:"hidden"},[Fg]:{exposure:"event"},[$a]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Bo]:{exposure:"hidden"},[Vv]:{exposure:"event"},[nE]:{exposure:"event",shouldSkipFromEventProperties:e=>En(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Na]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ds(e))return{};for(var t={},n=Object.keys(e),r=0;n.length>r;r++)t["$feature/"+n[r]]=e[n[r]];return t}},[ph]:{exposure:"event",storageGroup:"flags"},[mc]:{exposure:"hidden"},[qg]:{exposure:"hidden",storageGroup:"flags"},[mh]:{exposure:"event",storageGroup:"flags"},[Vg]:{exposure:"event",storageGroup:"flags",volatile:!0},[Dh]:{exposure:"hidden",storageGroup:"flags"},[ar]:{exposure:"event"},[Lo]:{exposure:"hidden"},[ja]:{exposure:"hidden"},[Ra]:{exposure:"hidden"},[Gg]:{exposure:"hidden",storageGroup:"surveys"},[Oh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Wg]:{exposure:"event"},[gh]:{exposure:"hidden"},[gc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[wc]:{exposure:"hidden"},[Kg]:{exposure:"hidden"},[Yg]:{exposure:"hidden"},[Mc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ci]:{exposure:"hidden"},[Xg]:{exposure:"hidden"},[Jg]:{exposure:"hidden"},[Zg]:{exposure:"hidden"},[Qg]:{exposure:"hidden"},[Lh]:{exposure:"hidden"},[Ih]:{exposure:"hidden"},[iE]:{exposure:"event"},[rE]:{exposure:"event"},[aE]:{exposure:"event"},[oE]:{exposure:"event"},[cE]:{exposure:"event"},[uE]:{exposure:"event"},[dE]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},F4=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],_a=e=>{var t=U4[e];if(t)return t;for(var n of F4){var r=n[1];if(e.indexOf(n[0])===0)return r}},zo=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return EC(e)}},Uh=e=>{var t=Be==null?void 0:Be.createElement("a");return $e(t)?null:(t.href=e,t)},Qo=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),o=0;r.length>o;o++){var c=r[o].split("=");if(c[0]===t){n=c;break}}if(!ut(n)||2>n.length)return"";var h=n[1];try{h=decodeURIComponent(h)}catch{Oe.error("Skipping decoding for malformed query param: "+h)}return h.replace(/\+/g," ")},Dc=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),o=r[1],c=(r[0]||"").split("?"),h=c[1],l=c[0],u=(h||"").split("&"),m=[],g=0;u.length>g;g++){var p=u[g].split("=");ut(p)&&(t.includes(p[0])?m.push(p[0]+"="+n):m.push(u[g]))}var S=l;return h!=null&&(S+="?"+m.join("&")),o!=null&&(S+="#"+o),S},Fh=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},RE=(e,t)=>e>=t&&wC(),AE=(e,t,n,r)=>{if(e===0){if(wC()){var o=t+1;return o===n&&r(),o}return t}return 0},Qu="https?://(.*)",el=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],q4=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...el],Oc="<masked>",V4=["li_fat_id"];function TE(e,t,n){if(!Be)return{};var r,o=t?[...el,...n||[]]:[],c=NE(Dc(Be.URL,o,Oc),e),h=(r={},ss(V4,(function(l){var u=fE(l);r[l]=u||null})),r);return rs(h,c)}function NE(e,t){var n=q4.concat(t||[]),r={};return ss(n,(function(o){var c=Qo(e,o);r[o]=c||null})),r}function ME(e){var t=(function(c){return c?c.search(Qu+"google.([^/?]*)")===0?"google":c.search(Qu+"bing.com")===0?"bing":c.search(Qu+"yahoo.com")===0?"yahoo":c.search(Qu+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!En(t)){r.$search_engine=t;var o=Be?Qo(Be.referrer,n):"";o.length&&(r.ph_keyword=o)}return r}function Y1(){return navigator.language||navigator.userLanguage}var qh="$direct";function $E(){return(Be==null?void 0:Be.referrer)||qh}function DE(e,t,n){n===void 0&&(n=!1);var r=e?[...el,...t||[]]:[],o=n?Kr(Ns==null?void 0:Ns.href):Ns==null?void 0:Ns.href,c=o==null?void 0:o.substring(0,1e3);return{r:$E().substring(0,1e3),u:c?Dc(c,r,Oc):void 0}}function OE(e,t){var n;t===void 0&&(t=!1);var r=e.r,o=e.u,c=t?Kr(o):o,h={$referrer:r,$referring_domain:r==null?void 0:r==qh?qh:(n=Uh(r))==null?void 0:n.host};if(c){h.$current_url=c;var l=Uh(c);h.$host=l==null?void 0:l.host,h.$pathname=l==null?void 0:l.pathname;var u=NE(c);rs(h,u)}if(r){var m=ME(r);rs(h,m)}return h}function LE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function G4(){try{return new Date().getTimezoneOffset()}catch{return}}var W4={flags:Mc,surveys:Oh},K4=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ro="main";class Bm{constructor(t,n,r){if(r===void 0&&(r=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=r,this.props={},this.cr=void 0,this.vr=(c=>{var h="";return c.token&&(h=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+h+"_posthog"})(t),this.Je=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Oe.info("Persistence loaded",t.persistence,Te({},this.props)),this.update_config(t,t,n),this.save(),_e){var o=()=>this.flush();bs(_e,"beforeunload",o,{capture:!1}),bs(_e,"pagehide",o,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return cn(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){K4.indexOf(t.persistence.toLowerCase())===-1&&(Oe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(h,l){h===void 0&&(h=[]),l===void 0&&(l=!1);var u=[...k4,...h];return Te({},is,{F(m){try{var g={};try{g=ur.F(m)||{}}catch{}var p,S=JSON.parse(is.q(m)||"{}");if(l){var w={};for(var A in g){var E=g[A];En(E)||E===""||(w[A]=E)}p=rs(S,w)}else p=rs(g,S);return is.A(m,p),p}catch{}return null},A(m,g,p,S,w,A){var E=is.A(m,g,void 0,void 0,A);try{var y={};u.forEach((b=>{g[b]&&(y[b]=g[b])})),Object.keys(y).length&&ur.A(m,y,p,S,w,A)}catch(b){is.P(b)}return E},D(m,g){try{_e==null||_e.localStorage.removeItem(m),ur.D(m,g)}catch(p){is.P(p)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),o=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&is.N()?(n=is,o=!0):c==="localstorage+cookie"&&r.N()?(n=r,o=!0):c==="sessionstorage"&&ln.N()?n=ln:c==="memory"?n=j4:c==="cookie"?n=ur:r.N()?(n=r,o=!0):n=ur,this.ur=o,n}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var n=t??this.Te.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Mc];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return ss(this.props,((n,r)=>{var o=_a(r);if((o==null?void 0:o.exposure)==="derived"){if(o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(n,r===Na?()=>this._r():()=>!1))return;o.transformToEventProperties&&rs(t,o.transformToEventProperties(n))}else if(!o||o.exposure==="event"){if(o!=null&&o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(n,(()=>!1)))return;t[r]=n}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=rs({},t)),this.hr&&this.wr()}}wr(){for(var t of Pm){var n=is.F(this.br(t));if(n&&!Vr(n)){var r=this.kr(t);r.persisted=!0,this.Sr(t)||(r.fingerprint=this.Cr(n,t)),this.Mr(t,n)||rs(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var r;return((r=_a(n))==null?void 0:r.storageGroup)===t}))}Mr(t,n){var r=W4[t];if(!r)return!1;var o=n[r],c=this.props[r];return cn(o)&&cn(c)&&c>o}refreshKey(t){var n;if(!this.yr){var r=this.hr?(n=_a(t))==null?void 0:n.storageGroup:void 0,o=r?is.F(this.br(r)):this.Je.F(this.vr);if(o&&t in o)this.Ir(t,o[t]);else{if(r){var c=this.Je.F(this.vr);if(c&&t in c)return void this.Ir(t,c[t])}this.Tr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?$e(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){$e(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,Ro))}Pr(){var t=this.Fr(),n=t.main,r=t.groups;for(var o of(this.Or(this.Je,this.vr,n,Ro),Pm)){var c,h=r[o];(!Vr(h)||(c=this.lr[o])!=null&&c.persisted)&&this.Or(is,this.br(o),h,o)}}Fr(){var t={},n={flags:{},surveys:{}};return ss(this.props,((r,o)=>{var c,h=(c=_a(o))==null?void 0:c.storageGroup;h?n[h][o]=r:t[o]=r})),{main:t,groups:n}}Cr(t,n){if(n===Ro)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var r={};return ss(t,((o,c)=>{var h;r[c]=(h=_a(c))!=null&&h.volatile?"__volatile__":o})),JSON.stringify(r)}Or(t,n,r,o){var c=this.kr(o);if(o===Ro||c.dirty||$e(c.fingerprint)){var h;try{if((h=this.Cr(r,o))===c.fingerprint)return void(c.dirty=!1)}catch{h=void 0}t.A(n,r,this.Ar,this.$r,this.Lr,this.Te.debug)?(c.dirty=!1,o!==Ro&&(c.persisted=!0),$e(h)||(c.fingerprint=h)):this.Te.debug&&Oe.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if($e(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!r&&this.dr)for(var o of Pm)is.D(this.br(o));r?delete this.lr[Ro]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,r){if(ds(t)){$e(n)&&(n="None"),this.Ar=$e(r)?this.Dr:r;var o=!1;if(ss(t,((c,h)=>{this.props.hasOwnProperty(h)&&this.props[h]!==n||(this.Ir(h,c),o=!0)})),o)return this.save(),!0}return!1}register(t,n){if(ds(t)){this.Ar=$e(n)?this.Dr:n;var r=!1;if(ss(t,((o,c)=>{t.hasOwnProperty(c)&&this.props[c]!==o&&(this.Ir(c,o),r=!0)})),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){var t=Be==null?void 0:Be.URL;if(t!==this.cr){var n=TE(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Vr(Wv(n))||this.register(n),this.cr=t}}update_search_keyword(){var t;this.register((t=Be==null?void 0:Be.referrer)?ME(t):{})}update_referrer_info(){var t;this.register_once({$referrer:$E(),$referring_domain:Be!=null&&Be.referrer&&((t=Uh(Be.referrer))==null?void 0:t.host)||qh},void 0)}set_initial_person_info(){this.props[Zg]||this.props[Qg]||this.register_once({[Lh]:DE(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ss([Qg,Zg],(o=>{var c=this.props[o];c&&ss(c,(function(h,l){t["$initial_"+Tg(l)]=h}))}));var n=this.props[Lh];if(n){var r=(function(o,c){c===void 0&&(c=!1);var h=OE(o,c),l={};return ss(h,(function(u,m){l["$initial_"+Tg(m)]=u})),l})(n,this.Te.disable_capture_url_hashes);rs(t,r)}return t}safe_merge(t){return ss(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){this.Dr=this.Ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var o=t.persistence!==n.persistence||!((u,m)=>{if(u.length!==m.length)return!1;var g=[...u].sort(),p=[...m].sort();return g.every(((S,w)=>S===p[w]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=o?this.pr(t):this.Je,h=this.gr(t);if(o||h!==this.hr){var l=this.props;this.clear(),this.Je=c,this.hr=h,this.props=l,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Lr&&(this.Lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[pc]||{};r[t]=n,this.Ir(pc,r),this.save()}remove_event_timer(t){var n=this.props[pc]||{},r=n[t];return $e(r)||(delete n[t],this.Ir(pc,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var r;this.props[t]=n,(r=_a(t))!=null&&r.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var n,r=(n=_a(t))==null?void 0:n.storageGroup;r&&(this.kr(r).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function ed(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Wn(n.then)&&n.then(void 0,(()=>{}))}}}}var Sn={GZipJS:"gzip-js",Base64:"base64"},ec={Activation:"events",Cancellation:"cancelEvents"},zm={Popover:"popover",API:"api",Widget:"widget"},dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Hm={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},nv={Popover:"popover",Inline:"inline"},Y4={SHOWN:"product tour shown"},X1={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},J1=ps("[RateLimiter]");class X4{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((o=>{J1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4}))}catch(o){return void J1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,o;t===void 0&&(t=!1);var c=this.captureEventsBurstLimit,h=this.captureEventsPerSecond,l=new Date().getTime(),u=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Jg))!==null&&n!==void 0?n:{tokens:c,last:l};u.tokens+=(l-u.last)/1e3*h,u.last=l,u.tokens>c&&(u.tokens=c);var m=1>u.tokens;return m||t||(u.tokens=Math.max(0,u.tokens-1)),!m||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+h+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=m,(o=this.instance.persistence)==null||o.set_property(Jg,u),{isRateLimited:m,remainingTokens:u.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ya=ps("[RemoteConfig]");class IE{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Xe._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,r;(n=Xe.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Xe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return ya.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void ya.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return ya.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((n=>{this.Br(n),this.Hr()}));this.Br(t),this.Hr()}))}catch(t){ya.error("Error loading remote config",t),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Be&&Be.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Hr(){var t;if(!this.zr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.zr=setInterval((()=>{this.refresh()}),n))}}Br(t){t||ya.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(t?{ok:!0,config:t}:{ok:!1})}catch(r){ya.error("Error applying remote config",r)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(r){ya.error("Error loading feature flags",r)}}}var fi=Uint8Array,Ln=Uint16Array,tl=Uint32Array,Jv=new fi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Zv=new fi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Z1=new fi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),PE=function(e,t){for(var n=new Ln(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var o=new tl(n[30]);for(r=1;30>r;++r)for(var c=n[r];n[r+1]>c;++c)o[c]=c-n[r]<<5|r;return[n,o]},BE=PE(Jv,2),iv=BE[1];BE[0][28]=258,iv[258]=28;for(var Q1=PE(Zv,0)[1],zE=new Ln(32768),fs=0;32768>fs;++fs){var Ao=(43690&fs)>>>1|(21845&fs)<<1;zE[fs]=((65280&(Ao=(61680&(Ao=(52428&Ao)>>>2|(13107&Ao)<<2))>>>4|(3855&Ao)<<4))>>>8|(255&Ao)<<8)>>>1}var Cc=function(e,t,n){for(var r=e.length,o=0,c=new Ln(t);r>o;++o)++c[e[o]-1];var h,l=new Ln(t);for(o=0;t>o;++o)l[o]=l[o-1]+c[o-1]<<1;for(h=new Ln(r),o=0;r>o;++o)h[o]=zE[l[e[o]-1]++]>>>15-e[o];return h},Ia=new fi(288);for(fs=0;144>fs;++fs)Ia[fs]=8;for(fs=144;256>fs;++fs)Ia[fs]=9;for(fs=256;280>fs;++fs)Ia[fs]=7;for(fs=280;288>fs;++fs)Ia[fs]=8;var Vh=new fi(32);for(fs=0;32>fs;++fs)Vh[fs]=5;var J4=Cc(Ia,9),Z4=Cc(Vh,5),HE=function(e){return(e/8>>0)+(7&e&&1)},UE=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Ln?Ln:e instanceof tl?tl:fi)(n-t);return r.set(e.subarray(t,n)),r},er=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},tc=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Um=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var o=n.length,c=n.slice();if(!o)return[new fi(0),0];if(o==1){var h=new fi(n[0].s+1);return h[n[0].s]=1,[h,1]}n.sort((function(C,x){return C.f-x.f})),n.push({s:-1,f:25001});var l=n[0],u=n[1],m=0,g=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};g!=o-1;)l=n[n[p].f>n[m].f?m++:p++],u=n[m!=g&&n[p].f>n[m].f?m++:p++],n[g++]={s:-1,f:l.f+u.f,l,r:u};var S=c[0].s;for(r=1;o>r;++r)c[r].s>S&&(S=c[r].s);var w=new Ln(S+1),A=rv(n[g-1],w,0);if(A>t){r=0;var E=0,y=A-t,b=1<<y;for(c.sort((function(C,x){return w[x.s]-w[C.s]||C.f-x.f}));o>r;++r){var v=c[r].s;if(t>=w[v])break;E+=b-(1<<A-w[v]),w[v]=t}for(E>>>=y;E>0;){var _=c[r].s;t>w[_]?E-=1<<t-w[_]++-1:++r}for(;r>=0&&E;--r){var k=c[r].s;w[k]==t&&(--w[k],++E)}A=t}return[new fi(w),A]},rv=function(e,t,n){return e.s==-1?Math.max(rv(e.l,t,n+1),rv(e.r,t,n+1)):t[e.s]=n},eS=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ln(++t),r=0,o=e[0],c=1,h=function(u){n[r++]=u},l=1;t>=l;++l)if(e[l]==o&&l!=t)++c;else{if(!o&&c>2){for(;c>138;c-=138)h(32754);c>2&&(h(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(h(o),--c;c>6;c-=6)h(8304);c>2&&(h(c-3<<5|8208),c=0)}for(;c--;)h(o);c=1,o=e[l]}return[n.subarray(0,r),t]},sc=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},av=function(e,t,n){var r=n.length,o=HE(t+2);e[o]=255&r,e[o+1]=r>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var c=0;r>c;++c)e[o+c+4]=n[c];return 8*(o+4+r)},tS=function(e,t,n,r,o,c,h,l,u,m,g){er(t,g++,n),++o[256];for(var p=Um(o,15),S=p[0],w=p[1],A=Um(c,15),E=A[0],y=A[1],b=eS(S),v=b[0],_=b[1],k=eS(E),C=k[0],x=k[1],T=new Ln(19),R=0;v.length>R;++R)T[31&v[R]]++;for(R=0;C.length>R;++R)T[31&C[R]]++;for(var M=Um(T,7),D=M[0],L=M[1],q=19;q>4&&!D[Z1[q-1]];--q);var F,Y,Q,G,ee=m+5<<3,ne=sc(o,Ia)+sc(c,Vh)+h,z=sc(o,S)+sc(c,E)+h+14+3*q+sc(T,D)+(2*T[16]+3*T[17]+7*T[18]);if(ne>=ee&&z>=ee)return av(t,g,e.subarray(u,u+m));if(er(t,g,1+(ne>z)),g+=2,ne>z){F=Cc(S,w),Y=S,Q=Cc(E,y),G=E;var B=Cc(D,L);for(er(t,g,_-257),er(t,g+5,x-1),er(t,g+10,q-4),g+=14,R=0;q>R;++R)er(t,g+3*R,D[Z1[R]]);g+=3*q;for(var $=[v,C],H=0;2>H;++H){var U=$[H];for(R=0;U.length>R;++R)er(t,g,B[P=31&U[R]]),g+=D[P],P>15&&(er(t,g,U[R]>>>5&127),g+=U[R]>>>12)}}else F=J4,Y=Ia,Q=Z4,G=Vh;for(R=0;l>R;++R)if(r[R]>255){var P;tc(t,g,F[257+(P=r[R]>>>18&31)]),g+=Y[P+257],P>7&&(er(t,g,r[R]>>>23&31),g+=Jv[P]);var W=31&r[R];tc(t,g,Q[W]),g+=G[W],W>3&&(tc(t,g,r[R]>>>5&8191),g+=Zv[W])}else tc(t,g,F[r[R]]),g+=Y[r[R]];return tc(t,g,F[256]),g+Y[256]},Q4=new tl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eM=(function(){for(var e=new tl(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Fm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function tM(e,t){t===void 0&&(t={});var n=(function(){var p=4294967295;return{p(S){for(var w=p,A=0;S.length>A;++A)w=eM[255&w^S[A]]^w>>>8;p=w},d(){return 4294967295^p}}})(),r=e.length;n.p(e);var o,c,h,l,u,m=(l=10+((o=t).filename&&o.filename.length+1||0),u=8,(function(p,S,w,A,E,y){var b=p.length,v=new fi(A+b+5*(1+Math.floor(b/7e3))+E),_=v.subarray(A,v.length-E),k=0;if(!S||8>b)for(var C=0;b>=C;C+=65535){var x=C+65535;b>x?k=av(_,k,p.subarray(C,x)):(_[C]=!0,k=av(_,k,p.subarray(C,b)))}else{for(var T=Q4[S-1],R=T>>>13,M=8191&T,D=(1<<w)-1,L=new Ln(32768),q=new Ln(D+1),F=Math.ceil(w/3),Y=2*F,Q=function(rt){return(p[rt]^p[rt+1]<<F^p[rt+2]<<Y)&D},G=new tl(25e3),ee=new Ln(288),ne=new Ln(32),z=0,B=0,$=(C=0,0),H=0,U=0;b>C;++C){var P=Q(C),W=32767&C,se=q[P];if(L[W]=se,q[P]=W,C>=H){var X=b-C;if((z>7e3||$>24576)&&X>423){k=tS(p,_,0,G,ee,ne,B,$,U,C-U,k),$=z=B=0,U=C;for(var V=0;286>V;++V)ee[V]=0;for(V=0;30>V;++V)ne[V]=0}var ce=2,oe=0,Z=M,te=W-se&32767;if(X>2&&P==Q(C-te))for(var pe=Math.min(R,X)-1,ye=Math.min(32767,C),Ee=Math.min(258,X);ye>=te&&--Z&&W!=se;){if(p[C+ce]==p[C+ce-te]){for(var Ie=0;Ee>Ie&&p[C+Ie]==p[C+Ie-te];++Ie);if(Ie>ce){if(ce=Ie,oe=te,Ie>pe)break;var Pe=Math.min(te,Ie-2),Fe=0;for(V=0;Pe>V;++V){var je=C-te+V+32768&32767,Ue=je-L[je]+32768&32767;Ue>Fe&&(Fe=Ue,se=je)}}}te+=(W=se)-(se=L[W])+32768&32767}if(oe){G[$++]=268435456|iv[ce]<<18|Q1[oe];var Ye=31&iv[ce],jt=31&Q1[oe];B+=Jv[Ye]+Zv[jt],++ee[257+Ye],++ne[jt],H=C+ce,++z}else G[$++]=p[C],++ee[p[C]]}}k=tS(p,_,!0,G,ee,ne,B,$,U,C-U,k)}return UE(v,0,A+HE(k)+E)})(c=e,(h=t).level==null?6:h.level,h.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+h.mem,l,u)),g=m.length;return(function(p,S){var w=S.filename;if(p[0]=31,p[1]=139,p[2]=8,p[8]=2>S.level?4:S.level==9?2:0,p[9]=3,S.mtime!=0&&Fm(p,4,Math.floor(new Date(S.mtime||Date.now())/1e3)),w){p[3]=8;for(var A=0;w.length>=A;++A)p[A+10]=w.charCodeAt(A)}})(m,t),Fm(m,g-8,n.d()),Fm(m,g-4,r),m}var sM=!!jg||!!Iv,FE="text/plain",_h=!1,qE=(e,t)=>{var n=e.split("#"),r=n[1],o=n[0].split("?"),c=o[0],h=o[1];if(!h)return e;var l=h.split("&").filter((u=>u.split("=")[0]!==t)).join("&");return c+(l?"?"+l:"")+(r?"#"+r:"")},cf=function(e,t,n){var r;n===void 0&&(n=!0);var o=e.split("?"),c=o[0],h=o[1],l=Te({},t),u=(r=h==null?void 0:h.split("&").map((g=>{var p,S=g.split("="),w=S[0],A=n&&(p=l[w])!==null&&p!==void 0?p:S[1];return delete l[w],w+"="+A})))!==null&&r!==void 0?r:[],m=(function(g,p){var S,w;p===void 0&&(p="&");var A=[];return ss(g,(function(E,y){$e(E)||$e(y)||y==="undefined"||(S=encodeURIComponent((b=>b instanceof File)(E)?E.name:E.toString()),w=encodeURIComponent(y),A[A.length]=w+"="+S)})),A.join(p)})(l);return m&&u.push(m),u.length>0?c+"?"+u.join("&"):c},qm=e=>{if(e.Vr)return e.Vr;var t=e.data,n=e.compression;if(t){if(n===Sn.GZipJS){var r=tM((function(l,u){var m=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var g=new fi(l.length+(l.length>>>1)),p=0,S=function(y){g[p++]=y},w=0;m>w;++w){if(p+5>g.length){var A=new fi(p+8+(m-w<<1));A.set(g),g=A}var E=l.charCodeAt(w);128>E?S(E):2048>E?(S(192|E>>>6),S(128|63&E)):E>55295&&57344>E?(S(240|(E=65536+(1047552&E)|1023&l.charCodeAt(++w))>>>18),S(128|E>>>12&63),S(128|E>>>6&63),S(128|63&E)):(S(224|E>>>12),S(128|E>>>6&63),S(128|63&E))}return UE(g,0,p)})(zo(t)),{mtime:0});return{contentType:FE,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Sn.Base64){var o=(function(l){return l&&btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,((u,m)=>String.fromCharCode(parseInt(m,16)))))})(zo(t)),c=(l=>"data="+encodeURIComponent(typeof l=="string"?l:zo(l)))(o);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var h=zo(t);return{contentType:"application/json",body:h,estimatedSize:new Blob([h]).size}}},VE=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:cf(e.url,{compression:Sn.Base64}),encodedBody:qm(Te({},e,{compression:Sn.Base64,Vr:void 0}))}:{url:qE(e.url,"compression"),encodedBody:qm(Te({},e,{compression:void 0,Vr:void 0}))};try{t=qm(e)}catch(o){if(w1(e.compression,Qo(e.url,"compression")))return Oe.error("Failed to gzip request body, sending uncompressed payload",o),r();throw o}return t&&w1(e.compression,Qo(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Rg(new Uint8Array(n)):ArrayBuffer.isView(n)&&Rg(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(_h=!0,r()):{url:e.url,encodedBody:t}},GE=e=>{try{return VE(e)}catch(t){return Oe.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},nM=(function(){var e=hs((function*(t){var n=zo(t.data),r=yield(function(c,h,l){return Ag.apply(this,arguments)})(n,qt.DEBUG,{rethrow:!0});if(!r)return t;var o=yield r.arrayBuffer();return Te({},t,{Vr:{contentType:FE,body:o,estimatedSize:o.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),iM=/Failed to fetch|NetworkError|Load failed/i,WE=e=>{var t=GE(e);if(t){var n=t.url,r=t.encodedBody,o=r??{},c=o.contentType,h=o.body,l=o.estimatedSize,u=new Headers;ss(e.headers,(function(A,E){u.append(E,A)})),c&&u.append("Content-Type",c);var m=null,g=!1;if(g1){var p=new g1;m={signal:p.signal,timeout:setTimeout((()=>{var A,E;g=!0,p.abort((A=e.timeout,(E=new Error("PostHog request timed out"+(A?" after "+A+"ms":""))).name="AbortError",E))}),e.timeout)}}var S=A=>{g&&(A==null?void 0:A.name)==="AbortError"||(E=>(E==null?void 0:E.name)==="TypeError"&&iM.test((E==null?void 0:E.message)||""))(A)?Oe.warn(A):Oe.error(A),e.callback==null||e.callback({statusCode:0,error:A})};try{var w;Iv(n,Te({method:(e==null?void 0:e.method)||"GET",headers:u,keepalive:e.method==="POST"&&!e.Wr&&52428.8>(l||0),body:h,signal:(w=m)==null?void 0:w.signal},e.fetchOptions)).then((A=>A.text().then((E=>{var y={statusCode:A.status,text:E};if(A.status===200)try{y.json=JSON.parse(E)}catch(b){Oe.error(b)}e.callback==null||e.callback(y)})))).catch(S).finally((()=>m?clearTimeout(m.timeout):null))}catch(A){m&&clearTimeout(m.timeout),S(A)}}},ov=e=>{try{var t,n=VE(e),r=n.url,o=n.encodedBody,c=o??{},h=c.body,l=c.estimatedSize;if(!h)return;var u=h instanceof Blob?h:new Blob([h],{type:c.contentType});if(xn.sendBeacon(r,u))return;var m=ut(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(ut(m)&&m.length>1&&(l??0)>16384){var g=Math.ceil(m.length/2),p=S=>ut(e.data)?S:Te({},e.data,{batch:S});return ov(Te({},e,{data:p(m.slice(0,g))})),void ov(Te({},e,{data:p(m.slice(g))}))}Oe.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),WE(Te({},e,{Wr:!0}))}catch(S){Oe.warn("Beacon send failed",S)}},sS=(e,t,n,r)=>{var o=r==="query"?t==="POST"?"sent_at":"_":void 0;return cf(n===Sn.GZipJS?qE(e,"compression"):e,Te({},o?{[o]:Date.now().toString()}:{},n===Sn.GZipJS?{}:{compression:n}))},yh=[];Iv&&yh.push({transport:"fetch",method:WE}),jg&&yh.push({transport:"XHR",method(e){var t=GE(e);if(t){var n=new jg,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var o=r??{},c=o.contentType,h=o.body;ss(e.headers,(function(l,u){n.setRequestHeader(u,l)})),c&&n.setRequestHeader("Content-Type",c),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var l={statusCode:n.status,text:n.responseText};if(n.status===200)try{l.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(l)}},n.send(h)}}}),xn!=null&&xn.sendBeacon&&yh.push({transport:"sendBeacon",method:ov});var lv=3e3;class rM{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=Oi((n==null?void 0:n.flush_interval_ms)||lv,250,5e3,Oe.createLogger("flush interval"),lv),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ti():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ei(Te({},r,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var n=this.ti(),r=function(){var c=n[o],h=new Date().getTime();c.data&&ut(c.data)&&ss(c.data,(l=>{l.offset=Math.abs(l.timestamp-h),delete l.timestamp})),t.ei(c)};for(var o in n)r()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(n){Oe.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return ss(this.Gr,(n=>{var r,o=n,c=(o?o.batchKey:null)||o.url;$e(t[c])&&(t[c]=Te({},o,{data:[]})),(r=t[c].data)==null||r.push(o.data)})),this.Gr=[],t}}var aM=["retriesPerformedSoFar"];class oM{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!$e(_e)&&"onLine"in _e.navigator&&(this.ni=_e.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},bs(_e,"online",this.si),bs(_e,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=xC(t,aM);rr(n)&&(r.url=cf(r.url,{retry_count:n})),this._instance._send_request(Te({},r,{callback:o=>{if(o.statusCode!==200&&(400>o.statusCode||o.statusCode>=500)){if((o.statusCode===0?3:10)>(n??0))return void this.Ot(Te({retriesPerformedSoFar:n},r));o.statusCode===0&&Oe.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(o)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(h){var l=3e3*Math.pow(2,h),u=l/2,m=Math.min(18e5,l),g=Math.random()-.5;return Math.ceil(m+g*(m-u))})(n),o=Date.now()+r;this.Gr.push({retryAt:o,requestOptions:t});var c="Enqueued failed request for retry in "+r;navigator.onLine||(c+=" (Browser is offline)"),Oe.warn(c),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),n=[],r=this.Gr.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.Gr=n,r.length>0)for(var o of r)this.retriableRequest(o.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,$e(_e)||(this.si&&(_e.removeEventListener("online",this.si),this.si=void 0),this.ai&&(_e.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(Te({},n,{transport:"sendBeacon"}))}catch(r){Oe.error(r)}}this.Gr=[]}}class lM{constructor(t){this.hi=()=>{var n,r,o,c;this.di||(this.di={});var h=this.scrollElement(),l=this.scrollY(),u=h?Math.max(0,h.scrollHeight-h.clientHeight):0,m=l+((h==null?void 0:h.clientHeight)||0),g=(h==null?void 0:h.scrollHeight)||0;this.di.lastScrollY=Math.ceil(l),this.di.maxScrollY=Math.max(l,(n=this.di.maxScrollY)!==null&&n!==void 0?n:0),this.di.maxScrollHeight=Math.max(u,(r=this.di.maxScrollHeight)!==null&&r!==void 0?r:0),this.di.lastContentY=m,this.di.maxContentY=Math.max(m,(o=this.di.maxContentY)!==null&&o!==void 0?o:0),this.di.maxContentHeight=Math.max(g,(c=this.di.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){bs(_e,"scroll",this.hi,{capture:!0}),bs(_e,"scrollend",this.hi,{capture:!0}),bs(_e,"resize",this.hi)}scrollElement(){if(!this.ci)return _e==null?void 0:_e.document.documentElement;var t=ut(this.ci)?this.ci:[this.ci];for(var n of t){var r=_e==null?void 0:_e.document.querySelector(n);if(r)return r}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var r=this.scrollElement();return r&&r[n]||0}return _e?t==="y"?_e.scrollY||_e.pageYOffset||_e.document.documentElement.scrollTop||0:_e.scrollX||_e.pageXOffset||_e.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var cM=e=>DE(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class nS{constructor(t,n,r,o){this.fi=c=>{var h=this.pi();if(!h||h.sessionId!==c){var l={sessionId:c,props:this.gi(this._instance)};this.mi.register({[Xg]:l})}},this._instance=t,this.yi=n,this.mi=r,this.gi=o||cM,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Xg]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?OE(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return ss(Wv(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Tg(r)]=n})),t}}class Qv{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.bi[t]||[])r(n);for(var o of this.bi["*"]||[])o(t,n)}constructor(){this.bi={}}}var nc=ps("[SessionId]");class iS{on(t,n){return this.wi.on(t,n)}constructor(t,n,r){var o;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Qv,this.Mi=(m,g)=>!(!rr(m)||!rr(g))&&Math.abs(m-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===cr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Ti=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=n||lr,this.Ri=r||lr;var c=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Oi(this.Te.session_idle_timeout_seconds||1800,60,36e3,nc.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+c+"_window_id",this.Fi="ph_"+c+"_primary_window_exists",this.Ai()){var h=ln.F(this.Oi),l=ln.F(this.Fi);h&&!l?this.Ii=h:ln.D(this.Oi),ln.A(this.Fi,!0)}if((o=this.Te.bootstrap)!=null&&o.sessionID)try{var u=(m=>{var g=this.Te.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(m){nc.error("Invalid sessionID in bootstrap",m)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return $e(this.ki)&&(this.ki=[]),this.ki.push(t),this.Ti&&t(this.Ti,this.Ii),()=>{this.ki=this.ki.filter((n=>n!==t))}}Ai(){return this.Te.persistence!=="memory"&&!this.mi.yr&&ln.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&ln.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?ln.F(this.Oi):null}qi(t){var n=this.xi;return!En(n)&&!En(t)&&5e3>Math.abs(t-n)}$i(t,n,r){var o=n!==this._sessionActivityTimestamp,c=!(t!==this.Ti||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ti=t,c&&!o||c&&this.qi(n)||(this.xi=n,this.mi.register({[Bo]:[n,t,r]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return rr(n)&&n>0}Bi(){this.ji()?this.mi.refreshKey(Bo):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!En(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Bi();var n=this.Ui();n[1]===this.Ti&&n[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[Bo]:[this._sessionActivityTimestamp,(t=this.Ti)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=rr(t)?t:0,r=rr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[Bo];return ut(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Hi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&_e&&(_e.removeEventListener(Bh,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&ln.D(this.Fi)},bs(_e,Bh,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===cr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),o=this.Ui(),c=o[1],h=o[2],l=this.zi(),u=this.Ni(),m=rr(h)&&Math.abs(r-h)>864e5,g=!1,p=!1,S=!c,w=c,A=!S&&!t&&this.Mi(r,l);if(A){(A=this.Vi(r))||nc.info("cross-tab refresh kept the session alive",{sessionId:c});var E=this.Ui();c=E[1],h=E[2]}S||A||m?(c=this.Ei(),u=this.Ri(),nc.info("new session ID generated",{sessionId:c,windowId:u,changeReason:{noSessionId:S,activityTimeout:A,sessionPastMaximumLength:m}}),h=r,g=!0):(u||(u=this.Ri(),g=!0),(p=c!==w)&&(nc.info("adopted cross-tab session id",{sessionId:c,windowId:u}),g=!0));var y=rr(l)&&t&&!m?l:r,b=rr(h)?h:new Date().getTime();this.Di(u),this.$i(c,y,b),t||this.Pi();var v={noSessionId:S,activityTimeout:A,sessionPastMaximumLength:m,crossTabAdoption:p};return g&&this.ki.forEach((_=>_(c,u,v))),{sessionId:c,windowId:u,sessionStartTimestamp:b,changeReason:g?v:void 0,lastActivityTimestamp:l}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var t=this.Ti;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var KE=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&C1(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((o=>C1(o==null?void 0:o.brand,t))))return!0}catch{}return!!e.webdriver};function YE(){return(YE=hs((function*(){var e=xn==null?void 0:xn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return ts(n)&&n.length>0?n:void 0}catch(r){return void Oe.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var Gh=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Vm(e,t,n){return zo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var XE={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>Gh(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Gh(n,r))))),icontains:(e,t)=>t.map(td).some((n=>e.map(td).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(td).every((n=>e.map(td).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((o=>r>parseFloat(o)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((o=>r<parseFloat(o)))}))},td=e=>e.toLowerCase();function JE(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],o=t==null?void 0:t[n[0]];if($e(o)||En(o))return!1;var c=[String(o)],h=XE[r.operator];return!!h&&h(r.values,c)}))}var cv="custom",rS="i.posthog.com",uM=/^\/static\//;class dM{constructor(t){this.Zi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+rS,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":cv),this.Zi[this.apiHost]}Gi(t){if(uM.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var r=this.Gi(n);if(r)return""+r+n}if(this.region===cv)return this.apiHost+n;var o=rS+n;switch(t){case"assets":return"https://"+this.region+"-assets."+o;case"api":return"https://"+this.region+"."+o}}}function ZE(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Kt=ps("[Surveys]"),QE="seenSurvey_",e2=e=>{try{var t=(n=>((r,o)=>""+QE+(function(c){return c.current_iteration&&c.current_iteration>0?c.id+"_"+c.current_iteration:c.id})(o))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){Kt.error("Failed to persist survey seen state",n)}},hM=[zm.Popover,zm.Widget,zm.API],fM={ignoreConditions:!1,ignoreDelay:!1,displayType:nv.Popover},pM=ps("[PostHog ExternalIntegrations]"),mM={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class gM{constructor(t){this._instance=t}tr(t,n){var r;(r=Xe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(o=>{if(o)return pM.error("failed to load script",o);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var c,h,l,u=r[0],m=r[1];!m||(c=Xe.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[u]||t.tr(mM[u],(()=>{var g;(g=Xe.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!m&&(h=Xe.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((l=Xe.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[u])==null||l.stop())};for(var r of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;n()}}}class vM{constructor(t,n){this.it=t,this.Qi=n,this.Ji=new Map,this.Ki=!1}add(t){var n=this;return hs((function*(){if(n.Ki)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.Ji.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.Ji.set(t.name,t);try{var r=t.setup(n.Qi);r&&(yield r)}catch(c){var o=n.Ji.get(t.name)===t;o&&n.Ji.delete(t.name),n.it.error('Failed to set up browser extension "'+t.name+'"',c),o&&n.Yi(t)}}))()}dispose(){if(!this.Ki){this.Ki=!0;var t=Array.from(this.Ji.values()).reverse();for(var n of(this.Ji.clear(),t))this.Yi(n)}}Yi(t){try{var n=t.dispose==null?void 0:t.dispose();n&&Wn(n.then)&&n.then(void 0,(r=>{this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class _M{constructor(t){this._instance=t}get(t){var n;return(n=this._instance.persistence)==null?void 0:n.get_property(t)}set(t,n){var r;(r=this._instance.persistence)==null||r.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var aS="extensionsRemoteConfig";class yM{constructor(t){this.Ki=!1,this.instance=t,this.it=Oe.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new _M(t),this.onEvent=n=>ed(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(o){this.it.error("Browser extension event listener failed",o)}}))),this.onRemoteConfig=n=>{if(this.Ki)return ed((()=>{}));var r=c=>{try{n(c)}catch(h){this.it.error("Browser extension remote config listener failed",h)}},o=this.instance.en.on(aS,r);return this.Xi&&r(this.Xi),ed(o)},this.rn=new vM(this.it,this)}get logger(){return this.it}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Nc))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,o,c=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=c==null?void 0:c.sessionId)!==null&&n!==void 0?n:"",windowId:(r=c==null?void 0:c.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(o=c==null?void 0:c.sessionStartTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.rn.add(t)}capture(t,n,r){var o=this;return hs((function*(){r?o.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):o.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return ed(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(aS,t))}sendRequest(t,n){var r=this;return hs((function*(){var o;n===void 0&&(n={});var c=r.instance.requestRouter.endpointFor((o=n.target)!==null&&o!==void 0?o:"api",t),h={method:n.method,url:n.query?cf(c,n.query):c,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(r.instance._send_request(h),{statusCode:202}):new Promise((l=>{h.callback=l,r.instance._send_request(h)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var Ec={},Gm=0,Wh=()=>{},oS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ic="Surveys module not available",lS="sanitize_properties is deprecated. Use before_send instead",t2="Invalid value for property_denylist config: ",bM=["token","distinct_id",lE],Po="posthog",s2=!sM&&(On==null?void 0:On.indexOf("MSIE"))===-1&&(On==null?void 0:On.indexOf("Mozilla"))===-1,Wm=e=>{var t;return Te({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:S4(Be==null?void 0:Be.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Wh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Ns&&ts(Ns==null?void 0:Ns.search)&&Ns.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(_e==null||(t=_e.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){Oe.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ev,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:lv},error_tracking:{},_onCapture:Wh},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:$4,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},SM=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],cS=e=>{var t={};for(var n of SM){var r=n[0],o=n[1];$e(e[r])||(t[o]=e[r])}var c=rs({},t,e),h=e.__preview_external_dependency_versioned_paths;return $e(h)||($e(e.strict_script_versioning)&&(c.strict_script_versioning=!!h),ts(h)&&$e(e.asset_host)&&(c.asset_host=h)),ut(e.property_blacklist)&&($e(e.property_denylist)?c.property_denylist=e.property_blacklist:ut(e.property_denylist)?c.property_denylist=[...e.property_blacklist,...e.property_denylist]:Oe.error(t2+e.property_denylist)),c};class wM{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){Oe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class di{an(t,n){if(t){var r=this.Ji.indexOf(t);r!==-1&&this.Ji.splice(r,1)}return this.Ji.push(n),n.initialize==null||n.initialize(),n}ln(){return this.config.cookieless_mode===cr||this.config.cookieless_mode===Aa&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new wM,this.un=!1,this.version=qt.LIB_VERSION,this.en=new Qv,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Wm(),this.SentryIntegration=H4,this.sentryIntegration=r=>(function(o,c){var h=jE(o,c);return{name:kE,processEvent:l=>h(l)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dn=!1,this.cn=null,this.vn=null,this.fn=null,this.scrollManager=new lM(this),this.pageViewManager=new K1(this),this.rateLimiter=new X4(this),this.requestRouter=new dM(this),this.consent=new R4(this),this.externalIntegrations=new gM(this);var n=(t=di.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,o,c)=>{var h=ts(r)?{[r]:o}:r;this.setPersonProperties(h),c==null||c({})},set_once:(r,o,c)=>{var h=ts(r)?{[r]:o}:r;this.setPersonProperties(void 0,h),c==null||c({})}},this.on("eventCaptured",(r=>Oe.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==Po){var o,c=(o=Ec[r])!==null&&o!==void 0?o:new di;return c._init(t,n,r),Ec[r]=c,Ec[Po][r]=c,c}return this._init(t,n,r)}_init(t,n,r){var o,c;n===void 0&&(n={});var h=ts(t)?t.trim():"";if(!h)return Oe.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Wm(n.defaults),n.debug=this.pn(n.debug),this.gn=n,this.mn=[],n.person_profiles?this.vn=n.person_profiles:n.process_person&&(this.vn=n.process_person);var l=Wm(n.defaults),u=cS(n),m=rs({},l,u,{name:r,token:h});ds(l.rageclick)&&ds(u.rageclick)&&(m.rageclick=rs({},l.rageclick,u.rageclick)),ds(l.session_recording)&&ds(u.session_recording)&&(m.session_recording=rs({},l.session_recording,u.session_recording)),this.set_config(m),this.config.on_xhr_error&&Oe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Sn.GZipJS;var g=this.yn();this.persistence=new Bm(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Bm(Te({},this.config,{persistence:"sessionStorage"}),g,!1);var p=Te({},this.persistence.props),S=Te({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new rM((k=>this._n(k)),this.config.request_queue_config),this.wn=new oM(this),this.__request_queue=[];var w=this.ln();if(w||(this.sessionManager=new iS(this),this.sessionPropsManager=new nS(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Oe.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(w)}),0)):(Oe.info("Initializing extensions synchronously"),this.xn(w)),qt.DEBUG=qt.DEBUG||this.config.debug,qt.DEBUG&&Oe.info("Starting in debug mode",{this:this,config:n,thisC:Te({},this.config),p,s:S}),!this.config.identity_distinct_id||(o=n.bootstrap)!=null&&o.distinctID||(n.bootstrap=Te({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var A=n.bootstrap.distinctID,E=this.get_distinct_id(),y=this.persistence.get_property(ci);if(n.bootstrap.isIdentifiedID&&E!=null&&E!==A&&y===jo)this.identify(A);else if(n.bootstrap.isIdentifiedID&&E!=null&&E!==A&&y===ga)Oe.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(lr()),v=n.bootstrap.isIdentifiedID?b:A;this.persistence.set_property(ci,n.bootstrap.isIdentifiedID?ga:jo),this.register({distinct_id:A,$device_id:v})}}if(w)this.register_once({distinct_id:Yu,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(lr());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(ci,jo)}return bs(_e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(k,C){var x=k.config.segment;if(!x)return C();(function(T,R){var M=T.config.segment;if(!M)return R();var D=q=>{var F=()=>q.anonymousId()||lr();T.config.get_device_id=F,q.id()&&(T.register({distinct_id:q.id(),$device_id:F()}),T.persistence.set_property(ci,ga)),R()},L=M.user();"then"in L&&Wn(L.then)?L.then(D):D(L)})(k,(()=>{x.register((T=>{typeof Promise<"u"&&Promise.resolve||Im.warn("This browser does not have Promise support, and can not use the segment integration");var R=(M,D)=>{if(!D)return M;M.event.userId||M.event.anonymousId===T.get_distinct_id()||(Im.info("No userId set, resetting PostHog"),T.reset()),M.event.userId&&M.event.userId!==T.get_distinct_id()&&(Im.info("UserId set, identifying with PostHog"),T.identify(M.event.userId));var L=T.calculateEventProperties(D,M.event.properties);return M.event.properties=Object.assign({},L,M.event.properties),M};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:M=>R(M,M.event.event),page:M=>R(M,Io),identify:M=>R(M,Dm),screen:M=>R(M,"$screen")}})(k)).then((()=>{C()}))}))})(this,(()=>this.kn())):this.kn(),Wn(this.config._onCapture)&&this.config._onCapture!==Wh&&(Oe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&Oe.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return YE.apply(this,arguments)})().then((k=>{k&&this.register({[Mm]:k})})).catch(Wh),this}xn(t){var n,r,o,c,h,l,u,m,g=performance.now(),p=Te({},di.__defaultExtensionClasses,this.config.__extensionClasses),S=[];p.featureFlags&&this.Ji.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new p.featureFlags(this)),p.exceptions&&this.Ji.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new p.exceptions(this)),p.historyAutocapture&&this.Ji.push(this.historyAutocapture=new p.historyAutocapture(this)),p.tracingHeaders&&this.Ji.push(this.tracingHeaders=new p.tracingHeaders(this)),p.siteApps&&this.Ji.push(this.siteApps=new p.siteApps(this)),p.sessionRecording&&!t&&this.Ji.push(this.sessionRecording=new p.sessionRecording(this)),this.config.disable_scroll_properties||S.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),p.autocapture&&this.Ji.push(this.autocapture=new p.autocapture(this)),p.surveys&&this.Ji.push(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new p.surveys(this)),p.logs&&this.Ji.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new p.logs(this)),p.metrics&&this.Ji.push(this.metrics=(h=this.metrics)!==null&&h!==void 0?h:new p.metrics(this)),p.conversations&&this.Ji.push(this.conversations=(l=this.conversations)!==null&&l!==void 0?l:new p.conversations(this)),p.productTours&&this.Ji.push(this.productTours=new p.productTours(this)),p.heatmaps&&this.Ji.push(this.heatmaps=new p.heatmaps(this)),p.webVitalsAutocapture&&this.Ji.push(this.webVitalsAutocapture=new p.webVitalsAutocapture(this)),p.exceptionObserver&&this.Ji.push(this.exceptionObserver=new p.exceptionObserver(this)),p.deadClicksAutocapture&&this.Ji.push(this.deadClicksAutocapture=new p.deadClicksAutocapture(this,z4)),p.toolbar&&this.Ji.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new p.toolbar(this)),p.experiments&&this.Ji.push(this.experiments=(m=this.experiments)!==null&&m!==void 0?m:new p.experiments(this)),this.Ji.forEach((w=>{w.initialize&&S.push((()=>{w.initialize==null||w.initialize()}))})),S.push((()=>{if(this.Sn){var w=this.Sn;this.Sn=void 0,this.Ji.forEach((A=>A.onRemoteConfig==null?void 0:A.onRemoteConfig(w)))}})),this.Cn(S,g)}Cn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Cn(t,n)}),0);var r=t.shift();if(r)try{r()}catch(c){Oe.error("Error initializing extension:",c)}}var o=Math.round(performance.now()-n);this.register_for_session({[cE]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[uE]:o}),this.config.__preview_deferred_init_extensions&&Oe.info("PostHog extensions initialized ("+o+"ms)")}Br(t){var n;if(!Be||!Be.body)return Oe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Br(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Sn=t),this.tn=t,this.compression=void 0,t.ok){var r,o=t.config;o.supportedCompression&&!this.config.disable_compression&&(this.compression=at(o.supportedCompression,Sn.GZipJS)?Sn.GZipJS:at(o.supportedCompression,Sn.Base64)?Sn.Base64:void 0),(r=o.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=o.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:ev}),(n=this.Mn)==null||n.handleRemoteConfig(t),this.Ji.forEach((c=>c.onRemoteConfig==null?void 0:c.onRemoteConfig(t)))}kn(){try{this.config.loaded(this)}catch(r){Oe.critical("`loaded` function failed",r)}if(this.In(),this.config.internal_or_test_user_hostname&&Ns!=null&&Ns.hostname){var t=Ns.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ln())&&this.Tn()}),1),this.En=new IE(this),this.En.load()}In(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.bn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Xu(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,n,r,o,c;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture($m),(r=this.logs)==null||r.flushLogs("sendBeacon"),(o=this.bn)==null||o.unload(),(c=this.wn)==null||c.unload()):this.Rn()&&this.capture($m,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?s2?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=Te({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,($e(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,o,c,h=Te({},n);h.timeout=h.timeout||6e4;var l,u,m,g,p,S=(r=h.transport)!==null&&r!==void 0?r:"fetch";S==="sendBeacon"&&$e(h.compression)&&h.data&&(h.compression=Sn.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data={api_key:(u=(p=(g=ut(l=h.data)?l:[l])[0])==null||(m=p.properties)==null?void 0:m.token)!==null&&u!==void 0?u:p==null?void 0:p.token,batch:g,sent_at:new Date().toISOString()}:h.timestampMode==="body"&&(h.data=(function(E,y){return y===void 0&&(y=new Date().toISOString()),ut(E)?E.map((b=>Te({},b,{sent_at:y}))):Te({},E,{sent_at:y})})(h.data))),h.url=sS(h.url,h.method,h.compression,h.timestampMode);var w=yh.filter((E=>!h.disableTransport||!E.transport||!h.disableTransport.includes(E.transport))),A=(o=(c=(function(E,y){for(var b=0;E.length>b;b++)if(E[b].transport===S)return E[b]})(w))==null?void 0:c.method)!==null&&o!==void 0?o:w[0].method;if(!A)throw new Error("No available transport method");S!=="sendBeacon"&&h.data&&h.compression===Sn.GZipJS&&x3&&typeof Promise<"u"&&!_h?nM(h).then((E=>{A(E)})).catch((E=>{if(x1(E))return _h=!0,void A(Te({},h,{compression:void 0,url:sS(n.url,n.method,void 0,n.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;var b="name"in y?String(y.name):"";return x1(y)||b===CC})(E)&&(_h=!0),A(h)})):A(h)})(Te({},t,{callback:n=>{var r,o;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(o=this.config).on_request_error)==null||r.call(o,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}_n(t){this.wn?this.wn.retriableRequest(t):this._send_request(t)}_execute_array(t){Gm++;try{var n,r=[],o=[],c=[];Xu(t,(l=>{if(l)if(ut(n=l[0]))c.push(l);else if(Wn(l))try{l.call(this)}catch(u){Oe.error("Error executing queued PostHog call",l,u)}else ut(l)&&n==="alias"?r.push(l):ut(l)&&n.indexOf("capture")!==-1&&Wn(this[n])?c.push(l):o.push(l)}));var h=function(l,u){Xu(l,(function(m){try{if(ut(m[0])){var g=u;ss(m,(function(p){g=g[p[0]].apply(g,p.slice(1))}))}else u[m[0]].apply(u,m.slice(1))}catch(p){Oe.error("Error executing queued PostHog call",m,p)}}))};h(r,this),h(o,this),h(c,this)}finally{Gm--}}push(t){if(Gm>0&&ut(t)&&ts(t[0])){var n=di.prototype[t[0]];Wn(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var o,c,h,l,u,m,g;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!$e(t)&&ts(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var S=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(S==null||!S.isRateLimited){if(this.hn.length>0){var w={};for(var A of this.hn.slice())try{rs(w,A())}catch(B){Oe.error("Failed to produce browser extension event properties",B)}n=Te({},w,n??{})}var E;(o=n)!=null&&o.$current_url&&!ts((c=n)==null?void 0:c.$current_url)&&(Oe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(E=n)==null||delete E.$current_url),t!=="$exception"||r!=null&&r.Pn||Oe.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var y=new Date,b=(r==null?void 0:r.timestamp)||y,v=R1(r==null?void 0:r.uuid,lr),_={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},b,v)};t===Io&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),S&&(_.properties.$lib_rate_limit_remaining_tokens=S.remainingTokens);var k=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(Dh)===!0;r!=null&&r.$set&&!k&&(_.$set=r==null?void 0:r.$set);var C=r==null?void 0:r.$unset;C&&(_.$unset=C);var x,T,R,M=k?void 0:this.On(r==null?void 0:r.$set_once,t!==$1,t===Dm);if(M&&(_.$set_once=M),r!=null&&r._noTruncate||(l=this.config.properties_string_max_length,u=_,m=B=>ts(B)?B.slice(0,l):B,g=new Set,_=(function B($,H){if($!==Object($))return m?m($):$;if(!g.has($)){var U;if(g.add($),ut($))U=[],Xu($,(W=>{U.push(B(W))}));else{var P={};ss($,((W,se)=>{g.has(W)||(P[se]=B(W))})),U=P}return U}})(u)),_.timestamp=b,$e(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=y),k&&(_.properties=(function(B,$){$===void 0&&($=[]);var H={},U=P=>{B[P]!==void 0&&(H[P]=B[P])};return C3.forEach(U),$.forEach(U),H})(_.properties,bM)),t===dr.DISMISSED||t===dr.SENT){var D,L,q=(D=n)==null?void 0:D[Hm.SURVEY_ID],F=(L=n)==null?void 0:L[Hm.SURVEY_ITERATION];e2({id:q,current_iteration:F}),_.$set=Te({},_.$set,{[(x={id:q,current_iteration:F},T=t===dr.SENT?"responded":"dismissed",R="$survey_"+T+"/"+x.id,x.current_iteration&&x.current_iteration>0&&(R="$survey_"+T+"/"+x.id+"/"+x.current_iteration),R)]:!0})}else t===dr.SHOWN&&(_.$set=Te({},_.$set,{[Hm.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===Y4.SHOWN){var Y,Q=(Y=n)==null?void 0:Y[X1.TOUR_TYPE];Q&&(_.$set=Te({},_.$set,{[X1.TOUR_LAST_SEEN_DATE+"/"+Q]:new Date().toISOString()}))}var G=Te({},_.properties.$set,_.$set);if(Vr(G)||this.setPersonPropertiesForFlags(G),!ft(this.config.before_send)){var ee=this.Rt(_);if(!ee)return;(_=ee).uuid=R1(_.uuid,lr)}this.en.emit("eventCaptured",_);var ne=(h=r==null?void 0:r._url)!==null&&h!==void 0?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),z={method:"POST",url:ne,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(ne)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._n(z):this.bn.enqueue(z),_}Oe.critical("This capture call is ignored due to client rate limiting.")}}else Oe.error("No event name provided to posthog.capture")}else Oe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}Fn(){var t;return(t=this.Mn)!==null&&t!==void 0?t:this.Mn=new yM(this)}nn(t){this.hn.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.hn.indexOf(t);r!==-1&&this.hn.splice(r,1)}}}calculateEventProperties(t,n,r,o,c){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var h=c?void 0:this.persistence.remove_event_timer(t),l=Te({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.ln()&&(l[lE]=!0),t==="$snapshot"){var u=Te({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!ts(l.distinct_id)&&!cn(l.distinct_id)||Ng(l.distinct_id))&&Oe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var m,g=(function(_,k,C,x){var T,R,M,D;if(x===void 0&&(x=!1),!On)return{};var L,q=_?[...el,...k||[]]:[],F=(function(pe){for(var ye=0;k1.length>ye;ye++){var Ee=k1[ye],Ie=Ee[1],Pe=Ee[0].exec(pe),Fe=Pe&&(Wn(Ie)?Ie(Pe,pe):Ie);if(Fe)return Fe}return["",""]})(On),Y=F[0],Q=F[1],G=(L=typeof navigator<"u"?navigator:void 0)!=null&&L.brave?{brave:!0}:{},ee={};$e(C)||(ee.detectGoogleSearchApp=C);var ne={},z=(T=navigator)==null||(T=T.userAgentData)==null?void 0:T.platform,B=(R=navigator)==null?void 0:R.maxTouchPoints,$=_e==null||(M=_e.screen)==null?void 0:M.width,H=_e==null||(D=_e.screen)==null?void 0:D.height,U=_e==null?void 0:_e.devicePixelRatio;$e(z)||(ne.userAgentDataPlatform=z),$e(B)||(ne.maxTouchPoints=B),$e($)||(ne.screenWidth=$),$e(H)||(ne.screenHeight=H),$e(U)||(ne.devicePixelRatio=U);var P,W,se,X,V,ce,oe,Z,te=rs(Wv({$os:Y,$os_version:Q,$browser:KC(On,navigator.vendor,G,ee),$device:j1(On),$device_type:(W=On,se=ne,Z=j1(W),Z===TC||Z===AC||Z==="Kobo"||Z==="Kindle Fire"||Z===FC?Xo:Z===Ac||Z===Vo||Z===Tc||Z===$g?"Console":Z===MC?"Wearable":Z?Xn:(se==null?void 0:se.userAgentDataPlatform)==="Android"&&((X=se==null?void 0:se.maxTouchPoints)!==null&&X!==void 0?X:0)>0?600>Math.min((V=se==null?void 0:se.screenWidth)!==null&&V!==void 0?V:0,(ce=se==null?void 0:se.screenHeight)!==null&&ce!==void 0?ce:0)/((oe=se==null?void 0:se.devicePixelRatio)!==null&&oe!==void 0?oe:1)?Xn:Xo:"Desktop"),$timezone:LE(),$timezone_offset:G4()}),{$current_url:Dc(x?Kr(Ns==null?void 0:Ns.href):Ns==null?void 0:Ns.href,q,Oc),$host:Ns==null?void 0:Ns.host,$pathname:Ns==null?void 0:Ns.pathname,$raw_user_agent:On.length>1e3?On.substring(0,997)+"...":On,$browser_version:F3(On,navigator.vendor,G,ee),$browser_language:Y1(),$browser_language_prefix:(P=Y1(),typeof P=="string"?P.split("-")[0]:void 0),$screen_height:_e==null?void 0:_e.screen.height,$screen_width:_e==null?void 0:_e.screen.width,$viewport_height:_e==null?void 0:_e.innerHeight,$viewport_width:_e==null?void 0:_e.innerWidth,$lib:qt.LIB_NAME,$lib_version:qt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return qt.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=qt.SDK_DIST_CHANNEL),te})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var p=this.sessionManager.checkAndGetSessionAndWindowId(c,r.getTime()),S=p.windowId;l.$session_id=p.sessionId,l.$window_id=S}this.sessionPropsManager&&rs(l,this.sessionPropsManager.getSessionProps());try{var w;this.sessionRecording&&rs(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(w=this.wn)==null?void 0:w.length}catch(_){l.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===cv&&(l.$lib_custom_api_host=this.config.api_host),m=t!==Io||c?t!==$m||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),l=rs(l,m),t===Io&&Be&&(l.title=Be.title),!$e(h)){var A=r.getTime()-h;l.$duration=parseFloat((A/1e3).toFixed(3))}On&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var E=this.persistence.properties(),y=this.sessionPersistence.properties();ss(["$referrer","$referring_domain"],(_=>{_ in E&&delete y[_]})),(l=rs({},g,E,y,l)).$is_identified=this._isIdentified(),ut(this.config.property_denylist)?ss(this.config.property_denylist,(function(_){delete l[_]})):Oe.error(t2+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Oe.error(lS),l=b(l,t));var v=this.An();return l.$process_person_profile=v,v&&!c&&this.$n("_calculate_event_properties"),l}On(t,n,r){var o;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.An()||this.un&&!r)return t;var c=this.persistence.get_initial_props(),h=(o=this.sessionPropsManager)==null?void 0:o.getSetOnceProps(),l=rs({},c,h||{},t||{}),u=this.config.sanitize_properties;return u&&(Oe.error(lS),l=u(l,"$set_once")),n&&(this.un=!0),Vr(l)?void 0:l}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var o;(o=this.persistence)==null||o.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ln(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,o;return(r=(o=this.featureFlags)==null?void 0:o.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var o;(o=this.featureFlags)==null||o.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var o;(o=this.featureFlags)==null||o.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var o;return n===void 0&&(n=!1),(o=this.featureFlags)==null?void 0:o.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.en.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ic}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:ic})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:ic})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=fM),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:ic}}canRenderSurveyAsync(t,n){var r,o;return n===void 0&&(n=!1),(r=(o=this.surveys)==null?void 0:o.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:ic})}Dn(t){return!t||Ng(t)?(Oe.critical("Unique user id has not been set in posthog.identify"),!1):t===Yu?(Oe.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Oe.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return Oe.uninitializedWarning("posthog.identify");if(cn(t)&&(t=t.toString(),Oe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Dn(t)&&this.$n("posthog.identify")){var o=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Nc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:o},""),t!==o&&t!==this.get_property(fc)&&(this.unregister(fc),this.register({distinct_id:t}));var c,h=(this.persistence.get_property(ci)||jo)===jo,l=t!==o,u=!l&&h;if(l&&h)this.persistence.set_property(ci,ga),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(Dm,{distinct_id:t,$anon_distinct_id:o},{$set:n||{},$set_once:r||{}}),this.fn=Vm(t,n,r),(c=this.featureFlags)==null||c.setAnonymousDistinctId(o);else if(u){this.persistence.set_property(ci,ga);var m=n||{},g=r||{};this.setPersonPropertiesForFlags({$set:m,$set_once:g},!1),this.capture("$set",{$set:m,$set_once:g}),this.fn=Vm(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);l?(this.reloadFeatureFlags(),this.unregister(wc)):u&&(n||r)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.$n("posthog.setPersonProperties")){var r=Vm(this.get_distinct_id(),t,n);this.fn!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.fn=r):Oe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(ut(t)?t:[t]).filter((o=>ts(o)&&o.length>0));r.length!==0&&this.$n("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.fn=null)}group(t,n,r){if(t&&n){var o=this.getGroups(),c=o[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Te({},o,{[t]:n})}),c||r){var h={$group_type:t,$group_key:n};r&&(h.$group_set=r),this.capture($1,h)}r&&this.setGroupPropertiesForFlags({[t]:r}),c&&!r&&this.reloadFeatureFlags()}else Oe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,r,o,c,h,l,u,m,g,p;if(Oe.info("reset"),!this.__loaded)return Oe.uninitializedWarning("posthog.reset");var S,w=this.get_property(Nc),A=this.get_property(Mm),E=this.get_property($a);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),$e(E)||(S=this.persistence)==null||S.register({[$a]:E}),(o=this.surveys)==null||o.reset(),(c=this.En)==null||c.stop(),(h=this.featureFlags)==null||h.reset(),(l=this.conversations)==null||l.reset(),(u=this.logs)==null||u.reset(),(m=this.metrics)==null||m.reset(),(g=this.persistence)==null||g.set_property(ci,jo),(p=this.sessionManager)==null||p.resetSessionId(),this.fn=null,this.config.cookieless_mode===cr)this.register_once({distinct_id:Yu,$device_id:null},"");else{var y=this.config.get_device_id(lr());this.register_once({distinct_id:y,$device_id:t?y:w},""),t||$e(A)||this.register({[Mm]:A})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var n=this;return hs((function*(){var r,o,c,h,l,u,m;n.__loaded?((r=n.En)==null||r.stop(),(o=n.Mn)==null||o.dispose(),(c=n.logs)==null||c.flushLogs("sendBeacon"),(h=n.metrics)==null||h.flush("sendBeacon"),(l=n.bn)==null||l.unload(),(u=n.wn)==null||u.unload(),(m=n.featureFlags)==null||m.destroy()):Oe.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Nn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.qn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,o=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var c,h=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!r)return o;o+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-h,0)}return o}alias(t,n){return t===this.get_property(sE)?(Oe.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?($e(n)&&(n=this.get_distinct_id()),t!==n?(this.Ln(fc,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Oe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Te({},this.config);if(ds(t)){var r,o,c,h,l,u,m,g,p,S,w;rs(this.config,cS(t));var A=this.yn();(r=this.persistence)==null||r.update_config(this.config,n,A),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Bm(Te({},this.config,{persistence:"sessionStorage"}),A,!1);var E=this.pn(this.config.debug);xi(E)&&(this.config.debug=E),xi(this.config.debug)&&(this.config.debug?(qt.DEBUG=!0,is.N()&&is.A("ph_debug",!0),Oe.info("set_config",{config:t,oldConfig:n,newConfig:Te({},this.config)})):(qt.DEBUG=!1,is.N()&&is.D("ph_debug"))),(o=this.exceptionObserver)==null||o.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(h=this.sessionRecording)==null||h.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(S=this.surveys)==null||S.loadIfEnabled(),this.jn(),(w=this.externalIntegrations)==null||w.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){qt.LIB_NAME=t,qt.LIB_VERSION=n}startSessionRecording(t){var n,r,o,c,h,l=t===!0,u={sampling:l||!(t==null||!t.sampling),linked_flag:l||!(t==null||!t.linked_flag),url_trigger:l||!(t==null||!t.url_trigger),event_trigger:l||!(t==null||!t.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),u.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),u.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),u.event_trigger&&((h=this.sessionRecording)==null||h.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),o=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Te({},o,n))}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:di.Bn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Po;return n!==Po&&(n=Po+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(ci))===ga||((n=this.sessionPersistence)==null?void 0:n.get_property(ci))===ga}An(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===ev&&!this._isIdentified()&&Vr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[fc])&&((n=this.persistence)==null||(n=n.props)==null||!n[Ih]))}Rn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.An()||this.$n("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.$n("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}$n(t){return this.config.person_profiles==="never"?(Oe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(Ih,!0),!0)}yn(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Aa)}jn(){var t,n,r,o,c=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==c&&((r=this.persistence)==null||r.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.yr)!==c&&((o=this.sessionPersistence)==null||o.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==cr){if(this.ln()){var r,o,c,h,l;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new iS(this),this.pageViewManager=new K1(this),this.persistence&&(this.sessionPropsManager=new nS(this,this.sessionManager,this.persistence));var u,m=(c=(h=this.config.__extensionClasses)==null?void 0:h.sessionRecording)!==null&&c!==void 0?c:(l=di.__defaultExtensionClasses)==null?void 0:l.sessionRecording;m&&(this.sessionRecording=this.an(this.sessionRecording,new m(this)),this.tn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.tn)))}var g,p;this.consent.optInOut(!0),this.jn(),this.In(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Aa&&((g=this.surveys)==null||g.loadIfEnabled()),($e(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((p=t==null?void 0:t.captureEventName)!==null&&p!==void 0?p:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Tn()}else Oe.warn(oS)}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!==cr?(this.config.cookieless_mode===Aa&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===Aa&&(this.register({distinct_id:Yu,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):Oe.warn(oS)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===cr||(this.config.cookieless_mode===Aa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return xn?KE(xn,this.config.custom_blocked_useragents):void 0}Tn(){Be&&(Be.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(Io,{title:Be.title},{send_instantly:!0}),this.cn&&(Be.removeEventListener(Ph,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),bs(Be,Ph,this.cn)))}debug(t){t===!1?(_e==null||_e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(_e==null||_e.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Ur(){var t=this.gn||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Oe.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,r,o,c,h){var l=r in n&&!ft(n[r]),u=o in n&&!ft(n[o]);return l?n[r]:!!u&&(h&&h.warn("Config field '"+o+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[o])})(t,"advanced_disable_flags","advanced_disable_decide",0,Oe)}Rt(t){var n;if(ft(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(N3),o=ut(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var h of o){if(c=h(c),ft(c)){var l="Event '"+t.event+"' was rejected in beforeSend function";return T3(t.event)?Oe.warn(l+". This can cause unexpected behavior."):Oe.info(l),null}c.properties&&!Vr(c.properties)||Oe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of r)if(c.properties&&ft(c.properties[u]))return Oe.warn("Event '"+t.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.ir)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}pn(t){var n=xi(t)&&!t,r=is.N()&&is.q("ph_debug")==="true";return!n&&(!!r||t)}}di.__defaultExtensionClasses={},di.Bn=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=y4(e.prototype[t[n]])})(di,["identify"]);class uS{constructor(t){this.disabled=t===!1;var n=ds(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(n-o.y)<this.thresholdPx&&this.timeoutMs>r-o.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Km="$copy_autocapture",Ym=ps("[AutoCapture]");function Xm(e,t){return t.length>e?t.slice(0,e)+"...":t}function xM(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Yr(t));return t}function CM(e,t){var n,r,o=t.e,c=t.maskAllElementAttributes,h=t.maskAllText,l=t.elementAttributeIgnoreList,u=t.elementsChainAsString,m=t.disableCaptureUrlHashes;if(!Yr(e))return{props:{}};for(var g=[e],p=new Set([e]),S=e;S.parentNode&&!Kn(S,"body")&&yE>g.length;)if(_E(S.parentNode)){var w=S.parentNode.host;if(p.has(w))break;p.add(w),g.push(w),S=w}else{if(!Yr(S.parentNode)||p.has(S.parentNode))break;p.add(S.parentNode),g.push(S.parentNode),S=S.parentNode}var A,E,y=[],b={},v=!1,_=!1;if(ss(g,(R=>{var M=sv(R);if(Kn(R,"a")){var D=R.getAttribute("href");v=!!(M&&D&&xc(D))&&(m?Kr(D):D)}at(Hh(R),"ph-no-capture")&&(_=!0),y.push((function(q,F,Y,Q,G){G===void 0&&(G=!1);var ee=q.tagName.toLowerCase(),ne={tag_name:ee};Yv.indexOf(ee)>-1&&!Y&&(ne.$el_text=ee.toLowerCase()==="a"||ee.toLowerCase()==="button"?Xm(1024,V1(q)):Xm(1024,$c(q)));var z=Hh(q);z.length>0&&(ne.classes=z.filter((function(U){return U!==""}))),ss(q.attributes,(function(U){var P;if((!CE(q)||["name","id","class","aria-label"].indexOf(U.name)!==-1)&&(Q==null||!Q.includes(U.name))&&!F&&xc(U.value)&&(!ts(P=U.name)||P.substring(0,10)!=="_ngcontent"&&P.substring(0,7)!=="_nghost")){var W=U.value;U.name==="class"&&(W=Kv(W).join(" ")),ne["attr__"+U.name]=Xm(1024,U.name==="href"&&G?Kr(W):W)}}));for(var B=1,$=1,H=q;H=xM(H);)B++,H.tagName===q.tagName&&$++;return ne.nth_child=B,ne.nth_of_type=$,ne})(R,c,h,l,m));var L=(function(q){if(!sv(q))return{};var F={};return ss(q.attributes,(function(Y){if(Y.name&&Y.name.indexOf("data-ph-capture-attribute")===0){var Q=Y.name.replace("data-ph-capture-attribute-",""),G=Y.value;Q&&G&&xc(G)&&(F[Q]=G)}})),F})(R);rs(b,L)})),_)return{props:{},explicitNoCapture:_};if(h||(y[0].$el_text=Kn(e,"a")||Kn(e,"button")?V1(e):$c(e)),v){var k,C;y[0].attr__href=v;var x=(k=Uh(v))==null?void 0:k.host,T=_e==null||(C=_e.location)==null?void 0:C.host;x&&T&&x!==T&&(A=v)}return{props:rs({$event_type:o.type,$ce_version:1},u?{}:{$elements:y},{$elements_chain:(E=y,(function(R){return R.map((M=>{var D,L,q="";if(M.tag_name&&(q+=M.tag_name),M.attr_class)for(var F of(M.attr_class.sort(),M.attr_class))q+="."+F.replace(/"/g,"");var Y=Te({},M.text?{text:M.text}:{},{"nth-child":(D=M.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(L=M.nth_of_type)!==null&&L!==void 0?L:0},M.href?{href:M.href}:{},M.attr_id?{attr_id:M.attr_id}:{},M.attributes),Q={};return vh(Y).sort(((G,ee)=>G[0].localeCompare(ee[0]))).forEach((G=>{var ee=G[1];return Q[G1(G[0].toString())]=G1(ee.toString())})),(q+=":")+vh(Q).map((G=>G[0]+'="'+G[1]+'"')).join("")})).join(";")})((function(R){return R.map((M=>{var D,L,q={text:(D=M.$el_text)==null?void 0:D.slice(0,400),tag_name:M.tag_name,href:(L=M.attr__href)==null?void 0:L.slice(0,2048),attr_class:P4(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return vh(M).filter((F=>F[0].indexOf("attr__")===0)).forEach((F=>q.attributes[F[0]]=F[1])),q}))})(E)))},(n=y[0])!=null&&n.$el_text?{$el_text:(r=y[0])==null?void 0:r.$el_text}:{},A&&o.type==="click"?{$external_click_url:A}:{},b)}}var rc=ps("[ExceptionAutocapture]"),dS=()=>{},EM=ps("[TracingHeaders]"),ba=ps("[Web Vitals]"),hS=9e5,fS="disabled",pS="lazy_loading",ac="awaiting_config",sd="missing_config";ps("[SessionRecording]"),ps("[SessionRecording]");var uv="[SessionRecording]",tr=ps(uv),kM=ps("[Heatmaps]");function Jm(e){return ds(e)&&"clientX"in e&&"clientY"in e&&cn(e.clientX)&&cn(e.clientY)}var Zm=ps("[Product Tours]"),Qm=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(qv))},jM=["$set_once","$set"],$i=ps("[SiteApps]"),mS="Error while initializing PostHog app with config id ";function To(e,t,n){if(ft(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class RM{constructor(t){this.Hn=new Qv,this.Un=(n,r)=>this.zn(n,r)&&this.Vn(n,r)&&this.Wn(n,r)&&this.Zn(n,r),this.zn=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,n;$e((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,o)=>{this.on(r,o)}))}register(t){var n,r;if(!$e((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((h=>{var l,u;(l=this.Qn)==null||l.add(h),(u=h.steps)==null||u.forEach((m=>{var g;(g=this.Gn)==null||g.add((m==null?void 0:m.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var o,c=new Set;t.forEach((h=>{var l;(l=h.steps)==null||l.forEach((u=>{u!=null&&u.selector&&c.add(u==null?void 0:u.selector)}))})),(o=this._instance)==null||o.autocapture.setElementSelectors(c)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(n.event))&&this.Qn&&((r=this.Qn)==null?void 0:r.size)>0&&this.Qn.forEach((o=>{this.Jn(n,o)&&this.Hn.emit("actionCaptured",o.name)}))}Kn(t){this.onAction("actionCaptured",(n=>t(n)))}Jn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Un(t,r))return!0;return!1}onAction(t,n){return this.Hn.on(t,n)}Vn(t,n){if(n!=null&&n.url){var r,o=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!o||typeof o!="string"||!To(o,n.url,n.url_matching||"contains"))return!1}return!0}Wn(t,n){return!!this.Yn(t,n)&&!!this.Xn(t,n)&&!!this.ts(t,n)}Yn(t,n){var r;if(n==null||!n.href)return!0;var o=this.es(t);if(o.length>0)return o.some((l=>To(l.href,n.href,n.href_matching||"exact")));var c,h=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!h&&To((c=h.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}Xn(t,n){var r;if(n==null||!n.text)return!0;var o=this.es(t);if(o.length>0)return o.some((m=>To(m.text,n.text,n.text_matching||"exact")||To(m.$el_text,n.text,n.text_matching||"exact")));var c,h,l,u=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!u&&(c=(function(m){for(var g,p=[],S=/(?::|")text="(.*?)"/g;!ft(g=S.exec(m));)p.includes(g[1])||p.push(g[1]);return p})(u),h=n.text,l=n.text_matching||"exact",c.some((m=>To(m,h,l))))}ts(t,n){var r,o;if(n==null||!n.selector)return!0;var c=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var h=(t==null||(o=t.properties)==null?void 0:o.$elements_chain)||"";if(n.selector_regex&&h)try{return new RegExp(n.selector_regex).test(h)}catch{return!1}return!1}es(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Zn(t,n){return n==null||!n.properties||n.properties.length===0||JE(n.properties.reduce(((r,o)=>{var c=ut(o.value)?o.value.map(String):o.value!=null?[String(o.value)]:[];return r[o.key]={values:c,operator:o.operator||"exact"},r}),{}),t==null?void 0:t.properties)}}class AM{constructor(t){var n;this.rs=[],this._instance=t,this.ns=new Map,this.ss=new Map,this.os=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((r=>this.ls(r)))}us(t,n){return!!t&&JE(t.propertyFilters,n==null?void 0:n.properties)}hs(t,n){var r=new Map;return t.forEach((o=>{var c;(c=o.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((h=>{if(h!=null&&h.name){var l=r.get(h.name)||[];l.push(o.id),r.set(h.name,l)}}))})),r}ds(t,n,r){var o=(r===ec.Activation?this.ns:this.ss).get(t),c=[];return this.cs((h=>{c=h.filter((l=>o==null?void 0:o.includes(l.id)))})),c.filter((h=>{var l,u=(l=h.conditions)==null||(l=l[r])==null||(l=l.values)==null?void 0:l.find((m=>m.name===t));return this.us(u,n)}))}register(t){var n;$e((n=this._instance)==null?void 0:n._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var n=t.filter((r=>{var o,c;return((o=r.conditions)==null?void 0:o.actions)&&((c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.ps==null&&(this.ps=new RM(this._instance),this.ps.init(),this.ps.Kn((r=>{this.onAction(r)}))),n.forEach((r=>{var o,c,h,l,u;r.conditions&&(o=r.conditions)!=null&&o.actions&&(c=r.conditions)!=null&&(c=c.actions)!=null&&c.values&&((h=r.conditions)==null||(h=h.actions)==null||(h=h.values)==null?void 0:h.length)>0&&((l=this.ps)==null||l.register(r.conditions.actions.values),(u=r.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((m=>{if(m&&m.name){var g=this.os.get(m.name);g&&g.push(r.id),this.os.set(m.name,g||[r.id])}})))})))}vs(t){var n,r=t.filter((c=>{var h,l;return((h=c.conditions)==null?void 0:h.events)&&((l=c.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0})),o=t.filter((c=>{var h,l;return((h=c.conditions)==null?void 0:h.cancelEvents)&&((l=c.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0}));r.length===0&&o.length===0||((n=this._instance)==null||n._addCaptureHook(((c,h)=>{this.onEvent(c,h)})),this.ns=this.hs(t,ec.Activation),this.ss=this.hs(t,ec.Cancellation))}onEvent(t,n){var r,o,c=this.gs(),h=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(o=n.properties)==null?void 0:o.$product_tour_id);if(h&&this.getActivatedIds().includes(h)){var l=this.ys(t,h);if(l==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:h}),void this.bs([h]);if(l==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:h}),void this._s(h)}if(this.ss.has(t)){var u=this.ds(t,n,ec.Cancellation);u.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:u.map((g=>g.id))}),this.bs(u.map((g=>g.id))),u.forEach((g=>this.ws(g.id))))}if(this.ns.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this.ns.get(t)});var m=this.ds(t,n,ec.Activation);this.xs(m.map((g=>g.id)))}}onAction(t){this.os.has(t)&&this.xs(this.os.get(t)||[])}xs(t){t.length!==0&&(this.rs=[...new Set([...this.rs,...t])],this.gs().info("updating activated items",{activatedItems:this.getActivatedIds()}))}_s(t){this.rs=this.rs.filter((r=>r!==t));var n=this.ks();n.includes(t)||(this.Ss([...n,t]),this.Cs())}bs(t){var n=new Set(t);this.rs=this.rs.filter((c=>!n.has(c)));var r=this.Ms(),o=r.filter((c=>!n.has(c)));o.length!==r.length&&(this.Ss(o),o.length===0&&this.Is())}Ms(){var t,n=this.Ts();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}ks(){var t,n,r=this.Ms();if(r.length===0)return[];var o=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Es()],c=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return c&&o===c?r:[]}Cs(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Rs(n)}Is(){this.Ps()}ls(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Es()];r&&r!==t&&(this.Ms().length>0&&this.Ss([]),this.Is())}getActivatedIds(){return[...new Set([...this.ks(),...this.rs])].filter((t=>!this.Os(t)))}reset(){this.rs=[],this.Ms().length>0&&this.Ss([]),this.Is()}getEventToItemsMap(){return this.ns}Fs(){return this.ps}}class TM extends AM{constructor(t){super(t)}Ts(){return Wg}Es(){return gh}As(){return dr.SHOWN}cs(t){var n;(n=this._instance)==null||n.getSurveys(t)}ws(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}gs(){return Kt}Ss(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Wg]:t})}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[gh]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(gh)}Os(){return!1}ys(t,n){var r;this.cs((c=>{r=c.find((h=>h.id===n))}));var o=!r||(function(c){var h;return ZE(c)&&!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation)||c.schedule==="always"})(r);return o?t===dr.SHOWN?"consume":"ignore":t===dr.SHOWN?"persist":t===dr.DISMISSED||t===dr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var nd="SDK is not enabled or survey functionality is not yet loaded",gS="Disabled. Not loading surveys.",NM=_e!=null&&_e.location?Fh(_e.location.hash,"__posthog")||Fh(location.hash,"state"):null,vS="_postHogToolbarParams",_S=ps("[Toolbar]"),Bs=ps("[FeatureFlags]"),Sa=ps("[FeatureFlags]",{debugEnabled:!0}),eg=`" failed. Feature flags didn't load in time.`,yS=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},bS=e=>{var t={};for(var n of vh(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},Di=ps("[Error tracking]"),SS="Refusing to render web experiment since the viewer is a likely bot",MM={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Gh(t,e),not_regex:(e,t)=>!Gh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class pn{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((o=>{pn.$s("retrieved web experiments from the server"),n.Ls=new Map,o.forEach((c=>{if(c.feature_flag_key){var h;n.Ls&&(pn.$s("setting flag key ",c.feature_flag_key," to web experiment ",c),(h=n.Ls)==null||h.set(c.feature_flag_key,c));var l=n._instance.getFeatureFlag(c.feature_flag_key);ts(l)&&c.variants[l]&&n.Ds(c.name,l,c.variants[l].transforms)}else if(c.variants)for(var u in c.variants){var m=c.variants[u];pn.Ns(m,n._instance)&&n.Ds(c.name,u,m.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())pn.$s(SS);else if(!this.Te.disable_web_experiments){if(ft(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();pn.$s("applying feature flags",t),t.forEach((n=>{var r;if(this.Ls&&(r=this.Ls)!=null&&r.has(n)){var o,c=this._instance.getFeatureFlag(n),h=(o=this.Ls)==null?void 0:o.get(n);c&&h!=null&&h.variants[c]&&this.Ds(h.name,c,h.variants[c].transforms)}}))}}previewWebExperiment(){var t=pn.getWindowLocation();if(t!=null&&t.search){var n=Qo(t==null?void 0:t.search,"__experiment_id"),r=Qo(t==null?void 0:t.search,"__experiment_variant");n&&r&&(pn.$s("previewing web experiments "+n+" && "+r),this.getWebExperiments((o=>{this.qs(parseInt(n),r,o)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.Te.disable_web_experiments&&!r)return t([]);var o=this._instance.get_property("$web_experiments");if(o&&!n)return t(o);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}qs(t,n,r){var o=r.filter((c=>c.id===t));o&&o.length>0&&(pn.$s("Previewing web experiment ["+o[0].name+"] with variant ["+n+"]"),this.Ds(o[0].name,n,o[0].variants[n].transforms))}static Ns(t,n){return!ft(t.conditions)&&pn.js(t,n)&&pn.Bs(t)}static js(t,n){var r;if(ft(t.conditions)||ft((r=t.conditions)==null?void 0:r.url))return!0;var o=pn.getWindowLocation();if(o){var c,h,l,u=mE(n,o.href);return(c=t.conditions)==null||!c.url||MM[(h=(l=t.conditions)==null?void 0:l.urlMatchType)!==null&&h!==void 0?h:"icontains"](t.conditions.url,u)}return!1}static getWindowLocation(){return _e==null?void 0:_e.location}static Bs(t){var n;if(ft(t.conditions)||ft((n=t.conditions)==null?void 0:n.utm))return!0;var r=TE();if(r.utm_source){var o,c,h,l,u,m,g,p,S=(o=t.conditions)==null||(o=o.utm)==null||!o.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==r.utm_campaign,w=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.utm_source,A=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_medium||((m=t.conditions)==null||(m=m.utm)==null?void 0:m.utm_medium)==r.utm_medium,E=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==r.utm_term;return S&&A&&E&&w}return!1}static $s(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];Oe.info("[WebExperiments] "+t,r)}Ds(t,n,r){this._is_bot()?pn.$s(SS):n!=="control"?r.forEach((o=>{if(o.selector){var c;pn.$s("applying transform of variant "+n+" for experiment "+t+" ",o);var h=(c=document)==null?void 0:c.querySelectorAll(o.selector);h==null||h.forEach((l=>{var u=l;o.html&&(u.innerHTML=o.html),o.css&&u.setAttribute("style",o.css)}))}})):pn.$s("Control variants leave the page unmodified.")}_is_bot(){return xn&&this._instance?KE(xn,this.Te.custom_blocked_useragents):void 0}}var oi=ps("[Conversations]"),wa="Conversations not available yet.",wS="console",uf={featureFlags:class{constructor(e){this.Hs=!1,this.Us=!1,this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.Gs=!1,this.Qs=!1,this.Js=0,this.Ks=()=>{var t=this.Ys();this.Js=0,t&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],_e&&bs(_e,"online",this.Ks)}destroy(){_e==null||_e.removeEventListener("online",this.Ks)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}Xs(e){return this._instance.get_property(e)}eo(){var e,t;return(e=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}ro(){return!!this.eo()&&(this.Qs||this.zs||(this.Qs=!0,Bs.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}io(){var e,t=(e=this.Te.evaluation_contexts)!==null&&e!==void 0?e:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.Gs||(Bs.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gs=!0),t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Bs.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}no(){return this.io().length>0}so(){var e=this.Te.flag_keys;if(!$e(e)){if(ut(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||Bs.error("Invalid flag key found:",t,"Expected non-empty string"),n}));Bs.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,n=this._instance.config,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var o,c,h=(o=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&o!==void 0?o:{},l=Object.keys(r).filter((m=>!!r[m])).reduce(((m,g)=>(m[g]=r[g]||!1,m)),{}),u=Object.keys(h).filter((m=>l[m])).reduce(((m,g)=>(h[g]&&(m[g]=h[g]),m)),{});this.receivedFeatureFlags({featureFlags:l,featureFlagPayloads:u})}}updateFlags(e,t,n){var r,o,c=n!=null&&n.merge&&(r=this.Xs(Na))!==null&&r!==void 0?r:{},h=n!=null&&n.merge&&(o=this.Xs(mh))!==null&&o!==void 0?o:{},l=Te({},c,e),u=Te({},h,t),m={};for(var g of Object.entries(l)){var p=g[0],S=g[1];m[p]={key:p,enabled:y1(S),variant:b1(S),reason:void 0,metadata:$e(u==null?void 0:u[p])?void 0:{id:0,version:void 0,description:void 0,payload:u[p]}}}this.receivedFeatureFlags({flags:m})}get hasLoadedFlags(){return this.Us}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Xs(qg),t=this.Xs(ar),n=this.Xs(Lo);if(!n&&!t)return e||{};var r=rs({},e||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of o){var h,l,u=r[c],m=t==null?void 0:t[c],g=$e(m)?(h=u==null?void 0:u.enabled)!==null&&h!==void 0&&h:!!m,p=$e(m)?u.variant:typeof m=="string"?m:void 0,S=n==null?void 0:n[c],w=Te({},u,{enabled:g,variant:g?p??(u==null?void 0:u.variant):void 0});g!==(u==null?void 0:u.enabled)&&(w.original_enabled=u==null?void 0:u.enabled),p!==(u==null?void 0:u.variant)&&(w.original_variant=u==null?void 0:u.variant),S&&(w.metadata=Te({},u==null?void 0:u.metadata,{payload:S,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),r[c]=w}return this.Hs||(Bs.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Hs=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:y1(r),variant:b1(r),payload:_1(t[n])}}))}getFlagVariants(){var e=this.Xs(Na),t=this.Xs(ar);if(!t)return e||{};for(var n=rs({},e),r=Object.keys(t),o=0;r.length>o;o++)n[r[o]]=t[r[o]];return this.Hs||(Bs.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Hs=!0),n}getFlagPayloads(){var e=this.Xs(mh),t=this.Xs(Lo);if(!t)return e||{};for(var n=rs({},e||{}),r=Object.keys(t),o=0;r.length>o;o++)n[r[o]]=t[r[o]];return this.Hs||(Bs.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Hs=!0),n}reloadFeatureFlags(){this.Vs||this.Te.advanced_disable_feature_flags||this.Ys()||this.oo||(this._instance.en.emit("featureFlagsReloading",!0),this.oo=setTimeout((()=>{this.ao()}),5))}lo(){clearTimeout(this.oo),this.oo=void 0}ensureFlagsLoaded(){this.Us||this.zs||this.oo||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Vs=e}ao(e){var t;if(this.lo(),!this._instance.Ur()&&!this.Ys())if(this.zs)this.Ws=!0;else{var n=this.Te.token,r=this.Xs(Nc),o={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Te({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(ja)||{},{$lib:qt.LIB_NAME,$lib_version:qt.LIB_VERSION}),group_properties:this.Xs(Ra),timezone:LE()};En(r)||$e(r)||(o.$device_id=r),(e!=null&&e.disableFlags||this.Te.advanced_disable_feature_flags)&&(o.disable_flags=!0),this.no()&&(o.evaluation_contexts=this.io());var c=this.so();$e(c)||(o.flag_keys=c);var h=!!this.Te.advanced_only_evaluate_survey_feature_flags,l=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.zs=!0,this._instance._send_request({method:"POST",url:l,data:o,compression:this.Te.disable_compression?void 0:Sn.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var m,g,p,S=!0;if(this.uo(u.statusCode),u.statusCode===200&&(this.Ws||(this.$anon_distinct_id=void 0),S=!1),this.zs=!1,!o.disable_flags||this.Ws){this.Zs=!S;var w=[];u.error?u.error instanceof Error?w.push(u.error.name==="AbortError"?"timeout":"connection_error"):w.push("unknown_error"):u.statusCode!==200&&w.push("api_error_"+u.statusCode),(m=u.json)!=null&&m.errorsWhileComputingFlags&&w.push("errors_while_computing_flags");var A,E=!((g=u.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));E&&w.push("quota_limited"),(p=this.mi)==null||p.register({[Yg]:w}),E?Bs.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(o.disable_flags||this.receivedFeatureFlags((A=u.json)!==null&&A!==void 0?A:{},S,{partialResponse:h}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return RE(this.Js,3)}uo(e){this.Js=AE(e,this.Js,3,(()=>Bs.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else Bs.warn('getFeatureFlag for key "'+e+eg)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var n=this.getFlagVariants(),r=e in n,o=n[e],c=this.getFlagPayloads()[e],h=String(o),l=this.Xs(Vg)||void 0,u=this.Xs(Mc)||void 0,m=this.Xs(wc)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var g,p=this._instance.get_session_id(),S=this.Xs(Kg);p&&p!==S&&(m={},(g=this.mi)==null||g.register({[wc]:m,[Kg]:p}))}if((t.send_event||!("send_event"in t))&&(!(e in m)||!m[e].includes(h))){var w,A,E,y,b,v,_,k,C,x,T;ut(m[e])?m[e].push(h):m[e]=[h],(w=this.mi)==null||w.register({[wc]:m});var R=this.getFeatureFlagDetails(e),M=[...(A=this.Xs(Yg))!==null&&A!==void 0?A:[]];$e(o)&&M.push("flag_missing");var D={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:c||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((E=this.Te.bootstrap)==null||(E=E.featureFlags)==null?void 0:E[e])||null,$feature_flag_bootstrapped_payload:((y=this.Te.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[e])||null,$used_bootstrap_value:!this.Zs};$e(R==null||(b=R.metadata)==null?void 0:b.has_experiment)||(D.$feature_flag_has_experiment=R.metadata.has_experiment),$e(R==null||(v=R.metadata)==null?void 0:v.version)||(D.$feature_flag_version=R.metadata.version);var L,q=(_=R==null||(k=R.reason)==null?void 0:k.description)!==null&&_!==void 0?_:R==null||(C=R.reason)==null?void 0:C.code;q&&(D.$feature_flag_reason=q),R!=null&&(x=R.metadata)!=null&&x.id&&(D.$feature_flag_id=R.metadata.id),$e(R==null?void 0:R.original_variant)&&$e(R==null?void 0:R.original_enabled)||(D.$feature_flag_original_response=$e(R.original_variant)?R.original_enabled:R.original_variant),R!=null&&(T=R.metadata)!=null&&T.original_payload&&(D.$feature_flag_original_payload=R==null||(L=R.metadata)==null?void 0:L.original_payload),M.length&&(D.$feature_flag_error=M.join(",")),this._instance.capture("$feature_flag_called",D)}if(r)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:_1(c)}}}else Bs.warn('getFeatureFlagResult for key "'+e+eg)}getRemoteConfigPayload(e,t){var n=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:qt.LIB_NAME,$lib_version:qt.LIB_VERSION}};this.no()&&(r.evaluation_contexts=this.io());var o=this.so();$e(o)||(r.flag_keys=o),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Te.disable_compression?void 0:Sn.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(c){var h,l=(h=c.json)==null?void 0:h.featureFlagPayloads;t((l==null?void 0:l[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.Zs)return t.defaultValue;if(!(this.Us||this.getFlags()&&this.getFlags().length>0))return Bs.warn('isFeatureEnabled for key "'+e+eg),t.defaultValue;var n=this.getFeatureFlag(e,t);return $e(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.mi){this.Us=!0;var r=this.getFlagVariants(),o=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(h,l,u,m,g,p){u===void 0&&(u={}),m===void 0&&(m={}),g===void 0&&(g={});var S=(R=>{var M=R.flags;return M?(R.featureFlags=Object.fromEntries(Object.keys(M).map((D=>{var L;return[D,(L=M[D].variant)!==null&&L!==void 0?L:M[D].enabled]}))),R.featureFlagPayloads=Object.fromEntries(Object.keys(M).filter((D=>M[D].enabled)).filter((D=>{var L;return(L=M[D].metadata)==null?void 0:L.payload})).map((D=>{var L;return[D,(L=M[D].metadata)==null?void 0:L.payload]})))):R.featureFlags&&Bs.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),R})(h),w=S.flags,A=S.featureFlags,E=S.featureFlagPayloads;if(A){var y=h.requestId,b=h.evaluatedAt;if(ut(A)){Bs.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(A)for(var _=0;A.length>_;_++)v[A[_]]=!0;l&&l.register({[ph]:A,[Na]:v,[Dh]:!1})}else{var k=A,C=E,x=w;if(p!=null&&p.partialResponse)k=Te({},u,k),C=Te({},m,C),x=Te({},g,x);else if(h.errorsWhileComputingFlags)if(w){var T=new Set(Object.keys(w).filter((R=>{var M;return!((M=w[R])!=null&&M.failed)})));k=Te({},u,Object.fromEntries(Object.entries(k).filter((R=>T.has(R[0]))))),C=Te({},m,Object.fromEntries(Object.entries(C||{}).filter((R=>T.has(R[0]))))),x=Te({},g,Object.fromEntries(Object.entries(x||{}).filter((R=>T.has(R[0])))))}else k=Te({},u,k),C=Te({},m,C),x=Te({},g,x);l&&l.register(Te({[ph]:Object.keys(bS(k)),[Na]:k||{},[mh]:C||{},[qg]:x||{},[Dh]:h.minimalFlagCalledEvents===!0},y?{[Vg]:y}:{},b?{[Mc]:b}:{}))}}})(e,this.mi,r,o,c,n),t||(this.Qs=!1),this.ho(t)}}override(e,t){t===void 0&&(t=!1),Bs.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return Bs.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(ar),this.mi.unregister(Lo),this.ho(),Sa.info("All overrides cleared");if(ut(e)){var t=yS(e);return this.mi.register({[ar]:t}),this.ho(),Sa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.Hs=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.mi.unregister(ar),Sa.info("Flag overrides cleared");else if(r.flags){if(ut(r.flags)){var o=yS(r.flags);this.mi.register({[ar]:o})}else this.mi.register({[ar]:r.flags});Sa.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.mi.unregister(Lo),Sa.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[Lo]:r.payloads}),Sa.info("Payload overrides set",{payloads:r.payloads}))),void this.ho()}if(e&&typeof e=="object")return this.mi.register({[ar]:e}),this.ho(),Sa.info("Flag overrides set",{flags:e});Bs.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Us){var t=this.do(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(o){Bs.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,o=(this.Xs(mc)||[]).find((u=>u.flagKey===e)),c={["$feature_enrollment/"+e]:t},h={$feature_flag:e,$feature_enrollment:t,$set:c};o&&(h.$early_access_feature_name=o.name),n&&(h.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",h),this.setPersonPropertiesForFlags(c,!1);var l=Te({},this.getFlagVariants(),{[e]:t});(r=this.mi)==null||r.register({[ph]:Object.keys(bS(l)),[Na]:l}),this.ho()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Xs(mc),o=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+o),method:"GET",timestampMode:"query",callback:c=>{var h,l;if(c.json){var u=c.json.earlyAccessFeatures;return(h=this.mi)==null||h.unregister(mc),(l=this.mi)==null||l.register({[mc]:u}),e(u)}}})}do(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}ho(e){var t=this.do(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((o=>{try{o(n,r,{errorsLoading:e})}catch(c){Bs.error("Error while running feature flags callback",c)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Xs(ja)||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),o=e==null?void 0:e.$set_once,c={};if(o)for(var h in o)({}).hasOwnProperty.call(o,h)&&(h in n||(c[h]=o[h]));this._instance.register({[ja]:Te({},n,c,r)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=Te({},this.Xs(ja)||{});e.forEach((r=>{delete n[r]})),this._instance.register({[ja]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ja),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Xs(Ra)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=Te({},n[r],e[r]),delete e[r]})),this._instance.register({[Ra]:Te({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Xs(Ra)||{};this._instance.register({[Ra]:Te({},t,{[e]:{}})})}else this._instance.unregister(Ra)}reset(){this.Us=!1,this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.$anon_distinct_id=void 0,this.lo(),this.Hs=!1,this.Js=0}}},$M={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var e;return!((e=this.co)==null||!e.isStarted)}get status(){var e,t;return this.vo===ac||this.vo===sd?this.vo:(e=(t=this.co)==null?void 0:t.status)!==null&&e!==void 0?e:this.vo}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.vo=fS,this.fo=void 0,this._instance=e,!this._instance.sessionManager)throw tr.error("started without valid sessionManager"),new Error(uv+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===cr)throw new Error(uv+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var e,t=!((e=this._instance.get_property($a))==null||!e.enabled),n=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return _e&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var n=!$e(Object.assign)&&!$e(Array.from);this.po&&n?(this.mo(e),tr.info("starting")):(this.vo=fS,this.stopRecording())}}mo(e){var t,n,r;this.po&&(this.vo!==ac&&this.vo!==sd&&(this.vo=pS),Xe!=null&&(t=Xe.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Xe.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yo(e):(r=Xe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.bo,(o=>{if(o)return tr.error("could not load recorder",o);this.yo(e)})))}stopRecording(){var e,t;(e=this.fo)==null||e.call(this),this.fo=void 0,(t=this.co)==null||t.stop()}_o(){var e,t;(e=this.fo)==null||e.call(this),this.fo=void 0,(t=this.co)==null||t.discard()}wo(){var e,t;(e=this.mi)==null||e.unregister(Vv),(t=this.mi)==null||t.unregister(nE)}xo(e,t){if(ft(e))return null;var n,r=cn(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(tr.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}ko(e){if(this.mi){var t,n,r=this.mi,o=()=>{var c,h=e.sessionRecording===!1?void 0:e.sessionRecording,l=this.xo((c=this.Te.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),u=this.xo(h==null?void 0:h.sampleRate,"remote config sampleRate"),m=l??u;ft(m)&&this.wo();var g=h==null?void 0:h.minimumDurationMilliseconds;r.register({[$a]:Te({cache_timestamp:Date.now(),enabled:!!h},h,{networkPayloadCapture:Te({capturePerformance:e.capturePerformance},h==null?void 0:h.networkPayloadCapture),canvasRecording:{enabled:h==null?void 0:h.recordCanvas,fps:h==null?void 0:h.canvasFps,quality:h==null?void 0:h.canvasQuality},sampleRate:m,minimumDurationMilliseconds:$e(g)?null:g,endpoint:h==null?void 0:h.endpoint,triggerMatchType:h==null?void 0:h.triggerMatchType,masking:h==null?void 0:h.masking,urlTriggers:h==null?void 0:h.urlTriggers,version:h==null?void 0:h.version,triggerGroups:h==null?void 0:h.triggerGroups})})};o(),(t=this.fo)==null||t.call(this),this.fo=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(o)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.ko(t),void this._o()):(this.ko(t),void this.startIfEnabledOrStop()):(this.vo===ac&&(this.vo=sd,tr.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.co)!=null&&n.log?this.co.log(e,t):tr.warn("log called before recorder was ready")}get bo(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property($a);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var e,t,n=this._instance.get_property($a);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(o){return tr.warn("persisted remote config for session recording is invalid and will be ignored",o),!1}var r=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-r}yo(e){var t,n;if((t=Xe.__PosthogExtensions__)==null||!t.initSessionRecording)return tr.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[dE]:!0});if(this.co||(this.co=(n=Xe.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===sd||this.vo===ac?void 0:(this.vo=ac,tr.info("persisted remote config is stale, requesting fresh config before starting"),void new IE(this._instance).load());this.vo=pS,this.co.start(e)}onRRwebEmit(e){var t;(t=this.co)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.co||(t=this.mi)==null||t.register({[rE]:!0}),(e=this.co)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.co||(t=this.mi)==null||t.register({[iE]:!0}),(e=this.co)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.co||(n=this.mi)==null||n.register({[e==="url"?aE:oE]:!0}),(t=this.co)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.co)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.co)==null||!n.tryAddCustomEvent(e,t))}}},DM={autocapture:class{constructor(e){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=e,this.rageclicks=new uS(e.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var e,t,n=ds(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),n}Ro(){if(this.isBrowserSupported()){if(_e&&Be){var e=n=>{n=n||(_e==null?void 0:_e.event);try{this.Po(n)}catch(r){Ym.error("Failed to capture event",r)}};if(bs(Be,"submit",e,{capture:!0}),bs(Be,"change",e,{capture:!0}),bs(Be,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(_e==null?void 0:_e.event);try{this.Po(n,Km)}catch(r){Ym.error("Failed to capture copy/cut event",r)}};bs(Be,"copy",t,{capture:!0}),bs(Be,"cut",t,{capture:!0})}}}else Ym.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Co&&(this.Ro(),this.Co=!0)}onRemoteConfig(e){if(this.Io=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);var n=t.autocapture_opt_out;xi(n)&&(this.instance.persistence&&this.instance.persistence.register({[Ig]:n}),this.Mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Eo=e}getElementSelectors(e){var t,n=[];return(t=this.Eo)==null||t.forEach((r=>{var o=Be==null?void 0:Be.querySelectorAll(r);o==null||o.forEach((c=>{e===c&&n.push(r)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Ig],r=this.Mo,o=this.instance.Ur()&&!this.Io;if(En(r)&&!xi(n)&&!o)return!1;var c=(t=this.Mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!c}Po(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=Lm(e);vE(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&z1(r,this.instance.config.rageclick)&&this.Po(e,"$rageclick");var o=t===Km;if(r&&(function(p,S,w,A,E,y){var b;if(!_e||Xv(p)||w!=null&&w.url_allowlist&&!I1(w.url_allowlist,y)||w!=null&&w.url_ignorelist&&I1(w.url_ignorelist,y))return!1;if(w!=null&&w.dom_event_allowlist){var v=w.dom_event_allowlist;if(v&&!v.some((R=>S.type===R)))return!1}var _=xE(p,A),k=_.parentIsUsefulElement,C=_.targetElementList;if(!(function(R,M){var D=M==null?void 0:M.element_allowlist;if($e(D))return!0;var L,q=function(Y){if(D.some((Q=>Y.tagName.toLowerCase()===Q)))return{v:!0}};for(var F of R)if(L=q(F))return L.v;return!1})(C,w)||!tv(C,w==null?void 0:w.css_selector_allowlist)||tv(C,(b=w==null?void 0:w.css_selector_ignorelist)!==null&&b!==void 0?b:M4))return!1;try{var x=_e.getComputedStyle(p);if(x&&x.getPropertyValue("cursor")==="pointer"&&S.type==="click")return!0}catch{}var T=p.tagName.toLowerCase();switch(T){case"html":return!1;case"form":return(E||["submit"]).indexOf(S.type)>=0;case"input":case"select":case"textarea":return(E||["change","click"]).indexOf(S.type)>=0;default:return k?(E||["click"]).indexOf(S.type)>=0:(E||["click"]).indexOf(S.type)>=0&&(Yv.indexOf(T)>-1||p.getAttribute("contenteditable")==="true")}})(r,e,this.Te,o,o?["copy","cut"]:void 0,this.instance)){var c=CM(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),h=c.props;if(c.explicitNoCapture)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(h.$element_selectors=l),t===Km){var u,m=bE(_e==null||(u=_e.getSelection())==null?void 0:u.toString()),g=e.type||"clipboard";if(!m)return!1;h.$selected_content=m,h.$copy_type=g}return this.instance.capture(t,h),!0}}}isBrowserSupported(){return Wn(Be==null?void 0:Be.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Oo=(_e==null||(t=_e.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Oe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,Oe.info("History API monitoring stopped")}monitorHistoryChanges(){_e&&_e.history&&(this.Ao("pushState"),this.Ao("replaceState"),this.$o())}Ao(e){var t;if(_e&&((t=_e.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(r,o,c){try{if(!(o in r))return dS;var h={next:r[o]},l=c((function(){for(var u=arguments.length,m=new Array(u),g=0;u>g;g++)m[g]=arguments[g];return h.next.apply(this,m)}));return Wn(l)&&(l.prototype=l.prototype||{},Object.defineProperties(l,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:h}})),r[o]=l,()=>{if(r[o]!==l)for(var u=r[o];Wn(u)&&u.__posthog_layer__;){var m=u.__posthog_layer__;if(m.next===l)return void(m.next=h.next);u=m.next}else r[o]=h.next}}catch{return dS}})(_e.history,e,(r=>function(o,c,h){r.call(this,o,c,h),n.Lo(e)}))}}Lo(e){try{var t,n=_e==null||(t=_e.location)==null?void 0:t.pathname;if(!n)return;n!==this.Oo&&this.isEnabled&&this._instance.capture(Io,{navigation_type:e}),this.Oo=n}catch(r){Oe.error("Error capturing "+e+" pageview",r)}}$o(){if(!this.Fo){var e=()=>{this.Lo("popstate")};bs(_e,"popstate",e),this.Fo=()=>{_e&&_e.removeEventListener("popstate",e)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(e){var t;this.Do=!1,this.Co=!1,this.No=null,this.instance=e,this.Do=!((t=this.instance.persistence)==null||!t.props[Pg]),this.rageclicks=new uS(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ds(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ft(this.Te.capture_heatmaps)?ft(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;kM.info("starting..."),this.qo(),this.xe()}else{var e;clearInterval((e=this.No)!==null&&e!==void 0?e:void 0),this.jo(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Pg]:n}),this.Do=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Bo(e){Jm(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(Be==null?void 0:Be.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){_e&&Be&&(this.Ho=this.oi.bind(this),bs(_e,Bh,this.Ho),this.Uo=e=>this.pe(e||(_e==null?void 0:_e.event)),bs(Be,"click",this.Uo,{capture:!0}),this.zo=e=>this.Vo(e||(_e==null?void 0:_e.event)),bs(Be,"mousemove",this.zo,{capture:!0}),this.Wo=new W1(this.instance,B4,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),bs(Be,Ph,this.Zo),this.Co=!0)}jo(){var e;_e&&Be&&(this.Ho&&_e.removeEventListener(Bh,this.Ho),this.Uo&&Be.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&Be.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&Be.removeEventListener(Ph,this.Zo),clearTimeout(this.Go),(e=this.Wo)==null||e.stop(),this.Co=!1)}Qo(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),c=(function(h,l,u){for(var m=h;m&&Yr(m)&&!Kn(m,"body");){if(m===u)return!1;var g=void 0;try{var p,S,w;g=(p=(S=(w=m.ownerDocument)==null?void 0:w.defaultView)!==null&&S!==void 0?S:_e)==null?void 0:p.getComputedStyle(m).position}catch{return!1}if(at(l,g))return!0;m=SE(m)}return!1})(Lm(e),["fixed","sticky"],o);return{x:e.clientX+(c?0:r),y:e.clientY+(c?0:n),target_fixed:c,type:t}}pe(e,t){var n;if(t===void 0&&(t="click"),!L1(e.target)&&Jm(e)){var r=this.Qo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&z1(Lm(e),this.instance.config.rageclick)&&this.Wt(Te({},r,{type:"rageclick"})),this.Wt(r)}}Vo(e){!L1(e.target)&&Jm(e)&&(clearTimeout(this.Go),this.Go=setTimeout((()=>{this.Wt(this.Qo(e,"mousemove"))}),500))}Wt(e){if(_e){var t=this.Te.disable_capture_url_hashes?Kr(_e.location.href):_e.location.href,n=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...el,...n||[]]:[],o=Dc(t,r,Oc);this.R=this.R||{},this.R[o]||(this.R[o]=[]),this.R[o].push(e)}}oi(){this.R&&!Vr(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:W1,webVitalsAutocapture:class{constructor(e){var t;this.Do=!1,this.Co=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jo=()=>{clearTimeout(this.Ko),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,r)=>Te({},n,{["$web_vitals_"+r.name+"_event"]:Te({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=n=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Xo();if(!$e(o))if(ft(n==null?void 0:n.name)||ft(n==null?void 0:n.value))ba.error("Invalid metric received",n);else if(!this.ta||this.ta>n.value){this.R.url!==o&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),$e(this.R.url)&&(this.R.url=o),this.R.firstMetricTimestamp=$e(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),h=Te({},n,{$current_url:o,timestamp:Date.now()});$e(c)||(h.$session_id=c.sessionId,h.$window_id=c.windowId),this.R.metrics.push(h),this.R.metrics.length===this.allowedMetrics.length&&this.Jo()}else ba.error("Ignoring metric with value >= "+this.ta,n)},this.ea=()=>{if(!this.Co){var n,r,o,c,h=Xe.__PosthogExtensions__;if(!$e(h)&&!$e(h.postHogWebVitalsCallbacks)){var l=h.postHogWebVitalsCallbacks;n=l.onLCP,r=l.onCLS,o=l.onFCP,c=l.onINP}n&&r&&o&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Yo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.Yo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.Yo.bind(this)),this.Co=!0):ba.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Do=!((t=this._instance.persistence)==null||!t.props[Ug]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=ds(this.ra)?(e=this.ra)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ft(n)?((t=this._instance.persistence)==null?void 0:t.props[Fg])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ds(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ds(this.ra)?this.ra.web_vitals_attribution:void 0;return e!=null&&e}get ta(){var e=ds(this.ra)&&cn(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:hS;return e>0&&6e4>=e?hS:e}get isEnabled(){var e=Ns==null?void 0:Ns.protocol;if(e!=="http:"&&e!=="https:")return ba.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ds(this.ra)?this.ra.web_vitals:xi(this.ra)?this.ra:void 0;return xi(t)?t:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(ba.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=ds(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=ds(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ug]:n}),this._instance.persistence.register({[Fg]:r})),this.Do=n,this.startIfEnabled()}}}tr(e){var t,n;(t=Xe.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Xe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?ba.error("failed to load script",r):e()}))}Xo(){var e=_e?this._instance.config.disable_capture_url_hashes?Kr(_e.location.href):_e.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...el,...t||[]]:[];return Dc(e,n,Oc)}ba.error("Could not determine current URL")}}},OM={exceptionObserver:class{constructor(e){var t;this.ea=()=>{var n;if(_e&&this.isEnabled&&(n=Xe.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Xe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=Xe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Xe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ia&&this.Te.capture_unhandled_errors&&(this.ia=r(this.captureException.bind(this))),!this.na&&this.Te.capture_unhandled_rejections&&(this.na=o(this.captureException.bind(this))),!this.sa&&this.Te.capture_console_errors&&(this.sa=c(this.captureException.bind(this)))}catch(h){rc.error("failed to start",h),this.oa()}}},this._instance=e,this.aa=!((t=this._instance.persistence)==null||!t.props[Bg]),this.la=new D3(Te({},(function(n){var r,o,c,h;return n===void 0&&(n={}),{refillRate:(r=(o=n.exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(c=(h=n.exceptionRateLimiterBucketSize)!==null&&h!==void 0?h:n.__exceptionRateLimiterBucketSize)!==null&&c!==void 0?c:10}})(this._instance.config.error_tracking),{refillInterval:1e4,it:rc})),this.Te=this.ua(),this.startIfEnabledOrStop()}ua(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ds(e)?t=Te({},t,e):($e(e)?this.aa:e)&&(t=Te({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(rc.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(e){var t,n;(t=Xe.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Xe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return rc.error("failed to load script",r);e()}))}oa(){var e,t,n;(e=this.ia)==null||e.call(this),this.ia=void 0,(t=this.na)==null||t.call(this),this.na=void 0,(n=this.sa)==null||n.call(this),this.sa=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.aa=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Bg]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(e){var t,n,r,o=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.la.consumeRateLimit(o)?rc.info("Skipping exception capture because of client rate limiting.",{exception:o}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.ha=[],this.da=new J3([new r4,new p4,new o4,new a4,new h4,new d4,new c4,new f4],(function(r){for(var o=arguments.length,c=new Array(o>1?o-1:0),h=1;o>h;h++)c[h-1]=arguments[h];return function(l,u){u===void 0&&(u=0);for(var m=[],g=l.split(`
464
+ `),p=u;g.length>p;p++){var S=g[p];if(1024>=S.length){var w=M1.test(S)?S.replace(M1,"$1"):S;if(!w.match(/\S*Error: /)){for(var A of c){var E=A(w,r);if(E){m.push(E);break}}if(m.length>=50)break}}}return(function(y){if(!y.length)return[];var b=Array.from(y);return b.reverse(),b.slice(0,50).map((v=>{return Te({},v,{filename:v.filename||(_=b,_[_.length-1]||{}).filename,function:v.function||Zo});var _}))})(m)}})("web:javascript",t4,i4)),this._instance=e,this.ha=(t=(n=this._instance.persistence)==null?void 0:n.get_property(zg))!==null&&t!==void 0?t:[],this.ca=$h(this.va()),this.fa=new g4(this.ca)}onConfigChange(){this.ca=$h(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(e){var t,n,r;if(e.ok){var o=e.config;if("errorTracking"in o){var c=(t=(n=o.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],h=(r=o.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ha=c,this._instance.persistence&&this._instance.persistence.register({[zg]:this.ha,[Hg]:h})}}}get pa(){var e,t=!!this._instance.get_property(Hg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.da.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ca.enabled)try{if(!ts(e)||e.trim().length===0)return void Di.warn("Ignoring exception step because message must be a non-empty string");var n=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var h=[];return{sanitizedProperties:Object.keys(c).reduce(((l,u)=>m4.has(u)?(h.push(u),l):(l[u]=c[u],l)),{}),droppedKeys:h}})(this.ga(t)),r=n.sanitizedProperties,o=n.droppedKeys;o.length>0&&Di.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.fa.add(Te({[Nh]:e,[Mh]:new Date().toISOString()},r))}catch(c){Di.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.ma(t)){if(this.ya(t))return this.ba("Exception dropped: matched a suppression rule"),void Di.info("Skipping exception capture because a suppression rule matched");if(!this.pa&&this._a(t))return this.ba("Exception dropped: thrown by a browser extension"),void Di.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.wa(t))return this.ba("Exception dropped: thrown by the PostHog SDK"),void Di.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ca.enabled&&ft(e.$exception_steps)?this.xa(e):e,r=typeof(c=globalThis._posthogReleaseId)=="string"&&c.length>0?c:void 0;r&&(n.$release_id=r);try{var o=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return o&&this.fa.clear(),o}catch(h){return Di.error("Failed to capture exception event. Dropping this exception.",h),void this.fa.clear()}}catch(h){return void Di.error("Failed to process exception event. Ignoring this exception.",h)}var c}xa(e){try{var t=this.fa.getAttachable();return t.length===0?e:Te({},e,{$exception_steps:t})}catch(n){return Di.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}ba(e){this.ca.enabled&&this.fa.add({[Nh]:e,[Mh]:new Date().toISOString()})}ga(e){return ds(e)?Te({},e):{}}va(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ya(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var o=r.type,c=r.value;return ts(o)&&o.length>0&&n.$exception_types.push(o),ts(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.ha.some((n=>{var r=n.values.map((o=>{var c=XE[o.operator],h=t[o.key];if(!c||!h)return!1;var l=ut(o.value)?o.value:[o.value];return l.length>0&&c(l,h)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return Di.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}_a(e){return e.flatMap((t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(e){if(e.length>0){var t,n,r,o,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],h=c[c.length-1];return(r=h==null||(o=h.filename)==null?void 0:o.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ma(e){return!ft(e)&&ut(e)}}},LM=Te({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.ka=null,this.Sa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.mi&&this.mi.register({[qv]:!!t.productTours}),!Qm(this._instance))return!this.ka&&ft((n=this.mi)==null?void 0:n.props[gc])||Zm.info("product tours disabled; stopping and clearing cached tours"),(r=this.ka)==null||r.stop(),this.ka=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ka&&Qm(this._instance)&&this.tr((()=>this.Ca()))}tr(e){var t,n;(t=Xe.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Xe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Zm.error("Could not load product tours script",r):e()}))}Ca(){var e;!this.ka&&(e=Xe.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ka=Xe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!ut(this.Sa)||t){var n=this.mi;if(n){var r=n.props[gc];if(ut(r)&&!t)return this.Sa=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:o=>{if(Qm(this._instance)){var c=o.statusCode;if(c!==200||!o.json){var h="Product Tours API could not be loaded, status: "+c;return Zm.error(h),void e([],{isLoaded:!1,error:h})}var l=ut(o.json.product_tours)?o.json.product_tours:[];this.Sa=l,n&&n.register({[gc]:l}),e(l,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Sa,{isLoaded:!0})}getActiveProductTours(e){ft(this.ka)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ka.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ka)==null||t.showTourById(e)}previewTour(e){this.ka?this.ka.previewTour(e):this.tr((()=>{var t;this.Ca(),(t=this.ka)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.ka)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.ka)==null||e.nextStep()}previousStep(){var e;(e=this.ka)==null||e.previousStep()}clearCache(){var e;this.Sa=null,(e=this.mi)==null||e.unregister(gc)}resetTour(e){var t;(t=this.ka)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.ka)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ka)==null||t.cancelPendingTour(e)}}},uf),IM={siteApps:class{constructor(e){this.Ma=0,this._instance=e,this.Ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ta(e,t){if(t){var n=this.globalsForEvent(t);this.Ia.push(n),this.Ia.length>1e3&&(this.Ia=this.Ia.slice(10))}}get siteAppLoaders(){var e;return(e=Xe._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ta.bind(this));this.Ea=()=>{e(),this.Ia=[],this.Ea=void 0}}}globalsForEvent(e){var t,n,r,o,c,h,l;if(!e)throw new Error("Event payload is required");var u={},m=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var p of Object.entries(g)){var S=p[0];u[S]={id:m[S],type:S,properties:p[1]}}var w=e.$set_once,A=e.$set;return{event:Te({},xC(e,jM),{properties:Te({},e.properties,A?{$set:Te({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},A)}:{},w?{$set_once:Te({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},w)}:{}),elements_chain:(c=(h=e.properties)==null?void 0:h.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Ra(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||($i.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||($i.error("prepare_external_dependency_script returned null"),null):e}Pa(){var e,t,n,r,o,c,h,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=Be==null?void 0:Be.defaultView,m=u==null||(e=u.Node)==null?void 0:e.prototype;if(!u||!m)return()=>{};if(this.Ma++,this.Oa)return this.Fa();var g=[],p=this,S=new WeakSet,w=(y,b,v)=>{if(y!=null&&y[b]){var _=y[b];y[b]=v(_),g.push((()=>{y[b]=_}))}},A=y=>{if(S.has(y))return y;var b=p.Ra(y);return b&&S.add(b),b},E=y=>y.map((b=>typeof b=="string"?b:A(b))).filter((b=>!En(b)));return w(m,"appendChild",(y=>function(b){var v=A(b);return v?y.call(this,v):b})),w(m,"insertBefore",(y=>function(b,v){var _=A(b);return _?y.call(this,_,v):b})),w(m,"replaceChild",(y=>function(b,v){var _=A(b);return _?y.call(this,_,v):v})),[(t=u.Element)==null?void 0:t.prototype,(n=u.Document)==null?void 0:n.prototype,(r=u.DocumentFragment)==null?void 0:r.prototype].forEach((y=>{w(y,"append",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))})),w(y,"prepend",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))}))})),[(o=u.Element)==null?void 0:o.prototype,(c=u.CharacterData)==null?void 0:c.prototype,(h=u.DocumentType)==null?void 0:h.prototype].forEach((y=>{w(y,"before",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))})),w(y,"after",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))})),w(y,"replaceWith",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];var C=E(_);return _.length&&!C.length?void 0:b.apply(this,C)}))})),w((l=u.Element)==null?void 0:l.prototype,"insertAdjacentElement",(y=>function(b,v){var _=A(v);return _?y.call(this,b,_):null})),this.Oa=()=>{g.forEach((y=>y())),this.Oa=void 0},this.Fa()}Fa(){var e=!1;return()=>{var t;e||(e=!0,this.Ma--,this.Ma===0&&((t=this.Oa)==null||t.call(this)))}}Aa(e,t){t===void 0&&(t=!0);var n=this.Pa();try{var r=e(n);return t&&n(),r}catch(o){throw n(),o}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var h;!t.errored&&this.Ia.length&&($i.info("Processing "+this.Ia.length+" events for site app with id "+e.id),this.Ia.forEach((l=>this.Aa((()=>t.processEvent==null?void 0:t.processEvent(l))))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((h=this.Ea)==null||h.call(this))},r=!1,o=h=>{t.errored=!h,t.loaded=!0,$i.info("Site app with id "+e.id+" "+(h?"loaded":"errored")),r&&n()};try{var c=this.Aa((h=>e.init({posthog:this._instance,callback(l){h(),o(l)}})),!1).processEvent;c&&(t.processEvent=c),r=!0}catch(h){$i.error(mS+e.id,h),o(!1)}if(r&&t.loaded)try{n()}catch(h){$i.error("Error while processing buffered events PostHog app with config id "+e.id,h),t.errored=!0}}$a(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}La(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(c){try{t.Aa((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(h){$i.error("Error while processing event "+e.event+" for site app "+c.id,h)}};for(var o of Object.values(this.apps))r(o)}}onRemoteConfig(e){var t,n,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(u=>this.La(u)))):void $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ea)==null||n.call(this),e.ok){var c=e.config;if((r=c.siteApps)!=null&&r.length)if(this.isEnabled){var h=function(){var u,m=l.id,g=l.url;Xe["__$$ph_site_app_"+m]=o._instance,(u=Xe.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(o._instance,g,(p=>{if(p)return $i.error(mS+m,p)}))};for(var l of c.siteApps)h()}else $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},PM={tracingHeaders:class{constructor(e){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,n,r=this.ja();r?($e(this.Da)&&(this.Da=(t=Xe.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),$e(this.Na)&&(this.Na=(n=Xe.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=e}initialize(){this.startIfEnabledOrStop()}tr(e){var t,n;(t=Xe.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Xe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return EM.error("failed to load script",r);e()}))}Ba(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}ja(){var e=this.Ba();return ut(e)?(ut(this.qa)?this.qa.splice(0,this.qa.length,...e):this.qa=[...e],e.length>0?this.qa:void 0):(ut(this.qa)&&this.qa.splice(0),this.qa=e||void 0,this.qa)}oa(){var e,t;(e=this.Da)==null||e.call(this),(t=this.Na)==null||t.call(this),this.Da=void 0,this.Na=void 0}startIfEnabledOrStop(){this.ja()?this.tr(this.ea):this.oa()}}},BM=Te({surveys:class{get Te(){return this._instance.config}constructor(e){this.Ha=void 0,this._surveyManager=null,this.Ua=!1,this.za=[],this.Va=null,this.Wa=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Te.disable_surveys){if(!e.ok)return Kt.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(ft(t))return Kt.warn("Flags not loaded yet. Not loading surveys.");var n=ut(t);this.Ha=n?t.length>0:t,Kt.info("flags response received, isSurveysEnabled: "+this.Ha),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(QE)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((o=>localStorage.removeItem(o)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Ua)Kt.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)Kt.info(gS);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())Kt.info("Not loading surveys in cookieless mode without consent.");else{var e=Xe==null?void 0:Xe.__PosthogExtensions__;if(e){if(!$e(this.Ha)||this.Te.advanced_enable_surveys){var t=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var n=e.generateSurveys;if(n)return void this.Za(n,t);var r=e.loadExternalDependency;if(!r)return void this.Ga(Gv);r(this._instance,"surveys",(o=>{o||!e.generateSurveys?this.Ga("Could not load surveys script",o):this.Za(e.generateSurveys,t)}))}catch(o){throw this.Ga("Error initializing surveys",o),o}finally{this.Ua=!1}}}else Kt.error("PostHog Extensions not found.")}}Za(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new TM(this._instance),Kt.info("Surveys loaded successfully"),this.Qa({isLoaded:!0})}Ga(e,t){Kt.error(e,t),this.Qa({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.za.push(e),this._surveyManager&&this.Qa({isLoaded:!0}),()=>{this.za=this.za.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return Kt.info(gS),e([]);var n,r=this._instance.get_property(Gg);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Ja()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Va?this.Va.then((o=>e(o.surveys,o.context))):(typeof Promise<"u"&&(this.Va=new Promise((o=>{n=o}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:o=>{var c;this.Va=null;var h=o.statusCode;if(h!==200||!o.json){var l="Surveys API could not be loaded, status: "+h;Kt.error(l),this.Wa=Date.now();var u={isLoaded:!1,error:l};return e([],u),void(n==null||n({surveys:[],context:u}))}this.Wa=null;var m,g=o.json.surveys||[],p=g.filter((w=>(function(A){return!(!A.start_date||A.end_date)})(w)&&(ZE(w)||(function(A){var E;return!((E=A.conditions)==null||(E=E.actions)==null||(E=E.values)==null||!E.length)})(w))));p.length>0&&((m=this._surveyEventReceiver)==null||m.register(p)),(c=this._instance.persistence)==null||c.register({[Gg]:g,[Oh]:Date.now()});var S={isLoaded:!0};e(g,S),n==null||n({surveys:g,context:S})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var e=this._instance.get_property(Oh);return cn(e)&&Date.now()-e>3e5}Ya(){return cn(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(e,t){var n,r={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};e2(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Qa(e){for(var t of this.za)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Kt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ft(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Kt.warn("init was not called")}Xa(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((o=>o.id===e)))!==null&&r!==void 0?r:null})),t}tl(e){if(ft(this._surveyManager))return{eligible:!1,reason:nd};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}el(e){if(ft(this._surveyManager))return{eligible:!1,reason:nd};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ft(this._surveyManager))return Kt.warn("init was not called"),{visible:!1,disabledReason:nd};var t=this.el(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ft(this._surveyManager)?(Kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:nd})):new Promise((n=>{this.getSurveys((r=>{var o,c=(o=r.find((l=>l.id===e)))!==null&&o!==void 0?o:null;if(c){var h=this.el(c);n({visible:h.eligible,disabledReason:h.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var r;if(ft(this._surveyManager))Kt.warn("init was not called");else{var o=typeof e=="string"?this.Xa(e):e;if(o!=null&&o.id)if(hM.includes(o.type)){var c=Be==null?void 0:Be.querySelector(t);if(c)return(r=o.appearance)!=null&&r.surveyPopupDelaySeconds?(Kt.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var h,l;Kt.info("Rendering survey "+o.id+" with delay of "+((h=o.appearance)==null?void 0:h.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(o,c,n),Kt.info("Survey "+o.id+" rendered")}),1e3*o.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(o,c,n);Kt.warn("Survey element not found")}else Kt.warn("Surveys of type "+o.type+" cannot be rendered in the app");else Kt.warn("Survey not found")}}displaySurvey(e,t){var n;if(ft(this._surveyManager))Kt.warn("init was not called");else{var r=this.Xa(e);if(r){var o=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(o=Te({},r,{appearance:Te({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==nv.Popover&&t.initialResponses&&Kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.tl(r);if(!c.eligible)return void Kt.warn("Survey is not eligible to be displayed: ",c.reason)}t.displayType!==nv.Inline?this._surveyManager.handlePopoverSurvey(o,t):this.renderSurvey(o,t.selector,t.properties)}else Kt.warn("Survey not found")}}cancelPendingSurvey(e){ft(this._surveyManager)?Kt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},uf),zM={toolbar:class{constructor(e){this.instance=e}rl(e){Xe.ph_toolbar_state=e}il(){var e;return(e=Xe.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),hE(this.instance.config)||!_e||!Be)return!1;e=e??_e.location,n=n??_e.history;try{if(!t){try{_e.localStorage.setItem("test","test"),_e.localStorage.removeItem("test")}catch{return!1}t=_e==null?void 0:_e.localStorage}var r,o=NM||Fh(e.hash,"__posthog")||Fh(e.hash,"state"),c=o?D1((()=>JSON.parse(atob(decodeURIComponent(o)))))||D1((()=>JSON.parse(decodeURIComponent(o)))):null;return c&&c.action==="ph_authorize"?((r=c).source="url",r&&Object.keys(r).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(vS)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}nl(e){var t=Xe.ph_load_toolbar||Xe.ph_load_editor;!ft(t)&&Wn(t)?t(e,this.instance):_S.warn("No toolbar load function found")}loadToolbar(e){var t=!(Be==null||!Be.getElementById(gE));if(!_e||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Te({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(_e.localStorage.setItem(vS,JSON.stringify(Te({},r,{source:void 0}))),this.il()===2)this.nl(r);else if(this.il()===0){var o;this.rl(1),(o=Xe.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return _S.error("[Toolbar] Failed to load",c),void this.rl(0);this.rl(2),this.nl(r)})),bs(_e,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(r)}))}return!0}sl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},HM=Te({experiments:pn},uf),UM={conversations:class{constructor(e){this.ol=void 0,this._conversationsManager=null,this.al=!1,this.ll=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;ft(t)||(xi(t)?this.ol=t:(this.ol=t.enabled,this.ll=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.ol=void 0,this.ll=null}loadIfEnabled(){if(!(this._conversationsManager||this.al||this._instance.config.disable_conversations||hE(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Xe==null?void 0:Xe.__PosthogExtensions__;if(e&&!$e(this.ol)&&this.ol)if(this.ll&&this.ll.token){this.al=!0;try{var t=e.initConversations;if(t)return this.ul(t),void(this.al=!1);var n=e.loadExternalDependency;if(!n)return void this.hl(Gv);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.hl("Could not load conversations script",r):this.ul(e.initConversations),this.al=!1}))}catch(r){this.hl("Error initializing conversations",r),this.al=!1}}else oi.error("Conversations enabled but missing token in remote config.")}}ul(e){if(this.ll)try{this._conversationsManager=e(this.ll,this._instance),oi.info("Conversations loaded successfully")}catch(t){this.hl("Error completing conversations initialization",t)}else oi.error("Cannot complete initialization: remote config is null")}hl(e,t){oi.error(e,t),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():oi.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!En(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return hs((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(oi.warn(wa),null)}))()}getMessages(e,t){var n=this;return hs((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(oi.warn(wa),null)}))()}markAsRead(e){var t=this;return hs((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(oi.warn(wa),null)}))()}getTickets(e){var t=this;return hs((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(oi.warn(wa),null)}))()}requestRestoreLink(e){var t=this;return hs((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(oi.warn(wa),null)}))()}restoreFromToken(e){var t=this;return hs((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(oi.warn(wa),null)}))()}restoreFromUrlToken(){var e=this;return hs((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(oi.warn(wa),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Nn(){var e;(e=this._conversationsManager)==null||e.setIdentity()}qn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},FM={logs:class{constructor(e){var t;this.dl=!1,this.cl=!1,this.it=ps("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var n,r;this.Js=0,(n=this.pl)==null||n.onReconnect(),(r=this.gl)==null||r.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),_e&&bs(_e,"online",this.fl)}ml(e,t,n,r){var o,c=(function(h,l){var u,m,g,p,S,w,A,E=(u=h==null?void 0:h.flushIntervalMs)!==null&&u!==void 0?u:3e3,y=(m=h==null?void 0:h.maxBufferSize)!==null&&m!==void 0?m:100,b=l!=null&&l.consoleCapture?void 0:(g=h==null?void 0:h.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,v=$e(b)?Math.max(y,2048):Math.max(y,b),_=h==null?void 0:h.resourceAttributes;return{serviceName:(p=(S=_==null?void 0:_["service.name"])!==null&&S!==void 0?S:h==null?void 0:h.serviceName)!==null&&p!==void 0?p:l==null?void 0:l.serviceNameDefault,serviceVersion:(w=_==null?void 0:_["service.version"])!==null&&w!==void 0?w:h==null?void 0:h.serviceVersion,environment:(A=_==null?void 0:_["deployment.environment"])!==null&&A!==void 0?A:h==null?void 0:h.environment,resourceAttributes:_,beforeSend:h==null?void 0:h.beforeSend,flushIntervalMs:E,maxBufferSize:y,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:E,maxLogsPerInterval:b,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((o=this._instance)==null||(o=o.config)==null?void 0:o.logs,n);return[new K3(this.yl(e,t),c,this.it,(()=>this.bl()),(h=>h()),void 0,r),c]}_l(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.pl||this.wl!==t){var n;(n=this.pl)==null||n.reset(),this.wl=t;var r=this.ml((()=>this.Gr),(o=>{this.Gr=o}));this.pl=r[0],this.xl=r[1]}return this.pl}kl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.gl||this.Sl!==t){var n;(n=this.gl)==null||n.reset(),this.Sl=t;var r=this.ml((()=>this.vl),(o=>{this.vl=o}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},wS);this.gl=r[0],this.Cl=r[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!ft(n)&&n&&(this.dl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],(e=this.pl)==null||e.reset(),this.vl=[],(t=this.gl)==null||t.reset(),this.Js=0}captureLog(e){this._l().captureLog(e)}le(e){this.kl().captureLog(e)}get logger(){return this.Ml||(this.Ml={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ml}flushLogs(e){e?this.Il(e):(this.pl&&this.pl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))),this.gl&&this.gl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.dl&&!this.cl){var e=Xe==null?void 0:Xe.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var r;n||(r=e.logs)==null||!r.initializeLogs?this.it.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(Gv)}else this.it.error("PostHog Extensions not found.")}}yl(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===or.LogsQueue?e():void 0,setPersistedProperty(r,o){var c;r===or.LogsQueue&&t((c=o)!==null&&c!==void 0?c:[])},$t:r=>this.$t(r),getLibraryId:()=>qt.LIB_NAME,getLibraryVersion:()=>qt.LIB_VERSION}}$t(e){return new Promise((t=>{if(RE(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,r=c=>{n||(n=!0,clearTimeout(o),t(c))},o=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Tl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:c=>{var h=c.statusCode;if(this.El(h),h>=200&&300>h)r({kind:"ok"});else if(h===413)r({kind:"too-large"});else if(h!==0&&h!==429&&500>h)r({kind:"fatal",error:new Error("logs request failed with status "+h)});else{var l;r({kind:"retry-later",error:(l=c.error)!==null&&l!==void 0?l:new Error("logs request failed with status "+h)})}}})}}))}El(e){(e!==0||this._instance.__loaded)&&(this.Js=AE(e,this.Js,3,(()=>this.it.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}Il(e){this.Gr.length>0&&this.Rl(e,this.Gr,this.xl,qt.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(e,this.vl,this.Cl,wS,(t=>{this.vl=t}))}Rl(e,t,n,r,o){if(t.length!==0){var c=t.map((l=>l.record));o([]);var h=ZC(c,JC(n,qt.LIB_NAME,qt.LIB_VERSION),r,qt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tl(),data:h,compression:"best-available",batchKey:"logs",transport:e})}}Tl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}bl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,o=n.sessionStartTimestamp,c=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,ft(o)||(t.sessionStartTimestamp=o),ft(c)||(t.lastActivityTimestamp=c)}if(Xe!=null&&(e=Xe.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Kr(Xe.location.href):Xe.location.href),this._instance.featureFlags){var h=this._instance.featureFlags.getFlags();h&&h.length>0&&(t.activeFeatureFlags=h)}return t}}},qM={metrics:class{constructor(e){this.it=ps("[metrics]"),this._instance=e}initialize(){}_l(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.pl&&this.wl===n||((t=this.pl)==null||t.reset(),this.wl=n,this.pl=new Y3(this.yl(),(function(r){var o,c,h,l,u,m=r==null?void 0:r.resourceAttributes;return{serviceName:(o=m==null?void 0:m["service.name"])!==null&&o!==void 0?o:r==null?void 0:r.serviceName,serviceVersion:(c=m==null?void 0:m["service.version"])!==null&&c!==void 0?c:r==null?void 0:r.serviceVersion,environment:(h=m==null?void 0:m["deployment.environment"])!==null&&h!==void 0?h:r==null?void 0:r.environment,resourceAttributes:m,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(l=r==null?void 0:r.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(u=r==null?void 0:r.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(n),this.it)),this.pl}count(e,t,n){t===void 0&&(t=1),this._l().count(e,t,n)}gauge(e,t,n){this._l().gauge(e,t,n)}histogram(e,t,n){this._l().histogram(e,t,n)}flush(e){if(!this.pl)return Promise.resolve();if(e){var t=this.pl.drainWindow();return t&&this.Kt(t,e),Promise.resolve()}return this.pl.flush().catch((n=>this.it.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.pl)==null||e.reset()}yl(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Kt:n=>t.Kt(n),getLibraryId:()=>qt.LIB_NAME,getLibraryVersion:()=>qt.LIB_VERSION}}Kt(e,t){return new Promise((n=>{var r=!1,o=h=>{r||(r=!0,clearTimeout(c),n(h))},c=setTimeout((()=>o({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(Te({method:"POST",url:this.Pl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(h){var l=h.statusCode;if(l>=200&&300>l)o({kind:"ok"});else if(l===413)o({kind:"too-large"});else if(l!==0&&l!==429&&500>l)o({kind:"fatal",error:new Error("metrics request failed with status "+l)});else{var u;o({kind:"retry-later",error:(u=h.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+l)})}}}))}))}Pl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},VM=Te({},uf,$M,DM,OM,LM,IM,BM,PM,zM,HM,UM,FM,qM);di.__defaultExtensionClasses=Te({},VM);var Yn=(function(){qt.SDK_DIST_CHANNEL="npm";var e=Ec[Po]=new di;return(function(){function t(){t.done||(t.done=!0,s2=!1,ss(Ec,(function(n){n._dom_loaded()})))}Be!=null&&Be.addEventListener?Be.readyState==="complete"?t():bs(Be,"DOMContentLoaded",t,{capture:!1}):_e&&Oe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();function GM(e){if(!e)return"unknown";if(e.settingsOpen)return"account";if(e.firstRun&&!e.hasLiveSession)return"onboarding";if(e.templatesOpen)return"agent_build";if(e.hasLiveSession){const t=e.rightTab??"";return t==="logs"||t==="diff"?"agent_observe":t==="canvas"||t==="preview"?"agent_operate":"agent_build"}return e.inspectingDeadSession?"agent_observe":"unknown"}function Vs(e,t){try{Yn.capture(e,t)}catch{}}let No=null;function WM(){var e,t;if(No)return No;try{No=((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??null}catch{No=null}return No??(No=`boot-${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`),No}function e_(e){try{const t={};for(const[n,r]of Object.entries(e))r!=null&&r!==""&&(t[n]=r);Yn.register(t)}catch{}}function KM(e){try{const t=GM(e);Yn.register({journey:t,view:YM(e)})}catch{}}function YM(e){return e.settingsOpen?"settings":e.firstRun&&!e.hasLiveSession?"welcome":e.templatesOpen?"templates":e.hasLiveSession?`workbench:${e.rightTab??"chat"}`:e.inspectingDeadSession?"session_history":"unknown"}const XM=4e3,JM=220,xS={light:'<script>(function(){var r=window.document.documentElement;r.setAttribute("data-canvas-theme","light");r.setAttribute("data-theme","light");})();<\/script>',dark:'<script>(function(){var r=window.document.documentElement;r.setAttribute("data-canvas-theme","dark");r.setAttribute("data-theme","dark");})();<\/script>'};function ZM(e,t){return`${e}${t==="dark"?xS.dark:xS.light}`}function QM(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.kind=="string"&&typeof t.label=="string"}function e$({sessionId:e,lastMessage:t,subjectWorkflow:n,source:r,loadWorkflowGraph:o,overviewActive:c,sessionExited:h,expanded:l,onToggleExpanded:u,macros:m,tasks:g,onRunMacro:p,onInjectPrompt:S,onDescribeWorkflow:w,surface:A,onOpenSteps:E,run:y,runTarget:b,runs:v,onSelectRun:_,preview:k,deployState:C,onDismissDeploy:x,onOpenCode:T,workflows:R,onOpenWorkflow:M,onCanvasState:D,onGraphChange:L}){const[q,F]=O.useState(!1),Y=O.useRef(D);Y.current=D;const Q=O.useRef(L);Q.current=L;const G=O.useRef((n==null?void 0:n.path)??null);G.current=(n==null?void 0:n.path)??null;const ee=r.kind==="agent"?r.path:null,ne=r.kind==="session"?r.sessionId:null,[z,B]=O.useState(0),[$,H]=O.useState(nf()),[U,P]=O.useState(!1),[W,se]=O.useState(!0),[X,V]=O.useState(!1),ce=O.useRef(null),oe=O.useRef(null),Z=O.useRef(0),te=O.useCallback(()=>{se(!1),V(!0),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>V(!1),360)},[]),pe=()=>{const fe=Z.current-Date.now();oe.current&&clearTimeout(oe.current),fe>0?oe.current=setTimeout(te,fe):te()};O.useEffect(()=>()=>{ce.current&&clearTimeout(ce.current),oe.current&&clearTimeout(oe.current)},[]),O.useEffect(()=>{if(!W)return;const fe=window.setTimeout(te,XM);return()=>window.clearTimeout(fe)},[W,te]);const[ye,Ee]=O.useState(1),[Ie,Pe]=O.useState({x:0,y:0}),[Fe,je]=O.useState(!1),Ue=O.useRef(null),Ye=O.useRef(null),[jt,rt]=O.useState(.25),Ct=fe=>Math.min(3,Math.max(jt,Math.round(fe*100)/100)),[dt,Lt]=O.useState(null),mt=O.useRef(!1),[Ut,Ss]=O.useState({zoom:1,x:0,y:0}),Yt=O.useCallback(()=>{const fe=Ue.current;if(!dt||!fe)return null;const Le=fe.getBoundingClientRect();if(Le.width<80||Le.height<80)return null;const Me=Le.width-dt.insetX*2,Qe=Le.height-dt.insetTop-dt.insetBottom;if(Me<=0||Qe<=0)return null;const it=Math.min(1,Me/dt.width,Qe/dt.height);return{zoom:Math.max(.1,Math.round(it*100)/100),x:0,y:0}},[dt]),ms=O.useCallback(()=>{let fe=12;const Le=()=>{const Me=Yt();if(Me){rt(Math.min(.25,Me.zoom)),mt.current=!1,Ee(Me.zoom),Pe({x:Me.x,y:Me.y}),Ss(Me);return}if(dt&&fe-- >0){requestAnimationFrame(Le);return}rt(.25),mt.current=!1,Ee(1),Pe({x:0,y:0}),Ss({zoom:1,x:0,y:0})};Le()},[Yt,dt]);O.useEffect(()=>{!dt||mt.current||ms()},[dt,ms]),O.useEffect(()=>{const fe=Ue.current;if(!fe||typeof ResizeObserver>"u")return;const Le=new ResizeObserver(()=>{mt.current||ms()});return Le.observe(fe),()=>Le.disconnect()},[ms]),O.useEffect(()=>{var Me,Qe,it;(Qe=(Me=Ye.current)==null?void 0:Me.contentWindow)==null||Qe.postMessage({type:"sapiom-canvas:view",zoom:ye,x:Ie.x,y:Ie.y},"*");const fe=Hs.current,Le=Ye.current;if(fe&&Le){const St=Le.getBoundingClientRect();(it=Le.contentWindow)==null||it.postMessage({type:"sapiom-canvas:hover",x:fe.x-St.left,y:fe.y-St.top},"*")}},[ye,Ie]),O.useEffect(()=>{const fe=Ue.current;if(!fe)return;const Le=Me=>{Me.preventDefault(),mt.current=!0,Ee(Qe=>Ct(Qe*(Me.deltaY<0?1.1:1/1.1)))};return fe.addEventListener("wheel",Le,{passive:!1}),()=>fe.removeEventListener("wheel",Le)});const _t=fe=>{var Qe,it;const Le=Ye.current;if(!Le)return;const Me=Le.getBoundingClientRect();if(typeof fe.clientX=="number"&&typeof fe.clientY=="number"){const{clientX:St,clientY:Ge,...Je}=fe;(Qe=Le.contentWindow)==null||Qe.postMessage({...Je,x:St-Me.left,y:Ge-Me.top},"*");return}(it=Le.contentWindow)==null||it.postMessage(fe,"*")},[$s,as]=O.useState(!1),Et=O.useRef(!1),It=O.useRef(0),Hs=O.useRef(null),Xs=fe=>{if(Hs.current={x:fe.clientX,y:fe.clientY},Fe)return;const{clientX:Le,clientY:Me}=fe;cancelAnimationFrame(It.current),It.current=requestAnimationFrame(()=>{_t({type:"sapiom-canvas:hover",clientX:Le,clientY:Me})})},In=()=>{cancelAnimationFrame(It.current),Hs.current=null,as(!1),Et.current=!1,_t({type:"sapiom-canvas:hover",x:-1,y:-1})},Gs=fe=>{if(fe.button!==0)return;const Le=fe.currentTarget;try{Le.setPointerCapture(fe.pointerId)}catch{}je(!0),_t({type:"sapiom-canvas:press",clientX:fe.clientX,clientY:fe.clientY,down:!0});let Me=!0;const Qe=()=>{Me&&(Me=!1,_t({type:"sapiom-canvas:press",down:!1}))};let it=fe.clientX,St=fe.clientY;const Ge=fe.clientX,Je=fe.clientY,lt=Bt=>{const Jn=Bt.clientX-it,gt=Bt.clientY-St;it=Bt.clientX,St=Bt.clientY,(Math.abs(Bt.clientX-Ge)>=4||Math.abs(Bt.clientY-Je)>=4)&&(Qe(),mt.current=!0),Pe(gs=>({x:gs.x+Jn,y:gs.y+gt}))},wt=Bt=>{je(!1),Qe(),Le.removeEventListener("pointermove",lt),Le.removeEventListener("pointerup",wt),Le.removeEventListener("pointercancel",wt),Math.abs(Bt.clientX-Ge)<4&&Math.abs(Bt.clientY-Je)<4&&(_t({type:"sapiom-canvas:pick",clientX:Bt.clientX,clientY:Bt.clientY}),Et.current||Us(null))};Le.addEventListener("pointermove",lt),Le.addEventListener("pointerup",wt),Le.addEventListener("pointercancel",wt)},[ot,Us]=O.useState(null);O.useEffect(()=>{if(A==="steps"&&y&&l||!l&&ot==null)return;const fe=Le=>{Le.key==="Escape"&&(ot!=null?Us(null):u())};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[l,ot,u,y,A]);const[os,js]=O.useState(!0),[un,Js]=O.useState(!1),[_n,Pn]=O.useState(null),[ls,mi]=O.useState(null),[xs,kn]=O.useState(null),[gi,Ze]=O.useState(null);O.useEffect(()=>{const fe=Le=>{var Qe,it,St;const Me=Le.data;if(!(!Me||Le.source!==((Qe=Ye.current)==null?void 0:Qe.contentWindow))){if(Me.type==="sapiom-canvas:overview")Pn({description:typeof Me.description=="string"?Me.description:"",stats:typeof Me.stats=="string"?Me.stats:"",notes:Array.isArray(Me.notes)?Me.notes.filter(Ge=>typeof Ge=="string"):[],badges:Array.isArray(Me.badges)?Me.badges.filter(Ge=>typeof Ge=="string"):[],legend:Array.isArray(Me.legend)?Me.legend.filter(QM):[]});else if(Me.type==="sapiom-canvas:graph"){const Ge=VR(Me.graph);kn(Ge);const Je=G.current;Ge&&Je&&((it=Q.current)==null||it.call(Q,Je,Ge)),(St=Y.current)==null||St.call(Y,!0)}else if(Me.type==="sapiom-canvas:node"){const Ge=Me.id;typeof Ge=="string"&&Us(Ge)}else if(Me.type==="sapiom:node-click"){const Ge=Me.stepName;typeof Ge=="string"&&kn(Je=>{if(Je){const lt=Je.nodes.find(wt=>wt.label===Ge)??Je.nodes.find(wt=>wt.id===Ge)??null;lt&&Us(lt.id)}return Je})}else if(Me.type==="sapiom-canvas:hit"){const Ge=typeof Me.id=="string";as(Ge),Et.current=Ge}else if(Me.type==="sapiom-canvas:size"){const Ge=Me;typeof Ge.width=="number"&&Ge.width>0&&typeof Ge.height=="number"&&Ge.height>0&&Lt({width:Ge.width,height:Ge.height,insetTop:typeof Ge.insetTop=="number"&&Ge.insetTop>=0?Ge.insetTop:0,insetBottom:typeof Ge.insetBottom=="number"&&Ge.insetBottom>=0?Ge.insetBottom:0,insetX:typeof Ge.insetX=="number"&&Ge.insetX>=0?Ge.insetX:0})}else if(Me.type==="sapiom-canvas:error"){const Ge=Me;mi({title:typeof Ge.title=="string"?Ge.title:"",reason:typeof Ge.reason=="string"?Ge.reason:""})}}};return window.addEventListener("message",fe),()=>window.removeEventListener("message",fe)},[]),O.useEffect(()=>{Pn(null),mi(null),kn(null),Us(null),Ze(null),js(!0),as(!1),Et.current=!1,Lt(null),Ee(1),Pe({x:0,y:0}),Ss({zoom:1,x:0,y:0}),mt.current=!1},[e,z]);const Zs=xs&&ot?xs.nodes.find(fe=>fe.id===ot)??null:null;O.useEffect(()=>{var fe,Le;(Le=(fe=Ye.current)==null?void 0:fe.contentWindow)==null||Le.postMessage({type:"sapiom-canvas:select",id:ot},"*")},[ot]);const tt=O.useCallback(()=>{var fe,Le;!y||!b||ee==null&&ne==null||W||(Le=(fe=Ye.current)==null?void 0:fe.contentWindow)==null||Le.postMessage({type:"sapiom:run-state",steps:y.steps,status:y.status,target:b},"*")},[y,b,ee,ne,W]);O.useEffect(()=>{tt()},[tt]);const jn=_n??void 0,[Ds,kt]=O.useState(new Set);O.useEffect(()=>Nv(H),[]),O.useEffect(()=>{var Le;if(ee!=null)return;if(se(!0),!e){F(!1),(Le=Y.current)==null||Le.call(Y,!1);return}F(!1);let fe=!1;return P(!0),fetch(`/canvas/${e}/`,{method:"HEAD"}).then(Me=>{var Qe;fe||(F(Me.ok),Me.ok||(Qe=Y.current)==null||Qe.call(Y,!1))}).catch(()=>{}).finally(()=>!fe&&P(!1)),()=>{fe=!0}},[e,ee]);const[Xt,dn]=O.useState(null),[Rs,hn]=O.useState(0),Rn=O.useRef(o);Rn.current=o,O.useEffect(()=>{if(ee==null){dn(null);return}let fe=!1;se(!0),P(!0);const Le=setTimeout(()=>{Rn.current(ee).then(Me=>{fe||dn({path:ee,status:Me.status,document:Me.document,reason:Me.reason})}).catch(Me=>{if(fe)return;const Qe=Me instanceof gn&&Me.status===404?"notRegistered":Me instanceof gn&&Me.status===400?"rejected":"unreachable";dn({path:ee,status:Qe,document:null,reason:Me instanceof Error?Me.message:null})}).finally(()=>{fe||P(!1)})},JM);return()=>{fe=!0,clearTimeout(Le),P(!1)}},[ee,Rs]),O.useEffect(()=>{(t==null?void 0:t.type)==="canvas.reload"&&hn(fe=>fe+1)},[t]),O.useEffect(()=>{!t||!e||t.type==="canvas.reload"&&t.harnessSessionId===e&&(F(!0),se(!0),B(fe=>fe+1))},[t,e]);const Qs=(n==null?void 0:n.path)??null;O.useEffect(()=>{se(!0),B(fe=>fe+1),Ee(1),Pe({x:0,y:0}),Ss({zoom:1,x:0,y:0}),mt.current=!1},[Qs]);const Fs=g.filter(fe=>fe.harnessSessionId===e&&(fe.workflowPath==null||fe.workflowPath===Qs)),ws=Fs.some(fe=>fe.status==="running"&&fe.macroId==="describe"),re=Fs.find(fe=>fe.status==="running"&&fe.macroId!=="describe")??null,he=Fs.filter(fe=>fe.status!=="running"&&fe.macroId!=="describe").sort((fe,Le)=>(Le.endedAt??"").localeCompare(fe.endedAt??""))[0],be=!re&&(he==null?void 0:he.status)==="failed"&&!Ds.has(he.id)?he:null,xe=be?m.find(fe=>fe.id===be.macroId)??null:null,Ae=m.find(fe=>fe.id==="visualize")??null,ze=ne!=null&&!0,st=ee!=null&&(Xt==null?void 0:Xt.path)===ee?Xt:null,We=st!=null&&(st.status==="ok"||st.status==="preparing")&&st.document!=null?st.document:null,Rt=r.kind==="agent"?We!=null:q&&ze,le=d.jsx(d.Fragment,{children:C&&d.jsx(QN,{deployState:C,workflow:n,onDismiss:x,onOpenCode:T})}),De=st==null||We!=null?null:st.status==="empty"?{testId:"canvas-empty-route-empty",icon:"Workflow",title:A==="steps"?"No steps yet":"Nothing rendered yet",body:st.reason??"This agent has no diagram yet; it is generated from its code."}:st.status==="error"?{testId:"canvas-empty-route-error",icon:"TriangleAlert",title:"Couldn't read this agent's diagram",body:st.reason??"The diagram extraction failed."}:st.status==="notRegistered"?{testId:"canvas-empty-route-unregistered",icon:"Radio",title:"Studio doesn't know this agent",body:"The path is not a registered agent — rescan the project to pick it up again."}:{testId:"canvas-empty-route-unavailable",icon:"Radio",title:"Couldn't load this agent's board",body:st.reason??"The harness didn't answer."};return d.jsxs("aside",{className:"canvas-pane",...Dt({surface:"canvas"}),children:[n&&!c&&d.jsx(h3,{workflow:n,detailStep:null,onBack:()=>{},onAskAgent:S,surface:A,stepsSummary:xs&&xs.nodes.length>0?FR(xs):null,run:y,runTarget:b,runs:v,onSelectRun:_}),c||r.kind==="none"?A==="steps"?d.jsx(wn,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see the agent's steps here."}):d.jsx(wn,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its canvas here."}):be?d.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[d.jsxs("p",{className:"canvas-task-title",children:[d.jsx(ue,{name:"TriangleAlert",size:14})," ",be.label," failed."]}),be.errorTail&&d.jsx("pre",{className:"canvas-task-error",children:be.errorTail}),d.jsxs("div",{className:"canvas-task-actions",children:[xe&&d.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>p(xe),children:"Retry"}),d.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>kt(fe=>{const Le=new Set(fe);return Le.add(be.id),Le}),children:"Dismiss"})]})]}):re&&!Rt?d.jsxs("div",{className:"canvas-task-activity","data-testid":"canvas-task-activity",children:[d.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:d.jsx(ue,{name:"Workflow",size:20})}),d.jsx("div",{className:"canvas-task-title",children:d.jsxs("span",{children:[re.label," is running…"]})}),re.statusLines.length>0&&d.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:re.statusLines.slice(-8).map((fe,Le)=>d.jsx("li",{children:fe},`${Le}-${fe}`))}),d.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}):U?d.jsxs("div",{className:"canvas-loading","data-testid":"canvas-loading",children:[d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),d.jsx("p",{className:"canvas-empty-hint",children:A==="steps"?"Loading steps…":"Loading canvas…"})]}):!Rt&&A==="steps"&&(y||C)?d.jsx("div",{className:"canvas-frame-wrap","data-view":"steps",children:d.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[le,y&&d.jsx(m1,{run:y,target:b,workflow:n,focus:l,onToggleFocus:u,onAskAgent:S,onInspectionOpened:()=>Vs("run.inspection_opened",{target:b??"unknown"}),onArtifactViewed:()=>Vs("run.artifact_viewed",{target:b??"unknown"}),onDashboardOpened:()=>Vs("run.dashboard_opened",{target:b??"unknown"})})]})}):De?d.jsx(wn,{className:"canvas-empty",testId:De.testId,icon:De.icon,title:De.title,body:De.body}):!Rt&&h?d.jsx(wn,{className:"canvas-empty",testId:"canvas-empty-exited",icon:"History",title:"Session ended",body:`Resume the session to see ${A==="steps"?"the agent's steps":"the agent's diagram"} here.`}):Rt?d.jsx("div",{className:"canvas-frame-wrap"+(l&&A==="board"?" is-expanded":""),"data-view":A==="board"?"board":"steps",children:d.jsx("div",{className:"canvas-slide-track",children:d.jsxs("div",{className:"canvas-slide-pane",children:[d.jsxs("div",{className:"canvas-visual"+(A==="steps"?" is-offstage":""),children:[d.jsxs("div",{className:"canvas-view-controls","data-testid":"canvas-view-controls",children:[d.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-out","aria-label":"Zoom out",title:"Zoom out",disabled:ye<=jt+.001,onClick:()=>{mt.current=!0,Ee(fe=>Math.max(jt,Math.round((fe-.25)*100)/100))},children:d.jsx(ue,{name:"ZoomOut",size:14})}),d.jsxs("button",{className:"theme-toggle canvas-zoom-reset","data-testid":"canvas-zoom-reset","aria-label":"Reset zoom",title:"Reset zoom",disabled:ye===1,onClick:()=>{mt.current=!0,Ee(1)},children:[Math.round(ye*100),"%"]}),d.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:ye>=2,onClick:()=>{mt.current=!0,Ee(fe=>Math.min(2,Math.round((fe+.25)*100)/100))},children:d.jsx(ue,{name:"ZoomIn",size:14})}),d.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:ye===Ut.zoom&&Ie.x===Ut.x&&Ie.y===Ut.y,onClick:ms,children:d.jsx(ue,{name:"Frame",size:14})})]}),l&&d.jsx("button",{className:"macro-icon-btn canvas-expand-exit","data-testid":"canvas-expand-exit","aria-label":"Exit expanded canvas",title:"Exit expanded canvas (Esc)",onClick:u,children:d.jsx(ue,{name:"Minimize2",size:14})}),(W||X)&&d.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(W?"":" is-fading"),"data-testid":"canvas-loading",role:"status","aria-label":"Rendering diagram",children:[d.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-title"}),d.jsxs("div",{className:"canvas-skeleton-row",children:[d.jsx("div",{className:"canvas-skeleton-block"}),d.jsx("div",{className:"canvas-skeleton-block"})]}),d.jsxs("div",{className:"canvas-skeleton-row",children:[d.jsx("div",{className:"canvas-skeleton-block"}),d.jsx("div",{className:"canvas-skeleton-block"}),d.jsx("div",{className:"canvas-skeleton-block"})]}),d.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-wide"})]}),ls&&d.jsxs("div",{className:"canvas-render-error","data-testid":"canvas-render-error",children:[d.jsx("span",{className:"canvas-error-icon","aria-hidden":"true",children:d.jsx(ue,{name:"TriangleAlert",size:20})}),d.jsx("div",{className:"canvas-task-title",children:"Render failed"}),d.jsx("p",{className:"canvas-error-summary",children:(()=>{const fe=ls.reason.trim();return fe.length<4?"The agent graph could not be extracted. Open the terminal for details.":fe.includes(": ")?fe.slice(fe.indexOf(": ")+2).split(". ")[0]:fe})()}),d.jsxs("div",{className:"canvas-error-actions",children:[d.jsx("button",{className:"btn-primary","data-testid":"canvas-error-fix",onClick:()=>S(`The canvas render for ${ls.title||"this agent"} failed: ${ls.reason} Fix the project so the agent graph extracts cleanly.`),children:"Ask coding agent to fix"}),d.jsx("button",{className:"btn-ghost","data-testid":"canvas-error-retry",onClick:()=>{Ae?p(Ae):(Z.current=Date.now()+900,se(!0),B(fe=>fe+1))},children:"Retry"})]}),d.jsxs("details",{className:"canvas-error-details",children:[d.jsx("summary",{children:"Details"}),d.jsx("pre",{children:ls.reason.trim().length>=4?ls.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),re&&d.jsxs("div",{className:"canvas-task-activity canvas-task-activity--overlay","data-testid":"canvas-task-activity",children:[d.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:d.jsx(ue,{name:"Workflow",size:20})}),d.jsx("div",{className:"canvas-task-title",children:d.jsxs("span",{children:[re.label," is running…"]})}),re.statusLines.length>0&&d.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:re.statusLines.slice(-8).map((fe,Le)=>d.jsx("li",{children:fe},`${Le}-${fe}`))}),d.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}),jn&&!os&&!Zs&&d.jsx("button",{className:"theme-toggle canvas-overview-open","data-testid":"canvas-overview-toggle","aria-label":"Show agent overview","data-tooltip":"Show agent overview",onClick:()=>js(!0),children:"i"}),A==="board"&&d.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(un?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":un?"Close chat":"Open chat","data-tooltip":"Chat — ask about this agent or the selected step",onClick:()=>Js(fe=>!fe),children:d.jsx(ue,{name:"MessageSquare",size:14})}),d.jsx("iframe",{ref:Ye,className:"canvas-iframe",...We!=null?{srcDoc:ZM(We,$)}:{src:`/canvas/${e}/?theme=${$}`},sandbox:"allow-scripts",scrolling:"no",onLoad:()=>{var fe,Le,Me,Qe;pe(),(Le=(fe=Ye.current)==null?void 0:fe.contentWindow)==null||Le.postMessage({type:"sapiom-canvas:view",zoom:ye,x:Ie.x,y:Ie.y},"*"),y&&b&&(We!=null||ze)&&((Qe=(Me=Ye.current)==null?void 0:Me.contentWindow)==null||Qe.postMessage({type:"sapiom:run-state",steps:y.steps,status:y.status,target:b},"*"))},onError:te},We!=null?`wf:${ee}:${Rs}`:`${e}:${z}`),d.jsx("div",{ref:Ue,className:"canvas-pan-layer"+(Fe?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":$s&&!Fe?"true":void 0,onPointerDown:Gs,onPointerMove:Xs,onPointerLeave:In,onDoubleClick:ms})]}),A==="steps"&&d.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[le,y?d.jsx(m1,{run:y,target:b,workflow:n,focus:l,onToggleFocus:u,onAskAgent:S,onInspectionOpened:()=>Vs("run.inspection_opened",{target:b??"unknown"}),onArtifactViewed:()=>Vs("run.artifact_viewed",{target:b??"unknown"}),onDashboardOpened:()=>Vs("run.dashboard_opened",{target:b??"unknown"})}):xs&&xs.nodes.length>0?d.jsx(i3,{graph:xs,run:y,runTarget:b,workflows:R,onOpenWorkflow:M,onAskAgent:S,expandedId:gi,onToggle:fe=>Ze(Le=>Le===fe?null:fe)}):d.jsx(wn,{className:"canvas-empty",icon:"Workflow",title:"No steps yet",body:"This diagram has no step graph. It regenerates automatically from the bound agent — check the terminal if it never appears."})]}),A==="board"&&(jn&&os||Zs)&&d.jsx(l3,{overview:jn??null,selectedNode:Zs,graph:xs,run:y,workflows:R,onOpenWorkflow:M,onOpenSteps:()=>{ot&&Ze(ot),E()},onDeselect:()=>Us(null),onCollapse:()=>js(!1),onDescribeWithAI:n&&e&&!h?()=>w(n):void 0,describing:ws}),A==="board"&&un&&d.jsx(o3,{node:Zs,run:y,onInjectPrompt:S,onClose:()=>Js(!1)})]})})}):d.jsx(wn,{className:"canvas-empty",icon:"Workflow",title:A==="steps"?"No steps yet":"Nothing generated yet",body:A==="steps"?"Steps are read from the bound agent's diagram — generated automatically from its code.":"Generated automatically from the bound agent; it refreshes when the code changes."})]})}const t$="https://tools.sapiom.ai",s$="x-sapiom-api-key",n$="YOUR_SAPIOM_API_KEY";function i$(e){return e==null?"{ /* your input */ }":JSON.stringify(e,null,2).replace(/\n/g,`
465
+ `)}function r$(e){return e==null?"{}":JSON.stringify(e)}function a$(e){return e.replace(/'/g,"'\\''")}function o$(e,t){return`import { agents } from "@sapiom/tools";
466
+
467
+ const result = await agents.run({
468
+ definition: ${JSON.stringify(e)},
469
+ input: ${i$(t)},
470
+ });
471
+
472
+ if (result.status === "completed") {
473
+ console.log(result.output);
474
+ }
475
+ `}function l$(e,t,n){const r=a$(`{ "input": ${r$(t)} }`),o=encodeURIComponent(e);return`curl -X POST ${n}/agents/v1/definitions/${o}/executions \\
476
+ -H "${s$}: ${n$}" \\
477
+ -H "Content-Type: application/json" \\
478
+ -d '${r}'
479
+ `}function c$(e){const{definition:t,inputSample:n,baseUrl:r=t$}=e;return{typescript:o$(t,n),curl:l$(t,n,r)}}const u$=new Set(["pending","queued","building"]),d$=new Set(["failed","cancelled","superseded","stale"]);function Pa(e,t=null){return e.activeBuildRunStatus==="ready"?"ready":e.activeBuildRunStatus!=null&&u$.has(e.activeBuildRunStatus)?"building":t!=null||e.activeBuildRunStatus!=null&&d$.has(e.activeBuildRunStatus)?"failed":e.definitionId==null?"draft":"linked"}function bh(e){return(e==null?void 0:e.activeBuildRunStatus)==="ready"}function h$(e,t=null){switch(Pa(e,t)){case"ready":return null;case"building":return"Build in progress";case"failed":return"Last deploy failed — retry Deploy";case"linked":return"No ready deployment yet";case"draft":return"Not deployed yet"}}const f$="https://app.sapiom.ai/settings?tab=api-keys";function p$({boundWorkflow:e,agentsBaseUrl:t}){return bh(e)?d.jsx(m$,{boundWorkflow:e,agentsBaseUrl:t}):null}function m$({boundWorkflow:e,agentsBaseUrl:t}){const[n,r]=O.useState("typescript"),[o,c]=O.useState(!1),h=e.definitionSlug==null,l=e.definitionSlug??e.name,{typescript:u,curl:m}=c$({definition:l,baseUrl:t}),g=n==="typescript"?u:m,p=()=>{navigator.clipboard.writeText(g).then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)}).catch(()=>{})};return d.jsxs("div",{className:"snippet-panel","data-testid":"snippet-panel",...Dt({object:"snippet"}),children:[d.jsx("div",{className:"snippet-panel-header",children:d.jsx("span",{className:"snippet-panel-title",children:"Trigger from your code"})}),d.jsxs("div",{className:"snippet-slug-row",children:[d.jsx("span",{className:"snippet-slug-label",children:"Agent"}),d.jsx("code",{className:"snippet-slug","data-testid":"snippet-slug",children:l})]}),h&&d.jsx("p",{className:"snippet-slug-inferred","data-testid":"snippet-slug-inferred",children:"Inferred from the project name. Confirm it matches your deployed agent."}),d.jsxs("div",{className:"snippet-tabs",role:"tablist","aria-label":"Snippet language",children:[d.jsx("button",{role:"tab","aria-selected":n==="typescript","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="typescript"?" is-active":""),"data-testid":"snippet-tab-ts",onClick:()=>r("typescript"),children:"TypeScript (SDK)"}),d.jsx("button",{role:"tab","aria-selected":n==="curl","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="curl"?" is-active":""),"data-testid":"snippet-tab-curl",onClick:()=>r("curl"),children:"cURL (HTTP)"})]}),d.jsxs("div",{className:"snippet-code-wrap",role:"tabpanel",id:"snippet-code-panel",children:[d.jsx("pre",{className:"snippet-code","data-testid":"snippet-code",children:d.jsx("code",{children:g})}),d.jsx("button",{className:"snippet-copy"+(o?" is-copied":""),"data-testid":"snippet-copy","aria-label":o?"Copied":"Copy snippet",onClick:p,children:o?"Copied":"Copy"})]}),d.jsxs("p",{className:"snippet-hint","data-testid":"snippet-hint",children:[n==="typescript"?d.jsxs(d.Fragment,{children:["Install ",d.jsx("code",{children:"@sapiom/tools"}),", set ",d.jsx("code",{children:"SAPIOM_API_KEY"}),", and replace the sample input. The SDK call waits for a terminal run and returns its result."]}):d.jsxs(d.Fragment,{children:["Replace ",d.jsx("code",{children:"YOUR_SAPIOM_API_KEY"})," and the sample input. This request starts a run and returns its execution ID."]})," ","Create or manage the key in your"," ",d.jsx("a",{className:"snippet-link","data-testid":"snippet-api-key-link",href:f$,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),"."]})]})}function g$({boundWorkflow:e,noSessionAgent:t=null,agentsBaseUrl:n,lastDeployError:r=null}){if(!e)return d.jsx(wn,{className:"code-panel-empty",icon:"Code",title:t?`No running session for ${t}`:"No agent bound",body:t?"Start a session to inspect this agent's integration snippets here.":"Open an agent to see how to trigger it from your code."});const o=Pa(e,r),c=o==="ready",h=o==="building"?"Building":o==="failed"?"Deploy failed":o==="linked"?"Linked":"Draft",l=o==="building"?"Cloud build in progress":o==="failed"?"Deploy did not produce a ready build":o==="linked"?"No ready deployment yet":"Deploy to trigger from code",u=o==="building"?`${e.name} is linked and building. Integration snippets appear after the cloud build is ready.`:o==="failed"?`Fix ${e.name} and retry Deploy. Studio only shows integration snippets for a ready cloud build.`:o==="linked"?`${e.name} is linked to Sapiom, but Studio cannot confirm a ready cloud build. Deploy it before integrating.`:`${e.name} is a draft. Once it deploys, TypeScript SDK and cURL starter calls appear here.`;return d.jsxs("div",{className:"code-panel",...Dt({surface:"code_panel"}),children:[d.jsxs("div",{className:"workflow-actions-header code-panel-header","data-testid":"code-panel-header",children:[d.jsx("span",{className:"workflow-actions-name",children:e.name}),c?d.jsxs("span",{className:"status-tag workflow-deployed-tag","data-testid":"code-panel-status","data-tooltip":"Ready cloud build",children:[d.jsx("span",{className:"workflow-dot workflow-dot-pinned","aria-hidden":"true"}),"Deployed"]}):d.jsxs("span",{className:"status-tag code-panel-draft-tag","data-testid":"code-panel-status","data-tooltip":l,children:[d.jsx(ue,{name:"CloudOff",size:13}),h]})]}),c?d.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:d.jsx(p$,{boundWorkflow:e,agentsBaseUrl:n},e.path)}):d.jsx(wn,{className:"code-panel-empty",icon:"Code",title:l,body:u})]})}const v$="https://docs.sapiom.ai/",_$=[{label:"Agents quick start",meta:"Run your first agent",href:"https://docs.sapiom.ai/agents/quick-start"},{label:"Workflows quick start",meta:"Typed steps, gates and exits",href:"https://docs.sapiom.ai/workflows/quick-start"},{label:"AI models",meta:"Which models a capability can call",href:"https://docs.sapiom.ai/capabilities/ai-models"},{label:"MCP servers: setup",meta:"Connect a server to a workspace",href:"https://docs.sapiom.ai/integration/mcp-servers/setup"},{label:"MCP servers: remote",meta:"Reach a server you do not host",href:"https://docs.sapiom.ai/integration/mcp-servers/remote"}],dv=1,hv=12,n2=10,i2=20,y$=25,b$=e=>-(3+Math.min(e,9)),S$=new Set(["/","\\","-","_",".",":"," "]),CS=e=>e>="0"&&e<="9",w$=e=>e!==e.toUpperCase()&&e===e.toLowerCase(),x$=e=>e!==e.toLowerCase()&&e===e.toUpperCase();function C$(e){const t=new Array(e.length);for(let n=0;n<e.length;n++){if(n===0){t[n]=!0;continue}const r=e[n-1],o=e[n];t[n]=S$.has(r)||CS(o)!==CS(r)||x$(o)&&w$(r)}return t}function E$(e,t,n,r){var S;const o=e.length,c=t.length,h=(w,A)=>{let E=dv;n[A]&&(E+=hv),A===w+1&&(E+=n2);const y=A-w-1;return y>=1&&(E+=b$(y)),E},l=new Map,u=(w,A)=>{if(w===o-1)return 0;const E=w*c+A,y=l.get(E);if(y!==void 0)return y.score;const b=e[w+1];let v=Number.NEGATIVE_INFINITY,_=-1;if(A+1<c&&t[A+1]===b){const k=h(A,A+1)+u(w+1,A+1);k>v&&(v=k,_=A+1)}for(const k of r.get(b)??[]){if(k<=A+1)continue;const C=h(A,k)+u(w+1,k);C>v&&(v=C,_=k)}return l.set(E,{score:v,next:_}),v};let m=Number.NEGATIVE_INFINITY,g=-1;for(const w of r.get(e[0])??[]){const E=dv+hv+(w===0?i2:0)+u(0,w);E>m&&(m=E,g=w)}if(g===-1||!Number.isFinite(m))return null;const p=[g];for(let w=0,A=g;w<o-1;w++){const E=((S=l.get(w*c+A))==null?void 0:S.next)??-1;p.push(E),A=E}return{score:m,indices:p}}function k$(e,t,n){let r=null;for(let c=0;;){const h=t.indexOf(e,c);if(h===-1)break;let l=h===0?i2:0;for(let u=0;u<e.length;u++)l+=dv,n[h+u]&&(l+=hv),u>0&&(l+=n2);(r===null||l>r.score)&&(r={score:l,start:h}),c=h+1}if(r===null)return null;const o=r.start;return{score:r.score,indices:Array.from({length:e.length},(c,h)=>o+h)}}function tg(e){let t="";for(let n=0;n<e.length;n++){const r=e[n].toLowerCase();t+=r.length===1?r:e[n]}return t}function ES(e,t){const n=[...new Set(tg(e).split(/\s+/).filter(Boolean))];if(n.length===0)return{score:0,indices:[]};if(!t)return null;const r=tg(t),o=C$(t),c=new Map;for(let u=0;u<t.length;u++){if(!o[u])continue;const m=r[u],g=c.get(m);g?g.push(u):c.set(m,[u])}let h=0;const l=new Set;for(const u of n){if(u.length>r.length)return null;const m=E$(u,r,o,c),g=k$(u,r,o),p=m&&g?m.score>=g.score?m:g:m??g;if(!p)return null;h+=p.score;for(const S of p.indices)l.add(S)}return tg(e.trim())===r&&(h+=y$),{score:h,indices:[...l].sort((u,m)=>u-m)}}function kS(e,t){var n;return(n=t[e.id])!=null&&n.trim()?!1:!e.title||e.title===zs(e.cwd)}function Kh(e,t,n){var l;const r=(l=n[e.id])==null?void 0:l.trim();if(r)return r;if(!kS(e,n))return e.title;const o=zs(e.cwd),h=t.filter(u=>u.cwd===e.cwd&&(u.status!=="exited"||u.id===e.id)&&kS(u,n)).sort((u,m)=>u.createdAt.localeCompare(m.createdAt)||u.id.localeCompare(m.id)).findIndex(u=>u.id===e.id);return h>0?`${o} ${h+1}`:o}const oc=[{id:"all",label:"All",icon:"Search"},{id:"sessions",label:"Sessions",icon:"Radio"},{id:"agents",label:"Agents",icon:"Workflow"},{id:"templates",label:"Templates",icon:"LayoutTemplate"},{id:"docs",label:"Docs",icon:"BookOpen"},{id:"files",label:"Files",icon:"Folder"},{id:"actions",label:"Actions",icon:"Zap"}],j$={templates:{label:"Browse templates",actionId:"browse-templates"},docs:{label:"Open documentation",href:v$}},R$=6,A$=6,id=20,T$=6,r2=36e5,sg=24*r2;function jS(e,t){if(t<=0)return 0;const n=e-t;return n<=r2?30:n<=sg?20:n<=7*sg?12:n<=30*sg?6:0}const rd=e=>{const t=Date.parse(e);return Number.isNaN(t)?0:t},N$=(e,t)=>e.item.recency!==t.item.recency?e.item.recency>t.item.recency:e.fromRegistry!==t.fromRegistry?e.fromRegistry:e.count>t.count;function M$(e){const{sessions:t,workflows:n,history:r,recentDirs:o,sessionNames:c,actions:h,templates:l,activeSessionId:u}=e,m=t.filter(x=>x.status!=="exited").map(x=>({id:`session:${x.id}`,kind:"session",label:Kh(x,t,c),meta:x.cwd,sessionId:x.id,current:x.id===u||void 0,recency:rd(x.lastActiveAt)})),g=new Set(t.map(x=>x.id)),p=new Set(t.map(x=>x.agentSessionId).filter(x=>x!=null)),S=[...t.filter(x=>x.status==="exited").map(x=>({item:{id:`past:${x.id}`,kind:"past",label:Kh(x,t,c),meta:x.cwd,sessionId:x.id,recency:rd(x.lastActiveAt)},cwd:x.cwd,count:0,fromRegistry:!0})),...r.filter(x=>!(x.harnessSessionId!=null&&g.has(x.harnessSessionId))&&!p.has(x.agentSessionId)).map(x=>{var T;return{item:{id:`summary:${x.agentSessionId}`,kind:"past",label:((T=c[x.harnessSessionId??""])==null?void 0:T.trim())||x.title,meta:x.cwd,summary:x,recency:rd(x.lastActiveAt)},cwd:x.cwd,count:x.turnCount??x.messageCount??0,fromRegistry:!1}})],w=new Map;for(const x of S){const T=`${x.item.label.trim()}\0${x.cwd}`,R=w.get(T);(!R||N$(x,R))&&w.set(T,x)}const A=[...w.values()].map(x=>x.item).sort((x,T)=>T.recency-x.recency),E=x=>{let T=0;for(const M of t){if(M.boundWorkflowPath!==x.path&&!Li(x.path,M.cwd))continue;const D=rd(M.lastActiveAt);D>T&&(T=D)}if(T>0)return T;const R=o.findIndex(M=>Li(M,x.path)||Li(x.path,M));return R===-1?0:o.length-R},y=n.map(x=>({id:`agent:${x.path}`,kind:"agent",label:Wr(x.name),meta:x.path,path:x.path,recency:E(x)})),b=new Set(n.map(x=>x.path)),v=o.filter(x=>!b.has(x)).map(x=>({id:`recent:${x}`,kind:"recent",label:zs(x),meta:x,path:x,recency:o.length-o.indexOf(x)})),_=h.map(x=>({id:`command:${x.id}`,kind:"command",label:x.label,meta:x.meta??"",icon:x.icon,run:x.run,recency:0})),k=_$.map(x=>({id:`doc:${x.href}`,kind:"doc",label:x.label,meta:x.meta,href:x.href,recency:0})),C=l.map(x=>({id:`template:${x.id}`,kind:"template",label:x.name,meta:x.description,templateId:x.id,recency:0}));return[...m,...A,...y,...v,...C,...k,..._]}const RS={session:0,agent:1,past:2,recent:3,template:4,doc:5,command:6,path:7},$$={all:["session","agent","past","recent","template","doc","command"],sessions:["session","past"],agents:["agent"],templates:["template"],docs:["doc"],files:["recent"],actions:["command"]},fv=(e,t)=>e.filter(n=>n.kind===t);function xa(e,t){const n=fv(e,t);return t==="session"?n.sort((r,o)=>(r.current?1:0)-(o.current?1:0)||o.recency-r.recency):t==="past"?n.sort((r,o)=>o.recency-r.recency):t==="agent"?n.sort((r,o)=>o.recency-r.recency||r.label.localeCompare(o.label)):t==="recent"?n.sort((r,o)=>o.recency-r.recency):n}function D$(e,t,n={}){const r=n.filter??"all",o=n.now??Date.now(),c=$$[r],h=e.trim();if(!h){if(r!=="all")return c.flatMap(p=>xa(t,p)).slice(0,id);const g=fv(t,"command");return[...xa(t,"session"),...xa(t,"past").slice(0,R$),...xa(t,"agent").slice(0,T$),...xa(t,"recent"),...xa(t,"template"),...xa(t,"doc")].slice(0,Math.max(0,id-g.length)).concat(g)}const l=g=>{const p=ES(h,g.label);if(p)return{item:{...g,labelIndices:p.indices},fieldRank:0,boosted:p.score+jS(o,g.recency),matchedLength:g.label.length};const S=g.meta?ES(h,g.meta):null;return S?{item:{...g,metaIndices:S.indices},fieldRank:1,boosted:S.score+jS(o,g.recency),matchedLength:g.meta.length}:null},u=c.map(g=>({kind:g,scored:fv(t,g).map(l).filter(p=>p!==null).sort((p,S)=>p.fieldRank-S.fieldRank||S.boosted-p.boosted||S.item.recency-p.item.recency||p.matchedLength-S.matchedLength||p.item.label.localeCompare(S.item.label))})).filter(g=>g.scored.length>0),m=u.length>1?A$:id;return u.sort((g,p)=>{const S=g.scored[0],w=p.scored[0];return S.fieldRank-w.fieldRank||w.boosted-S.boosted||RS[g.kind]-RS[p.kind]}).flatMap(g=>g.scored.slice(0,m).map(p=>p.item)).slice(0,id)}function O$(e,t){const n=e.trim();return[...n?[{id:`confirm:${n}`,kind:"path",label:n,meta:"Open this path",path:n,recency:0}]:[],...t.map(o=>({id:`dir:${o.path}`,kind:"path",label:o.name,meta:o.path,path:o.path,recency:0}))]}function L$(e){switch(e.kind){case"command":return e.run?{type:"run",run:e.run}:{type:"none"};case"doc":return e.href?{type:"open-href",href:e.href}:{type:"none"};case"template":return e.templateId?{type:"open-template",templateId:e.templateId}:{type:"none"};case"session":return e.sessionId?{type:"select-session",sessionId:e.sessionId}:{type:"none"};case"past":return e.sessionId?{type:"select-session",sessionId:e.sessionId}:e.summary?{type:"review-summary",summary:e.summary}:{type:"none"};case"agent":case"recent":case"path":return e.path?{type:"open-path",path:e.path}:{type:"none"}}}const I$=/^[a-z0-9][a-z0-9-]{0,213}$/,t_="sapiom-agent",P$=3,AS=32,B$=new Set(["a","an","and","any","are","as","at","be","can","could","do","each","every","for","from","get","i","if","in","into","is","it","its","just","me","my","need","of","on","once","or","our","please","should","so","that","the","their","them","then","there","this","to","us","want","we","when","with","would","you","your","daily","day","hourly","hour","week","weekly","month","monthly","morning","evening","night","always","regularly"]);function a2(e){return I$.test(e)}function z$(e){var h;const t=e.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),n=t.filter(l=>!B$.has(l)),r=n.length>0?n:t,o=[];for(const l of r.slice(0,P$)){if((o.length===0?l:`${o.join("-")}-${l}`).length>AS)break;o.push(l)}const c=o.join("-")||((h=r[0])==null?void 0:h.slice(0,AS))||"";return a2(c)?c:t_}function o2(e,t){const n=(t==null?void 0:t.trim())??"",r=e.trim();return!n.replace(/[\\/]+$/,"")||!r?"":Mv(n,r)}function H$(e){var t,n,r;return((t=e.settingsRoot)==null?void 0:t.trim())||((n=e.defaultProjectRoot)==null?void 0:n.trim())||((r=e.launchDir)==null?void 0:r.trim())||""}const U$=Pc;function F$(e,t){const n=new Set(t);if(!n.has(e))return e;for(let r=2;r<1e3;r+=1){const o=`${e}-${r}`;if(!n.has(o)&&a2(o))return o}return e}const Yh=[{kind:"starter",id:"default",name:"Default starter",description:"A minimal two-step starter."},{kind:"starter",id:"coding-pause",name:"Coding pause",description:"The launch + pauseUntilSignal + resume pattern for a non-blocking coding-agent run."}],q$={starter:"Starter","product-engineering":"Product and engineering","reliability-governance":"Reliability and governance","revenue-marketing":"Revenue and marketing","customer-experience":"Customer experience","data-knowledge":"Data and knowledge","finance-legal-people":"Finance, legal and people"};function V$(e){return e?q$[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function s_(e){return e!=null&&e.label?e.score>0?`${e.label} ${e.score}/5`:e.label:"—"}function l2(e){const{basis:t}=e,n=[];t.llmSteps>0&&n.push(`${t.llmSteps} model ${t.llmSteps===1?"step":"steps"}`),t.chainedLlmSteps>0&&n.push(`${t.chainedLlmSteps} chained`),t.mediaCapabilities>0&&n.push(`${t.mediaCapabilities} media ${t.mediaCapabilities===1?"generator":"generators"}`),n.push(`${t.stepCount} ${t.stepCount===1?"step":"steps"}`),t.capabilityCount>0&&n.push(`${t.capabilityCount} ${t.capabilityCount===1?"capability":"capabilities"}`);const r=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${n.join(", ")}${r}`}function G$(e){return`${e.label}: ${l2(e)}`}function TS(e,t){const n=t.trim().toLowerCase();return n?[e.name,e.description,e.id,...e.kind==="gallery"?e.tags:[],...e.kind==="gallery"?e.capabilities:[]].join(" ").toLowerCase().includes(n):!0}function W$(e,t){const n="When the project is ready, offer a local test run with no Sapiom capability spend (sapiom_dev_agents_run_local) as the next step.";return e.kind==="gallery"?`Clone the Sapiom gallery template "${e.id}" into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and templateId "${e.id}". If it reports you are not authenticated, run sapiom_authenticate first and retry. After the clone, read the project's AGENTS.md and run npm install. `+n:`Scaffold the "${e.id}" starter in this directory: ${pv(t,e.id)}, then run npm install and read AGENTS.md. Keep the shipped starter unchanged until the user describes what to build. `+n}function K$(e,t){return`Clone the deployed Sapiom agent (definition ${e}) into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and definitionId "${e}". If it reports you are not authenticated, run sapiom_authenticate first and retry. After the clone, read the project's AGENTS.md and run npm install. When the project is ready, offer a local test run with no Sapiom capability spend (sapiom_dev_agents_run_local) as the next step.`}function pv(e,t){return"call the sapiom_dev_agents_scaffold tool with "+JSON.stringify({dir:e,template:t})}function Y$(e){var o,c;const t=e.steps.map(h=>({id:h.name,kind:h.kind,label:h.name,role:h.kind.startsWith("terminal")?"terminal":h.kind==="entry"?"entry":"step",description:h.description??"",timeoutMs:null,inputSchema:null,capabilities:h.capabilities})),n=new Map;for(const h of e.transitions)h.kind==="continue"&&n.set(h.from,(n.get(h.from)??0)+1);const r=e.transitions.map(h=>({from:h.from,to:h.to,kind:h.kind==="pause"?"cross":(n.get(h.from)??0)>1?"branching":"sequential",label:h.label??""}));return{name:e.name,entry:((o=e.steps.find(h=>h.kind==="entry"))==null?void 0:o.name)??((c=e.steps[0])==null?void 0:c.name)??"",nodes:t,edges:r,groups:[],warnings:[]}}function X$(e,t){const n=e.kind==="starter"&&e.id==="default"?t_:e.id;return o2(n,t)}function J$(e){const t=O.useRef(null),[n,r]=O.useState(null),o=O.useCallback(()=>{const l=t.current;if(!l)return;const u=l.querySelector('[aria-selected="true"]');if(!u){r(null);return}const m=l.getBoundingClientRect(),g=u.getBoundingClientRect();r({x:g.left-m.left+l.scrollLeft,w:g.width})},[]),c=O.useRef(null),h=O.useCallback(l=>{var u;(u=c.current)==null||u.disconnect(),t.current=l,l&&(o(),!(typeof ResizeObserver>"u")&&(c.current=new ResizeObserver(o),c.current.observe(l)))},[o]);return O.useLayoutEffect(()=>{o()},[e,o]),O.useLayoutEffect(()=>()=>{var l;return(l=c.current)==null?void 0:l.disconnect()},[]),{trackRef:h,style:n?{transform:`translateX(${n.x}px)`,width:`${n.w}px`,opacity:1}:{opacity:0}}}const Z$={command:"Zap",doc:"BookOpen",session:"Radio",past:"History",agent:"Workflow",recent:"Folder",path:"Folder",template:"LayoutTemplate"},ng={command:"Actions",doc:"Documentation",session:"Sessions",past:"Past sessions",agent:"Agents",recent:"Folders",path:"Folders",template:"Templates"},Q$=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),eD=Q$?"⌘":"Ctrl";function NS(e,t){if(!t||t.length===0)return e;const n=new Set(t),r=[];let o="",c=n.has(0);const h=l=>{o&&(r.push(c?d.jsx("b",{className:"palette-match",children:o},l):o),o="")};for(let l=0;l<e.length;l++){const u=n.has(l);u!==c&&(h(l),c=u),o+=e[l]}return h(e.length),r}function tD({sessions:e,workflows:t,recentDirs:n,history:r,sessionNames:o,activeSessionId:c,actions:h,listDir:l,listTemplates:u,onSelectSession:m,onReviewSummary:g,onOpenPath:p,onOpenTemplate:S,onClose:w}){const[A,E]=O.useState(""),[y,b]=O.useState("all"),[v,_]=O.useState([]),[k,C]=O.useState([]),[x,T]=O.useState(!1),[R,M]=O.useState(!1),[D,L]=O.useState(0),q=J$(y),F=O.useRef(null);O.useEffect(()=>{var B;(B=F.current)==null||B.focus()},[]),O.useEffect(()=>{let B=!1;return _(Yh.map(({id:$,name:H,description:U})=>({id:$,name:H,description:U}))),u().then($=>{B||_([...$.templates.map(({id:H,name:U,description:P})=>({id:H,name:U,description:P})),...Yh.map(({id:H,name:U,description:P})=>({id:H,name:U,description:P}))])}).catch(()=>{}),()=>{B=!0}},[u]);const Y=AR(A);O.useEffect(()=>{if(!Y){C([]),M(!1);return}let B=!1;T(!0),M(!1);const $=setTimeout(()=>{l(A).then(H=>{B||C(H.dirs)}).catch(()=>{B||(C([]),M(!0))}).finally(()=>!B&&T(!1))},150);return()=>{B=!0,clearTimeout($)}},[A,Y,l]);const Q=O.useMemo(()=>Y?O$(A,k):D$(A,M$({sessions:e,workflows:t,history:r,recentDirs:n,sessionNames:o,actions:h,templates:v,activeSessionId:c}),{filter:y}),[A,Y,k,e,t,n,r,o,c,h,v,y]);O.useEffect(()=>{const B=Q.findIndex($=>!$.current);L(B===-1?0:B)},[Q,A,y]);const G=Y?void 0:j$[y],ee=B=>{const $=L$(B);switch($.type){case"run":$.run();break;case"open-href":window.open($.href,"_blank","noopener,noreferrer");break;case"open-template":S($.templateId);break;case"select-session":m($.sessionId);break;case"review-summary":g($.summary);break;case"open-path":p($.path);break}w()},ne=B=>{b($=>{const U=(oc.findIndex(P=>P.id===$)+B+oc.length)%oc.length;return oc[U].id})},z=B=>{if(B.key==="ArrowDown")B.preventDefault(),L($=>Math.min($+1,Q.length-1));else if(B.key==="ArrowUp")B.preventDefault(),L($=>Math.max($-1,0));else if(B.key==="Tab"&&!Y)B.preventDefault(),ne(B.shiftKey?-1:1);else if(B.key==="Enter"){B.preventDefault();const $=Q[D];$&&ee($)}else B.key==="Escape"&&(A?E(""):w())};return d.jsx("div",{className:"modal-backdrop",onClick:w,children:d.jsxs("div",{className:"modal command-palette",onClick:B=>B.stopPropagation(),...Dt({dialog:"command_palette"}),children:[d.jsxs("div",{className:"command-palette-search",children:[d.jsx(ue,{name:"Search",size:16}),d.jsx("input",{ref:F,className:"command-palette-input","data-testid":"command-palette-input","aria-label":"Jump to a session, agent, or path",placeholder:"Jump to a session, agent, or path…",value:A,onChange:B=>E(B.target.value),onKeyDown:z}),A&&d.jsx("button",{type:"button",className:"command-palette-clear","data-testid":"command-palette-clear","aria-label":"Clear search",onClick:()=>{var B;E(""),(B=F.current)==null||B.focus()},children:d.jsx(ue,{name:"X",size:14})})]}),!Y&&d.jsxs("div",{ref:q.trackRef,className:"command-palette-filters tab-track",role:"tablist","aria-label":"Search filter",children:[d.jsx("span",{className:"tab-indicator",style:q.style,"aria-hidden":"true"}),oc.map(B=>d.jsxs("button",{type:"button",role:"tab","aria-selected":y===B.id,className:"command-palette-filter"+(y===B.id?" is-active":""),"data-testid":`command-palette-filter-${B.id}`,onClick:()=>{var $;b(B.id),($=F.current)==null||$.focus()},children:[d.jsx(ue,{name:B.icon,size:14}),B.label]},B.id))]}),d.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[Y&&x&&d.jsx("div",{className:"command-palette-empty",children:"Loading…"}),Y&&R&&!x&&d.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),Q.length===0&&!x&&!R&&d.jsx("div",{className:"command-palette-empty",children:"No matches"}),Q.map((B,$)=>d.jsxs("div",{className:"command-palette-row",children:[!Y&&($===0||ng[B.kind]!==ng[Q[$-1].kind])&&d.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:ng[B.kind]}),d.jsxs("button",{type:"button",className:"command-palette-item"+($===D?" is-selected":"")+(B.current?" is-current":""),"data-testid":`command-palette-item-${$}`,onMouseEnter:()=>L($),onClick:()=>ee(B),children:[d.jsx(ue,{name:B.icon??Z$[B.kind],size:14}),d.jsx("span",{className:"command-palette-item-label",children:NS(B.label,B.labelIndices)}),B.current&&d.jsx("span",{className:"command-palette-current",children:"current"}),d.jsx("span",{className:"command-palette-item-meta","data-code":B.path!=null||B.kind==="session"||B.kind==="past"||void 0,children:B.meta?NS(B.meta,B.metaIndices):null})]})]},B.id))]}),d.jsxs("div",{className:"command-palette-footer","data-testid":"command-palette-footer",children:[d.jsxs("span",{children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," navigate"]}),!Y&&d.jsxs("span",{children:[d.jsx("kbd",{children:"tab"})," category"]}),d.jsxs("span",{children:[d.jsx("kbd",{children:"↵"})," open"]}),d.jsxs("span",{children:[d.jsx("kbd",{children:"esc"})," close"]}),G?d.jsxs("button",{type:"button",className:"btn-ghost command-palette-footer-cta","data-testid":"command-palette-destination",onClick:()=>{if(G.href)window.open(G.href,"_blank","noopener,noreferrer");else if(G.actionId){const B=h.find($=>$.id===G.actionId);B&&(B.run(),w())}},children:[G.label,d.jsx(ue,{name:G.href?"ExternalLink":"ArrowRight",size:14})]}):d.jsxs("span",{className:"command-palette-footer-mod",children:[d.jsx("kbd",{children:eD}),d.jsx("kbd",{children:"K"})," anytime"]})]})]})})}const sD={offline:{icon:"CloudOff",title:"You're offline",body:"Agent Studio can't reach the network. Check your connection — the moment you're back, retry to pick up right where you left off."},auth:{icon:"Plug",title:"Session needs a refresh",body:"Your credential was rejected — it may have rotated or expired. Retry to reconnect with the current key; you won't lose your place."},error:{icon:"TriangleAlert",title:"Couldn't reach Agent Studio",body:"The server didn't respond as expected. This is usually temporary — retry in a moment."}};function nD({status:e,onRetry:t,retrying:n=!1,detail:r,onStartAuth:o}){const c=sD[e],[h,l]=O.useState({status:"idle"}),u=async()=>{if(o){l({status:"pending"});try{await o(),l({status:"idle"})}catch(m){const g=m instanceof Error?m.message:"Could not start sign-in. Try again.";l({status:"error",message:g})}}};return d.jsx("div",{className:"app-status connectivity-screen","data-testid":"connectivity-screen","data-status":e,role:"alert",children:d.jsxs("div",{className:"connectivity-screen-inner",children:[d.jsx("span",{className:"connectivity-screen-icon","aria-hidden":"true",children:d.jsx(ue,{name:c.icon,size:22})}),d.jsx("span",{className:"connectivity-screen-title",children:c.title}),d.jsx("span",{className:"connectivity-screen-body",children:c.body}),e==="error"&&r&&d.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:r}),d.jsx("button",{className:"btn-primary connectivity-screen-retry","data-testid":"connectivity-retry",onClick:t,disabled:n||h.status==="pending",children:n?"Reconnecting…":"Retry"}),e==="auth"&&o&&d.jsxs("div",{className:"connectivity-screen-auth-section",children:[h.status==="pending"?d.jsxs("span",{className:"connectivity-auth-pending","data-testid":"connectivity-auth-pending",children:[d.jsx(ue,{name:"Loader",size:14}),"Opening browser… waiting for sign-in"]}):d.jsxs("button",{className:"btn-secondary connectivity-connect-btn","data-testid":"connectivity-connect-btn",onClick:()=>void u(),children:[d.jsx(ue,{name:"Plug",size:14}),"Connect account"]}),h.status==="error"&&d.jsx("span",{className:"connectivity-auth-error","data-testid":"connectivity-auth-error",children:h.message})]})]})})}function iD({onDismiss:e}){return d.jsxs("div",{className:"connectivity-banner",role:"status","data-testid":"connectivity-banner",children:[d.jsx("span",{className:"connectivity-banner-icon","aria-hidden":"true",children:d.jsx(ue,{name:"CloudOff",size:14})}),d.jsx("span",{className:"connectivity-banner-text",children:"You're offline. Agent Studio stays usable, but live actions (runs, deploys, the terminal) pause until your connection returns."}),e&&d.jsx("button",{className:"connectivity-banner-dismiss","aria-label":"Dismiss offline notice","data-testid":"connectivity-banner-dismiss",onClick:e,children:"×"})]})}function rD(e,t,n){const r=new Map;for(const o of t)r.has(o.agentSessionId)||r.set(o.agentSessionId,o);for(const o of e)n.has(o.cwd)||r.has(o.agentSessionId)||r.set(o.agentSessionId,o);return Array.from(r.values()).sort((o,c)=>c.lastActiveAt.localeCompare(o.lastActiveAt))}const aD=12;function c2(e,t,n){var c;const r=[],o=h=>{h&&!r.includes(h)&&r.push(h)};return o((c=e.find(h=>h.id===n))==null?void 0:c.cwd),e.forEach(h=>o(h.cwd)),t.forEach(h=>o(h)),r.slice(0,aD)}const Ba={"claude-code":"Claude Code",codex:"Codex"};function u2(e,t=Date.now()){const n=t-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function oD(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(!Number.isFinite(n)||n<=0)return null;const r=Math.floor(n/6e4);if(r<1)return"under a minute";if(r<60)return`${r}m`;const o=Math.floor(r/60);return o<24?`${o}h ${r%60}m`:`${Math.floor(o/24)}d ${o%24}h`}function MS(e){return e.resumeMode===void 0?"checking":e.resumeMode==="agent-resume"?"resume":(e.turnCount??e.messageCount??0)>0?"from-summary":"empty"}function lD(e){switch(e){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function mv(e,t=Date.now(),n={}){const r=[];n.includeHarness!==!1&&r.push(Ba[e.harness]),e.gitBranch&&r.push(e.gitBranch);const o=e.turnCount??e.messageCount;o!=null&&o>0&&r.push(`${o} ${o===1?"turn":"turns"}`);const c=n.state?lD(n.state):null;return c&&r.push(c),r.push(u2(e.lastActiveAt,t)),r.join(" · ")}function d2(e,t){const[n,r]=O.useState(e===null?{status:"empty"}:{status:"loading"});return O.useEffect(()=>{if(e===null){r({status:"empty"});return}let o=!1;return r({status:"loading"}),t(e).then(c=>{o||r(c?{status:"ready",record:c}:{status:"empty"})},c=>{o||r({status:"error",message:c instanceof Error?c.message:String(c)})}),()=>{o=!0}},[e,t]),n}function h2({text:e}){const t=e.split(`
480
+ `),n=[];let r=0,o=0;function c(){return o++}function h(l){const u=[],m=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*)/g;let g=0,p;for(;(p=m.exec(l))!==null;){p.index>g&&u.push(l.slice(g,p.index));const S=p[0];S.startsWith("`")&&S.endsWith("`")?u.push(d.jsx("code",{className:"chat-inline-code",children:S.slice(1,-1)},c())):S.startsWith("**")&&S.endsWith("**")?u.push(d.jsx("strong",{children:S.slice(2,-2)},c())):S.startsWith("*")&&S.endsWith("*")?u.push(d.jsx("em",{children:S.slice(1,-1)},c())):u.push(S),g=p.index+S.length}return g<l.length&&u.push(l.slice(g)),u}for(;r<t.length;){const l=t[r];if(l.startsWith("```")){const p=l.slice(3).trim(),S=[];for(r++;r<t.length&&!t[r].startsWith("```");)S.push(t[r]),r++;r++,n.push(d.jsx("pre",{className:"chat-code-block","data-lang":p||void 0,children:d.jsx("code",{className:p?`language-${p}`:void 0,children:S.join(`
481
+ `)})},c()));continue}const u=l.match(/^(#{1,3})\s+(.+)/);if(u){const S=`h${u[1].length}`;n.push(d.jsx(S,{className:"chat-heading",children:h(u[2])},c())),r++;continue}if(l.startsWith("> ")){n.push(d.jsx("blockquote",{className:"chat-blockquote",children:h(l.slice(2))},c())),r++;continue}if(/^- \[[ x]\]/.test(l)){const p=[];for(;r<t.length&&/^- \[[ x]\]/.test(t[r]);){const S=t[r][3]==="x";p.push({text:t[r].replace(/^- \[[ x]\]\s?/,""),checked:S}),r++}n.push(d.jsx("ul",{className:"chat-list chat-checklist",children:p.map((S,w)=>d.jsx("li",{children:h(S.text)},w))},c()));continue}if(/^[-*+]\s+/.test(l)){const p=[];for(;r<t.length&&/^[-*+]\s+/.test(t[r]);){const S=t[r].replace(/^[-*+]\s+/,"");p.push(d.jsx("li",{children:h(S)},c())),r++}n.push(d.jsx("ul",{className:"chat-list",children:p},c()));continue}if(!l.trim()){r++;continue}const m=p=>p.startsWith("```")||/^#{1,3}\s+/.test(p)||p.startsWith("> ")||/^[-*+]\s+/.test(p),g=[l];for(r++;r<t.length&&t[r].trim()&&!m(t[r]);)g.push(t[r]),r++;n.push(d.jsx("p",{className:"chat-paragraph",children:h(g.join(" "))},c()))}return d.jsx(d.Fragment,{children:n})}const $S={"assistant-narration-gap":"Only each turn's final assistant message was recorded — anything said between tool calls is missing.","truncated-tool-output":"Large tool results were truncated when recorded and can't be shown in full.","missing-assistant-text":"This agent doesn't report assistant text to the harness, so replies aren't shown.","incomplete-final-turn":"The last turn never completed — the session ended while it was still running.","compacted-archive":"Read from this session's archived copy: the conversation is whole, but tool inputs and results were shortened to keep it small enough to keep.","dropped-early-turns":"The archived copy only had room for the most recent turns — earlier ones are gone."},cD=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function uD(e){const t=new Set(e),n=cD.filter(o=>t.has(o)).map(o=>$S[o]),r=[...t].filter(o=>!(o in $S)).map(o=>`Known gap reported by the harness: ${o}.`);return[...n,...r]}function dD(e){if(!e)return null;const t=[];return e.inputTokens!=null&&t.push(`${DS(e.inputTokens)} in`),e.outputTokens!=null&&t.push(`${DS(e.outputTokens)} out`),t.length>0?t.join(" · "):null}function DS(e){if(e<1e3)return String(e);const t=e/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function f2(e,t=Date.now()){if(!e)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),o=new Date(t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()&&n.getDate()===o.getDate()?r:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${r}`}function hD(e,t){const n=e??"unknown tool";if(!t)return n;const r=t.replace(/\s+/g," ").trim();if(!r)return n;const o=r.length>80?`${r.slice(0,80)}…`:r;return`${n} · ${o}`}function fD({record:e}){const t=uD(e.limitations),n=f2(e.archivedAt);return d.jsxs("div",{className:"transcript","data-testid":"session-transcript",children:[d.jsxs("div",{className:"transcript-notice","data-testid":"transcript-reconstructed",children:[d.jsx("span",{className:"transcript-badge",children:"Reconstructed"}),d.jsxs("div",{className:"transcript-notice-body",children:[d.jsx("p",{className:"transcript-notice-lead",children:"Rebuilt from the harness's own recording of this session, not a replay of your terminal."}),e.archivedAt!==null&&d.jsx("p",{className:"transcript-notice-lead transcript-notice-archived","data-testid":"transcript-archived",children:n?`Archived copy from ${n}, kept after this session's raw events aged out of the local log.`:"Archived copy, kept after this session's raw events aged out of the local log."}),t.length>0&&d.jsx("ul",{className:"transcript-notice-list","data-testid":"transcript-limitations",children:t.map(r=>d.jsx("li",{children:r},r))})]})]}),d.jsx("ol",{className:"transcript-turns",children:e.turns.map(r=>d.jsx(pD,{turn:r},r.index))})]})}function pD({turn:e}){const t=dD(e.usage),n=f2(e.promptAt);return d.jsxs("li",{className:"transcript-turn","data-testid":"transcript-turn","data-turn":e.index,children:[d.jsxs("div",{className:"transcript-role transcript-role-user",children:[d.jsx("span",{className:"transcript-role-label",children:"You"}),n&&d.jsx("span",{className:"transcript-time",children:n})]}),e.prompt!==null?d.jsx("div",{className:"transcript-prompt","data-testid":"transcript-prompt",children:e.prompt}):d.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-prompt",children:"No prompt recorded for this turn — the harness started recording after it began."}),e.toolCalls.length>0&&d.jsx("ul",{className:"transcript-tools","data-testid":"transcript-tools",children:e.toolCalls.map((r,o)=>d.jsx(mD,{call:r},`${r.at}-${o}`))}),d.jsxs("div",{className:"transcript-role transcript-role-agent",children:[d.jsx("span",{className:"transcript-role-label",children:"Agent"}),e.model&&d.jsx("span",{className:"transcript-model",children:e.model}),t&&d.jsx("span",{className:"transcript-usage",children:t})]}),e.assistantText!==null?d.jsx("div",{className:"transcript-assistant","data-testid":"transcript-assistant",children:d.jsx(h2,{text:e.assistantText})}):d.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-assistant",children:e.incomplete?"This turn never completed — no reply was recorded.":"No assistant text was recorded for this turn."}),e.incomplete&&d.jsx("div",{className:"transcript-incomplete","data-testid":"transcript-incomplete",children:"Turn incomplete"})]})}function mD({call:e}){return d.jsx("li",{className:"transcript-tool",children:d.jsxs("details",{"data-testid":"transcript-tool-call",children:[d.jsxs("summary",{className:"transcript-tool-summary",children:[d.jsx("span",{className:"transcript-tool-name",children:hD(e.name,e.input)}),e.responseTruncated&&d.jsx("span",{className:"transcript-tool-truncated","data-testid":"transcript-tool-truncated",children:"truncated"})]}),d.jsxs("div",{className:"transcript-tool-body",children:[e.input&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"transcript-tool-heading",children:"Input"}),d.jsx("pre",{className:"transcript-tool-pre",children:e.input})]}),d.jsx("div",{className:"transcript-tool-heading",children:"Result"}),e.responseSummary?d.jsx("pre",{className:"transcript-tool-pre",children:e.responseSummary}):d.jsx("div",{className:"transcript-absent",children:"No result recorded."}),e.responseTruncated&&d.jsx("div",{className:"transcript-absent",children:"The recorded result was truncated at the collector's size cap; the rest isn't recoverable."})]})]})})}function OS(e){return e.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${Ba[e.harness]} has no saved conversation for this session, so there's nothing to hand back. That happens when a session ends before its first prompt — the coding agent never writes a transcript for those.`}function gD({session:e,resumeMode:t,loadRecord:n,onResume:r,onContinue:o,onClose:c}){const h=e.agentSessionId!=null&&t!=="rehydrate",l=oD(e.createdAt,e.lastActiveAt),u=d2(e.id,n),m=u.status!=="empty",g=!h&&u.status==="ready";return d.jsxs("div",{className:"dead-session-pane","data-testid":"dead-session-pane","data-has-record":m,...Dt({surface:"session_history"}),children:[d.jsxs("div",{className:"dead-session-summary",...Dt({object:"session"}),children:[d.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:d.jsx(ue,{name:"SquareTerminal",size:18})}),d.jsx("div",{className:"dead-session-title",children:"Session exited"}),d.jsxs("div",{className:"dead-session-meta",children:[e.cwd,e.exitCode!=null&&` · exit code ${e.exitCode}`]}),d.jsxs("dl",{className:"dead-session-detail","data-testid":"dead-session-detail",children:[e.title&&d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Session"}),d.jsx("dd",{children:e.title})]}),d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Coding agent"}),d.jsx("dd",{children:Ba[e.harness]})]}),l&&d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Ran for"}),d.jsx("dd",{children:l})]}),d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Ended"}),d.jsx("dd",{children:u2(e.lastActiveAt)})]})]}),d.jsxs("div",{className:"dead-session-actions",children:[g?d.jsx("button",{className:"btn-primary","data-testid":"dead-session-continue",onClick:o,children:"Continue here"}):d.jsx("button",{className:"btn-primary","data-testid":"dead-session-resume",onClick:r,disabled:!h,title:h?void 0:OS(e),children:"Resume"}),d.jsx("button",{className:"btn-ghost","data-testid":"dead-session-close",onClick:c,children:"Close"})]}),!h&&d.jsxs("div",{className:"dead-session-resume-reason","data-testid":"dead-session-resume-reason",children:[OS(e)," ",g?"Continuing opens a fresh session in this directory, seeded with the reconstruction below — a briefing about this session, not its context. The new coding agent will need to check the repository before relying on any of it.":"Start a new session in this directory instead; there is no recording of this one to carry over either."]})]}),e.exitTail&&d.jsxs("div",{className:"dead-session-exit-tail","data-testid":"dead-session-exit-tail",children:[d.jsx("div",{className:"dead-session-exit-tail-label",children:"Last output before exit"}),d.jsx("pre",{className:"dead-session-exit-tail-body",children:e.exitTail})]}),m&&d.jsx("div",{className:"dead-session-record","data-testid":"dead-session-record",children:d.jsx(p2,{state:u})})]})}function vD({summary:e,loadRecord:t,onStart:n,onClose:r}){const o=e.resumeMode==="agent-resume",c=e.harnessSessionId??e.agentSessionId,h=d2(c,t),l=!o&&h.status==="ready";return d.jsxs("div",{className:"past-session-pane","data-testid":"past-session-pane",children:[d.jsxs("header",{className:"past-session-header",children:[d.jsxs("div",{className:"past-session-heading",children:[d.jsx("div",{className:"dead-session-title",children:e.title}),d.jsxs("div",{className:"dead-session-meta",children:[mv(e)," · ",e.cwd]})]}),d.jsxs("div",{className:"dead-session-actions",children:[d.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:n,children:o?"Resume":l?"Continue here":"New session here"}),d.jsx("button",{className:"btn-ghost","data-testid":"past-session-close",onClick:r,children:"Close"})]})]}),!o&&d.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[Ba[e.harness]," has no saved conversation for this session, so it can't be reattached — sessions that end before their first prompt are never written to the coding agent's history."," ",l?"Continuing opens a fresh session here, seeded with the reconstruction below. The new coding agent gets a briefing about this session, not its context — it will need to check the repository before relying on any of it.":"Starting opens a fresh session in the same directory, with no context from this one."]}),d.jsx("div",{className:"past-session-body",children:d.jsx(p2,{state:h})})]})}function p2({state:e}){return e.status==="loading"?d.jsx("div",{className:"past-session-status","data-testid":"past-session-loading",children:"Rebuilding this session's transcript…"}):e.status==="error"?d.jsxs("div",{className:"past-session-status","data-testid":"past-session-error",children:["Couldn't load this session's transcript: ",e.message]}):e.status==="empty"?d.jsxs("div",{className:"past-session-status","data-testid":"past-session-empty",children:[d.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:d.jsx(ue,{name:"SquareTerminal",size:18})}),"No transcript for this session: Agent Studio has no recorded events for it. Sessions Agent Studio didn't run — or ones whose events have aged out of the local log — show up here as history rows only."]}):d.jsx(fD,{record:e.record})}function _D({onCancel:e,onConfirm:t,triggerRef:n}){const r=O.useRef(null);return za(!0,{onDismiss:e,containerRef:r,triggerRef:n}),d.jsx("div",{className:"modal-backdrop",onClick:e,children:d.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"End session","data-testid":"end-session-confirm",onClick:o=>o.stopPropagation(),children:[d.jsxs("div",{className:"modal-header",children:["End session?",d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:e,children:d.jsx(ue,{name:"X",size:14})})]}),d.jsx("div",{className:"modal-body",children:d.jsx("p",{className:"modal-copy",children:"This kills the live terminal; anything the agent is doing right now stops. The session stays resumable from history once it has an agent session id."})}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:e,children:"Keep session"}),d.jsx("button",{className:"btn-danger","data-testid":"end-session-confirm-btn",onClick:t,children:"End session"})]})]})})}function yD({sessions:e,activeSessionId:t,busySessionIds:n,labelOf:r,subjectName:o,onSelect:c,onNew:h,newSessionPending:l,menuOpen:u,onToggleMenu:m,menuTriggerRef:g,menuTooltip:p,renaming:S,renameDraft:w,onRenameDraftChange:A,onCommitRename:E,onCancelRename:y}){const b=O.useRef(null),v=O.useRef(!1);return O.useEffect(()=>{var _;(_=b.current)==null||_.scrollIntoView({block:"nearest",inline:"nearest"})},[t,e.length]),d.jsxs("div",{className:"session-tabs","data-testid":"session-tabs",children:[d.jsx("div",{className:"session-tabs-list",role:"tablist","aria-label":"Sessions",children:e.map(_=>{const k=_.id===t,C=r(_),x=Ba[_.harness],T=k&&S;return d.jsxs("div",{ref:k?b:void 0,className:`session-tab${k?" is-active":""}`,"data-testid":`session-tab-${_.id}`,children:[T?d.jsx("input",{className:"group-name-input session-rename-input session-tab-rename","data-testid":"session-rename-input","aria-label":"Rename session",value:w,autoFocus:!0,onFocus:R=>{v.current=!1,R.currentTarget.select()},onChange:R=>A(R.target.value),onKeyDown:R=>{R.key==="Enter"&&E(),R.key==="Escape"&&(v.current=!0,y())},onBlur:()=>{if(v.current){v.current=!1;return}E()}}):d.jsxs("button",{type:"button",role:"tab","aria-selected":k,className:"session-tab-main","data-testid":`session-tab-main-${_.id}`,title:`${C} · ${x}`,"data-tooltip":`${C} · ${x}`,onClick:()=>c(_.id),children:[n.has(_.id)?d.jsx("span",{className:"session-busy","data-testid":`session-tab-busy-${_.id}`,"aria-hidden":"true"}):d.jsx("span",{className:"session-dot","data-status":_.status,"aria-hidden":"true"}),d.jsx("span",{className:"session-tab-label","data-testid":k?"session-context-title":void 0,children:C})]}),k&&!T&&d.jsx("button",{ref:g,type:"button",className:"theme-toggle session-tab-menu","data-testid":"session-menu","aria-label":"Session options","aria-haspopup":"menu","aria-expanded":u,"data-tooltip":p,onClick:R=>{R.stopPropagation(),m()},...Dt({object:"session"}),children:d.jsx(ue,{name:"ChevronDown",size:12})})]},_.id)})}),d.jsx("button",{type:"button",className:"theme-toggle session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${o}`,"aria-busy":l,"data-tooltip":`New session on ${o}`,disabled:l,onClick:h,children:l?d.jsx("span",{className:"session-busy","aria-hidden":"true"}):d.jsx(ue,{name:"Plus",size:14})})]})}function lc(e){return zs(e)}const bD=new Set;function SD({overviewMode:e=!1,openedAgentName:t=null,reviewTitle:n=null,composing:r=!1,onBack:o=null,activeSession:c,sessionName:h,onRenameSession:l,boundWorkflowName:u,busy:m,onExpandRail:g,onExpandRight:p,onCloseSession:S,onOpenInEditor:w,editorLabel:A,onToast:E,actions:y=null,onNewSession:b=null,newSessionPending:v=!1,subjectName:_=null,sessions:k=[],busySessionIds:C=bD,onSelectSession:x=null,labelOf:T}){const[R,M]=O.useState(!1),[D,L]=O.useState(!1),[q,F]=O.useState(!1),[Y,Q]=O.useState(""),G=O.useRef(null),ee=()=>L(!1),ne=()=>{c&&l(c.id,Y),F(!1)};return O.useEffect(()=>{L(!1),F(!1),M(!1)},[c==null?void 0:c.id]),d.jsxs("div",{className:"session-bar",...Dt({surface:"session_bar"}),children:[g&&d.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:g,children:d.jsx(ue,{name:"PanelLeftOpen",size:14})}),d.jsx("div",{className:"session-queue","data-testid":"session-context","data-session-id":(c==null?void 0:c.id)??"",children:e?d.jsxs("div",{className:"session-current session-current-static",children:[d.jsx(ue,{name:"Radio",size:13}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Overview"})]}):t?d.jsxs("div",{className:"session-current session-current-static",children:[d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:t}),d.jsx("span",{className:"status-tag session-status-tag","data-testid":"session-status-tag","data-status":"none","data-tooltip":"No running session for this agent. Start one to work on it.",children:"no session"})]}):n?d.jsxs("div",{className:"session-current session-current-static",children:[d.jsx(ue,{name:"History",size:13}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:n}),d.jsxs("span",{className:"status-tag session-status-tag","data-testid":"session-status-tag","data-status":"exited","data-tooltip":"A past session under review. Resume it from the pane below.",children:[d.jsx("span",{className:"session-dot","data-status":"exited"}),"past"]})]}):r?o?d.jsxs("button",{type:"button",className:"session-current session-back","data-testid":"composer-back",onClick:o,children:[d.jsx(ue,{name:"ArrowLeft",size:13}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Back"})]}):null:c&&c.status!=="exited"&&k.length>0&&x&&b&&T?d.jsx(yD,{sessions:k,activeSessionId:c.id,busySessionIds:C,labelOf:T,subjectName:_??lc(c.cwd),onSelect:x,onNew:b,newSessionPending:v,menuOpen:D,onToggleMenu:()=>L(z=>!z),menuTriggerRef:G,menuTooltip:`${Ba[c.harness]} · ${lc(c.cwd)} · ${c.cwd}`,renaming:q,renameDraft:Y,onRenameDraftChange:Q,onCommitRename:ne,onCancelRename:()=>F(!1)}):c?d.jsx("div",{className:"session-current-wrap",children:q?d.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:Y,autoFocus:!0,onFocus:z=>z.currentTarget.select(),onChange:z=>Q(z.target.value),onKeyDown:z=>{z.key==="Enter"&&ne(),z.key==="Escape"&&F(!1)},onBlur:ne}):d.jsxs("button",{ref:G,type:"button",className:"session-current session-title-trigger","data-testid":"session-menu","aria-haspopup":"menu","aria-expanded":D,"data-tooltip":`${Ba[c.harness]} · ${lc(c.cwd)} · ${c.cwd}`,onClick:()=>L(z=>!z),...Dt({object:"session"}),children:[m?d.jsx("span",{className:"session-busy","data-testid":"session-busy","aria-hidden":"true"}):d.jsx("span",{className:"session-dot","data-status":c.status,"aria-hidden":"true"}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:T?T(c):h??c.title}),d.jsx(ue,{name:"ChevronDown",size:13})]})}):d.jsx("span",{className:"session-context-none",children:"No active session"})}),c&&d.jsxs(Ei,{open:D,anchorRef:G,onDismiss:ee,placement:"down-start",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[u&&d.jsxs("div",{className:"session-menu-bound","data-testid":"session-workflow-chip",children:["Bound to ",d.jsx("strong",{children:u})," · what this session is working on"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var z;(z=navigator.clipboard)==null||z.writeText(c.cwd).then(()=>E("Path copied.","success")).catch(()=>E("Couldn't copy the path.")),ee()},children:[d.jsx(ue,{name:"Copy",size:13}),"Copy path"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{Q(h??c.title),F(!0),ee()},children:[d.jsx(ue,{name:"Pencil",size:13}),"Rename session"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{w(c.cwd),ee()},children:[d.jsx(ue,{name:"Code",size:13}),"Open in ",A]}),c.status!=="exited"&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{ee(),M(!0)},children:[d.jsx(ue,{name:"X",size:13}),"End session…"]})]}),b&&(c==null?void 0:c.status)==="exited"&&!r&&d.jsx("button",{type:"button",className:"theme-toggle session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${_??lc(c.cwd)}`,"aria-busy":v,"data-tooltip":`New session on ${_??lc(c.cwd)}`,disabled:v,onClick:b,children:v?d.jsx("span",{className:"session-busy","aria-hidden":"true"}):d.jsx(ue,{name:"Plus",size:14})}),y,p&&d.jsx("button",{className:"theme-toggle","data-testid":"right-expand","aria-label":"Expand canvas panel",title:"Expand canvas panel",onClick:p,children:d.jsx(ue,{name:"PanelRightOpen",size:15})}),R&&c&&d.jsx(_D,{triggerRef:G,onCancel:()=>M(!1),onConfirm:()=>{M(!1),S(c.id)}})]})}const LS={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function m2(e){return Object.prototype.hasOwnProperty.call(LS,e)?LS[e]:null}function wD(e){return m2(e.id)===null&&e.action.kind==="inject"}function xD(e,t,n){if(e.requiresWorkflow){if(!t)return"Select an agent first";if(e.action.kind==="open-url"&&e.action.url.includes("{{workflow.definitionId}}")&&t.definitionId==null)return"Not deployed yet"}return e.action.kind!=="open-url"&&!n?"Start a session first":null}function CD(e,t){return e.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}function pi(e,t){return e.trim()===""?!1:Li(e,t)}function n_(e,t){return t.filter(n=>pi(n,e)).map(La).sort((n,r)=>r.length-n.length)[0]??e}function vc(e,t){return t?e.filter(n=>n.status!=="exited"&&(Cn(n.boundWorkflowPath??"",t)||(n.boundWorkflowPath??null)==null&&Cn(n.cwd,t))).sort((n,r)=>n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id)):[]}function IS(e,t){return!e||e.status==="exited"?t:e.boundWorkflowPath??e.cwd}function g2(e,t,n){return!e||e.status==="exited"||t==null?!1:pi(n_(e.cwd,n),t)}function PS(e,t){const n=e.lastActiveAt??e.createdAt;return(t.lastActiveAt??t.createdAt).localeCompare(n)||e.id.localeCompare(t.id)}function ED({focusPath:e,active:t,sessions:n,roots:r}){const o=n.filter(u=>u.status!=="exited");if(g2(t,e,r))return{kind:"keep"};const c=n_(e,r),h=vc(o,e).sort(PS)[0],l=o.filter(u=>pi(c,u.cwd)).sort(PS)[0];return{kind:"switch",to:h??l??null}}function kD({selection:e,suppressed:t=!1}){return t?null:e}function jD({subjectPath:e,bindingPath:t,sessionId:n}){const r=e==null?t==null:t!=null&&Cn(t,e);return n!=null&&r?{kind:"session",sessionId:n}:e==null?{kind:"none"}:{kind:"agent",path:e}}function RD(e,{subject:t,authenticated:n,deployError:r}){if(!t)return{subjectPath:null,reason:"Select an agent first"};const o=t.path;switch(e){case"prod":return{subjectPath:o,reason:t.definitionId==null?"Not deployed yet":null};case"run":return{subjectPath:o,reason:(n?null:"Connect your account first")??h$(t,r)};case"deploy":return{subjectPath:o,reason:n?null:"Connect your account first"};case"test":return{subjectPath:o,reason:null}}}function gv(e,t){return e.filter(n=>n.workflowPath===t)}const AD=200;function TD(e,t,n=AD){if(n<=0)return[];const r=e.slice(-n),o=n-r.length;if(o<=0)return r;const c=new Set(r.map(h=>h.run.executionId));return[...r,...t.filter(h=>!c.has(h.run.executionId)).slice(-o)]}function ND(e,t,n){return t&&gv(e,n).some(r=>r.run.executionId===t.run.executionId)?t:null}function MD(e,t){return t&&e.some(n=>n.run.executionId===t.run.executionId)?t:e.length>0?e[e.length-1]:null}var ad={exports:{}},ig={},sr={},Ca={},rg={},ag={},og={},BS;function Xh(){return BS||(BS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(v){if(super(),!e.IDENTIFIER.test(v))throw new Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((_,k)=>`${_}${k}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((_,k)=>(k instanceof n&&(_[k.str]=(_[k.str]||0)+1),_),{})}}e._Code=r,e.nil=new r("");function o(b,...v){const _=[b[0]];let k=0;for(;k<v.length;)l(_,v[k]),_.push(b[++k]);return new r(_)}e._=o;const c=new r("+");function h(b,...v){const _=[w(b[0])];let k=0;for(;k<v.length;)_.push(c),l(_,v[k]),_.push(c,w(b[++k]));return u(_),new r(_)}e.str=h;function l(b,v){v instanceof r?b.push(...v._items):v instanceof n?b.push(v):b.push(p(v))}e.addCodeArg=l;function u(b){let v=1;for(;v<b.length-1;){if(b[v]===c){const _=m(b[v-1],b[v+1]);if(_!==void 0){b.splice(v-1,3,_);continue}b[v++]="+"}v++}}function m(b,v){if(v==='""')return b;if(b==='""')return v;if(typeof b=="string")return v instanceof n||b[b.length-1]!=='"'?void 0:typeof v!="string"?`${b.slice(0,-1)}${v}"`:v[0]==='"'?b.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(b instanceof n))return`"${b}${v.slice(1)}`}function g(b,v){return v.emptyStr()?b:b.emptyStr()?v:h`${b}${v}`}e.strConcat=g;function p(b){return typeof b=="number"||typeof b=="boolean"||b===null?b:w(Array.isArray(b)?b.join(","):b)}function S(b){return new r(w(b))}e.stringify=S;function w(b){return JSON.stringify(b).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=w;function A(b){return typeof b=="string"&&e.IDENTIFIER.test(b)?new r(`.${b}`):o`[${b}]`}e.getProperty=A;function E(b){if(typeof b=="string"&&e.IDENTIFIER.test(b))return new r(`${b}`);throw new Error(`CodeGen: invalid export name: ${b}, use explicit $id name mapping`)}e.getEsmExportName=E;function y(b){return new r(b.toString())}e.regexpCode=y})(og)),og}var lg={},zS;function HS(){return zS||(zS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Xh();class n extends Error{constructor(m){super(`CodeGen: "code" for ${m} not defined`),this.value=m.value}}var r;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:m,parent:g}={}){this._names={},this._prefixes=m,this._parent=g}toName(m){return m instanceof t.Name?m:this.name(m)}name(m){return new t.Name(this._newName(m))}_newName(m){const g=this._names[m]||this._nameGroup(m);return`${m}${g.index++}`}_nameGroup(m){var g,p;if(!((p=(g=this._parent)===null||g===void 0?void 0:g._prefixes)===null||p===void 0)&&p.has(m)||this._prefixes&&!this._prefixes.has(m))throw new Error(`CodeGen: prefix "${m}" is not allowed in this scope`);return this._names[m]={prefix:m,index:0}}}e.Scope=o;class c extends t.Name{constructor(m,g){super(g),this.prefix=m}setValue(m,{property:g,itemIndex:p}){this.value=m,this.scopePath=(0,t._)`.${new t.Name(g)}[${p}]`}}e.ValueScopeName=c;const h=(0,t._)`\n`;class l extends o{constructor(m){super(m),this._values={},this._scope=m.scope,this.opts={...m,_n:m.lines?h:t.nil}}get(){return this._scope}name(m){return new c(m,this._newName(m))}value(m,g){var p;if(g.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const S=this.toName(m),{prefix:w}=S,A=(p=g.key)!==null&&p!==void 0?p:g.ref;let E=this._values[w];if(E){const v=E.get(A);if(v)return v}else E=this._values[w]=new Map;E.set(A,S);const y=this._scope[w]||(this._scope[w]=[]),b=y.length;return y[b]=g.ref,S.setValue(g,{property:w,itemIndex:b}),S}getValue(m,g){const p=this._values[m];if(p)return p.get(g)}scopeRefs(m,g=this._values){return this._reduceValues(g,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,t._)`${m}${p.scopePath}`})}scopeCode(m=this._values,g,p){return this._reduceValues(m,S=>{if(S.value===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return S.value.code},g,p)}_reduceValues(m,g,p={},S){let w=t.nil;for(const A in m){const E=m[A];if(!E)continue;const y=p[A]=p[A]||new Map;E.forEach(b=>{if(y.has(b))return;y.set(b,r.Started);let v=g(b);if(v){const _=this.opts.es5?e.varKinds.var:e.varKinds.const;w=(0,t._)`${w}${_} ${b} = ${v};${this.opts._n}`}else if(v=S==null?void 0:S(b))w=(0,t._)`${w}${v}${this.opts._n}`;else throw new n(b);y.set(b,r.Completed)})}return w}}e.ValueScope=l})(lg)),lg}var US;function bt(){return US||(US=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Xh(),n=HS();var r=Xh();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=HS();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class c{optimizeNodes(){return this}optimizeNames(P,W){return this}}class h extends c{constructor(P,W,se){super(),this.varKind=P,this.name=W,this.rhs=se}render({es5:P,_n:W}){const se=P?n.varKinds.var:this.varKind,X=this.rhs===void 0?"":` = ${this.rhs}`;return`${se} ${this.name}${X};`+W}optimizeNames(P,W){if(P[this.name.str])return this.rhs&&(this.rhs=Y(this.rhs,P,W)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends c{constructor(P,W,se){super(),this.lhs=P,this.rhs=W,this.sideEffects=se}render({_n:P}){return`${this.lhs} = ${this.rhs};`+P}optimizeNames(P,W){if(!(this.lhs instanceof t.Name&&!P[this.lhs.str]&&!this.sideEffects))return this.rhs=Y(this.rhs,P,W),this}get names(){const P=this.lhs instanceof t.Name?{}:{...this.lhs.names};return F(P,this.rhs)}}class u extends l{constructor(P,W,se,X){super(P,se,X),this.op=W}render({_n:P}){return`${this.lhs} ${this.op}= ${this.rhs};`+P}}class m extends c{constructor(P){super(),this.label=P,this.names={}}render({_n:P}){return`${this.label}:`+P}}class g extends c{constructor(P){super(),this.label=P,this.names={}}render({_n:P}){return`break${this.label?` ${this.label}`:""};`+P}}class p extends c{constructor(P){super(),this.error=P}render({_n:P}){return`throw ${this.error};`+P}get names(){return this.error.names}}class S extends c{constructor(P){super(),this.code=P}render({_n:P}){return`${this.code};`+P}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(P,W){return this.code=Y(this.code,P,W),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class w extends c{constructor(P=[]){super(),this.nodes=P}render(P){return this.nodes.reduce((W,se)=>W+se.render(P),"")}optimizeNodes(){const{nodes:P}=this;let W=P.length;for(;W--;){const se=P[W].optimizeNodes();Array.isArray(se)?P.splice(W,1,...se):se?P[W]=se:P.splice(W,1)}return P.length>0?this:void 0}optimizeNames(P,W){const{nodes:se}=this;let X=se.length;for(;X--;){const V=se[X];V.optimizeNames(P,W)||(Q(P,V.names),se.splice(X,1))}return se.length>0?this:void 0}get names(){return this.nodes.reduce((P,W)=>q(P,W.names),{})}}class A extends w{render(P){return"{"+P._n+super.render(P)+"}"+P._n}}class E extends w{}class y extends A{}y.kind="else";class b extends A{constructor(P,W){super(W),this.condition=P}render(P){let W=`if(${this.condition})`+super.render(P);return this.else&&(W+="else "+this.else.render(P)),W}optimizeNodes(){super.optimizeNodes();const P=this.condition;if(P===!0)return this.nodes;let W=this.else;if(W){const se=W.optimizeNodes();W=this.else=Array.isArray(se)?new y(se):se}if(W)return P===!1?W instanceof b?W:W.nodes:this.nodes.length?this:new b(G(P),W instanceof b?[W]:W.nodes);if(!(P===!1||!this.nodes.length))return this}optimizeNames(P,W){var se;if(this.else=(se=this.else)===null||se===void 0?void 0:se.optimizeNames(P,W),!!(super.optimizeNames(P,W)||this.else))return this.condition=Y(this.condition,P,W),this}get names(){const P=super.names;return F(P,this.condition),this.else&&q(P,this.else.names),P}}b.kind="if";class v extends A{}v.kind="for";class _ extends v{constructor(P){super(),this.iteration=P}render(P){return`for(${this.iteration})`+super.render(P)}optimizeNames(P,W){if(super.optimizeNames(P,W))return this.iteration=Y(this.iteration,P,W),this}get names(){return q(super.names,this.iteration.names)}}class k extends v{constructor(P,W,se,X){super(),this.varKind=P,this.name=W,this.from=se,this.to=X}render(P){const W=P.es5?n.varKinds.var:this.varKind,{name:se,from:X,to:V}=this;return`for(${W} ${se}=${X}; ${se}<${V}; ${se}++)`+super.render(P)}get names(){const P=F(super.names,this.from);return F(P,this.to)}}class C extends v{constructor(P,W,se,X){super(),this.loop=P,this.varKind=W,this.name=se,this.iterable=X}render(P){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(P)}optimizeNames(P,W){if(super.optimizeNames(P,W))return this.iterable=Y(this.iterable,P,W),this}get names(){return q(super.names,this.iterable.names)}}class x extends A{constructor(P,W,se){super(),this.name=P,this.args=W,this.async=se}render(P){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(P)}}x.kind="func";class T extends w{render(P){return"return "+super.render(P)}}T.kind="return";class R extends A{render(P){let W="try"+super.render(P);return this.catch&&(W+=this.catch.render(P)),this.finally&&(W+=this.finally.render(P)),W}optimizeNodes(){var P,W;return super.optimizeNodes(),(P=this.catch)===null||P===void 0||P.optimizeNodes(),(W=this.finally)===null||W===void 0||W.optimizeNodes(),this}optimizeNames(P,W){var se,X;return super.optimizeNames(P,W),(se=this.catch)===null||se===void 0||se.optimizeNames(P,W),(X=this.finally)===null||X===void 0||X.optimizeNames(P,W),this}get names(){const P=super.names;return this.catch&&q(P,this.catch.names),this.finally&&q(P,this.finally.names),P}}class M extends A{constructor(P){super(),this.error=P}render(P){return`catch(${this.error})`+super.render(P)}}M.kind="catch";class D extends A{render(P){return"finally"+super.render(P)}}D.kind="finally";class L{constructor(P,W={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...W,_n:W.lines?`
482
+ `:""},this._extScope=P,this._scope=new n.Scope({parent:P}),this._nodes=[new E]}toString(){return this._root.render(this.opts)}name(P){return this._scope.name(P)}scopeName(P){return this._extScope.name(P)}scopeValue(P,W){const se=this._extScope.value(P,W);return(this._values[se.prefix]||(this._values[se.prefix]=new Set)).add(se),se}getScopeValue(P,W){return this._extScope.getValue(P,W)}scopeRefs(P){return this._extScope.scopeRefs(P,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(P,W,se,X){const V=this._scope.toName(W);return se!==void 0&&X&&(this._constants[V.str]=se),this._leafNode(new h(P,V,se)),V}const(P,W,se){return this._def(n.varKinds.const,P,W,se)}let(P,W,se){return this._def(n.varKinds.let,P,W,se)}var(P,W,se){return this._def(n.varKinds.var,P,W,se)}assign(P,W,se){return this._leafNode(new l(P,W,se))}add(P,W){return this._leafNode(new u(P,e.operators.ADD,W))}code(P){return typeof P=="function"?P():P!==t.nil&&this._leafNode(new S(P)),this}object(...P){const W=["{"];for(const[se,X]of P)W.length>1&&W.push(","),W.push(se),(se!==X||this.opts.es5)&&(W.push(":"),(0,t.addCodeArg)(W,X));return W.push("}"),new t._Code(W)}if(P,W,se){if(this._blockNode(new b(P)),W&&se)this.code(W).else().code(se).endIf();else if(W)this.code(W).endIf();else if(se)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(P){return this._elseNode(new b(P))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(b,y)}_for(P,W){return this._blockNode(P),W&&this.code(W).endFor(),this}for(P,W){return this._for(new _(P),W)}forRange(P,W,se,X,V=this.opts.es5?n.varKinds.var:n.varKinds.let){const ce=this._scope.toName(P);return this._for(new k(V,ce,W,se),()=>X(ce))}forOf(P,W,se,X=n.varKinds.const){const V=this._scope.toName(P);if(this.opts.es5){const ce=W instanceof t.Name?W:this.var("_arr",W);return this.forRange("_i",0,(0,t._)`${ce}.length`,oe=>{this.var(V,(0,t._)`${ce}[${oe}]`),se(V)})}return this._for(new C("of",X,V,W),()=>se(V))}forIn(P,W,se,X=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(P,(0,t._)`Object.keys(${W})`,se);const V=this._scope.toName(P);return this._for(new C("in",X,V,W),()=>se(V))}endFor(){return this._endBlockNode(v)}label(P){return this._leafNode(new m(P))}break(P){return this._leafNode(new g(P))}return(P){const W=new T;if(this._blockNode(W),this.code(P),W.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(T)}try(P,W,se){if(!W&&!se)throw new Error('CodeGen: "try" without "catch" and "finally"');const X=new R;if(this._blockNode(X),this.code(P),W){const V=this.name("e");this._currNode=X.catch=new M(V),W(V)}return se&&(this._currNode=X.finally=new D,this.code(se)),this._endBlockNode(M,D)}throw(P){return this._leafNode(new p(P))}block(P,W){return this._blockStarts.push(this._nodes.length),P&&this.code(P).endBlock(W),this}endBlock(P){const W=this._blockStarts.pop();if(W===void 0)throw new Error("CodeGen: not in self-balancing block");const se=this._nodes.length-W;if(se<0||P!==void 0&&se!==P)throw new Error(`CodeGen: wrong number of nodes: ${se} vs ${P} expected`);return this._nodes.length=W,this}func(P,W=t.nil,se,X){return this._blockNode(new x(P,W,se)),X&&this.code(X).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(P=1){for(;P-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(P){return this._currNode.nodes.push(P),this}_blockNode(P){this._currNode.nodes.push(P),this._nodes.push(P)}_endBlockNode(P,W){const se=this._currNode;if(se instanceof P||W&&se instanceof W)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${W?`${P.kind}/${W.kind}`:P.kind}"`)}_elseNode(P){const W=this._currNode;if(!(W instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=W.else=P,this}get _root(){return this._nodes[0]}get _currNode(){const P=this._nodes;return P[P.length-1]}set _currNode(P){const W=this._nodes;W[W.length-1]=P}}e.CodeGen=L;function q(U,P){for(const W in P)U[W]=(U[W]||0)+(P[W]||0);return U}function F(U,P){return P instanceof t._CodeOrName?q(U,P.names):U}function Y(U,P,W){if(U instanceof t.Name)return se(U);if(!X(U))return U;return new t._Code(U._items.reduce((V,ce)=>(ce instanceof t.Name&&(ce=se(ce)),ce instanceof t._Code?V.push(...ce._items):V.push(ce),V),[]));function se(V){const ce=W[V.str];return ce===void 0||P[V.str]!==1?V:(delete P[V.str],ce)}function X(V){return V instanceof t._Code&&V._items.some(ce=>ce instanceof t.Name&&P[ce.str]===1&&W[ce.str]!==void 0)}}function Q(U,P){for(const W in P)U[W]=(U[W]||0)-(P[W]||0)}function G(U){return typeof U=="boolean"||typeof U=="number"||U===null?!U:(0,t._)`!${H(U)}`}e.not=G;const ee=$(e.operators.AND);function ne(...U){return U.reduce(ee)}e.and=ne;const z=$(e.operators.OR);function B(...U){return U.reduce(z)}e.or=B;function $(U){return(P,W)=>P===t.nil?W:W===t.nil?P:(0,t._)`${H(P)} ${U} ${H(W)}`}function H(U){return U instanceof t.Name?U:(0,t._)`(${U})`}})(ag)),ag}var xt={},FS;function Nt(){if(FS)return xt;FS=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.checkStrictMode=xt.getErrorPath=xt.Type=xt.useFunc=xt.setEvaluated=xt.evaluatedPropsToName=xt.mergeEvaluated=xt.eachItem=xt.unescapeJsonPointer=xt.escapeJsonPointer=xt.escapeFragment=xt.unescapeFragment=xt.schemaRefOrVal=xt.schemaHasRulesButRef=xt.schemaHasRules=xt.checkUnknownRules=xt.alwaysValidSchema=xt.toHash=void 0;const e=bt(),t=Xh();function n(C){const x={};for(const T of C)x[T]=!0;return x}xt.toHash=n;function r(C,x){return typeof x=="boolean"?x:Object.keys(x).length===0?!0:(o(C,x),!c(x,C.self.RULES.all))}xt.alwaysValidSchema=r;function o(C,x=C.schema){const{opts:T,self:R}=C;if(!T.strictSchema||typeof x=="boolean")return;const M=R.RULES.keywords;for(const D in x)M[D]||k(C,`unknown keyword: "${D}"`)}xt.checkUnknownRules=o;function c(C,x){if(typeof C=="boolean")return!C;for(const T in C)if(x[T])return!0;return!1}xt.schemaHasRules=c;function h(C,x){if(typeof C=="boolean")return!C;for(const T in C)if(T!=="$ref"&&x.all[T])return!0;return!1}xt.schemaHasRulesButRef=h;function l({topSchemaRef:C,schemaPath:x},T,R,M){if(!M){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return(0,e._)`${T}`}return(0,e._)`${C}${x}${(0,e.getProperty)(R)}`}xt.schemaRefOrVal=l;function u(C){return p(decodeURIComponent(C))}xt.unescapeFragment=u;function m(C){return encodeURIComponent(g(C))}xt.escapeFragment=m;function g(C){return typeof C=="number"?`${C}`:C.replace(/~/g,"~0").replace(/\//g,"~1")}xt.escapeJsonPointer=g;function p(C){return C.replace(/~1/g,"/").replace(/~0/g,"~")}xt.unescapeJsonPointer=p;function S(C,x){if(Array.isArray(C))for(const T of C)x(T);else x(C)}xt.eachItem=S;function w({mergeNames:C,mergeToName:x,mergeValues:T,resultToName:R}){return(M,D,L,q)=>{const F=L===void 0?D:L instanceof e.Name?(D instanceof e.Name?C(M,D,L):x(M,D,L),L):D instanceof e.Name?(x(M,L,D),D):T(D,L);return q===e.Name&&!(F instanceof e.Name)?R(M,F):F}}xt.mergeEvaluated={props:w({mergeNames:(C,x,T)=>C.if((0,e._)`${T} !== true && ${x} !== undefined`,()=>{C.if((0,e._)`${x} === true`,()=>C.assign(T,!0),()=>C.assign(T,(0,e._)`${T} || {}`).code((0,e._)`Object.assign(${T}, ${x})`))}),mergeToName:(C,x,T)=>C.if((0,e._)`${T} !== true`,()=>{x===!0?C.assign(T,!0):(C.assign(T,(0,e._)`${T} || {}`),E(C,T,x))}),mergeValues:(C,x)=>C===!0?!0:{...C,...x},resultToName:A}),items:w({mergeNames:(C,x,T)=>C.if((0,e._)`${T} !== true && ${x} !== undefined`,()=>C.assign(T,(0,e._)`${x} === true ? true : ${T} > ${x} ? ${T} : ${x}`)),mergeToName:(C,x,T)=>C.if((0,e._)`${T} !== true`,()=>C.assign(T,x===!0?!0:(0,e._)`${T} > ${x} ? ${T} : ${x}`)),mergeValues:(C,x)=>C===!0?!0:Math.max(C,x),resultToName:(C,x)=>C.var("items",x)})};function A(C,x){if(x===!0)return C.var("props",!0);const T=C.var("props",(0,e._)`{}`);return x!==void 0&&E(C,T,x),T}xt.evaluatedPropsToName=A;function E(C,x,T){Object.keys(T).forEach(R=>C.assign((0,e._)`${x}${(0,e.getProperty)(R)}`,!0))}xt.setEvaluated=E;const y={};function b(C,x){return C.scopeValue("func",{ref:x,code:y[x.code]||(y[x.code]=new t._Code(x.code))})}xt.useFunc=b;var v;(function(C){C[C.Num=0]="Num",C[C.Str=1]="Str"})(v||(xt.Type=v={}));function _(C,x,T){if(C instanceof e.Name){const R=x===v.Num;return T?R?(0,e._)`"[" + ${C} + "]"`:(0,e._)`"['" + ${C} + "']"`:R?(0,e._)`"/" + ${C}`:(0,e._)`"/" + ${C}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,e.getProperty)(C).toString():"/"+g(C)}xt.getErrorPath=_;function k(C,x,T=C.opts.strictSchema){if(T){if(x=`strict mode: ${x}`,T===!0)throw new Error(x);C.self.logger.warn(x)}}return xt.checkStrictMode=k,xt}var od={},qS;function ki(){if(qS)return od;qS=1,Object.defineProperty(od,"__esModule",{value:!0});const e=bt(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return od.default=t,od}var VS;function df(){return VS||(VS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=bt(),n=Nt(),r=ki();e.keywordError={message:({keyword:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:b})=>b?(0,t.str)`"${y}" keyword must be ${b} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function o(y,b=e.keywordError,v,_){const{it:k}=y,{gen:C,compositeRule:x,allErrors:T}=k,R=p(y,b,v);_??(x||T)?u(C,R):m(k,(0,t._)`[${R}]`)}e.reportError=o;function c(y,b=e.keywordError,v){const{it:_}=y,{gen:k,compositeRule:C,allErrors:x}=_,T=p(y,b,v);u(k,T),C||x||m(_,r.default.vErrors)}e.reportExtraError=c;function h(y,b){y.assign(r.default.errors,b),y.if((0,t._)`${r.default.vErrors} !== null`,()=>y.if(b,()=>y.assign((0,t._)`${r.default.vErrors}.length`,b),()=>y.assign(r.default.vErrors,null)))}e.resetErrorsCount=h;function l({gen:y,keyword:b,schemaValue:v,data:_,errsCount:k,it:C}){if(k===void 0)throw new Error("ajv implementation error");const x=y.name("err");y.forRange("i",k,r.default.errors,T=>{y.const(x,(0,t._)`${r.default.vErrors}[${T}]`),y.if((0,t._)`${x}.instancePath === undefined`,()=>y.assign((0,t._)`${x}.instancePath`,(0,t.strConcat)(r.default.instancePath,C.errorPath))),y.assign((0,t._)`${x}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${b}`),C.opts.verbose&&(y.assign((0,t._)`${x}.schema`,v),y.assign((0,t._)`${x}.data`,_))})}e.extendErrors=l;function u(y,b){const v=y.const("err",b);y.if((0,t._)`${r.default.vErrors} === null`,()=>y.assign(r.default.vErrors,(0,t._)`[${v}]`),(0,t._)`${r.default.vErrors}.push(${v})`),y.code((0,t._)`${r.default.errors}++`)}function m(y,b){const{gen:v,validateName:_,schemaEnv:k}=y;k.$async?v.throw((0,t._)`new ${y.ValidationError}(${b})`):(v.assign((0,t._)`${_}.errors`,b),v.return(!1))}const g={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function p(y,b,v){const{createErrors:_}=y.it;return _===!1?(0,t._)`{}`:S(y,b,v)}function S(y,b,v={}){const{gen:_,it:k}=y,C=[w(k,v),A(y,v)];return E(y,b,C),_.object(...C)}function w({errorPath:y},{instancePath:b}){const v=b?(0,t.str)`${y}${(0,n.getErrorPath)(b,n.Type.Str)}`:y;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,v)]}function A({keyword:y,it:{errSchemaPath:b}},{schemaPath:v,parentSchema:_}){let k=_?b:(0,t.str)`${b}/${y}`;return v&&(k=(0,t.str)`${k}${(0,n.getErrorPath)(v,n.Type.Str)}`),[g.schemaPath,k]}function E(y,{params:b,message:v},_){const{keyword:k,data:C,schemaValue:x,it:T}=y,{opts:R,propertyName:M,topSchemaRef:D,schemaPath:L}=T;_.push([g.keyword,k],[g.params,typeof b=="function"?b(y):b||(0,t._)`{}`]),R.messages&&_.push([g.message,typeof v=="function"?v(y):v]),R.verbose&&_.push([g.schema,x],[g.parentSchema,(0,t._)`${D}${L}`],[r.default.data,C]),M&&_.push([g.propertyName,M])}})(rg)),rg}var GS;function $D(){if(GS)return Ca;GS=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.boolOrEmptySchema=Ca.topBoolOrEmptySchema=void 0;const e=df(),t=bt(),n=ki(),r={message:"boolean schema is false"};function o(l){const{gen:u,schema:m,validateName:g}=l;m===!1?h(l,!1):typeof m=="object"&&m.$async===!0?u.return(n.default.data):(u.assign((0,t._)`${g}.errors`,null),u.return(!0))}Ca.topBoolOrEmptySchema=o;function c(l,u){const{gen:m,schema:g}=l;g===!1?(m.var(u,!1),h(l)):m.var(u,!0)}Ca.boolOrEmptySchema=c;function h(l,u){const{gen:m,data:g}=l,p={gen:m,keyword:"false schema",data:g,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:l};(0,e.reportError)(p,r,void 0,u)}return Ca}var an={},Ea={},WS;function v2(){if(WS)return Ea;WS=1,Object.defineProperty(Ea,"__esModule",{value:!0}),Ea.getRules=Ea.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function n(o){return typeof o=="string"&&t.has(o)}Ea.isJSONType=n;function r(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return Ea.getRules=r,Ea}var nr={},KS;function _2(){if(KS)return nr;KS=1,Object.defineProperty(nr,"__esModule",{value:!0}),nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function e({schema:r,self:o},c){const h=o.RULES.types[c];return h&&h!==!0&&t(r,h)}nr.schemaHasRulesForType=e;function t(r,o){return o.rules.some(c=>n(r,c))}nr.shouldUseGroup=t;function n(r,o){var c;return r[o.keyword]!==void 0||((c=o.definition.implements)===null||c===void 0?void 0:c.some(h=>r[h]!==void 0))}return nr.shouldUseRule=n,nr}var YS;function Jh(){if(YS)return an;YS=1,Object.defineProperty(an,"__esModule",{value:!0}),an.reportTypeError=an.checkDataTypes=an.checkDataType=an.coerceAndCheckDataType=an.getJSONTypes=an.getSchemaTypes=an.DataType=void 0;const e=v2(),t=_2(),n=df(),r=bt(),o=Nt();var c;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(c||(an.DataType=c={}));function h(v){const _=l(v.type);if(_.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!_.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&_.push("null")}return _}an.getSchemaTypes=h;function l(v){const _=Array.isArray(v)?v:v?[v]:[];if(_.every(e.isJSONType))return _;throw new Error("type must be JSONType or JSONType[]: "+_.join(","))}an.getJSONTypes=l;function u(v,_){const{gen:k,data:C,opts:x}=v,T=g(_,x.coerceTypes),R=_.length>0&&!(T.length===0&&_.length===1&&(0,t.schemaHasRulesForType)(v,_[0]));if(R){const M=A(_,C,x.strictNumbers,c.Wrong);k.if(M,()=>{T.length?p(v,_,T):y(v)})}return R}an.coerceAndCheckDataType=u;const m=new Set(["string","number","integer","boolean","null"]);function g(v,_){return _?v.filter(k=>m.has(k)||_==="array"&&k==="array"):[]}function p(v,_,k){const{gen:C,data:x,opts:T}=v,R=C.let("dataType",(0,r._)`typeof ${x}`),M=C.let("coerced",(0,r._)`undefined`);T.coerceTypes==="array"&&C.if((0,r._)`${R} == 'object' && Array.isArray(${x}) && ${x}.length == 1`,()=>C.assign(x,(0,r._)`${x}[0]`).assign(R,(0,r._)`typeof ${x}`).if(A(_,x,T.strictNumbers),()=>C.assign(M,x))),C.if((0,r._)`${M} !== undefined`);for(const L of k)(m.has(L)||L==="array"&&T.coerceTypes==="array")&&D(L);C.else(),y(v),C.endIf(),C.if((0,r._)`${M} !== undefined`,()=>{C.assign(x,M),S(v,M)});function D(L){switch(L){case"string":C.elseIf((0,r._)`${R} == "number" || ${R} == "boolean"`).assign(M,(0,r._)`"" + ${x}`).elseIf((0,r._)`${x} === null`).assign(M,(0,r._)`""`);return;case"number":C.elseIf((0,r._)`${R} == "boolean" || ${x} === null
483
+ || (${R} == "string" && ${x} && ${x} == +${x})`).assign(M,(0,r._)`+${x}`);return;case"integer":C.elseIf((0,r._)`${R} === "boolean" || ${x} === null
484
+ || (${R} === "string" && ${x} && ${x} == +${x} && !(${x} % 1))`).assign(M,(0,r._)`+${x}`);return;case"boolean":C.elseIf((0,r._)`${x} === "false" || ${x} === 0 || ${x} === null`).assign(M,!1).elseIf((0,r._)`${x} === "true" || ${x} === 1`).assign(M,!0);return;case"null":C.elseIf((0,r._)`${x} === "" || ${x} === 0 || ${x} === false`),C.assign(M,null);return;case"array":C.elseIf((0,r._)`${R} === "string" || ${R} === "number"
485
+ || ${R} === "boolean" || ${x} === null`).assign(M,(0,r._)`[${x}]`)}}}function S({gen:v,parentData:_,parentDataProperty:k},C){v.if((0,r._)`${_} !== undefined`,()=>v.assign((0,r._)`${_}[${k}]`,C))}function w(v,_,k,C=c.Correct){const x=C===c.Correct?r.operators.EQ:r.operators.NEQ;let T;switch(v){case"null":return(0,r._)`${_} ${x} null`;case"array":T=(0,r._)`Array.isArray(${_})`;break;case"object":T=(0,r._)`${_} && typeof ${_} == "object" && !Array.isArray(${_})`;break;case"integer":T=R((0,r._)`!(${_} % 1) && !isNaN(${_})`);break;case"number":T=R();break;default:return(0,r._)`typeof ${_} ${x} ${v}`}return C===c.Correct?T:(0,r.not)(T);function R(M=r.nil){return(0,r.and)((0,r._)`typeof ${_} == "number"`,M,k?(0,r._)`isFinite(${_})`:r.nil)}}an.checkDataType=w;function A(v,_,k,C){if(v.length===1)return w(v[0],_,k,C);let x;const T=(0,o.toHash)(v);if(T.array&&T.object){const R=(0,r._)`typeof ${_} != "object"`;x=T.null?R:(0,r._)`!${_} || ${R}`,delete T.null,delete T.array,delete T.object}else x=r.nil;T.number&&delete T.integer;for(const R in T)x=(0,r.and)(x,w(R,_,k,C));return x}an.checkDataTypes=A;const E={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:_})=>typeof v=="string"?(0,r._)`{type: ${v}}`:(0,r._)`{type: ${_}}`};function y(v){const _=b(v);(0,n.reportError)(_,E)}an.reportTypeError=y;function b(v){const{gen:_,data:k,schema:C}=v,x=(0,o.schemaRefOrVal)(v,C,"type");return{gen:_,keyword:"type",data:k,schema:C.type,schemaCode:x,schemaValue:x,parentSchema:C,params:{},it:v}}return an}var cc={},XS;function DD(){if(XS)return cc;XS=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.assignDefaults=void 0;const e=bt(),t=Nt();function n(o,c){const{properties:h,items:l}=o.schema;if(c==="object"&&h)for(const u in h)r(o,u,h[u].default);else c==="array"&&Array.isArray(l)&&l.forEach((u,m)=>r(o,m,u.default))}cc.assignDefaults=n;function r(o,c,h){const{gen:l,compositeRule:u,data:m,opts:g}=o;if(h===void 0)return;const p=(0,e._)`${m}${(0,e.getProperty)(c)}`;if(u){(0,t.checkStrictMode)(o,`default is ignored for: ${p}`);return}let S=(0,e._)`${p} === undefined`;g.useDefaults==="empty"&&(S=(0,e._)`${S} || ${p} === null || ${p} === ""`),l.if(S,(0,e._)`${p} = ${(0,e.stringify)(h)}`)}return cc}var Si={},Wt={},JS;function ji(){if(JS)return Wt;JS=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.validateUnion=Wt.validateArray=Wt.usePattern=Wt.callValidateCode=Wt.schemaProperties=Wt.allSchemaProperties=Wt.noPropertyInData=Wt.propertyInData=Wt.isOwnProperty=Wt.hasPropFunc=Wt.reportMissingProp=Wt.checkMissingProp=Wt.checkReportMissingProp=void 0;const e=bt(),t=Nt(),n=ki(),r=Nt();function o(v,_){const{gen:k,data:C,it:x}=v;k.if(g(k,C,_,x.opts.ownProperties),()=>{v.setParams({missingProperty:(0,e._)`${_}`},!0),v.error()})}Wt.checkReportMissingProp=o;function c({gen:v,data:_,it:{opts:k}},C,x){return(0,e.or)(...C.map(T=>(0,e.and)(g(v,_,T,k.ownProperties),(0,e._)`${x} = ${T}`)))}Wt.checkMissingProp=c;function h(v,_){v.setParams({missingProperty:_},!0),v.error()}Wt.reportMissingProp=h;function l(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}Wt.hasPropFunc=l;function u(v,_,k){return(0,e._)`${l(v)}.call(${_}, ${k})`}Wt.isOwnProperty=u;function m(v,_,k,C){const x=(0,e._)`${_}${(0,e.getProperty)(k)} !== undefined`;return C?(0,e._)`${x} && ${u(v,_,k)}`:x}Wt.propertyInData=m;function g(v,_,k,C){const x=(0,e._)`${_}${(0,e.getProperty)(k)} === undefined`;return C?(0,e.or)(x,(0,e.not)(u(v,_,k))):x}Wt.noPropertyInData=g;function p(v){return v?Object.keys(v).filter(_=>_!=="__proto__"):[]}Wt.allSchemaProperties=p;function S(v,_){return p(_).filter(k=>!(0,t.alwaysValidSchema)(v,_[k]))}Wt.schemaProperties=S;function w({schemaCode:v,data:_,it:{gen:k,topSchemaRef:C,schemaPath:x,errorPath:T},it:R},M,D,L){const q=L?(0,e._)`${v}, ${_}, ${C}${x}`:_,F=[[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,T)],[n.default.parentData,R.parentData],[n.default.parentDataProperty,R.parentDataProperty],[n.default.rootData,n.default.rootData]];R.opts.dynamicRef&&F.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const Y=(0,e._)`${q}, ${k.object(...F)}`;return D!==e.nil?(0,e._)`${M}.call(${D}, ${Y})`:(0,e._)`${M}(${Y})`}Wt.callValidateCode=w;const A=(0,e._)`new RegExp`;function E({gen:v,it:{opts:_}},k){const C=_.unicodeRegExp?"u":"",{regExp:x}=_.code,T=x(k,C);return v.scopeValue("pattern",{key:T.toString(),ref:T,code:(0,e._)`${x.code==="new RegExp"?A:(0,r.useFunc)(v,x)}(${k}, ${C})`})}Wt.usePattern=E;function y(v){const{gen:_,data:k,keyword:C,it:x}=v,T=_.name("valid");if(x.allErrors){const M=_.let("valid",!0);return R(()=>_.assign(M,!1)),M}return _.var(T,!0),R(()=>_.break()),T;function R(M){const D=_.const("len",(0,e._)`${k}.length`);_.forRange("i",0,D,L=>{v.subschema({keyword:C,dataProp:L,dataPropType:t.Type.Num},T),_.if((0,e.not)(T),M)})}}Wt.validateArray=y;function b(v){const{gen:_,schema:k,keyword:C,it:x}=v;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(D=>(0,t.alwaysValidSchema)(x,D))&&!x.opts.unevaluated)return;const R=_.let("valid",!1),M=_.name("_valid");_.block(()=>k.forEach((D,L)=>{const q=v.subschema({keyword:C,schemaProp:L,compositeRule:!0},M);_.assign(R,(0,e._)`${R} || ${M}`),v.mergeValidEvaluated(q,M)||_.if((0,e.not)(R))})),v.result(R,()=>v.reset(),()=>v.error(!0))}return Wt.validateUnion=b,Wt}var ZS;function OD(){if(ZS)return Si;ZS=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.validateKeywordUsage=Si.validSchemaType=Si.funcKeywordCode=Si.macroKeywordCode=void 0;const e=bt(),t=ki(),n=ji(),r=df();function o(S,w){const{gen:A,keyword:E,schema:y,parentSchema:b,it:v}=S,_=w.macro.call(v.self,y,b,v),k=m(A,E,_);v.opts.validateSchema!==!1&&v.self.validateSchema(_,!0);const C=A.name("valid");S.subschema({schema:_,schemaPath:e.nil,errSchemaPath:`${v.errSchemaPath}/${E}`,topSchemaRef:k,compositeRule:!0},C),S.pass(C,()=>S.error(!0))}Si.macroKeywordCode=o;function c(S,w){var A;const{gen:E,keyword:y,schema:b,parentSchema:v,$data:_,it:k}=S;u(k,w);const C=!_&&w.compile?w.compile.call(k.self,b,v,k):w.validate,x=m(E,y,C),T=E.let("valid");S.block$data(T,R),S.ok((A=w.valid)!==null&&A!==void 0?A:T);function R(){if(w.errors===!1)L(),w.modifying&&h(S),q(()=>S.error());else{const F=w.async?M():D();w.modifying&&h(S),q(()=>l(S,F))}}function M(){const F=E.let("ruleErrs",null);return E.try(()=>L((0,e._)`await `),Y=>E.assign(T,!1).if((0,e._)`${Y} instanceof ${k.ValidationError}`,()=>E.assign(F,(0,e._)`${Y}.errors`),()=>E.throw(Y))),F}function D(){const F=(0,e._)`${x}.errors`;return E.assign(F,null),L(e.nil),F}function L(F=w.async?(0,e._)`await `:e.nil){const Y=k.opts.passContext?t.default.this:t.default.self,Q=!("compile"in w&&!_||w.schema===!1);E.assign(T,(0,e._)`${F}${(0,n.callValidateCode)(S,x,Y,Q)}`,w.modifying)}function q(F){var Y;E.if((0,e.not)((Y=w.valid)!==null&&Y!==void 0?Y:T),F)}}Si.funcKeywordCode=c;function h(S){const{gen:w,data:A,it:E}=S;w.if(E.parentData,()=>w.assign(A,(0,e._)`${E.parentData}[${E.parentDataProperty}]`))}function l(S,w){const{gen:A}=S;A.if((0,e._)`Array.isArray(${w})`,()=>{A.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${w} : ${t.default.vErrors}.concat(${w})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,r.extendErrors)(S)},()=>S.error())}function u({schemaEnv:S},w){if(w.async&&!S.$async)throw new Error("async keyword in sync schema")}function m(S,w,A){if(A===void 0)throw new Error(`keyword "${w}" failed to compile`);return S.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,e.stringify)(A)})}function g(S,w,A=!1){return!w.length||w.some(E=>E==="array"?Array.isArray(S):E==="object"?S&&typeof S=="object"&&!Array.isArray(S):typeof S==E||A&&typeof S>"u")}Si.validSchemaType=g;function p({schema:S,opts:w,self:A,errSchemaPath:E},y,b){if(Array.isArray(y.keyword)?!y.keyword.includes(b):y.keyword!==b)throw new Error("ajv implementation error");const v=y.dependencies;if(v!=null&&v.some(_=>!Object.prototype.hasOwnProperty.call(S,_)))throw new Error(`parent schema must have dependencies of ${b}: ${v.join(",")}`);if(y.validateSchema&&!y.validateSchema(S[b])){const k=`keyword "${b}" value is invalid at path "${E}": `+A.errorsText(y.validateSchema.errors);if(w.validateSchema==="log")A.logger.error(k);else throw new Error(k)}}return Si.validateKeywordUsage=p,Si}var ir={},QS;function LD(){if(QS)return ir;QS=1,Object.defineProperty(ir,"__esModule",{value:!0}),ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;const e=bt(),t=Nt();function n(c,{keyword:h,schemaProp:l,schema:u,schemaPath:m,errSchemaPath:g,topSchemaRef:p}){if(h!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(h!==void 0){const S=c.schema[h];return l===void 0?{schema:S,schemaPath:(0,e._)`${c.schemaPath}${(0,e.getProperty)(h)}`,errSchemaPath:`${c.errSchemaPath}/${h}`}:{schema:S[l],schemaPath:(0,e._)`${c.schemaPath}${(0,e.getProperty)(h)}${(0,e.getProperty)(l)}`,errSchemaPath:`${c.errSchemaPath}/${h}/${(0,t.escapeFragment)(l)}`}}if(u!==void 0){if(m===void 0||g===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:m,topSchemaRef:p,errSchemaPath:g}}throw new Error('either "keyword" or "schema" must be passed')}ir.getSubschema=n;function r(c,h,{dataProp:l,dataPropType:u,data:m,dataTypes:g,propertyName:p}){if(m!==void 0&&l!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:S}=h;if(l!==void 0){const{errorPath:A,dataPathArr:E,opts:y}=h,b=S.let("data",(0,e._)`${h.data}${(0,e.getProperty)(l)}`,!0);w(b),c.errorPath=(0,e.str)`${A}${(0,t.getErrorPath)(l,u,y.jsPropertySyntax)}`,c.parentDataProperty=(0,e._)`${l}`,c.dataPathArr=[...E,c.parentDataProperty]}if(m!==void 0){const A=m instanceof e.Name?m:S.let("data",m,!0);w(A),p!==void 0&&(c.propertyName=p)}g&&(c.dataTypes=g);function w(A){c.data=A,c.dataLevel=h.dataLevel+1,c.dataTypes=[],h.definedProperties=new Set,c.parentData=h.data,c.dataNames=[...h.dataNames,A]}}ir.extendSubschemaData=r;function o(c,{jtdDiscriminator:h,jtdMetadata:l,compositeRule:u,createErrors:m,allErrors:g}){u!==void 0&&(c.compositeRule=u),m!==void 0&&(c.createErrors=m),g!==void 0&&(c.allErrors=g),c.jtdDiscriminator=h,c.jtdMetadata=l}return ir.extendSubschemaMode=o,ir}var bn={},cg,ew;function y2(){return ew||(ew=1,cg=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,c;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(c=Object.keys(t),r=c.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[o]))return!1;for(o=r;o--!==0;){var h=c[o];if(!e(t[h],n[h]))return!1}return!0}return t!==t&&n!==n}),cg}var ug={exports:{}},tw;function ID(){if(tw)return ug.exports;tw=1;var e=ug.exports=function(r,o,c){typeof o=="function"&&(c=o,o={}),c=o.cb||c;var h=typeof c=="function"?c:c.pre||function(){},l=c.post||function(){};t(o,h,l,r,"",r)};e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t(r,o,c,h,l,u,m,g,p,S){if(h&&typeof h=="object"&&!Array.isArray(h)){o(h,l,u,m,g,p,S);for(var w in h){var A=h[w];if(Array.isArray(A)){if(w in e.arrayKeywords)for(var E=0;E<A.length;E++)t(r,o,c,A[E],l+"/"+w+"/"+E,u,l,w,h,E)}else if(w in e.propsKeywords){if(A&&typeof A=="object")for(var y in A)t(r,o,c,A[y],l+"/"+w+"/"+n(y),u,l,w,h,y)}else(w in e.keywords||r.allKeys&&!(w in e.skipKeywords))&&t(r,o,c,A,l+"/"+w,u,l,w,h)}c(h,l,u,m,g,p,S)}}function n(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}return ug.exports}var sw;function hf(){if(sw)return bn;sw=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.getSchemaRefs=bn.resolveUrl=bn.normalizeId=bn._getFullPath=bn.getFullPath=bn.inlineRef=void 0;const e=Nt(),t=y2(),n=ID(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(E,y=!0){return typeof E=="boolean"?!0:y===!0?!h(E):y?l(E)<=y:!1}bn.inlineRef=o;const c=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h(E){for(const y in E){if(c.has(y))return!0;const b=E[y];if(Array.isArray(b)&&b.some(h)||typeof b=="object"&&h(b))return!0}return!1}function l(E){let y=0;for(const b in E){if(b==="$ref")return 1/0;if(y++,!r.has(b)&&(typeof E[b]=="object"&&(0,e.eachItem)(E[b],v=>y+=l(v)),y===1/0))return 1/0}return y}function u(E,y="",b){b!==!1&&(y=p(y));const v=E.parse(y);return m(E,v)}bn.getFullPath=u;function m(E,y){return E.serialize(y).split("#")[0]+"#"}bn._getFullPath=m;const g=/#\/?$/;function p(E){return E?E.replace(g,""):""}bn.normalizeId=p;function S(E,y,b){return b=p(b),E.resolve(y,b)}bn.resolveUrl=S;const w=/^[a-z_][-a-z0-9._]*$/i;function A(E,y){if(typeof E=="boolean")return{};const{schemaId:b,uriResolver:v}=this.opts,_=p(E[b]||y),k={"":_},C=u(v,_,!1),x={},T=new Set;return n(E,{allKeys:!0},(D,L,q,F)=>{if(F===void 0)return;const Y=C+L;let Q=k[F];typeof D[b]=="string"&&(Q=G.call(this,D[b])),ee.call(this,D.$anchor),ee.call(this,D.$dynamicAnchor),k[L]=Q;function G(ne){const z=this.opts.uriResolver.resolve;if(ne=p(Q?z(Q,ne):ne),T.has(ne))throw M(ne);T.add(ne);let B=this.refs[ne];return typeof B=="string"&&(B=this.refs[B]),typeof B=="object"?R(D,B.schema,ne):ne!==p(Y)&&(ne[0]==="#"?(R(D,x[ne],ne),x[ne]=D):this.refs[ne]=Y),ne}function ee(ne){if(typeof ne=="string"){if(!w.test(ne))throw new Error(`invalid anchor "${ne}"`);G.call(this,`#${ne}`)}}}),x;function R(D,L,q){if(L!==void 0&&!t(D,L))throw M(q)}function M(D){return new Error(`reference "${D}" resolves to more than one schema`)}}return bn.getSchemaRefs=A,bn}var nw;function ff(){if(nw)return sr;nw=1,Object.defineProperty(sr,"__esModule",{value:!0}),sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;const e=$D(),t=Jh(),n=_2(),r=Jh(),o=DD(),c=OD(),h=LD(),l=bt(),u=ki(),m=hf(),g=Nt(),p=df();function S(Z){if(C(Z)&&(T(Z),k(Z))){y(Z);return}w(Z,()=>(0,e.topBoolOrEmptySchema)(Z))}sr.validateFunctionCode=S;function w({gen:Z,validateName:te,schema:pe,schemaEnv:ye,opts:Ee},Ie){Ee.code.es5?Z.func(te,(0,l._)`${u.default.data}, ${u.default.valCxt}`,ye.$async,()=>{Z.code((0,l._)`"use strict"; ${v(pe,Ee)}`),E(Z,Ee),Z.code(Ie)}):Z.func(te,(0,l._)`${u.default.data}, ${A(Ee)}`,ye.$async,()=>Z.code(v(pe,Ee)).code(Ie))}function A(Z){return(0,l._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${Z.dynamicRef?(0,l._)`, ${u.default.dynamicAnchors}={}`:l.nil}}={}`}function E(Z,te){Z.if(u.default.valCxt,()=>{Z.var(u.default.instancePath,(0,l._)`${u.default.valCxt}.${u.default.instancePath}`),Z.var(u.default.parentData,(0,l._)`${u.default.valCxt}.${u.default.parentData}`),Z.var(u.default.parentDataProperty,(0,l._)`${u.default.valCxt}.${u.default.parentDataProperty}`),Z.var(u.default.rootData,(0,l._)`${u.default.valCxt}.${u.default.rootData}`),te.dynamicRef&&Z.var(u.default.dynamicAnchors,(0,l._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{Z.var(u.default.instancePath,(0,l._)`""`),Z.var(u.default.parentData,(0,l._)`undefined`),Z.var(u.default.parentDataProperty,(0,l._)`undefined`),Z.var(u.default.rootData,u.default.data),te.dynamicRef&&Z.var(u.default.dynamicAnchors,(0,l._)`{}`)})}function y(Z){const{schema:te,opts:pe,gen:ye}=Z;w(Z,()=>{pe.$comment&&te.$comment&&F(Z),D(Z),ye.let(u.default.vErrors,null),ye.let(u.default.errors,0),pe.unevaluated&&b(Z),R(Z),Y(Z)})}function b(Z){const{gen:te,validateName:pe}=Z;Z.evaluated=te.const("evaluated",(0,l._)`${pe}.evaluated`),te.if((0,l._)`${Z.evaluated}.dynamicProps`,()=>te.assign((0,l._)`${Z.evaluated}.props`,(0,l._)`undefined`)),te.if((0,l._)`${Z.evaluated}.dynamicItems`,()=>te.assign((0,l._)`${Z.evaluated}.items`,(0,l._)`undefined`))}function v(Z,te){const pe=typeof Z=="object"&&Z[te.schemaId];return pe&&(te.code.source||te.code.process)?(0,l._)`/*# sourceURL=${pe} */`:l.nil}function _(Z,te){if(C(Z)&&(T(Z),k(Z))){x(Z,te);return}(0,e.boolOrEmptySchema)(Z,te)}function k({schema:Z,self:te}){if(typeof Z=="boolean")return!Z;for(const pe in Z)if(te.RULES.all[pe])return!0;return!1}function C(Z){return typeof Z.schema!="boolean"}function x(Z,te){const{schema:pe,gen:ye,opts:Ee}=Z;Ee.$comment&&pe.$comment&&F(Z),L(Z),q(Z);const Ie=ye.const("_errs",u.default.errors);R(Z,Ie),ye.var(te,(0,l._)`${Ie} === ${u.default.errors}`)}function T(Z){(0,g.checkUnknownRules)(Z),M(Z)}function R(Z,te){if(Z.opts.jtd)return G(Z,[],!1,te);const pe=(0,t.getSchemaTypes)(Z.schema),ye=(0,t.coerceAndCheckDataType)(Z,pe);G(Z,pe,!ye,te)}function M(Z){const{schema:te,errSchemaPath:pe,opts:ye,self:Ee}=Z;te.$ref&&ye.ignoreKeywordsWithRef&&(0,g.schemaHasRulesButRef)(te,Ee.RULES)&&Ee.logger.warn(`$ref: keywords ignored in schema at path "${pe}"`)}function D(Z){const{schema:te,opts:pe}=Z;te.default!==void 0&&pe.useDefaults&&pe.strictSchema&&(0,g.checkStrictMode)(Z,"default is ignored in the schema root")}function L(Z){const te=Z.schema[Z.opts.schemaId];te&&(Z.baseId=(0,m.resolveUrl)(Z.opts.uriResolver,Z.baseId,te))}function q(Z){if(Z.schema.$async&&!Z.schemaEnv.$async)throw new Error("async schema in sync schema")}function F({gen:Z,schemaEnv:te,schema:pe,errSchemaPath:ye,opts:Ee}){const Ie=pe.$comment;if(Ee.$comment===!0)Z.code((0,l._)`${u.default.self}.logger.log(${Ie})`);else if(typeof Ee.$comment=="function"){const Pe=(0,l.str)`${ye}/$comment`,Fe=Z.scopeValue("root",{ref:te.root});Z.code((0,l._)`${u.default.self}.opts.$comment(${Ie}, ${Pe}, ${Fe}.schema)`)}}function Y(Z){const{gen:te,schemaEnv:pe,validateName:ye,ValidationError:Ee,opts:Ie}=Z;pe.$async?te.if((0,l._)`${u.default.errors} === 0`,()=>te.return(u.default.data),()=>te.throw((0,l._)`new ${Ee}(${u.default.vErrors})`)):(te.assign((0,l._)`${ye}.errors`,u.default.vErrors),Ie.unevaluated&&Q(Z),te.return((0,l._)`${u.default.errors} === 0`))}function Q({gen:Z,evaluated:te,props:pe,items:ye}){pe instanceof l.Name&&Z.assign((0,l._)`${te}.props`,pe),ye instanceof l.Name&&Z.assign((0,l._)`${te}.items`,ye)}function G(Z,te,pe,ye){const{gen:Ee,schema:Ie,data:Pe,allErrors:Fe,opts:je,self:Ue}=Z,{RULES:Ye}=Ue;if(Ie.$ref&&(je.ignoreKeywordsWithRef||!(0,g.schemaHasRulesButRef)(Ie,Ye))){Ee.block(()=>X(Z,"$ref",Ye.all.$ref.definition));return}je.jtd||ne(Z,te),Ee.block(()=>{for(const rt of Ye.rules)jt(rt);jt(Ye.post)});function jt(rt){(0,n.shouldUseGroup)(Ie,rt)&&(rt.type?(Ee.if((0,r.checkDataType)(rt.type,Pe,je.strictNumbers)),ee(Z,rt),te.length===1&&te[0]===rt.type&&pe&&(Ee.else(),(0,r.reportTypeError)(Z)),Ee.endIf()):ee(Z,rt),Fe||Ee.if((0,l._)`${u.default.errors} === ${ye||0}`))}}function ee(Z,te){const{gen:pe,schema:ye,opts:{useDefaults:Ee}}=Z;Ee&&(0,o.assignDefaults)(Z,te.type),pe.block(()=>{for(const Ie of te.rules)(0,n.shouldUseRule)(ye,Ie)&&X(Z,Ie.keyword,Ie.definition,te.type)})}function ne(Z,te){Z.schemaEnv.meta||!Z.opts.strictTypes||(z(Z,te),Z.opts.allowUnionTypes||B(Z,te),$(Z,Z.dataTypes))}function z(Z,te){if(te.length){if(!Z.dataTypes.length){Z.dataTypes=te;return}te.forEach(pe=>{U(Z.dataTypes,pe)||W(Z,`type "${pe}" not allowed by context "${Z.dataTypes.join(",")}"`)}),P(Z,te)}}function B(Z,te){te.length>1&&!(te.length===2&&te.includes("null"))&&W(Z,"use allowUnionTypes to allow union type keyword")}function $(Z,te){const pe=Z.self.RULES.all;for(const ye in pe){const Ee=pe[ye];if(typeof Ee=="object"&&(0,n.shouldUseRule)(Z.schema,Ee)){const{type:Ie}=Ee.definition;Ie.length&&!Ie.some(Pe=>H(te,Pe))&&W(Z,`missing type "${Ie.join(",")}" for keyword "${ye}"`)}}}function H(Z,te){return Z.includes(te)||te==="number"&&Z.includes("integer")}function U(Z,te){return Z.includes(te)||te==="integer"&&Z.includes("number")}function P(Z,te){const pe=[];for(const ye of Z.dataTypes)U(te,ye)?pe.push(ye):te.includes("integer")&&ye==="number"&&pe.push("integer");Z.dataTypes=pe}function W(Z,te){const pe=Z.schemaEnv.baseId+Z.errSchemaPath;te+=` at "${pe}" (strictTypes)`,(0,g.checkStrictMode)(Z,te,Z.opts.strictTypes)}class se{constructor(te,pe,ye){if((0,c.validateKeywordUsage)(te,pe,ye),this.gen=te.gen,this.allErrors=te.allErrors,this.keyword=ye,this.data=te.data,this.schema=te.schema[ye],this.$data=pe.$data&&te.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,g.schemaRefOrVal)(te,this.schema,ye,this.$data),this.schemaType=pe.schemaType,this.parentSchema=te.schema,this.params={},this.it=te,this.def=pe,this.$data)this.schemaCode=te.gen.const("vSchema",oe(this.$data,te));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,pe.schemaType,pe.allowUndefined))throw new Error(`${ye} value must be ${JSON.stringify(pe.schemaType)}`);("code"in pe?pe.trackErrors:pe.errors!==!1)&&(this.errsCount=te.gen.const("_errs",u.default.errors))}result(te,pe,ye){this.failResult((0,l.not)(te),pe,ye)}failResult(te,pe,ye){this.gen.if(te),ye?ye():this.error(),pe?(this.gen.else(),pe(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(te,pe){this.failResult((0,l.not)(te),void 0,pe)}fail(te){if(te===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(te),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(te){if(!this.$data)return this.fail(te);const{schemaCode:pe}=this;this.fail((0,l._)`${pe} !== undefined && (${(0,l.or)(this.invalid$data(),te)})`)}error(te,pe,ye){if(pe){this.setParams(pe),this._error(te,ye),this.setParams({});return}this._error(te,ye)}_error(te,pe){(te?p.reportExtraError:p.reportError)(this,this.def.error,pe)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(te){this.allErrors||this.gen.if(te)}setParams(te,pe){pe?Object.assign(this.params,te):this.params=te}block$data(te,pe,ye=l.nil){this.gen.block(()=>{this.check$data(te,ye),pe()})}check$data(te=l.nil,pe=l.nil){if(!this.$data)return;const{gen:ye,schemaCode:Ee,schemaType:Ie,def:Pe}=this;ye.if((0,l.or)((0,l._)`${Ee} === undefined`,pe)),te!==l.nil&&ye.assign(te,!0),(Ie.length||Pe.validateSchema)&&(ye.elseIf(this.invalid$data()),this.$dataError(),te!==l.nil&&ye.assign(te,!1)),ye.else()}invalid$data(){const{gen:te,schemaCode:pe,schemaType:ye,def:Ee,it:Ie}=this;return(0,l.or)(Pe(),Fe());function Pe(){if(ye.length){if(!(pe instanceof l.Name))throw new Error("ajv implementation error");const je=Array.isArray(ye)?ye:[ye];return(0,l._)`${(0,r.checkDataTypes)(je,pe,Ie.opts.strictNumbers,r.DataType.Wrong)}`}return l.nil}function Fe(){if(Ee.validateSchema){const je=te.scopeValue("validate$data",{ref:Ee.validateSchema});return(0,l._)`!${je}(${pe})`}return l.nil}}subschema(te,pe){const ye=(0,h.getSubschema)(this.it,te);(0,h.extendSubschemaData)(ye,this.it,te),(0,h.extendSubschemaMode)(ye,te);const Ee={...this.it,...ye,items:void 0,props:void 0};return _(Ee,pe),Ee}mergeEvaluated(te,pe){const{it:ye,gen:Ee}=this;ye.opts.unevaluated&&(ye.props!==!0&&te.props!==void 0&&(ye.props=g.mergeEvaluated.props(Ee,te.props,ye.props,pe)),ye.items!==!0&&te.items!==void 0&&(ye.items=g.mergeEvaluated.items(Ee,te.items,ye.items,pe)))}mergeValidEvaluated(te,pe){const{it:ye,gen:Ee}=this;if(ye.opts.unevaluated&&(ye.props!==!0||ye.items!==!0))return Ee.if(pe,()=>this.mergeEvaluated(te,l.Name)),!0}}sr.KeywordCxt=se;function X(Z,te,pe,ye){const Ee=new se(Z,pe,te);"code"in pe?pe.code(Ee,ye):Ee.$data&&pe.validate?(0,c.funcKeywordCode)(Ee,pe):"macro"in pe?(0,c.macroKeywordCode)(Ee,pe):(pe.compile||pe.validate)&&(0,c.funcKeywordCode)(Ee,pe)}const V=/^\/(?:[^~]|~0|~1)*$/,ce=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oe(Z,{dataLevel:te,dataNames:pe,dataPathArr:ye}){let Ee,Ie;if(Z==="")return u.default.rootData;if(Z[0]==="/"){if(!V.test(Z))throw new Error(`Invalid JSON-pointer: ${Z}`);Ee=Z,Ie=u.default.rootData}else{const Ue=ce.exec(Z);if(!Ue)throw new Error(`Invalid JSON-pointer: ${Z}`);const Ye=+Ue[1];if(Ee=Ue[2],Ee==="#"){if(Ye>=te)throw new Error(je("property/index",Ye));return ye[te-Ye]}if(Ye>te)throw new Error(je("data",Ye));if(Ie=pe[te-Ye],!Ee)return Ie}let Pe=Ie;const Fe=Ee.split("/");for(const Ue of Fe)Ue&&(Ie=(0,l._)`${Ie}${(0,l.getProperty)((0,g.unescapeJsonPointer)(Ue))}`,Pe=(0,l._)`${Pe} && ${Ie}`);return Pe;function je(Ue,Ye){return`Cannot access ${Ue} ${Ye} levels up, current level is ${te}`}}return sr.getData=oe,sr}var ld={},iw;function i_(){if(iw)return ld;iw=1,Object.defineProperty(ld,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return ld.default=e,ld}var cd={},rw;function pf(){if(rw)return cd;rw=1,Object.defineProperty(cd,"__esModule",{value:!0});const e=hf();class t extends Error{constructor(r,o,c,h){super(h||`can't resolve reference ${c} from id ${o}`),this.missingRef=(0,e.resolveUrl)(r,o,c),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(r,this.missingRef))}}return cd.default=t,cd}var Gn={},aw;function mf(){if(aw)return Gn;aw=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.resolveSchema=Gn.getCompilingSchema=Gn.resolveRef=Gn.compileSchema=Gn.SchemaEnv=void 0;const e=bt(),t=i_(),n=ki(),r=hf(),o=Nt(),c=ff();class h{constructor(b){var v;this.refs={},this.dynamicAnchors={};let _;typeof b.schema=="object"&&(_=b.schema),this.schema=b.schema,this.schemaId=b.schemaId,this.root=b.root||this,this.baseId=(v=b.baseId)!==null&&v!==void 0?v:(0,r.normalizeId)(_==null?void 0:_[b.schemaId||"$id"]),this.schemaPath=b.schemaPath,this.localRefs=b.localRefs,this.meta=b.meta,this.$async=_==null?void 0:_.$async,this.refs={}}}Gn.SchemaEnv=h;function l(y){const b=g.call(this,y);if(b)return b;const v=(0,r.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:_,lines:k}=this.opts.code,{ownProperties:C}=this.opts,x=new e.CodeGen(this.scope,{es5:_,lines:k,ownProperties:C});let T;y.$async&&(T=x.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const R=x.scopeName("validate");y.validateName=R;const M={gen:x,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:x.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,e.stringify)(y.schema)}:{ref:y.schema}),validateName:R,ValidationError:T,schema:y.schema,schemaEnv:y,rootId:v,baseId:y.baseId||v,schemaPath:e.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let D;try{this._compilations.add(y),(0,c.validateFunctionCode)(M),x.optimize(this.opts.code.optimize);const L=x.toString();D=`${x.scopeRefs(n.default.scope)}return ${L}`,this.opts.code.process&&(D=this.opts.code.process(D,y));const F=new Function(`${n.default.self}`,`${n.default.scope}`,D)(this,this.scope.get());if(this.scope.value(R,{ref:F}),F.errors=null,F.schema=y.schema,F.schemaEnv=y,y.$async&&(F.$async=!0),this.opts.code.source===!0&&(F.source={validateName:R,validateCode:L,scopeValues:x._values}),this.opts.unevaluated){const{props:Y,items:Q}=M;F.evaluated={props:Y instanceof e.Name?void 0:Y,items:Q instanceof e.Name?void 0:Q,dynamicProps:Y instanceof e.Name,dynamicItems:Q instanceof e.Name},F.source&&(F.source.evaluated=(0,e.stringify)(F.evaluated))}return y.validate=F,y}catch(L){throw delete y.validate,delete y.validateName,D&&this.logger.error("Error compiling schema, function code:",D),L}finally{this._compilations.delete(y)}}Gn.compileSchema=l;function u(y,b,v){var _;v=(0,r.resolveUrl)(this.opts.uriResolver,b,v);const k=y.refs[v];if(k)return k;let C=S.call(this,y,v);if(C===void 0){const x=(_=y.localRefs)===null||_===void 0?void 0:_[v],{schemaId:T}=this.opts;x&&(C=new h({schema:x,schemaId:T,root:y,baseId:b}))}if(C!==void 0)return y.refs[v]=m.call(this,C)}Gn.resolveRef=u;function m(y){return(0,r.inlineRef)(y.schema,this.opts.inlineRefs)?y.schema:y.validate?y:l.call(this,y)}function g(y){for(const b of this._compilations)if(p(b,y))return b}Gn.getCompilingSchema=g;function p(y,b){return y.schema===b.schema&&y.root===b.root&&y.baseId===b.baseId}function S(y,b){let v;for(;typeof(v=this.refs[b])=="string";)b=v;return v||this.schemas[b]||w.call(this,y,b)}function w(y,b){const v=this.opts.uriResolver.parse(b),_=(0,r._getFullPath)(this.opts.uriResolver,v);let k=(0,r.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&_===k)return E.call(this,v,y);const C=(0,r.normalizeId)(_),x=this.refs[C]||this.schemas[C];if(typeof x=="string"){const T=w.call(this,y,x);return typeof(T==null?void 0:T.schema)!="object"?void 0:E.call(this,v,T)}if(typeof(x==null?void 0:x.schema)=="object"){if(x.validate||l.call(this,x),C===(0,r.normalizeId)(b)){const{schema:T}=x,{schemaId:R}=this.opts,M=T[R];return M&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,M)),new h({schema:T,schemaId:R,root:y,baseId:k})}return E.call(this,v,x)}}Gn.resolveSchema=w;const A=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function E(y,{baseId:b,schema:v,root:_}){var k;if(((k=y.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(const T of y.fragment.slice(1).split("/")){if(typeof v=="boolean")return;const R=v[(0,o.unescapeFragment)(T)];if(R===void 0)return;v=R;const M=typeof v=="object"&&v[this.opts.schemaId];!A.has(T)&&M&&(b=(0,r.resolveUrl)(this.opts.uriResolver,b,M))}let C;if(typeof v!="boolean"&&v.$ref&&!(0,o.schemaHasRulesButRef)(v,this.RULES)){const T=(0,r.resolveUrl)(this.opts.uriResolver,b,v.$ref);C=w.call(this,_,T)}const{schemaId:x}=this.opts;if(C=C||new h({schema:v,schemaId:x,root:_,baseId:b}),C.schema!==C.root.schema)return C}return Gn}const PD="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",BD="Meta-schema for $data reference (JSON AnySchema extension proposal)",zD="object",HD=["$data"],UD={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},FD=!1,qD={$id:PD,description:BD,type:zD,required:HD,properties:UD,additionalProperties:FD};var ud={},uc={exports:{}},dg,ow;function b2(){if(ow)return dg;ow=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),n=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),r=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function c(C){let x="",T=0,R=0;for(R=0;R<C.length;R++)if(T=C[R].charCodeAt(0),T!==48){if(!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";x+=C[R];break}for(R+=1;R<C.length;R++){if(T=C[R].charCodeAt(0),!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";x+=C[R]}return x}const h=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(C){return C.length=0,!0}function u(C,x,T){if(C.length){const R=c(C);if(R!=="")x.push(R);else return T.error=!0,!1;C.length=0}return!0}function m(C){let x=0;const T={error:!1,address:"",zone:""},R=[],M=[];let D=!1,L=!1,q=u;for(let F=0;F<C.length;F++){const Y=C[F];if(!(Y==="["||Y==="]"))if(Y===":"){if(D===!0&&(L=!0),!q(M,R,T))break;if(++x>7){T.error=!0;break}F>0&&C[F-1]===":"&&(D=!0),R.push(":");continue}else if(Y==="%"){if(!q(M,R,T))break;q=l}else{M.push(Y);continue}}return M.length&&(q===l?T.zone=M.join(""):L?R.push(M.join("")):R.push(c(M))),T.address=R.join(""),T}function g(C){if(p(C,":")<2)return{host:C,isIPV6:!1};const x=m(C);if(x.error)return{host:C,isIPV6:!1};{let T=x.address,R=x.address;return x.zone&&(T+="%"+x.zone,R+="%25"+x.zone),{host:T,isIPV6:!0,escapedHost:R}}}function p(C,x){let T=0;for(let R=0;R<C.length;R++)C[R]===x&&T++;return T}function S(C){let x=C;const T=[];let R=-1,M=0;for(;M=x.length;){if(M===1){if(x===".")break;if(x==="/"){T.push("/");break}else{T.push(x);break}}else if(M===2){if(x[0]==="."){if(x[1]===".")break;if(x[1]==="/"){x=x.slice(2);continue}}else if(x[0]==="/"&&(x[1]==="."||x[1]==="/")){T.push("/");break}}else if(M===3&&x==="/.."){T.length!==0&&T.pop(),T.push("/");break}if(x[0]==="."){if(x[1]==="."){if(x[2]==="/"){x=x.slice(3);continue}}else if(x[1]==="/"){x=x.slice(2);continue}}else if(x[0]==="/"&&x[1]==="."){if(x[2]==="/"){x=x.slice(2);continue}else if(x[2]==="."&&x[3]==="/"){x=x.slice(3),T.length!==0&&T.pop();continue}}if((R=x.indexOf("/",1))===-1){T.push(x);break}else T.push(x.slice(0,R)),x=x.slice(R)}return T.join("")}const w={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},A=/[@/?#:]/g,E=/[@/?#]/g;function y(C,x){const T=x?E:A;return T.lastIndex=0,C.replace(T,R=>w[R])}function b(C,x=!1){if(C.indexOf("%")===-1)return C;let T="";for(let R=0;R<C.length;R++){if(C[R]==="%"&&R+2<C.length){const M=C.slice(R+1,R+3);if(n(M)){const D=M.toUpperCase(),L=String.fromCharCode(parseInt(D,16));x&&r(L)?T+=L:T+="%"+D,R+=2;continue}}T+=C[R]}return T}function v(C){let x="";for(let T=0;T<C.length;T++){if(C[T]==="%"&&T+2<C.length){const R=C.slice(T+1,T+3);if(n(R)){const M=R.toUpperCase(),D=String.fromCharCode(parseInt(M,16));D!=="."&&r(D)?x+=D:x+="%"+M,T+=2;continue}}o(C[T])?x+=C[T]:x+=escape(C[T])}return x}function _(C){let x="";for(let T=0;T<C.length;T++){if(C[T]==="%"&&T+2<C.length){const R=C.slice(T+1,T+3);if(n(R)){x+="%"+R.toUpperCase(),T+=2;continue}}x+=escape(C[T])}return x}function k(C){const x=[];if(C.userinfo!==void 0&&(x.push(C.userinfo),x.push("@")),C.host!==void 0){let T=unescape(C.host);if(!t(T)){const R=g(T);R.isIPV6===!0?T=`[${R.escapedHost}]`:T=y(T,!1)}x.push(T)}return(typeof C.port=="number"||typeof C.port=="string")&&(x.push(":"),x.push(String(C.port))),x.length?x.join(""):void 0}return dg={nonSimpleDomain:h,recomposeAuthority:k,reescapeHostDelimiters:y,normalizePercentEncoding:b,normalizePathEncoding:v,escapePreservingEscapes:_,removeDotSegments:S,isIPv4:t,isUUID:e,normalizeIPv6:g,stringArrayToHexStripped:c},dg}var hg,lw;function VD(){if(lw)return hg;lw=1;const{isUUID:e}=b2(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(C){return n.indexOf(C)!==-1}function o(C){return C.secure===!0?!0:C.secure===!1?!1:C.scheme?C.scheme.length===3&&(C.scheme[0]==="w"||C.scheme[0]==="W")&&(C.scheme[1]==="s"||C.scheme[1]==="S")&&(C.scheme[2]==="s"||C.scheme[2]==="S"):!1}function c(C){return C.host||(C.error=C.error||"HTTP URIs must have a host."),C}function h(C){const x=String(C.scheme).toLowerCase()==="https";return(C.port===(x?443:80)||C.port==="")&&(C.port=void 0),C.path||(C.path="/"),C}function l(C){return C.secure=o(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C}function u(C){if((C.port===(o(C)?443:80)||C.port==="")&&(C.port=void 0),typeof C.secure=="boolean"&&(C.scheme=C.secure?"wss":"ws",C.secure=void 0),C.resourceName){const[x,T]=C.resourceName.split("?");C.path=x&&x!=="/"?x:void 0,C.query=T,C.resourceName=void 0}return C.fragment=void 0,C}function m(C,x){if(!C.path)return C.error="URN can not be parsed",C;const T=C.path.match(t);if(T){const R=x.scheme||C.scheme||"urn";C.nid=T[1].toLowerCase(),C.nss=T[2];const M=`${R}:${x.nid||C.nid}`,D=k(M);C.path=void 0,D&&(C=D.parse(C,x))}else C.error=C.error||"URN can not be parsed.";return C}function g(C,x){if(C.nid===void 0)throw new Error("URN without nid cannot be serialized");const T=x.scheme||C.scheme||"urn",R=C.nid.toLowerCase(),M=`${T}:${x.nid||R}`,D=k(M);D&&(C=D.serialize(C,x));const L=C,q=C.nss;return L.path=`${R||x.nid}:${q}`,x.skipEscape=!0,L}function p(C,x){const T=C;return T.uuid=T.nss,T.nss=void 0,!x.tolerant&&(!T.uuid||!e(T.uuid))&&(T.error=T.error||"UUID is not valid."),T}function S(C){const x=C;return x.nss=(C.uuid||"").toLowerCase(),x}const w={scheme:"http",domainHost:!0,parse:c,serialize:h},A={scheme:"https",domainHost:w.domainHost,parse:c,serialize:h},E={scheme:"ws",domainHost:!0,parse:l,serialize:u},y={scheme:"wss",domainHost:E.domainHost,parse:E.parse,serialize:E.serialize},_={http:w,https:A,ws:E,wss:y,urn:{scheme:"urn",parse:m,serialize:g,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:p,serialize:S,skipNormalize:!0}};Object.setPrototypeOf(_,null);function k(C){return C&&(_[C]||_[C.toLowerCase()])||void 0}return hg={wsIsSecure:o,SCHEMES:_,isValidSchemeName:r,getSchemeHandler:k},hg}var cw;function GD(){if(cw)return uc.exports;cw=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizePercentEncoding:r,normalizePathEncoding:o,escapePreservingEscapes:c,reescapeHostDelimiters:h,isIPv4:l,nonSimpleDomain:u}=b2(),{SCHEMES:m,getSchemeHandler:g}=VD();function p(R,M){return typeof R=="string"?R=k(R,M):typeof R=="object"&&(R=_(E(R,M),M)),R}function S(R,M,D){const L=D?Object.assign({scheme:"null"},D):{scheme:"null"},q=w(_(R,L),_(M,L),L,!0);return L.skipEscape=!0,E(q,L)}function w(R,M,D,L){const q={};return L||(R=_(E(R,D),D),M=_(E(M,D),D)),D=D||{},!D.tolerant&&M.scheme?(q.scheme=M.scheme,q.userinfo=M.userinfo,q.host=M.host,q.port=M.port,q.path=t(M.path||""),q.query=M.query):(M.userinfo!==void 0||M.host!==void 0||M.port!==void 0?(q.userinfo=M.userinfo,q.host=M.host,q.port=M.port,q.path=t(M.path||""),q.query=M.query):(M.path?(M.path[0]==="/"?q.path=t(M.path):((R.userinfo!==void 0||R.host!==void 0||R.port!==void 0)&&!R.path?q.path="/"+M.path:R.path?q.path=R.path.slice(0,R.path.lastIndexOf("/")+1)+M.path:q.path=M.path,q.path=t(q.path)),q.query=M.query):(q.path=R.path,M.query!==void 0?q.query=M.query:q.query=R.query),q.userinfo=R.userinfo,q.host=R.host,q.port=R.port),q.scheme=R.scheme),q.fragment=M.fragment,q}function A(R,M,D){const L=x(R,D),q=x(M,D);return L!==void 0&&q!==void 0&&L.toLowerCase()===q.toLowerCase()}function E(R,M){const D={host:R.host,scheme:R.scheme,userinfo:R.userinfo,port:R.port,path:R.path,query:R.query,nid:R.nid,nss:R.nss,uuid:R.uuid,fragment:R.fragment,reference:R.reference,resourceName:R.resourceName,secure:R.secure,error:""},L=Object.assign({},M),q=[],F=g(L.scheme||D.scheme);F&&F.serialize&&F.serialize(D,L),D.path!==void 0&&(L.skipEscape?D.path=r(D.path):(D.path=c(D.path),D.scheme!==void 0&&(D.path=D.path.split("%3A").join(":")))),L.reference!=="suffix"&&D.scheme&&q.push(D.scheme,":");const Y=n(D);if(Y!==void 0&&(L.reference!=="suffix"&&q.push("//"),q.push(Y),D.path&&D.path[0]!=="/"&&q.push("/")),D.path!==void 0){let Q=D.path;!L.absolutePath&&(!F||!F.absolutePath)&&(Q=t(Q)),Y===void 0&&Q[0]==="/"&&Q[1]==="/"&&(Q="/%2F"+Q.slice(2)),q.push(Q)}return D.query!==void 0&&q.push("?",D.query),D.fragment!==void 0&&q.push("#",D.fragment),q.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function b(R,M){if(M[2]!==void 0&&R.path&&R.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof R.port=="number"&&(R.port<0||R.port>65535))return"URI port is malformed."}function v(R,M){const D=Object.assign({},M),L={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let q=!1,F=!1;D.reference==="suffix"&&(D.scheme?R=D.scheme+":"+R:R="//"+R);const Y=R.match(y);if(Y){L.scheme=Y[1],L.userinfo=Y[3],L.host=Y[4],L.port=parseInt(Y[5],10),L.path=Y[6]||"",L.query=Y[7],L.fragment=Y[8],isNaN(L.port)&&(L.port=Y[5]);const Q=b(L,Y);if(Q!==void 0&&(L.error=L.error||Q,q=!0),L.host)if(l(L.host)===!1){const ne=e(L.host);L.host=ne.host.toLowerCase(),F=ne.isIPV6}else F=!0;L.scheme===void 0&&L.userinfo===void 0&&L.host===void 0&&L.port===void 0&&L.query===void 0&&!L.path?L.reference="same-document":L.scheme===void 0?L.reference="relative":L.fragment===void 0?L.reference="absolute":L.reference="uri",D.reference&&D.reference!=="suffix"&&D.reference!==L.reference&&(L.error=L.error||"URI is not a "+D.reference+" reference.");const G=g(D.scheme||L.scheme);if(!D.unicodeSupport&&(!G||!G.unicodeSupport)&&L.host&&(D.domainHost||G&&G.domainHost)&&F===!1&&u(L.host))try{L.host=URL.domainToASCII(L.host.toLowerCase())}catch(ee){L.error=L.error||"Host's domain name can not be converted to ASCII: "+ee}if((!G||G&&!G.skipNormalize)&&(R.indexOf("%")!==-1&&(L.scheme!==void 0&&(L.scheme=unescape(L.scheme)),L.host!==void 0&&(L.host=h(unescape(L.host),F))),L.path&&(L.path=o(L.path)),L.fragment))try{L.fragment=encodeURI(decodeURIComponent(L.fragment))}catch{L.error=L.error||"URI malformed"}G&&G.parse&&G.parse(L,D)}else L.error=L.error||"URI can not be parsed.";return{parsed:L,malformedAuthorityOrPort:q}}function _(R,M){return v(R,M).parsed}function k(R,M){return C(R,M).normalized}function C(R,M){const{parsed:D,malformedAuthorityOrPort:L}=v(R,M);return{normalized:L?R:E(D,M),malformedAuthorityOrPort:L}}function x(R,M){if(typeof R=="string"){const{normalized:D,malformedAuthorityOrPort:L}=C(R,M);return L?void 0:D}if(typeof R=="object")return E(R,M)}const T={SCHEMES:m,normalize:p,resolve:S,resolveComponent:w,equal:A,serialize:E,parse:_};return uc.exports=T,uc.exports.default=T,uc.exports.fastUri=T,uc.exports}var uw;function WD(){if(uw)return ud;uw=1,Object.defineProperty(ud,"__esModule",{value:!0});const e=GD();return e.code='require("ajv/dist/runtime/uri").default',ud.default=e,ud}var dw;function KD(){return dw||(dw=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ff();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=bt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=i_(),o=pf(),c=v2(),h=mf(),l=bt(),u=hf(),m=Jh(),g=Nt(),p=qD,S=WD(),w=(B,$)=>new RegExp(B,$);w.code="new RegExp";const A=["removeAdditional","useDefaults","coerceTypes"],E=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},b={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function _(B){var $,H,U,P,W,se,X,V,ce,oe,Z,te,pe,ye,Ee,Ie,Pe,Fe,je,Ue,Ye,jt,rt,Ct,dt;const Lt=B.strict,mt=($=B.code)===null||$===void 0?void 0:$.optimize,Ut=mt===!0||mt===void 0?1:mt||0,Ss=(U=(H=B.code)===null||H===void 0?void 0:H.regExp)!==null&&U!==void 0?U:w,Yt=(P=B.uriResolver)!==null&&P!==void 0?P:S.default;return{strictSchema:(se=(W=B.strictSchema)!==null&&W!==void 0?W:Lt)!==null&&se!==void 0?se:!0,strictNumbers:(V=(X=B.strictNumbers)!==null&&X!==void 0?X:Lt)!==null&&V!==void 0?V:!0,strictTypes:(oe=(ce=B.strictTypes)!==null&&ce!==void 0?ce:Lt)!==null&&oe!==void 0?oe:"log",strictTuples:(te=(Z=B.strictTuples)!==null&&Z!==void 0?Z:Lt)!==null&&te!==void 0?te:"log",strictRequired:(ye=(pe=B.strictRequired)!==null&&pe!==void 0?pe:Lt)!==null&&ye!==void 0?ye:!1,code:B.code?{...B.code,optimize:Ut,regExp:Ss}:{optimize:Ut,regExp:Ss},loopRequired:(Ee=B.loopRequired)!==null&&Ee!==void 0?Ee:v,loopEnum:(Ie=B.loopEnum)!==null&&Ie!==void 0?Ie:v,meta:(Pe=B.meta)!==null&&Pe!==void 0?Pe:!0,messages:(Fe=B.messages)!==null&&Fe!==void 0?Fe:!0,inlineRefs:(je=B.inlineRefs)!==null&&je!==void 0?je:!0,schemaId:(Ue=B.schemaId)!==null&&Ue!==void 0?Ue:"$id",addUsedSchema:(Ye=B.addUsedSchema)!==null&&Ye!==void 0?Ye:!0,validateSchema:(jt=B.validateSchema)!==null&&jt!==void 0?jt:!0,validateFormats:(rt=B.validateFormats)!==null&&rt!==void 0?rt:!0,unicodeRegExp:(Ct=B.unicodeRegExp)!==null&&Ct!==void 0?Ct:!0,int32range:(dt=B.int32range)!==null&&dt!==void 0?dt:!0,uriResolver:Yt}}class k{constructor($={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,..._($)};const{es5:H,lines:U}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:E,es5:H,lines:U}),this.logger=q($.logger);const P=$.validateFormats;$.validateFormats=!1,this.RULES=(0,c.getRules)(),C.call(this,y,$,"NOT SUPPORTED"),C.call(this,b,$,"DEPRECATED","warn"),this._metaOpts=D.call(this),$.formats&&R.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords&&M.call(this,$.keywords),typeof $.meta=="object"&&this.addMetaSchema($.meta),T.call(this),$.validateFormats=P}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:$,meta:H,schemaId:U}=this.opts;let P=p;U==="id"&&(P={...p},P.id=P.$id,delete P.$id),H&&$&&this.addMetaSchema(P,P[U],!1)}defaultMeta(){const{meta:$,schemaId:H}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[H]||$:void 0}validate($,H){let U;if(typeof $=="string"){if(U=this.getSchema($),!U)throw new Error(`no schema with key or ref "${$}"`)}else U=this.compile($);const P=U(H);return"$async"in U||(this.errors=U.errors),P}compile($,H){const U=this._addSchema($,H);return U.validate||this._compileSchemaEnv(U)}compileAsync($,H){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:U}=this.opts;return P.call(this,$,H);async function P(oe,Z){await W.call(this,oe.$schema);const te=this._addSchema(oe,Z);return te.validate||se.call(this,te)}async function W(oe){oe&&!this.getSchema(oe)&&await P.call(this,{$ref:oe},!0)}async function se(oe){try{return this._compileSchemaEnv(oe)}catch(Z){if(!(Z instanceof o.default))throw Z;return X.call(this,Z),await V.call(this,Z.missingSchema),se.call(this,oe)}}function X({missingSchema:oe,missingRef:Z}){if(this.refs[oe])throw new Error(`AnySchema ${oe} is loaded but ${Z} cannot be resolved`)}async function V(oe){const Z=await ce.call(this,oe);this.refs[oe]||await W.call(this,Z.$schema),this.refs[oe]||this.addSchema(Z,oe,H)}async function ce(oe){const Z=this._loading[oe];if(Z)return Z;try{return await(this._loading[oe]=U(oe))}finally{delete this._loading[oe]}}}addSchema($,H,U,P=this.opts.validateSchema){if(Array.isArray($)){for(const se of $)this.addSchema(se,void 0,U,P);return this}let W;if(typeof $=="object"){const{schemaId:se}=this.opts;if(W=$[se],W!==void 0&&typeof W!="string")throw new Error(`schema ${se} must be string`)}return H=(0,u.normalizeId)(H||W),this._checkUnique(H),this.schemas[H]=this._addSchema($,U,H,P,!0),this}addMetaSchema($,H,U=this.opts.validateSchema){return this.addSchema($,H,!0,U),this}validateSchema($,H){if(typeof $=="boolean")return!0;let U;if(U=$.$schema,U!==void 0&&typeof U!="string")throw new Error("$schema must be a string");if(U=U||this.opts.defaultMeta||this.defaultMeta(),!U)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const P=this.validate(U,$);if(!P&&H){const W="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(W);else throw new Error(W)}return P}getSchema($){let H;for(;typeof(H=x.call(this,$))=="string";)$=H;if(H===void 0){const{schemaId:U}=this.opts,P=new h.SchemaEnv({schema:{},schemaId:U});if(H=h.resolveSchema.call(this,P,$),!H)return;this.refs[$]=H}return H.validate||this._compileSchemaEnv(H)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const H=x.call(this,$);return typeof H=="object"&&this._cache.delete(H.schema),delete this.schemas[$],delete this.refs[$],this}case"object":{const H=$;this._cache.delete(H);let U=$[this.opts.schemaId];return U&&(U=(0,u.normalizeId)(U),delete this.schemas[U],delete this.refs[U]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(const H of $)this.addKeyword(H);return this}addKeyword($,H){let U;if(typeof $=="string")U=$,typeof H=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),H.keyword=U);else if(typeof $=="object"&&H===void 0){if(H=$,U=H.keyword,Array.isArray(U)&&!U.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Y.call(this,U,H),!H)return(0,g.eachItem)(U,W=>Q.call(this,W)),this;ee.call(this,H);const P={...H,type:(0,m.getJSONTypes)(H.type),schemaType:(0,m.getJSONTypes)(H.schemaType)};return(0,g.eachItem)(U,P.type.length===0?W=>Q.call(this,W,P):W=>P.type.forEach(se=>Q.call(this,W,P,se))),this}getKeyword($){const H=this.RULES.all[$];return typeof H=="object"?H.definition:!!H}removeKeyword($){const{RULES:H}=this;delete H.keywords[$],delete H.all[$];for(const U of H.rules){const P=U.rules.findIndex(W=>W.keyword===$);P>=0&&U.rules.splice(P,1)}return this}addFormat($,H){return typeof H=="string"&&(H=new RegExp(H)),this.formats[$]=H,this}errorsText($=this.errors,{separator:H=", ",dataVar:U="data"}={}){return!$||$.length===0?"No errors":$.map(P=>`${U}${P.instancePath} ${P.message}`).reduce((P,W)=>P+H+W)}$dataMetaSchema($,H){const U=this.RULES.all;$=JSON.parse(JSON.stringify($));for(const P of H){const W=P.split("/").slice(1);let se=$;for(const X of W)se=se[X];for(const X in U){const V=U[X];if(typeof V!="object")continue;const{$data:ce}=V.definition,oe=se[X];ce&&oe&&(se[X]=z(oe))}}return $}_removeAllSchemas($,H){for(const U in $){const P=$[U];(!H||H.test(U))&&(typeof P=="string"?delete $[U]:P&&!P.meta&&(this._cache.delete(P.schema),delete $[U]))}}_addSchema($,H,U,P=this.opts.validateSchema,W=this.opts.addUsedSchema){let se;const{schemaId:X}=this.opts;if(typeof $=="object")se=$[X];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof $!="boolean")throw new Error("schema must be object or boolean")}let V=this._cache.get($);if(V!==void 0)return V;U=(0,u.normalizeId)(se||U);const ce=u.getSchemaRefs.call(this,$,U);return V=new h.SchemaEnv({schema:$,schemaId:X,meta:H,baseId:U,localRefs:ce}),this._cache.set(V.schema,V),W&&!U.startsWith("#")&&(U&&this._checkUnique(U),this.refs[U]=V),P&&this.validateSchema($,!0),V}_checkUnique($){if(this.schemas[$]||this.refs[$])throw new Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta?this._compileMetaSchema($):h.compileSchema.call(this,$),!$.validate)throw new Error("ajv implementation error");return $.validate}_compileMetaSchema($){const H=this.opts;this.opts=this._metaOpts;try{h.compileSchema.call(this,$)}finally{this.opts=H}}}k.ValidationError=r.default,k.MissingRefError=o.default,e.default=k;function C(B,$,H,U="error"){for(const P in B){const W=P;W in $&&this.logger[U](`${H}: option ${P}. ${B[W]}`)}}function x(B){return B=(0,u.normalizeId)(B),this.schemas[B]||this.refs[B]}function T(){const B=this.opts.schemas;if(B)if(Array.isArray(B))this.addSchema(B);else for(const $ in B)this.addSchema(B[$],$)}function R(){for(const B in this.opts.formats){const $=this.opts.formats[B];$&&this.addFormat(B,$)}}function M(B){if(Array.isArray(B)){this.addVocabulary(B);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const $ in B){const H=B[$];H.keyword||(H.keyword=$),this.addKeyword(H)}}function D(){const B={...this.opts};for(const $ of A)delete B[$];return B}const L={log(){},warn(){},error(){}};function q(B){if(B===!1)return L;if(B===void 0)return console;if(B.log&&B.warn&&B.error)return B;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function Y(B,$){const{RULES:H}=this;if((0,g.eachItem)(B,U=>{if(H.keywords[U])throw new Error(`Keyword ${U} is already defined`);if(!F.test(U))throw new Error(`Keyword ${U} has invalid name`)}),!!$&&$.$data&&!("code"in $||"validate"in $))throw new Error('$data keyword must have "code" or "validate" function')}function Q(B,$,H){var U;const P=$==null?void 0:$.post;if(H&&P)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:W}=this;let se=P?W.post:W.rules.find(({type:V})=>V===H);if(se||(se={type:H,rules:[]},W.rules.push(se)),W.keywords[B]=!0,!$)return;const X={keyword:B,definition:{...$,type:(0,m.getJSONTypes)($.type),schemaType:(0,m.getJSONTypes)($.schemaType)}};$.before?G.call(this,se,X,$.before):se.rules.push(X),W.all[B]=X,(U=$.implements)===null||U===void 0||U.forEach(V=>this.addKeyword(V))}function G(B,$,H){const U=B.rules.findIndex(P=>P.keyword===H);U>=0?B.rules.splice(U,0,$):(B.rules.push($),this.logger.warn(`rule ${H} is not defined`))}function ee(B){let{metaSchema:$}=B;$!==void 0&&(B.$data&&this.opts.$data&&($=z($)),B.validateSchema=this.compile($,!0))}const ne={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function z(B){return{anyOf:[B,ne]}}})(ig)),ig}var dd={},hd={},fd={},hw;function YD(){if(hw)return fd;hw=1,Object.defineProperty(fd,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return fd.default=e,fd}var Fr={},fw;function r_(){if(fw)return Fr;fw=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.callRef=Fr.getValidate=void 0;const e=pf(),t=ji(),n=bt(),r=ki(),o=mf(),c=Nt(),h={keyword:"$ref",schemaType:"string",code(m){const{gen:g,schema:p,it:S}=m,{baseId:w,schemaEnv:A,validateName:E,opts:y,self:b}=S,{root:v}=A;if((p==="#"||p==="#/")&&w===v.baseId)return k();const _=o.resolveRef.call(b,v,w,p);if(_===void 0)throw new e.default(S.opts.uriResolver,w,p);if(_ instanceof o.SchemaEnv)return C(_);return x(_);function k(){if(A===v)return u(m,E,A,A.$async);const T=g.scopeValue("root",{ref:v});return u(m,(0,n._)`${T}.validate`,v,v.$async)}function C(T){const R=l(m,T);u(m,R,T,T.$async)}function x(T){const R=g.scopeValue("schema",y.code.source===!0?{ref:T,code:(0,n.stringify)(T)}:{ref:T}),M=g.name("valid"),D=m.subschema({schema:T,dataTypes:[],schemaPath:n.nil,topSchemaRef:R,errSchemaPath:p},M);m.mergeEvaluated(D),m.ok(M)}}};function l(m,g){const{gen:p}=m;return g.validate?p.scopeValue("validate",{ref:g.validate}):(0,n._)`${p.scopeValue("wrapper",{ref:g})}.validate`}Fr.getValidate=l;function u(m,g,p,S){const{gen:w,it:A}=m,{allErrors:E,schemaEnv:y,opts:b}=A,v=b.passContext?r.default.this:n.nil;S?_():k();function _(){if(!y.$async)throw new Error("async schema referenced by sync schema");const T=w.let("valid");w.try(()=>{w.code((0,n._)`await ${(0,t.callValidateCode)(m,g,v)}`),x(g),E||w.assign(T,!0)},R=>{w.if((0,n._)`!(${R} instanceof ${A.ValidationError})`,()=>w.throw(R)),C(R),E||w.assign(T,!1)}),m.ok(T)}function k(){m.result((0,t.callValidateCode)(m,g,v),()=>x(g),()=>C(g))}function C(T){const R=(0,n._)`${T}.errors`;w.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${R} : ${r.default.vErrors}.concat(${R})`),w.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function x(T){var R;if(!A.opts.unevaluated)return;const M=(R=p==null?void 0:p.validate)===null||R===void 0?void 0:R.evaluated;if(A.props!==!0)if(M&&!M.dynamicProps)M.props!==void 0&&(A.props=c.mergeEvaluated.props(w,M.props,A.props));else{const D=w.var("props",(0,n._)`${T}.evaluated.props`);A.props=c.mergeEvaluated.props(w,D,A.props,n.Name)}if(A.items!==!0)if(M&&!M.dynamicItems)M.items!==void 0&&(A.items=c.mergeEvaluated.items(w,M.items,A.items));else{const D=w.var("items",(0,n._)`${T}.evaluated.items`);A.items=c.mergeEvaluated.items(w,D,A.items,n.Name)}}}return Fr.callRef=u,Fr.default=h,Fr}var pw;function XD(){if(pw)return hd;pw=1,Object.defineProperty(hd,"__esModule",{value:!0});const e=YD(),t=r_(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return hd.default=n,hd}var pd={},md={},mw;function JD(){if(mw)return md;mw=1,Object.defineProperty(md,"__esModule",{value:!0});const e=bt(),t=e.operators,n={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},r={message:({keyword:c,schemaCode:h})=>(0,e.str)`must be ${n[c].okStr} ${h}`,params:({keyword:c,schemaCode:h})=>(0,e._)`{comparison: ${n[c].okStr}, limit: ${h}}`},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:r,code(c){const{keyword:h,data:l,schemaCode:u}=c;c.fail$data((0,e._)`${l} ${n[h].fail} ${u} || isNaN(${l})`)}};return md.default=o,md}var gd={},gw;function ZD(){if(gw)return gd;gw=1,Object.defineProperty(gd,"__esModule",{value:!0});const e=bt(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must be multiple of ${r}`,params:({schemaCode:r})=>(0,e._)`{multipleOf: ${r}}`},code(r){const{gen:o,data:c,schemaCode:h,it:l}=r,u=l.opts.multipleOfPrecision,m=o.let("res"),g=u?(0,e._)`Math.abs(Math.round(${m}) - ${m}) > 1e-${u}`:(0,e._)`${m} !== parseInt(${m})`;r.fail$data((0,e._)`(${h} === 0 || (${m} = ${c}/${h}, ${g}))`)}};return gd.default=n,gd}var vd={},_d={},vw;function QD(){if(vw)return _d;vw=1,Object.defineProperty(_d,"__esModule",{value:!0});function e(t){const n=t.length;let r=0,o=0,c;for(;o<n;)r++,c=t.charCodeAt(o++),c>=55296&&c<=56319&&o<n&&(c=t.charCodeAt(o),(c&64512)===56320&&o++);return r}return _d.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',_d}var _w;function eO(){if(_w)return vd;_w=1,Object.defineProperty(vd,"__esModule",{value:!0});const e=bt(),t=Nt(),n=QD(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:c,schemaCode:h}){const l=c==="maxLength"?"more":"fewer";return(0,e.str)`must NOT have ${l} than ${h} characters`},params:({schemaCode:c})=>(0,e._)`{limit: ${c}}`},code(c){const{keyword:h,data:l,schemaCode:u,it:m}=c,g=h==="maxLength"?e.operators.GT:e.operators.LT,p=m.opts.unicode===!1?(0,e._)`${l}.length`:(0,e._)`${(0,t.useFunc)(c.gen,n.default)}(${l})`;c.fail$data((0,e._)`${p} ${g} ${u}`)}};return vd.default=o,vd}var yd={},yw;function tO(){if(yw)return yd;yw=1,Object.defineProperty(yd,"__esModule",{value:!0});const e=ji(),t=Nt(),n=bt(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:c})=>(0,n.str)`must match pattern "${c}"`,params:({schemaCode:c})=>(0,n._)`{pattern: ${c}}`},code(c){const{gen:h,data:l,$data:u,schema:m,schemaCode:g,it:p}=c,S=p.opts.unicodeRegExp?"u":"";if(u){const{regExp:w}=p.opts.code,A=w.code==="new RegExp"?(0,n._)`new RegExp`:(0,t.useFunc)(h,w),E=h.let("valid");h.try(()=>h.assign(E,(0,n._)`${A}(${g}, ${S}).test(${l})`),()=>h.assign(E,!1)),c.fail$data((0,n._)`!${E}`)}else{const w=(0,e.usePattern)(c,m);c.fail$data((0,n._)`!${w}.test(${l})`)}}};return yd.default=o,yd}var bd={},bw;function sO(){if(bw)return bd;bw=1,Object.defineProperty(bd,"__esModule",{value:!0});const e=bt(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const c=r==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${o} properties`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:o,data:c,schemaCode:h}=r,l=o==="maxProperties"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`Object.keys(${c}).length ${l} ${h}`)}};return bd.default=n,bd}var Sd={},Sw;function nO(){if(Sw)return Sd;Sw=1,Object.defineProperty(Sd,"__esModule",{value:!0});const e=ji(),t=bt(),n=Nt(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:c}})=>(0,t.str)`must have required property '${c}'`,params:({params:{missingProperty:c}})=>(0,t._)`{missingProperty: ${c}}`},code(c){const{gen:h,schema:l,schemaCode:u,data:m,$data:g,it:p}=c,{opts:S}=p;if(!g&&l.length===0)return;const w=l.length>=S.loopRequired;if(p.allErrors?A():E(),S.strictRequired){const v=c.parentSchema.properties,{definedProperties:_}=c.it;for(const k of l)if((v==null?void 0:v[k])===void 0&&!_.has(k)){const C=p.schemaEnv.baseId+p.errSchemaPath,x=`required property "${k}" is not defined at "${C}" (strictRequired)`;(0,n.checkStrictMode)(p,x,p.opts.strictRequired)}}function A(){if(w||g)c.block$data(t.nil,y);else for(const v of l)(0,e.checkReportMissingProp)(c,v)}function E(){const v=h.let("missing");if(w||g){const _=h.let("valid",!0);c.block$data(_,()=>b(v,_)),c.ok(_)}else h.if((0,e.checkMissingProp)(c,l,v)),(0,e.reportMissingProp)(c,v),h.else()}function y(){h.forOf("prop",u,v=>{c.setParams({missingProperty:v}),h.if((0,e.noPropertyInData)(h,m,v,S.ownProperties),()=>c.error())})}function b(v,_){c.setParams({missingProperty:v}),h.forOf(v,u,()=>{h.assign(_,(0,e.propertyInData)(h,m,v,S.ownProperties)),h.if((0,t.not)(_),()=>{c.error(),h.break()})},t.nil)}}};return Sd.default=o,Sd}var wd={},ww;function iO(){if(ww)return wd;ww=1,Object.defineProperty(wd,"__esModule",{value:!0});const e=bt(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const c=r==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${o} items`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:o,data:c,schemaCode:h}=r,l=o==="maxItems"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`${c}.length ${l} ${h}`)}};return wd.default=n,wd}var xd={},Cd={},xw;function a_(){if(xw)return Cd;xw=1,Object.defineProperty(Cd,"__esModule",{value:!0});const e=y2();return e.code='require("ajv/dist/runtime/equal").default',Cd.default=e,Cd}var Cw;function rO(){if(Cw)return xd;Cw=1,Object.defineProperty(xd,"__esModule",{value:!0});const e=Jh(),t=bt(),n=Nt(),r=a_(),c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:h,j:l}})=>(0,t.str)`must NOT have duplicate items (items ## ${l} and ${h} are identical)`,params:({params:{i:h,j:l}})=>(0,t._)`{i: ${h}, j: ${l}}`},code(h){const{gen:l,data:u,$data:m,schema:g,parentSchema:p,schemaCode:S,it:w}=h;if(!m&&!g)return;const A=l.let("valid"),E=p.items?(0,e.getSchemaTypes)(p.items):[];h.block$data(A,y,(0,t._)`${S} === false`),h.ok(A);function y(){const k=l.let("i",(0,t._)`${u}.length`),C=l.let("j");h.setParams({i:k,j:C}),l.assign(A,!0),l.if((0,t._)`${k} > 1`,()=>(b()?v:_)(k,C))}function b(){return E.length>0&&!E.some(k=>k==="object"||k==="array")}function v(k,C){const x=l.name("item"),T=(0,e.checkDataTypes)(E,x,w.opts.strictNumbers,e.DataType.Wrong),R=l.const("indices",(0,t._)`{}`);l.for((0,t._)`;${k}--;`,()=>{l.let(x,(0,t._)`${u}[${k}]`),l.if(T,(0,t._)`continue`),E.length>1&&l.if((0,t._)`typeof ${x} == "string"`,(0,t._)`${x} += "_"`),l.if((0,t._)`typeof ${R}[${x}] == "number"`,()=>{l.assign(C,(0,t._)`${R}[${x}]`),h.error(),l.assign(A,!1).break()}).code((0,t._)`${R}[${x}] = ${k}`)})}function _(k,C){const x=(0,n.useFunc)(l,r.default),T=l.name("outer");l.label(T).for((0,t._)`;${k}--;`,()=>l.for((0,t._)`${C} = ${k}; ${C}--;`,()=>l.if((0,t._)`${x}(${u}[${k}], ${u}[${C}])`,()=>{h.error(),l.assign(A,!1).break(T)})))}}};return xd.default=c,xd}var Ed={},Ew;function aO(){if(Ew)return Ed;Ew=1,Object.defineProperty(Ed,"__esModule",{value:!0});const e=bt(),t=Nt(),n=a_(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:c})=>(0,e._)`{allowedValue: ${c}}`},code(c){const{gen:h,data:l,$data:u,schemaCode:m,schema:g}=c;u||g&&typeof g=="object"?c.fail$data((0,e._)`!${(0,t.useFunc)(h,n.default)}(${l}, ${m})`):c.fail((0,e._)`${g} !== ${l}`)}};return Ed.default=o,Ed}var kd={},kw;function oO(){if(kw)return kd;kw=1,Object.defineProperty(kd,"__esModule",{value:!0});const e=bt(),t=Nt(),n=a_(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:c})=>(0,e._)`{allowedValues: ${c}}`},code(c){const{gen:h,data:l,$data:u,schema:m,schemaCode:g,it:p}=c;if(!u&&m.length===0)throw new Error("enum must have non-empty array");const S=m.length>=p.opts.loopEnum;let w;const A=()=>w??(w=(0,t.useFunc)(h,n.default));let E;if(S||u)E=h.let("valid"),c.block$data(E,y);else{if(!Array.isArray(m))throw new Error("ajv implementation error");const v=h.const("vSchema",g);E=(0,e.or)(...m.map((_,k)=>b(v,k)))}c.pass(E);function y(){h.assign(E,!1),h.forOf("v",g,v=>h.if((0,e._)`${A()}(${l}, ${v})`,()=>h.assign(E,!0).break()))}function b(v,_){const k=m[_];return typeof k=="object"&&k!==null?(0,e._)`${A()}(${l}, ${v}[${_}])`:(0,e._)`${l} === ${k}`}}};return kd.default=o,kd}var jw;function lO(){if(jw)return pd;jw=1,Object.defineProperty(pd,"__esModule",{value:!0});const e=JD(),t=ZD(),n=eO(),r=tO(),o=sO(),c=nO(),h=iO(),l=rO(),u=aO(),m=oO(),g=[e.default,t.default,n.default,r.default,o.default,c.default,h.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,m.default];return pd.default=g,pd}var jd={},Mo={},Rw;function S2(){if(Rw)return Mo;Rw=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.validateAdditionalItems=void 0;const e=bt(),t=Nt(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:c}})=>(0,e.str)`must NOT have more than ${c} items`,params:({params:{len:c}})=>(0,e._)`{limit: ${c}}`},code(c){const{parentSchema:h,it:l}=c,{items:u}=h;if(!Array.isArray(u)){(0,t.checkStrictMode)(l,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(c,u)}};function o(c,h){const{gen:l,schema:u,data:m,keyword:g,it:p}=c;p.items=!0;const S=l.const("len",(0,e._)`${m}.length`);if(u===!1)c.setParams({len:h.length}),c.pass((0,e._)`${S} <= ${h.length}`);else if(typeof u=="object"&&!(0,t.alwaysValidSchema)(p,u)){const A=l.var("valid",(0,e._)`${S} <= ${h.length}`);l.if((0,e.not)(A),()=>w(A)),c.ok(A)}function w(A){l.forRange("i",h.length,S,E=>{c.subschema({keyword:g,dataProp:E,dataPropType:t.Type.Num},A),p.allErrors||l.if((0,e.not)(A),()=>l.break())})}}return Mo.validateAdditionalItems=o,Mo.default=r,Mo}var Rd={},$o={},Aw;function w2(){if(Aw)return $o;Aw=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.validateTuple=void 0;const e=bt(),t=Nt(),n=ji(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(c){const{schema:h,it:l}=c;if(Array.isArray(h))return o(c,"additionalItems",h);l.items=!0,!(0,t.alwaysValidSchema)(l,h)&&c.ok((0,n.validateArray)(c))}};function o(c,h,l=c.schema){const{gen:u,parentSchema:m,data:g,keyword:p,it:S}=c;E(m),S.opts.unevaluated&&l.length&&S.items!==!0&&(S.items=t.mergeEvaluated.items(u,l.length,S.items));const w=u.name("valid"),A=u.const("len",(0,e._)`${g}.length`);l.forEach((y,b)=>{(0,t.alwaysValidSchema)(S,y)||(u.if((0,e._)`${A} > ${b}`,()=>c.subschema({keyword:p,schemaProp:b,dataProp:b},w)),c.ok(w))});function E(y){const{opts:b,errSchemaPath:v}=S,_=l.length,k=_===y.minItems&&(_===y.maxItems||y[h]===!1);if(b.strictTuples&&!k){const C=`"${p}" is ${_}-tuple, but minItems or maxItems/${h} are not specified or different at path "${v}"`;(0,t.checkStrictMode)(S,C,b.strictTuples)}}}return $o.validateTuple=o,$o.default=r,$o}var Tw;function cO(){if(Tw)return Rd;Tw=1,Object.defineProperty(Rd,"__esModule",{value:!0});const e=w2(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,e.validateTuple)(n,"items")};return Rd.default=t,Rd}var Ad={},Nw;function uO(){if(Nw)return Ad;Nw=1,Object.defineProperty(Ad,"__esModule",{value:!0});const e=bt(),t=Nt(),n=ji(),r=S2(),c={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:h}})=>(0,e.str)`must NOT have more than ${h} items`,params:({params:{len:h}})=>(0,e._)`{limit: ${h}}`},code(h){const{schema:l,parentSchema:u,it:m}=h,{prefixItems:g}=u;m.items=!0,!(0,t.alwaysValidSchema)(m,l)&&(g?(0,r.validateAdditionalItems)(h,g):h.ok((0,n.validateArray)(h)))}};return Ad.default=c,Ad}var Td={},Mw;function dO(){if(Mw)return Td;Mw=1,Object.defineProperty(Td,"__esModule",{value:!0});const e=bt(),t=Nt(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:c}})=>c===void 0?(0,e.str)`must contain at least ${o} valid item(s)`:(0,e.str)`must contain at least ${o} and no more than ${c} valid item(s)`,params:({params:{min:o,max:c}})=>c===void 0?(0,e._)`{minContains: ${o}}`:(0,e._)`{minContains: ${o}, maxContains: ${c}}`},code(o){const{gen:c,schema:h,parentSchema:l,data:u,it:m}=o;let g,p;const{minContains:S,maxContains:w}=l;m.opts.next?(g=S===void 0?1:S,p=w):g=1;const A=c.const("len",(0,e._)`${u}.length`);if(o.setParams({min:g,max:p}),p===void 0&&g===0){(0,t.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&g>p){(0,t.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,t.alwaysValidSchema)(m,h)){let _=(0,e._)`${A} >= ${g}`;p!==void 0&&(_=(0,e._)`${_} && ${A} <= ${p}`),o.pass(_);return}m.items=!0;const E=c.name("valid");p===void 0&&g===1?b(E,()=>c.if(E,()=>c.break())):g===0?(c.let(E,!0),p!==void 0&&c.if((0,e._)`${u}.length > 0`,y)):(c.let(E,!1),y()),o.result(E,()=>o.reset());function y(){const _=c.name("_valid"),k=c.let("count",0);b(_,()=>c.if(_,()=>v(k)))}function b(_,k){c.forRange("i",0,A,C=>{o.subschema({keyword:"contains",dataProp:C,dataPropType:t.Type.Num,compositeRule:!0},_),k()})}function v(_){c.code((0,e._)`${_}++`),p===void 0?c.if((0,e._)`${_} >= ${g}`,()=>c.assign(E,!0).break()):(c.if((0,e._)`${_} > ${p}`,()=>c.assign(E,!1).break()),g===1?c.assign(E,!0):c.if((0,e._)`${_} >= ${g}`,()=>c.assign(E,!0)))}}};return Td.default=r,Td}var fg={},$w;function o_(){return $w||($w=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=bt(),n=Nt(),r=ji();e.error={message:({params:{property:u,depsCount:m,deps:g}})=>{const p=m===1?"property":"properties";return(0,t.str)`must have ${p} ${g} when property ${u} is present`},params:({params:{property:u,depsCount:m,deps:g,missingProperty:p}})=>(0,t._)`{property: ${u},
486
+ missingProperty: ${p},
487
+ depsCount: ${m},
488
+ deps: ${g}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[m,g]=c(u);h(u,m),l(u,g)}};function c({schema:u}){const m={},g={};for(const p in u){if(p==="__proto__")continue;const S=Array.isArray(u[p])?m:g;S[p]=u[p]}return[m,g]}function h(u,m=u.schema){const{gen:g,data:p,it:S}=u;if(Object.keys(m).length===0)return;const w=g.let("missing");for(const A in m){const E=m[A];if(E.length===0)continue;const y=(0,r.propertyInData)(g,p,A,S.opts.ownProperties);u.setParams({property:A,depsCount:E.length,deps:E.join(", ")}),S.allErrors?g.if(y,()=>{for(const b of E)(0,r.checkReportMissingProp)(u,b)}):(g.if((0,t._)`${y} && (${(0,r.checkMissingProp)(u,E,w)})`),(0,r.reportMissingProp)(u,w),g.else())}}e.validatePropertyDeps=h;function l(u,m=u.schema){const{gen:g,data:p,keyword:S,it:w}=u,A=g.name("valid");for(const E in m)(0,n.alwaysValidSchema)(w,m[E])||(g.if((0,r.propertyInData)(g,p,E,w.opts.ownProperties),()=>{const y=u.subschema({keyword:S,schemaProp:E},A);u.mergeValidEvaluated(y,A)},()=>g.var(A,!0)),u.ok(A))}e.validateSchemaDeps=l,e.default=o})(fg)),fg}var Nd={},Dw;function hO(){if(Dw)return Nd;Dw=1,Object.defineProperty(Nd,"__esModule",{value:!0});const e=bt(),t=Nt(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,e._)`{propertyName: ${o.propertyName}}`},code(o){const{gen:c,schema:h,data:l,it:u}=o;if((0,t.alwaysValidSchema)(u,h))return;const m=c.name("valid");c.forIn("key",l,g=>{o.setParams({propertyName:g}),o.subschema({keyword:"propertyNames",data:g,dataTypes:["string"],propertyName:g,compositeRule:!0},m),c.if((0,e.not)(m),()=>{o.error(!0),u.allErrors||c.break()})}),o.ok(m)}};return Nd.default=r,Nd}var Md={},Ow;function x2(){if(Ow)return Md;Ow=1,Object.defineProperty(Md,"__esModule",{value:!0});const e=ji(),t=bt(),n=ki(),r=Nt(),c={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:h})=>(0,t._)`{additionalProperty: ${h.additionalProperty}}`},code(h){const{gen:l,schema:u,parentSchema:m,data:g,errsCount:p,it:S}=h;if(!p)throw new Error("ajv implementation error");const{allErrors:w,opts:A}=S;if(S.props=!0,A.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(S,u))return;const E=(0,e.allSchemaProperties)(m.properties),y=(0,e.allSchemaProperties)(m.patternProperties);b(),h.ok((0,t._)`${p} === ${n.default.errors}`);function b(){l.forIn("key",g,x=>{!E.length&&!y.length?k(x):l.if(v(x),()=>k(x))})}function v(x){let T;if(E.length>8){const R=(0,r.schemaRefOrVal)(S,m.properties,"properties");T=(0,e.isOwnProperty)(l,R,x)}else E.length?T=(0,t.or)(...E.map(R=>(0,t._)`${x} === ${R}`)):T=t.nil;return y.length&&(T=(0,t.or)(T,...y.map(R=>(0,t._)`${(0,e.usePattern)(h,R)}.test(${x})`))),(0,t.not)(T)}function _(x){l.code((0,t._)`delete ${g}[${x}]`)}function k(x){if(A.removeAdditional==="all"||A.removeAdditional&&u===!1){_(x);return}if(u===!1){h.setParams({additionalProperty:x}),h.error(),w||l.break();return}if(typeof u=="object"&&!(0,r.alwaysValidSchema)(S,u)){const T=l.name("valid");A.removeAdditional==="failing"?(C(x,T,!1),l.if((0,t.not)(T),()=>{h.reset(),_(x)})):(C(x,T),w||l.if((0,t.not)(T),()=>l.break()))}}function C(x,T,R){const M={keyword:"additionalProperties",dataProp:x,dataPropType:r.Type.Str};R===!1&&Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1}),h.subschema(M,T)}}};return Md.default=c,Md}var $d={},Lw;function fO(){if(Lw)return $d;Lw=1,Object.defineProperty($d,"__esModule",{value:!0});const e=ff(),t=ji(),n=Nt(),r=x2(),o={keyword:"properties",type:"object",schemaType:"object",code(c){const{gen:h,schema:l,parentSchema:u,data:m,it:g}=c;g.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&r.default.code(new e.KeywordCxt(g,r.default,"additionalProperties"));const p=(0,t.allSchemaProperties)(l);for(const y of p)g.definedProperties.add(y);g.opts.unevaluated&&p.length&&g.props!==!0&&(g.props=n.mergeEvaluated.props(h,(0,n.toHash)(p),g.props));const S=p.filter(y=>!(0,n.alwaysValidSchema)(g,l[y]));if(S.length===0)return;const w=h.name("valid");for(const y of S)A(y)?E(y):(h.if((0,t.propertyInData)(h,m,y,g.opts.ownProperties)),E(y),g.allErrors||h.else().var(w,!0),h.endIf()),c.it.definedProperties.add(y),c.ok(w);function A(y){return g.opts.useDefaults&&!g.compositeRule&&l[y].default!==void 0}function E(y){c.subschema({keyword:"properties",schemaProp:y,dataProp:y},w)}}};return $d.default=o,$d}var Dd={},Iw;function pO(){if(Iw)return Dd;Iw=1,Object.defineProperty(Dd,"__esModule",{value:!0});const e=ji(),t=bt(),n=Nt(),r=Nt(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(c){const{gen:h,schema:l,data:u,parentSchema:m,it:g}=c,{opts:p}=g,S=(0,e.allSchemaProperties)(l),w=S.filter(k=>(0,n.alwaysValidSchema)(g,l[k]));if(S.length===0||w.length===S.length&&(!g.opts.unevaluated||g.props===!0))return;const A=p.strictSchema&&!p.allowMatchingProperties&&m.properties,E=h.name("valid");g.props!==!0&&!(g.props instanceof t.Name)&&(g.props=(0,r.evaluatedPropsToName)(h,g.props));const{props:y}=g;b();function b(){for(const k of S)A&&v(k),g.allErrors?_(k):(h.var(E,!0),_(k),h.if(E))}function v(k){for(const C in A)new RegExp(k).test(C)&&(0,n.checkStrictMode)(g,`property ${C} matches pattern ${k} (use allowMatchingProperties)`)}function _(k){h.forIn("key",u,C=>{h.if((0,t._)`${(0,e.usePattern)(c,k)}.test(${C})`,()=>{const x=w.includes(k);x||c.subschema({keyword:"patternProperties",schemaProp:k,dataProp:C,dataPropType:r.Type.Str},E),g.opts.unevaluated&&y!==!0?h.assign((0,t._)`${y}[${C}]`,!0):!x&&!g.allErrors&&h.if((0,t.not)(E),()=>h.break())})})}}};return Dd.default=o,Dd}var Od={},Pw;function mO(){if(Pw)return Od;Pw=1,Object.defineProperty(Od,"__esModule",{value:!0});const e=Nt(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:o,it:c}=n;if((0,e.alwaysValidSchema)(c,o)){n.fail();return}const h=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},h),n.failResult(h,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return Od.default=t,Od}var Ld={},Bw;function gO(){if(Bw)return Ld;Bw=1,Object.defineProperty(Ld,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ji().validateUnion,error:{message:"must match a schema in anyOf"}};return Ld.default=t,Ld}var Id={},zw;function vO(){if(zw)return Id;zw=1,Object.defineProperty(Id,"__esModule",{value:!0});const e=bt(),t=Nt(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,e._)`{passingSchemas: ${o.passing}}`},code(o){const{gen:c,schema:h,parentSchema:l,it:u}=o;if(!Array.isArray(h))throw new Error("ajv implementation error");if(u.opts.discriminator&&l.discriminator)return;const m=h,g=c.let("valid",!1),p=c.let("passing",null),S=c.name("_valid");o.setParams({passing:p}),c.block(w),o.result(g,()=>o.reset(),()=>o.error(!0));function w(){m.forEach((A,E)=>{let y;(0,t.alwaysValidSchema)(u,A)?c.var(S,!0):y=o.subschema({keyword:"oneOf",schemaProp:E,compositeRule:!0},S),E>0&&c.if((0,e._)`${S} && ${g}`).assign(g,!1).assign(p,(0,e._)`[${p}, ${E}]`).else(),c.if(S,()=>{c.assign(g,!0),c.assign(p,E),y&&o.mergeEvaluated(y,e.Name)})})}}};return Id.default=r,Id}var Pd={},Hw;function _O(){if(Hw)return Pd;Hw=1,Object.defineProperty(Pd,"__esModule",{value:!0});const e=Nt(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:o,it:c}=n;if(!Array.isArray(o))throw new Error("ajv implementation error");const h=r.name("valid");o.forEach((l,u)=>{if((0,e.alwaysValidSchema)(c,l))return;const m=n.subschema({keyword:"allOf",schemaProp:u},h);n.ok(h),n.mergeEvaluated(m)})}};return Pd.default=t,Pd}var Bd={},Uw;function yO(){if(Uw)return Bd;Uw=1,Object.defineProperty(Bd,"__esModule",{value:!0});const e=bt(),t=Nt(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:c})=>(0,e.str)`must match "${c.ifClause}" schema`,params:({params:c})=>(0,e._)`{failingKeyword: ${c.ifClause}}`},code(c){const{gen:h,parentSchema:l,it:u}=c;l.then===void 0&&l.else===void 0&&(0,t.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const m=o(u,"then"),g=o(u,"else");if(!m&&!g)return;const p=h.let("valid",!0),S=h.name("_valid");if(w(),c.reset(),m&&g){const E=h.let("ifClause");c.setParams({ifClause:E}),h.if(S,A("then",E),A("else",E))}else m?h.if(S,A("then")):h.if((0,e.not)(S),A("else"));c.pass(p,()=>c.error(!0));function w(){const E=c.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},S);c.mergeEvaluated(E)}function A(E,y){return()=>{const b=c.subschema({keyword:E},S);h.assign(p,S),c.mergeValidEvaluated(b,p),y?h.assign(y,(0,e._)`${E}`):c.setParams({ifClause:E})}}}};function o(c,h){const l=c.schema[h];return l!==void 0&&!(0,t.alwaysValidSchema)(c,l)}return Bd.default=r,Bd}var zd={},Fw;function bO(){if(Fw)return zd;Fw=1,Object.defineProperty(zd,"__esModule",{value:!0});const e=Nt(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:o}){r.if===void 0&&(0,e.checkStrictMode)(o,`"${n}" without "if" is ignored`)}};return zd.default=t,zd}var qw;function SO(){if(qw)return jd;qw=1,Object.defineProperty(jd,"__esModule",{value:!0});const e=S2(),t=cO(),n=w2(),r=uO(),o=dO(),c=o_(),h=hO(),l=x2(),u=fO(),m=pO(),g=mO(),p=gO(),S=vO(),w=_O(),A=yO(),E=bO();function y(b=!1){const v=[g.default,p.default,S.default,w.default,A.default,E.default,h.default,l.default,c.default,u.default,m.default];return b?v.push(t.default,r.default):v.push(e.default,n.default),v.push(o.default),v}return jd.default=y,jd}var Hd={},Do={},Vw;function C2(){if(Vw)return Do;Vw=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.dynamicAnchor=void 0;const e=bt(),t=ki(),n=mf(),r=r_(),o={keyword:"$dynamicAnchor",schemaType:"string",code:l=>c(l,l.schema)};function c(l,u){const{gen:m,it:g}=l;g.schemaEnv.root.dynamicAnchors[u]=!0;const p=(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(u)}`,S=g.errSchemaPath==="#"?g.validateName:h(l);m.if((0,e._)`!${p}`,()=>m.assign(p,S))}Do.dynamicAnchor=c;function h(l){const{schemaEnv:u,schema:m,self:g}=l.it,{root:p,baseId:S,localRefs:w,meta:A}=u.root,{schemaId:E}=g.opts,y=new n.SchemaEnv({schema:m,schemaId:E,root:p,baseId:S,localRefs:w,meta:A});return n.compileSchema.call(g,y),(0,r.getValidate)(l,y)}return Do.default=o,Do}var Oo={},Gw;function E2(){if(Gw)return Oo;Gw=1,Object.defineProperty(Oo,"__esModule",{value:!0}),Oo.dynamicRef=void 0;const e=bt(),t=ki(),n=r_(),r={keyword:"$dynamicRef",schemaType:"string",code:c=>o(c,c.schema)};function o(c,h){const{gen:l,keyword:u,it:m}=c;if(h[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);const g=h.slice(1);if(m.allErrors)p();else{const w=l.let("valid",!1);p(w),c.ok(w)}function p(w){if(m.schemaEnv.root.dynamicAnchors[g]){const A=l.let("_v",(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(g)}`);l.if(A,S(A,w),S(m.validateName,w))}else S(m.validateName,w)()}function S(w,A){return A?()=>l.block(()=>{(0,n.callRef)(c,w),l.let(A,!0)}):()=>(0,n.callRef)(c,w)}}return Oo.dynamicRef=o,Oo.default=r,Oo}var Ud={},Ww;function wO(){if(Ww)return Ud;Ww=1,Object.defineProperty(Ud,"__esModule",{value:!0});const e=C2(),t=Nt(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Ud.default=n,Ud}var Fd={},Kw;function xO(){if(Kw)return Fd;Kw=1,Object.defineProperty(Fd,"__esModule",{value:!0});const e=E2(),t={keyword:"$recursiveRef",schemaType:"string",code:n=>(0,e.dynamicRef)(n,n.schema)};return Fd.default=t,Fd}var Yw;function CO(){if(Yw)return Hd;Yw=1,Object.defineProperty(Hd,"__esModule",{value:!0});const e=C2(),t=E2(),n=wO(),r=xO(),o=[e.default,t.default,n.default,r.default];return Hd.default=o,Hd}var qd={},Vd={},Xw;function EO(){if(Xw)return Vd;Xw=1,Object.defineProperty(Vd,"__esModule",{value:!0});const e=o_(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:n=>(0,e.validatePropertyDeps)(n)};return Vd.default=t,Vd}var Gd={},Jw;function kO(){if(Jw)return Gd;Jw=1,Object.defineProperty(Gd,"__esModule",{value:!0});const e=o_(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:n=>(0,e.validateSchemaDeps)(n)};return Gd.default=t,Gd}var Wd={},Zw;function jO(){if(Zw)return Wd;Zw=1,Object.defineProperty(Wd,"__esModule",{value:!0});const e=Nt(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:r,it:o}){r.contains===void 0&&(0,e.checkStrictMode)(o,`"${n}" without "contains" is ignored`)}};return Wd.default=t,Wd}var Qw;function RO(){if(Qw)return qd;Qw=1,Object.defineProperty(qd,"__esModule",{value:!0});const e=EO(),t=kO(),n=jO(),r=[e.default,t.default,n.default];return qd.default=r,qd}var Kd={},Yd={},ex;function AO(){if(ex)return Yd;ex=1,Object.defineProperty(Yd,"__esModule",{value:!0});const e=bt(),t=Nt(),n=ki(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:c})=>(0,e._)`{unevaluatedProperty: ${c.unevaluatedProperty}}`},code(c){const{gen:h,schema:l,data:u,errsCount:m,it:g}=c;if(!m)throw new Error("ajv implementation error");const{allErrors:p,props:S}=g;S instanceof e.Name?h.if((0,e._)`${S} !== true`,()=>h.forIn("key",u,y=>h.if(A(S,y),()=>w(y)))):S!==!0&&h.forIn("key",u,y=>S===void 0?w(y):h.if(E(S,y),()=>w(y))),g.props=!0,c.ok((0,e._)`${m} === ${n.default.errors}`);function w(y){if(l===!1){c.setParams({unevaluatedProperty:y}),c.error(),p||h.break();return}if(!(0,t.alwaysValidSchema)(g,l)){const b=h.name("valid");c.subschema({keyword:"unevaluatedProperties",dataProp:y,dataPropType:t.Type.Str},b),p||h.if((0,e.not)(b),()=>h.break())}}function A(y,b){return(0,e._)`!${y} || !${y}[${b}]`}function E(y,b){const v=[];for(const _ in y)y[_]===!0&&v.push((0,e._)`${b} !== ${_}`);return(0,e.and)(...v)}}};return Yd.default=o,Yd}var Xd={},tx;function TO(){if(tx)return Xd;tx=1,Object.defineProperty(Xd,"__esModule",{value:!0});const e=bt(),t=Nt(),r={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,e.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,e._)`{limit: ${o}}`},code(o){const{gen:c,schema:h,data:l,it:u}=o,m=u.items||0;if(m===!0)return;const g=c.const("len",(0,e._)`${l}.length`);if(h===!1)o.setParams({len:m}),o.fail((0,e._)`${g} > ${m}`);else if(typeof h=="object"&&!(0,t.alwaysValidSchema)(u,h)){const S=c.var("valid",(0,e._)`${g} <= ${m}`);c.if((0,e.not)(S),()=>p(S,m)),o.ok(S)}u.items=!0;function p(S,w){c.forRange("i",w,g,A=>{o.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:t.Type.Num},S),u.allErrors||c.if((0,e.not)(S),()=>c.break())})}}};return Xd.default=r,Xd}var sx;function NO(){if(sx)return Kd;sx=1,Object.defineProperty(Kd,"__esModule",{value:!0});const e=AO(),t=TO(),n=[e.default,t.default];return Kd.default=n,Kd}var Jd={},Zd={},nx;function MO(){if(nx)return Zd;nx=1,Object.defineProperty(Zd,"__esModule",{value:!0});const e=bt(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,e._)`{format: ${r}}`},code(r,o){const{gen:c,data:h,$data:l,schema:u,schemaCode:m,it:g}=r,{opts:p,errSchemaPath:S,schemaEnv:w,self:A}=g;if(!p.validateFormats)return;l?E():y();function E(){const b=c.scopeValue("formats",{ref:A.formats,code:p.code.formats}),v=c.const("fDef",(0,e._)`${b}[${m}]`),_=c.let("fType"),k=c.let("format");c.if((0,e._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>c.assign(_,(0,e._)`${v}.type || "string"`).assign(k,(0,e._)`${v}.validate`),()=>c.assign(_,(0,e._)`"string"`).assign(k,v)),r.fail$data((0,e.or)(C(),x()));function C(){return p.strictSchema===!1?e.nil:(0,e._)`${m} && !${k}`}function x(){const T=w.$async?(0,e._)`(${v}.async ? await ${k}(${h}) : ${k}(${h}))`:(0,e._)`${k}(${h})`,R=(0,e._)`(typeof ${k} == "function" ? ${T} : ${k}.test(${h}))`;return(0,e._)`${k} && ${k} !== true && ${_} === ${o} && !${R}`}}function y(){const b=A.formats[u];if(!b){C();return}if(b===!0)return;const[v,_,k]=x(b);v===o&&r.pass(T());function C(){if(p.strictSchema===!1){A.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${u}" ignored in schema at path "${S}"`}}function x(R){const M=R instanceof RegExp?(0,e.regexpCode)(R):p.code.formats?(0,e._)`${p.code.formats}${(0,e.getProperty)(u)}`:void 0,D=c.scopeValue("formats",{key:u,ref:R,code:M});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,e._)`${D}.validate`]:["string",R,D]}function T(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!w.$async)throw new Error("async format in sync schema");return(0,e._)`await ${k}(${h})`}return typeof _=="function"?(0,e._)`${k}(${h})`:(0,e._)`${k}.test(${h})`}}}};return Zd.default=n,Zd}var ix;function $O(){if(ix)return Jd;ix=1,Object.defineProperty(Jd,"__esModule",{value:!0});const t=[MO().default];return Jd.default=t,Jd}var ka={},rx;function DO(){return rx||(rx=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.contentVocabulary=ka.metadataVocabulary=void 0,ka.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ka.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ka}var ax;function OO(){if(ax)return dd;ax=1,Object.defineProperty(dd,"__esModule",{value:!0});const e=XD(),t=lO(),n=SO(),r=CO(),o=RO(),c=NO(),h=$O(),l=DO(),u=[r.default,e.default,t.default,(0,n.default)(!0),h.default,l.metadataVocabulary,l.contentVocabulary,o.default,c.default];return dd.default=u,dd}var Qd={},dc={},ox;function LO(){if(ox)return dc;ox=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(dc.DiscrError=e={})),dc}var lx;function IO(){if(lx)return Qd;lx=1,Object.defineProperty(Qd,"__esModule",{value:!0});const e=bt(),t=LO(),n=mf(),r=pf(),o=Nt(),h={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:l,tagName:u}})=>l===t.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:l,tag:u,tagName:m}})=>(0,e._)`{error: ${l}, tag: ${m}, tagValue: ${u}}`},code(l){const{gen:u,data:m,schema:g,parentSchema:p,it:S}=l,{oneOf:w}=p;if(!S.opts.discriminator)throw new Error("discriminator: requires discriminator option");const A=g.propertyName;if(typeof A!="string")throw new Error("discriminator: requires propertyName");if(g.mapping)throw new Error("discriminator: mapping is not supported");if(!w)throw new Error("discriminator: requires oneOf keyword");const E=u.let("valid",!1),y=u.const("tag",(0,e._)`${m}${(0,e.getProperty)(A)}`);u.if((0,e._)`typeof ${y} == "string"`,()=>b(),()=>l.error(!1,{discrError:t.DiscrError.Tag,tag:y,tagName:A})),l.ok(E);function b(){const k=_();u.if(!1);for(const C in k)u.elseIf((0,e._)`${y} === ${C}`),u.assign(E,v(k[C]));u.else(),l.error(!1,{discrError:t.DiscrError.Mapping,tag:y,tagName:A}),u.endIf()}function v(k){const C=u.name("valid"),x=l.subschema({keyword:"oneOf",schemaProp:k},C);return l.mergeEvaluated(x,e.Name),C}function _(){var k;const C={},x=R(p);let T=!0;for(let L=0;L<w.length;L++){let q=w[L];if(q!=null&&q.$ref&&!(0,o.schemaHasRulesButRef)(q,S.self.RULES)){const Y=q.$ref;if(q=n.resolveRef.call(S.self,S.schemaEnv.root,S.baseId,Y),q instanceof n.SchemaEnv&&(q=q.schema),q===void 0)throw new r.default(S.opts.uriResolver,S.baseId,Y)}const F=(k=q==null?void 0:q.properties)===null||k===void 0?void 0:k[A];if(typeof F!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);T=T&&(x||R(q)),M(F,L)}if(!T)throw new Error(`discriminator: "${A}" must be required`);return C;function R({required:L}){return Array.isArray(L)&&L.includes(A)}function M(L,q){if(L.const)D(L.const,q);else if(L.enum)for(const F of L.enum)D(F,q);else throw new Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function D(L,q){if(typeof L!="string"||L in C)throw new Error(`discriminator: "${A}" values must be unique strings`);C[L]=q}}}};return Qd.default=h,Qd}var eh={};const PO="https://json-schema.org/draft/2020-12/schema",BO="https://json-schema.org/draft/2020-12/schema",zO={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},HO="meta",UO="Core and Validation specifications meta-schema",FO=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],qO=["object","boolean"],VO="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",GO={definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}},WO={$schema:PO,$id:BO,$vocabulary:zO,$dynamicAnchor:HO,title:UO,allOf:FO,type:qO,$comment:VO,properties:GO},KO="https://json-schema.org/draft/2020-12/schema",YO="https://json-schema.org/draft/2020-12/meta/applicator",XO={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},JO="meta",ZO="Applicator vocabulary meta-schema",QO=["object","boolean"],e5={prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},t5={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},s5={$schema:KO,$id:YO,$vocabulary:XO,$dynamicAnchor:JO,title:ZO,type:QO,properties:e5,$defs:t5},n5="https://json-schema.org/draft/2020-12/schema",i5="https://json-schema.org/draft/2020-12/meta/unevaluated",r5={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},a5="meta",o5="Unevaluated applicator vocabulary meta-schema",l5=["object","boolean"],c5={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},u5={$schema:n5,$id:i5,$vocabulary:r5,$dynamicAnchor:a5,title:o5,type:l5,properties:c5},d5="https://json-schema.org/draft/2020-12/schema",h5="https://json-schema.org/draft/2020-12/meta/content",f5={"https://json-schema.org/draft/2020-12/vocab/content":!0},p5="meta",m5="Content vocabulary meta-schema",g5=["object","boolean"],v5={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},_5={$schema:d5,$id:h5,$vocabulary:f5,$dynamicAnchor:p5,title:m5,type:g5,properties:v5},y5="https://json-schema.org/draft/2020-12/schema",b5="https://json-schema.org/draft/2020-12/meta/core",S5={"https://json-schema.org/draft/2020-12/vocab/core":!0},w5="meta",x5="Core vocabulary meta-schema",C5=["object","boolean"],E5={$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},k5={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},j5={$schema:y5,$id:b5,$vocabulary:S5,$dynamicAnchor:w5,title:x5,type:C5,properties:E5,$defs:k5},R5="https://json-schema.org/draft/2020-12/schema",A5="https://json-schema.org/draft/2020-12/meta/format-annotation",T5={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},N5="meta",M5="Format vocabulary meta-schema for annotation results",$5=["object","boolean"],D5={format:{type:"string"}},O5={$schema:R5,$id:A5,$vocabulary:T5,$dynamicAnchor:N5,title:M5,type:$5,properties:D5},L5="https://json-schema.org/draft/2020-12/schema",I5="https://json-schema.org/draft/2020-12/meta/meta-data",P5={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},B5="meta",z5="Meta-data vocabulary meta-schema",H5=["object","boolean"],U5={title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}},F5={$schema:L5,$id:I5,$vocabulary:P5,$dynamicAnchor:B5,title:z5,type:H5,properties:U5},q5="https://json-schema.org/draft/2020-12/schema",V5="https://json-schema.org/draft/2020-12/meta/validation",G5={"https://json-schema.org/draft/2020-12/vocab/validation":!0},W5="meta",K5="Validation vocabulary meta-schema",Y5=["object","boolean"],X5={type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},J5={nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},Z5={$schema:q5,$id:V5,$vocabulary:G5,$dynamicAnchor:W5,title:K5,type:Y5,properties:X5,$defs:J5};var cx;function Q5(){if(cx)return eh;cx=1,Object.defineProperty(eh,"__esModule",{value:!0});const e=WO,t=s5,n=u5,r=_5,o=j5,c=O5,h=F5,l=Z5,u=["/properties"];function m(g){return[e,t,n,r,o,p(this,c),h,p(this,l)].forEach(S=>this.addMetaSchema(S,void 0,!1)),this;function p(S,w){return g?S.$dataMetaSchema(w,u):w}}return eh.default=m,eh}var ux;function e6(){return ux||(ux=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const n=KD(),r=OO(),o=IO(),c=Q5(),h="https://json-schema.org/draft/2020-12/schema";class l extends n.default{constructor(w={}){super({...w,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(w=>this.addVocabulary(w)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:w,meta:A}=this.opts;A&&(c.default.call(this,w),this.refs["http://json-schema.org/schema"]=h)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(h)?h:void 0)}}t.Ajv2020=l,e.exports=t=l,e.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=ff();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var m=bt();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var g=i_();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return g.default}});var p=pf();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})(ad,ad.exports)),ad.exports}var t6=e6();const s6=cR(t6),k2="sapiom.studio.run-input.v1:",j2="sapiom.studio.run-target.v1:";function gf(e,t){return`${e}${encodeURIComponent(t)}`}function vf(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function dx(e){var t;try{const n=(t=vf())==null?void 0:t.getItem(gf(k2,e));if(!n)return null;const r=JSON.parse(n);return"value"in r?{value:r.value,schemaSignature:typeof r.schemaSignature=="string"?r.schemaSignature:null}:null}catch{return null}}function n6(e,t,n){var r;try{(r=vf())==null||r.setItem(gf(k2,e),JSON.stringify({value:t,schemaSignature:n}))}catch{}}function hx(e){var t;try{return((t=vf())==null?void 0:t.getItem(gf(j2,e)))==="prod"?"prod":"local"}catch{return"local"}}function i6(e,t){var n;try{(n=vf())==null||n.setItem(gf(j2,e),t)}catch{}}function r6(e){const t=n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.entries(n).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>[r,t(o)])):n;return JSON.stringify(t(e))}function a6(e){return Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:Object.prototype.hasOwnProperty.call(e,"example")?e.example:void 0}function R2(e){if(Object.prototype.hasOwnProperty.call(e,"default"))return e.default;if(e.type==="object"){const t=e.properties??{},n={};for(const[r,o]of Object.entries(t)){const c=R2(o);c!==void 0&&(n[r]=c)}return Object.keys(n).length>0?n:void 0}}function vv(e){if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0];switch(e.type){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return A2(e);default:return null}}function A2(e){if(e.type!=="object")return vv(e);const t=Array.isArray(e.required)?e.required.filter(r=>typeof r=="string"):[],n=e.properties??{};return Object.fromEntries(t.map(r=>[r,vv(n[r]??{})]))}function Sh(e){const t=Object.prototype.hasOwnProperty.call(e,"default");if(e.type!=="object")return t?e.default:void 0;if(t&&(!e.default||typeof e.default!="object"||Array.isArray(e.default)))return e.default;const n=e.properties??{},r=new Set(Array.isArray(e.required)?e.required.filter(c=>typeof c=="string"):[]),o=t?{...e.default}:{};for(const[c,h]of Object.entries(n)){if(Object.prototype.hasOwnProperty.call(o,c)){const u=o[c];h.type==="object"&&u!==null&&typeof u=="object"&&!Array.isArray(u)&&(o[c]=Sh({...h,default:u}));continue}R2(h)!==void 0?o[c]=Sh(h):r.has(c)&&(o[c]=Sh(h)??vv(h))}return Object.keys(o).length>0?o:void 0}function Go(e){const t=a6(e);if(t!==void 0)return t;const n=Sh(e);return n!==void 0?n:A2(e)}function o6(e){const t=e.nodes.find(n=>n.id===e.entry);return t?t.inputSchema?{status:"available",jsonSchema:t.inputSchema,example:Go(t.inputSchema)}:{status:"none",jsonSchema:null,example:{}}:null}function l6(e){const n=new s6({allErrors:!0,strict:!1}).compile(e);return{validate:n,validateValue(r){return n(r)?[]:[...n.errors??[]]}}}function T2(e){if(e.keyword==="required"){const t=e.params.missingProperty;if(typeof t=="string")return`${e.instancePath}/${t}`}return e.instancePath||"/"}function Ho(e){return`${T2(e).split("/").filter(Boolean).map(n=>n.replaceAll("~1","/").replaceAll("~0","~")).join(" → ")||"Input"} ${e.message??"is invalid"}`}function Lc(e,t,n){const r={event:e,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":Fo()},body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}const c6=[{id:"local",label:"Local",description:"Agent code runs here with Sapiom calls stubbed",icon:"SquareTerminal"},{id:"prod",label:"Cloud",description:"Run the deployed agent with real capabilities",icon:"Cloud"}];function u6({open:e,anchorRef:t,selected:n,cloudDisabledReason:r,onDismiss:o,onSelect:c}){return d.jsx(Ei,{open:e,anchorRef:t,onDismiss:o,placement:"down-end",className:"canvas-run-menu session-run-menu",role:"menu",testid:"session-run-target-menu",children:c6.map(h=>{const l=h.id==="prod"?r:null,u=n===h.id;return d.jsxs("button",{className:"run-target-option","data-selected":u||void 0,"data-testid":h.id==="prod"?"session-step-run":"run-target-local",type:"button",role:"menuitemradio","aria-checked":u,disabled:!!l,title:l??void 0,"aria-label":l?`${h.label}: ${l}`:h.label,"data-tooltip":l??void 0,onClick:()=>c(h.id),children:[d.jsx(ue,{name:h.icon,size:15}),d.jsxs("span",{className:"run-target-copy",children:[d.jsx("strong",{children:h.label}),d.jsx("small",{children:l??h.description})]}),d.jsx("span",{className:"run-target-check","aria-hidden":"true",children:u&&d.jsx(ue,{name:"Check",size:13})})]},h.id)})})}function d6({workflow:e,activeSessionId:t,sessionReady:n,macros:r,onRunMacro:o,onRequestRun:c,preview:h,lastDeployError:l,authenticated:u,directActionSettleSeq:m,runningTarget:g}){const p=F=>r.find(Y=>Y.id===F),S=Pa(e,l),w=S==="ready",[A,E]=O.useState(null),[y,b]=O.useState(!1),[v,_]=O.useState(()=>hx(e.path)),k=O.useRef(null),C=O.useRef(null);O.useEffect(()=>{E(null)},[e.path,S,l,m]),O.useEffect(()=>{_(hx(e.path))},[e.path]);const x=[{id:"deploy",label:"Deploy",icon:"CloudUpload",macro:p("deploy"),testId:"session-step-deploy",hint:"Deploy: push and build on Sapiom.",needsAuth:!0,primary:!w}].filter(F=>F.macro),T=F=>RD(F,{subject:e,authenticated:u,deployError:l}).reason,R=T("prod"),M=T("run"),D=v==="prod"&&M?"local":v,L=D==="local"?"Local":"Cloud",q=F=>{F==="prod"&&M||(_(F),i6(e.path,F),b(!1),c(F,C.current))};return d.jsxs("div",{className:"session-actions","data-testid":"session-steps","aria-label":"Agent actions",...Dt({surface:"agent_actions"}),children:[h&&d.jsxs("a",{className:"status-tag status-tag-action session-preview-chip","data-testid":"session-preview-chip",href:h.url,target:"_blank",rel:"noreferrer","aria-label":`Preview :${h.port}`,"data-tooltip":`The coding agent is serving an app on port ${h.port}. Opens ${h.url}`,children:[d.jsx(ue,{name:"ExternalLink",size:12}),d.jsx("span",{className:"session-preview-label",children:"Preview "}),":",h.port]}),R?d.jsx("button",{className:"session-step session-action-prod","data-testid":"session-step-prod",type:"button",disabled:!0,"aria-label":`Prod: ${R}`,"data-tooltip":`Prod: ${R}`,children:d.jsx(ue,{name:"Globe",size:14})}):d.jsx("a",{className:"session-step session-action-prod","data-testid":"session-step-prod",href:af(e.definitionId??0),target:"_blank",rel:"noreferrer","aria-label":`Open ${e.name} in the Sapiom dashboard`,"data-tooltip":"Open this linked agent in the Sapiom dashboard",children:d.jsx(ue,{name:"Globe",size:14})}),d.jsxs("div",{className:"session-run-split","data-running":g===D||void 0,children:[d.jsxs("button",{ref:C,className:"session-step session-run-main"+(w?" session-action-primary":""),"data-testid":"session-step-local",type:"button",onClick:()=>c(D,C.current),"aria-label":`Run using ${L}`,"data-tooltip":`Review input and run using ${L}`,children:[d.jsx(ue,{name:"Play",size:14}),d.jsxs("span",{className:"session-step-label",children:["Run · ",L]})]}),d.jsx("button",{ref:k,className:"session-step session-run-menu-trigger"+(w?" session-action-primary":""),type:"button","aria-label":"Choose run target","aria-haspopup":"menu","aria-expanded":y,onClick:()=>b(F=>!F),children:d.jsx(ue,{name:"ChevronDown",size:13})}),d.jsx(u6,{open:y,anchorRef:k,onDismiss:()=>b(!1),selected:v,cloudDisabledReason:M,onSelect:q})]}),x.map(F=>{const Y=F.needsAuth?T("deploy"):null,Q=F.needsDeploy?M:null,G=!n&&F.macro&&wD(F.macro)?"Session is starting":null,ee=Y??Q??G??(F.macro?xD(F.macro,e,t):null);return d.jsxs("button",{className:"session-step"+(F.primary?" session-action-primary":""),"data-testid":F.testId,"data-pending":A===F.id||void 0,"data-running":void 0,disabled:!!ee,"data-tooltip":ee?`${F.label}: ${ee}`:F.hint,"aria-label":ee?`${F.label}: ${ee}`:F.label,onClick:()=>{F.macro&&(o(F.macro),E(F.id),Lc("macro.invoked",{macroId:F.macro.id}))},children:[d.jsx(ue,{name:F.icon,size:14}),d.jsx("span",{className:"session-step-label",children:F.label})]},F.id)})]})}function N2(e,t){const n=String(t).replaceAll("~","~0").replaceAll("/","~1");return`${e}/${n}`}function M2(e,t){return e.filter(n=>T2(n)===(t||"/"))}function _v(e,t){return typeof e.title=="string"&&e.title.trim()?e.title:t??"Value"}function h6(e){return typeof e.description=="string"&&e.description.trim()?e.description:null}function f6(e){if(e.$ref||e.anyOf||e.oneOf||e.allOf)return!1;if(Array.isArray(e.enum))return!0;if(e.type==="array"){const t=e.items;return!!(t&&typeof t=="object"&&p6(t))}return["object","string","number","integer","boolean"].includes(String(e.type))}function p6(e){return e.$ref||e.anyOf||e.oneOf||e.allOf?!1:Array.isArray(e.enum)?!0:["string","number","integer","boolean"].includes(String(e.type))}function fx(e){return JSON.stringify(e??null,null,2)}function px({value:e,onChange:t,label:n,description:r}){const o=O.useId(),c=r?`${o}-description`:void 0,h=fx(e),l=O.useRef(h),[u,m]=O.useState(h),[g,p]=O.useState(null),S=g?`${o}-error`:void 0;return O.useEffect(()=>{h!==l.current&&(l.current=h,m(h),p(null))},[h]),d.jsxs("div",{className:"schema-field schema-json-field",children:[d.jsx("label",{htmlFor:o,children:n}),r&&d.jsx("p",{id:c,children:r}),d.jsx("textarea",{id:o,value:u,rows:5,spellCheck:!1,"aria-invalid":!!g,"aria-describedby":[c,S].filter(Boolean).join(" ")||void 0,onChange:w=>{const A=w.target.value;m(A);try{const E=JSON.parse(A);p(null),l.current=fx(E),t(E)}catch(E){p(E instanceof Error?E.message:"Enter valid JSON.")}}}),g&&d.jsx("span",{id:S,className:"schema-field-error",children:g})]})}function $2({schema:e,value:t,onChange:n,id:r,ariaLabel:o,describedBy:c,invalid:h=!1,required:l=!1}){if(Array.isArray(e.enum))return d.jsxs("select",{id:r,"aria-label":o,"aria-describedby":c,"aria-invalid":h,required:l,value:t===void 0?"":JSON.stringify(t),onChange:m=>n(m.target.value===""?void 0:JSON.parse(m.target.value)),children:[d.jsx("option",{value:"",children:"Select…"}),e.enum.map((m,g)=>d.jsx("option",{value:JSON.stringify(m),children:String(m)},g))]});if(e.type==="boolean")return d.jsxs("select",{id:r,"aria-label":o,"aria-describedby":c,"aria-invalid":h,required:l,value:t===!0?"true":t===!1?"false":"",onChange:m=>n(m.target.value===""?void 0:m.target.value==="true"),children:[d.jsx("option",{value:"",children:"Not set"}),d.jsx("option",{value:"true",children:"True"}),d.jsx("option",{value:"false",children:"False"})]});const u=e.type==="number"||e.type==="integer";return d.jsx("input",{id:r,type:u?"number":"text",step:e.type==="integer"?1:"any",min:typeof e.minimum=="number"?e.minimum:void 0,max:typeof e.maximum=="number"?e.maximum:void 0,minLength:!u&&typeof e.minLength=="number"?e.minLength:void 0,maxLength:!u&&typeof e.maxLength=="number"?e.maxLength:void 0,pattern:!u&&typeof e.pattern=="string"?e.pattern:void 0,"aria-label":o,"aria-describedby":c,"aria-invalid":h,required:l,value:typeof t=="string"||typeof t=="number"?t:"",placeholder:typeof e.placeholder=="string"?e.placeholder:void 0,onChange:m=>{const g=m.target.value;n(u?g===""?void 0:Number(g):g)}})}function m6({schema:e,value:t,onChange:n,errors:r,path:o,label:c}){const h=O.useId(),l=e.items,u=Array.isArray(t)?t:[],m=typeof e.minItems=="number"?e.minItems:0,g=typeof e.maxItems=="number"?e.maxItems:Number.POSITIVE_INFINITY,p=c??_v(e);return d.jsxs("div",{className:"schema-array",children:[u.map((S,w)=>{const A=N2(o??"",w),E=`${h}-${w}`,y=M2(r,A),b=y.length>0?`${E}-errors`:void 0;return d.jsxs("div",{className:"schema-array-row",children:[d.jsx($2,{schema:l,value:S,onChange:v=>{const _=[...u];_[w]=v,n(_)},id:E,ariaLabel:`${p} item ${w+1}`,describedBy:b,invalid:y.length>0}),d.jsx("button",{type:"button",className:"theme-toggle","aria-label":`Remove item ${w+1}`,disabled:u.length<=m,onClick:()=>n(u.filter((v,_)=>_!==w)),children:d.jsx(ue,{name:"X",size:13})}),y.length>0&&d.jsx("div",{id:b,className:"schema-field-errors",children:y.map((v,_)=>d.jsx("span",{className:"schema-field-error",children:Ho(v)},_))})]},w)}),d.jsxs("button",{type:"button",className:"btn-ghost schema-array-add",disabled:u.length>=g,onClick:()=>n([...u,Go(l)]),children:[d.jsx(ue,{name:"Plus",size:13})," Add item"]})]})}function D2({schema:e,value:t,onChange:n,errors:r,path:o="",label:c,required:h=!0}){const l=O.useId(),u=_v(e,c),m=h6(e),g=M2(r,o);if(!f6(e))return d.jsx(px,{value:t,onChange:n,label:u,description:m});if(e.type==="object"){const w=t&&typeof t=="object"&&!Array.isArray(t)?t:{},A=e.properties??{},E=new Set(Array.isArray(e.required)?e.required.filter(k=>typeof k=="string"):[]),y=Object.fromEntries(Object.entries(w).filter(([k])=>!(k in A))),b=d.jsxs("div",{className:"schema-object-fields",children:[Object.entries(A).map(([k,C])=>{const x=N2(o,k),T=E.has(k),R=Object.prototype.hasOwnProperty.call(w,k);return d.jsxs("div",{className:"schema-property",children:[!T&&d.jsxs("label",{className:"schema-optional-toggle",children:[d.jsx("input",{type:"checkbox",checked:R,onChange:M=>{const D={...w};M.target.checked?D[k]=Go(C):delete D[k],n(D)}}),"Include ",_v(C,k)]}),(T||R)&&d.jsx(D2,{schema:C,value:w[k],onChange:M=>n({...w,[k]:M}),errors:r,path:x,label:k,required:T})]},k)}),Object.keys(y).length>0&&d.jsx(px,{value:y,label:"Additional fields",description:"These values are not present in the current contract.",onChange:k=>{const C=k&&typeof k=="object"&&!Array.isArray(k)?k:{};n({...Object.fromEntries(Object.entries(w).filter(([x])=>x in A)),...C})}})]});if(o===""){const k=g.length>0?`${l}-errors`:void 0;return d.jsxs("div",{"aria-describedby":k,children:[m&&d.jsx("p",{children:m}),b,g.length>0&&d.jsx("div",{id:k,className:"schema-field-errors",children:g.map((C,x)=>d.jsx("span",{className:"schema-field-error",children:Ho(C)},x))})]})}const v=m?`${l}-description`:void 0,_=g.length>0?`${l}-errors`:void 0;return d.jsxs("fieldset",{className:"schema-object","aria-describedby":[v,_].filter(Boolean).join(" ")||void 0,children:[d.jsxs("legend",{children:[u,h&&d.jsx("span",{"aria-label":"required",children:" *"})]}),m&&d.jsx("p",{id:v,children:m}),b,g.length>0&&d.jsx("div",{id:_,className:"schema-field-errors",children:g.map((k,C)=>d.jsx("span",{className:"schema-field-error",children:Ho(k)},C))})]})}const p=m?`${l}-description`:void 0,S=g.length>0?`${l}-errors`:void 0;return e.type==="array"?d.jsxs("fieldset",{className:"schema-field schema-array-field","aria-describedby":[p,S].filter(Boolean).join(" ")||void 0,children:[d.jsxs("legend",{children:[u,h&&d.jsx("span",{"aria-label":"required",children:" *"})]}),m&&d.jsx("p",{id:p,children:m}),d.jsx(m6,{schema:e,value:t,onChange:n,errors:r,path:o,label:u}),g.length>0&&d.jsx("div",{id:S,className:"schema-field-errors",children:g.map((w,A)=>d.jsx("span",{className:"schema-field-error",children:Ho(w)},A))})]}):d.jsxs("div",{className:"schema-field",children:[d.jsxs("label",{htmlFor:l,children:[u,h&&d.jsx("span",{"aria-label":"required",children:" *"})]}),m&&d.jsx("p",{id:p,children:m}),d.jsx($2,{schema:e,value:t,onChange:n,id:l,describedBy:[p,S].filter(Boolean).join(" ")||void 0,invalid:g.length>0,required:h}),g.length>0&&d.jsx("div",{id:S,className:"schema-field-errors",children:g.map((w,A)=>d.jsx("span",{className:"schema-field-error",children:Ho(w)},A))})]})}function th(e){return JSON.stringify(e??{},null,2)}function g6({workflow:e,target:t,loadContract:n,onClose:r,returnFocus:o,onRun:c}){const h=O.useRef(null),l=O.useRef(null),u=O.useRef(null),m=O.useRef(null),[g,p]=O.useState(null),[S,w]=O.useState({}),[A,E]=O.useState("{}"),[y,b]=O.useState(null),[v,_]=O.useState([]),[k,C]=O.useState(null),[x,T]=O.useState("form"),[R,M]=O.useState(!1);za(!0,{onDismiss:r,containerRef:h}),O.useEffect(()=>()=>{o==null||o.focus()},[o]),O.useEffect(()=>{let Q=!0;return p(null),b(null),n(e.path).then(G=>{if(!Q)return;p(G);const ee=dx(e.path);let ne=(ee==null?void 0:ee.value)??G.example,z=null,B=[];if(G.status==="available"){ne=(ee==null?void 0:ee.value)??Go(G.jsonSchema);try{z=l6(G.jsonSchema),B=z.validateValue(ne)}catch{T("json"),b("This contract uses a schema branch Studio cannot render. Edit the complete JSON input instead.")}}else T("json");C(z),w(ne),_(B),M(!!(ee&&B.length>0)),E(th(ne)),requestAnimationFrame(()=>{var $,H;return(H=l.current??(($=h.current)==null?void 0:$.querySelector("input, select, textarea")))==null?void 0:H.focus()})}).catch(()=>{if(!Q)return;p({status:"unavailable",jsonSchema:null,example:{},reason:"Studio couldn't load this agent's input contract. You can still run it with raw JSON."});const G=dx(e.path),ee=(G==null?void 0:G.value)??{};w(ee),E(th(ee)),T("json"),b(null),requestAnimationFrame(()=>{var ne;return(ne=l.current)==null?void 0:ne.focus()})}),()=>{Q=!1}},[n,e.path]);const D=()=>{var ne;if(!g)return;let Q=S;if(x==="json")try{Q=JSON.parse(A)}catch(z){b(z instanceof Error?z.message:"Enter valid JSON."),(ne=l.current)==null||ne.focus();return}const G=(k==null?void 0:k.validateValue(Q))??[];if(_(G),G.length>0){b("Fix the highlighted input before running.");return}const ee=g.status==="available"?r6(g.jsonSchema):null;n6(e.path,Q,ee),b(null),c(Q)},L=Q=>{w(Q),E(th(Q));const G=(k==null?void 0:k.validateValue(Q))??[];_(G),G.length===0&&(b(null),M(!1))},q=Q=>{if(Q===x)return!0;if(Q==="form")try{const G=JSON.parse(A);w(G),_((k==null?void 0:k.validateValue(G))??[]),b(null)}catch(G){return b(G instanceof Error?G.message:"Enter valid JSON."),!1}else E(th(S)),b(null);return T(Q),!0},F=(g==null?void 0:g.status)==="available"&&k!==null,Y=Q=>{var ee;if(!["ArrowLeft","ArrowRight","Home","End"].includes(Q.key))return;Q.preventDefault();const G=Q.key==="Home"?"form":Q.key==="End"||x==="form"?"json":"form";q(G)&&((ee=(G==="form"?u:m).current)==null||ee.focus())};return d.jsx("div",{className:"modal-backdrop run-sheet-backdrop",children:d.jsxs("div",{className:"modal run-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"run-sheet-title",ref:h,onKeyDown:Q=>{var G;if(Q.key==="Tab"){const ee=Array.from(((G=h.current)==null?void 0:G.querySelectorAll("button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a[href]"))??[]).filter(B=>B.offsetParent!==null),ne=ee[0],z=ee[ee.length-1];ne&&z&&Q.shiftKey&&document.activeElement===ne?(Q.preventDefault(),z.focus()):ne&&z&&!Q.shiftKey&&document.activeElement===z&&(Q.preventDefault(),ne.focus())}Q.key==="Enter"&&(Q.metaKey||Q.ctrlKey)&&(Q.preventDefault(),D())},children:[d.jsxs("header",{className:"run-sheet-header",children:[d.jsxs("div",{children:[d.jsx("div",{className:"run-sheet-kicker",children:t==="local"?"Local execution":"Cloud execution"}),d.jsxs("h2",{id:"run-sheet-title",children:["Run ",e.name]}),d.jsx("p",{children:"Review the agent input, then follow the execution live in Steps."})]}),d.jsx("button",{className:"theme-toggle modal-close",type:"button","aria-label":"Close run dialog",onClick:r,children:d.jsx(ue,{name:"X",size:14})})]}),d.jsxs("div",{className:"run-sheet-body",children:[d.jsxs("div",{className:"run-sheet-field-head",children:[d.jsx("h3",{id:"run-sheet-input-heading",children:"Input"}),F?d.jsxs("div",{className:"run-input-mode",role:"tablist","aria-label":"Input editor mode",children:[d.jsx("button",{ref:u,id:"run-sheet-fields-tab",type:"button",role:"tab","aria-controls":"run-sheet-input-panel","aria-selected":x==="form",tabIndex:x==="form"?0:-1,onClick:()=>q("form"),onKeyDown:Y,children:"Fields"}),d.jsx("button",{ref:m,id:"run-sheet-json-tab",type:"button",role:"tab","aria-controls":"run-sheet-input-panel","aria-selected":x==="json",tabIndex:x==="json"?0:-1,onClick:()=>q("json"),onKeyDown:Y,children:"JSON"})]}):d.jsx("span",{children:"JSON"})]}),d.jsxs("div",{id:"run-sheet-input-panel",role:F?"tabpanel":void 0,"aria-labelledby":F?x==="form"?"run-sheet-fields-tab":"run-sheet-json-tab":"run-sheet-input-heading",children:[g?d.jsxs(d.Fragment,{children:[g.status==="none"&&d.jsx("p",{className:"run-sheet-notice",children:"This agent declares no input contract. Pass an object or any JSON value it accepts."}),g.status==="unavailable"&&d.jsx("p",{className:"run-sheet-notice","data-tone":"warning",children:g.reason}),R&&d.jsxs("div",{className:"run-sheet-stale",role:"status",children:[d.jsx("span",{children:"The saved input no longer matches this agent's contract. Your values are still here so you can repair them."}),d.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>{g.status==="available"&&L(Go(g.jsonSchema))},children:"Reset to defaults"})]}),x==="form"&&g.status==="available"&&k?d.jsxs("div",{className:"run-schema-form",role:"group","aria-labelledby":"run-sheet-input-heading",children:[d.jsx(D2,{schema:g.jsonSchema,value:S,onChange:L,errors:v}),!R&&d.jsx("button",{type:"button",className:"btn-ghost run-sheet-reset",onClick:()=>L(Go(g.jsonSchema)),children:"Reset to defaults"})]}):d.jsx("textarea",{id:"run-sheet-json",ref:l,className:"run-sheet-editor",value:A,onChange:Q=>{E(Q.target.value),b(null)},rows:12,spellCheck:!1,"aria-labelledby":"run-sheet-input-heading","aria-invalid":!!(y||v.length),"aria-describedby":[y?"run-sheet-error":null,v.length>0?"run-sheet-validation":null].filter(Boolean).join(" ")||void 0})]}):d.jsx("div",{className:"run-sheet-loading",role:"status",children:"Loading input contract…"}),x==="json"&&v.length>0&&d.jsx("ul",{id:"run-sheet-validation",className:"run-sheet-validation-list",children:v.map((Q,G)=>d.jsx("li",{children:Ho(Q)},G))}),y&&d.jsx("div",{id:"run-sheet-error",className:"modal-error",role:"alert",children:y})]})]}),d.jsxs("footer",{className:"run-sheet-actions",children:[d.jsx("span",{className:"run-sheet-shortcut",children:"⌘/Ctrl + Enter"}),d.jsx("button",{className:"btn-ghost",type:"button",onClick:r,children:"Cancel"}),d.jsxs("button",{className:"btn-primary",type:"button",disabled:!g,onClick:D,"data-testid":"run-sheet-submit",children:[d.jsx(ue,{name:"Play",size:14}),"Run ",t==="local"?"locally":"in cloud"]})]})]})})}function v6({onDismiss:e,onOpenSettings:t}){return d.jsxs("div",{className:"telemetry-notice",role:"status","data-testid":"telemetry-notice",children:[d.jsx("div",{className:"telemetry-notice-body",children:d.jsxs("p",{className:"telemetry-notice-text",children:["Sharing session details with Sapiom is ",d.jsx("strong",{children:"off by default"}),". Your prompts and tool calls stay local unless you opt in to help us improve Agent Studio. Turn it on any time in"," ",d.jsx("button",{className:"telemetry-notice-settings-link",onClick:()=>{t(),e()},children:"Settings"}),", or use the indicator in the top bar."]})}),d.jsx("button",{className:"telemetry-notice-dismiss","aria-label":"Dismiss analytics notice","data-testid":"telemetry-notice-dismiss",onClick:e,children:"×"})]})}const Wo="(none)",mx={query:"",category:null,cadence:null};function _6(e){return e.query.trim()!==""||e.category!==null||e.cadence!==null}const y6={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function O2(e){return e?y6[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function L2(e,t,n){const r=new Map;for(const o of e){const c=t(o)??Wo;r.set(c,(r.get(c)??0)+1)}return[...r.entries()].map(([o,c])=>({value:o,label:n(o),count:c})).sort((o,c)=>o.value===Wo?1:c.value===Wo?-1:c.count-o.count||o.label.localeCompare(c.label))}function b6(e){return L2(e,t=>t.category,t=>t===Wo?"Uncategorised":V$(t))}function S6(e){return L2(e,t=>t.cadence,t=>t===Wo?"No trigger declared":O2(t))}function gx(e,t){return t===null?!0:t===Wo?e===null:e===t}function w6(e,t,n){return e.filter(r=>n(r,t.query)&&gx(r.category,t.category)&&gx(r.cadence,t.cadence))}function wh({children:e,variant:t="tag",title:n}){return d.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:n,children:e})}const vx=3;function x6({template:e,onPreview:t,onUse:n}){const[r,o]=O.useState(!1),c=O.useRef(null),h=[{term:"Steps",value:String(e.stepCount)},{term:"Trigger",value:e.cadence?O2(e.cadence):"Not declared"},{term:"Complexity",value:s_(e.complexity),...e.complexity?{title:G$(e.complexity)}:{title:"This catalog response carried no complexity band."}},{term:"Capabilities",value:e.capabilities.length>0?String(e.capabilities.length):"None"}];return d.jsxs(d.Fragment,{children:[d.jsx("button",{ref:c,type:"button",className:"theme-toggle template-card-info","data-testid":`template-card-info-${e.id}`,"aria-label":`What ${e.name} runs and costs`,"aria-expanded":r,onClick:()=>o(l=>!l),children:d.jsx(ue,{name:"Info",size:14})}),d.jsxs(Ei,{open:r,anchorRef:c,onDismiss:()=>o(!1),placement:"down-end",className:"template-facts",testid:"template-facts",children:[d.jsx("dl",{className:"template-fact-list",children:h.map(l=>d.jsxs("div",{className:"template-fact",children:[d.jsx("dt",{children:l.term}),d.jsx("dd",{title:l.title,children:l.value})]},l.term))}),d.jsxs("div",{className:"template-fact-actions",children:[d.jsx("button",{type:"button",className:"btn-line","data-testid":`template-facts-preview-${e.id}`,onClick:()=>{o(!1),t(e)},children:"Preview"}),d.jsx("button",{type:"button",className:"btn-primary","data-testid":`template-facts-use-${e.id}`,onClick:()=>{o(!1),n(e)},children:"Use"})]})]})]})}function _x({template:e,onOpen:t,onUse:n}){const r=e.kind==="gallery"?e.tags.slice(0,vx):[],o=e.kind==="gallery"?e.tags.length-r.length:0;return d.jsxs("article",{className:"template-card","data-testid":`template-card-${e.id}`,children:[d.jsx("button",{type:"button",className:"template-card-hitbox","data-testid":`template-card-open-${e.id}`,onClick:()=>t(e),children:d.jsxs("span",{className:"visually-hidden",children:["Open ",e.name]})}),d.jsxs("div",{className:"template-card-header",children:[d.jsx("h3",{className:"template-card-name",children:e.name}),e.kind==="gallery"&&d.jsx(x6,{template:e,onPreview:t,onUse:n})]}),d.jsx("p",{className:"template-card-desc","data-testid":"template-card-desc",children:e.description}),e.kind==="starter"?d.jsx("div",{className:"template-card-tags",children:d.jsx(wh,{children:"bundled"})}):r.length>0&&d.jsxs("div",{className:"template-card-tags",children:[r.map(c=>d.jsx(wh,{children:c},c)),o>0&&d.jsxs(wh,{variant:"count",title:e.tags.slice(vx).join(", "),children:["+",o]})]})]})}function C6({detail:e}){const t=Y$(e);return d.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(n=>{const r=t.edges.filter(o=>o.from===n.id);return d.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${n.id}`,children:[d.jsxs("div",{className:"template-graph-node",children:[d.jsx("span",{className:"canvas-step-dot dot--"+n.kind,"aria-hidden":"true"}),d.jsx("span",{className:"template-graph-name",children:n.label}),n.kind==="terminal-success"&&d.jsx("span",{className:"template-step-exit",children:"exit"}),n.kind==="terminal-warn"&&d.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),n.kind==="pause"&&d.jsx("span",{className:"template-step-pause",children:"pause"}),n.capabilities.map(o=>d.jsx("code",{className:"template-cap",children:o},o))]}),r.map(o=>d.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[d.jsx(ue,{name:"CornerDownRight",size:12}),d.jsx("span",{className:"canvas-step-transition-target",children:o.to}),o.label&&d.jsx("span",{className:"canvas-step-transition-label",children:o.label})]},`${o.from}->${o.to}`))]},n.id)})})}function E6({example:e,index:t}){return d.jsxs("details",{className:"template-example",children:[d.jsx("summary",{className:"template-example-summary",children:e.title??`Example ${t+1}`}),d.jsxs("div",{className:"template-example-body",children:[d.jsx("span",{className:"template-example-label",children:"Input"}),d.jsx("pre",{className:"template-example-json",children:JSON.stringify(e.input,null,2)}),e.output!==null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"template-example-label",children:"Output"}),d.jsx("pre",{className:"template-example-json",children:JSON.stringify(e.output,null,2)})]})]})]})}function k6({detail:e}){return d.jsxs(d.Fragment,{children:[e.whatItDoes&&d.jsx("p",{className:"template-lead",children:e.whatItDoes}),e.steps.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Steps"}),d.jsx(C6,{detail:e}),d.jsx("ol",{className:"template-steps",children:e.steps.map((t,n)=>d.jsxs("li",{className:"template-step",children:[d.jsx("span",{className:"template-step-index","aria-hidden":"true",children:n+1}),d.jsxs("span",{className:"template-step-copy",children:[d.jsxs("span",{className:"template-step-name",children:[t.name,d.jsx("span",{className:"template-step-role",children:t.sublabel})]}),t.description&&d.jsx("span",{className:"template-step-desc",children:t.description})]}),t.capabilities.map(r=>d.jsx("code",{className:"template-cap",children:r},r))]},t.name))})]}),d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Capabilities and complexity"}),e.capabilities.length>0?d.jsx("div",{className:"template-caps",children:e.capabilities.map(t=>d.jsx("code",{className:"template-cap",children:t},t))}):d.jsx("p",{className:"template-note","data-testid":"template-caps-none",children:"Declares no metered capabilities."}),d.jsx("p",{className:"template-note","data-testid":"template-complexity-note",children:e.complexity?d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:s_(e.complexity)})," —"," ",l2(e.complexity),". A rough estimate of how involved this template is, not a price. Local test runs stub every capability and are free."]}):d.jsx(d.Fragment,{children:"This catalog response carried no complexity band, so none is shown. Local test runs stub every capability and are free."})})]}),e.requiredSecrets.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Credentials you supply"}),d.jsx("ul",{className:"template-usecases",children:e.requiredSecrets.map(t=>d.jsxs("li",{children:[d.jsx("code",{className:"template-cap",children:t.key})," ",t.label,t.description&&d.jsxs(d.Fragment,{children:[" — ",t.description]})]},t.key))})]}),e.useCases.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Use cases"}),d.jsx("ul",{className:"template-usecases",children:e.useCases.map(t=>d.jsx("li",{children:t},t))})]}),e.examples.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Examples"}),e.examples.map((t,n)=>d.jsx(E6,{example:t,index:n},t.title??n))]}),e.notes&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Notes"}),d.jsx("div",{className:"template-notes",children:d.jsx(h2,{text:e.notes})})]})]})}function j6({template:e,getTemplate:t}){const[n,r]=O.useState(null),[o,c]=O.useState(null);return O.useEffect(()=>{if(e.kind!=="gallery"){r(null),c(null);return}let h=!1;return r(null),c(null),t(e.id).then(l=>{h||r(l)}).catch(l=>{h||c(l instanceof Error?l.message:String(l))}),()=>{h=!0}},[e.kind,e.id,t]),d.jsxs("div",{className:"template-detail","data-testid":"template-detail",...Dt({surface:"template_detail",object:"template"}),children:[d.jsxs("div",{className:"template-detail-head",children:[d.jsx("h3",{className:"template-detail-name",children:e.name}),d.jsx("div",{className:"template-tags",children:(e.kind==="gallery"?e.tags:["bundled"]).map(h=>d.jsx("span",{className:"template-tag",children:h},h))})]}),e.kind==="gallery"?d.jsxs(d.Fragment,{children:[(n==null?void 0:n.author)&&d.jsxs("span",{className:"template-byline",children:["By"," ",n.author.url?d.jsx("a",{href:n.author.url,target:"_blank",rel:"noopener noreferrer",children:n.author.name}):n.author.name]}),!n&&!o&&d.jsx("p",{className:"template-lead",children:e.description}),o&&d.jsxs("p",{className:"template-note","data-testid":"template-detail-error",children:["Could not load this template’s details: ",o]}),n&&d.jsx(k6,{detail:n})]}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"template-lead",children:e.description}),d.jsx("p",{className:"template-note",children:"Scaffolds an npm-install-ready TypeScript project with a starter agent in index.ts."})]}),d.jsx("p",{className:"template-handoff","data-testid":"template-handoff",children:e.kind==="gallery"?"Using it forks the template into a repo you own, then clones it here. Needs a signed-in Sapiom account; the coding agent asks you to sign in if it is missing.":"Scaffolds from the template bundled with the CLI. No Sapiom account or capability spend; setup may access npm."})]})}function yx({title:e,allLabel:t,allCount:n,options:r,value:o,onSelect:c,testIdPrefix:h}){if(r.length<2)return null;const l=[{value:"",label:t,count:n,testId:`${h}-all`,selects:null},...r.map(u=>({...u,testId:`${h}-${u.value}`,selects:u.value}))];return d.jsxs("div",{className:"facet",children:[d.jsx("span",{className:"facet-title",children:e}),d.jsx("div",{className:"facet-rows",role:"radiogroup","aria-label":e,children:l.map(u=>{const m=o===u.selects;return d.jsxs("button",{type:"button",role:"radio","aria-checked":m,className:m?"facet-row is-active":"facet-row","data-testid":u.testId,onClick:()=>c(u.selects),children:[d.jsx("span",{className:"facet-row-label",children:u.label}),d.jsx(wh,{variant:"count",children:u.count})]},u.testId)})})]})}function R6({catalog:e,filter:t,onChange:n}){return d.jsxs("div",{className:"template-filters","data-testid":"template-filters",children:[d.jsxs("div",{className:"template-search",children:[d.jsx(ue,{name:"Search",size:14}),d.jsx("input",{className:"template-search-input",type:"search",value:t.query,placeholder:"Search templates","aria-label":"Search templates","data-testid":"template-search",onChange:r=>n({...t,query:r.target.value})})]}),d.jsx(yx,{title:"Category",allLabel:"All templates",allCount:e.length,options:b6(e),value:t.category,onSelect:r=>n({...t,category:r}),testIdPrefix:"templates-category"}),d.jsx(yx,{title:"Trigger",allLabel:"Any trigger",allCount:e.length,options:S6(e),value:t.cadence,onSelect:r=>n({...t,cadence:r}),testIdPrefix:"templates-cadence"})]})}function A6(){return typeof window>"u"?void 0:window}function pr(e=A6()){const t=e==null?void 0:e.sapiomDesktop;if(!t||typeof t!="object")return null;const n=t;return typeof n.checkForUpdates!="function"?null:{appVersion:typeof n.appVersion=="string"?n.appVersion:"",checkForUpdates:n.checkForUpdates,chooseDirectory:typeof n.chooseDirectory=="function"?n.chooseDirectory:void 0,onDeepLink:typeof n.onDeepLink=="function"?n.onDeepLink:void 0,onUpdateState:typeof n.onUpdateState=="function"?n.onUpdateState:void 0,pathForFile:typeof n.pathForFile=="function"?n.pathForFile:void 0}}function I2(e){switch(e.kind){case"available":return{text:`Downloading ${e.version}…`,tone:"info"};case"downloaded":return{text:`${e.version} is ready to install.`,tone:"action"};case"up-to-date":return{text:`Up to date (${e.version}, ${e.channel}).`,tone:"info"};case"no-release":return{text:`No ${e.channel} release published yet.`,tone:"info"};case"disabled":return{text:`Updates are off: ${e.reason}.`,tone:"error"};case"failed":return{text:`Couldn't check: ${e.message}`,tone:"error"}}}function P2({value:e,onChange:t,onSubmit:n,recentDirs:r,listDir:o,onNewDirChange:c,onResolve:h}){var H;const[l,u]=O.useState(e),[m,g]=O.useState([]),[p,S]=O.useState(e),[w,A]=O.useState(!1),[E,y]=O.useState(null),[b,v]=O.useState(0),[_,k]=O.useState(!0),[C,x]=O.useState(!1),[T,R]=O.useState(0),M=O.useRef(null),[D,L]=O.useState("none"),q=()=>{const U=M.current;if(!U)return;const P=U.scrollLeft>2,W=U.scrollLeft+U.clientWidth<U.scrollWidth-2;L(P&&W?"both":P?"left":W?"right":"none")};O.useEffect(()=>{q()},[r]),O.useEffect(()=>{let U=!1;A(!0),y(null),x(!1);const P=setTimeout(()=>{o(e||void 0).then(W=>{U||(u(W.path),g(W.dirs),S(W.parent))}).catch(async()=>{const W=Pc(e);if(!W||U){U||y("Couldn't read that directory.");return}try{const se=await o(W);if(U)return;u(se.path),g(se.dirs),S(se.parent),x(!0)}catch{U||y("Couldn't read that directory.")}}).finally(()=>!U&&A(!1))},150);return()=>{U=!0,clearTimeout(P)}},[e,T]);const F=U=>U.replace(/\\/g,"/"),Y=F(e).startsWith(F(l))?e.slice(l.length).replace(/^[\\/]+/,""):"",Q=Y?m.filter(U=>U.name.toLowerCase().startsWith(Y.toLowerCase())):m,G=Math.min(b,Math.max(Q.length-1,0)),ee=!w&&!E&&Q.length===0&&(C||Y!=="");O.useEffect(()=>{c==null||c(ee)},[ee]),O.useEffect(()=>{w||E||h==null||h({resolvedPath:l,dirs:m,parent:p,isNew:ee})},[l,m,p,ee,w,E]);const ne=U=>t(U),z=((H=pr())==null?void 0:H.chooseDirectory)??null,B=()=>{if(z){z(e||l||void 0).then(U=>{U&&t(U)}).catch(()=>{});return}if(!_){k(!0);return}ee&&l&&l!==e?ne(l):k(!1)},$=U=>{var W;const P=_&&Q.length>0;U.key==="ArrowDown"&&P?(U.preventDefault(),v(Math.min(G+1,Q.length-1))):U.key==="ArrowUp"&&P?(U.preventDefault(),v(Math.max(G-1,0))):U.key==="Enter"&&(P?(ne(((W=Q[G])==null?void 0:W.path)??Q[0].path),v(0)):n())};return d.jsxs("div",{className:"dir-picker",children:[d.jsxs("div",{className:"dir-picker-inputrow",children:[d.jsx("button",{type:"button",className:"dir-picker-up","data-testid":"dir-picker-up",disabled:p===l,onClick:()=>ne(p),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:d.jsx(ue,{name:"CornerLeftUp",size:14})}),d.jsx("input",{id:"new-session-cwd",autoFocus:!0,"aria-label":"Workspace folder",className:"modal-input dir-picker-input","data-testid":"dir-picker-input",value:e,placeholder:"/path/to/workspace",onChange:U=>t(U.target.value),onKeyDown:$}),d.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(!z&&_?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":z?void 0:_,onClick:B,"aria-label":z?"Choose a folder":"Browse subdirectories","data-tooltip":z?"Choose a folder…":_?ee?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:d.jsx(ue,{name:"Folder",size:14})})]}),r.length>0&&d.jsx("div",{className:"recent-dirs",ref:M,"data-fade":D,onScroll:q,children:r.map(U=>d.jsx("button",{type:"button",className:"recent-dir-chip",title:U,onClick:()=>ne(U),children:TR(U)},U))}),_&&d.jsxs("div",{className:"dir-picker-listing","data-testid":"dir-picker-listing",children:[d.jsx("div",{className:"dir-picker-path",children:l}),w&&d.jsx("div",{className:"dir-picker-empty",children:"Loading…"}),!w&&E&&d.jsxs("div",{className:"dir-picker-error","data-testid":"dir-picker-error",role:"alert",children:[d.jsx(ue,{name:"TriangleAlert",size:14}),d.jsx("span",{children:E}),d.jsx("button",{type:"button",className:"btn-ghost dir-picker-retry","data-testid":"dir-picker-retry",onClick:()=>R(U=>U+1),children:"Retry"})]}),ee&&d.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!w&&!E&&!ee&&Q.length===0&&d.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!w&&!E&&Q.map((U,P)=>d.jsxs("button",{type:"button",className:"dir-picker-item"+(P===G?" is-selected":""),"data-testid":`dir-picker-item-${U.name}`,onMouseEnter:()=>v(P),onClick:()=>ne(U.path),...Dt({object:"directory"}),children:[d.jsx(ue,{name:"Folder",size:13}),d.jsx("span",{className:"dir-picker-item-name",children:U.name}),U.hasAgentProject&&d.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${U.name}`,title:"Contains sapiom.json",children:[d.jsx(ue,{name:"Check",size:11}),"Agent"]})]},U.path))]})]})}function T6({template:e,initialDest:t,recentDirs:n,listDir:r,onCancel:o,onConfirm:c,triggerRef:h}){const[l,u]=O.useState(t),[m,g]=O.useState(!1),[p,S]=O.useState(null),w=O.useRef(null);za(!m,{onDismiss:o,containerRef:w,triggerRef:h});const A=async()=>{const E=l.trim();if(!(!E||m)){g(!0),S(null);try{await c(E)}catch(y){S(y.message),g(!1)}}};return d.jsx("div",{className:"modal-backdrop",children:d.jsxs("div",{className:"modal modal-confirm modal-template-use",role:"dialog","aria-label":`Use ${e.name}`,...Dt({dialog:"template_use"}),"data-testid":"template-use-dialog",ref:w,children:[d.jsxs("div",{className:"modal-header",children:["Use ",e.name,d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",disabled:m,onClick:o,children:d.jsx(ue,{name:"X",size:14})})]}),d.jsxs("div",{className:"modal-body",children:[d.jsx(P2,{value:l,onChange:u,onSubmit:()=>void A(),recentDirs:n,listDir:r}),p?d.jsx("p",{className:"modal-error","data-testid":"template-use-error",children:p}):d.jsx("p",{className:"modal-field-hint",children:"A session starts here and sets the template up in it. A folder that does not exist yet is created."})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",disabled:m,onClick:o,children:"Cancel"}),d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"template-use-confirm",disabled:m||!l.trim(),onClick:()=>void A(),children:m?"Starting…":"Start session"})]})]})})}function B2({children:e,...t}){return d.jsx("div",{style:{display:"contents"},...Dt(t),children:e})}function N6({projectRoot:e,recentDirs:t,listDir:n,onExit:r,onUse:o,listTemplates:c,getTemplate:h,openTemplateId:l}){const[u,m]=O.useState(null),[g,p]=O.useState(null),[S,w]=O.useState(mx),[A,E]=O.useState(null),[y,b]=O.useState(null),v=O.useRef(null);O.useEffect(()=>{let M=!1;return c().then(D=>{M||m(D)}).catch(D=>{M||p(D instanceof Error?D.message:String(D))}),()=>{M=!0}},[]);const _=O.useMemo(()=>((u==null?void 0:u.templates)??[]).map(M=>({...M,kind:"gallery"})),[u]),k=O.useMemo(()=>w6(_,S,TS),[_,S]),C=O.useMemo(()=>S.category!==null||S.cadence!==null?[]:Yh.filter(M=>TS(M,S.query)),[S]),x=O.useRef(null);O.useEffect(()=>{if(!l||x.current===l)return;const M=_.find(D=>D.id===l)??Yh.find(D=>D.id===l);M&&(x.current=l,E(M))},[l,_]);const T=u===null&&g===null,R=g?`Could not load the template gallery: ${g}`:!u||u.source==="live"?null:u.reason==="signed-out"?"Sign in to Sapiom to browse the template gallery. The bundled starters below remain available.":"The template gallery is unreachable right now. The bundled starters below remain available.";return d.jsxs("section",{className:"templates-panel","data-testid":"templates-panel","aria-label":"Templates",children:[d.jsxs("div",{className:"templates-bar",...Dt({surface:"template_gallery"}),children:[d.jsx("button",{type:"button",className:"theme-toggle templates-back","data-testid":A?"template-detail-back":"templates-exit","aria-label":A?"Back to all templates":"Back to the session",title:A?"All templates":"Back to the session",onClick:()=>A?E(null):r(),children:d.jsx(ue,{name:"ArrowLeft",size:14})}),d.jsx("span",{className:"templates-bar-title",children:A?A.name:"Templates"}),A&&d.jsx("button",{ref:v,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>b(A),children:"Use template"})]}),d.jsx("div",{className:"templates-scroll",children:d.jsx("div",{className:"templates-measure",children:A?d.jsx(j6,{template:A,getTemplate:h}):d.jsxs(B2,{surface:"template_gallery",children:[d.jsxs("header",{className:"templates-hero",children:[d.jsx("h2",{className:"templates-hero-title",children:"Start from a template"}),d.jsx("p",{className:"templates-hero-copy",children:T?"Loading the catalog…":`${_.length} runnable agents. Open one to read what it does, then use it. A session starts in a new folder and sets it up for you.`})]}),R&&d.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[d.jsx(ue,{name:"TriangleAlert",size:14}),d.jsx("span",{children:R})]}),d.jsxs("div",{className:"templates-layout",children:[d.jsx(R6,{catalog:_,filter:S,onChange:w}),d.jsxs("div",{className:"templates-results",children:[k.length>0&&d.jsx("div",{className:"templates-grid","data-testid":"templates-grid",children:k.map(M=>d.jsx(_x,{template:M,onOpen:E,onUse:b},M.id))}),k.length===0&&!T&&_.length>0&&d.jsx(wn,{className:"templates-empty",testId:"templates-empty",icon:"Search",title:"No template matches these filters",body:`Search a tag or a capability, or clear the filters to see all ${_.length}.`,cta:_6(S)?d.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>w(mx),children:"Clear filters"}):void 0}),C.length>0&&d.jsxs("section",{className:"templates-starters","data-testid":"templates-starters",children:[d.jsx("span",{className:"facet-title",children:"Bundled starters"}),d.jsx("p",{className:"templates-starters-copy",children:"Shipped with the CLI. No Sapiom account or capability spend; setup may access npm."}),d.jsx("div",{className:"templates-grid",children:C.map(M=>d.jsx(_x,{template:M,onOpen:E,onUse:b},M.id))})]})]})]})]})})}),y&&d.jsx(T6,{template:y,initialDest:X$(y,e),recentDirs:t,listDir:n,onCancel:()=>b(null),triggerRef:v,onConfirm:async M=>{await o(M,y),r()}})]})}var pg={exports:{}},bx;function M6(){return bx||(bx=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var x,T=arguments.length,R=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(x=v[M])&&(R=(T<3?x(R):T>3?x(_,k,R):x(_,k))||R);return T>3&&R&&Object.defineProperty(_,k,R),R},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const p=u(9042),S=u(9924),w=u(844),A=u(4725),E=u(2585),y=u(3656);let b=l.AccessibilityManager=class extends w.Disposable{constructor(v,_,k,C){super(),this._terminal=v,this._coreBrowserService=k,this._renderService=C,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((x=>this._handleResize(x.rows)))),this.register(this._terminal.onRender((x=>this._refreshRows(x.start,x.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((x=>this._handleChar(x)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
489
+ `)))),this.register(this._terminal.onA11yTab((x=>this._handleTab(x)))),this.register(this._terminal.onKey((x=>this._handleKey(x.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,w.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let _=0;_<v;_++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
490
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=p.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,_){this._liveRegionDebouncer.refresh(v,_,this._terminal.rows)}_renderRows(v,_){const k=this._terminal.buffer,C=k.lines.length.toString();for(let x=v;x<=_;x++){const T=k.lines.get(k.ydisp+x),R=[],M=(T==null?void 0:T.translateToString(!0,void 0,void 0,R))||"",D=(k.ydisp+x+1).toString(),L=this._rowElements[x];L&&(M.length===0?(L.innerText=" ",this._rowColumns.set(L,[0,1])):(L.textContent=M,this._rowColumns.set(L,R)),L.setAttribute("aria-posinset",D),L.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,_){const k=v.target,C=this._rowElements[_===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==C)return;let x,T;if(_===0?(x=k,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(x=this._rowElements.shift(),T=k,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const R=this._createAccessibilityTreeNode();this._rowElements.unshift(R),this._rowContainer.insertAdjacentElement("afterbegin",R)}else{const R=this._createAccessibilityTreeNode();this._rowElements.push(R),this._rowContainer.appendChild(R)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:v.anchorNode,offset:v.anchorOffset},k={node:v.focusNode,offset:v.focusOffset};if((_.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===k.node&&_.offset>k.offset)&&([_,k]=[k,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const C=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:C,offset:((M=C.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const x=({node:D,offset:L})=>{const q=D instanceof Text?D.parentNode:D;let F=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const Y=this._rowColumns.get(q);if(!Y)return console.warn("columns is null. Race condition?"),null;let Q=L<Y.length?Y[L]:Y.slice(-1)[0]+1;return Q>=this._terminal.cols&&(++F,Q=0),{row:F,column:Q}},T=x(_),R=x(k);if(T&&R){if(T.row>R.row||T.row===R.row&&T.column>=R.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(R.row-T.row)*this._terminal.cols-T.column+R.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=m([g(1,E.IInstantiationService),g(2,A.ICoreBrowserService),g(3,A.IRenderService)],b)},3614:(h,l)=>{function u(S){return S.replace(/\r?\n/g,"\r")}function m(S,w){return w?"\x1B[200~"+S+"\x1B[201~":S}function g(S,w,A,E){S=m(S=u(S),A.decPrivateModes.bracketedPasteMode&&E.rawOptions.ignoreBracketedPasteMode!==!0),A.triggerDataEvent(S,!0),w.value=""}function p(S,w,A){const E=A.getBoundingClientRect(),y=S.clientX-E.left-10,b=S.clientY-E.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${y}px`,w.style.top=`${b}px`,w.style.zIndex="1000",w.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=u,l.bracketTextForPaste=m,l.copyHandler=function(S,w){S.clipboardData&&S.clipboardData.setData("text/plain",w.selectionText),S.preventDefault()},l.handlePasteEvent=function(S,w,A,E){S.stopPropagation(),S.clipboardData&&g(S.clipboardData.getData("text/plain"),w,A,E)},l.paste=g,l.moveTextAreaUnderMouseCursor=p,l.rightClickHandler=function(S,w,A,E,y){p(S,w,A),y&&E.rightClickSelect(S),w.value=E.selectionText,w.select()}},7239:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const m=u(1505);l.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(g,p,S){this._css.set(g,p,S)}getCss(g,p){return this._css.get(g,p)}setColor(g,p,S){this._color.set(g,p,S)}getColor(g,p){return this._color.get(g,p)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(u,m,g,p){u.addEventListener(m,g,p);let S=!1;return{dispose:()=>{S||(S=!0,u.removeEventListener(m,g,p))}}}},3551:function(h,l,u){var m=this&&this.__decorate||function(b,v,_,k){var C,x=arguments.length,T=x<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,v,_,k);else for(var R=b.length-1;R>=0;R--)(C=b[R])&&(T=(x<3?C(T):x>3?C(v,_,T):C(v,_))||T);return x>3&&T&&Object.defineProperty(v,_,T),T},g=this&&this.__param||function(b,v){return function(_,k){v(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const p=u(3656),S=u(8460),w=u(844),A=u(2585),E=u(4725);let y=l.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(b,v,_,k,C){super(),this._element=b,this._mouseService=v,this._renderService=_,this._bufferService=k,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)((()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,p.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const _=b.composedPath();for(let k=0;k<_.length;k++){const C=_[k];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,v){var k,C;this._activeProviderReplies&&v||((k=this._activeProviderReplies)==null||k.forEach((x=>{x==null||x.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let _=!1;for(const[x,T]of this._linkProviderService.linkProviders.entries())v?(C=this._activeProviderReplies)!=null&&C.get(x)&&(_=this._checkLinkProviderResult(x,b,_)):T.provideLinks(b.y,(R=>{var D,L;if(this._isMouseOut)return;const M=R==null?void 0:R.map((q=>({link:q})));(D=this._activeProviderReplies)==null||D.set(x,M),_=this._checkLinkProviderResult(x,b,_),((L=this._activeProviderReplies)==null?void 0:L.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,v){const _=new Set;for(let k=0;k<v.size;k++){const C=v.get(k);if(C)for(let x=0;x<C.length;x++){const T=C[x],R=T.link.range.start.y<b?0:T.link.range.start.x,M=T.link.range.end.y>b?this._bufferService.cols:T.link.range.end.x;for(let D=R;D<=M;D++){if(_.has(D)){C.splice(x--,1);break}_.add(D)}}}}_checkLinkProviderResult(b,v,_){var x;if(!this._activeProviderReplies)return _;const k=this._activeProviderReplies.get(b);let C=!1;for(let T=0;T<b;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(C=!0);if(!C&&k){const T=k.find((R=>this._linkAtPosition(R.link,v)));T&&(_=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let T=0;T<this._activeProviderReplies.size;T++){const R=(x=this._activeProviderReplies.get(T))==null?void 0:x.find((M=>this._linkAtPosition(M.link,v)));if(R){_=!0,this._handleNewLink(R);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,v){this._currentLink&&this._lastMouseEvent&&(!b||!v||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(b.link,v)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var _,k;return(k=(_=this._currentLink)==null?void 0:_.state)==null?void 0:k.decorations.pointerCursor},set:_=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,k;return(k=(_=this._currentLink)==null?void 0:_.state)==null?void 0:k.decorations.underline},set:_=>{var k,C,x;(k=this._currentLink)!=null&&k.state&&((x=(C=this._currentLink)==null?void 0:C.state)==null?void 0:x.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const k=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(k,C),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}}))))}_linkHover(b,v,_){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(_,v.text)}_fireUnderlineEvent(b,v){const _=b.range,k=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-k-1,_.end.x,_.end.y-k-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(b,v,_){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(_,v.text)}_linkAtPosition(b,v){const _=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,C=v.y*this._bufferService.cols+v.x;return _<=C&&C<=k}_positionFromMouseEvent(b,v,_){const k=_.getCoords(b,v,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,v,_,k,C){return{x1:b,y1:v,x2:_,y2:k,cols:this._bufferService.cols,fg:C}}};l.Linkifier=y=m([g(1,E.IMouseService),g(2,E.IRenderService),g(3,A.IBufferService),g(4,E.ILinkProviderService)],y)},9042:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,l,u){var m=this&&this.__decorate||function(E,y,b,v){var _,k=arguments.length,C=k<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,y,b,v);else for(var x=E.length-1;x>=0;x--)(_=E[x])&&(C=(k<3?_(C):k>3?_(y,b,C):_(y,b))||C);return k>3&&C&&Object.defineProperty(y,b,C),C},g=this&&this.__param||function(E,y){return function(b,v){y(b,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const p=u(511),S=u(2585);let w=l.OscLinkProvider=class{constructor(E,y,b){this._bufferService=E,this._optionsService=y,this._oscLinkService=b}provideLinks(E,y){var M;const b=this._bufferService.buffer.lines.get(E-1);if(!b)return void y(void 0);const v=[],_=this._optionsService.rawOptions.linkHandler,k=new p.CellData,C=b.getTrimmedLength();let x=-1,T=-1,R=!1;for(let D=0;D<C;D++)if(T!==-1||b.hasContent(D)){if(b.loadCell(D,k),k.hasExtendedAttrs()&&k.extended.urlId){if(T===-1){T=D,x=k.extended.urlId;continue}R=k.extended.urlId!==x}else T!==-1&&(R=!0);if(R||T!==-1&&D===C-1){const L=(M=this._oscLinkService.getLinkData(x))==null?void 0:M.uri;if(L){const q={start:{x:T+1,y:E},end:{x:D+(R||D!==C-1?0:1),y:E}};let F=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const Y=new URL(L);["http:","https:"].includes(Y.protocol)||(F=!0)}catch{F=!0}F||v.push({text:L,range:q,activate:(Y,Q)=>_?_.activate(Y,Q,q):A(0,Q),hover:(Y,Q)=>{var G;return(G=_==null?void 0:_.hover)==null?void 0:G.call(_,Y,Q,q)},leave:(Y,Q)=>{var G;return(G=_==null?void 0:_.leave)==null?void 0:G.call(_,Y,Q,q)}})}R=!1,k.hasExtendedAttrs()&&k.extended.urlId?(T=D,x=k.extended.urlId):(T=-1,x=-1)}}y(v)}};function A(E,y){if(confirm(`Do you want to navigate to ${y}?
491
+
492
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=w=m([g(0,S.IBufferService),g(1,S.IOptionsService),g(2,S.IOscLinkService)],w)},6193:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(u,m){this._renderCallback=u,this._coreBrowserService=m,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,m,g){this._rowCount=g,u=u!==void 0?u:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const u=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,m),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const m=u(3614),g=u(3656),p=u(3551),S=u(9042),w=u(3730),A=u(1680),E=u(3107),y=u(5744),b=u(2950),v=u(1296),_=u(428),k=u(4269),C=u(5114),x=u(8934),T=u(3230),R=u(9312),M=u(4725),D=u(6731),L=u(8055),q=u(8969),F=u(8460),Y=u(844),Q=u(6114),G=u(8437),ee=u(2584),ne=u(7399),z=u(5941),B=u(9074),$=u(2585),H=u(5435),U=u(4567),P=u(779);class W extends q.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(X={}){super(X),this.browser=Q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService($.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,ce)=>this.refresh(V,ce)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,Y.toDisposable)((()=>{var V,ce;this._customKeyEventHandler=void 0,(ce=(V=this.element)==null?void 0:V.parentNode)==null||ce.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const V of X){let ce,oe="";switch(V.index){case 256:ce="foreground",oe="10";break;case 257:ce="background",oe="11";break;case 258:ce="cursor",oe="12";break;default:ce="ansi",oe="4;"+V.index}switch(V.type){case 0:const Z=L.color.toColorRGB(ce==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[ce]);this.coreService.triggerDataEvent(`${ee.C0.ESC}]${oe};${(0,z.toRgbString)(Z)}${ee.C1_ESCAPED.ST}`);break;case 1:if(ce==="ansi")this._themeService.modifyColors((te=>te.ansi[V.index]=L.channels.toColor(...V.color)));else{const te=ce;this._themeService.modifyColors((pe=>pe[te]=L.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ee.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ee.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(X);if(!V)return;const ce=Math.min(this.buffer.x,this.cols-1),oe=this._renderService.dimensions.css.cell.height,Z=V.getWidth(ce),te=this._renderService.dimensions.css.cell.width*Z,pe=this.buffer.y*this._renderService.dimensions.css.cell.height,ye=ce*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ye+"px",this.textarea.style.top=pe+"px",this.textarea.style.width=te+"px",this.textarea.style.height=oe+"px",this.textarea.style.lineHeight=oe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,m.copyHandler)(V,this._selectionService)})));const X=V=>(0,m.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),Q.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,m.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,m.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),Q.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,m.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ce;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ce=this.element)==null?void 0:ce.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",(oe=>this.updateCursorStyle(oe)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),Q.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(C.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(oe=>this._handleTextAreaFocus(oe)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((oe=>this._onRender.fire(oe)))),this.onResize((oe=>this._renderService.resize(oe.cols,oe.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(p.Linkifier,this.screenElement)),this.element.appendChild(V);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(A.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(R.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((oe=>this._renderService.handleSelectionChanged(oe.start,oe.end,oe.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((oe=>{this.textarea.value=oe,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((oe=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(E.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(oe=>this._selectionService.handleMouseDown(oe)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(oe=>this._handleScreenReaderModeOptionChange(oe)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(oe=>{!this._overviewRulerRenderer&&oe&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,V=this.element;function ce(te){const pe=X._mouseService.getMouseReportCoords(te,X.screenElement);if(!pe)return!1;let ye,Ee;switch(te.overrideType||te.type){case"mousemove":Ee=32,te.buttons===void 0?(ye=3,te.button!==void 0&&(ye=te.button<3?te.button:3)):ye=1&te.buttons?0:4&te.buttons?1:2&te.buttons?2:3;break;case"mouseup":Ee=0,ye=te.button<3?te.button:3;break;case"mousedown":Ee=1,ye=te.button<3?te.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(te)===!1||X.viewport.getLinesScrolled(te)===0)return!1;Ee=te.deltaY<0?0:1,ye=4;break;default:return!1}return!(Ee===void 0||ye===void 0||ye>4)&&X.coreMouseService.triggerMouseEvent({col:pe.col,row:pe.row,x:pe.x,y:pe.y,button:ye,action:Ee,ctrl:te.ctrlKey,alt:te.altKey,shift:te.shiftKey})}const oe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:te=>(ce(te),te.buttons||(this._document.removeEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.removeEventListener("mousemove",oe.mousedrag)),this.cancel(te)),wheel:te=>(ce(te),this.cancel(te,!0)),mousedrag:te=>{te.buttons&&ce(te)},mousemove:te=>{te.buttons||ce(te)}};this.register(this.coreMouseService.onProtocolChange((te=>{te?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(te)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&te?oe.mousemove||(V.addEventListener("mousemove",Z.mousemove),oe.mousemove=Z.mousemove):(V.removeEventListener("mousemove",oe.mousemove),oe.mousemove=null),16&te?oe.wheel||(V.addEventListener("wheel",Z.wheel,{passive:!1}),oe.wheel=Z.wheel):(V.removeEventListener("wheel",oe.wheel),oe.wheel=null),2&te?oe.mouseup||(oe.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",oe.mouseup),oe.mouseup=null),4&te?oe.mousedrag||(oe.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",oe.mousedrag),oe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(V,"mousedown",(te=>{if(te.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(te))return ce(te),oe.mouseup&&this._document.addEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.addEventListener("mousemove",oe.mousedrag),this.cancel(te)}))),this.register((0,g.addDisposableDomListener)(V,"wheel",(te=>{if(!oe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(te)===!1)return!1;if(!this.buffer.hasScrollback){const pe=this.viewport.getLinesScrolled(te);if(pe===0)return;const ye=ee.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(te.deltaY<0?"A":"B");let Ee="";for(let Ie=0;Ie<Math.abs(pe);Ie++)Ee+=ye;return this.coreService.triggerDataEvent(Ee,!0),this.cancel(te,!0)}return this.viewport.handleWheel(te)?this.cancel(te):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(V,"touchstart",(te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(te),this.cancel(te)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(V,"touchmove",(te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(te)?void 0:this.cancel(te)}),{passive:!1}))}refresh(X,V){var ce;(ce=this._renderService)==null||ce.refreshRows(X,V)}updateCursorStyle(X){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,V,ce=0){var oe;ce===1?(super.scrollLines(X,V,ce),this.refresh(0,this.rows-1)):(oe=this.viewport)==null||oe.scrollLines(X)}paste(X){(0,m.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,V,ce){this._selectionService.setSelection(X,V,ce)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,V){var ce;(ce=this._selectionService)==null||ce.selectLines(X,V)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!V&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ce=(0,ne.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ce.type===3||ce.type===2){const oe=this.rows-1;return this.scrollLines(ce.type===2?-oe:oe),this.cancel(X,!0)}return ce.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ce.cancel&&this.cancel(X,!0),!ce.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ce.key!==ee.C0.ETX&&ce.key!==ee.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ce.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ce.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,V){const ce=X.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||X.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||X.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?ce:ce&&(!V.keyCode||V.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)V=X.charCode;else if(X.which===null||X.which===void 0)V=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;V=X.which}return!(!V||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=X.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(X),!0}return!1}resize(X,V){X!==this.cols||V!==this.rows?super.resize(X,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,V){var ce,oe;(ce=this._charSizeService)==null||ce.measure(),(oe=this.viewport)==null||oe.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let V=1;V<this.rows;V++)this.buffer.lines.push(this.buffer.getBlankLine(G.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var V,ce;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(V=this._selectionService)==null||V.reset(),this._decorationService.reset(),(ce=this.viewport)==null||ce.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(ee.C0.ESC+"[I"):this.coreService.triggerDataEvent(ee.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const V=this._renderService.dimensions.css.canvas.width.toFixed(0),ce=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ee.C0.ESC}[4;${ce};${V}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const oe=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ee.C0.ESC}[6;${Z};${oe}t`)}}cancel(X,V){if(this.options.cancelEvents||V)return X.preventDefault(),X.stopPropagation(),!1}}l.Terminal=W},9924:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(u,m=1e3){this._renderCallback=u,this._debounceThresholdMS=m,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,m,g){this._rowCount=g,u=u!==void 0?u:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m;const p=Date.now();if(p-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=p,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=p-this._lastRefreshMs,w=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,m)}}},1680:function(h,l,u){var m=this&&this.__decorate||function(b,v,_,k){var C,x=arguments.length,T=x<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,v,_,k);else for(var R=b.length-1;R>=0;R--)(C=b[R])&&(T=(x<3?C(T):x>3?C(v,_,T):C(v,_))||T);return x>3&&T&&Object.defineProperty(v,_,T),T},g=this&&this.__param||function(b,v){return function(_,k){v(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const p=u(3656),S=u(4725),w=u(8460),A=u(844),E=u(2585);let y=l.Viewport=class extends A.Disposable{constructor(b,v,_,k,C,x,T,R){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=_,this._optionsService=k,this._charSizeService=C,this._renderService=x,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(R.colors),this.register(R.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,v){const _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&_<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){var R;let _,k="";const C=[],x=v??this._bufferService.buffer.lines.length,T=this._bufferService.buffer.lines;for(let M=b;M<x;M++){const D=T.get(M);if(!D)continue;const L=(R=T.get(M+1))==null?void 0:R.isWrapped;if(k+=D.translateToString(!L),!L||M===T.length-1){const q=document.createElement("div");q.textContent=k,C.push(q),k.length>0&&(_=q),k=""}}return{bufferElements:C,cursorElement:_}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&v.altKey||_==="ctrl"&&v.ctrlKey||_==="shift"&&v.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};l.Viewport=y=m([g(2,E.IBufferService),g(3,E.IOptionsService),g(4,S.ICharSizeService),g(5,S.IRenderService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],y)},3107:function(h,l,u){var m=this&&this.__decorate||function(E,y,b,v){var _,k=arguments.length,C=k<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,y,b,v);else for(var x=E.length-1;x>=0;x--)(_=E[x])&&(C=(k<3?_(C):k>3?_(y,b,C):_(y,b))||C);return k>3&&C&&Object.defineProperty(y,b,C),C},g=this&&this.__param||function(E,y){return function(b,v){y(b,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const p=u(4725),S=u(844),w=u(2585);let A=l.BufferDecorationRenderer=class extends S.Disposable{constructor(E,y,b,v,_){super(),this._screenElement=E,this._bufferService=y,this._coreBrowserService=b,this._decorationService=v,this._renderService=_,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((k=>this._removeDecoration(k)))),this.register((0,S.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const E of this._decorationService.decorations)this._renderDecoration(E);this._dimensionsChanged=!1}_renderDecoration(E){this._refreshStyle(E),this._dimensionsChanged&&this._refreshXPosition(E)}_createElement(E){var v;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((v=E==null?void 0:E.options)==null?void 0:v.layer)==="top"),y.style.width=`${Math.round((E.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(E.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(E.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=E.options.x??0;return b&&b>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(E,y),y}_refreshStyle(E){const y=E.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)E.element&&(E.element.style.display="none",E.onRenderEmitter.fire(E.element));else{let b=this._decorationElements.get(E);b||(b=this._createElement(E),E.element=b,this._decorationElements.set(E,b),this._container.appendChild(b),E.onDispose((()=>{this._decorationElements.delete(E),b.remove()}))),b.style.top=y*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",E.onRenderEmitter.fire(b)}}_refreshXPosition(E,y=E.element){if(!y)return;const b=E.options.x??0;(E.options.anchor||"left")==="right"?y.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(E){var y;(y=this._decorationElements.get(E))==null||y.remove(),this._decorationElements.delete(E),E.dispose()}};l.BufferDecorationRenderer=A=m([g(1,w.IBufferService),g(2,p.ICoreBrowserService),g(3,w.IDecorationService),g(4,p.IRenderService)],A)},5871:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(u){if(u.options.overviewRulerOptions){for(const m of this._zones)if(m.color===u.options.overviewRulerOptions.color&&m.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(m,u.marker.line))return;if(this._lineAdjacentToZone(m,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(m,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,m){return m>=u.startBufferLine&&m<=u.endBufferLine}_lineAdjacentToZone(u,m,g){return m>=u.startBufferLine-this._linePadding[g||"full"]&&m<=u.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(u,m){u.startBufferLine=Math.min(u.startBufferLine,m),u.endBufferLine=Math.max(u.endBufferLine,m)}}},5744:function(h,l,u){var m=this&&this.__decorate||function(_,k,C,x){var T,R=arguments.length,M=R<3?k:x===null?x=Object.getOwnPropertyDescriptor(k,C):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,C,x);else for(var D=_.length-1;D>=0;D--)(T=_[D])&&(M=(R<3?T(M):R>3?T(k,C,M):T(k,C))||M);return R>3&&M&&Object.defineProperty(k,C,M),M},g=this&&this.__param||function(_,k){return function(C,x){k(C,x,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const p=u(5871),S=u(4725),w=u(844),A=u(2585),E={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let v=l.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,k,C,x,T,R,M){var L;super(),this._viewportElement=_,this._screenElement=k,this._bufferService=C,this._decorationService=x,this._renderService=T,this._optionsService=R,this._coreBrowserService=M,this._colorZoneStore=new p.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(L=this._viewportElement.parentElement)==null||L.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)((()=>{var q;(q=this._canvas)==null||q.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const _=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=_,y.center=k,y.right=_,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=y.left,b.right=y.left+y.center}_refreshDrawHeightConstants(){E.full=Math.round(2*this._coreBrowserService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(_,12),6)*this._coreBrowserService.dpr);E.left=k,E.center=k,E.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const _=this._colorZoneStore.zones;for(const k of _)k.position!=="full"&&this._renderColorZone(k);for(const k of _)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(b[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-E[_.position||"full"]/2),y[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+E[_.position||"full"]))}_queueRefresh(_,k){this._shouldUpdateDimensions=_||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=v=m([g(2,A.IBufferService),g(3,A.IDecorationService),g(4,S.IRenderService),g(5,A.IOptionsService),g(6,S.ICoreBrowserService)],v)},2950:function(h,l,u){var m=this&&this.__decorate||function(E,y,b,v){var _,k=arguments.length,C=k<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,y,b,v);else for(var x=E.length-1;x>=0;x--)(_=E[x])&&(C=(k<3?_(C):k>3?_(y,b,C):_(y,b))||C);return k>3&&C&&Object.defineProperty(y,b,C),C},g=this&&this.__param||function(E,y){return function(b,v){y(b,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const p=u(4725),S=u(2585),w=u(2584);let A=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(E,y,b,v,_,k){this._textarea=E,this._compositionView=y,this._bufferService=b,this._optionsService=v,this._coreService=_,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(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===229||E.keyCode===16||E.keyCode===17||E.keyCode===18)return!1;this._finalizeComposition(!1)}return E.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(E){if(this._compositionView.classList.remove("active"),this._isComposing=!1,E){const y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const E=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,b=y.replace(E,"");this._dataAlreadySent=b,y.length>E.length?this._coreService.triggerDataEvent(b,!0):y.length<E.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):y.length===E.length&&y!==E&&this._coreService.triggerDataEvent(y,!0)}}),0)}updateCompositionElements(E){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const y=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,_=y*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=_+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}E||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=A=m([g(2,S.IBufferService),g(3,S.IOptionsService),g(4,S.ICoreService),g(5,p.IRenderService)],A)},9806:(h,l)=>{function u(m,g,p){const S=p.getBoundingClientRect(),w=m.getComputedStyle(p),A=parseInt(w.getPropertyValue("padding-left")),E=parseInt(w.getPropertyValue("padding-top"));return[g.clientX-S.left-A,g.clientY-S.top-E]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=u,l.getCoords=function(m,g,p,S,w,A,E,y,b){if(!A)return;const v=u(m,g,p);return v?(v[0]=Math.ceil((v[0]+(b?E/2:0))/E),v[1]=Math.ceil(v[1]/y),v[0]=Math.min(Math.max(v[0],1),S+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),w),v):void 0}},9504:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const m=u(2584);function g(y,b,v,_){const k=y-p(y,v),C=b-p(b,v),x=Math.abs(k-C)-(function(T,R,M){let D=0;const L=T-p(T,M),q=R-p(R,M);for(let F=0;F<Math.abs(L-q);F++){const Y=S(T,R)==="A"?-1:1,Q=M.buffer.lines.get(L+Y*F);Q!=null&&Q.isWrapped&&D++}return D})(y,b,v);return E(x,A(S(y,b),_))}function p(y,b){let v=0,_=b.buffer.lines.get(y),k=_==null?void 0:_.isWrapped;for(;k&&y>=0&&y<b.rows;)v++,_=b.buffer.lines.get(--y),k=_==null?void 0:_.isWrapped;return v}function S(y,b){return y>b?"A":"B"}function w(y,b,v,_,k,C){let x=y,T=b,R="";for(;x!==v||T!==_;)x+=k?1:-1,k&&x>C.cols-1?(R+=C.buffer.translateBufferLineToString(T,!1,y,x),x=0,y=0,T++):!k&&x<0&&(R+=C.buffer.translateBufferLineToString(T,!1,0,y+1),x=C.cols-1,y=x,T--);return R+C.buffer.translateBufferLineToString(T,!1,y,x)}function A(y,b){const v=b?"O":"[";return m.C0.ESC+v+y}function E(y,b){y=Math.floor(y);let v="";for(let _=0;_<y;_++)v+=b;return v}l.moveToCellSequence=function(y,b,v,_){const k=v.buffer.x,C=v.buffer.y;if(!v.buffer.hasScrollback)return(function(R,M,D,L,q,F){return g(M,L,q,F).length===0?"":E(w(R,M,R,M-p(M,q),!1,q).length,A("D",F))})(k,C,0,b,v,_)+g(C,b,v,_)+(function(R,M,D,L,q,F){let Y;Y=g(M,L,q,F).length>0?L-p(L,q):M;const Q=L,G=(function(ee,ne,z,B,$,H){let U;return U=g(z,B,$,H).length>0?B-p(B,$):ne,ee<z&&U<=B||ee>=z&&U<B?"C":"D"})(R,M,D,L,q,F);return E(w(R,Y,D,Q,G==="C",q).length,A(G,F))})(k,C,y,b,v,_);let x;if(C===b)return x=k>y?"D":"C",E(Math.abs(k-y),A(x,_));x=C>b?"D":"C";const T=Math.abs(C-b);return E((function(R,M){return M.cols-R})(C>b?y:k,v)+(T-1)*v.cols+1+((C>b?k:y)-1),A(x,_))}},1296:function(h,l,u){var m=this&&this.__decorate||function(F,Y,Q,G){var ee,ne=arguments.length,z=ne<3?Y:G===null?G=Object.getOwnPropertyDescriptor(Y,Q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(F,Y,Q,G);else for(var B=F.length-1;B>=0;B--)(ee=F[B])&&(z=(ne<3?ee(z):ne>3?ee(Y,Q,z):ee(Y,Q))||z);return ne>3&&z&&Object.defineProperty(Y,Q,z),z},g=this&&this.__param||function(F,Y){return function(Q,G){Y(Q,G,F)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const p=u(3787),S=u(2550),w=u(2223),A=u(6171),E=u(6052),y=u(4725),b=u(8055),v=u(8460),_=u(844),k=u(2585),C="xterm-dom-renderer-owner-",x="xterm-rows",T="xterm-fg-",R="xterm-bg-",M="xterm-focus",D="xterm-selection";let L=1,q=l.DomRenderer=class extends _.Disposable{constructor(F,Y,Q,G,ee,ne,z,B,$,H,U,P,W){super(),this._terminal=F,this._document=Y,this._element=Q,this._screenElement=G,this._viewportElement=ee,this._helperContainer=ne,this._linkifier2=z,this._charSizeService=$,this._optionsService=H,this._bufferService=U,this._coreBrowserService=P,this._themeService=W,this._terminalClass=L++,this._rowElements=[],this._selectionRenderModel=(0,E.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),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(D),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,A.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((se=>this._injectCss(se)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(p.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((se=>this._handleLinkHover(se)))),this.register(this._linkifier2.onHideLinkUnderline((se=>this._handleLinkLeave(se)))),this.register((0,_.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),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/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const Q of this._rowElements)Q.style.width=`${this.dimensions.css.canvas.width}px`,Q.style.height=`${this.dimensions.css.cell.height}px`,Q.style.lineHeight=`${this.dimensions.css.cell.height}px`,Q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${x} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${x} .xterm-dim { color: ${b.color.multiplyOpacity(F.foreground,.5).css};}`,Y+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const Q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,ee=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${Q} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${G} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${ee} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,Y+=`${this._terminalSelector} .${x}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${x}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${x}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${ee} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[ne,z]of F.ansi.entries())Y+=`${this._terminalSelector} .${T}${ne} { color: ${z.css}; }${this._terminalSelector} .${T}${ne}.xterm-dim { color: ${b.color.multiplyOpacity(z,.5).css}; }${this._terminalSelector} .${R}${ne} { background-color: ${z.css}; }`;Y+=`${this._terminalSelector} .${T}${w.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(F.background).css}; }${this._terminalSelector} .${T}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${R}${w.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,Y){for(let Q=this._rowElements.length;Q<=Y;Q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,Y){this._refreshRowElements(F,Y),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,Y,Q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,Y,Q),this.renderRows(0,this._bufferService.rows-1),!F||!Y)return;this._selectionRenderModel.update(this._terminal,F,Y,Q);const G=this._selectionRenderModel.viewportStartRow,ee=this._selectionRenderModel.viewportEndRow,ne=this._selectionRenderModel.viewportCappedStartRow,z=this._selectionRenderModel.viewportCappedEndRow;if(ne>=this._bufferService.rows||z<0)return;const B=this._document.createDocumentFragment();if(Q){const $=F[0]>Y[0];B.appendChild(this._createSelectionElement(ne,$?Y[0]:F[0],$?F[0]:Y[0],z-ne+1))}else{const $=G===ne?F[0]:0,H=ne===ee?Y[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(ne,$,H));const U=z-ne-1;if(B.appendChild(this._createSelectionElement(ne+1,0,this._bufferService.cols,U)),ne!==z){const P=ee===z?Y[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(z,0,P))}}this._selectionContainer.appendChild(B)}_createSelectionElement(F,Y,Q,G=1){const ee=this._document.createElement("div"),ne=Y*this.dimensions.css.cell.width;let z=this.dimensions.css.cell.width*(Q-Y);return ne+z>this.dimensions.css.canvas.width&&(z=this.dimensions.css.canvas.width-ne),ee.style.height=G*this.dimensions.css.cell.height+"px",ee.style.top=F*this.dimensions.css.cell.height+"px",ee.style.left=`${ne}px`,ee.style.width=`${z}px`,ee}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const F of this._rowElements)F.replaceChildren()}renderRows(F,Y){const Q=this._bufferService.buffer,G=Q.ybase+Q.y,ee=Math.min(Q.x,this._bufferService.cols-1),ne=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=F;$<=Y;$++){const H=$+Q.ydisp,U=this._rowElements[$],P=Q.lines.get(H);if(!U||!P)break;U.replaceChildren(...this._rowFactory.createRow(P,H,H===G,z,B,ee,ne,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,Y,Q,G,ee,ne){Q<0&&(F=0),G<0&&(Y=0);const z=this._bufferService.rows-1;Q=Math.max(Math.min(Q,z),0),G=Math.max(Math.min(G,z),0),ee=Math.min(ee,this._bufferService.cols);const B=this._bufferService.buffer,$=B.ybase+B.y,H=Math.min(B.x,ee-1),U=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,W=this._optionsService.rawOptions.cursorInactiveStyle;for(let se=Q;se<=G;++se){const X=se+B.ydisp,V=this._rowElements[se],ce=B.lines.get(X);if(!V||!ce)break;V.replaceChildren(...this._rowFactory.createRow(ce,X,X===$,P,W,H,U,this.dimensions.css.cell.width,this._widthCache,ne?se===Q?F:0:-1,ne?(se===G?Y:ee)-1:-1))}}};l.DomRenderer=q=m([g(7,k.IInstantiationService),g(8,y.ICharSizeService),g(9,k.IOptionsService),g(10,k.IBufferService),g(11,y.ICoreBrowserService),g(12,y.IThemeService)],q)},3787:function(h,l,u){var m=this&&this.__decorate||function(x,T,R,M){var D,L=arguments.length,q=L<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,R):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(x,T,R,M);else for(var F=x.length-1;F>=0;F--)(D=x[F])&&(q=(L<3?D(q):L>3?D(T,R,q):D(T,R))||q);return L>3&&q&&Object.defineProperty(T,R,q),q},g=this&&this.__param||function(x,T){return function(R,M){T(R,M,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const p=u(2223),S=u(643),w=u(511),A=u(2585),E=u(8055),y=u(4725),b=u(4269),v=u(6171),_=u(3734);let k=l.DomRendererRowFactory=class{constructor(x,T,R,M,D,L,q){this._document=x,this._characterJoinerService=T,this._optionsService=R,this._coreBrowserService=M,this._coreService=D,this._decorationService=L,this._themeService=q,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,T,R){this._selectionStart=x,this._selectionEnd=T,this._columnSelectMode=R}createRow(x,T,R,M,D,L,q,F,Y,Q,G){const ee=[],ne=this._characterJoinerService.getJoinedCharacters(T),z=this._themeService.colors;let B,$=x.getNoBgTrimmedLength();R&&$<L+1&&($=L+1);let H=0,U="",P=0,W=0,se=0,X=!1,V=0,ce=!1,oe=0;const Z=[],te=Q!==-1&&G!==-1;for(let pe=0;pe<$;pe++){x.loadCell(pe,this._workCell);let ye=this._workCell.getWidth();if(ye===0)continue;let Ee=!1,Ie=pe,Pe=this._workCell;if(ne.length>0&&pe===ne[0][0]){Ee=!0;const _t=ne.shift();Pe=new b.JoinedCellData(this._workCell,x.translateToString(!0,_t[0],_t[1]),_t[1]-_t[0]),Ie=_t[1]-1,ye=Pe.getWidth()}const Fe=this._isCellInSelection(pe,T),je=R&&pe===L,Ue=te&&pe>=Q&&pe<=G;let Ye=!1;this._decorationService.forEachDecorationAtCell(pe,T,void 0,(_t=>{Ye=!0}));let jt=Pe.getChars()||S.WHITESPACE_CELL_CHAR;if(jt===" "&&(Pe.isUnderline()||Pe.isOverline())&&(jt=" "),oe=ye*F-Y.get(jt,Pe.isBold(),Pe.isItalic()),B){if(H&&(Fe&&ce||!Fe&&!ce&&Pe.bg===P)&&(Fe&&ce&&z.selectionForeground||Pe.fg===W)&&Pe.extended.ext===se&&Ue===X&&oe===V&&!je&&!Ee&&!Ye){Pe.isInvisible()?U+=S.WHITESPACE_CELL_CHAR:U+=jt,H++;continue}H&&(B.textContent=U),B=this._document.createElement("span"),H=0,U=""}else B=this._document.createElement("span");if(P=Pe.bg,W=Pe.fg,se=Pe.extended.ext,X=Ue,V=oe,ce=Fe,Ee&&L>=pe&&L<=Ie&&(L=pe),!this._coreService.isCursorHidden&&je&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&Z.push("xterm-cursor-blink"),Z.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(Pe.isBold()&&Z.push("xterm-bold"),Pe.isItalic()&&Z.push("xterm-italic"),Pe.isDim()&&Z.push("xterm-dim"),U=Pe.isInvisible()?S.WHITESPACE_CELL_CHAR:Pe.getChars()||S.WHITESPACE_CELL_CHAR,Pe.isUnderline()&&(Z.push(`xterm-underline-${Pe.extended.underlineStyle}`),U===" "&&(U=" "),!Pe.isUnderlineColorDefault()))if(Pe.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(Pe.getUnderlineColor()).join(",")})`;else{let _t=Pe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Pe.isBold()&&_t<8&&(_t+=8),B.style.textDecorationColor=z.ansi[_t].css}Pe.isOverline()&&(Z.push("xterm-overline"),U===" "&&(U=" ")),Pe.isStrikethrough()&&Z.push("xterm-strikethrough"),Ue&&(B.style.textDecoration="underline");let rt=Pe.getFgColor(),Ct=Pe.getFgColorMode(),dt=Pe.getBgColor(),Lt=Pe.getBgColorMode();const mt=!!Pe.isInverse();if(mt){const _t=rt;rt=dt,dt=_t;const $s=Ct;Ct=Lt,Lt=$s}let Ut,Ss,Yt,ms=!1;switch(this._decorationService.forEachDecorationAtCell(pe,T,void 0,(_t=>{_t.options.layer!=="top"&&ms||(_t.backgroundColorRGB&&(Lt=50331648,dt=_t.backgroundColorRGB.rgba>>8&16777215,Ut=_t.backgroundColorRGB),_t.foregroundColorRGB&&(Ct=50331648,rt=_t.foregroundColorRGB.rgba>>8&16777215,Ss=_t.foregroundColorRGB),ms=_t.options.layer==="top")})),!ms&&Fe&&(Ut=this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque,dt=Ut.rgba>>8&16777215,Lt=50331648,ms=!0,z.selectionForeground&&(Ct=50331648,rt=z.selectionForeground.rgba>>8&16777215,Ss=z.selectionForeground)),ms&&Z.push("xterm-decoration-top"),Lt){case 16777216:case 33554432:Yt=z.ansi[dt],Z.push(`xterm-bg-${dt}`);break;case 50331648:Yt=E.channels.toColor(dt>>16,dt>>8&255,255&dt),this._addStyle(B,`background-color:#${C((dt>>>0).toString(16),"0",6)}`);break;default:mt?(Yt=z.foreground,Z.push(`xterm-bg-${p.INVERTED_DEFAULT_COLOR}`)):Yt=z.background}switch(Ut||Pe.isDim()&&(Ut=E.color.multiplyOpacity(Yt,.5)),Ct){case 16777216:case 33554432:Pe.isBold()&&rt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(rt+=8),this._applyMinimumContrast(B,Yt,z.ansi[rt],Pe,Ut,void 0)||Z.push(`xterm-fg-${rt}`);break;case 50331648:const _t=E.channels.toColor(rt>>16&255,rt>>8&255,255&rt);this._applyMinimumContrast(B,Yt,_t,Pe,Ut,Ss)||this._addStyle(B,`color:#${C(rt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,Yt,z.foreground,Pe,Ut,Ss)||mt&&Z.push(`xterm-fg-${p.INVERTED_DEFAULT_COLOR}`)}Z.length&&(B.className=Z.join(" "),Z.length=0),je||Ee||Ye?B.textContent=U:H++,oe!==this.defaultSpacing&&(B.style.letterSpacing=`${oe}px`),ee.push(B),pe=Ie}return B&&H&&(B.textContent=U),ee}_applyMinimumContrast(x,T,R,M,D,L){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const q=this._getContrastCache(M);let F;if(D||L||(F=q.getColor(T.rgba,R.rgba)),F===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);F=E.color.ensureContrastRatio(D||T,L||R,Y),q.setColor((D||T).rgba,(L||R).rgba,F??null)}return!!F&&(this._addStyle(x,`color:${F.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,T){x.setAttribute("style",`${x.getAttribute("style")||""}${T};`)}_isCellInSelection(x,T){const R=this._selectionStart,M=this._selectionEnd;return!(!R||!M)&&(this._columnSelectMode?R[0]<=M[0]?x>=R[0]&&T>=R[1]&&x<M[0]&&T<=M[1]:x<R[0]&&T>=R[1]&&x>=M[0]&&T<=M[1]:T>R[1]&&T<M[1]||R[1]===M[1]&&T===R[1]&&x>=R[0]&&x<M[0]||R[1]<M[1]&&T===M[1]&&x<M[0]||R[1]<M[1]&&T===R[1]&&x>=R[0])}};function C(x,T,R){for(;x.length<R;)x=T+x;return x}l.DomRendererRowFactory=k=m([g(1,y.ICharacterJoinerService),g(2,A.IOptionsService),g(3,y.ICoreBrowserService),g(4,A.ICoreService),g(5,A.IDecorationService),g(6,y.IThemeService)],k)},2550:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(u,m){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=u.createElement("span");g.classList.add("xterm-char-measure-element");const p=u.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold";const S=u.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const w=u.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[g,p,S,w],this._container.appendChild(g),this._container.appendChild(p),this._container.appendChild(S),this._container.appendChild(w),m.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(u,m,g,p){u===this._font&&m===this._fontSize&&g===this._weight&&p===this._weightBold||(this._font=u,this._fontSize=m,this._weight=g,this._weightBold=p,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${p}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${p}`,this.clear())}get(u,m,g){let p=0;if(!m&&!g&&u.length===1&&(p=u.charCodeAt(0))<256){if(this._flat[p]!==-9999)return this._flat[p];const A=this._measure(u,0);return A>0&&(this._flat[p]=A),A}let S=u;m&&(S+="B"),g&&(S+="I");let w=this._holey.get(S);if(w===void 0){let A=0;m&&(A|=1),g&&(A|=2),w=this._measure(u,A),w>0&&this._holey.set(S,w)}return w}_measure(u,m){const g=this._measureElements[m];return g.textContent=u.repeat(32),g.offsetWidth/32}}},2223:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const m=u(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(h,l)=>{function u(g){return 57508<=g&&g<=57558}function m(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},l.isPowerlineGlyph=u,l.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},l.isEmoji=m,l.allowRescaling=function(g,p,S,w){return p===1&&S>Math.ceil(1.5*w)&&g!==void 0&&g>255&&!m(g)&&!u(g)&&!(function(A){return 57344<=A&&A<=63743})(g)},l.treatGlyphAsBackgroundColor=function(g){return u(g)||(function(p){return 9472<=p&&p<=9631})(g)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(g,p,S=0){return(g-(2*Math.round(p)-S))%(2*Math.round(p))}},6052:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,p,S,w=!1){if(this.selectionStart=p,this.selectionEnd=S,!p||!S||p[0]===S[0]&&p[1]===S[1])return void this.clear();const A=g.buffers.active.ydisp,E=p[1]-A,y=S[1]-A,b=Math.max(E,0),v=Math.min(y,g.rows-1);b>=g.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=E,this.viewportEndRow=y,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=p[0],this.endCol=S[0])}isCellSelected(g,p,S){return!!this.hasSelection&&(S-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?p>=this.startCol&&S>=this.viewportCappedStartRow&&p<this.endCol&&S<=this.viewportCappedEndRow:p<this.startCol&&S>=this.viewportCappedStartRow&&p>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&p>=this.startCol&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&p>=this.startCol)}}l.createSelectionRenderModel=function(){return new u}},456:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(u){this._bufferService=u,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,m=this.selectionEnd;return!(!u||!m)&&(u[1]>m[1]||u[1]===m[1]&&u[0]>m[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var x,T=arguments.length,R=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(x=v[M])&&(R=(T<3?x(R):T>3?x(_,k,R):x(_,k))||R);return T>3&&R&&Object.defineProperty(_,k,R),R},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const p=u(2585),S=u(8460),w=u(844);let A=l.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,_,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new y(v,_,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};l.CharSizeService=A=m([g(2,p.IOptionsService)],A);class E extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(_,k){_!==void 0&&_>0&&k!==void 0&&k>0&&(this._result.width=_,this._result.height=k)}}class y extends E{constructor(_,k,C){super(),this._document=_,this._parentElement=k,this._optionsService=C,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends E{constructor(_){super(),this._optionsService=_,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const _=this._ctx.measureText("W");return this._validateAndSet(_.width,_.fontBoundingBoxAscent+_.fontBoundingBoxDescent),this._result}}},4269:function(h,l,u){var m=this&&this.__decorate||function(b,v,_,k){var C,x=arguments.length,T=x<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,v,_,k);else for(var R=b.length-1;R>=0;R--)(C=b[R])&&(T=(x<3?C(T):x>3?C(v,_,T):C(v,_))||T);return x>3&&T&&Object.defineProperty(v,_,T),T},g=this&&this.__param||function(b,v){return function(_,k){v(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const p=u(3734),S=u(643),w=u(511),A=u(2585);class E extends p.AttributeData{constructor(v,_,k){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=_,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=E;let y=l.CharacterJoinerService=class z2{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(v){const _={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(_),_.id}deregister(v){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===v)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(v);if(!_||_.length===0)return[];const k=[],C=_.translateToString(!0);let x=0,T=0,R=0,M=_.getFg(0),D=_.getBg(0);for(let L=0;L<_.getTrimmedLength();L++)if(_.loadCell(L,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==D){if(L-x>1){const q=this._getJoinedRanges(C,R,T,_,x);for(let F=0;F<q.length;F++)k.push(q[F])}x=L,R=T,M=this._workCell.fg,D=this._workCell.bg}T+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const L=this._getJoinedRanges(C,R,T,_,x);for(let q=0;q<L.length;q++)k.push(L[q])}return k}_getJoinedRanges(v,_,k,C,x){const T=v.substring(_,k);let R=[];try{R=this._characterJoiners[0].handler(T)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const D=this._characterJoiners[M].handler(T);for(let L=0;L<D.length;L++)z2._mergeRanges(R,D[L])}catch(D){console.error(D)}return this._stringRangesToCellRanges(R,C,x),R}_stringRangesToCellRanges(v,_,k){let C=0,x=!1,T=0,R=v[C];if(R){for(let M=k;M<this._bufferService.cols;M++){const D=_.getWidth(M),L=_.getString(M).length||S.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!x&&R[0]<=T&&(R[0]=M,x=!0),R[1]<=T){if(R[1]=M,R=v[++C],!R)break;R[0]<=T?(R[0]=M,x=!0):x=!1}T+=L}}R&&(R[1]=this._bufferService.cols)}}static _mergeRanges(v,_){let k=!1;for(let C=0;C<v.length;C++){const x=v[C];if(k){if(_[1]<=x[0])return v[C-1][1]=_[1],v;if(_[1]<=x[1])return v[C-1][1]=Math.max(_[1],x[1]),v.splice(C,1),v;v.splice(C,1),C--}else{if(_[1]<=x[0])return v.splice(C,0,_),v;if(_[1]<=x[1])return x[0]=Math.min(_[0],x[0]),v;_[0]<x[1]&&(x[0]=Math.min(_[0],x[0]),k=!0)}}return k?v[v.length-1][1]=_[1]:v.push(_),v}};l.CharacterJoinerService=y=m([g(0,A.IBufferService)],y)},5114:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const m=u(844),g=u(8460),p=u(3656);class S extends m.Disposable{constructor(E,y,b){super(),this._textarea=E,this._window=y,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(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}}l.CoreBrowserService=S;class w extends m.Disposable{constructor(E){super(),this._parentWindow=E,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,m.toDisposable)((()=>this.clearListener())))}setWindow(E){this._parentWindow=E,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,p.addDisposableDomListener)(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)}}},779:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const m=u(844);class g extends m.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,m.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const w=this.linkProviders.indexOf(S);w!==-1&&this.linkProviders.splice(w,1)}}}}l.LinkProviderService=g},8934:function(h,l,u){var m=this&&this.__decorate||function(A,E,y,b){var v,_=arguments.length,k=_<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(A,E,y,b);else for(var C=A.length-1;C>=0;C--)(v=A[C])&&(k=(_<3?v(k):_>3?v(E,y,k):v(E,y))||k);return _>3&&k&&Object.defineProperty(E,y,k),k},g=this&&this.__param||function(A,E){return function(y,b){E(y,b,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const p=u(4725),S=u(9806);let w=l.MouseService=class{constructor(A,E){this._renderService=A,this._charSizeService=E}getCoords(A,E,y,b,v){return(0,S.getCoords)(window,A,E,y,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(A,E){const y=(0,S.getCoordsRelativeToElement)(window,A,E);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};l.MouseService=w=m([g(0,p.IRenderService),g(1,p.ICharSizeService)],w)},3230:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var x,T=arguments.length,R=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(x=v[M])&&(R=(T<3?x(R):T>3?x(_,k,R):x(_,k))||R);return T>3&&R&&Object.defineProperty(_,k,R),R},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const p=u(6193),S=u(4725),w=u(8460),A=u(844),E=u(7226),y=u(2585);let b=l.RenderService=class extends A.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,_,k,C,x,T,R,M){super(),this._rowCount=v,this._charSizeService=C,this._renderer=this.register(new A.MutableDisposable),this._pausedResizeTask=new E.DebouncedIdleTask,this._observerDisposable=this.register(new A.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(((D,L)=>this._renderRows(D,L)),R),this.register(this._renderDebouncer),this.register(R.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(x.onDecorationRegistered((()=>this._fullRefresh()))),this.register(x.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(R.window,_),this.register(R.onWindowChange((D=>this._registerIntersectionObserver(D,_))))}_registerIntersectionObserver(v,_){if("IntersectionObserver"in v){const k=new v.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});k.observe(_),this._observerDisposable.value=(0,A.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,_,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,_,this._rowCount))}_renderRows(v,_){this._renderer.value&&(v=Math.min(v,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(v,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:_}),this._onRender.fire({start:v,end:_}),this._isNextRenderRedrawOnly=!0)}resize(v,_){this._rowCount=_,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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,_;this._renderer.value&&((_=(v=this._renderer.value).clearTextureAtlas)==null||_.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(v,_)})):this._renderer.value.handleResize(v,_),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)==null||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)==null||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)==null||v.handleFocus()}handleSelectionChanged(v,_,k){var C;this._selectionState.start=v,this._selectionState.end=_,this._selectionState.columnSelectMode=k,(C=this._renderer.value)==null||C.handleSelectionChanged(v,_,k)}handleCursorMove(){var v;(v=this._renderer.value)==null||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)==null||v.clear()}};l.RenderService=b=m([g(2,y.IOptionsService),g(3,S.ICharSizeService),g(4,y.IDecorationService),g(5,y.IBufferService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],b)},9312:function(h,l,u){var m=this&&this.__decorate||function(R,M,D,L){var q,F=arguments.length,Y=F<3?M:L===null?L=Object.getOwnPropertyDescriptor(M,D):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(R,M,D,L);else for(var Q=R.length-1;Q>=0;Q--)(q=R[Q])&&(Y=(F<3?q(Y):F>3?q(M,D,Y):q(M,D))||Y);return F>3&&Y&&Object.defineProperty(M,D,Y),Y},g=this&&this.__param||function(R,M){return function(D,L){M(D,L,R)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const p=u(9806),S=u(9504),w=u(456),A=u(4725),E=u(8460),y=u(844),b=u(6114),v=u(4841),_=u(511),k=u(2585),C=" ",x=new RegExp(C,"g");let T=l.SelectionService=class extends y.Disposable{constructor(R,M,D,L,q,F,Y,Q,G){super(),this._element=R,this._screenElement=M,this._linkifier=D,this._bufferService=L,this._coreService=q,this._mouseService=F,this._optionsService=Y,this._renderService=Q,this._coreBrowserService=G,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new E.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new E.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=ee=>this._handleMouseMove(ee),this._mouseUpListener=ee=>this._handleMouseUp(ee),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((ee=>this._handleTrim(ee))),this.register(this._bufferService.buffers.onBufferActivate((ee=>this._handleBufferActivate(ee)))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,y.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const R=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!R||!M||R[0]===M[0]&&R[1]===M[1])}get selectionText(){const R=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!R||!M)return"";const D=this._bufferService.buffer,L=[];if(this._activeSelectionMode===3){if(R[0]===M[0])return"";const q=R[0]<M[0]?R[0]:M[0],F=R[0]<M[0]?M[0]:R[0];for(let Y=R[1];Y<=M[1];Y++){const Q=D.translateBufferLineToString(Y,!0,q,F);L.push(Q)}}else{const q=R[1]===M[1]?M[0]:void 0;L.push(D.translateBufferLineToString(R[1],!0,R[0],q));for(let F=R[1]+1;F<=M[1]-1;F++){const Y=D.lines.get(F),Q=D.translateBufferLineToString(F,!0);Y!=null&&Y.isWrapped?L[L.length-1]+=Q:L.push(Q)}if(R[1]!==M[1]){const F=D.lines.get(M[1]),Y=D.translateBufferLineToString(M[1],!0,0,M[0]);F&&F.isWrapped?L[L.length-1]+=Y:L.push(Y)}}return L.map((q=>q.replace(x," "))).join(b.isWindows?`\r
493
+ `:`
494
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(R){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&R&&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(R){const M=this._getMouseBufferCoords(R),D=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!!(D&&L&&M)&&this._areCoordsInSelection(M,D,L)}isCellInSelection(R,M){const D=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!D||!L)&&this._areCoordsInSelection([R,M],D,L)}_areCoordsInSelection(R,M,D){return R[1]>M[1]&&R[1]<D[1]||M[1]===D[1]&&R[1]===M[1]&&R[0]>=M[0]&&R[0]<D[0]||M[1]<D[1]&&R[1]===D[1]&&R[0]<D[0]||M[1]<D[1]&&R[1]===M[1]&&R[0]>=M[0]}_selectWordAtCursor(R,M){var q,F;const D=(F=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:F.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const L=this._getMouseBufferCoords(R);return!!L&&(this._selectWordAt(L,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(R,M){this._model.clearSelection(),R=Math.max(R,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,R],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(R){this._model.handleTrim(R)&&this.refresh()}_getMouseBufferCoords(R){const M=this._mouseService.getCoords(R,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(R){let M=(0,p.getCoordsRelativeToElement)(this._coreBrowserService.window,R,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=D?0:(M>D&&(M-=D),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(R){return b.isMac?R.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:R.shiftKey}handleMouseDown(R){if(this._mouseDownTimeStamp=R.timeStamp,(R.button!==2||!this.hasSelection)&&R.button===0){if(!this._enabled){if(!this.shouldForceSelection(R))return;R.stopPropagation()}R.preventDefault(),this._dragScrollAmount=0,this._enabled&&R.shiftKey?this._handleIncrementalClick(R):R.detail===1?this._handleSingleClick(R):R.detail===2?this._handleDoubleClick(R):R.detail===3&&this._handleTripleClick(R),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(R){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(R))}_handleSingleClick(R){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(R)?3:0,this._model.selectionStart=this._getMouseBufferCoords(R),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(R){this._selectWordAtCursor(R,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(R){const M=this._getMouseBufferCoords(R);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(R){return R.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(R){if(R.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(R),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(R),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const L=D.lines.get(this._model.selectionEnd[1]);L&&L.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}M&&M[0]===this._model.selectionEnd[0]&&M[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const R=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(R.ydisp+this._bufferService.rows,R.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=R.ydisp),this.refresh()}}_handleMouseUp(R){const M=R.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&R.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(R,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const L=(0,S.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const R=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,D=!(!R||!M||R[0]===M[0]&&R[1]===M[1]);D?R&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&R[0]===this._oldSelectionStart[0]&&R[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(R,M,D)):this._oldHasSelection&&this._fireOnSelectionChange(R,M,D)}_fireOnSelectionChange(R,M,D){this._oldSelectionStart=R,this._oldSelectionEnd=M,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(R){this.clearSelection(),this._trimListener.dispose(),this._trimListener=R.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(R,M){let D=M;for(let L=0;M>=L;L++){const q=R.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:q>1&&M!==L&&(D+=q-1)}return D}setSelection(R,M,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[R,M],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(R){this._isClickInSelection(R)||(this._selectWordAtCursor(R,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(R,M,D=!0,L=!0){if(R[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,F=q.lines.get(R[1]);if(!F)return;const Y=q.translateBufferLineToString(R[1],!1);let Q=this._convertViewportColToCharacterIndex(F,R[0]),G=Q;const ee=R[0]-Q;let ne=0,z=0,B=0,$=0;if(Y.charAt(Q)===" "){for(;Q>0&&Y.charAt(Q-1)===" ";)Q--;for(;G<Y.length&&Y.charAt(G+1)===" ";)G++}else{let P=R[0],W=R[0];F.getWidth(P)===0&&(ne++,P--),F.getWidth(W)===2&&(z++,W++);const se=F.getString(W).length;for(se>1&&($+=se-1,G+=se-1);P>0&&Q>0&&!this._isCharWordSeparator(F.loadCell(P-1,this._workCell));){F.loadCell(P-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(ne++,P--):X>1&&(B+=X-1,Q-=X-1),Q--,P--}for(;W<F.length&&G+1<Y.length&&!this._isCharWordSeparator(F.loadCell(W+1,this._workCell));){F.loadCell(W+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,W++):X>1&&($+=X-1,G+=X-1),G++,W++}}G++;let H=Q+ee-ne+B,U=Math.min(this._bufferService.cols,G-Q+ne+z-B-$);if(M||Y.slice(Q,G).trim()!==""){if(D&&H===0&&F.getCodePoint(0)!==32){const P=q.lines.get(R[1]-1);if(P&&F.isWrapped&&P.getCodePoint(this._bufferService.cols-1)!==32){const W=this._getWordAt([this._bufferService.cols-1,R[1]-1],!1,!0,!1);if(W){const se=this._bufferService.cols-W.start;H-=se,U+=se}}}if(L&&H+U===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const P=q.lines.get(R[1]+1);if(P!=null&&P.isWrapped&&P.getCodePoint(0)!==32){const W=this._getWordAt([0,R[1]+1],!1,!1,!0);W&&(U+=W.length)}}return{start:H,length:U}}}_selectWordAt(R,M){const D=this._getWordAt(R,M);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,R[1]--;this._model.selectionStart=[D.start,R[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(R){const M=this._getWordAt(R,!0);if(M){let D=R[1];for(;M.start<0;)M.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,D]}}_isCharWordSeparator(R){return R.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(R.getChars())>=0}_selectLineAt(R){const M=this._bufferService.buffer.getWrappedRangeForLine(R),D={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(D,this._bufferService.cols)}};l.SelectionService=T=m([g(3,k.IBufferService),g(4,k.ICoreService),g(5,A.IMouseService),g(6,k.IOptionsService),g(7,A.IRenderService),g(8,A.ICoreBrowserService)],T)},4725:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const m=u(8343);l.ICharSizeService=(0,m.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,m.createDecorator)("CoreBrowserService"),l.IMouseService=(0,m.createDecorator)("MouseService"),l.IRenderService=(0,m.createDecorator)("RenderService"),l.ISelectionService=(0,m.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,m.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,m.createDecorator)("ThemeService"),l.ILinkProviderService=(0,m.createDecorator)("LinkProviderService")},6731:function(h,l,u){var m=this&&this.__decorate||function(T,R,M,D){var L,q=arguments.length,F=q<3?R:D===null?D=Object.getOwnPropertyDescriptor(R,M):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,R,M,D);else for(var Y=T.length-1;Y>=0;Y--)(L=T[Y])&&(F=(q<3?L(F):q>3?L(R,M,F):L(R,M))||F);return q>3&&F&&Object.defineProperty(R,M,F),F},g=this&&this.__param||function(T,R){return function(M,D){R(M,D,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const p=u(7239),S=u(8055),w=u(8460),A=u(844),E=u(2585),y=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),v=S.css.toColor("#ffffff"),_=S.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],R=[0,95,135,175,215,255];for(let M=0;M<216;M++){const D=R[M/36%6|0],L=R[M/6%6|0],q=R[M%6];T.push({css:S.channels.toCss(D,L,q),rgba:S.channels.toRgba(D,L,q)})}for(let M=0;M<24;M++){const D=8+10*M;T.push({css:S.channels.toCss(D,D,D),rgba:S.channels.toRgba(D,D,D)})}return T})());let C=l.ThemeService=class extends A.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new p.ColorContrastCache,this._halfContrastCache=new p.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:b,cursor:v,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:S.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:S.color.blend(b,k),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(T={}){const R=this._colors;if(R.foreground=x(T.foreground,y),R.background=x(T.background,b),R.cursor=x(T.cursor,v),R.cursorAccent=x(T.cursorAccent,_),R.selectionBackgroundTransparent=x(T.selectionBackground,k),R.selectionBackgroundOpaque=S.color.blend(R.background,R.selectionBackgroundTransparent),R.selectionInactiveBackgroundTransparent=x(T.selectionInactiveBackground,R.selectionBackgroundTransparent),R.selectionInactiveBackgroundOpaque=S.color.blend(R.background,R.selectionInactiveBackgroundTransparent),R.selectionForeground=T.selectionForeground?x(T.selectionForeground,S.NULL_COLOR):void 0,R.selectionForeground===S.NULL_COLOR&&(R.selectionForeground=void 0),S.color.isOpaque(R.selectionBackgroundTransparent)&&(R.selectionBackgroundTransparent=S.color.opacity(R.selectionBackgroundTransparent,.3)),S.color.isOpaque(R.selectionInactiveBackgroundTransparent)&&(R.selectionInactiveBackgroundTransparent=S.color.opacity(R.selectionInactiveBackgroundTransparent,.3)),R.ansi=l.DEFAULT_ANSI_COLORS.slice(),R.ansi[0]=x(T.black,l.DEFAULT_ANSI_COLORS[0]),R.ansi[1]=x(T.red,l.DEFAULT_ANSI_COLORS[1]),R.ansi[2]=x(T.green,l.DEFAULT_ANSI_COLORS[2]),R.ansi[3]=x(T.yellow,l.DEFAULT_ANSI_COLORS[3]),R.ansi[4]=x(T.blue,l.DEFAULT_ANSI_COLORS[4]),R.ansi[5]=x(T.magenta,l.DEFAULT_ANSI_COLORS[5]),R.ansi[6]=x(T.cyan,l.DEFAULT_ANSI_COLORS[6]),R.ansi[7]=x(T.white,l.DEFAULT_ANSI_COLORS[7]),R.ansi[8]=x(T.brightBlack,l.DEFAULT_ANSI_COLORS[8]),R.ansi[9]=x(T.brightRed,l.DEFAULT_ANSI_COLORS[9]),R.ansi[10]=x(T.brightGreen,l.DEFAULT_ANSI_COLORS[10]),R.ansi[11]=x(T.brightYellow,l.DEFAULT_ANSI_COLORS[11]),R.ansi[12]=x(T.brightBlue,l.DEFAULT_ANSI_COLORS[12]),R.ansi[13]=x(T.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),R.ansi[14]=x(T.brightCyan,l.DEFAULT_ANSI_COLORS[14]),R.ansi[15]=x(T.brightWhite,l.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const M=Math.min(R.ansi.length-16,T.extendedAnsi.length);for(let D=0;D<M;D++)R.ansi[D+16]=x(T.extendedAnsi[D],l.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(T){this._restoreColor(T),this._onChangeColors.fire(this.colors)}_restoreColor(T){if(T!==void 0)switch(T){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[T]=this._restoreColors.ansi[T]}else for(let R=0;R<this._restoreColors.ansi.length;++R)this._colors.ansi[R]=this._restoreColors.ansi[R]}modifyColors(T){T(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function x(T,R){if(T!==void 0)try{return S.css.toColor(T)}catch{}return R}l.ThemeService=C=m([g(0,E.IOptionsService)],C)},6349:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const m=u(8460),g=u(844);class p extends g.Disposable{constructor(w){super(),this._maxLength=w,this.onDeleteEmitter=this.register(new m.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new m.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new m.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(w){if(this._maxLength===w)return;const A=new Array(w);for(let E=0;E<Math.min(w,this.length);E++)A[E]=this._array[this._getCyclicIndex(E)];this._array=A,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let A=this._length;A<w;A++)this._array[A]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,A){this._array[this._getCyclicIndex(w)]=A}push(w){this._array[this._getCyclicIndex(this._length)]=w,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(w,A,...E){if(A){for(let y=w;y<this._length-A;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+A)];this._length-=A,this.onDeleteEmitter.fire({index:w,amount:A})}for(let y=this._length-1;y>=w;y--)this._array[this._getCyclicIndex(y+E.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;y<E.length;y++)this._array[this._getCyclicIndex(w+y)]=E[y];if(E.length&&this.onInsertEmitter.fire({index:w,amount:E.length}),this._length+E.length>this._maxLength){const y=this._length+E.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=E.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,A,E){if(!(A<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+E<0)throw new Error("Cannot shift elements in list beyond index 0");if(E>0){for(let b=A-1;b>=0;b--)this.set(w+b+E,this.get(w+b));const y=w+A+E-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y<A;y++)this.set(w+y+E,this.get(w+y))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}l.CircularList=p},1439:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function u(m,g=5){if(typeof m!="object")return m;const p=Array.isArray(m)?[]:{};for(const S in m)p[S]=g<=1?m[S]:m[S]&&u(m[S],g-1);return p}},8055:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let u=0,m=0,g=0,p=0;var S,w,A,E,y;function b(_){const k=_.toString(16);return k.length<2?"0"+k:k}function v(_,k){return _<k?(k+.05)/(_+.05):(_+.05)/(k+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(k,C,x,T){return T!==void 0?`#${b(k)}${b(C)}${b(x)}${b(T)}`:`#${b(k)}${b(C)}${b(x)}`},_.toRgba=function(k,C,x,T=255){return(k<<24|C<<16|x<<8|T)>>>0},_.toColor=function(k,C,x,T){return{css:_.toCss(k,C,x,T),rgba:_.toRgba(k,C,x,T)}}})(S||(l.channels=S={})),(function(_){function k(C,x){return p=Math.round(255*x),[u,m,g]=y.toChannels(C.rgba),{css:S.toCss(u,m,g,p),rgba:S.toRgba(u,m,g,p)}}_.blend=function(C,x){if(p=(255&x.rgba)/255,p===1)return{css:x.css,rgba:x.rgba};const T=x.rgba>>24&255,R=x.rgba>>16&255,M=x.rgba>>8&255,D=C.rgba>>24&255,L=C.rgba>>16&255,q=C.rgba>>8&255;return u=D+Math.round((T-D)*p),m=L+Math.round((R-L)*p),g=q+Math.round((M-q)*p),{css:S.toCss(u,m,g),rgba:S.toRgba(u,m,g)}},_.isOpaque=function(C){return(255&C.rgba)==255},_.ensureContrastRatio=function(C,x,T){const R=y.ensureContrastRatio(C.rgba,x.rgba,T);if(R)return S.toColor(R>>24&255,R>>16&255,R>>8&255)},_.opaque=function(C){const x=(255|C.rgba)>>>0;return[u,m,g]=y.toChannels(x),{css:S.toCss(u,m,g),rgba:x}},_.opacity=k,_.multiplyOpacity=function(C,x){return p=255&C.rgba,k(C,p*x/255)},_.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(w||(l.color=w={})),(function(_){let k,C;try{const x=document.createElement("canvas");x.width=1,x.height=1;const T=x.getContext("2d",{willReadFrequently:!0});T&&(k=T,k.globalCompositeOperation="copy",C=k.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return u=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),S.toColor(u,m,g);case 5:return u=parseInt(x.slice(1,2).repeat(2),16),m=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),p=parseInt(x.slice(4,5).repeat(2),16),S.toColor(u,m,g,p);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const T=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return u=parseInt(T[1]),m=parseInt(T[2]),g=parseInt(T[3]),p=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),S.toColor(u,m,g,p);if(!k||!C)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=C,k.fillStyle=x,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[u,m,g,p]=k.getImageData(0,0,1,1).data,p!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(u,m,g,p),css:x}}})(A||(l.css=A={})),(function(_){function k(C,x,T){const R=C/255,M=x/255,D=T/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}_.relativeLuminance=function(C){return k(C>>16&255,C>>8&255,255&C)},_.relativeLuminance2=k})(E||(l.rgb=E={})),(function(_){function k(x,T,R){const M=x>>24&255,D=x>>16&255,L=x>>8&255;let q=T>>24&255,F=T>>16&255,Y=T>>8&255,Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));for(;Q<R&&(q>0||F>0||Y>0);)q-=Math.max(0,Math.ceil(.1*q)),F-=Math.max(0,Math.ceil(.1*F)),Y-=Math.max(0,Math.ceil(.1*Y)),Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));return(q<<24|F<<16|Y<<8|255)>>>0}function C(x,T,R){const M=x>>24&255,D=x>>16&255,L=x>>8&255;let q=T>>24&255,F=T>>16&255,Y=T>>8&255,Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));for(;Q<R&&(q<255||F<255||Y<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),F=Math.min(255,F+Math.ceil(.1*(255-F))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));return(q<<24|F<<16|Y<<8|255)>>>0}_.blend=function(x,T){if(p=(255&T)/255,p===1)return T;const R=T>>24&255,M=T>>16&255,D=T>>8&255,L=x>>24&255,q=x>>16&255,F=x>>8&255;return u=L+Math.round((R-L)*p),m=q+Math.round((M-q)*p),g=F+Math.round((D-F)*p),S.toRgba(u,m,g)},_.ensureContrastRatio=function(x,T,R){const M=E.relativeLuminance(x>>8),D=E.relativeLuminance(T>>8);if(v(M,D)<R){if(D<M){const F=k(x,T,R),Y=v(M,E.relativeLuminance(F>>8));if(Y<R){const Q=C(x,T,R);return Y>v(M,E.relativeLuminance(Q>>8))?F:Q}return F}const L=C(x,T,R),q=v(M,E.relativeLuminance(L>>8));if(q<R){const F=k(x,T,R);return q>v(M,E.relativeLuminance(F>>8))?L:F}return L}},_.reduceLuminance=k,_.increaseLuminance=C,_.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}})(y||(l.rgba=y={})),l.toPaddedHex=b,l.contrastRatio=v},8969:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const m=u(844),g=u(2585),p=u(4348),S=u(7866),w=u(744),A=u(7302),E=u(6975),y=u(8460),b=u(1753),v=u(1480),_=u(7994),k=u(9282),C=u(5435),x=u(5981),T=u(2660);let R=!1;class M extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((L=>{var q;(q=this._onScrollApi)==null||q.fire(L.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(L){for(const q in L)this.optionsService.options[q]=L[q]}constructor(L){super(),this._windowsWrappingHeuristics=this.register(new m.MutableDisposable),this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new p.InstantiationService,this.optionsService=this.register(new A.OptionsService(L)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(E.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((q=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((q=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new x.WriteBuffer(((q,F)=>this._inputHandler.parse(q,F)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,q){this._writeBuffer.write(L,q)}writeSync(L,q){this._logService.logLevel<=g.LogLevelEnum.WARN&&!R&&(this._logService.warn("writeSync is unreliable and will be removed soon."),R=!0),this._writeBuffer.writeSync(L,q)}input(L,q=!0){this.coreService.triggerDataEvent(L,q)}resize(L,q){isNaN(L)||isNaN(q)||(L=Math.max(L,w.MINIMUM_COLS),q=Math.max(q,w.MINIMUM_ROWS),this._bufferService.resize(L,q))}scroll(L,q=!1){this._bufferService.scroll(L,q)}scrollLines(L,q,F){this._bufferService.scrollLines(L,q,F)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const q=L-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(L,q){return this._inputHandler.registerEscHandler(L,q)}registerDcsHandler(L,q){return this._inputHandler.registerDcsHandler(L,q)}registerCsiHandler(L,q){return this._inputHandler.registerCsiHandler(L,q)}registerOscHandler(L,q){return this._inputHandler.registerOscHandler(L,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?L=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const q of L)q.dispose()}))}}}l.CoreTerminal=M},8460:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===u)return void this._listeners.splice(m,1)}}})),this._event}fire(u,m){const g=[];for(let p=0;p<this._listeners.length;p++)g.push(this._listeners[p]);for(let p=0;p<g.length;p++)g[p].call(void 0,u,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(u,m){return u((g=>m.fire(g)))},l.runAndSubscribe=function(u,m){return m(void 0),u((g=>m(g)))}},5435:function(h,l,u){var m=this&&this.__decorate||function(ne,z,B,$){var H,U=arguments.length,P=U<3?z:$===null?$=Object.getOwnPropertyDescriptor(z,B):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(ne,z,B,$);else for(var W=ne.length-1;W>=0;W--)(H=ne[W])&&(P=(U<3?H(P):U>3?H(z,B,P):H(z,B))||P);return U>3&&P&&Object.defineProperty(z,B,P),P},g=this&&this.__param||function(ne,z){return function(B,$){z(B,$,ne)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const p=u(2584),S=u(7116),w=u(2015),A=u(844),E=u(482),y=u(8437),b=u(8460),v=u(643),_=u(511),k=u(3734),C=u(2585),x=u(1480),T=u(6242),R=u(6351),M=u(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},L=131072;function q(ne,z){if(ne>24)return z.setWinLines||!1;switch(ne){case 1:return!!z.restoreWin;case 2:return!!z.minimizeWin;case 3:return!!z.setWinPosition;case 4:return!!z.setWinSizePixels;case 5:return!!z.raiseWin;case 6:return!!z.lowerWin;case 7:return!!z.refreshWin;case 8:return!!z.setWinSizeChars;case 9:return!!z.maximizeWin;case 10:return!!z.fullscreenWin;case 11:return!!z.getWinState;case 13:return!!z.getWinPosition;case 14:return!!z.getWinSizePixels;case 15:return!!z.getScreenSizePixels;case 16:return!!z.getCellSizePixels;case 18:return!!z.getWinSizeChars;case 19:return!!z.getScreenSizeChars;case 20:return!!z.getIconTitle;case 21:return!!z.getWinTitle;case 22:return!!z.pushTitle;case 23:return!!z.popTitle;case 24:return!!z.setWinLines}return!1}var F;(function(ne){ne[ne.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ne[ne.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(l.WindowsOptionsReportType=F={}));let Y=0;class Q extends A.Disposable{getAttrData(){return this._curAttrData}constructor(z,B,$,H,U,P,W,se,X=new w.EscapeSequenceParser){super(),this._bufferService=z,this._charsetService=B,this._coreService=$,this._logService=H,this._optionsService=U,this._oscLinkService=P,this._coreMouseService=W,this._unicodeService=se,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new E.StringToUtf32,this._utf8Decoder=new E.Utf8ToUtf32,this._workCell=new _.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,ce)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:ce.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,ce,oe)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:ce,data:oe})})),this._parser.setDcsHandlerFallback(((V,ce,oe)=>{ce==="HOOK"&&(oe=oe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:ce,payload:oe})})),this._parser.setPrintHandler(((V,ce,oe)=>this.print(V,ce,oe))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!1))),this._parser.setExecuteHandler(p.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(p.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(p.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(p.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(p.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(p.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(p.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(p.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(p.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new T.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new T.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new T.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new T.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new T.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new T.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new T.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new T.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new T.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new T.OscHandler((V=>this.restoreCursorColor(V)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const V in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new R.DcsHandler(((V,ce)=>this.requestStatusString(V,ce))))}_preserveStack(z,B,$,H){this._parseStack.paused=!0,this._parseStack.cursorStartX=z,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=$,this._parseStack.position=H}_logSlowResolvingAsync(z){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([z,new Promise(((B,$)=>setTimeout((()=>$("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(z,B){let $,H=this._activeBuffer.x,U=this._activeBuffer.y,P=0;const W=this._parseStack.paused;if(W){if($=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync($),$;H=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,z.length>L&&(P=this._parseStack.position+L)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof z=="string"?` "${z}"`:` "${Array.prototype.map.call(z,(V=>String.fromCharCode(V))).join("")}"`),typeof z=="string"?z.split("").map((V=>V.charCodeAt(0))):z),this._parseBuffer.length<z.length&&this._parseBuffer.length<L&&(this._parseBuffer=new Uint32Array(Math.min(z.length,L))),W||this._dirtyRowTracker.clearRange(),z.length>L)for(let V=P;V<z.length;V+=L){const ce=V+L<z.length?V+L:z.length,oe=typeof z=="string"?this._stringDecoder.decode(z.substring(V,ce),this._parseBuffer):this._utf8Decoder.decode(z.subarray(V,ce),this._parseBuffer);if($=this._parser.parse(this._parseBuffer,oe))return this._preserveStack(H,U,oe,V),this._logSlowResolvingAsync($),$}else if(!W){const V=typeof z=="string"?this._stringDecoder.decode(z,this._parseBuffer):this._utf8Decoder.decode(z,this._parseBuffer);if($=this._parser.parse(this._parseBuffer,V))return this._preserveStack(H,U,V,0),this._logSlowResolvingAsync($),$}this._activeBuffer.x===H&&this._activeBuffer.y===U||this._onCursorMove.fire();const se=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(se,this._bufferService.rows-1))}print(z,B,$){let H,U;const P=this._charsetService.charset,W=this._optionsService.rawOptions.screenReaderMode,se=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,V=this._coreService.modes.insertMode,ce=this._curAttrData;let oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&$-B>0&&oe.getWidth(this._activeBuffer.x-1)===2&&oe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ce);let Z=this._parser.precedingJoinState;for(let te=B;te<$;++te){if(H=z[te],H<127&&P){const Ie=P[String.fromCharCode(H)];Ie&&(H=Ie.charCodeAt(0))}const pe=this._unicodeService.charProperties(H,Z);U=x.UnicodeService.extractWidth(pe);const ye=x.UnicodeService.extractShouldJoin(pe),Ee=ye?x.UnicodeService.extractWidth(Z):0;if(Z=pe,W&&this._onA11yChar.fire((0,E.stringFromCodePoint)(H)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-Ee>se){if(X){const Ie=oe;let Pe=this._activeBuffer.x-Ee;for(this._activeBuffer.x=Ee,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ee>0&&oe instanceof y.BufferLine&&oe.copyCellsFrom(Ie,Pe,0,Ee,!1);Pe<se;)Ie.setCellFromCodepoint(Pe++,0,1,ce)}else if(this._activeBuffer.x=se-1,U===2)continue}if(ye&&this._activeBuffer.x){const Ie=oe.getWidth(this._activeBuffer.x-1)?1:2;oe.addCodepointToCell(this._activeBuffer.x-Ie,H,U);for(let Pe=U-Ee;--Pe>=0;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ce)}else if(V&&(oe.insertCells(this._activeBuffer.x,U-Ee,this._activeBuffer.getNullCell(ce)),oe.getWidth(se-1)===2&&oe.setCellFromCodepoint(se-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ce)),oe.setCellFromCodepoint(this._activeBuffer.x++,H,U,ce),U>0)for(;--U;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ce)}this._parser.precedingJoinState=Z,this._activeBuffer.x<se&&$-B>0&&oe.getWidth(this._activeBuffer.x)===0&&!oe.hasContent(this._activeBuffer.x)&&oe.setCellFromCodepoint(this._activeBuffer.x,0,1,ce),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(z,B){return z.final!=="t"||z.prefix||z.intermediates?this._parser.registerCsiHandler(z,B):this._parser.registerCsiHandler(z,($=>!q($.params[0],this._optionsService.rawOptions.windowOptions)||B($)))}registerDcsHandler(z,B){return this._parser.registerDcsHandler(z,new R.DcsHandler(B))}registerEscHandler(z,B){return this._parser.registerEscHandler(z,B)}registerOscHandler(z,B){return this._parser.registerOscHandler(z,new T.OscHandler(B))}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 z;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&&((z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&z.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const z=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-z),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(z=this._bufferService.cols-1){this._activeBuffer.x=Math.min(z,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(z,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=z,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=z,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(z,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+z,this._activeBuffer.y+B)}cursorUp(z){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,z.params[0]||1)):this._moveCursor(0,-(z.params[0]||1)),!0}cursorDown(z){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,z.params[0]||1)):this._moveCursor(0,z.params[0]||1),!0}cursorForward(z){return this._moveCursor(z.params[0]||1,0),!0}cursorBackward(z){return this._moveCursor(-(z.params[0]||1),0),!0}cursorNextLine(z){return this.cursorDown(z),this._activeBuffer.x=0,!0}cursorPrecedingLine(z){return this.cursorUp(z),this._activeBuffer.x=0,!0}cursorCharAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(z){return this._setCursor(z.length>=2?(z.params[1]||1)-1:0,(z.params[0]||1)-1),!0}charPosAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(z){return this._moveCursor(z.params[0]||1,0),!0}linePosAbsolute(z){return this._setCursor(this._activeBuffer.x,(z.params[0]||1)-1),!0}vPositionRelative(z){return this._moveCursor(0,z.params[0]||1),!0}hVPosition(z){return this.cursorPosition(z),!0}tabClear(z){const B=z.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=z.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=z.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(z){const B=z.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(z,B,$,H=!1,U=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);P.replaceCells(B,$,this._activeBuffer.getNullCell(this._eraseAttrData()),U),H&&(P.isWrapped=!1)}_resetBufferLine(z,B=!1){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);$&&($.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+z),$.isWrapped=!1)}eraseInDisplay(z,B=!1){let $;switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);$<this._bufferService.rows;$++)this._resetBufferLine($,B);this._dirtyRowTracker.markDirty($);break;case 1:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get($+1).isWrapped=!1);$--;)this._resetBufferLine($,B);this._dirtyRowTracker.markDirty(0);break;case 2:for($=this._bufferService.rows,this._dirtyRowTracker.markDirty($-1);$--;)this._resetBufferLine($,B);this._dirtyRowTracker.markDirty(0);break;case 3:const H=this._activeBuffer.lines.length-this._bufferService.rows;H>0&&(this._activeBuffer.lines.trimStart(H),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-H,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-H,0),this._onScroll.fire(0))}return!0}eraseInLine(z,B=!1){switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(z){this._restrictCursor();let B=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y,H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-H+1;for(;B--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(z){this._restrictCursor();let B=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y;let H;for(H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-H;B--;)this._activeBuffer.lines.splice($,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(z){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(z){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(z){let B=z.params[0]||1;for(;B--;)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(z){let B=z.params[0]||1;for(;B--;)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(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(z){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(z.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(z){const B=this._parser.precedingJoinState;if(!B)return!0;const $=z.params[0]||1,H=x.UnicodeService.extractWidth(B),U=this._activeBuffer.x-H,P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),W=new Uint32Array(P.length*$);let se=0;for(let V=0;V<P.length;){const ce=P.codePointAt(V)||0;W[se++]=ce,V+=ce>65535?2:1}let X=se;for(let V=1;V<$;++V)W.copyWithin(X,0,se),X+=se;return this.print(W,0,X),!0}sendDeviceAttributesPrimary(z){return z.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(p.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(p.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(z){return z.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(p.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(p.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(z.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(p.C0.ESC+"[>83;40003;0c")),!0}_is(z){return(this._optionsService.rawOptions.termName+"").indexOf(z)===0}setMode(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),z.params[B]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(z,B){const $=this._coreService.decPrivateModes,{activeProtocol:H,activeEncoding:U}=this._coreMouseService,P=this._coreService,{buffers:W,cols:se}=this._bufferService,{active:X,alt:V}=W,ce=this._optionsService.rawOptions,oe=ye=>ye?1:2,Z=z.params[0];return te=Z,pe=B?Z===2?4:Z===4?oe(P.modes.insertMode):Z===12?3:Z===20?oe(ce.convertEol):0:Z===1?oe($.applicationCursorKeys):Z===3?ce.windowOptions.setWinLines?se===80?2:se===132?1:0:0:Z===6?oe($.origin):Z===7?oe($.wraparound):Z===8?3:Z===9?oe(H==="X10"):Z===12?oe(ce.cursorBlink):Z===25?oe(!P.isCursorHidden):Z===45?oe($.reverseWraparound):Z===66?oe($.applicationKeypad):Z===67?4:Z===1e3?oe(H==="VT200"):Z===1002?oe(H==="DRAG"):Z===1003?oe(H==="ANY"):Z===1004?oe($.sendFocus):Z===1005?4:Z===1006?oe(U==="SGR"):Z===1015?4:Z===1016?oe(U==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?oe(X===V):Z===2004?oe($.bracketedPasteMode):0,P.triggerDataEvent(`${p.C0.ESC}[${B?"":"?"}${te};${pe}$y`),!0;var te,pe}_updateAttrColor(z,B,$,H,U){return B===2?(z|=50331648,z&=-16777216,z|=k.AttributeData.fromColorRGB([$,H,U])):B===5&&(z&=-50331904,z|=33554432|255&$),z}_extractColor(z,B,$){const H=[0,0,-1,0,0,0];let U=0,P=0;do{if(H[P+U]=z.params[B+P],z.hasSubParams(B+P)){const W=z.getSubParams(B+P);let se=0;do H[1]===5&&(U=1),H[P+se+1+U]=W[se];while(++se<W.length&&se+P+1+U<H.length);break}if(H[1]===5&&P+U>=2||H[1]===2&&P+U>=5)break;H[1]&&(U=1)}while(++P+B<z.length&&P+U<H.length);for(let W=2;W<H.length;++W)H[W]===-1&&(H[W]=0);switch(H[0]){case 38:$.fg=this._updateAttrColor($.fg,H[1],H[3],H[4],H[5]);break;case 48:$.bg=this._updateAttrColor($.bg,H[1],H[3],H[4],H[5]);break;case 58:$.extended=$.extended.clone(),$.extended.underlineColor=this._updateAttrColor($.extended.underlineColor,H[1],H[3],H[4],H[5])}return P}_processUnderline(z,B){B.extended=B.extended.clone(),(!~z||z>5)&&(z=1),B.extended.underlineStyle=z,B.fg|=268435456,z===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(z){z.fg=y.DEFAULT_ATTR_DATA.fg,z.bg=y.DEFAULT_ATTR_DATA.bg,z.extended=z.extended.clone(),z.extended.underlineStyle=0,z.extended.underlineColor&=-67108864,z.updateExtended()}charAttributes(z){if(z.length===1&&z.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=z.length;let $;const H=this._curAttrData;for(let U=0;U<B;U++)$=z.params[U],$>=30&&$<=37?(H.fg&=-50331904,H.fg|=16777216|$-30):$>=40&&$<=47?(H.bg&=-50331904,H.bg|=16777216|$-40):$>=90&&$<=97?(H.fg&=-50331904,H.fg|=16777224|$-90):$>=100&&$<=107?(H.bg&=-50331904,H.bg|=16777224|$-100):$===0?this._processSGR0(H):$===1?H.fg|=134217728:$===3?H.bg|=67108864:$===4?(H.fg|=268435456,this._processUnderline(z.hasSubParams(U)?z.getSubParams(U)[0]:1,H)):$===5?H.fg|=536870912:$===7?H.fg|=67108864:$===8?H.fg|=1073741824:$===9?H.fg|=2147483648:$===2?H.bg|=134217728:$===21?this._processUnderline(2,H):$===22?(H.fg&=-134217729,H.bg&=-134217729):$===23?H.bg&=-67108865:$===24?(H.fg&=-268435457,this._processUnderline(0,H)):$===25?H.fg&=-536870913:$===27?H.fg&=-67108865:$===28?H.fg&=-1073741825:$===29?H.fg&=2147483647:$===39?(H.fg&=-67108864,H.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):$===49?(H.bg&=-67108864,H.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):$===38||$===48||$===58?U+=this._extractColor(z,U,H):$===53?H.bg|=1073741824:$===55?H.bg&=-1073741825:$===59?(H.extended=H.extended.clone(),H.extended.underlineColor=-1,H.updateExtended()):$===100?(H.fg&=-67108864,H.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,H.bg&=-67108864,H.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",$);return!0}deviceStatus(z){switch(z.params[0]){case 5:this._coreService.triggerDataEvent(`${p.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[${B};${$}R`)}return!0}deviceStatusPrivate(z){if(z.params[0]===6){const B=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[?${B};${$}R`)}return!0}softReset(z){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(z){const B=z.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const $=B%2==1;return this._optionsService.options.cursorBlink=$,!0}setScrollRegion(z){const B=z.params[0]||1;let $;return(z.length<2||($=z.params[1])>this._bufferService.rows||$===0)&&($=this._bufferService.rows),$>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=$-1,this._setCursor(0,0)),!0}windowOptions(z){if(!q(z.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=z.length>1?z.params[1]:0;switch(z.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${p.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(z){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(z){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(z){return this._windowTitle=z,this._onTitleChange.fire(z),!0}setIconName(z){return this._iconName=z,!0}setOrReportIndexedColor(z){const B=[],$=z.split(";");for(;$.length>1;){const H=$.shift(),U=$.shift();if(/^\d+$/.exec(H)){const P=parseInt(H);if(ee(P))if(U==="?")B.push({type:0,index:P});else{const W=(0,M.parseColor)(U);W&&B.push({type:1,index:P,color:W})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(z){const B=z.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(z,B){this._getCurrentLinkId()&&this._finishHyperlink();const $=z.split(":");let H;const U=$.findIndex((P=>P.startsWith("id=")));return U!==-1&&(H=$[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:H,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(z,B){const $=z.split(";");for(let H=0;H<$.length&&!(B>=this._specialColors.length);++H,++B)if($[H]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const U=(0,M.parseColor)($[H]);U&&this._onColor.fire([{type:1,index:this._specialColors[B],color:U}])}return!0}setOrReportFgColor(z){return this._setOrReportSpecialColor(z,0)}setOrReportBgColor(z){return this._setOrReportSpecialColor(z,1)}setOrReportCursorColor(z){return this._setOrReportSpecialColor(z,2)}restoreIndexedColor(z){if(!z)return this._onColor.fire([{type:2}]),!0;const B=[],$=z.split(";");for(let H=0;H<$.length;++H)if(/^\d+$/.exec($[H])){const U=parseInt($[H]);ee(U)&&B.push({type:2,index:U})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(z){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(z){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(z){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,S.DEFAULT_CHARSET),!0}selectCharset(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(D[z[0]],S.CHARSETS[z[1]]||S.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const z=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,z,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=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(z){return this._charsetService.setgLevel(z),!0}screenAlignmentPattern(){const z=new _.CellData;z.content=4194373,z.fg=this._curAttrData.fg,z.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const $=this._activeBuffer.ybase+this._activeBuffer.y+B,H=this._activeBuffer.lines.get($);H&&(H.fill(z),H.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(z,B){const $=this._bufferService.buffer,H=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${p.C0.ESC}${U}${p.C0.ESC}\\`),!0))(z==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:z==='"p'?'P1$r61;1"p':z==="r"?`P1$r${$.scrollTop+1};${$.scrollBottom+1}r`:z==="m"?"P1$r0m":z===" q"?`P1$r${{block:2,underline:4,bar:6}[H.cursorStyle]-(H.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(z,B){this._dirtyRowTracker.markRangeDirty(z,B)}}l.InputHandler=Q;let G=class{constructor(ne){this._bufferService=ne,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ne){ne<this.start?this.start=ne:ne>this.end&&(this.end=ne)}markRangeDirty(ne,z){ne>z&&(Y=ne,ne=z,z=Y),ne<this.start&&(this.start=ne),z>this.end&&(this.end=z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function ee(ne){return 0<=ne&&ne<256}G=m([g(0,C.IBufferService)],G)},844:(h,l)=>{function u(m){for(const g of m)g.dispose();m.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const g=this._disposables.indexOf(m);g!==-1&&this._disposables.splice(g,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var g;this._isDisposed||m===this._value||((g=this._value)==null||g.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},l.toDisposable=function(m){return{dispose:m}},l.disposeArray=u,l.getDisposeArrayDisposable=function(m){return{dispose:()=>u(m)}}},1505:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(g,p,S){this._data[g]||(this._data[g]={}),this._data[g][p]=S}get(g,p){return this._data[g]?this._data[g][p]:void 0}clear(){this._data={}}}l.TwoKeyMap=u,l.FourKeyMap=class{constructor(){this._data=new u}set(m,g,p,S,w){this._data.get(m,g)||this._data.set(m,g,new u),this._data.get(m,g).set(p,S,w)}get(m,g,p,S){var w;return(w=this._data.get(m,g))==null?void 0:w.get(p,S)}clear(){this._data.clear()}}},6114:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const u=l.isNode?"node":navigator.userAgent,m=l.isNode?"node":navigator.platform;l.isFirefox=u.includes("Firefox"),l.isLegacyEdge=u.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(u),l.getSafariVersion=function(){if(!l.isSafari)return 0;const g=u.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),l.isIpad=m==="iPad",l.isIphone=m==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),l.isLinux=m.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(u)},6106:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let u=0;l.SortedList=class{constructor(m){this._getKey=m,this._array=[]}clear(){this._array.length=0}insert(m){this._array.length!==0?(u=this._search(this._getKey(m)),this._array.splice(u,0,m)):this._array.push(m)}delete(m){if(this._array.length===0)return!1;const g=this._getKey(m);if(g===void 0||(u=this._search(g),u===-1)||this._getKey(this._array[u])!==g)return!1;do if(this._array[u]===m)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===g);return!1}*getKeyIterator(m){if(this._array.length!==0&&(u=this._search(m),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===m))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===m)}forEachByKey(m,g){if(this._array.length!==0&&(u=this._search(m),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===m))do g(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===m)}values(){return[...this._array].values()}_search(m){let g=0,p=this._array.length-1;for(;p>=g;){let S=g+p>>1;const w=this._getKey(this._array[S]);if(w>m)p=S-1;else{if(!(w<m)){for(;S>0&&this._getKey(this._array[S-1])===m;)S--;return S}g=S+1}}return g}}},7226:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const m=u(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(w){this._idleCallback=void 0;let A=0,E=0,y=w.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(A=Date.now(),this._tasks[this._i]()||this._i++,A=Math.max(1,Date.now()-A),E=Math.max(A,E),b=w.timeRemaining(),1.5*E>b)return y-A<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-A))}ms`),void this._start();y=b}this.clear()}}class p extends g{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const A=Date.now()+w;return{timeRemaining:()=>Math.max(0,A-Date.now())}}}l.PriorityTaskQueue=p,l.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:p,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const m=u(643);l.updateWindowsModeWrappedState=function(g){const p=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),S=p==null?void 0:p.get(g.cols-1),w=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);w&&S&&(w.isWrapped=S[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&S[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){const p=new u;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=u;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){const p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,S=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=S}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=m},9092:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const m=u(6349),g=u(7226),p=u(3734),S=u(8437),w=u(4634),A=u(511),E=u(643),y=u(4863),b=u(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(v,_,k){this._hasScrollback=v,this._optionsService=_,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=A.CellData.fromCharData([0,E.NULL_CELL_CHAR,E.NULL_CELL_WIDTH,E.NULL_CELL_CODE]),this._whitespaceCell=A.CellData.fromCharData([0,E.WHITESPACE_CELL_CHAR,E.WHITESPACE_CELL_WIDTH,E.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new p.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new p.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,_){return new S.BufferLine(this._bufferService.cols,this.getNullCell(v),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const _=v+this._optionsService.rawOptions.scrollback;return _>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:_}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=S.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,_){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let C=0;const x=this._getCorrectBufferLength(_);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<v)for(let R=0;R<this.lines.length;R++)C+=+this.lines.get(R).resize(v,k);let T=0;if(this._rows<_)for(let R=this._rows;R<_;R++)this.lines.length<_+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new S.BufferLine(v,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(v,k)));else for(let R=this._rows;R>_;R--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const R=this.lines.length-x;R>0&&(this.lines.trimStart(R),this.ybase=Math.max(this.ybase-R,0),this.ydisp=Math.max(this.ydisp-R,0),this.savedY=Math.max(this.savedY-R,0)),this.lines.maxLength=x}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,_-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(v,_),this._cols>v))for(let T=0;T<this.lines.length;T++)C+=+this.lines.get(T).resize(v,k);this._cols=v,this._rows=_,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,_){this._cols!==v&&(v>this._cols?this._reflowLarger(v,_):this._reflowSmaller(v,_))}_reflowLarger(v,_){const k=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const C=(0,w.reflowLargerCreateNewLayout)(this.lines,k);(0,w.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(v,_,C.countRemoved)}}_reflowLargerAdjustViewport(v,_,k){const C=this.getNullCell(S.DEFAULT_ATTR_DATA);let x=k;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new S.BufferLine(v,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(v,_){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),C=[];let x=0;for(let T=this.lines.length-1;T>=0;T--){let R=this.lines.get(T);if(!R||!R.isWrapped&&R.getTrimmedLength()<=v)continue;const M=[R];for(;R.isWrapped&&T>0;)R=this.lines.get(--T),M.unshift(R);const D=this.ybase+this.y;if(D>=T&&D<T+M.length)continue;const L=M[M.length-1].getTrimmedLength(),q=(0,w.reflowSmallerGetNewLineLengths)(M,this._cols,v),F=q.length-M.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const Q=[];for(let $=0;$<F;$++){const H=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);Q.push(H)}Q.length>0&&(C.push({start:T+M.length+x,newLines:Q}),x+=Q.length),M.push(...Q);let G=q.length-1,ee=q[G];ee===0&&(G--,ee=q[G]);let ne=M.length-F-1,z=L;for(;ne>=0;){const $=Math.min(z,ee);if(M[G]===void 0)break;if(M[G].copyCellsFrom(M[ne],z-$,ee-$,$,!0),ee-=$,ee===0&&(G--,ee=q[G]),z-=$,z===0){ne--;const H=Math.max(ne,0);z=(0,w.getWrappedLineTrimmedLength)(M,H,this._cols)}}for(let $=0;$<M.length;$++)q[$]<v&&M[$].setCell(q[$],k);let B=F-Y;for(;B-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+_-1)}if(C.length>0){const T=[],R=[];for(let G=0;G<this.lines.length;G++)R.push(this.lines.get(G));const M=this.lines.length;let D=M-1,L=0,q=C[L];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let F=0;for(let G=Math.min(this.lines.maxLength-1,M+x-1);G>=0;G--)if(q&&q.start>D+F){for(let ee=q.newLines.length-1;ee>=0;ee--)this.lines.set(G--,q.newLines[ee]);G++,T.push({index:D+1,amount:q.newLines.length}),F+=q.newLines.length,q=C[++L]}else this.lines.set(G,R[D--]);let Y=0;for(let G=T.length-1;G>=0;G--)T[G].index+=Y,this.lines.onInsertEmitter.fire(T[G]),Y+=T[G].amount;const Q=Math.max(0,M+x-this.lines.maxLength);Q>0&&this.lines.onTrimEmitter.fire(Q)}}translateBufferLineToString(v,_,k=0,C){const x=this.lines.get(v);return x?x.translateToString(_,k,C):""}getWrappedRangeForLine(v){let _=v,k=v;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:_,last:k}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===v&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const _=new y.Marker(v);return this.markers.push(_),_.register(this.lines.onTrim((k=>{_.line-=k,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((k=>{_.line>=k.index&&(_.line+=k.amount)}))),_.register(this.lines.onDelete((k=>{_.line>=k.index&&_.line<k.index+k.amount&&_.dispose(),_.line>k.index&&(_.line-=k.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const m=u(3734),g=u(511),p=u(643),S=u(482);l.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let w=0;class A{constructor(y,b,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const _=b||g.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]);for(let k=0;k<y;++k)this.setCell(k,_);this.length=y}get(y){const b=this._data[3*y+0],v=2097151&b;return[this._data[3*y+1],2097152&b?this._combined[y]:v?(0,S.stringFromCodePoint)(v):"",b>>22,2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):v]}set(y,b){this._data[3*y+1]=b[p.CHAR_DATA_ATTR_INDEX],b[p.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=b[1],this._data[3*y+0]=2097152|y|b[p.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=b[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[p.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&b}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y]:2097151&b?(0,S.stringFromCodePoint)(2097151&b):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,b){return w=3*y,b.content=this._data[w+0],b.fg=this._data[w+1],b.bg=this._data[w+2],2097152&b.content&&(b.combinedData=this._combined[y]),268435456&b.bg&&(b.extended=this._extendedAttrs[y]),b}setCell(y,b){2097152&b.content&&(this._combined[y]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[y]=b.extended),this._data[3*y+0]=b.content,this._data[3*y+1]=b.fg,this._data[3*y+2]=b.bg}setCellFromCodepoint(y,b,v,_){268435456&_.bg&&(this._extendedAttrs[y]=_.extended),this._data[3*y+0]=b|v<<22,this._data[3*y+1]=_.fg,this._data[3*y+2]=_.bg}addCodepointToCell(y,b,v){let _=this._data[3*y+0];2097152&_?this._combined[y]+=(0,S.stringFromCodePoint)(b):2097151&_?(this._combined[y]=(0,S.stringFromCodePoint)(2097151&_)+(0,S.stringFromCodePoint)(b),_&=-2097152,_|=2097152):_=b|4194304,v&&(_&=-12582913,_|=v<<22),this._data[3*y+0]=_}insertCells(y,b,v){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),b<this.length-y){const _=new g.CellData;for(let k=this.length-y-b-1;k>=0;--k)this.setCell(y+b+k,this.loadCell(y+k,_));for(let k=0;k<b;++k)this.setCell(y+k,v)}else for(let _=y;_<this.length;++_)this.setCell(_,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(y,b,v){if(y%=this.length,b<this.length-y){const _=new g.CellData;for(let k=0;k<this.length-y-b;++k)this.setCell(y+k,this.loadCell(y+b+k,_));for(let k=this.length-b;k<this.length;++k)this.setCell(k,v)}else for(let _=y;_<this.length;++_)this.setCell(_,v);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,v)}replaceCells(y,b,v,_=!1){if(_)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,v);y<b&&y<this.length;)this.isProtected(y)||this.setCell(y,v),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,v);y<b&&y<this.length;)this.setCell(y++,v)}resize(y,b){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const _=new Uint32Array(v);_.set(this._data),this._data=_}for(let _=this.length;_<y;++_)this.setCell(_,b)}else{this._data=this._data.subarray(0,v);const _=Object.keys(this._combined);for(let C=0;C<_.length;C++){const x=parseInt(_[C],10);x>=y&&delete this._combined[x]}const k=Object.keys(this._extendedAttrs);for(let C=0;C<k.length;C++){const x=parseInt(k[C],10);x>=y&&delete this._extendedAttrs[x]}}return this.length=y,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const y=new Uint32Array(this._data.length);return y.set(this._data),this._data=y,1}return 0}fill(y,b=!1){if(b)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,y);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,y)}}copyFrom(y){this.length!==y.length?this._data=new Uint32Array(y._data):this._data.set(y._data),this.length=y.length,this._combined={};for(const b in y._combined)this._combined[b]=y._combined[b];this._extendedAttrs={};for(const b in y._extendedAttrs)this._extendedAttrs[b]=y._extendedAttrs[b];this.isWrapped=y.isWrapped}clone(){const y=new A(0);y._data=new Uint32Array(this._data),y.length=this.length;for(const b in this._combined)y._combined[b]=this._combined[b];for(const b in this._extendedAttrs)y._extendedAttrs[b]=this._extendedAttrs[b];return y.isWrapped=this.isWrapped,y}getTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,b,v,_,k){const C=y._data;if(k)for(let T=_-1;T>=0;T--){for(let R=0;R<3;R++)this._data[3*(v+T)+R]=C[3*(b+T)+R];268435456&C[3*(b+T)+2]&&(this._extendedAttrs[v+T]=y._extendedAttrs[b+T])}else for(let T=0;T<_;T++){for(let R=0;R<3;R++)this._data[3*(v+T)+R]=C[3*(b+T)+R];268435456&C[3*(b+T)+2]&&(this._extendedAttrs[v+T]=y._extendedAttrs[b+T])}const x=Object.keys(y._combined);for(let T=0;T<x.length;T++){const R=parseInt(x[T],10);R>=b&&(this._combined[R-b+v]=y._combined[R])}}translateToString(y,b,v,_){b=b??0,v=v??this.length,y&&(v=Math.min(v,this.getTrimmedLength())),_&&(_.length=0);let k="";for(;b<v;){const C=this._data[3*b+0],x=2097151&C,T=2097152&C?this._combined[b]:x?(0,S.stringFromCodePoint)(x):p.WHITESPACE_CELL_CHAR;if(k+=T,_)for(let R=0;R<T.length;++R)_.push(b);b+=C>>22||1}return _&&_.push(b),k}}l.BufferLine=A},4841:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(u,m){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return m*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(h,l)=>{function u(m,g,p){if(g===m.length-1)return m[g].getTrimmedLength();const S=!m[g].hasContent(p-1)&&m[g].getWidth(p-1)===1,w=m[g+1].getWidth(0)===2;return S&&w?p-1:p}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(m,g,p,S,w){const A=[];for(let E=0;E<m.length-1;E++){let y=E,b=m.get(++y);if(!b.isWrapped)continue;const v=[m.get(E)];for(;y<m.length&&b.isWrapped;)v.push(b),b=m.get(++y);if(S>=E&&S<y){E+=v.length-1;continue}let _=0,k=u(v,_,g),C=1,x=0;for(;C<v.length;){const R=u(v,C,g),M=R-x,D=p-k,L=Math.min(M,D);v[_].copyCellsFrom(v[C],x,k,L,!1),k+=L,k===p&&(_++,k=0),x+=L,x===R&&(C++,x=0),k===0&&_!==0&&v[_-1].getWidth(p-1)===2&&(v[_].copyCellsFrom(v[_-1],p-1,k++,1,!1),v[_-1].setCell(p-1,w))}v[_].replaceCells(k,p,w);let T=0;for(let R=v.length-1;R>0&&(R>_||v[R].getTrimmedLength()===0);R--)T++;T>0&&(A.push(E+v.length-T),A.push(T)),E+=v.length-1}return A},l.reflowLargerCreateNewLayout=function(m,g){const p=[];let S=0,w=g[S],A=0;for(let E=0;E<m.length;E++)if(w===E){const y=g[++S];m.onDeleteEmitter.fire({index:E-A,amount:y}),E+=y-1,A+=y,w=g[++S]}else p.push(E);return{layout:p,countRemoved:A}},l.reflowLargerApplyNewLayout=function(m,g){const p=[];for(let S=0;S<g.length;S++)p.push(m.get(g[S]));for(let S=0;S<p.length;S++)m.set(S,p[S]);m.length=g.length},l.reflowSmallerGetNewLineLengths=function(m,g,p){const S=[],w=m.map(((b,v)=>u(m,v,g))).reduce(((b,v)=>b+v));let A=0,E=0,y=0;for(;y<w;){if(w-y<p){S.push(w-y);break}A+=p;const b=u(m,E,g);A>b&&(A-=b,E++);const v=m[E].getWidth(A-1)===2;v&&A--;const _=v?p-1:p;S.push(_),y+=_}return S},l.getWrappedLineTrimmedLength=u},5295:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const m=u(8460),g=u(844),p=u(9092);class S extends g.Disposable{constructor(A,E){super(),this._optionsService=A,this._bufferService=E,this._onBufferActivate=this.register(new m.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(A){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(A),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(A,E){this._normal.resize(A,E),this._alt.resize(A,E),this.setupTabStops(A)}setupTabStops(A){this._normal.setupTabStops(A),this._alt.setupTabStops(A)}}l.BufferSet=S},511:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const m=u(482),g=u(643),p=u(3734);class S extends p.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new p.ExtendedAttrs,this.combinedData=""}static fromCharData(A){const E=new S;return E.setFromCharData(A),E}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(A){this.fg=A[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let E=!1;if(A[g.CHAR_DATA_CHAR_INDEX].length>2)E=!0;else if(A[g.CHAR_DATA_CHAR_INDEX].length===2){const y=A[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const b=A[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(y-55296)+b-56320+65536|A[g.CHAR_DATA_WIDTH_INDEX]<<22:E=!0}else E=!0}else this.content=A[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|A[g.CHAR_DATA_WIDTH_INDEX]<<22;E&&(this.combinedData=A[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|A[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=S},643:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const m=u(8460),g=u(844);class p{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=p._nextId++,this._onDispose=this.register(new m.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}l.Marker=p,p._nextId=1},7116:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(h,l)=>{var u,m,g;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(p){p.NUL="\0",p.SOH="",p.STX="",p.ETX="",p.EOT="",p.ENQ="",p.ACK="",p.BEL="\x07",p.BS="\b",p.HT=" ",p.LF=`
495
+ `,p.VT="\v",p.FF="\f",p.CR="\r",p.SO="",p.SI="",p.DLE="",p.DC1="",p.DC2="",p.DC3="",p.DC4="",p.NAK="",p.SYN="",p.ETB="",p.CAN="",p.EM="",p.SUB="",p.ESC="\x1B",p.FS="",p.GS="",p.RS="",p.US="",p.SP=" ",p.DEL=""})(u||(l.C0=u={})),(function(p){p.PAD="€",p.HOP="",p.BPH="‚",p.NBH="ƒ",p.IND="„",p.NEL="…",p.SSA="†",p.ESA="‡",p.HTS="ˆ",p.HTJ="‰",p.VTS="Š",p.PLD="‹",p.PLU="Œ",p.RI="",p.SS2="Ž",p.SS3="",p.DCS="",p.PU1="‘",p.PU2="’",p.STS="“",p.CCH="”",p.MW="•",p.SPA="–",p.EPA="—",p.SOS="˜",p.SGCI="™",p.SCI="š",p.CSI="›",p.ST="œ",p.OSC="",p.PM="ž",p.APC="Ÿ"})(m||(l.C1=m={})),(function(p){p.ST=`${u.ESC}\\`})(g||(l.C1_ESCAPED=g={}))},7399:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const m=u(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(p,S,w,A){const E={type:0,cancel:!1,key:void 0},y=(p.shiftKey?1:0)|(p.altKey?2:0)|(p.ctrlKey?4:0)|(p.metaKey?8:0);switch(p.keyCode){case 0:p.key==="UIKeyInputUpArrow"?E.key=S?m.C0.ESC+"OA":m.C0.ESC+"[A":p.key==="UIKeyInputLeftArrow"?E.key=S?m.C0.ESC+"OD":m.C0.ESC+"[D":p.key==="UIKeyInputRightArrow"?E.key=S?m.C0.ESC+"OC":m.C0.ESC+"[C":p.key==="UIKeyInputDownArrow"&&(E.key=S?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:E.key=p.ctrlKey?"\b":m.C0.DEL,p.altKey&&(E.key=m.C0.ESC+E.key);break;case 9:if(p.shiftKey){E.key=m.C0.ESC+"[Z";break}E.key=m.C0.HT,E.cancel=!0;break;case 13:E.key=p.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,E.cancel=!0;break;case 27:E.key=m.C0.ESC,p.altKey&&(E.key=m.C0.ESC+m.C0.ESC),E.cancel=!0;break;case 37:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"D",E.key===m.C0.ESC+"[1;3D"&&(E.key=m.C0.ESC+(w?"b":"[1;5D"))):E.key=S?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"C",E.key===m.C0.ESC+"[1;3C"&&(E.key=m.C0.ESC+(w?"f":"[1;5C"))):E.key=S?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"A",w||E.key!==m.C0.ESC+"[1;3A"||(E.key=m.C0.ESC+"[1;5A")):E.key=S?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"B",w||E.key!==m.C0.ESC+"[1;3B"||(E.key=m.C0.ESC+"[1;5B")):E.key=S?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:p.shiftKey||p.ctrlKey||(E.key=m.C0.ESC+"[2~");break;case 46:E.key=y?m.C0.ESC+"[3;"+(y+1)+"~":m.C0.ESC+"[3~";break;case 36:E.key=y?m.C0.ESC+"[1;"+(y+1)+"H":S?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:E.key=y?m.C0.ESC+"[1;"+(y+1)+"F":S?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:p.shiftKey?E.type=2:p.ctrlKey?E.key=m.C0.ESC+"[5;"+(y+1)+"~":E.key=m.C0.ESC+"[5~";break;case 34:p.shiftKey?E.type=3:p.ctrlKey?E.key=m.C0.ESC+"[6;"+(y+1)+"~":E.key=m.C0.ESC+"[6~";break;case 112:E.key=y?m.C0.ESC+"[1;"+(y+1)+"P":m.C0.ESC+"OP";break;case 113:E.key=y?m.C0.ESC+"[1;"+(y+1)+"Q":m.C0.ESC+"OQ";break;case 114:E.key=y?m.C0.ESC+"[1;"+(y+1)+"R":m.C0.ESC+"OR";break;case 115:E.key=y?m.C0.ESC+"[1;"+(y+1)+"S":m.C0.ESC+"OS";break;case 116:E.key=y?m.C0.ESC+"[15;"+(y+1)+"~":m.C0.ESC+"[15~";break;case 117:E.key=y?m.C0.ESC+"[17;"+(y+1)+"~":m.C0.ESC+"[17~";break;case 118:E.key=y?m.C0.ESC+"[18;"+(y+1)+"~":m.C0.ESC+"[18~";break;case 119:E.key=y?m.C0.ESC+"[19;"+(y+1)+"~":m.C0.ESC+"[19~";break;case 120:E.key=y?m.C0.ESC+"[20;"+(y+1)+"~":m.C0.ESC+"[20~";break;case 121:E.key=y?m.C0.ESC+"[21;"+(y+1)+"~":m.C0.ESC+"[21~";break;case 122:E.key=y?m.C0.ESC+"[23;"+(y+1)+"~":m.C0.ESC+"[23~";break;case 123:E.key=y?m.C0.ESC+"[24;"+(y+1)+"~":m.C0.ESC+"[24~";break;default:if(!p.ctrlKey||p.shiftKey||p.altKey||p.metaKey)if(w&&!A||!p.altKey||p.metaKey)!w||p.altKey||p.ctrlKey||p.shiftKey||!p.metaKey?p.key&&!p.ctrlKey&&!p.altKey&&!p.metaKey&&p.keyCode>=48&&p.key.length===1?E.key=p.key:p.key&&p.ctrlKey&&(p.key==="_"&&(E.key=m.C0.US),p.key==="@"&&(E.key=m.C0.NUL)):p.keyCode===65&&(E.type=1);else{const b=g[p.keyCode],v=b==null?void 0:b[p.shiftKey?1:0];if(v)E.key=m.C0.ESC+v;else if(p.keyCode>=65&&p.keyCode<=90){const _=p.ctrlKey?p.keyCode-64:p.keyCode+32;let k=String.fromCharCode(_);p.shiftKey&&(k=k.toUpperCase()),E.key=m.C0.ESC+k}else if(p.keyCode===32)E.key=m.C0.ESC+(p.ctrlKey?m.C0.NUL:" ");else if(p.key==="Dead"&&p.code.startsWith("Key")){let _=p.code.slice(3,4);p.shiftKey||(_=_.toLowerCase()),E.key=m.C0.ESC+_,E.cancel=!0}}else p.keyCode>=65&&p.keyCode<=90?E.key=String.fromCharCode(p.keyCode-64):p.keyCode===32?E.key=m.C0.NUL:p.keyCode>=51&&p.keyCode<=55?E.key=String.fromCharCode(p.keyCode-51+27):p.keyCode===56?E.key=m.C0.DEL:p.keyCode===219?E.key=m.C0.ESC:p.keyCode===220?E.key=m.C0.FS:p.keyCode===221&&(E.key=m.C0.GS)}return E}},482:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},l.utf32ToString=function(u,m=0,g=u.length){let p="";for(let S=m;S<g;++S){let w=u[S];w>65535?(w-=65536,p+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):p+=String.fromCharCode(w)}return p},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,m){const g=u.length;if(!g)return 0;let p=0,S=0;if(this._interim){const w=u.charCodeAt(S++);56320<=w&&w<=57343?m[p++]=1024*(this._interim-55296)+w-56320+65536:(m[p++]=this._interim,m[p++]=w),this._interim=0}for(let w=S;w<g;++w){const A=u.charCodeAt(w);if(55296<=A&&A<=56319){if(++w>=g)return this._interim=A,p;const E=u.charCodeAt(w);56320<=E&&E<=57343?m[p++]=1024*(A-55296)+E-56320+65536:(m[p++]=A,m[p++]=E)}else A!==65279&&(m[p++]=A)}return p}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,m){const g=u.length;if(!g)return 0;let p,S,w,A,E=0,y=0,b=0;if(this.interim[0]){let k=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let x,T=0;for(;(x=63&this.interim[++T])&&T<4;)C<<=6,C|=x;const R=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=R-T;for(;b<M;){if(b>=g)return 0;if(x=u[b++],(192&x)!=128){b--,k=!0;break}this.interim[T++]=x,C<<=6,C|=63&x}k||(R===2?C<128?b--:m[E++]=C:R===3?C<2048||C>=55296&&C<=57343||C===65279||(m[E++]=C):C<65536||C>1114111||(m[E++]=C)),this.interim.fill(0)}const v=g-4;let _=b;for(;_<g;){for(;!(!(_<v)||128&(p=u[_])||128&(S=u[_+1])||128&(w=u[_+2])||128&(A=u[_+3]));)m[E++]=p,m[E++]=S,m[E++]=w,m[E++]=A,_+=4;if(p=u[_++],p<128)m[E++]=p;else if((224&p)==192){if(_>=g)return this.interim[0]=p,E;if(S=u[_++],(192&S)!=128){_--;continue}if(y=(31&p)<<6|63&S,y<128){_--;continue}m[E++]=y}else if((240&p)==224){if(_>=g)return this.interim[0]=p,E;if(S=u[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=p,this.interim[1]=S,E;if(w=u[_++],(192&w)!=128){_--;continue}if(y=(15&p)<<12|(63&S)<<6|63&w,y<2048||y>=55296&&y<=57343||y===65279)continue;m[E++]=y}else if((248&p)==240){if(_>=g)return this.interim[0]=p,E;if(S=u[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=p,this.interim[1]=S,E;if(w=u[_++],(192&w)!=128){_--;continue}if(_>=g)return this.interim[0]=p,this.interim[1]=S,this.interim[2]=w,E;if(A=u[_++],(192&A)!=128){_--;continue}if(y=(7&p)<<18|(63&S)<<12|(63&w)<<6|63&A,y<65536||y>1114111)continue;m[E++]=y}}return E}}},225:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const m=u(1480),g=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],p=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let S;l.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let w=0;w<g.length;++w)S.fill(0,g[w][0],g[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?S[w]:(function(A,E){let y,b=0,v=E.length-1;if(A<E[0][0]||A>E[v][1])return!1;for(;v>=b;)if(y=b+v>>1,A>E[y][1])b=y+1;else{if(!(A<E[y][0]))return!0;v=y-1}return!1})(w,p)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,A){let E=this.wcwidth(w),y=E===0&&A!==0;if(y){const b=m.UnicodeService.extractWidth(A);b===0?y=!1:b>E&&(E=b)}return m.UnicodeService.createPropertyValue(0,E,y)}}},5981:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const m=u(8460),g=u(844);class p extends g.Disposable{constructor(w){super(),this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(w,A){if(A!==void 0&&this._syncCalls>A)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let E;for(this._isSyncWriting=!0;E=this._writeBuffer.shift();){this._action(E);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,A){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(A),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(A)}_innerWrite(w=0,A=!0){const E=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],b=this._action(y,A);if(b){const _=k=>Date.now()-E>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(E,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(_)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-E>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=p},5941:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const u=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,m=/^[\da-f]+$/;function g(p,S){const w=p.toString(16),A=w.length<2?"0"+w:w;switch(S){case 4:return w[0];case 8:return A;case 12:return(A+A).slice(0,3);default:return A+A}}l.parseColor=function(p){if(!p)return;let S=p.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const w=u.exec(S);if(w){const A=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/A*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/A*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/A*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),m.exec(S)&&[3,6,9,12].includes(S.length))){const w=S.length/3,A=[0,0,0];for(let E=0;E<3;++E){const y=parseInt(S.slice(w*E,w*E+w),16);A[E]=w===1?y<<4:w===2?y:w===3?y>>4:y>>8}return A}},l.toRgbString=function(p,S=16){const[w,A,E]=p;return`rgb:${g(w,S)}/${g(A,S)}/${g(E,S)}`}},5770:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const m=u(482),g=u(8742),p=u(5770),S=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(A,E){this._handlers[A]===void 0&&(this._handlers[A]=[]);const y=this._handlers[A];return y.push(E),{dispose:()=>{const b=y.indexOf(E);b!==-1&&y.splice(b,1)}}}clearHandler(A){this._handlers[A]&&delete this._handlers[A]}setHandlerFallback(A){this._handlerFb=A}reset(){if(this._active.length)for(let A=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;A>=0;--A)this._active[A].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(A,E){if(this.reset(),this._ident=A,this._active=this._handlers[A]||S,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(E);else this._handlerFb(this._ident,"HOOK",E)}put(A,E,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(A,E,y);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(A,E,y))}unhook(A,E=!0){if(this._active.length){let y=!1,b=this._active.length-1,v=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=E,v=this._stack.fallThrough,this._stack.paused=!1),!v&&y===!1){for(;b>=0&&(y=this._active[b].unhook(A),y!==!0);b--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,y;b--}for(;b>=0;b--)if(y=this._active[b].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",A);this._active=S,this._ident=0}};const w=new g.Params;w.addParam(0),l.DcsHandler=class{constructor(A){this._handler=A,this._data="",this._params=w,this._hitLimit=!1}hook(A){this._params=A.length>1||A.params[0]?A.clone():w,this._data="",this._hitLimit=!1}put(A,E,y){this._hitLimit||(this._data+=(0,m.utf32ToString)(A,E,y),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(A){let E=!1;if(this._hitLimit)E=!1;else if(A&&(E=this._handler(this._data,this._params),E instanceof Promise))return E.then((y=>(this._params=w,this._data="",this._hitLimit=!1,y)));return this._params=w,this._data="",this._hitLimit=!1,E}}},2015:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const m=u(844),g=u(8742),p=u(6242),S=u(6351);class w{constructor(b){this.table=new Uint8Array(b)}setDefault(b,v){this.table.fill(b<<4|v)}add(b,v,_,k){this.table[v<<8|b]=_<<4|k}addMany(b,v,_,k){for(let C=0;C<b.length;C++)this.table[v<<8|b[C]]=_<<4|k}}l.TransitionTable=w;const A=160;l.VT500_TRANSITION_TABLE=(function(){const y=new w(4095),b=Array.apply(null,Array(256)).map(((T,R)=>R)),v=(T,R)=>b.slice(T,R),_=v(32,127),k=v(0,24);k.push(25),k.push.apply(k,v(28,32));const C=v(0,14);let x;for(x in y.setDefault(1,0),y.addMany(_,0,2,0),C)y.addMany([24,26,153,154],x,3,0),y.addMany(v(128,144),x,3,0),y.addMany(v(144,152),x,3,0),y.add(156,x,0,0),y.add(27,x,11,1),y.add(157,x,4,8),y.addMany([152,158,159],x,0,7),y.add(155,x,11,3),y.add(144,x,11,9);return y.addMany(k,0,3,0),y.addMany(k,1,3,1),y.add(127,1,0,1),y.addMany(k,8,0,8),y.addMany(k,3,3,3),y.add(127,3,0,3),y.addMany(k,4,3,4),y.add(127,4,0,4),y.addMany(k,6,3,6),y.addMany(k,5,3,5),y.add(127,5,0,5),y.addMany(k,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(_,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(v(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(_,7,0,7),y.addMany(k,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(v(64,127),3,7,0),y.addMany(v(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(v(48,60),4,8,4),y.addMany(v(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(v(32,64),6,0,6),y.add(127,6,0,6),y.addMany(v(64,127),6,0,0),y.addMany(v(32,48),3,9,5),y.addMany(v(32,48),5,9,5),y.addMany(v(48,64),5,0,6),y.addMany(v(64,127),5,7,0),y.addMany(v(32,48),4,9,5),y.addMany(v(32,48),1,9,2),y.addMany(v(32,48),2,9,2),y.addMany(v(48,127),2,10,0),y.addMany(v(48,80),1,10,0),y.addMany(v(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(v(96,127),1,10,0),y.add(80,1,11,9),y.addMany(k,9,0,9),y.add(127,9,0,9),y.addMany(v(28,32),9,0,9),y.addMany(v(32,48),9,9,12),y.addMany(v(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(k,11,0,11),y.addMany(v(32,128),11,0,11),y.addMany(v(28,32),11,0,11),y.addMany(k,10,0,10),y.add(127,10,0,10),y.addMany(v(28,32),10,0,10),y.addMany(v(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(v(32,48),10,9,12),y.addMany(k,12,0,12),y.add(127,12,0,12),y.addMany(v(28,32),12,0,12),y.addMany(v(32,48),12,9,12),y.addMany(v(48,64),12,0,11),y.addMany(v(64,127),12,12,13),y.addMany(v(64,127),10,12,13),y.addMany(v(64,127),9,12,13),y.addMany(k,13,13,13),y.addMany(_,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(A,0,2,0),y.add(A,8,5,8),y.add(A,6,0,6),y.add(A,11,0,11),y.add(A,13,13,13),y})();class E extends m.Disposable{constructor(b=l.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,_,k)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,_)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,m.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new p.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,v=[64,126]){let _=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=b.prefix.charCodeAt(0),_&&60>_||_>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<b.intermediates.length;++C){const x=b.intermediates.charCodeAt(C);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=x}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(v[0]>k||k>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return _<<=8,_|=k,_}identToString(b){const v=[];for(;b;)v.push(String.fromCharCode(255&b)),b>>=8;return v.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,v){const _=this._identifier(b,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const k=this._escHandlers[_];return k.push(v),{dispose:()=>{const C=k.indexOf(v);C!==-1&&k.splice(C,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,v){this._executeHandlers[b.charCodeAt(0)]=v}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,v){const _=this._identifier(b);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const k=this._csiHandlers[_];return k.push(v),{dispose:()=>{const C=k.indexOf(v);C!==-1&&k.splice(C,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,v){return this._dcsParser.registerHandler(this._identifier(b),v)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,v){return this._oscParser.registerHandler(b,v)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}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(b,v,_,k,C){this._parseStack.state=b,this._parseStack.handlers=v,this._parseStack.handlerPos=_,this._parseStack.transition=k,this._parseStack.chunkPos=C}parse(b,v,_){let k,C=0,x=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const R=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&M>-1){for(;M>=0&&(k=R[M](this._params),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 4:if(_===!1&&M>-1){for(;M>=0&&(k=R[M](),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 6:if(C=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(C!==24&&C!==26,_),k)return k;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=b[this._parseStack.chunkPos],k=this._oscParser.end(C!==24&&C!==26,_),k)return k;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let R=T;R<v;++R){switch(C=b[R],x=this._transitions.table[this.currentState<<8|(C<160?C:A)],x>>4){case 2:for(let F=R+1;;++F){if(F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,R,F),R=F-1;break}if(++F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,R,F),R=F-1;break}if(++F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,R,F),R=F-1;break}if(++F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,R,F),R=F-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:R,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|C];let D=M?M.length-1:-1;for(;D>=0&&(k=M[D](this._params),k!==!0);D--)if(k instanceof Promise)return this._preserveStack(3,M,D,x,R),k;D<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++R<v&&(C=b[R])>47&&C<60);R--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const L=this._escHandlers[this._collect<<8|C];let q=L?L.length-1:-1;for(;q>=0&&(k=L[q](),k!==!0);q--)if(k instanceof Promise)return this._preserveStack(4,L,q,x,R),k;q<0&&this._escHandlerFb(this._collect<<8|C),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|C,this._params);break;case 13:for(let F=R+1;;++F)if(F>=v||(C=b[F])===24||C===26||C===27||C>127&&C<A){this._dcsParser.put(b,R,F),R=F-1;break}break;case 14:if(k=this._dcsParser.unhook(C!==24&&C!==26),k)return this._preserveStack(6,[],0,x,R),k;C===27&&(x|=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 F=R+1;;F++)if(F>=v||(C=b[F])<32||C>127&&C<A){this._oscParser.put(b,R,F),R=F-1;break}break;case 6:if(k=this._oscParser.end(C!==24&&C!==26),k)return this._preserveStack(5,[],0,x,R),k;C===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}l.EscapeSequenceParser=E},6242:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const m=u(5770),g=u(482),p=[];l.OscParser=class{constructor(){this._state=0,this._active=p,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,w){this._handlers[S]===void 0&&(this._handlers[S]=[]);const A=this._handlers[S];return A.push(w),{dispose:()=>{const E=A.indexOf(w);E!==-1&&A.splice(E,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=p,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||p,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,w,A){if(this._active.length)for(let E=this._active.length-1;E>=0;E--)this._active[E].put(S,w,A);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(S,w,A))}start(){this.reset(),this._state=1}put(S,w,A){if(this._state!==3){if(this._state===1)for(;w<A;){const E=S[w++];if(E===59){this._state=2,this._start();break}if(E<48||57<E)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+E-48}this._state===2&&A-w>0&&this._put(S,w,A)}}end(S,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let A=!1,E=this._active.length-1,y=!1;if(this._stack.paused&&(E=this._stack.loopPosition-1,A=w,y=this._stack.fallThrough,this._stack.paused=!1),!y&&A===!1){for(;E>=0&&(A=this._active[E].end(S),A!==!0);E--)if(A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!1,A;E--}for(;E>=0;E--)if(A=this._active[E].end(!1),A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!0,A}else this._handlerFb(this._id,"END",S);this._active=p,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,w,A){this._hitLimit||(this._data+=(0,g.utf32ToString)(S,w,A),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let w=!1;if(this._hitLimit)w=!1;else if(S&&(w=this._handler(this._data),w instanceof Promise))return w.then((A=>(this._data="",this._hitLimit=!1,A)));return this._data="",this._hitLimit=!1,w}}},8742:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const u=2147483647;class m{static fromArray(p){const S=new m;if(!p.length)return S;for(let w=Array.isArray(p[0])?1:0;w<p.length;++w){const A=p[w];if(Array.isArray(A))for(let E=0;E<A.length;++E)S.addSubParam(A[E]);else S.addParam(A)}return S}constructor(p=32,S=32){if(this.maxLength=p,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const p=new m(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){const p=[];for(let S=0;S<this.length;++S){p.push(this.params[S]);const w=this._subParamsIdx[S]>>8,A=255&this._subParamsIdx[S];A-w>0&&p.push(Array.prototype.slice.call(this._subParams,w,A))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>u?u:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>u?u:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){const S=this._subParamsIdx[p]>>8,w=255&this._subParamsIdx[p];return w-S>0?this._subParams.subarray(S,w):null}getSubParamsAll(){const p={};for(let S=0;S<this.length;++S){const w=this._subParamsIdx[S]>>8,A=255&this._subParamsIdx[S];A-w>0&&(p[S]=this._subParams.slice(w,A))}return p}addDigit(p){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,A=w[S-1];w[S-1]=~A?Math.min(10*A+p,u):p}}l.Params=m},5741:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,m){const g={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(g),m.dispose=()=>this._wrappedAddonDispose(g),m.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let m=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===u){m=g;break}if(m===-1)throw new Error("Could not dispose an addon that has not been loaded");u.isDisposed=!0,u.dispose.apply(u.instance),this._addons.splice(m,1)}}},8771:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const m=u(3785),g=u(511);l.BufferApiView=class{constructor(p,S){this._buffer=p,this.type=S}init(p){return this._buffer=p,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(p){const S=this._buffer.lines.get(p);if(S)return new m.BufferLineApiView(S)}getNullCell(){return new g.CellData}}},3785:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const m=u(511);l.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,p){if(!(g<0||g>=this._line.length))return p?(this._line.loadCell(g,p),p):this._line.loadCell(g,new m.CellData)}translateToString(g,p,S){return this._line.translateToString(g,p,S)}}},8285:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const m=u(8771),g=u(8460),p=u(844);class S extends p.Disposable{constructor(A){super(),this._core=A,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new m.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new m.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=S},7975:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,m){return this._core.registerCsiHandler(u,(g=>m(g.toArray())))}addCsiHandler(u,m){return this.registerCsiHandler(u,m)}registerDcsHandler(u,m){return this._core.registerDcsHandler(u,((g,p)=>m(g,p.toArray())))}addDcsHandler(u,m){return this.registerDcsHandler(u,m)}registerEscHandler(u,m){return this._core.registerEscHandler(u,m)}addEscHandler(u,m){return this.registerEscHandler(u,m)}registerOscHandler(u,m){return this._core.registerOscHandler(u,m)}addOscHandler(u,m){return this.registerOscHandler(u,m)}}},7090:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(h,l,u){var m=this&&this.__decorate||function(y,b,v,_){var k,C=arguments.length,x=C<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,v):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(y,b,v,_);else for(var T=y.length-1;T>=0;T--)(k=y[T])&&(x=(C<3?k(x):C>3?k(b,v,x):k(b,v))||x);return C>3&&x&&Object.defineProperty(b,v,x),x},g=this&&this.__param||function(y,b){return function(v,_){b(v,_,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const p=u(8460),S=u(844),w=u(5295),A=u(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let E=l.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(y){super(),this.isUserScrolling=!1,this._onResize=this.register(new p.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(y.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(y,this))}resize(y,b){this.cols=y,this.rows=b,this.buffers.resize(y,b),this._onResize.fire({cols:y,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,b=!1){const v=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===y.fg&&_.getBg(0)===y.bg||(_=v.getBlankLine(y,b),this._cachedBlankLine=_),_.isWrapped=b;const k=v.ybase+v.scrollTop,C=v.ybase+v.scrollBottom;if(v.scrollTop===0){const x=v.lines.isFull;C===v.lines.length-1?x?v.lines.recycle().copyFrom(_):v.lines.push(_.clone()):v.lines.splice(C+1,0,_.clone()),x?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const x=C-k+1;v.lines.shiftElements(k+1,x-1,-1),v.lines.set(C,_.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(y,b,v){const _=this.buffer;if(y<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else y+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const k=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+y,_.ybase),0),k!==_.ydisp&&(b||this._onScroll.fire(_.ydisp))}};l.BufferService=E=m([g(0,A.IOptionsService)],E)},7994:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,m){this._charsets[u]=m,this.glevel===u&&(this.charset=m)}}},1753:function(h,l,u){var m=this&&this.__decorate||function(_,k,C,x){var T,R=arguments.length,M=R<3?k:x===null?x=Object.getOwnPropertyDescriptor(k,C):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,C,x);else for(var D=_.length-1;D>=0;D--)(T=_[D])&&(M=(R<3?T(M):R>3?T(k,C,M):T(k,C))||M);return R>3&&M&&Object.defineProperty(k,C,M),M},g=this&&this.__param||function(_,k){return function(C,x){k(C,x,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const p=u(2585),S=u(8460),w=u(844),A={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function E(_,k){let C=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(C|=64,C|=_.action):(C|=3&_.button,4&_.button&&(C|=64),8&_.button&&(C|=128),_.action===32?C|=32:_.action!==0||k||(C|=3)),C}const y=String.fromCharCode,b={DEFAULT:_=>{const k=[E(_,!1)+32,_.col+32,_.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${y(k[0])}${y(k[1])}${y(k[2])}`},SGR:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${E(_,!0)};${_.col};${_.row}${k}`},SGR_PIXELS:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${E(_,!0)};${_.x};${_.y}${k}`}};let v=l.CoreMouseService=class extends w.Disposable{constructor(_,k){super(),this._bufferService=_,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const C of Object.keys(A))this.addProtocol(C,A[C]);for(const C of Object.keys(b))this.addEncoding(C,b[C]);this.reset()}addProtocol(_,k){this._protocols[_]=k}addEncoding(_,k){this._encodings[_]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const k=this._encodings[this._activeEncoding](_);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,k,C){if(C){if(_.x!==k.x||_.y!==k.y)return!1}else if(_.col!==k.col||_.row!==k.row)return!1;return _.button===k.button&&_.action===k.action&&_.ctrl===k.ctrl&&_.alt===k.alt&&_.shift===k.shift}};l.CoreMouseService=v=m([g(0,p.IBufferService),g(1,p.ICoreService)],v)},6975:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var x,T=arguments.length,R=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(x=v[M])&&(R=(T<3?x(R):T>3?x(_,k,R):x(_,k))||R);return T>3&&R&&Object.defineProperty(_,k,R),R},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const p=u(1439),S=u(8460),w=u(844),A=u(2585),E=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends w.Disposable{constructor(v,_,k){super(),this._bufferService=v,this._logService=_,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,p.clone)(E),this.decPrivateModes=(0,p.clone)(y)}reset(){this.modes=(0,p.clone)(E),this.decPrivateModes=(0,p.clone)(y)}triggerDataEvent(v,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(v))}};l.CoreService=b=m([g(0,A.IBufferService),g(1,A.ILogService),g(2,A.IOptionsService)],b)},9074:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const m=u(8055),g=u(8460),p=u(844),S=u(6106);let w=0,A=0;class E extends p.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((v=>v==null?void 0:v.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,p.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const _=new y(v);if(_){const k=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),k.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,_,k){let C=0,x=0;for(const T of this._decorations.getKeyIterator(_))C=T.options.x??0,x=C+(T.options.width??1),v>=C&&v<x&&(!k||(T.options.layer??"bottom")===k)&&(yield T)}forEachDecorationAtCell(v,_,k,C){this._decorations.forEachByKey(_,(x=>{w=x.options.x??0,A=w+(x.options.width??1),v>=w&&v<A&&(!k||(x.options.layer??"bottom")===k)&&C(x)}))}}l.DecorationService=E;class y extends p.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=m.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=m.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const m=u(2585),g=u(8343);class p{constructor(...w){this._entries=new Map;for(const[A,E]of w)this.set(A,E)}set(w,A){const E=this._entries.get(w);return this._entries.set(w,A),E}forEach(w){for(const[A,E]of this._entries.entries())w(A,E)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}l.ServiceCollection=p,l.InstantiationService=class{constructor(){this._services=new p,this._services.set(m.IInstantiationService,this)}setService(S,w){this._services.set(S,w)}getService(S){return this._services.get(S)}createInstance(S,...w){const A=(0,g.getServiceDependencies)(S).sort(((b,v)=>b.index-v.index)),E=[];for(const b of A){const v=this._services.get(b.id);if(!v)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);E.push(v)}const y=A.length>0?A[0].index:w.length;if(w.length!==y)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${y+1} conflicts with ${w.length} static arguments`);return new S(...w,...E)}}},7866:function(h,l,u){var m=this&&this.__decorate||function(y,b,v,_){var k,C=arguments.length,x=C<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,v):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(y,b,v,_);else for(var T=y.length-1;T>=0;T--)(k=y[T])&&(x=(C<3?k(x):C>3?k(b,v,x):k(b,v))||x);return C>3&&x&&Object.defineProperty(b,v,x),x},g=this&&this.__param||function(y,b){return function(v,_){b(v,_,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const p=u(844),S=u(2585),w={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let A,E=l.LogService=class extends p.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),A=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let b=0;b<y.length;b++)typeof y[b]=="function"&&(y[b]=y[b]())}_log(y,b,v){this._evalLazyOptionalParams(v),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...v)}trace(y,...b){var v;this._logLevel<=S.LogLevelEnum.TRACE&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.trace.bind(this._optionsService.options.logger))??console.log,y,b)}debug(y,...b){var v;this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.debug.bind(this._optionsService.options.logger))??console.log,y,b)}info(y,...b){var v;this._logLevel<=S.LogLevelEnum.INFO&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.info.bind(this._optionsService.options.logger))??console.info,y,b)}warn(y,...b){var v;this._logLevel<=S.LogLevelEnum.WARN&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.warn.bind(this._optionsService.options.logger))??console.warn,y,b)}error(y,...b){var v;this._logLevel<=S.LogLevelEnum.ERROR&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.error.bind(this._optionsService.options.logger))??console.error,y,b)}};l.LogService=E=m([g(0,S.IOptionsService)],E),l.setTraceLogger=function(y){A=y},l.traceCall=function(y,b,v){if(typeof v.value!="function")throw new Error("not supported");const _=v.value;v.value=function(...k){if(A.logLevel!==S.LogLevelEnum.TRACE)return _.apply(this,k);A.trace(`GlyphRenderer#${_.name}(${k.map((x=>JSON.stringify(x))).join(", ")})`);const C=_.apply(this,k);return A.trace(`GlyphRenderer#${_.name} return`,C),C}}},7302:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const m=u(8460),g=u(844),p=u(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class w extends g.Disposable{constructor(E){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...l.DEFAULT_OPTIONS};for(const b in E)if(b in y)try{const v=E[b];y[b]=this._sanitizeAndValidateOption(b,v)}catch(v){console.error(v)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(E,y){return this.onOptionChange((b=>{b===E&&y(this.rawOptions[E])}))}onMultipleOptionChange(E,y){return this.onOptionChange((b=>{E.indexOf(b)!==-1&&y()}))}_setupOptions(){const E=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},y=(b,v)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);v=this._sanitizeAndValidateOption(b,v),this.rawOptions[b]!==v&&(this.rawOptions[b]=v,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const v={get:E.bind(this,b),set:y.bind(this,b)};Object.defineProperty(this.options,b,v)}}_sanitizeAndValidateOption(E,y){switch(E){case"cursorStyle":if(y||(y=l.DEFAULT_OPTIONS[E]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${E}`);break;case"wordSeparator":y||(y=l.DEFAULT_OPTIONS[E]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=S.includes(y)?y:l.DEFAULT_OPTIONS[E];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${E} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${E} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${E} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${E} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}l.OptionsService=w},2660:function(h,l,u){var m=this&&this.__decorate||function(w,A,E,y){var b,v=arguments.length,_=v<3?A:y===null?y=Object.getOwnPropertyDescriptor(A,E):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(w,A,E,y);else for(var k=w.length-1;k>=0;k--)(b=w[k])&&(_=(v<3?b(_):v>3?b(A,E,_):b(A,E))||_);return v>3&&_&&Object.defineProperty(A,E,_),_},g=this&&this.__param||function(w,A){return function(E,y){A(E,y,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const p=u(2585);let S=l.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const A=this._bufferService.buffer;if(w.id===void 0){const k=A.addMarker(A.ybase+A.y),C={data:w,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(C,k))),this._dataByLinkId.set(C.id,C),C.id}const E=w,y=this._getEntryIdKey(E),b=this._entriesWithId.get(y);if(b)return this.addLineToLink(b.id,A.ybase+A.y),b.id;const v=A.addMarker(A.ybase+A.y),_={id:this._nextId++,key:this._getEntryIdKey(E),data:E,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(_,v))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(w,A){const E=this._dataByLinkId.get(w);if(E&&E.lines.every((y=>y.line!==A))){const y=this._bufferService.buffer.addMarker(A);E.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(E,y)))}}getLinkData(w){var A;return(A=this._dataByLinkId.get(w))==null?void 0:A.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,A){const E=w.lines.indexOf(A);E!==-1&&(w.lines.splice(E,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};l.OscLinkService=S=m([g(0,p.IBufferService)],S)},8343:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const u="di$target",m="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(g){return g[m]||[]},l.createDecorator=function(g){if(l.serviceRegistry.has(g))return l.serviceRegistry.get(g);const p=function(S,w,A){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,y,b){y[u]===y?y[m].push({id:E,index:b}):(y[m]=[{id:E,index:b}],y[u]=y)})(p,S,A)};return p.toString=()=>g,l.serviceRegistry.set(g,p),p}},2585:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const m=u(8343);var g;l.IBufferService=(0,m.createDecorator)("BufferService"),l.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),l.ICoreService=(0,m.createDecorator)("CoreService"),l.ICharsetService=(0,m.createDecorator)("CharsetService"),l.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(p){p[p.TRACE=0]="TRACE",p[p.DEBUG=1]="DEBUG",p[p.INFO=2]="INFO",p[p.WARN=3]="WARN",p[p.ERROR=4]="ERROR",p[p.OFF=5]="OFF"})(g||(l.LogLevelEnum=g={})),l.ILogService=(0,m.createDecorator)("LogService"),l.IOptionsService=(0,m.createDecorator)("OptionsService"),l.IOscLinkService=(0,m.createDecorator)("OscLinkService"),l.IUnicodeService=(0,m.createDecorator)("UnicodeService"),l.IDecorationService=(0,m.createDecorator)("DecorationService")},1480:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const m=u(8460),g=u(225);class p{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,A,E=!1){return(16777215&w)<<3|(3&A)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const w=new g.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let A=0,E=0;const y=w.length;for(let b=0;b<y;++b){let v=w.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=y)return A+this.wcwidth(v);const C=w.charCodeAt(b);56320<=C&&C<=57343?v=1024*(v-55296)+C-56320+65536:A+=this.wcwidth(C)}const _=this.charProperties(v,E);let k=p.extractWidth(_);p.extractShouldJoin(_)&&(k-=p.extractWidth(E)),A+=k,E=_}return A}charProperties(w,A){return this._activeProvider.charProperties(w,A)}}l.UnicodeService=p}},r={};function o(h){var l=r[h];if(l!==void 0)return l.exports;var u=r[h]={exports:{}};return n[h].call(u.exports,u,u.exports,o),u.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;const l=o(9042),u=o(3236),m=o(844),g=o(5741),p=o(8285),S=o(7975),w=o(7090),A=["cols","rows"];class E extends m.Disposable{constructor(b){super(),this._core=this.register(new u.Terminal(b)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const v=k=>this._core.options[k],_=(k,C)=>{this._checkReadonlyOptions(k),this._core.options[k]=C};for(const k in this._core.options){const C={get:v.bind(this,k),set:_.bind(this,k)};Object.defineProperty(this._publicOptions,k,C)}}_checkReadonlyOptions(b){if(A.includes(b))throw new Error(`Option "${b}" 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 S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new p.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const v in b)this._publicOptions[v]=b[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,v=!0){this._core.input(b,v)}resize(b,v){this._verifyIntegers(b,v),this._core.resize(b,v)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,v,_){this._verifyIntegers(b,v,_),this._core.select(b,v,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,v){this._verifyIntegers(b,v),this._core.selectLines(b,v)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,v){this._core.write(b,v)}writeln(b,v){this._core.write(b),this._core.write(`\r
496
+ `,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}h.Terminal=E})(),c})()))})(pg)),pg.exports}var $6=M6(),mg={exports:{}},Sx;function D6(){return Sx||(Sx=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const c=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(c._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,c=o._renderService.dimensions;if(c.css.cell.width===0||c.css.cell.height===0)return;const h=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(l.getPropertyValue("height")),m=Math.max(0,parseInt(l.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),p=u-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),S=m-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(S/c.css.cell.width)),rows:Math.max(1,Math.floor(p/c.css.cell.height))}}}})(),n})()))})(mg)),mg.exports}var O6=D6(),gg={exports:{}},wx;function L6(){return wx||(wx=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(h,l)=>{function u(g){try{const p=new URL(g),S=p.password&&p.username?`${p.protocol}//${p.username}:${p.password}@${p.host}`:p.username?`${p.protocol}//${p.username}@${p.host}`:`${p.protocol}//${p.host}`;return g.toLocaleLowerCase().startsWith(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(g,p,S,w={}){this._terminal=g,this._regex=p,this._handler=S,this._options=w}provideLinks(g,p){const S=m.computeLink(g,this._regex,this._terminal,this._handler);p(this._addCallbacks(S))}_addCallbacks(g){return g.map((p=>(p.leave=this._options.leave,p.hover=(S,w)=>{if(this._options.hover){const{range:A}=p;this._options.hover(S,w,A)}},p)))}};class m{static computeLink(p,S,w,A){const E=new RegExp(S.source,(S.flags||"")+"g"),[y,b]=m._getWindowedLineStrings(p-1,w),v=y.join("");let _;const k=[];for(;_=E.exec(v);){const C=_[0];if(!u(C))continue;const[x,T]=m._mapStrIdx(w,b,0,_.index),[R,M]=m._mapStrIdx(w,x,T,C.length);if(x===-1||T===-1||R===-1||M===-1)continue;const D={start:{x:T+1,y:x+1},end:{x:M,y:R+1}};k.push({range:D,text:C,activate:A})}return k}static _getWindowedLineStrings(p,S){let w,A=p,E=p,y=0,b="";const v=[];if(w=S.buffer.active.getLine(p)){const _=w.translateToString(!0);if(w.isWrapped&&_[0]!==" "){for(y=0;(w=S.buffer.active.getLine(--A))&&y<2048&&(b=w.translateToString(!0),y+=b.length,v.push(b),w.isWrapped&&b.indexOf(" ")===-1););v.reverse()}for(v.push(_),y=0;(w=S.buffer.active.getLine(++E))&&w.isWrapped&&y<2048&&(b=w.translateToString(!0),y+=b.length,v.push(b),b.indexOf(" ")===-1););}return[v,A]}static _mapStrIdx(p,S,w,A){const E=p.buffer.active,y=E.getNullCell();let b=w;for(;A;){const v=E.getLine(S);if(!v)return[-1,-1];for(let _=b;_<v.length;++_){v.getCell(_,y);const k=y.getChars();if(y.getWidth()&&(A-=k.length||1,_===v.length-1&&k==="")){const C=E.getLine(S+1);C&&C.isWrapped&&(C.getCell(0,y),y.getWidth()===2&&(A+=1))}if(A<0)return[S,_]}S++,b=0}return[S,b]}}l.LinkComputer=m}},r={};function o(h){var l=r[h];if(l!==void 0)return l.exports;var u=r[h]={exports:{}};return n[h](u,u.exports,o),u.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const l=o(6),u=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(g,p){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=p}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(g=m,p={}){this._handler=g,this._options=p}activate(g){this._terminal=g;const p=this._options,S=p.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,S,this._handler,p))}dispose(){var g;(g=this._linkProvider)==null||g.dispose()}}})(),c})()))})(gg)),gg.exports}var I6=L6();const P6=/^[A-Za-z0-9_\-./~:\\]+$/,B6=/^[A-Za-z]:[\\/]/;function H2(e){return P6.test(e)?e:B6.test(e)?`"${e}"`:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function z6(e){const t=e.filter(n=>n.length>0);return t.length===0?null:t.map(H2).join(" ")+" "}function H6(e,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}&token=${encodeURIComponent(t)}`}const U6=15e3,F6=new Set([4001,4004]),q6='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function xh(e,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}const V6={black:"#1a1a1e",red:"#e88a84",green:"#6be195",yellow:"#e6b96f",blue:"#6f9ae0",magenta:"#b7a6dd",cyan:"#74c8d4",white:"#e8e8ec",brightBlack:"#565661",brightRed:"#f4a7a1",brightGreen:"#8ceab0",brightYellow:"#f2cf93",brightBlue:"#8fb5ea",brightMagenta:"#ccbdf0",brightCyan:"#97dce7",brightWhite:"#ffffff"},G6={black:"#3a3a3e",red:"#c0392b",green:"#167e3a",yellow:"#a86414",blue:"#4f7cc4",magenta:"#7a4fb0",cyan:"#0e7d94",white:"#a6a6ae",brightBlack:"#6b6b75",brightRed:"#d64a3d",brightGreen:"#1f9a4a",brightYellow:"#c67d1a",brightBlue:"#6f9ae0",brightMagenta:"#9268c4",brightCyan:"#1596ad",brightWhite:"#ffffff"};function xx(e){const t=xh("--bg",e==="dark"?"#0b0e13":"#f8f9fa"),n=xh("--ink",e==="dark"?"#f3f3f5":"#16161a"),r=xh("--brand",e==="dark"?"#6be195":"#167e3a");return{...e==="dark"?V6:G6,background:t,foreground:n,cursor:r,cursorAccent:t,selectionBackground:`${r}40`}}const W6=({sessionId:e,token:t})=>{const n=O.useRef(null),r=O.useRef(null),[o,c]=O.useState("connecting"),[h,l]=O.useState(null);return O.useEffect(()=>Nv(u=>{r.current&&(r.current.options.theme=xx(u))}),[]),O.useEffect(()=>{var C;const u=n.current;if(!u)return;let m=!1,g=0,p=null,S=null;const w=new $6.Terminal({cursorBlink:!0,fontSize:13,fontFamily:xh("--mono",q6),theme:xx(nf()),scrollback:1e4,allowProposedApi:!0});r.current=w;const A=new O6.FitAddon;w.loadAddon(A),w.loadAddon(new I6.WebLinksAddon((x,T)=>{window.open(T,"_blank","noopener,noreferrer")})),w.parser.registerCsiHandler({prefix:">",final:"q"},()=>(w.write("\x1BP>|XTerm(370)\x1B\\"),!0)),w.parser.registerOscHandler(52,x=>{var M;const T=x.split(";");if(T.length<2)return!1;const R=T[T.length-1];try{const D=atob(R),L=Uint8Array.from(D,F=>F.charCodeAt(0)),q=new TextDecoder().decode(L);(M=navigator.clipboard)==null||M.writeText(q).catch(()=>{})}catch{}return!0}),w.open(u),A.fit(),(C=document.fonts)==null||C.ready.then(()=>{m||(A.fit(),y())});const E=w.onData(x=>{(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(x)}),y=()=>{(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(JSON.stringify({type:"resize",cols:w.cols,rows:w.rows}))},b=new ResizeObserver(()=>{A.fit(),y()});b.observe(u);const v=x=>{var T;(T=x.dataTransfer)!=null&&T.types.includes("Files")&&(x.preventDefault(),x.dataTransfer.dropEffect="copy")},_=x=>{var D,L;const T=(D=x.dataTransfer)==null?void 0:D.files;if(!T||T.length===0)return;x.preventDefault();const R=(L=pr())==null?void 0:L.pathForFile;if(!R)return;const M=z6(Array.from(T,q=>R(q)));M!==null&&(w.paste(M),w.focus())};u.addEventListener("dragover",v),u.addEventListener("drop",_);function k(){if(m)return;const x=new WebSocket(H6(e,t));S=x,x.onopen=()=>{g=0,c("connected"),l(null),A.fit(),y()},x.onmessage=T=>{const R=typeof T.data=="string"?T.data:new TextDecoder().decode(T.data);w.write(R)},x.onclose=T=>{if(m)return;if(F6.has(T.code)){c("error"),l(T.reason||`Connection refused (${T.code})`);return}const R=Math.min(1e3*2**g,U6);g+=1,c("connecting"),p=setTimeout(k,R)}}return k(),()=>{m=!0,p&&clearTimeout(p),u.removeEventListener("dragover",v),u.removeEventListener("drop",_),b.disconnect(),E.dispose(),S==null||S.close(),w.dispose(),r.current=null}},[e,t]),d.jsx("div",{className:"harness-terminal",...Dt({surface:"terminal"}),children:d.jsx("div",{ref:n,className:"terminal-screen"})})},K6=8e3,Y6=400,X6={info:"Info",success:"CircleCheck",error:"TriangleAlert"};function J6({message:e,tone:t="error",onDismiss:n}){const[r,o]=O.useState(!1),[c,h]=O.useState(!1),l=O.useCallback(()=>o(!0),[]);return O.useEffect(()=>{o(!1)},[e]),O.useEffect(()=>{if(r||c)return;const u=window.setTimeout(l,K6);return()=>window.clearTimeout(u)},[e,r,c,l]),O.useEffect(()=>{if(!r)return;const u=window.setTimeout(n,Y6);return()=>window.clearTimeout(u)},[r,n]),d.jsxs("div",{className:r?"toast is-leaving":"toast",role:"alert","data-tone":t,"data-testid":"toast",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),onFocus:()=>h(!0),onBlur:()=>h(!1),onAnimationEnd:r?n:void 0,children:[d.jsx("span",{className:"toast-icon","aria-hidden":"true",children:d.jsx(ue,{name:X6[t],size:16})}),d.jsx("span",{className:"toast-message",children:e}),d.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:l,children:d.jsx(ue,{name:"X",size:14})})]},e)}function Z6(){const e=O.useRef(null);return O.useEffect(()=>{const t=e.current;if(!t)return;let n=null;const r=()=>{n=null,t.dataset.show="false",t.textContent=""},o=l=>{const u=l.closest("[data-tooltip], [title], [data-tip-stash]");if(!u||u===n)return;const m=u;m.title&&(m.dataset.tipStash=m.title,m.removeAttribute("title"));const g=m.dataset.tooltip||m.dataset.tipStash;if(!g)return;n=u,t.textContent=g,t.dataset.show="true";const p=u.getBoundingClientRect(),{offsetWidth:S,offsetHeight:w}=t,A=u.closest(".rail-workflows");if(A&&A.getBoundingClientRect().right+S+14<=window.innerWidth){const b=A.getBoundingClientRect().right+8,v=Math.min(Math.max(p.top+p.height/2-w/2,6),window.innerHeight-w-6);t.style.transform=`translate(${Math.round(b)}px, ${Math.round(v)}px)`;return}const E=Math.min(Math.max(p.left+p.width/2-S/2,6),window.innerWidth-S-6),y=p.top-w-7>=4?p.top-w-7:p.bottom+7;t.style.transform=`translate(${Math.round(E)}px, ${Math.round(y)}px)`},c=l=>o(l.target),h=l=>{n&&!n.contains(l.relatedTarget)&&r()};return document.addEventListener("pointerover",c,!0),document.addEventListener("pointerout",h,!0),document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0),document.addEventListener("scroll",r,!0),window.addEventListener("blur",r),()=>{document.removeEventListener("pointerover",c,!0),document.removeEventListener("pointerout",h,!0),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0),document.removeEventListener("scroll",r,!0),window.removeEventListener("blur",r)}},[]),d.jsx("div",{ref:e,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const Q6="~/.sapiom/harness",eL={events:`${Q6}/events.ndjson`},sh=10*1024*1024,yv=50*1024*1024,tL=["claude-code","codex"],l_=["vscode","vscode-insiders","cursor","windsurf","zed"],sL=[{id:"claude-code",label:"Claude Code",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:""},{id:"codex",label:"Codex CLI",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:""}];function nL(e){const t=e.filter(n=>n.id==="sapiom");return t.length===0?e:[...t,...e.filter(n=>n.id!=="sapiom")]}function c_(e){return e.mode==="embedded"&&e.installed&&tL.includes(e.id)}function iL(e){if(c_(e))return null;if(e.mode==="external")return`${e.label} runs in its own app. Agent Studio can't launch it yet.`;if(!e.installed){const t=e.installMcpPrompt.trim();return t.length>0?t:`${e.label} isn't on this machine's PATH. Install its CLI, then restart the Agent Studio server.`}return`This Agent Studio build can't launch ${e.label} yet.`}function rL(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.label)??t}function aL(e){return e.name||"pasted-file"}function oL(e,t){const n=[];for(let o=0;o<e.length;o+=32768)n.push(String.fromCharCode(...e.subarray(o,o+32768)));return`data:${t};base64,${btoa(n.join(""))}`}async function lL(e){const t=new Uint8Array(e.byteLength);t.set(e);const n=await crypto.subtle.digest("SHA-256",t.buffer);return Array.from(new Uint8Array(n),r=>r.toString(16).padStart(2,"0")).join("")}async function cL(e,t,n=yv){const r=[],o=[];let c=0;for(const h of e){const l=aL(h);let u="";try{u=(t==null?void 0:t(h))??""}catch{}if(u){r.push({id:crypto.randomUUID(),kind:"path",name:l,path:u});continue}if(h.size>sh){o.push(`${l} is too large to paste (${h.size} bytes; limit ${sh} bytes).`);continue}if(c+h.size>n){o.push(`${l} would exceed the ${yv}-byte pasted-file limit for one session.`);continue}try{const m=h.type||"application/octet-stream",g=new Uint8Array(await h.arrayBuffer());if(g.byteLength>sh){o.push(`${l} is too large to paste (${g.byteLength} bytes; limit ${sh} bytes).`);continue}r.push({id:crypto.randomUUID(),kind:"inline",name:l,mediaType:m,bytes:g.byteLength,dataUrl:oL(g,m),fingerprint:await lL(g)}),c+=g.byteLength}catch{o.push(`Couldn't read ${l}.`)}}return{attachments:r,errors:o}}function Cx(e){return e.kind==="path"?`path:${e.path}`:`inline:${e.fingerprint}`}function uL(e,t){const n=new Set(e.map(Cx)),r=[...e];for(const o of t){const c=Cx(o);n.has(c)||(n.add(c),r.push(o))}return r}async function dL(e,t,n){const r=[];for(const o of t){if(o.kind==="path"){r.push({name:o.name,path:o.path});continue}try{const c=await n(e,{dataUrl:o.dataUrl,filename:o.name});r.push({name:o.name,path:c.path})}catch(c){const h=c.message;throw new Error(`Couldn't attach ${o.name}${h?`: ${h}`:"."}`,{cause:c})}}return r}function hL(e,t){const n=e.trim();if(t.length===0)return n||void 0;const o=`Attached files (read each as context):
497
+ ${t.map(c=>H2(c.path)).join(`
498
+ `)}`;return n?`${n}
499
+
500
+ ${o}`:o}function vg(e){return La(e)}async function fL(e,t,n){const r=vg(e.trim());if(!r)return{kind:"new"};if(t)return{kind:"new"};const o=U$(r);try{const c=o?await n(o):null;if(!!(c!=null&&c.dirs.some(m=>vg(m.path)===r&&m.hasAgentProject)))return{kind:"project"};const l=await n(r);if(vg(l.path)!==r)return{kind:"new"};const u=l.dirs.filter(m=>m.hasAgentProject).length;return u>0?{kind:"multi",directChildren:u}:{kind:"plain"}}catch{if(o)try{return await n(o),{kind:"new"}}catch{throw new Error("Couldn't read that directory.")}throw new Error("Couldn't read that directory.")}}function u_({mode:e="detect",recentDirs:t,launchDir:n,projectRoot:r,listDir:o,onClose:c,onConnect:h,onOpenProject:l,onScan:u,triggerRef:m}){const[g,p]=O.useState(r??n??t[0]??""),[S,w]=O.useState(null),[A,E]=O.useState(!0),[y,b]=O.useState(!1),[v,_]=O.useState(null),[k,C]=O.useState(!1),x=O.useRef(null);za(!0,{onDismiss:c,containerRef:x,triggerRef:m}),O.useEffect(()=>{E(!0),C(!1)},[g]);const T=O.useRef(g);T.current=g;const R=O.useRef(0),M=O.useCallback(z=>{const B=T.current.trim(),$=++R.current;if(!B){w(null),E(!1);return}fL(B,z.isNew,o).then(H=>{$===R.current&&(w(H),_(null))}).catch(H=>{$===R.current&&(w(null),_(H.message))}).finally(()=>{$===R.current&&E(!1)})},[o]),D=async z=>{b(!0),_(null);try{await z(),c()}catch(B){_(B.message)}finally{b(!1)}},L=g.trim(),q=S!=null&&S.kind!=="new"&&L!=="",F=l!=null&&!!S&&(S==null?void 0:S.kind)!=="new"&&L!=="",Y=()=>void D(()=>h(L)),Q=()=>{if(k){D(async()=>{if(await u(L)===0)throw new Error("No agent projects found under this folder.")});return}C(!0)},G=()=>void D(async()=>{await(l==null?void 0:l(L)),(S==null?void 0:S.kind)==="project"&&await h(L)}),ee=()=>{if(!(y||A||!S||!L)){if(e==="open"){F&&G();return}S.kind==="project"?Y():q&&Q()}},ne=z=>{z.key==="Enter"&&(z.metaKey||z.ctrlKey)&&(z.preventDefault(),ee())};return d.jsx("div",{className:"modal-backdrop",children:d.jsxs("div",{className:"modal modal-start",role:"dialog","aria-label":e==="open"?"Add a project":"Add existing agents",ref:x,onKeyDown:ne,...Dt({dialog:"add_agents"}),children:[d.jsxs("div",{className:"modal-header modal-start-header",children:[d.jsx("span",{className:"modal-start-title",children:e==="open"?"Add a project":"Add existing agents"}),d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:c,children:d.jsx(ue,{name:"X",size:14})})]}),d.jsxs("div",{className:"modal-body",children:[d.jsx("p",{className:"modal-field-hint modal-start-sub",children:e==="open"?"Pick a folder to work in. It doesn't need an agent yet — agents (sapiom.json) anywhere inside it appear under it automatically.":"Add a folder that already holds an agent project."}),d.jsx("section",{className:"modal-section",children:d.jsx(P2,{value:g,onChange:p,onSubmit:ee,recentDirs:[],listDir:o,onResolve:M})}),S&&d.jsx(pL,{outcome:S,path:L}),v&&d.jsx("div",{className:"modal-error",children:v})]}),d.jsxs("div",{className:"modal-actions modal-start-actions",children:[d.jsx("button",{className:"btn-ghost",onClick:c,disabled:y,children:"Cancel"}),d.jsx(mL,{mode:e,outcome:S,checking:A,busy:y,canOpen:F,canScan:q,armed:k,onConnect:Y,onScan:Q,onOpen:G})]})]})})}function pL({outcome:e,path:t}){const n=e.kind==="project"||e.kind==="multi";return d.jsx("div",{className:"aw-result","data-tone":n?"good":"todo","data-testid":"aw-result","aria-live":"polite",children:d.jsxs("div",{className:"aw-result-head",children:[d.jsx("span",{className:"aw-result-glyph","aria-hidden":"true",children:d.jsx(ue,{name:n?"Check":"TriangleAlert",size:14})}),d.jsxs("span",{className:"aw-result-text",children:[d.jsxs("span",{className:"aw-result-title",children:[e.kind==="project"&&"This is an agent project",e.kind==="multi"&&`${e.directChildren} agent ${e.directChildren===1?"project":"projects"} directly inside this folder`,e.kind==="plain"&&"No agent directly inside this folder",e.kind==="new"&&"This folder doesn't exist yet"]}),d.jsx("span",{className:"aw-result-path",title:t,children:t}),(e.kind==="multi"||e.kind==="plain")&&d.jsx("span",{className:"aw-result-note","data-testid":"aw-scan-reach",children:"Detection only looks one level down. Adding searches the whole tree beneath this folder, so it can find agents this line cannot see — and on a large folder, many more than it names."})]})]})})}function mL({mode:e,outcome:t,checking:n,busy:r,canOpen:o,canScan:c,armed:h,onConnect:l,onScan:u,onOpen:m}){if(n||!t)return d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Checking…"});const g=c&&t.kind!=="project"?d.jsx("button",{className:(e==="open"?"btn-ghost":"btn-primary modal-primary-cta")+(h?" is-armed":""),"data-testid":"aw-add-all","data-armed":h?"true":"false",onClick:u,disabled:r,children:r?"Adding…":h?"Add them — this can be a lot of rows":"Add every agent under this folder"}):null;if(e==="open")return d.jsxs(d.Fragment,{children:[g,d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"open-project",onClick:m,disabled:r||!o,children:r?"Opening…":"Open project"})]});const p=o?d.jsx("button",{className:"btn-ghost","data-testid":"open-project",onClick:m,disabled:r,children:"Open folder anyway"}):null;switch(t.kind){case"project":return d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add",onClick:l,disabled:r,children:r?"Adding…":"Add workspace"});case"multi":return g;case"plain":return d.jsxs(d.Fragment,{children:[p,g]});case"new":return d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Add workspace"})}}const gL="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",vL="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",_L={"claude-code":gL,codex:vL},yL=["M105.267 60.7219L98.8902 71.7648L92.1353 83.4669L83.3114 98.7521L70.18 121.491H0L13.1249 98.7521H57.042L72.6274 71.7648L79.0038 60.7219L72.2619 49.0459H98.5247L105.267 60.7219Z","M114.072 0L100.954 22.7189H57.0694L57.0498 22.6928L57.0368 22.7189L41.8365 49.047L35.0945 60.723L41.471 71.7659H15.2016L8.8252 60.723L15.5671 49.047L21.9631 37.978L30.774 22.7189L43.8923 0H114.072Z"];function d_({kind:e,size:t=16}){if(e==="sapiom")return d.jsx("svg",{viewBox:"0 0 115 122",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:yL.map(r=>d.jsx("path",{d:r},r.slice(0,16)))});const n=_L[e];return n?d.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:d.jsx("path",{d:n})}):d.jsx(ue,{name:"SquareTerminal",size:t})}function bL({entries:e,activeId:t,testidPrefix:n,onPick:r}){return d.jsx(d.Fragment,{children:e.map(o=>{const c=c_(o),h=o.id===t,l=iL(o);return d.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h,"aria-disabled":!c||void 0,className:"profile-menu-item provider-item"+(c?"":" is-unavailable"),"data-testid":`${n}-${o.id}`,"data-tooltip":l??void 0,onClick:()=>{c&&r(o.id)},children:[d.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:h&&d.jsx(ue,{name:"Check",size:13})}),d.jsx(d_,{kind:o.id,size:13}),o.label]},o.id)})})}const SL=[{label:"sales outreach",prompt:"Enrich a list of leads, then write a personalized first line for each prospect and draft an outreach email."},{label:"support triage",prompt:"Triage incoming support tickets: classify each by urgency and topic, draft a first reply, and flag anything critical."},{label:"research digest",prompt:"Search the web for the latest on a topic I give you, then publish a dated digest of what changed."},{label:"code review",prompt:"When a pull request opens, review the diff for bugs and style issues and post the findings as a review comment."}],wL=3;function xL(e){const t=e.getHours();return t<12?"Good morning.":t<18?"Good afternoon.":"Good evening."}function CL(e){return e.replace(/\s+/g,"-")}function EL({firstRun:e,onSubmitIdea:t,onAttachmentError:n,onUseTemplate:r,onBrowseTemplates:o,listHarnesses:c,listTemplates:h,telemetryOptIn:l,onToggleTelemetry:u,recentDirs:m,projectRoot:g,listDir:p,onConnect:S,onScan:w,onScaffold:A,onSaveProjectRoot:E}){const[y,b]=O.useState(""),[v,_]=O.useState(()=>hi().preferredHarness??"claude-code"),[k,C]=O.useState(sL),[x,T]=O.useState(!1),[R,M]=O.useState([]),[D,L]=O.useState(!1),[q,F]=O.useState([]),[Y,Q]=O.useState(!1),[G,ee]=O.useState(!1),[ne,z]=O.useState(!1),[B,$]=O.useState(!1),H=O.useRef(null),U=O.useRef(null),P=O.useRef(null),W=O.useRef(null),se=O.useRef([]),X=O.useRef(!1),V=O.useRef(!1),ce=O.useRef(Promise.resolve()),oe=O.useRef(0),Z=O.useCallback(()=>T(!1),[]);O.useEffect(()=>{let je=!1;return c().then(Ue=>{if(je||Ue.length===0)return;C(nL(Ue));const Ye=Ue.filter(c_);_(jt=>{var rt;return Ye.some(Ct=>Ct.id===jt)?jt:((rt=Ye[0])==null?void 0:rt.id)??jt})}).catch(()=>{}),()=>{je=!0}},[c]),O.useEffect(()=>{let je=!1;return h().then(Ue=>{je||M(Ue.templates.map(Ye=>({...Ye,kind:"gallery"})).slice(0,wL))}).catch(()=>{}),()=>{je=!0}},[h]);const te=je=>{_(je),Ci({preferredHarness:je==="codex"?"codex":"claude-code"}),Z()},pe=je=>{B||($(!0),window.setTimeout(je,170))},ye=()=>{if(B||X.current||V.current)return;X.current=!0,z(!0),$(!0);const je=se.current;window.setTimeout(()=>{t(y.trim(),v,je).catch(Ue=>{var Ye;X.current=!1,$(!1),z(!1),(Ye=H.current)==null||Ye.focus(),n(Ue.message||"Couldn't start a session with those files.")})},170)},Ee=je=>{var rt;if(je.length===0||X.current)return;const Ue=(rt=pr())==null?void 0:rt.pathForFile;oe.current+=1,V.current=!0,ee(!0);const Ye=async()=>{const Ct=se.current.reduce((Lt,mt)=>Lt+(mt.kind==="inline"?mt.bytes:0),0),dt=await cL(je,Ue,Math.max(0,yv-Ct));if(dt.attachments.length>0){const Lt=uL(se.current,dt.attachments);se.current=Lt,F(Lt)}dt.errors.length>0&&n(dt.errors.join(" "))},jt=ce.current.then(Ye);ce.current=jt.catch(()=>{}),jt.catch(Ct=>{n(Ct.message||"Couldn't attach those files.")}).then(()=>{oe.current-=1,oe.current===0&&(V.current=!1,ee(!1))})},Ie=je=>{if(X.current)return;const Ue=se.current.filter(Ye=>Ye.id!==je);se.current=Ue,F(Ue)},Pe=q.length===0?"No files attached.":q.length===1?"1 file attached.":`${q.length} files attached.`,Fe=Y?"Drop files to attach.":ne?`Starting session with ${Pe.toLowerCase()}`:G?"Preparing attached files.":Pe;return d.jsxs("div",{className:"composer-home"+(B?" is-leaving":""),"data-testid":"new-session-composer",...Dt({surface:"composer"}),children:[d.jsxs("div",{className:"composer-hero",children:[d.jsxs("p",{className:"composer-greeting","data-testid":"composer-greeting",children:[xL(new Date)," ",e?"Let's build your first agent.":"Let's build a new agent."]}),d.jsx("h1",{className:"composer-heading",children:"What should your agent do?"}),d.jsx("div",{className:"composer-chips",role:"list",children:SL.map(je=>d.jsx("button",{type:"button",role:"listitem",className:"composer-chip","data-testid":`composer-chip-${CL(je.label)}`,onClick:()=>{var Ue;b(je.prompt),(Ue=H.current)==null||Ue.focus()},children:je.label},je.label))}),d.jsxs("div",{className:"composer-box"+(Y?" is-dragging-files":"")+(ne||G?" is-busy":""),"data-testid":"composer-box",role:"group","aria-label":"New session request","aria-busy":ne||G,"aria-describedby":"composer-attachment-status",onPaste:je=>{const Ue=Array.from(je.clipboardData.items).filter(jt=>jt.kind==="file").flatMap(jt=>{const rt=jt.getAsFile();return rt?[rt]:[]}),Ye=Ue.length>0?Ue:Array.from(je.clipboardData.files??[]);Ye.length!==0&&(je.preventDefault(),Ee(Ye))},onDragEnter:je=>{Array.from(je.dataTransfer.types).includes("Files")&&(je.preventDefault(),!X.current&&Q(!0))},onDragOver:je=>{Array.from(je.dataTransfer.types).includes("Files")&&(je.preventDefault(),!X.current&&(je.dataTransfer.dropEffect="copy",Q(!0)))},onDragLeave:je=>{const Ue=je.relatedTarget;Ue instanceof Node&&je.currentTarget.contains(Ue)||Q(!1)},onDrop:je=>{Array.from(je.dataTransfer.types).includes("Files")&&(je.preventDefault(),Q(!1),Ee(Array.from(je.dataTransfer.files)))},children:[Y&&d.jsxs("div",{className:"composer-drop-hint","aria-hidden":"true",children:[d.jsx(ue,{name:"CloudUpload",size:18})," Drop files to attach"]}),d.jsx("textarea",{ref:H,className:"composer-input","data-testid":"composer-input",placeholder:"Describe the outcome you want","aria-label":"Describe the outcome you want",value:y,rows:2,autoFocus:!0,onChange:je=>b(je.target.value),onKeyDown:je=>{je.key==="Enter"&&!je.shiftKey&&(je.preventDefault(),ye())}}),q.length>0&&d.jsx("ul",{className:"composer-files","data-testid":"composer-files","aria-label":"Attached files",children:q.map(je=>d.jsxs("li",{className:"composer-file",...Dt({object:"file"}),children:[d.jsx(ue,{name:"Paperclip",size:13}),d.jsx("span",{className:"composer-file-name",title:je.name,children:je.name}),d.jsx("button",{type:"button",className:"composer-file-remove","aria-label":`Remove ${je.name}`,disabled:ne,onClick:()=>Ie(je.id),children:d.jsx(ue,{name:"X",size:11})})]},je.id))}),d.jsxs("div",{className:"composer-box-actions",children:[d.jsx("button",{ref:W,type:"button",className:"composer-attach","data-testid":"composer-open-folder","aria-label":"Open a folder or connect a workspace","data-tooltip":"Open a folder or connect a workspace",onClick:()=>L(!0),children:d.jsx(ue,{name:"Plus",size:16})}),d.jsx("button",{type:"button",className:"composer-attach","data-testid":"composer-attach-files","aria-label":"Attach files","data-tooltip":"Attach files",disabled:ne,onClick:()=>{var je;return(je=U.current)==null?void 0:je.click()},children:d.jsx(ue,{name:"Paperclip",size:15})}),d.jsx("input",{ref:U,type:"file",multiple:!0,hidden:!0,"data-testid":"composer-file-input",onChange:je=>{Ee(je.target.files?Array.from(je.target.files):[]),je.target.value=""}}),d.jsxs("div",{className:"composer-box-right",children:[d.jsxs("button",{ref:P,type:"button",className:"harness-select composer-harness","data-testid":"composer-harness-select","aria-haspopup":"menu","aria-expanded":x,"aria-label":"Coding agent for this session","data-tooltip":"Which coding agent runs this session",onClick:()=>T(je=>!je),children:[d.jsx(d_,{kind:v,size:14}),d.jsx("span",{className:"harness-select-label",children:rL(k,v)}),d.jsx("span",{className:"disclosure-caret"+(x?" is-open":""),"aria-hidden":"true",children:d.jsx(ue,{name:"ChevronDown",size:12})})]}),d.jsx(Ei,{open:x,anchorRef:P,onDismiss:Z,placement:"up-end",className:"session-menu harness-select-menu",role:"menu",testid:"composer-harness-menu",children:d.jsx(bL,{entries:k,activeId:v,testidPrefix:"composer-harness-option",onPick:te})}),d.jsx("button",{type:"button",className:"composer-send","data-testid":"composer-send","aria-label":"Start session",title:"Start session",disabled:ne||G,onClick:ye,children:d.jsx(ue,{name:"ArrowUp",size:16})})]})]})]}),d.jsx("div",{id:"composer-attachment-status",className:"visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"composer-attachment-status",children:Fe})]}),R.length>0&&d.jsxs("div",{className:"composer-templates",children:[d.jsxs("div",{className:"composer-templates-head",children:[d.jsx("span",{className:"composer-templates-title",children:"Start from a template"}),d.jsxs("button",{type:"button",className:"composer-templates-all","data-testid":"composer-browse-templates",onClick:o,children:["Browse all templates ",d.jsx(ue,{name:"ChevronRight",size:13})]})]}),d.jsx("div",{className:"composer-template-grid",children:R.map((je,Ue)=>d.jsxs("button",{type:"button",className:"composer-template-card","data-testid":`composer-template-${je.id}`,onClick:()=>pe(()=>r(je)),children:[d.jsxs("span",{className:"composer-template-cardhead",children:[d.jsx("span",{className:"composer-template-name",children:je.name}),Ue===0&&d.jsx("span",{className:"composer-template-suggested",children:"Suggested"})]}),d.jsx("span",{className:"composer-template-desc",children:je.description}),d.jsxs("span",{className:"composer-template-meta",children:[je.stepCount," ",je.stepCount===1?"step":"steps"," ·"," ",s_(je.complexity),je.capabilities.length>0&&` · ${je.capabilities.length} ${je.capabilities.length===1?"capability":"capabilities"}`]})]},je.id))})]}),e&&d.jsxs("div",{className:"composer-footer",children:[d.jsxs("label",{className:"composer-consent","data-testid":"welcome-consent",children:[d.jsx("button",{type:"button",role:"switch","aria-checked":l,"data-testid":"welcome-telemetry-toggle",className:"toggle-switch"+(l?" is-on":""),onClick:()=>void u(!l),children:d.jsx("span",{className:"toggle-knob"})}),d.jsx("span",{className:"composer-consent-copy",children:"Help us improve Agent Studio — share your session details with Sapiom. Off by default; change it anytime in Settings."})]}),d.jsxs("a",{className:"composer-docs","data-testid":"welcome-docs",href:"https://docs.sapiom.ai/agents/quick-start",target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",d.jsx(ue,{name:"ArrowUpRight",size:12})]})]}),D&&d.jsx(u_,{recentDirs:m,projectRoot:g,listDir:p,onClose:()=>L(!1),onConnect:S,onScan:w,triggerRef:W})]})}function kL({firstRun:e,appVersion:t,recentDirs:n,projectRoot:r,listDir:o,onConnect:c,onScan:h,onBrowseTemplates:l,onDismiss:u}){const[m,g]=O.useState(!1),p=O.useRef(null),S=O.useRef(u);return S.current=u,O.useEffect(()=>{if(m)return;const w=E=>{E.key==="Escape"&&S.current()},A=window.setTimeout(()=>window.addEventListener("keydown",w),0);return()=>{window.clearTimeout(A),window.removeEventListener("keydown",w)}},[m]),d.jsxs("div",{className:"overview-modal","data-testid":"overview-modal",role:"dialog","aria-modal":"true","aria-label":"Sapiom agent.studio overview",onClick:w=>{w.target===w.currentTarget&&u()},children:[d.jsxs("div",{className:"overview-modal-card",children:[d.jsx("button",{type:"button",className:"theme-toggle overview-modal-close","data-testid":"overview-exit","aria-label":"Close","data-tooltip":"Close",onClick:u,children:d.jsx(ue,{name:"X",size:14})}),d.jsxs("div",{className:"overview-modal-body",children:[d.jsx("h1",{className:"overview-modal-title",children:e?"Welcome to Sapiom agent.studio":"Sapiom agent.studio"}),t&&d.jsxs("p",{className:"overview-modal-version","data-testid":"overview-version",children:["v",t]}),d.jsx("p",{className:"overview-modal-intro",children:"Studio turns the agents in your codebase into diagrams you can inspect and run. Local agent runs are free and offline, with every step's input, output and capability call on screen. Nothing ships until you say so."}),d.jsxs("div",{className:"overview-modal-path","data-testid":"overview-open-card",children:[d.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:d.jsx(ue,{name:"FolderOpen",size:20})}),d.jsxs("span",{className:"overview-modal-path-copy",children:[d.jsx("span",{className:"overview-modal-path-title",children:"Open a folder"}),d.jsx("span",{className:"overview-modal-path-desc",children:"Agents in the folder appear in the rail. Nothing is uploaded."})]}),d.jsx("button",{ref:p,type:"button",className:"btn-primary overview-modal-cta","data-testid":"overview-open-folder",onClick:()=>g(!0),children:"Open folder"})]}),d.jsxs("div",{className:"overview-modal-path","data-testid":"overview-templates-card",children:[d.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:d.jsx(ue,{name:"LayoutTemplate",size:20})}),d.jsxs("span",{className:"overview-modal-path-copy",children:[d.jsx("span",{className:"overview-modal-path-title",children:"Start from a template"}),d.jsx("span",{className:"overview-modal-path-desc",children:"Runnable starters, cloned locally and free to test."})]}),d.jsx("button",{type:"button",className:"btn-line overview-modal-cta","data-testid":"overview-browse-templates",onClick:l,children:"Browse templates"})]}),d.jsxs("a",{className:"overview-modal-docs","data-testid":"overview-docs",href:tA,target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",d.jsx(ue,{name:"ArrowUpRight",size:12})]})]})]}),m&&d.jsx(u_,{recentDirs:n,projectRoot:r,listDir:o,onClose:()=>g(!1),onConnect:c,onScan:h,triggerRef:p})]})}const jL="M32.1834 7.36578L34.4714 5.81493H36.5941C39.3219 5.81493 41.5567 8.05816 41.5567 10.7996V14.9539C41.5567 17.7234 39.3247 19.9385 36.5941 19.9385H34.4714L32.1834 18.3877V24H29.4277V5.81493H32.1834V7.36578ZM23.7454 7.36578V5.81493H26.5012V19.9385H23.7454V18.3877L21.4574 19.9385H19.3347C16.6069 19.9385 14.3722 17.6953 14.3722 14.9539V10.7996C14.3722 8.03001 16.6041 5.81493 19.3347 5.81493H21.4574L23.7454 7.36578ZM50.2802 17.169H54.0945V19.9385H43.7074V17.169H47.5245V8.58449H43.7074V5.81493H50.2802V17.169ZM73.2556 7.36296L75.5436 5.81212H76.9774C78.4645 5.81212 79.7667 6.60584 80.492 7.79359L81.1557 7.36296L83.4466 5.81212H84.8805C87.1516 5.81212 89 7.66975 89 9.94957V19.9385H86.3199V10.0284C86.3199 9.21495 85.6898 8.58168 84.8805 8.58168H84.3008L81.1585 10.7151V19.9357H78.4001V9.79195C78.2909 9.09675 77.7084 8.58449 76.9802 8.58449H76.4005L73.2556 10.718V19.9385H70.4998V5.81212H73.2556V7.36296ZM64.4479 5.73331C66.3944 5.73331 67.9682 7.31511 67.9682 9.27125V16.2571L64.0923 19.8456L64.0783 19.8569H59.5807C57.6372 19.8569 56.0605 18.2751 56.0605 16.319V9.33316L59.9363 5.74457L59.9504 5.73331H64.4479ZM9.23606 5.81493L11.5549 7.38829V10.7405L8.3539 8.5676H3.91231C2.66607 8.61545 2.63808 10.079 3.62665 10.4618L9.69534 12.3926C11.0284 12.8176 11.9385 14.0616 11.9385 15.4662V16.4907C11.9385 17.5968 11.3925 18.6297 10.4795 19.249L9.65053 19.8119H2.28801L0 18.261V14.9088L3.29339 17.1436H7.53336C7.55015 17.1436 9.29767 17.1859 9.36488 16.0741C9.38729 15.5928 9.12683 15.1059 8.62835 14.9005L2.88732 13.0738C1.16781 12.5249 -0.0476086 10.9515 0.210037 9.16429C0.33886 7.88365 1.34424 5.80931 4.19515 5.83183H4.20356L9.23606 5.82056V5.81493ZM32.1834 10.718V15.0383L35.3284 17.1717H36.5969C37.8096 17.1717 38.8009 16.1754 38.8009 14.9567V10.8024C38.8009 9.58367 37.8096 8.5873 36.5969 8.5873H35.3284L32.1834 10.7208V10.718ZM19.3347 8.58449C18.122 8.58449 17.1307 9.58086 17.1307 10.7996V14.9539C17.1307 16.1726 18.122 17.169 19.3347 17.169H20.6033L23.7454 15.0383V10.718L20.6033 8.58449H19.3347ZM58.7881 10.5378V16.1642C58.7881 16.6764 59.1999 17.0902 59.7096 17.0902H63.0421L65.2377 15.058V9.43168C65.2377 8.91942 64.8261 8.50568 64.3164 8.50568H60.9837L58.7881 10.5378ZM50.283 2.76956H47.2501V0H50.283V2.76956Z",Ex=89,Zh=24,RL=19.9385,AL=(Zh-RL)/Zh;function TL({height:e=16,className:t,style:n,...r}){const o=!!r["aria-label"];return d.jsx("svg",{...r,className:["brand-logotype",t].filter(Boolean).join(" "),style:{"--brand-logotype-descender":`${AL*e}px`,...n},width:Ex/Zh*e,height:e,viewBox:`0 0 ${Ex} ${Zh}`,fill:"none",focusable:"false",role:o?"img":void 0,"aria-hidden":o?void 0:!0,children:d.jsx("path",{d:jL,fill:"currentColor"})})}function NL({canGoBack:e,canGoForward:t,onGoBack:n,onGoForward:r}){return d.jsxs("div",{className:"session-nav","data-testid":"session-nav",role:"group","aria-label":"Go back or forward",children:[d.jsx("button",{type:"button",className:"theme-toggle session-nav-btn","data-testid":"session-nav-back",disabled:!e,"aria-label":"Go back","data-tooltip":"Go back",onClick:n,children:d.jsx(ue,{name:"ArrowLeft",size:14})}),d.jsx("button",{type:"button",className:"theme-toggle session-nav-btn","data-testid":"session-nav-forward",disabled:!t,"aria-label":"Go forward","data-tooltip":"Go forward",onClick:r,children:d.jsx(ue,{name:"ArrowRight",size:14})})]})}function ML({onCollapse:e,canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:o}){return d.jsxs("header",{className:"brand-header",children:[d.jsx("div",{className:"brand-header-window",children:d.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:e,children:d.jsx(ue,{name:"PanelLeftClose",size:14})})}),d.jsxs("h1",{className:"brand-lockup",children:[d.jsxs("span",{className:"brand-mark",children:[d.jsx(TL,{height:13,"aria-hidden":!0}),d.jsx("span",{className:"visually-hidden",children:"Sapiom "})]}),d.jsx("span",{className:"brand-product",children:"agent.studio"})]}),d.jsx(NL,{canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:o})]})}function _g(e){const t=Math.round(e*100)/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function $L(e){switch(e.kind){case"limit":return`${_g(e.usedUsd)} / ${_g(e.limitUsd)}`;case"balance":return`${_g(e.availableUsd)} available`;case"none":return null}}function DL({plan:e}){const[t,n]=O.useState(!1),r=O.useRef(null),o=O.useCallback(()=>n(!1),[]);if(!e)return null;const c=$L(e.readout);return!e.plan&&!c?null:d.jsx("div",{className:"rail-footer-row plan-row","data-testid":"plan-card",children:d.jsxs("div",{className:"rail-footer-card plan-card",children:[d.jsxs("span",{className:"plan-card-copy",children:[e.plan&&d.jsx("span",{className:"plan-card-name",children:e.plan.name}),c&&d.jsx("span",{className:"plan-card-readout","data-testid":"plan-balance",children:c})]}),d.jsx("a",{className:"pill plan-card-upgrade",href:c1,target:"_blank",rel:"noreferrer","data-testid":"plan-upgrade",onClick:()=>Lc("plan.upgrade_clicked"),children:"Upgrade"}),d.jsx("button",{ref:r,className:"plan-card-menu-btn","data-testid":"plan-menu-trigger","aria-haspopup":"menu","aria-expanded":t,"aria-label":"Plan options",onClick:()=>n(h=>!h),children:d.jsx(ue,{name:"EllipsisVertical",size:13})}),d.jsxs(Ei,{open:t,anchorRef:r,onDismiss:o,placement:"up-end",className:"plan-menu",role:"menu",testid:"plan-menu",children:[d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-manage-billing",onClick:()=>{window.open(c1,"_blank","noopener,noreferrer"),o()},children:[d.jsx(ue,{name:"ExternalLink",size:13}),"Manage billing"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-view-usage",onClick:()=>{window.open(QR,"_blank","noopener,noreferrer"),o()},children:[d.jsx(ue,{name:"ExternalLink",size:13}),"View usage"]})]})]})})}function OL({desktop:e,version:t,onToast:n}){const[r,o]=O.useState(!1),c=async()=>{if(!r){o(!0);try{const h=await e.checkForUpdates();h.kind!=="downloaded"&&n(I2(h).text)}catch{n("Couldn't check for updates.")}finally{o(!1)}}};return d.jsx("div",{className:"rail-footer-row update-row",children:d.jsxs("button",{className:"rail-footer-card update-card","data-testid":"update-card",disabled:r,onClick:()=>void c(),children:[d.jsx("span",{className:"update-card-label",children:"Update now"}),d.jsxs("span",{className:"update-card-version","data-testid":"update-card-version",children:["v",t]}),d.jsx(ue,{name:"ChevronRight",size:14})]})})}const LL=l_[0],U2={vscode:"VS Code","vscode-insiders":"VS Code Insiders",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"},IL=l_.map(e=>({kind:e,label:U2[e]}));function _f(e){return l_.includes(e)?e:LL}function kx(e){return U2[_f(e)]}function PL(e,t){const n=t.replace(/\\/g,"/"),r=n.startsWith("/")?n:`/${n}`;return`${_f(e)}://file${encodeURI(r)}`}function BL({authenticated:e,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,consentSource:o,consentEnvReason:c,onToggleTelemetry:h,onToggleProductAnalytics:l,rollingSummary:u,onToggleRollingSummary:m,editor:g,onSelectEditor:p,onStartAuth:S,onDisconnect:w}){const[A,E]=O.useState(!1),[y,b]=O.useState({status:"idle"}),v=o==="env-forced-off",_=v?!1:n,k=v?!1:r,C=async()=>{const D=!n;E(!0);try{await h(D),Lc("consent.changed",{optIn:D})}finally{E(!1)}},x=async()=>{const D=!r;E(!0);try{await l(D),Lc("consent.changed",{productAnalytics:D})}finally{E(!1)}},T=async()=>{E(!0);try{await m(!u)}finally{E(!1)}},R=async D=>{E(!0);try{await p(D)}finally{E(!1)}},M=async()=>{b({status:"pending"});try{await S()}catch(D){const L=D instanceof Error?D.message:"Could not start sign-in. Try again.";b({status:"error",message:L})}};return e&&y.status==="pending"&&b({status:"idle"}),d.jsxs(B2,{surface:"settings",children:[d.jsx("div",{className:"settings-identity",children:e?t??"Signed in":"Not signed in"}),!e&&d.jsx("div",{className:"settings-auth-row",children:y.status==="pending"?d.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[d.jsx(ue,{name:"Loader",size:13}),"Opening browser… waiting for sign-in"]}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"btn-primary settings-connect-btn","data-testid":"settings-connect-btn",onClick:()=>void M(),children:"Connect account"}),y.status==="error"&&d.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:y.message})]})}),oC(),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Share session details with Sapiom"}),d.jsx("button",{type:"button",role:"switch","aria-checked":_,"data-testid":"telemetry-toggle",className:"toggle-switch"+(_?" is-on":""),disabled:A||v,onClick:()=>void C(),children:d.jsx("span",{className:"toggle-knob"})})]}),d.jsxs("p",{className:"settings-note",children:["Help us optimize your experience: with this on, your prompts, tool calls, and session lifecycle events are shared with Sapiom so we can see where Agent Studio gets in your way. Off by default. Always written locally to ",d.jsx("code",{children:eL.events})," either way."]}),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Product analytics (clicks & usage)"}),d.jsx("button",{type:"button",role:"switch","aria-checked":k,"data-testid":"product-analytics-toggle",className:"toggle-switch"+(k?" is-on":""),disabled:A||v,onClick:()=>void x(),children:d.jsx("span",{className:"toggle-knob"})})]}),d.jsx("p",{className:"settings-note",children:"Anonymous-by-default usage: which buttons and screens you use, and how you move through the Agent Studio. No prompt text, no file contents, and never a screen recording. On by default; turn it off here anytime."}),v&&d.jsxs("p",{className:"settings-note settings-env-note","data-testid":"telemetry-env-note",children:["All telemetry is turned off by ",c?`$${c}`:"an environment variable",". Unset it and restart the Agent Studio server to manage consent here."]}),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Summarize sessions in the background"}),d.jsx("button",{type:"button",role:"switch","aria-checked":u,"data-testid":"rolling-summary-toggle",className:"toggle-switch"+(u?" is-on":""),disabled:A,onClick:()=>void T(),children:d.jsx("span",{className:"toggle-knob"})})]}),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Open in editor uses"}),d.jsxs("span",{className:"settings-select-wrap",children:[d.jsx("select",{className:"settings-select","data-testid":"editor-select",value:_f(g),disabled:A,onChange:D=>void R(D.target.value),children:IL.map(D=>d.jsx("option",{value:D.kind,children:D.label},D.kind))}),d.jsx("span",{className:"settings-select-caret","aria-hidden":"true",children:d.jsx(ue,{name:"ChevronDown",size:12})})]})]}),d.jsx("p",{className:"settings-note",children:"Which editor the session menu’s “Open in editor” hands the project folder to. It opens the editor’s own URL scheme, so the app has to be installed — the OS never reports back, and an editor that isn’t there simply does nothing."}),d.jsxs("p",{className:"settings-note",children:["Off by default, because it uses tokens you didn’t ask to use: every 10 turns, and once at the end, a cheap one-shot coding-agent pass folds the session into a short summary. Continuing a session the coding agent can no longer reattach to then explains what the work was"," ",d.jsx("em",{children:"for"}),", not just what it last did. With this off, continuing still works — it carries the last few turns instead."]})]})}const zL=2,HL=22,h_=(e,t)=>Li(t,e),Ms=e=>La(e.replace(/\\/g,"/"));function f_(e,t){const n=Ms(e),r=Ms(t);return r===n?[]:(n.endsWith("/")?r.slice(n.length):r.slice(n.length+1)).split("/").filter(Boolean)}function jx(e){const t=e.join("/");return e.length<=zL||t.length<=HL?t:`${e[0]}/…/${e[e.length-1]}`}function p_(e,t,n=1){for(let r=Math.max(n,1);r<=e.length;r++){const o=e.slice(-r).join("/");if(!t.some(c=>c.slice(-r).join("/")===o))return e.slice(-r)}return[...e]}function F2(e,t){const n=zs(Ms(e.path));return n===e.name||n===t}function UL(e){var t;return(((t=zs(e).match(/[A-Za-z0-9]/))==null?void 0:t[0])??"•").toUpperCase()}const bv=e=>(t,n)=>e==="name"?Wr(t.workflow.name).localeCompare(Wr(n.workflow.name)):t.workflow.path.localeCompare(n.workflow.path),Rx=(e,t)=>({name:e,path:t,agent:null,children:new Map});function FL(e){const t=[e.name];let n=e;for(;!n.agent&&n.children.size===1;){const[r]=n.children.values();t.push(r.name),n=r}return{segments:t,node:n}}function Sv(e,t){const n=[],r=[];for(const o of e.children.values()){const{segments:c,node:h}=FL(o);if(h.agent){const u=c.slice(0,-1),m={workflow:h.agent,prefix:u[u.length-1]??"",prefixFull:u.join("/")},g=Sv(h,t);g.dirs.length>0||g.agents.length>0?n.push({path:h.path,label:jx(c),labelFull:c.join("/"),dirs:g.dirs,agents:[m,...g.agents].sort(bv(t))}):r.push(m);continue}const l=Sv(h,t);l.dirs.length===0&&l.agents.length===0||n.push({path:h.path,label:jx(c),labelFull:c.join("/"),dirs:l.dirs,agents:l.agents})}return n.sort((o,c)=>o.labelFull.localeCompare(c.labelFull)),r.sort(bv(t)),{dirs:n,agents:r}}function qL(e,t,n="recent"){const r=WL(t);return t.map(o=>{const c=Rx(zs(o),o);for(const u of e){if(!h_(u.path,o))continue;const m=f_(o,u.path);if(m.length===0){c.agent=u;continue}let g=c,p=o;for(const S of m){p=Mv(p,S);let w=g.children.get(S);w||(w=Rx(S,p),g.children.set(S,w)),g=w}g.agent=u}const{dirs:h,agents:l}=Sv(c,n);return{root:o,label:r(o),dirs:h,agents:l,rootAgent:c.agent?{workflow:c.agent,prefix:"",prefixFull:""}:null}})}function Ax(e){return e.rootAgent===null&&e.dirs.length===0&&e.agents.length===0}function Tx(e,t){const n=e.map(c=>f_(t,c.path).slice(0,-1)),r=e.map(c=>Wr(c.name)),o=new Map;return e.forEach((c,h)=>{const l=e.flatMap((u,m)=>m!==h&&r[m]===r[h]?[n[m]]:[]);o.set(c.path,{workflow:c,prefix:p_(n[h],l).join("/"),prefixFull:n[h].join("/")})}),o}function VL(e,t,n="recent"){const r=e.filter(h=>!t.some(l=>h_(h.path,l))),o=r.map(h=>Ms(h.path).split("/").filter(Boolean).slice(0,-1)),c=r.map(h=>Wr(h.name));return r.map((h,l)=>{const u=r.flatMap((m,g)=>g!==l&&c[g]===c[l]?[o[g]]:[]);return{workflow:h,prefix:p_(o[l],u).join("/"),prefixFull:Pc(h.path)??""}}).sort(bv(n))}function GL({recentDirs:e,sessions:t,pendingCwds:n,sort:r}){const o=new Map;for(const g of t){const p=Ms(g.cwd),S=o.get(p);(!S||g.createdAt>S)&&o.set(p,g.createdAt)}const c=new Set,h=[];for(const g of[...n,...e,...t.map(p=>p.cwd)]){const p=Ms(g);p===""||c.has(p)||(c.add(p),h.push(g))}const l=new Map(n.map((g,p)=>[Ms(g),p])),u=new Map(e.map((g,p)=>[Ms(g),p])),m=(g,p)=>{const S=u.get(Ms(g))??-1,w=u.get(Ms(p))??-1;return S>=0&&w>=0?S-w:S>=0||w>=0?S>=0?-1:1:(o.get(Ms(p))??"").localeCompare(o.get(Ms(g))??"")};return h.sort((g,p)=>{const S=l.get(Ms(g)),w=l.get(Ms(p));return S!==void 0||w!==void 0?S!==void 0&&w!==void 0?S-w:S!==void 0?-1:1:r==="name"?zs(g).localeCompare(zs(p))||g.localeCompare(p):m(g,p)||g.localeCompare(p)})}function WL(e){const t=o=>Ms(o).split("/").filter(Boolean),n=new Map;for(const o of e){const c=zs(o);n.set(c,(n.get(c)??0)+1)}const r=o=>{let c=null;for(const h of e)Ms(h)===Ms(o)||!h_(o,h)||(c===null||Ms(h).length>Ms(c).length)&&(c=h);return c};return o=>{const c=r(o);if(c)return`${zs(c)}/${f_(c,o).join("/")}`;const h=zs(o);if((n.get(h)??0)<2)return h;const l=t(o),u=e.filter(g=>Ms(g)!==Ms(o)).map(t),m=p_(l,u,2);return m.length===l.length&&u.some(g=>g.join("/")===l.join("/"))?o:m.join("/")}}function m_({workflow:e,isFocused:t,onFocus:n,prefix:r="",prefixFull:o="",depth:c=0,draggable:h=!1,onDragStart:l,onDragEnd:u}){const m=Wr(e.name),g=F2(e,m),p=Pa(e),S=p==="ready",w=p==="ready"?"Deployed to Sapiom with a ready build.":p==="building"?"Cloud build in progress.":p==="failed"?"Cloud build failed.":p==="linked"?"Linked to Sapiom; no ready build confirmed.":"Draft. Not deployed to Sapiom yet.";return d.jsx("div",{className:"workflow-item"+(t?" is-focused":""),"data-testid":`workflow-${e.name}`,"data-agent-path":e.path,style:c>0?{"--tree-depth":c}:void 0,draggable:h||void 0,onDragStart:l,onDragEnd:u,...Dt({object:"agent"}),children:d.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(e.path),"aria-pressed":t,title:e.path,"data-tooltip":t?"Focused agent":"Focus this agent",children:[d.jsxs("span",{className:"tree-row-name",children:[r&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tree-row-prefix","data-testid":`workflow-prefix-${e.path}`,children:r}),d.jsx("span",{className:"tree-row-sep"+(g?"":" tree-row-sep-loose"),"aria-hidden":"true",children:g?"/":"·"})]}),d.jsx("span",{className:"tree-row-label","data-testid":`workflow-name-${e.path}`,title:o?e.path:void 0,children:m})]}),d.jsx("span",{className:"workflow-status","data-deployed":S,"data-deployment-state":p,"data-testid":`workflow-status-${e.path}`,title:w,children:d.jsx(ue,{name:S?"Cloud":"CloudOff",size:13})})]})})}function q2(e,t){return t?{onDragOver:n=>{n.dataTransfer.types.includes(dh)&&(n.preventDefault(),n.dataTransfer.dropEffect="move",t.dropDir!==e&&t.setDropDir(e))},onDragLeave:n=>{n.currentTarget.contains(n.relatedTarget)||t.dropDir===e&&t.setDropDir(null)},onDrop:n=>{if(!n.dataTransfer.types.includes(dh))return;n.preventDefault(),t.setDropDir(null);const r=n.dataTransfer.getData(dh);r&&t.onDropInto(r,e)}}:{}}function KL(e,t){return t?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(dh,e.workflow.path)},onDragEnd:()=>t.setDropDir(null)}:{}}const Nx=e=>`project:${e}`,yg=e=>`dir:${e}`;function yf({collapsed:e,onToggle:t,label:n,testid:r,children:o}){return d.jsxs("button",{type:"button",className:"row-disclosure","data-testid":r,onClick:t,"aria-expanded":!e,"aria-label":e?`Expand ${n}`:`Collapse ${n}`,"data-tooltip":e?"Expand":"Collapse",children:[d.jsx("span",{className:"row-disclosure-mark","aria-hidden":"true",children:o}),d.jsx("span",{className:"row-disclosure-chevron","aria-hidden":"true",children:d.jsx(ue,{name:e?"ChevronRight":"ChevronDown",size:13})})]})}function Mx({root:e}){return d.jsx("span",{className:"project-mark","aria-hidden":"true",children:UL(e)})}function V2({dirs:e,agents:t,depth:n,focusedAgentPath:r,onFocusAgent:o,collapsedKeys:c,onToggleCollapsed:h,drag:l}){return d.jsxs(d.Fragment,{children:[t.map(u=>d.jsx(m_,{workflow:u.workflow,isFocused:u.workflow.path===r,onFocus:o,prefix:u.prefix,prefixFull:u.prefixFull,depth:n,...KL(u,l)},u.workflow.path)),e.map(u=>{const m=c.has(yg(u.path));return d.jsxs("div",{className:"workspace-group workspace-subgroup",children:[d.jsxs("div",{className:"workspace-row is-nested"+(m?" is-collapsed":"")+((l==null?void 0:l.dropDir)===u.path?" is-drop-target":""),"data-testid":`dir-row-${u.labelFull}`,style:{"--tree-depth":n},...q2(u.path,l),...Dt({object:"workspace"}),children:[d.jsx(yf,{collapsed:m,onToggle:()=>h(yg(u.path)),label:u.label,testid:`dir-disclosure-${u.labelFull}`,children:d.jsx(ue,{name:m?"Folder":"FolderOpen",size:13})}),d.jsx("button",{type:"button",className:"workspace-row-main",onClick:()=>h(yg(u.path)),title:u.path,"aria-expanded":!m,children:d.jsx("span",{className:"tree-row-label",children:u.label})})]}),!m&&d.jsx(V2,{dirs:u.dirs,agents:u.agents,depth:n+1,focusedAgentPath:r,onFocusAgent:o,collapsedKeys:c,onToggleCollapsed:h,drag:l})]},u.path)})]})}function YL({label:e,root:t,rootAgent:n,collapsed:r,onToggleCollapsed:o,workspaceKey:c,selected:h,onSelectProject:l,focusedAgentPath:u,onFocusAgent:m,trailing:g,focusable:p=!1,disclosable:S=!0,mainTestid:w,tooltip:A,busy:E=!1,drag:y}){const b=(n==null?void 0:n.workflow.path)??null,v=b!=null&&b===u||p&&t===u,_=b??(p?t:null);return d.jsxs("div",{className:"workspace-row"+(n?" workflow-item":"")+(h?" is-selected":"")+(!h&&v?n?" is-focused":" is-selected":"")+(S&&r?" is-collapsed":"")+((y==null?void 0:y.dropDir)===t?" is-drop-target":""),"data-testid":n?`workflow-${n.workflow.name}`:`project-row-${e}`,...q2(t,y),...Dt({object:"workspace"}),children:[S?d.jsx(yf,{collapsed:r,onToggle:o,label:e,testid:`project-disclosure-${e}`,children:d.jsx(Mx,{root:t})}):d.jsx("span",{className:"row-disclosure row-disclosure-static","aria-hidden":"true",children:d.jsx("span",{className:"row-disclosure-mark",children:d.jsx(Mx,{root:t})})}),d.jsx("button",{type:"button",className:"workspace-row-main"+(n?" workflow-item-trigger":""),"data-testid":w??`project-select-${e}`,onClick:c?()=>l(c,t,e):_?()=>m(_):void 0,title:t,"aria-pressed":c?h:_&&!E?v:void 0,"aria-busy":E?!0:void 0,"aria-label":c?`Open dependency graph for ${e}`:_?`Focus ${e}`:void 0,"data-tooltip":A??(c?"Open dependency graph":_?"Focus this agent":void 0),children:d.jsx("span",{className:"tree-row-label",children:e})}),g]})}function XL(e,t){return!t.some(n=>pi(n,e))}function G2(e,t,n){const r=t.filter(o=>pi(o,e));return r.length===0?!1:!n.some(o=>pi(o,e)&&r.some(c=>pi(c,o)&&!Cn(c,o)))}function W2({root:e,recentDirs:t,sessions:n}){const r=[e];return{root:e,nextRecentDirs:t.filter(o=>!Cn(o,e)),endSessionIds:n.filter(o=>o.status!=="exited"&&G2(o.cwd,r,t)).map(o=>o.id)}}function JL(e){return e===0?"No running sessions to end.":e===1?"Ends 1 running session.":`Ends ${e} running sessions.`}async function ZL(e,t){const n=await Promise.allSettled(e.endSessionIds.map(o=>t.endSession(o))),r=e.endSessionIds.filter((o,c)=>{var h;return((h=n[c])==null?void 0:h.status)==="rejected"});return await t.saveRecentDirs(e.nextRecentDirs),{endedCount:e.endSessionIds.length-r.length,failedSessionIds:r}}function QL(e,t){return e.filter(n=>!t.some(r=>Cn(n,r)))}function e8(e,t){return e.filter(n=>pi(n,t))}function t8({label:e,root:t,runningCount:n,onCancel:r,onConfirm:o,triggerRef:c}){const h=O.useRef(null);return za(!0,{onDismiss:r,containerRef:h,triggerRef:c}),d.jsx("div",{className:"modal-backdrop",onClick:r,children:d.jsxs("div",{ref:h,className:"modal modal-confirm",role:"alertdialog","aria-label":`Remove ${e}`,"data-testid":"remove-project-confirm",...Dt({object:"workspace"}),onClick:l=>l.stopPropagation(),children:[d.jsxs("div",{className:"modal-header",children:["Remove ",e,"?",d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:r,children:d.jsx(ue,{name:"X",size:14})})]}),d.jsxs("div",{className:"modal-body",children:[d.jsx("p",{className:"modal-copy","data-testid":"remove-project-confirm-count",children:JL(n)}),d.jsxs("p",{className:"modal-copy",children:[e," and the agents inside it leave the rail. ",d.jsx("strong",{children:"Nothing on disk is touched"})," — no file is created, moved or deleted, and"," ",d.jsx("code",{children:t})," stays exactly where it is. Open the folder again to bring the project back."]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:r,children:"Keep project"}),d.jsx("button",{className:"btn-danger","data-testid":"remove-project-confirm-btn",onClick:o,children:"Remove project"})]})]})})}const $x="unrooted:expanded",s8=5,n8=e=>e.replace(/\\/g,"/").split("/").filter(t=>t!==""&&!/^[A-Za-z]:$/.test(t)).length;function i8(e,t){const n=c=>({root:c,label:zs(c),agentCount:t.filter(h=>pi(c,h)).length}),r=[];let o=e;for(;o!=null&&r.length<s8&&n8(o)>=2;)r.push(n(o)),o=Pc(o);return r.length>0?r:[n(e)]}const r8=e=>`${e} agent${e===1?"":"s"}`;function a8({agent:e,agentPaths:t,onOpenAsProject:n}){const[r,o]=O.useState(!1),c=O.useRef(null),h=i8(e.workflow.path,t);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",ref:c,className:"workspace-row-action","data-testid":`unrooted-open-${e.workflow.path}`,"aria-label":`Open a project for ${e.workflow.name}`,"aria-haspopup":"menu","aria-expanded":r,"data-tooltip":"Open as project",onClick:()=>o(l=>!l),children:d.jsx(ue,{name:"FolderPlus",size:13})}),d.jsx(Ei,{open:r,anchorRef:c,onDismiss:()=>o(!1),placement:"down-end",className:"menu-flyer",testid:`unrooted-open-menu-${e.workflow.path}`,children:d.jsxs("div",{className:"connect-card",children:[d.jsx("div",{className:"connect-card-header",children:d.jsx("span",{children:"Open which folder?"})}),d.jsx("div",{className:"connect-card-body",role:"menu",children:h.map(l=>d.jsxs("button",{type:"button",role:"menuitem",className:"rail-add-row unrooted-open-choice","data-testid":`unrooted-open-choice-${l.root}`,title:l.root,onClick:()=>{o(!1),n(l.root)},children:[d.jsx(ue,{name:"Folder",size:13}),d.jsx("span",{className:"unrooted-open-choice-label",children:l.label}),d.jsx("span",{className:"rail-add-row-cost",children:r8(l.agentCount)})]},l.root))})]})})]})}function o8({agent:e,isFocused:t,onFocus:n,agentPaths:r,onOpenAsProject:o}){const{workflow:c,prefix:h}=e,l=Wr(c.name),u=F2(c,l),m=Pa(c),g=m==="ready";return d.jsxs("div",{className:"workflow-item unrooted-item"+(t?" is-focused":""),"data-testid":`unrooted-agent-${c.path}`,"data-agent-name":c.name,...Dt({object:"agent"}),children:[d.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(c.path),"aria-pressed":t,title:c.path,"data-tooltip":c.path,children:[d.jsxs("span",{className:"tree-row-name",children:[h&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tree-row-prefix","data-testid":`unrooted-prefix-${c.path}`,children:h}),d.jsx("span",{className:"tree-row-sep"+(u?"":" tree-row-sep-loose"),"aria-hidden":"true",children:u?"/":"·"})]}),d.jsx("span",{className:"tree-row-label","data-testid":`unrooted-name-${c.path}`,children:l})]}),d.jsx("span",{className:"workflow-status","data-deployed":g,"data-deployment-state":m,"data-testid":`unrooted-status-${c.path}`,children:d.jsx(ue,{name:g?"Cloud":"CloudOff",size:13})})]}),d.jsx(a8,{agent:e,agentPaths:r,onOpenAsProject:o})]})}function l8({agents:e,collapsed:t,onToggleCollapsed:n,focusedAgentPath:r,onFocusAgent:o,agentPaths:c,onOpenAsProject:h}){return d.jsxs("div",{className:"workspace-group","data-testid":"unrooted-section",children:[d.jsxs("div",{className:"workspace-row"+(t?" is-collapsed":""),children:[d.jsx(yf,{collapsed:t,onToggle:n,label:"agents outside your projects",testid:"unrooted-disclosure",children:d.jsx("span",{className:"project-mark project-mark-none","aria-hidden":"true",children:d.jsx(ue,{name:"Folder",size:13})})}),d.jsxs("button",{type:"button",className:"workspace-row-main",onClick:n,"aria-expanded":!t,"data-testid":"unrooted-header","data-tooltip":"Agents that live outside every project you have open. Open the folder above one as a project to file it.",children:[d.jsx("span",{className:"tree-row-label",children:"Outside your projects"}),d.jsx("span",{className:"unrooted-count","data-testid":"unrooted-count",children:e.length})]})]}),!t&&e.map(l=>d.jsx(o8,{agent:l,isFocused:l.workflow.path===r,onFocus:o,agentPaths:c,onOpenAsProject:h},l.workflow.path))]})}const Ch="application/x-sapiom-agent",K2="application/x-sapiom-group";function c8({label:e,collapsed:t,onToggleCollapsed:n,isUngrouped:r=!1,isDropTarget:o=!1,onRename:c,onDelete:h,startRenaming:l=!1,title:u,dropHandlers:m}){const g=c!=null&&!r,p=h!=null&&!r,[S,w]=O.useState(l&&g?e:null),A=S!==null&&g,E=()=>{const C=(S??"").trim();w(null),C!==""&&C!==e&&(c==null||c(C))},y=O.useRef(null),b=O.useRef(!1),v=O.useRef(!1),_=()=>{b.current=!1,v.current=!1,w(e)},k=()=>{var C;if(!b.current&&!v.current){v.current=!0,(C=y.current)==null||C.focus();return}E()};return d.jsxs("div",{className:"workspace-row is-nested"+(t?" is-collapsed":"")+(o?" is-drop-target":""),style:{"--tree-depth":0},"data-testid":`group-row-${e}`,...Dt({object:"workspace"}),...m,children:[d.jsx(yf,{collapsed:t,onToggle:n,label:e,testid:`group-disclosure-${e}`,children:d.jsx(ue,{name:r?"Folder":"Workflow",size:13})}),A?d.jsx("input",{ref:y,className:"group-name-input","data-testid":"group-rename-input","aria-label":`Rename ${e}`,value:S??"",autoFocus:!0,onFocus:C=>C.currentTarget.select(),onChange:C=>{b.current=!0,w(C.target.value)},onKeyDown:C=>{C.key==="Enter"&&E(),C.key==="Escape"&&w(null)},onBlur:k}):d.jsx("button",{type:"button",className:"workspace-row-main",onClick:n,onDoubleClick:g?_:void 0,"aria-expanded":!t,title:u,"data-tooltip":u,children:d.jsx("span",{className:"tree-row-label",children:e})}),g&&!A&&d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`group-rename-${e}`,"aria-label":`Rename ${e}`,"data-tooltip":"Rename group",onClick:_,children:d.jsx(ue,{name:"Pencil",size:13})}),p&&!A&&d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`group-delete-${e}`,"aria-label":`Delete ${e}`,"data-tooltip":"Delete group. Nothing is removed from disk.",onClick:h,children:d.jsx(ue,{name:"Trash2",size:13})})]})}function u8({workflow:e,prefix:t="",prefixFull:n="",groupId:r,isFocused:o,onFocus:c,draggable:h=!0}){return d.jsx("div",{className:"group-agent-drag",draggable:h,"data-testid":`group-agent-${e.name}`,onDragStart:l=>{h&&(l.dataTransfer.effectAllowed="copyMove",l.dataTransfer.setData(Ch,e.path),l.dataTransfer.setData(K2,r))},children:d.jsx(m_,{workflow:e,prefix:t,prefixFull:n,isFocused:o,onFocus:c,depth:1})})}function d8({sectionLabel:e,groups:t,prefixes:n,editable:r,isDerived:o,freshLabel:c,collapsedKeys:h,onToggleCollapsed:l,focusedAgentPath:u,onFocusAgent:m,onCreate:g,onRename:p,onDelete:S,onDrop:w,onReset:A,resetCount:E}){const[y,b]=O.useState(null),[v,_]=O.useState(!1),k=C=>({onDragOver:x=>{x.dataTransfer.types.includes(Ch)&&(x.preventDefault(),x.dataTransfer.dropEffect=x.altKey?"copy":"move",y!==C&&b(C))},onDragLeave:x=>{x.currentTarget.contains(x.relatedTarget)||b(T=>T===C?null:T)},onDrop:x=>{x.dataTransfer.types.includes(Ch)&&(x.preventDefault(),b(null),w({path:x.dataTransfer.getData(Ch),fromGroupId:x.dataTransfer.getData(K2),toGroupId:C,copy:x.altKey}))}});return d.jsxs(d.Fragment,{children:[t.map(C=>{const x=h.has(C.id),T=r&&C.label===c;return d.jsxs("div",{className:"workspace-group workspace-subgroup","data-testid":`group-section-${C.label}`,...k(C.id),children:[d.jsx(c8,{label:C.label,collapsed:x,onToggleCollapsed:()=>l(C.id),isUngrouped:C.isUngrouped,isDropTarget:y===C.id,startRenaming:T,title:C.isUngrouped?"No launch edge reaches these agents":o?`${C.label} and everything it launches`:void 0,onRename:r&&!C.isUngrouped?R=>p(C.id,R):void 0,onDelete:r&&!C.isUngrouped?()=>S(C.id):void 0}),!x&&C.agents.map(R=>{var M,D;return d.jsx(u8,{workflow:R.workflow,prefix:((M=n==null?void 0:n.get(R.workflow.path))==null?void 0:M.prefix)??"",prefixFull:((D=n==null?void 0:n.get(R.workflow.path))==null?void 0:D.prefixFull)??"",groupId:C.id,isFocused:R.workflow.path===u,onFocus:m,draggable:r},R.workflow.path)}),!x&&C.agents.length===0&&d.jsx("div",{className:"workspace-group-empty",style:{paddingLeft:"calc(2 * var(--tree-indent))"},children:"Drag agents here"})]},C.id+(T?":fresh":""))}),r&&d.jsxs("button",{type:"button",className:"rail-add-row","data-testid":`group-create-${e}`,"aria-label":`New group in ${e}`,onClick:()=>{_(!1),g()},children:[d.jsx(ue,{name:"Plus",size:13}),d.jsx("span",{className:"tree-row-label",children:"New group"})]}),r&&A&&d.jsxs("button",{type:"button",className:"rail-add-row rail-reset-row"+(v?" is-armed":""),"data-testid":`group-reset-${e}`,"aria-label":v?`Confirm resetting ${e} to detected groups`:`Reset ${e} to detected groups`,onClick:()=>{if(!v){_(!0);return}_(!1),A()},onBlur:()=>_(!1),children:[d.jsx(ue,{name:"RefreshCw",size:13}),d.jsx("span",{className:"tree-row-label",children:v?"Confirm reset":"Reset to detected"}),d.jsx("span",{className:"rail-add-row-cost",children:E>0?`Discards ${E} group${E===1?"":"s"}`:"Restores the launch-edge grouping"})]})]})}const qr={version:1,groups:null,renames:{}},kc="group:ungrouped",Xr=e=>e.groups!==null,Qh=e=>({workflow:e,prefix:"",prefixFull:""}),wv=e=>(t,n)=>e==="name"?t.workflow.name.localeCompare(n.workflow.name):t.workflow.path.localeCompare(n.workflow.path);function Y2(e,t,n="recent"){const r=new Map;for(const p of e)p.definitionSlug&&!r.has(p.definitionSlug)&&r.set(p.definitionSlug,p),r.has(p.name)||r.set(p.name,p);const o=[];for(const p of t){const S=r.get(p.parent),w=r.get(p.child);!S||!w||S.path===w.path||o.push({parent:S,child:w})}const c=new Map;for(const p of e)c.set(p.path,p.path);const h=p=>{let S=p;for(;c.get(S)!==S;)S=c.get(S)??S;for(;c.get(p)!==S;){const w=c.get(p)??S;c.set(p,S),p=w}return S};for(const p of o){const S=h(p.parent.path),w=h(p.child.path);S!==w&&c.set(S,w)}const l=new Map;for(const p of e){const S=h(p.path),w=l.get(S);w?w.push(p):l.set(S,[p])}const u=p=>{const S=new Set(p.map(y=>y.path)),w=new Set(o.filter(y=>S.has(y.parent.path)&&S.has(y.child.path)).map(y=>y.child.path)),A=p.filter(y=>!w.has(y.path));return[...A.length>0?A:p].sort((y,b)=>y.name.localeCompare(b.name))[0]},m=[],g=[];for(const p of l.values()){if(p.length<2){g.push(...p);continue}const S=u(p);m.push({id:`group:${S.path}`,label:S.name,agents:p.map(Qh).sort(wv(n)),isUngrouped:!1})}return m.sort((p,S)=>S.agents.length-p.agents.length||p.label.localeCompare(S.label)),g.length>0&&m.push({id:kc,label:"Ungrouped",agents:g.map(Qh).sort(wv(n)),isUngrouped:!0}),m}const g_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),X2=e=>[...new Set(e)];function h8(e){if(!g_(e))return null;const{id:t,label:n,members:r}=e;return typeof t!="string"||t===""?null:{id:t,label:typeof n=="string"&&n!==""?n:t,members:X2(Array.isArray(r)?r.filter(o=>typeof o=="string"):[])}}const f8=e=>{if(!g_(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t};function p8(e){if(!e)return qr;let t;try{t=JSON.parse(e)}catch{return qr}return!g_(t)||t.version!==1?qr:{version:1,groups:Array.isArray(t.groups)?t.groups.map(h8).filter(n=>n!==null):null,renames:f8(t.renames)}}function m8(e){return`${JSON.stringify({version:1,groups:e.groups,renames:e.renames},null,2)}
501
+ `}const g8=e=>Xr(e)?{kind:"write",raw:m8(e)}:{kind:"remove"};function v8(e,t){if(!Xr(e))return e;const n=new Set(t.map(c=>c.path));let r=!1;const o=e.groups.map(c=>{const h=c.members.filter(l=>n.has(l));return h.length===c.members.length?c:(r=!0,{...c,members:h})});return r?{...e,groups:o}:e}const _8=(e,t)=>v8(p8(e),t);function y8(e,t){const n=new Set(t.flatMap(r=>r.members));return e.filter(r=>!n.has(r.path))}function b8(e,t,n,r="recent"){if(!Xr(t))return Y2(e,n,r);const o=new Map(e.map(u=>[u.path,u])),c=wv(r),h=t.groups.map(u=>({id:u.id,label:u.label,agents:u.members.map(m=>o.get(m)).filter(m=>m!==void 0).map(Qh).sort(c),isUngrouped:!1})),l=y8(e,t.groups);return l.length>0&&h.push({id:kc,label:"Ungrouped",agents:l.map(Qh).sort(c),isUngrouped:!0}),h}function S8(e,t,n,r="recent"){return Xr(e)?e:{...e,groups:Y2(t,n,r).filter(o=>!o.isUngrouped).map(o=>({id:o.id,label:o.label,members:o.agents.map(c=>c.workflow.path)}))}}const w8=e=>Xr(e)?{...e,groups:null}:e,x8=e=>Xr(e);function C8(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"group",r=new Set(e.map(c=>c.id));let o=`g_${n}`;for(let c=2;r.has(o);c++)o=`g_${n}-${c}`;return o}function E8(e,t,n=[]){const r=t.trim();return r===""?e:{...e,groups:[...e.groups,{id:C8(e.groups,r),label:r,members:X2(n)}]}}function k8(e,t,n){const r=n.trim();return r===""?e:{...e,groups:e.groups.map(o=>o.id===t?{...o,label:r}:o)}}const j8=(e,t)=>({...e,groups:e.groups.filter(n=>n.id!==t)});function R8(e,t,n){return{...e,groups:e.groups.map(r=>r.id===t&&!r.members.includes(n)?{...r,members:[...r.members,n]}:r)}}function A8(e,t,n){return{...e,groups:e.groups.map(r=>r.id===t?{...r,members:r.members.filter(o=>o!==n)}:r)}}const T8=(e,t)=>({...e,groups:e.groups.map(n=>n.members.includes(t)?{...n,members:n.members.filter(r=>r!==t)}:n)});function N8(e,t){const{path:n,fromGroupId:r,toGroupId:o,copy:c}=t;if(n===""||r===o)return e;if(o===kc)return r===kc?e:T8(e,n);const h=R8(e,o,n);return c||r===kc?h:A8(h,r,n)}const nh=Bc(),Dx=`
502
+ `;function M8(e,t,n,r){const[o,c]=O.useState(null),[h,l]=O.useState({}),[u,m]=O.useState({}),g=O.useRef(t);g.current=t;const p=O.useRef(new Set);O.useEffect(()=>{if(!r)return;let C=!0;return nh.listLaunchEdges().then(x=>{C&&c(x)}).catch(()=>{C&&c([])}),()=>{C=!1}},[r]);const S=e.join(Dx);O.useEffect(()=>{if(r)for(const C of S.split(Dx).filter(Boolean))p.current.has(C)||(p.current.add(C),nh.getRailState(C).then(x=>{l(T=>({...T,[C]:_8(x,g.current)})),m(T=>({...T,[C]:!0}))}).catch(()=>{l(x=>({...x,[C]:qr}))}))},[r,S]);const w=O.useCallback(C=>h[C]??qr,[h]),A=O.useCallback(C=>o!==null&&u[C]===!0,[o,u]),E=O.useRef(new Map),y=O.useCallback((C,x)=>{l(D=>({...D,[C]:x}));const T=g8(x),M=(E.current.get(C)??Promise.resolve()).then(()=>T.kind==="write"?nh.saveRailState(C,T.raw):nh.clearRailState(C));E.current.set(C,M.catch(()=>{}))},[]),b=O.useCallback((C,x,T)=>{if(o===null||!u[C])return;const R=h[C]??qr;y(C,T(S8(R,x,o,n)))},[y,o,u,n,h]),v=O.useCallback(C=>{u[C]&&y(C,w8(h[C]??qr))},[y,u,h]),_=O.useCallback(C=>t.filter(x=>pi(C,x.path)),[t]),k=O.useCallback((C,x)=>b8(x,h[C]??qr,o??[],n),[o,n,h]);return O.useMemo(()=>({groupsFor:k,agentsIn:_,isReady:A,stateFor:w,edit:b,reset:v}),[k,_,A,w,b,v])}const $8=6e4,D8=Bc();function O8(e){return e.plan!==null||e.readout.kind!=="none"}function L8(e){const[t,n]=O.useState(null);return O.useEffect(()=>{let r=!1;n(null);const o=()=>{D8.getAccountPlan().then(h=>{r||n(O8(h)?h:null)},()=>{r||n(null)})};o();const c=setInterval(o,$8);return()=>{r=!0,clearInterval(c)}},[e]),t}const I8=Bc(),P8=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),B8=P8?"⌘K":"Ctrl+K",z8=()=>hi().preferredHarness==="codex"?"codex":"claude-code",J2=["project","group"],H8={project:"Project",group:"Group"},Ox=e=>J2.includes(e)?e:"project",U8={recent:"Recent activity",name:"Name"};function Lx({testid:e,harness:t,title:n,meta:r,cwd:o,resumeMode:c,isSelected:h,onOpen:l}){const u=c==="agent-resume"?"true":c==="rehydrate"?"false":"unknown";return d.jsxs("button",{"data-testid":e,className:"session-dropdown-item"+(h?" is-selected":""),"data-resumable":u,title:o,onClick:l,...Dt({object:"session"}),children:[d.jsx("span",{className:"session-item-icon",children:d.jsx(d_,{kind:t,size:13})}),d.jsxs("span",{className:"session-item-copy",children:[d.jsx("span",{className:"session-item-title",children:n}),d.jsx("span",{className:"session-item-meta",children:r})]})]})}function F8({width:e,minWidth:t,workflows:n,sessions:r,pendingWorkspaces:o,activeSessionId:c,focusedAgentPath:h,workspaceScopes:l,selectedWorkspaceKey:u,onSelectWorkspace:m,onFocusAgent:g,onOpenPalette:p,onConnect:S,onCollapse:w,canGoBack:A,canGoForward:E,onGoBack:y,onGoForward:b,onSelectSession:v,overviewSelected:_,onSelectOverview:k,onNewSession:C,onReviewSummary:x,history:T,historyLoading:R,onOpenHistory:M,recentDirs:D,closedProjects:L,unsearchedCheckouts:q,onRemoveProject:F,onOpenProject:Y,launchDir:Q,listDir:G,onCreateSession:ee,listHarnesses:ne,onScaffoldSession:z,onScaffoldInSession:B,projectRoot:$,onSaveProjectRoot:H,onBrowseTemplates:U,templatesActive:P,onScanWorkflows:W,onToast:se,telemetryOptIn:X,productAnalyticsOptIn:V,rollingSummary:ce,consentSource:oe,consentEnvReason:Z,authenticated:te,organizationName:pe,onToggleTelemetry:ye,onToggleProductAnalytics:Ee,onToggleRollingSummary:Ie,editor:Pe,onSelectEditor:Fe,onStartAuth:je,onDisconnect:Ue,settingsOpen:Ye,onSetSettingsOpen:jt}){const rt=L8(te),[Ct,dt]=O.useState(null);O.useEffect(()=>{const le=pr();if(le!=null&&le.onUpdateState)return le.onUpdateState(De=>{dt(De.kind==="downloaded"?{version:De.version}:null)})},[]);const[Lt,mt]=O.useState(null),Ut=Lt!==null,Ss=O.useRef(null),Yt=O.useRef(null),ms=O.useRef(null),[_t,$s]=O.useState(!1),[as,Et]=O.useState(!1),[It,Hs]=O.useState(()=>Ox(hi().railAxis)),[Xs,In]=O.useState(()=>hi().railSort==="name"?"name":"recent"),Gs=le=>{Hs(le),Ci({railAxis:le}),Et(!1)},ot=le=>{In(le),Ci({railSort:le}),Et(!1)},Us=O.useRef(null),os=O.useCallback(()=>{$s(!1),Et(!1)},[]),[js,un]=O.useState(()=>new Set(hi().collapsedKeys??[])),Js=O.useCallback(le=>{un(De=>{const fe=new Set(De);return fe.has(le)?fe.delete(le):fe.add(le),fe})},[]);O.useEffect(()=>{Ci({collapsedKeys:Array.from(js)})},[js]);const _n=r.filter(le=>le.status==="exited"),Pn=()=>{const le=!_t;if(Et(!1),$s(le),le){const De=c2(r,D,c);De.length>0&&M(De)}},ls=new Set(r.map(le=>le.id)),mi=new Set(r.map(le=>le.agentSessionId).filter(le=>le!=null)),xs=T.filter(le=>!(le.harnessSessionId!=null&&ls.has(le.harnessSessionId))&&!mi.has(le.agentSessionId)),kn=[..._n.map(le=>({kind:"exited",at:le.lastActiveAt,session:le})),...xs.map(le=>({kind:"summary",at:le.lastActiveAt,summary:le}))].sort((le,De)=>De.at.localeCompare(le.at)),gi=new Map(T.map(le=>[le.agentSessionId,le])),Ze=o.map(le=>le.cwd),Zs=[...D,...Ze],tt=le=>!G2(le,L,Zs),jn=n.filter(le=>tt(le.path)),Ds=GL({recentDirs:D,sessions:r,pendingCwds:Ze,sort:Xs}).filter(tt),kt=qL(jn,Ds,Xs),Xt=VL(jn,Ds,Xs),dn=n.map(le=>le.path),[Rs,hn]=O.useState(null),Rn=O.useRef(null),[Qs,Fs]=O.useState(null),ws=It==="project"?{dropDir:Qs,setDropDir:Fs,onDropInto:(le,De)=>{Fs(null);const fe=NR(le,De,n.map(Le=>Le.path));if(!fe.ok){fe.reason&&se(fe.reason);return}I8.moveAgent(fe.from,fe.to).catch(Le=>{se((Le instanceof gn?Le.reason:null)??(Le instanceof Error?Le.message:`Couldn't move ${fe.name}.`))})}}:void 0,re=M8(Ds,n,Xs,It==="group"),[he,be]=O.useState(null),xe=le=>{const De=new Set(le.map(Le=>Le.label));if(!De.has("New group"))return"New group";let fe=2;for(;De.has(`New group ${fe}`);)fe++;return`New group ${fe}`},Ae=(le,De)=>{const fe=re.agentsIn(le);fe.some(Le=>Le.path===De.path)&&(be(null),re.edit(le,fe,Le=>N8(Le,De)))},ze=le=>r.filter(De=>De.status!=="exited"&&De.boundWorkflowPath==null&&Cn(De.cwd,le)).sort((De,fe)=>fe.createdAt.localeCompare(De.createdAt)||De.id.localeCompare(fe.id))[0],st=kt.some(le=>!Ax(le)),We=!st&&Xt.length===0&&kt.length===0,Rt=!st&&Xt.length===0;return d.jsxs("aside",{ref:ms,className:"rail rail-workflows",style:{width:e,minWidth:t},...Dt({surface:"agent_rail"}),children:[d.jsx(ML,{onCollapse:w,canGoBack:A,canGoForward:E,onGoBack:y,onGoForward:b}),d.jsxs("nav",{className:"rail-nav","aria-label":"Primary",children:[d.jsxs("button",{type:"button",className:"rail-nav-cta"+(We?" is-empty":""),"data-testid":"rail-create-new","aria-label":"Create a new agent",onClick:()=>{$s(!1),C()},children:[d.jsx(ue,{name:"Plus",size:14}),d.jsx("span",{children:"Create new"})]}),d.jsxs("button",{type:"button",className:"rail-nav-row","data-testid":"palette-trigger","aria-label":"Search sessions, agents, and paths",onClick:p,children:[d.jsx(ue,{name:"Search",size:14}),d.jsx("span",{children:"Search"}),d.jsx("span",{className:"rail-nav-kbd",children:B8})]}),d.jsxs("button",{type:"button",className:"rail-nav-row"+(P?" is-selected":""),"data-testid":"rail-templates","aria-current":P?"page":void 0,onClick:U,children:[d.jsx(ue,{name:"LayoutTemplate",size:14}),d.jsx("span",{children:"Templates"})]}),d.jsxs("button",{type:"button",ref:Ss,className:"rail-nav-row","data-testid":"add-existing-agents","aria-haspopup":"dialog","aria-expanded":Ut,onClick:()=>{$s(!1),mt("detect")},children:[d.jsx(ue,{name:"FolderPlus",size:14}),d.jsx("span",{children:"Add existing agents"})]})]}),d.jsxs("div",{className:"rail-header",children:[d.jsx("span",{className:"rail-header-label",children:It==="group"?"Groups":"Projects"}),d.jsxs("div",{className:"rail-header-actions",children:[d.jsx("button",{type:"button",className:"theme-toggle rail-header-btn",ref:Yt,"data-testid":"rail-add-project","aria-label":"Add a project","data-tooltip":"Add a project",onClick:()=>{$s(!1),mt("open")},children:d.jsx(ue,{name:"FolderPlus",size:14})}),d.jsx("button",{ref:Us,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Rail settings","aria-haspopup":"menu","aria-expanded":_t,"data-tooltip":"Filing, sorting and past sessions",onClick:Pn,children:d.jsx(ue,{name:"EllipsisVertical",size:14})})]})]}),d.jsxs("div",{className:"rail-tree",children:[d.jsx(Ei,{open:_t,anchorRef:Us,onDismiss:os,placement:"right-start",besideRef:ms,noClip:!0,className:"menu-flyer",testid:"history-menu",children:d.jsxs("div",{className:"menu-flyer-track",children:[d.jsxs("div",{className:"connect-card history-card",children:[d.jsxs("div",{className:"connect-card-header",children:[d.jsx("span",{children:"Projects"}),d.jsx("button",{className:"theme-toggle connect-card-close",onClick:os,"aria-label":"Close",title:"Close",children:d.jsx(ue,{name:"X",size:13})})]}),d.jsxs("div",{className:"connect-card-body",role:"menu",children:[d.jsxs("div",{className:"menu-choice-group",onMouseEnter:()=>Et(!1),children:[d.jsxs("label",{className:"filing-field",children:[d.jsx("span",{className:"filing-field-label",children:"Group by"}),d.jsx("select",{className:"filing-field-select","data-testid":"filing-group-by",value:It,onChange:le=>Gs(Ox(le.target.value)),children:J2.map(le=>d.jsx("option",{value:le,children:H8[le]},le))})]}),d.jsxs("label",{className:"filing-field",children:[d.jsx("span",{className:"filing-field-label",children:"Sort by"}),d.jsx("select",{className:"filing-field-select","data-testid":"filing-sort-by",value:Xs,onChange:le=>ot(le.target.value==="name"?"name":"recent"),children:["recent","name"].map(le=>d.jsx("option",{value:le,children:U8[le]},le))})]})]}),d.jsxs("button",{type:"button",className:"session-dropdown-item nested-trigger"+(as?" is-open":""),"data-testid":"past-sessions-trigger","aria-haspopup":"menu","aria-expanded":as,onMouseEnter:()=>Et(!0),onClick:()=>Et(le=>!le),children:[d.jsx("span",{className:"session-item-icon",children:d.jsx(ue,{name:"History",size:13})}),d.jsx("span",{className:"session-item-copy",children:d.jsx("span",{className:"session-item-title",children:"Past sessions"})}),_n.length>0&&d.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:_n.length}),d.jsx(ue,{name:"ChevronRight",size:13})]})]})]}),as&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"menu-flyer-bridge","aria-hidden":"true"}),d.jsxs("div",{className:"connect-card menu-flyer-nested",children:[d.jsxs("div",{className:"connect-card-header",children:[d.jsx("span",{children:"Past sessions"}),d.jsx("button",{className:"theme-toggle connect-card-close",onClick:()=>Et(!1),"aria-label":"Back",title:"Back",children:d.jsx(ue,{name:"X",size:13})})]}),d.jsxs("div",{className:"connect-card-body past-sessions-list","data-testid":"past-sessions-card",children:[kn.map(le=>{if(le.kind==="exited"){const De=le.session.agentSessionId==null?void 0:gi.get(le.session.agentSessionId),fe=le.session.agentSessionId==null?"rehydrate":De==null?void 0:De.resumeMode;return d.jsx(Lx,{testid:`exited-session-${le.session.id}`,harness:le.session.harness,title:le.session.title,meta:mv({...le.session,gitBranch:De==null?void 0:De.gitBranch,turnCount:De==null?void 0:De.turnCount,messageCount:De==null?void 0:De.messageCount},void 0,{includeHarness:!1,state:MS({resumeMode:fe,turnCount:De==null?void 0:De.turnCount})}),cwd:le.session.cwd,resumeMode:fe,isSelected:le.session.id===c,onOpen:()=>{v(le.session.id),os()}},le.session.id)}return d.jsx(Lx,{testid:`history-${le.summary.agentSessionId}`,harness:le.summary.harness,title:le.summary.title,meta:mv(le.summary,void 0,{includeHarness:!1,state:MS(le.summary)}),cwd:le.summary.cwd,resumeMode:le.summary.resumeMode,isSelected:!1,onOpen:()=>{x(le.summary),os()}},le.summary.agentSessionId)}),R&&d.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!R&&kn.length===0&&d.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]})]})]})}),d.jsxs("div",{className:"rail-list",children:[Rt&&kt.length===0&&d.jsx(wn,{className:"rail-empty",icon:"Folder",title:"No agents yet",body:"Add a project folder to start a session in it. Agents (sapiom.json) anywhere inside it appear here automatically."}),kt.map(le=>{var Bt,Jn;const De=js.has(Nx(le.root)),fe=(l??[]).find(gt=>Cn(gt.cwd,le.root)),Le=Ze.some(gt=>Cn(gt,le.root)),Me=Ax(le),Qe=Me?ze(le.root):void 0,it=Le&&Me&&Qe==null,St=It==="group"?re.agentsIn(le.root):[],Ge=It==="group"&&St.length>1,Je=St.filter(gt=>{var gs;return gt.path!==((gs=le.rootAgent)==null?void 0:gs.workflow.path)}),lt=Ge?re.groupsFor(le.root,St):[],wt=re.stateFor(le.root);return d.jsxs("div",{className:"workspace-group","data-testid":`workspace-group-${le.label}`,children:[d.jsx(YL,{label:le.label,root:le.root,rootAgent:Ge?null:le.rootAgent,collapsed:De,onToggleCollapsed:()=>Js(Nx(le.root)),workspaceKey:(fe==null?void 0:fe.workspaceKey)??null,selected:(fe==null?void 0:fe.workspaceKey)===u,onSelectProject:m,focusedAgentPath:h,onFocusAgent:g,focusable:it||Qe!=null,disclosable:It==="group"?Ge||Je.length>0:le.dirs.length>0||le.agents.length>0,busy:it,drag:ws,mainTestid:fe?void 0:it?`workspace-pending-${le.label}`:Qe?`workspace-focus-${le.label}`:void 0,tooltip:it?"Creating agent…":Qe?"Project with sessions, no agent yet. Focus to work in it.":void 0,trailing:d.jsxs(d.Fragment,{children:[it?d.jsx("span",{className:"workspace-row-spinner","aria-hidden":"true"}):Qe?d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`workspace-scaffold-${le.label}`,"aria-label":`Scaffold an agent in ${le.label}`,"data-tooltip":"Scaffold an agent here",onClick:()=>B(Qe.id),children:d.jsx(ue,{name:"Sparkles",size:13})}):null,d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`project-remove-${le.label}`,"aria-label":`Remove ${le.label} from the rail`,"data-tooltip":"Remove project",onClick:gt=>{Rn.current=gt.currentTarget,hn({root:le.root,label:le.label})},children:d.jsx(ue,{name:"X",size:13})})]})}),!De&&Me&&!it&&Qe==null&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"workspace-row is-nested workspace-row-empty",children:[d.jsx("span",{className:"row-disclosure row-disclosure-static","aria-hidden":"true"}),d.jsxs("button",{type:"button",className:"tree-row tree-row-empty-action","data-testid":`project-empty-${le.label}`,"data-tooltip":`Start an agent in ${le.root}`,onClick:()=>{z(le.root,z8()).catch(gt=>{se(gt instanceof Error?gt.message:`Couldn't start an agent in ${le.label}.`)})},children:[d.jsx(ue,{name:"Sparkles",size:13}),d.jsx("span",{className:"tree-row-label",children:(((Bt=q[le.root])==null?void 0:Bt.length)??0)>0?"Create an agent here":"Create the first agent here"})]})]}),(((Jn=q[le.root])==null?void 0:Jn.length)??0)>0&&d.jsxs("div",{className:"workspace-row is-nested",children:[d.jsx("span",{className:"row-disclosure row-disclosure-static","aria-hidden":"true"}),d.jsxs("div",{className:"tree-row tree-row-note","data-testid":`project-unsearched-${le.label}`,title:`Open one as its own project to see its agents:
503
+ ${q[le.root].join(`
504
+ `)}`,children:[d.jsx(ue,{name:"GitBranch",size:13}),d.jsx("span",{className:"tree-row-label",children:q[le.root].length===1?"1 checkout not searched":`${q[le.root].length} checkouts not searched`})]})]})]}),!De&&It==="project"&&d.jsx(V2,{dirs:le.dirs,agents:le.agents,depth:0,focusedAgentPath:h,onFocusAgent:g,collapsedKeys:js,onToggleCollapsed:Js,drag:ws}),!De&&Ge&&d.jsx(d8,{sectionLabel:le.label,groups:lt,prefixes:Tx(St,le.root),editable:re.isReady(le.root),isDerived:!Xr(wt),freshLabel:(he==null?void 0:he.root)===le.root?he.label:null,collapsedKeys:js,onToggleCollapsed:Js,focusedAgentPath:h,onFocusAgent:g,onCreate:()=>{const gt=xe(lt);re.edit(le.root,St,gs=>E8(gs,gt)),be({root:le.root,label:gt})},onRename:(gt,gs)=>{be(null),re.edit(le.root,St,Ha=>k8(Ha,gt,gs))},onDelete:gt=>{be(null),re.edit(le.root,St,gs=>j8(gs,gt))},onDrop:gt=>Ae(le.root,gt),onReset:x8(wt)?()=>{be(null),re.reset(le.root)}:void 0,resetCount:Xr(wt)?wt.groups.length:0}),!De&&It==="group"&&!Ge&&Je.map(gt=>{const gs=Tx(Je,le.root).get(gt.path);return d.jsx(m_,{workflow:gt,prefix:(gs==null?void 0:gs.prefix)??"",prefixFull:(gs==null?void 0:gs.prefixFull)??"",isFocused:gt.path===h,onFocus:g},gt.path)})]},le.root)}),Xt.length>0&&d.jsx(l8,{agents:Xt,collapsed:!js.has($x),onToggleCollapsed:()=>Js($x),focusedAgentPath:h,onFocusAgent:g,agentPaths:dn,onOpenAsProject:le=>{Y(le).catch(De=>{se(De instanceof Error?De.message:"Couldn't open that folder.")})}})]})]}),d.jsxs("div",{className:"rail-footer",children:[Ct&&(()=>{const le=pr();return le?d.jsx(OL,{desktop:le,version:Ct.version,onToast:se}):null})(),d.jsx(DL,{plan:rt}),d.jsx(q8,{onToast:se,authenticated:te,organizationName:pe,telemetryOptIn:X,productAnalyticsOptIn:V,rollingSummary:ce,consentSource:oe,consentEnvReason:Z,onToggleTelemetry:ye,onToggleProductAnalytics:Ee,onToggleRollingSummary:Ie,editor:Pe,onSelectEditor:Fe,onStartAuth:je,onDisconnect:Ue,settingsOpen:Ye,onSetSettingsOpen:jt,overviewSelected:_,onSelectOverview:k})]}),Lt&&d.jsx(u_,{mode:Lt,recentDirs:D,launchDir:Q,projectRoot:$,listDir:G,onClose:()=>mt(null),onConnect:S,onOpenProject:Y,onScan:W,triggerRef:Lt==="open"?Yt:Ss}),Rs&&d.jsx(t8,{label:Rs.label,root:Rs.root,runningCount:W2({root:Rs.root,recentDirs:D,sessions:r}).endSessionIds.length,onCancel:()=>hn(null),onConfirm:()=>{const le=Rs.root;hn(null),F(le)},triggerRef:Rn})]})}function q8({authenticated:e,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,rollingSummary:o,consentSource:c,consentEnvReason:h,onToggleTelemetry:l,onToggleProductAnalytics:u,onToggleRollingSummary:m,editor:g,onSelectEditor:p,onStartAuth:S,onDisconnect:w,settingsOpen:A,onSetSettingsOpen:E,overviewSelected:y,onSelectOverview:b,onToast:v}){const[_,k]=O.useState(!1),[C,x]=O.useState(nf());O.useEffect(()=>Nv(x),[]);const[T,R]=O.useState({status:"idle"}),M=O.useRef(null),D=O.useCallback(()=>k(!1),[]),L=O.useCallback(()=>E(!1),[E]),q=oC(),F=T.status==="pending",Y=pr(),[Q,G]=O.useState(!1),ee=async()=>{if(!(!Y||Q)){G(!0),D();try{const H=await Y.checkForUpdates(),U=I2(H);v(U.text,U.tone==="error"?"error":H.kind==="up-to-date"||H.kind==="downloaded"?"success":"info")}catch{v("Couldn't check for updates.")}finally{G(!1)}}};e&&T.status==="pending"&&R({status:"idle"});const ne=F?"Connecting…":e?t??"Signed in":"Not signed in",z=F?"opening browser":e?"Sapiom account":"connect to get started",B=(t??"S").charAt(0).toUpperCase(),$=async()=>{D(),R({status:"pending"});try{await S()}catch(H){const U=H instanceof Error?H.message:"Could not start sign-in. Try again.";R({status:"error",message:U})}};return d.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[d.jsxs("button",{ref:M,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":_,title:"Account",onClick:()=>{const H=!_;k(H),H&&L()},children:[d.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:B}),d.jsxs("span",{className:"rail-profile-copy",children:[d.jsx("span",{className:"rail-profile-name",children:ne}),d.jsxs("span",{className:"rail-profile-meta",children:[d.jsx("span",{className:"identity-dot","data-authenticated":e,"data-pending":F}),z]})]}),d.jsx(ue,{name:"ChevronDown",size:14})]}),d.jsx(Ei,{open:A,anchorRef:M,onDismiss:L,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:d.jsx(BL,{authenticated:e,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,rollingSummary:o,consentSource:c,consentEnvReason:h,onToggleTelemetry:l,onToggleProductAnalytics:u,onToggleRollingSummary:m,editor:g,onSelectEditor:p,onStartAuth:S,onDisconnect:w})}),d.jsxs(Ei,{open:_,anchorRef:M,onDismiss:D,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[d.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(y?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{b(),D()},children:[d.jsx(ue,{name:"Info",size:13}),"Overview"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(uC,"_blank","noopener,noreferrer"),D()},children:[d.jsx(ue,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{E(!0),D()},children:[d.jsx(ue,{name:"Settings",size:13}),"Settings"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"theme-toggle",onClick:()=>{tC(),D()},children:[d.jsx(ue,{name:C==="dark"?"Sun":"Moon",size:13}),C==="dark"?"Switch to light mode":"Switch to dark mode"]}),Y&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-check-updates",disabled:Q,onClick:()=>void ee(),children:[d.jsx(ue,{name:Q?"Loader":"RefreshCw",size:13}),Q?"Checking…":"Check for updates",Y.appVersion&&d.jsxs("span",{className:"profile-menu-version","data-testid":"app-version",children:["v",Y.appVersion]})]}),!e&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:F,onClick:()=>void $(),children:[d.jsx(ue,{name:"Plug",size:13}),F?"Connecting…":"Connect account"]}),e&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{w(),D()},children:[d.jsx(ue,{name:"LogOut",size:13}),"Disconnect"]}),q,T.status==="error"&&d.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:T.message})]})]})}function V8(){const e=new Map,t=new Map,n=new Map,r=new Map,o=new Set,c=new Set,h=new Set,l=m=>{const g=n.get(m);if(g)return g;const p={generation:0,retired:!1};return n.set(m,p),p},u=(m,g)=>{const p=l(g),S=p.generation,w=e.get(g);if((w==null?void 0:w.lifetime)===p&&w.generation===S)return w.promise;const A=t.get(g),E=r.get(g)??-1,b=A!==void 0&&A.state!=="ready"&&c.has(g)&&!h.has(g);if(A&&A.revision>=E&&!o.has(g)&&!b){const k=Promise.resolve(A);return e.set(g,{lifetime:p,generation:S,promise:k}),k}b&&h.add(g);const v=o.has(g);let _;return _=Promise.resolve().then(()=>v?m.getSystemGraph(g,{refresh:!0}):m.getSystemGraph(g)).then(k=>{var x,T;if(k.workspaceKey!==g)throw new Error("Invalid system graph response");if(p.retired)return k;const C=r.get(g)??-1;return k.revision<C||p.generation!==S&&o.has(g)&&!v?(((x=e.get(g))==null?void 0:x.promise)===_&&e.delete(g),u(m,g)):(t.set(g,k),o.delete(g),k.state!=="ready"&&!c.has(g)?(c.add(g),((T=e.get(g))==null?void 0:T.promise)===_&&e.delete(g)):k.state==="ready"&&(c.delete(g),h.delete(g)),k)}),e.set(g,{lifetime:p,generation:S,promise:_}),_.catch(()=>{var k;((k=e.get(g))==null?void 0:k.promise)===_&&e.delete(g)}),_};return{load:u,invalidate(m,g){var S;const p=Math.max(((S=t.get(m))==null?void 0:S.revision)??-1,r.get(m)??-1);return g!==void 0&&g<=p?!1:(g!==void 0?r.set(m,g):o.add(m),l(m).generation+=1,e.delete(m),c.delete(m),h.delete(m),!0)},retain(m){const g=new Set([...e.keys(),...t.keys(),...n.keys(),...r.keys(),...o,...c,...h]);for(const p of g){if(m.has(p))continue;const S=n.get(p);S&&(S.retired=!0),n.delete(p),e.delete(p),t.delete(p),r.delete(p),o.delete(p),c.delete(p),h.delete(p)}},peek:m=>t.get(m)??null}}const Uo=V8();function bg(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t}function Ix(e){const t=e.replace(/\\/g,"/"),n=/^([A-Za-z]):\//.exec(t);if(n){const o=bg(t.slice(n[0].length));return o?{caseInsensitive:!0,root:`drive:${n[1].toLowerCase()}`,segments:o}:null}if(t.startsWith("//")){const o=bg(t.slice(2));return!o||o.length<2?null:{caseInsensitive:!0,root:`unc:${o[0].toLowerCase()}/${o[1].toLowerCase()}`,segments:o.slice(2)}}if(!t.startsWith("/"))return null;const r=bg(t.slice(1));return r?{caseInsensitive:!1,root:"posix:/",segments:r}:null}function G8(e,t){const n=Ix(e),r=Ix(t);if(!n||!r||n.root!==r.root||n.caseInsensitive!==r.caseInsensitive||n.segments.length>r.segments.length)return null;const o=(l,u)=>n.caseInsensitive?l.toLowerCase()===u.toLowerCase():l===u;return n.segments.some((l,u)=>!o(l,r.segments[u]))?null:`local:${r.segments.slice(n.segments.length).join("/")||r.segments.at(-1)||"root"}`}function W8(e,t,n,r){var u;const o=r.find(m=>m.workspaceKey===t);if(!o)return new Map;const c=new Set(e.map(m=>m.agentKey)),h=new Map,l=(m,g)=>{if(!m||!c.has(m))return;const p=h.get(m)??new Set;p.add(g),h.set(m,p)};for(const m of n){const g=G8(o.cwd,m.path);g!==null&&(l(((u=m.definitionSlug)==null?void 0:u.trim())||null,m),l(g,m))}return new Map([...h.entries()].filter(([,m])=>m.size===1).map(([m,g])=>[m,[...g][0]]))}const ef=184,ih=64,xv=48,Px=12,K8=64,rh=32,Y8=24,X8=8,li=16,Ys=(e,t)=>e===t?0:e<t?-1:1,ks=e=>Math.round(e*100)/100;function J8(e,t){const n=Math.max(128,(e+t+1)*96);let r=0;return{step(){if(r+=1,r>n)throw new Error("System graph layout exceeded its finite work budget")}}}function Z8(e){const t=new Set;for(const n of e.nodes){if(!n.id||t.has(n.id))throw new Error("Invalid system graph layout input");t.add(n.id)}if(e.edges.some(n=>!t.has(n.from)||!t.has(n.to)))throw new Error("Invalid system graph layout input")}function Q8(e,t){const n=new Map(e.map(c=>[c,new Set])),r=new Map(e.map(c=>[c,new Set]));for(const c of t)n.get(c.from).add(c.to),r.get(c.from).add(c.to),r.get(c.to).add(c.from);const o=c=>new Map([...c.entries()].map(([h,l])=>[h,[...l].sort(Ys)]));return{directed:o(n),undirected:o(r)}}function eI(e,t,n){const r=new Set,o=[];for(const c of e){if(n.step(),r.has(c))continue;const h=[],l=[c];for(r.add(c);l.length>0;){n.step();const u=l.shift();h.push(u);for(const m of t.get(u)??[])n.step(),!r.has(m)&&(r.add(m),l.push(m))}h.sort(Ys),o.push(h)}return o}function tI(e,t,n){const r=new Set(e),o=new Map,c=new Map,h=[],l=new Set,u=[];let m=0;const g=p=>{n.step(),o.set(p,m),c.set(p,m),m+=1,h.push(p),l.add(p);for(const w of t.get(p)??[])n.step(),r.has(w)&&(o.has(w)?l.has(w)&&c.set(p,Math.min(c.get(p),o.get(w))):(g(w),c.set(p,Math.min(c.get(p),c.get(w)))));if(c.get(p)!==o.get(p))return;const S=[];for(;h.length>0;){n.step();const w=h.pop();if(l.delete(w),S.push(w),w===p)break}S.sort(Ys),u.push(S)};for(const p of e)o.has(p)||g(p);return u.sort((p,S)=>Ys(p[0],S[0]))}function sI(e,t,n){const r=e.map(g=>`scc:${g[0]}`),o=new Map;e.forEach((g,p)=>{for(const S of g)o.set(S,r[p])});const c=new Map(r.map(g=>[g,new Set])),h=new Map(r.map(g=>[g,0]));for(const g of t){n.step();const p=o.get(g.from),S=o.get(g.to);!p||!S||p===S||c.get(p).has(S)||(c.get(p).add(S),h.set(S,h.get(S)+1))}const l=new Map(r.map(g=>[g,0])),u=r.filter(g=>h.get(g)===0).sort(Ys);let m=0;for(;u.length>0;){n.step();const g=u.shift();m+=1;for(const p of[...c.get(g)].sort(Ys))n.step(),l.set(p,Math.max(l.get(p),l.get(g)+1)),h.set(p,h.get(p)-1),h.get(p)===0&&(u.push(p),u.sort(Ys))}if(m!==e.length)throw new Error("System graph SCC condensation was not acyclic");return e.map((g,p)=>({id:r[p],nodeIds:[...g],rank:l.get(r[p])})).sort((g,p)=>g.rank-p.rank||Ys(g.id,p.id))}function nI(e){Z8(e);const t=sC(e.edges),n=e.nodes.map(u=>u.id).sort(Ys),r=J8(n.length,t.length),{directed:o,undirected:c}=Q8(n,t),l=eI(n,c,r).map(u=>{const m=new Set(u),g=t.filter(S=>m.has(S.from)&&m.has(S.to)),p=sI(tI(u,o,r),g,r);return{id:`component:${u[0]}`,nodeIds:[...u],stronglyConnected:p,connected:g.length>0}});return l.sort((u,m)=>Number(m.connected)-Number(u.connected)||Ys(u.id,m.id)),{components:l}}function iI(e){const t=[],n=new Map,r=new Map,o=new Map;let c=0;for(const h of e.components){const l=new Map;for(const S of h.stronglyConnected){const w=l.get(S.rank)??[];w.push(...S.nodeIds),w.sort(Ys),l.set(S.rank,w);for(const A of S.nodeIds)o.set(A,S.id),r.set(A,h.id)}const u=[...l.keys()].sort((S,w)=>S-w),m=S=>{const w=l.get(S).length;return w*ih+Math.max(0,w-1)*Px},g=Math.max(ih,...u.map(m));for(const S of u){const w=l.get(S),A=c+(g-m(S))/2;w.forEach((E,y)=>{t.push({id:E,x:S*(ef+xv),y:A+y*(ih+Px),width:ef,height:ih,componentId:h.id})})}const p=t.filter(S=>S.componentId===h.id);n.set(h.id,{minX:Math.min(...p.map(S=>S.x)),minY:Math.min(...p.map(S=>S.y)),maxX:Math.max(...p.map(S=>S.x+S.width)),maxY:Math.max(...p.map(S=>S.y+S.height))}),c+=g+K8}return t.sort((h,l)=>Ys(h.id,l.id)),{nodes:t,componentBoxes:n,componentByNode:r,strongByNode:o}}function Bx(e,t,n){const r=new Map;for(const o of e){const c=n==="source"?o.edge.from:o.edge.to,h=n==="source"||o.route==="cycle"?"right":"left",l=`${c}:${h}`;r.set(l,[...r.get(l)??[],o])}for(const o of r.values()){o.sort((h,l)=>{const u=t.get(n==="source"?h.edge.to:h.edge.from),m=t.get(n==="source"?l.edge.to:l.edge.from);return u.y-m.y||u.x-m.x||Ys(h.edge.from,l.edge.from)||Ys(h.edge.to,l.edge.to)});const c=o.length<=1?0:Math.min(X8,Y8*2/(o.length-1));o.forEach((h,l)=>{const u=ks((l-(o.length-1)/2)*c);n==="source"?h.sourceOffset=u:h.targetOffset=u})}}function rI(e){return e.length===2?"blocking + async":e[0]}function aI(e){return Math.max(40,e.length*6.5+8)}function ah(e,t,n=0){return!(e.x+e.width+n<=t.x||t.x+t.width+n<=e.x||e.y+e.height+n<=t.y||t.y+t.height+n<=e.y)}function oI(e,t,n,r,o){var k;const c=t.get(e.edge.from),h=t.get(e.edge.to),l=aI(e.label),u=e.points[0],m=e.points.at(-1),g=(u.x+m.x)/2,p=Math.min(c.y,h.y),S=Math.max(c.y+c.height,h.y+h.height),w=((k=e.points[1])==null?void 0:k.x)??g,A=e.route==="cycle"?h.x+h.width/2:h.x-l/2-8,E=[{x:A,y:h.y-li/2-4},{x:A,y:h.y+h.height+li/2+4},{x:w,y:p-li/2-4},{x:w,y:S+li/2+4},{x:g,y:p-li/2-4},{x:g,y:S+li/2+4}],y=n.map(C=>({x:C.x,y:C.y,width:C.width,height:C.height})),b=E.map(C=>({x:C.x-l/2,y:C.y-li/2,width:l,height:li})).find(C=>!y.some(x=>ah(C,x,2))&&!r.some(x=>ah(C,x,2)));if(b)return b;const v=(o.minX+o.maxX-l)/2,_=(n.length+r.length+1)*6;for(let C=0;C<_;C+=1)for(const x of[o.minY-li-8-C*(li+4),o.maxY+8+C*(li+4)]){const T={x:v,y:x,width:l,height:li};if(!y.some(R=>ah(T,R,2))&&!r.some(R=>ah(T,R,2)))return T}throw new Error("System graph labels exceeded their finite placement budget")}function lI(e,t,n,r,o){const c=new Map(t.map(g=>[g.id,g])),h=sC(e.edges).map(g=>{const p=r.get(g.from);return{edge:g,route:o.get(g.from)===o.get(g.to)?"cycle":"forward",componentId:p,sourceOffset:0,targetOffset:0,cycleLane:0,forwardLane:0}});Bx(h,c,"source"),Bx(h,c,"target");const l=new Map;for(const g of h.filter(p=>p.route==="cycle")){const p=o.get(g.edge.from);l.set(p,[...l.get(p)??[],g])}for(const g of l.values())g.sort((p,S)=>Ys(p.edge.from,S.edge.from)||Ys(p.edge.to,S.edge.to)).forEach((p,S)=>{p.cycleLane=S});const u=new Map;for(const g of h.filter(p=>{if(p.route!=="forward")return!1;const S=c.get(p.edge.from);return c.get(p.edge.to).x-S.x>ef+xv}))u.set(g.componentId,[...u.get(g.componentId)??[],g]);for(const g of u.values())g.sort((p,S)=>Ys(p.edge.from,S.edge.from)||Ys(p.edge.to,S.edge.to)).forEach((p,S)=>{p.forwardLane=S});const m=[];return h.map(g=>{const p=c.get(g.edge.from),S=c.get(g.edge.to),w={x:p.x+p.width,y:p.y+p.height/2+g.sourceOffset};let A;if(g.route==="forward"){const v={x:S.x-1,y:S.y+S.height/2+g.targetOffset};if(S.x-p.x>ef+xv){const k=g.forwardLane%5,C=p.x+p.width+8+k*4,x=S.x-8-k*4,T=n.get(g.componentId).minY-12-k*4;A=[w,{x:C,y:w.y},{x:C,y:T},{x,y:T},{x,y:v.y},v]}else{const k=ks(w.x+(S.x-w.x)*.32);A=[w,{x:k,y:w.y},{x:k,y:v.y},v]}}else{const v=p.id===S.id&&g.targetOffset===g.sourceOffset?S.y+S.height/2-12:S.y+S.height/2+g.targetOffset,_={x:S.x+S.width+1,y:v},k=Math.max(p.x+p.width,S.x+S.width)+8+g.cycleLane%10*4;if(p.id===S.id){const C=S.y-12-Math.floor(g.cycleLane/10)*8;A=[w,{x:k,y:w.y},{x:k,y:C},{x:S.x+S.width+4,y:C},{x:S.x+S.width+4,y:_.y},_]}else A=[w,{x:k,y:w.y},{x:k,y:_.y},_]}A=A.map(v=>({x:ks(v.x),y:ks(v.y)}));const E=rI(g.edge.modes),y={...g,points:A,label:E},b=oI(y,c,t,m,n.get(g.componentId));return m.push(b),{...y,labelBounds:b,labelX:ks(b.x+b.width/2),labelY:ks(b.y+b.height-3)}})}function cI(e){if(e.length===0)return"";const t=[`M ${ks(e[0].x)} ${ks(e[0].y)}`];for(let n=1;n<e.length;n+=1){const r=e[n-1],o=e[n];o.y===r.y?t.push(`H ${ks(o.x)}`):o.x===r.x?t.push(`V ${ks(o.y)}`):t.push(`L ${ks(o.x)} ${ks(o.y)}`)}return t.join(" ")}function uI(e,t){const n=[],r=[];for(const S of e)n.push(S.x,S.x+S.width),r.push(S.y,S.y+S.height);for(const S of t){for(const w of S.points)n.push(w.x),r.push(w.y);n.push(S.labelBounds.x,S.labelBounds.x+S.labelBounds.width),r.push(S.labelBounds.y,S.labelBounds.y+S.labelBounds.height)}if(n.length===0||r.length===0)return{nodes:[],edges:[],bounds:{width:0,height:0}};const o=Math.min(...n),c=Math.min(...r),h=Math.max(...n),l=Math.max(...r),u=rh-o,m=rh-c,g=e.map(S=>({...S,x:ks(S.x+u),y:ks(S.y+m)})),p=t.map(S=>{const w=S.points.map(E=>({x:ks(E.x+u),y:ks(E.y+m)})),A={...S.labelBounds,x:ks(S.labelBounds.x+u),y:ks(S.labelBounds.y+m)};return{from:S.edge.from,to:S.edge.to,modes:[...S.edge.modes],path:cI(w),points:w,label:S.label,labelX:ks(S.labelX+u),labelY:ks(S.labelY+m),labelBounds:A,route:S.route}});return{nodes:g,edges:p,bounds:{width:ks(h-o+rh*2),height:ks(l-c+rh*2)}}}function dI(e){const t=nI(e);if(e.nodes.length===0)return{nodes:[],edges:[],bounds:{width:0,height:0}};const n=iI(t),r=lI(e,n.nodes,n.componentBoxes,n.componentByNode,n.strongByNode);return uI(n.nodes,r)}function hI(e){return new Map(e.nodes.map(t=>[t.id,t]))}const tf=.25,Z2=.1,sf=3,zx=.25,fI=.0015,oh=48,pI=3.5,Hx=.2,Ux=16,mI=e=>Math.round(e*100)/100;function Cv(e,t=tf){return Math.min(sf,Math.max(Math.max(Z2,t),mI(e)))}function gI(e,t,n){if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{zoom:1,x:0,y:0,minZoom:tf};const r=pI*n,o=Math.min(r,t.width*Hx),c=Math.min(r,t.height*Hx),h=Math.min((t.width-o*2)/e.width,(t.height-c*2)/e.height,sf),l=Math.max(Z2,Math.min(sf,Math.floor(h*100)/100));return{zoom:l,x:0,y:0,minZoom:Math.min(tf,l)}}function Fx(){return{zoom:1,x:0,y:0}}function vI(e,t,n,r=[{x:0,y:0,width:t.width,height:t.height}]){return!Number.isFinite(e.zoom)||!Number.isFinite(e.x)||!Number.isFinite(e.y)||e.zoom<=0||t.width<=0||t.height<=0||n.width<=0||n.height<=0?!1:r.some(o=>{const c=n.width/2+e.x+(o.x-t.width/2)*e.zoom,h=n.height/2+e.y+(o.y-t.height/2)*e.zoom;return c<n.width&&c+o.width*e.zoom>0&&h<n.height&&h+o.height*e.zoom>0})}function _I(e,t){switch(t){case"ArrowLeft":return{...e,x:e.x-oh};case"ArrowRight":return{...e,x:e.x+oh};case"ArrowUp":return{...e,y:e.y-oh};case"ArrowDown":return{...e,y:e.y+oh}}}function qx(e,t,n,r){return t-e>r-n?(n+r-e-t)/2:e<n?n-e:t>r?r-t:0}function yI(e,t,n,r){if(t.width<=0||t.height<=0||n.width<=0||n.height<=0||e.zoom<=0)return{...e};const o=Math.min(Ux,n.width/2),c=Math.min(Ux,n.height/2),h=n.width/2+e.x+(r.x-t.width/2)*e.zoom,l=n.height/2+e.y+(r.y-t.height/2)*e.zoom,u=h+r.width*e.zoom,m=l+r.height*e.zoom;return{...e,x:e.x+qx(h,u,o,n.width-o),y:e.y+qx(l,m,c,n.height-c)}}function bI(e,t,n){if(e.zoom<=0||t===e.zoom)return{...e,zoom:t};const r=t/e.zoom;return{zoom:t,x:n.x-r*(n.x-e.x),y:n.y-r*(n.y-e.y)}}function SI(e,t,n,r){const o=Cv(e.zoom*Math.exp(-t*fI),r);return bI(e,o,n)}function wI(){const e=new Map;return{get(t){const n=e.get(t);return n?{...n}:void 0},set(t,n){e.set(t,{...n})}}}const lh=wI(),xI=3;function CI(e){return e.length===2?"is-combined":e[0]==="async"?"is-async":"is-blocking"}function EI({graph:e,workspaceKey:t,navigableAgentKeys:n,onOpenAgent:r}){const o=O.useMemo(()=>{try{return{layout:dI(e),failed:!1}}catch{return{layout:null,failed:!0}}},[e]),c=o.layout,h=O.useMemo(()=>hI(e),[e]),[l,u]=O.useState(()=>lh.get(t)??Fx()),[m,g]=O.useState(tf),[p,S]=O.useState(!1),w=O.useRef(null),A=O.useRef(null),E=O.useRef(l);E.current=l;const y=`system-graph-arrow-${O.useId().replace(/:/g,"")}`,b=O.useCallback(M=>{u(D=>{const L=typeof M=="function"?M(D):M;return lh.set(t,L),L})},[t]),v=O.useCallback(()=>{const M=w.current;if(!M||!c)return null;const D=M.getBoundingClientRect();if(D.width<=0||D.height<=0)return null;const L=Number.parseFloat(getComputedStyle(document.documentElement).fontSize),q={width:D.width,height:D.height};return{fit:gI(c.bounds,q,Number.isFinite(L)?L:16),viewport:q}},[c]),_=O.useCallback(()=>{const M=v();if(!M)return;const{fit:D}=M;g(D.minZoom),b({zoom:D.zoom,x:D.x,y:D.y})},[b,v]);O.useLayoutEffect(()=>{const M=w.current;if(!M||!c)return;const D=()=>{const Y=v();Y&&g(Y.fit.minZoom)},L=lh.get(t),q=v();if(q){const{fit:Y,viewport:Q}=q;if(g(Y.minZoom),L&&vI(L,c.bounds,Q,c.nodes))u(L);else{const ee={zoom:{...Y,zoom:Math.min(1,Y.zoom)}.zoom,x:0,y:0};lh.set(t,ee),u(ee)}}if(typeof ResizeObserver>"u")return;const F=new ResizeObserver(D);return F.observe(M),()=>F.disconnect()},[c,v,t]),O.useEffect(()=>{const M=w.current;if(!M)return;const D=L=>{const q=L.target;if(q instanceof Element&&q.closest(".system-graph-controls"))return;L.preventDefault();const F=M.getBoundingClientRect(),Y={x:L.clientX-(F.left+F.width/2),y:L.clientY-(F.top+F.height/2)};b(Q=>SI(Q,L.deltaY,Y,m))};return M.addEventListener("wheel",D,{passive:!1}),()=>M.removeEventListener("wheel",D)},[b,m]);const k=M=>{const D=A.current;!D||D.pointerId!==M.pointerId||(M.currentTarget.hasPointerCapture(M.pointerId)&&M.currentTarget.releasePointerCapture(M.pointerId),A.current=null,S(!1))},C=M=>{if(M.button!==0)return;const D=M.target;D instanceof Element&&D.closest("button, a")||(A.current={pointerId:M.pointerId,startClientX:M.clientX,startClientY:M.clientY,startView:E.current,moved:!1},M.currentTarget.setPointerCapture(M.pointerId))},x=M=>{const D=A.current;if(!D||D.pointerId!==M.pointerId)return;const L=M.clientX-D.startClientX,q=M.clientY-D.startClientY;!D.moved&&Math.hypot(L,q)<xI||(D.moved=!0,S(!0),b({...D.startView,x:D.startView.x+L,y:D.startView.y+q}))},T=M=>{M.target===M.currentTarget&&(M.key!=="ArrowLeft"&&M.key!=="ArrowRight"&&M.key!=="ArrowUp"&&M.key!=="ArrowDown"||(M.preventDefault(),b(D=>_I(D,M.key))))};if(o.failed||!c)return d.jsx(wn,{className:"system-graph-state",testId:"system-graph-layout-error",icon:"TriangleAlert",title:"Couldn't lay out this workspace graph",body:"The local graph was malformed, so Studio stopped before rendering unsafe geometry."});const R=M=>{const D=w.current;if(!D)return;const L=D.getBoundingClientRect();L.width<=0||L.height<=0||b(q=>yI(q,c.bounds,{width:L.width,height:L.height},M))};return d.jsxs("div",{className:"system-graph-canvas","data-testid":"system-graph-canvas",children:[d.jsxs("div",{ref:w,className:"system-graph-viewport"+(p?" is-panning":""),"data-testid":"system-graph-viewport",role:"region","aria-label":"Workspace dependency graph. Use arrow keys to pan.",tabIndex:0,onKeyDown:T,onPointerDown:C,onPointerMove:x,onPointerUp:k,onPointerCancel:k,onDoubleClick:M=>{const D=M.target;(!(D instanceof Element)||!D.closest(".system-graph-node, button, a"))&&_()},children:[d.jsxs("div",{className:"system-graph-subject","data-testid":"system-graph-subject","data-semantic-zoom":l.zoom<.55?"far":"near",style:{width:c.bounds.width,height:c.bounds.height,transform:`translate(-50%, -50%) translate(${l.x}px, ${l.y}px) scale(${l.zoom})`},role:"group","aria-label":"Workspace dependency graph",children:[d.jsxs("svg",{className:"system-graph-edges",width:c.bounds.width,height:c.bounds.height,viewBox:`0 0 ${c.bounds.width} ${c.bounds.height}`,"aria-hidden":"true",children:[d.jsx("defs",{children:d.jsx("marker",{id:y,markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"system-graph-arrow"})})}),c.edges.map(M=>d.jsxs("g",{"data-testid":`system-graph-edge-${M.from}-${M.to}`,children:[d.jsx("path",{className:`system-graph-edge ${CI(M.modes)}`,d:M.path,markerEnd:`url(#${y})`}),d.jsx("text",{className:"system-graph-edge-label",x:M.labelX,y:M.labelY,textAnchor:"middle",children:M.label})]},JSON.stringify([M.from,M.to])))]}),c.nodes.map(M=>{const D=h.get(M.id),L=n.has(D.agentKey),q={left:M.x,top:M.y,width:M.width,height:M.height},F=d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"system-graph-node-label",children:D.label}),d.jsx("span",{className:"system-graph-node-meta",children:"agent"})]});return L?d.jsx("button",{type:"button",className:"system-graph-node is-navigable","data-testid":`system-graph-node-${D.agentKey}`,"data-agent-key":D.agentKey,style:q,title:D.label,"aria-label":`Open ${D.label}`,onFocus:()=>R(M),onClick:()=>r(D.agentKey),...Dt({object:"agent"}),children:F},M.id):d.jsx("div",{className:"system-graph-node","data-testid":`system-graph-node-${D.agentKey}`,"data-agent-key":D.agentKey,style:q,title:D.label,...Dt({object:"agent"}),children:F},M.id)})]}),d.jsxs("div",{className:"system-graph-controls","data-testid":"system-graph-controls",role:"group","aria-label":"Workspace graph view controls",children:[d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"system-graph-zoom-out","aria-label":"Zoom out",disabled:l.zoom<=m,onClick:()=>b(M=>({...M,zoom:Cv(M.zoom-zx,m)})),children:d.jsx(ue,{name:"ZoomOut",size:14})}),d.jsxs("button",{type:"button",className:"theme-toggle system-graph-zoom-reset","data-testid":"system-graph-zoom-reset","aria-label":"Reset workspace graph view to 100%",disabled:l.zoom===1&&l.x===0&&l.y===0,onClick:()=>b(Fx()),children:[Math.round(l.zoom*100),"%"]}),d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"system-graph-zoom-in","aria-label":"Zoom in",disabled:l.zoom>=sf,onClick:()=>b(M=>({...M,zoom:Cv(M.zoom+zx,m)})),children:d.jsx(ue,{name:"ZoomIn",size:14})}),d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"system-graph-fit","aria-label":"Fit workspace graph to view",onClick:_,children:d.jsx(ue,{name:"Frame",size:14})})]})]}),e.warnings.length>0&&d.jsxs("p",{className:"system-graph-warning","data-testid":"system-graph-warning",children:[e.warnings.length," static projection"," ",e.warnings.length===1?"warning":"warnings"]})]})}function kI({workspaceKey:e,workspaceName:t,api:n,workflows:r,workspaceScopes:o,lastMessage:c,onOpenAgent:h,onExpandRail:l}){const[u,m]=O.useState(()=>Uo.peek(e)),[g,p]=O.useState(null),[S,w]=O.useState(!1),[A,E]=O.useState(!1),[y,b]=O.useState(0);O.useEffect(()=>{let R=!0;return E(!1),w(!0),Uo.load(n,e).then(M=>{R&&(m(D=>D&&D.revision>M.revision?D:M),p(D=>D&&D.revision>M.revision?D:null),w(!1))},()=>{R&&(p(null),E(!0),w(!1))}),()=>{R=!1}},[n,e,y]),O.useEffect(()=>{if((c==null?void 0:c.type)!=="system-graph.changed"||c.workspaceKey!==e)return;const R=Math.max((u==null?void 0:u.revision)??-1,(g==null?void 0:g.revision)??-1);c.revision<=R||(Uo.invalidate(e,c.revision),p({revision:c.revision,state:c.state}),E(!1),b(M=>M+1))},[g==null?void 0:g.revision,c,u==null?void 0:u.revision,e]);const v=(u==null?void 0:u.graph)??null,_=g!==null&&g.revision>((u==null?void 0:u.revision)??-1);let k=(u==null?void 0:u.state)??"building";_&&(k=g.state==="degraded"?"degraded":v?"stale":"building"),A&&(k=u!=null&&u.graph?"stale":"degraded");const C=!A&&v!==null&&(S||_&&(g==null?void 0:g.state)!=="degraded"),x=()=>{Uo.invalidate(e),p(null),E(!1),b(R=>R+1)},T=O.useMemo(()=>v?W8(v.nodes,e,r,o):new Map,[v,e,r,o]);return d.jsxs("section",{className:"workspace-graph-view","data-testid":"workspace-graph-view","aria-label":"Workspace dependencies",children:[d.jsxs("header",{className:"workspace-graph-bar",children:[l&&d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"workspace-graph-rail-expand","aria-label":"Expand workspace panel",onClick:l,children:d.jsx(ue,{name:"PanelLeftOpen",size:15})}),d.jsx(ue,{name:"Folder",size:15}),d.jsx("span",{className:"workspace-graph-title",title:t,...Dt({object:"workspace"}),children:t}),C&&v&&d.jsxs("span",{className:"status-tag workspace-graph-lifecycle","data-testid":"system-graph-refreshing","data-state":"refreshing",role:"status",children:[d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),"Refreshing graph"]}),k==="stale"&&v&&!C&&d.jsxs("span",{className:"workspace-graph-lifecycle","data-testid":"system-graph-stale","data-state":"stale",role:"status",children:[d.jsxs("span",{className:"status-tag",children:[d.jsx(ue,{name:"TriangleAlert",size:13}),"Graph may be out of date"]}),d.jsxs("button",{type:"button",className:"status-tag status-tag-action",onClick:x,children:[d.jsx(ue,{name:"RefreshCw",size:13}),"Retry"]})]}),k==="degraded"&&v&&d.jsxs("span",{className:"workspace-graph-lifecycle","data-testid":"system-graph-degraded","data-state":"degraded",role:"status",children:[d.jsxs("span",{className:"status-tag",children:[d.jsx(ue,{name:"TriangleAlert",size:13}),"Graph may be incomplete"]}),d.jsxs("button",{type:"button",className:"status-tag status-tag-action",onClick:x,children:[d.jsx(ue,{name:"RefreshCw",size:13}),"Retry"]})]})]}),d.jsx("div",{className:"workspace-graph-body",children:!v&&k==="degraded"?d.jsx(wn,{className:"system-graph-state",testId:"system-graph-error",icon:"TriangleAlert",title:A?"Couldn't load this workspace graph":"Couldn't build this workspace graph",body:A?"Studio couldn't load the latest local graph. Check that Studio is still running, then retry.":"Studio couldn't produce a usable local projection. Retry after the workspace is readable.",cta:d.jsx("button",{type:"button",className:"btn-primary",onClick:x,children:"Retry"})}):v?v.nodes.length===0&&k==="degraded"?d.jsx(wn,{className:"system-graph-state",testId:"system-graph-incomplete",icon:"TriangleAlert",title:"Workspace graph is incomplete",body:"Studio couldn't inspect enough of this workspace to show a reliable graph.",cta:d.jsx("button",{type:"button",className:"btn-primary",onClick:x,children:"Retry"})}):v.nodes.length===0?d.jsx(wn,{className:"system-graph-state",testId:"system-graph-empty",icon:"Frame",title:"No agents in this workspace",body:"Agent projects discovered inside this folder will appear here."}):d.jsx(EI,{graph:v,workspaceKey:e,navigableAgentKeys:new Set(T.keys()),onOpenAgent:R=>{const M=T.get(R);M&&h(M.path)}}):d.jsxs("div",{className:"canvas-loading system-graph-state","data-testid":"system-graph-loading",children:[d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),d.jsx("p",{className:"canvas-empty-hint",children:"Loading workspace graph…"})]})})]})}const jI=new Set([401,403]);function RI(e){return e?e.networkError===!0||e.status===void 0:!1}function AI(e){return(e==null?void 0:e.status)!==void 0&&jI.has(e.status)}function TI(e){const{online:t,error:n}=e;return!t||RI(n)?"offline":AI(n)?"auth":n?"error":"online"}function Vx(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function NI(){const[e,t]=O.useState(Vx);return O.useEffect(()=>{const n=()=>t(Vx());return window.addEventListener("online",n),window.addEventListener("offline",n),n(),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",n)}},[]),e}function MI(e=typeof window>"u"?"":window.location.search){const t=new URLSearchParams(e),n=t.get("agent");if(n){const o=t.get("agentSlug");return{kind:"agent",definitionId:n,...o?{slug:o}:{}}}const r=t.get("template");if(r){const o=t.get("templateSlug");return{kind:"template",templateId:r,...o?{slug:o}:{}}}return null}function $I({agentLabel:e,onCancel:t,onConfirm:n}){const r=O.useRef(null);return za(!0,{onDismiss:t,containerRef:r}),d.jsx("div",{className:"modal-backdrop",onClick:t,children:d.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"Clone agent","data-testid":"clone-agent-confirm",onClick:o=>o.stopPropagation(),children:[d.jsxs("div",{className:"modal-header",children:["Clone this agent?",d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:t,children:d.jsx(ue,{name:"X",size:14})})]}),d.jsx("div",{className:"modal-body",children:d.jsxs("p",{className:"modal-copy",children:[e," isn’t on this machine yet. Cloning checks it out locally — a git clone and npm install the coding agent runs — then opens it here."]})}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:t,children:"Cancel"}),d.jsx("button",{className:"btn-primary","data-testid":"clone-agent-confirm-btn",onClick:n,children:"Clone locally"})]})]})})}const Gx=120,Q2=new Set(["attr__class","attr__id"]),DI=/attr__([\w-]+)="(?:\\.|[^"\\])*"/g,OI=/(?:current_url|referrer|pathname)$/,LI=/host$/;function II(e){const t=typeof e.surface=="string"?e.surface.toLowerCase():"",n=typeof e.object=="string"?e.object.toLowerCase():"";return/secret|vault|credential/.test(t)||/secret|vault|credential/.test(n)}const PI=new Set(["agent","workspace","session","run","directory","file"]);function BI(e){const t=typeof e.object=="string"?e.object.toLowerCase():"";return PI.has(t)}const zI=/\btext="(?:\\.|[^"\\])*"/g,ek=new Set(["localhost","127.0.0.1","[::1]","::1"]),tk="localhost";function Sg(e){if(typeof e!="string"||e.length===0)return e;let t;try{t=new URL(e)}catch{return e}return`${ek.has(t.hostname)?`${t.protocol}//${tk}`:t.origin}${t.pathname}`}function Wx(e){if(typeof e!="string"||e.length===0)return e;const t=e.replace(/:\d+$/,"");return ek.has(t)?tk:e}function v_(e){return e.length>Gx?`${e.slice(0,Gx)}…`:e}function HI(e){return II(e)?"secret":BI(e)?"drop_name":"truncate"}function UI(e,t){for(const n of Object.keys(e))n.startsWith("attr__")&&!Q2.has(n)&&delete e[n];if(t==="truncate"){typeof e.$el_text=="string"&&(e.$el_text=v_(e.$el_text));return}delete e.$el_text}function FI(e,t){const n=e.$elements;if(Array.isArray(n))for(const o of n)o&&typeof o=="object"&&UI(o,t);if(typeof e.$elements_chain!="string")return;if(t==="secret"){delete e.$elements_chain;return}let r=e.$elements_chain.replace(DI,(o,c)=>Q2.has(`attr__${c}`)?o:"");t==="drop_name"&&(r=r.replace(zI,'text=""')),e.$elements_chain=r}function qI(e,t){t.$current_url=Sg(t.$current_url),t.$referrer=Sg(t.$referrer),t.$host=Wx(t.$host);for(const n of[e.$set,e.$set_once]){if(!n)continue;const r=n;for(const o of Object.keys(r))OI.test(o)?r[o]=Sg(r[o]):LI.test(o)&&(r[o]=Wx(r[o]))}}const VI=/attr__aria-label="((?:\\.|[^"\\])*)"/i;function GI(e){var o;const t=e.$el_text;if(typeof t=="string"&&t.trim()!=="")return;let n;const r=e.$elements;if(Array.isArray(r))for(const c of r){const h=c==null?void 0:c["attr__aria-label"];if(typeof h=="string"&&h.trim()!==""){n=h;break}}n===void 0&&typeof e.$elements_chain=="string"&&(n=(o=VI.exec(e.$elements_chain))==null?void 0:o[1]),n!==void 0&&n.trim()!==""&&(e.$el_text=v_(n),e.el_text_source="aria_label")}function WI(e,t){typeof e.$el_text=="string"&&(t==="truncate"?e.$el_text=v_(e.$el_text):delete e.$el_text),t==="truncate"&&GI(e),FI(e,t)}function KI(e){if(!e)return e;try{const t=e.properties??{},n=HI(t);return qI(e,t),WI(t,n),e.properties=t,e}catch{return e}}function YI(){if(typeof window>"u")return null;const e=window.__HARNESS__,t=e==null?void 0:e.posthog;return t!=null&&t.key?t:null}function XI(e){return e.consentSource==="env-forced-off"}function sk(e){return!XI(e)&&e.productAnalyticsOptIn}let Ko=!1;function JI(e){if(Ko){wg(e),Cg(e);return}const t=YI();if(t&&sk(e)){if(Yn.__loaded){Ko=!0,Ev(e),wg(e),Cg(e);return}Yn.init(t.key,{api_host:t.apiHost,ui_host:t.uiHost,capture_pageview:!0,capture_pageleave:!0,autocapture:!0,enable_heatmaps:!0,capture_dead_clicks:!0,before_send:KI,persistence:"localStorage",disable_session_recording:!0}),Ko=!0,Ev(e),wg(e),Cg(e)}}function wg(e){if(Ko)try{sk(e)?Yn.has_opted_out_capturing()&&Yn.opt_in_capturing():Yn.has_opted_out_capturing()||Yn.opt_out_capturing()}catch{}}function Ev(e){e_({app_version:e.version,harness_host:pr()?"desktop":"cli",studio_boot_id:WM()})}let xg=null;function Cg(e){if(Ko)try{if(e.authenticated&&e.userId){xg=e.userId,Yn.identify(e.userId),e.tenantId&&Yn.group("organization",e.tenantId,{...e.organizationName?{name:e.organizationName}:{}}),e_({active_organization_id:e.tenantId??void 0,app_version:e.version});return}xg&&(xg=null,Yn.reset(),Ev(e))}catch{}}function ZI(e){if(Ko)try{e?e_({harness_kind:e}):Yn.unregister("harness_kind")}catch{}}function QI(e){return[`Add human-readable descriptions to the "${e.name}" agent so its Sapiom canvas explains what each part does.`,"",`Edit the agent definition file(s) under ${e.path} (the entry is usually index.ts):`,"1. Give the defineAgent({ ... }) call a one-line `description` summarizing what the whole agent does.","2. Give every defineStep({ ... }) a one-line `description` of what that step does — infer it from the step's own code: its input, the Sapiom services it calls, and where it transitions.","","Rules:","- One sentence each, at most ~120 characters, present tense, plain language — don't just restate the step's name.","- Edit the source ONLY: add or refine `description` fields and nothing else. Do not change logic, control flow, imports, or other fields.","- Run NO commands — no npm/pnpm, no build, no tests, no git. Just make the edits and save. (The `description` field is supported by @sapiom/agent 0.7.0+, which this project already uses.)","- When the edits are saved you're done — the Sapiom canvas re-renders automatically, with no further step."].join(`
505
+ `)}const e7={entries:[],index:-1};function t7(e,t){return e.kind!==t.kind?!1:e.kind==="session"&&t.kind==="session"?e.sessionId===t.sessionId:e.kind==="agent"&&t.kind==="agent"?e.agentPath===t.agentPath:e.kind==="project"&&t.kind==="project"?e.workspaceKey===t.workspaceKey:e.kind==="review"&&t.kind==="review"?e.summary.agentSessionId===t.summary.agentSessionId:e.kind===t.kind}function nk(e){return e.index>0}function ik(e){return e.index>=0&&e.index<e.entries.length-1}function s7(e,t){const n=e.index>=0?e.entries[e.index]:null;if(n&&t7(n,t)){if(JSON.stringify(n)===JSON.stringify(t))return e;const c=[...e.entries];return c[e.index]=t,{...e,entries:c}}const o=[...e.entries.slice(0,e.index+1),t].slice(-50);return{entries:o,index:o.length-1}}function n7(e,t){if(!(t==="back"?nk(e):ik(e)))return{state:e,visit:null};const r=t==="back"?e.index-1:e.index+1;return{state:{...e,index:r},visit:e.entries[r]??null}}function i7(){const[e,t]=O.useState(e7),n=O.useRef(e);n.current=e;const r=O.useCallback(c=>{const h=s7(n.current,c);h!==n.current&&(n.current=h,t(h))},[]),o=O.useCallback(c=>{const h=n7(n.current,c);return h.visit?(n.current=h.state,t(h.state),h.visit):null},[]);return{canGoBack:nk(e),canGoForward:ik(e),record:r,goBack:()=>o("back"),goForward:()=>o("forward")}}const rk="(max-width: 768px)";function kv(){return typeof window<"u"&&window.matchMedia(rk).matches}function r7(e){const t=window.matchMedia(rk);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function a7(){return O.useSyncExternalStore(r7,kv,()=>!1)}const ak="sapiom-harness-pane-widths",__=180,ok=480,jv=320,Ic=320,lk=720;function Rv(e,t,n){return Math.min(Math.max(e,t),n)}function o7(){const e={rail:jv,canvas:null};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(ak);if(!t)return e;const n=JSON.parse(t);return{rail:Rv(typeof n.rail=="number"?n.rail:jv,__,ok),canvas:typeof n.canvas=="number"?Rv(n.canvas,Ic,lk):null}}catch{return e}}function Kx(e){window.localStorage.setItem(ak,JSON.stringify(e))}function l7(){const[e,t]=O.useState(o7),[n,r]=O.useState(!1),[o,c]=O.useState(!1),h=(u,m,g,p,S,w)=>A=>{const E=A.currentTarget;E.setPointerCapture(A.pointerId),w==null||w(!0);const y=A.clientX,b=S(),v=k=>{const C=Rv(b+(k.clientX-y)*m,g,p);t(x=>x[u]===C?x:{...x,[u]:C})},_=()=>{E.removeEventListener("pointermove",v),E.removeEventListener("pointerup",_),w==null||w(!1),t(k=>(Kx(k),k))};E.addEventListener("pointermove",v),E.addEventListener("pointerup",_)},l=(u,m)=>{t(g=>{const p={...g,[u]:m};return Kx(p),p})};return{widths:e,canvasResizing:n,railResizing:o,startRailDrag:h("rail",1,__,ok,()=>e.rail,c),startCanvasDrag:h("canvas",-1,Ic,lk,()=>{if(e.canvas!=null)return e.canvas;const u=document.querySelector(".canvas-pane");return u?u.getBoundingClientRect().width:Ic},r),resetRail:()=>{c(!0),l("rail",jv),window.setTimeout(()=>c(!1),0)},resetCanvas:()=>{r(!0),l("canvas",null),window.setTimeout(()=>r(!1),0)}}}function Ks(e,t="error"){return{message:e,tone:t}}const c7=2e3;function u7(e){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",Fo());let n=null,r=null,o=!1;const c=()=>{n=new WebSocket(t),n.addEventListener("message",h=>{try{e(JSON.parse(h.data))}catch{}}),n.addEventListener("close",()=>{o||(r=setTimeout(c,c7))})};return c(),()=>{o=!0,r&&clearTimeout(r),n==null||n.close()}}function ch(e){const t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function d7(e,t){const n=[];for(const r of t)e.has(r.path)||n.push(r.path);return n}function Yx(e,t){return t?"exception":e==="linking"?"link_failed":"build_failed"}function h7(e){return e==="cancelled"?"cancelled":"failed"}function f7(e){return e==="completed"?"succeeded":e==="failed"?"failed":"pending"}const p7=5;function m7(){return{started:!1,settled:!1,observed:!1,failures:0}}const uh={event:null};function g7(e,t,n=p7){if(t.kind==="announced")return t.duplicate||e.started?{state:e,emit:uh}:{state:{...e,started:!0},emit:{event:"agent.run_started"}};if(t.kind==="polled"){const c={...e,observed:!0,failures:0};if(t.status==="running")return{state:c,emit:uh};if(e.settled)return{state:c,emit:uh};const h={...c,settled:!0};return t.status==="completed"?{state:h,emit:{event:"agent.run_succeeded"}}:{state:h,emit:{event:"agent.run_failed",error_kind:h7(t.status)}}}const r=e.failures+1,o={...e,failures:r};return r<n||e.settled?{state:o,emit:uh}:{state:{...o,settled:!0},emit:{event:"agent.run_failed",error_kind:e.observed?"exception":"unobservable"}}}function jc(e){return typeof e=="string"&&e!==""?e:void 0}function v7(e){if(jc(e.templateId))return"template";const t=jc(e.starterId);return t&&t!=="default"?"starter":jc(e.forkId)?"fork":"scratch"}function Xx(e){if(!e)return{};const t=v7(e);return t==="template"?{source:t,template_id:jc(e.templateId)}:t==="starter"?{source:t,template_id:jc(e.starterId)}:{source:t}}const Jx=4e3;function _7(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"){const t=e,n=[t.ts,t.level,t.msg??t.message].filter(r=>typeof r=="string"||typeof r=="number");if(n.length>0)return n.map(String).join(" ")}return String(e)}function y7(e){if(!Array.isArray(e)||e.length===0)return;const t=e.map(_7).join(`
506
+ `).trim();if(t!=="")return t.length>Jx?t.slice(t.length-Jx):t}function b7(e){return e==="running"?"running":e==="succeeded"?"passed":e==="threw"?"failed":"pending"}function S7(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function w7(e){var r;const t={id:`${e.step}-${e.attempt}`,name:e.step,attempt:e.attempt,status:b7(e.status)};if(e.startedAt&&(t.startedAt=e.startedAt),e.finishedAt&&(t.finishedAt=e.finishedAt),e.startedAt&&e.finishedAt){const o=Date.parse(e.startedAt),c=Date.parse(e.finishedAt);Number.isFinite(o)&&Number.isFinite(c)&&c>=o&&(t.latencyMs=c-o)}e.input!==void 0&&(t.input=e.input),e.output!==void 0&&(t.output=e.output),e.sharedStateAfter!==void 0&&(t.sharedState=e.sharedStateAfter),e.directive!==void 0&&(t.directive=e.directive),(r=e.error)!=null&&r.message&&(t.error=e.error.message);const n=y7(e.logs);return n!==void 0&&(t.logSlice=n),e.calls&&e.calls.length>0&&(t.calls=e.calls.map(o=>({capability:o.capability,stubUsed:o.stubUsed,args:o.args,result:o.result}))),t}function x7(e,t={}){const n={executionId:t.executionId??"",status:S7(t.outcome),steps:e.map(w7),stubbed:!0};return t.unusedStubs&&t.unusedStubs.length>0&&(n.unusedStubs=t.unusedStubs),t.stubWarnings&&t.stubWarnings.length>0&&(n.stubWarnings=t.stubWarnings),t.input!==void 0&&(n.input=t.input),t.output!==void 0&&(n.output=t.output),t.error!==void 0&&(n.error=t.error),t.startedAt&&(n.startedAt=t.startedAt),t.finishedAt&&(n.finishedAt=t.finishedAt),n}const Pt=Bc(),C7=3e3,E7=8,k7=500;function j7(){const[e,t]=O.useState(null);O.useEffect(()=>{e&&Uo.retain(new Set((e.workspaceScopes??[]).map(re=>re.workspaceKey)))},[e==null?void 0:e.workspaceScopes]);const[n,r]=O.useState(null),o=O.useRef(null);o.current=n;const[c,h]=O.useState({}),[l,u]=O.useState(()=>hi().closedProjects??[]),m=O.useRef(l);m.current=l;const g=O.useCallback(re=>{const he=QL(m.current,re);he.length!==m.current.length&&(m.current=he,u(he),Ci({closedProjects:he}))},[]),p=O.useRef([]);p.current=(e==null?void 0:e.workflows)??[];const[S,w]=O.useState(!0),[A,E]=O.useState(null),[y,b]=O.useState(null),[v,_]=O.useState(0),[k,C]=O.useState(null),[x,T]=O.useState(null),[R,M]=O.useState([]),[D,L]=O.useState(null),[q,F]=O.useState(!1),Y=O.useRef(new Map),Q=O.useRef(0),G=O.useRef(new Map),[ee,ne]=O.useState(null),[z,B]=O.useState(new Set),[$,H]=O.useState([]),U=O.useRef(new Map),[P,W]=O.useState(new Map),[se,X]=O.useState(new Map),[V,ce]=O.useState(new Map),oe=O.useRef(new Map),Z=O.useRef(new Set),[te,pe]=O.useState(new Map),[ye,Ee]=O.useState(new Map),[Ie,Pe]=O.useState(new Map),Fe=O.useCallback((re,he)=>{Pe(be=>{if(he===null){if(!be.has(re))return be;const xe=new Map(be);return xe.delete(re),xe}return new Map(be).set(re,he)})},[]),[je,Ue]=O.useState([]),Ye=O.useCallback(re=>{Ue(he=>he.some(be=>be.cwd===re)?he:[{cwd:re,sessionSeen:!1},...he])},[]),jt=O.useCallback(re=>{Ue(he=>he.some(be=>be.cwd===re)?he.filter(be=>be.cwd!==re):he)},[]);O.useEffect(()=>{if(je.length===0)return;const re=(e==null?void 0:e.sessions)??[],he=(e==null?void 0:e.workflows)??[],be=(xe,Ae)=>Li(Ae,xe);Ue(xe=>{let Ae=!1;const ze=[];for(const st of xe){if(he.some(le=>be(le.path,st.cwd))){Ae=!0;continue}const Rt=re.some(le=>le.status!=="exited"&&be(le.cwd,st.cwd));if(st.sessionSeen&&!Rt){Ae=!0;continue}if(Rt&&!st.sessionSeen){ze.push({...st,sessionSeen:!0}),Ae=!0;continue}ze.push(st)}return Ae?ze:xe})},[e==null?void 0:e.sessions,e==null?void 0:e.workflows,je]);const[rt,Ct]=O.useState(0),dt=O.useCallback(()=>{Ct(re=>re+1)},[]),Lt=O.useRef(0),mt=O.useCallback(re=>{Lt.current+=1,T(re)},[]),Ut=O.useRef([]),Ss=O.useCallback(re=>{Pt.getRunState(re).then(he=>W(be=>{const xe=be.get(re);return xe?new Map(be).set(re,{...xe,run:he}):be})).catch(()=>{})},[]),Yt=O.useCallback((re,he,be)=>{const xe=oe.current.get(re);xe&&clearInterval(xe);const Ae=Ma(Ut.current.find(Me=>Me.id===re)),ze=Date.now();X(Me=>{const Qe=Me.get(re)??[];return Qe.includes(he)?Me:new Map(Me).set(re,[...Qe,he])}),ce(Me=>{if(!Me.has(re))return Me;const Qe=new Map(Me);return Qe.delete(re),Qe});const We={workflow_slug:Ae?ch(Ae):void 0,session_id:re,target:be};let Rt=m7();const le=Me=>{const{state:Qe,emit:it}=g7(Rt,Me);if(Rt=Qe,it.event===null)return;if(it.event==="agent.run_started"){Vs("agent.run_started",We);return}const St=Date.now()-ze;if(it.event==="agent.run_succeeded"){Vs("agent.run_succeeded",{...We,duration_ms:St});return}Vs("agent.run_failed",{...We,duration_ms:St,error_kind:it.error_kind})},De=Z.current.has(he);if(Z.current.size>=k7){const Me=Z.current.values().next().value;Me!==void 0&&Z.current.delete(Me)}Z.current.add(he),le({kind:"announced",duplicate:De});const fe=()=>{const Me=oe.current.get(re);Me&&clearInterval(Me),oe.current.delete(re)},Le=async()=>{try{const Me=await Pt.getRunState(he);W(Qe=>new Map(Qe).set(he,{run:Me,target:be,workflowPath:Ae,observedAt:ze})),le({kind:"polled",status:Me.status}),Me.status!=="running"&&fe()}catch{le({kind:"poll_failed"}),Rt.settled&&fe()}};Le(),oe.current.set(re,setInterval(()=>void Le(),2e3))},[]),ms=O.useRef(0),_t=O.useCallback(async(re,he,be)=>{ms.current+=1;const xe=`local-${Date.now()}-${ms.current}`,Ae=Ma(Ut.current.find(Je=>Je.id===re)),ze=Date.now(),st=new Date(ze).toISOString(),We=[];let Rt,le,De,fe,Le,Me;X(Je=>{const lt=Je.get(re)??[];return lt.includes(xe)?Je:new Map(Je).set(re,[...lt,xe])}),ce(Je=>{if(!Je.has(re))return Je;const lt=new Map(Je);return lt.delete(re),lt});const Qe=()=>{const Je=x7(We,{executionId:xe,outcome:Rt,unusedStubs:Le,stubWarnings:Me,input:be,output:le,error:De,startedAt:st,finishedAt:fe});W(lt=>new Map(lt).set(xe,{run:Je,target:"local",workflowPath:Ae,observedAt:ze}))};Qe();const it={workflow_slug:Ae?ch(Ae):void 0,session_id:re,target:"local"};let St=!1;Vs("agent.run_started",it);const Ge=Je=>{if(Je.kind==="summary")Rt=Je.outcome,le=Je.output,De=Je.error,fe=new Date().toISOString(),Le=Je.unusedStubs,Me=Je.stubWarnings;else if(Je.kind==="error"){Rt="failed",De=Je.error,fe=new Date().toISOString();const lt={step:"run-local",attempt:1,input:be,status:"threw",startedAt:st,finishedAt:fe,error:{name:"RunLocalError",message:Je.error},logs:[]},wt=We.findIndex(Bt=>Bt.step===lt.step&&Bt.attempt===lt.attempt);wt>=0?We[wt]=lt:We.push(lt)}else if(Je.kind==="step"){const lt=Je.trace,wt=We.findIndex(Bt=>Bt.step===lt.step&&Bt.attempt===lt.attempt);wt>=0?We[wt]=lt:We.push(lt)}else{const lt=We.findIndex(wt=>wt.step===Je.step&&wt.attempt===Je.attempt);lt>=0?We[lt]=Je:We.push(Je)}Qe()};try{await Pt.runLocal({sourceDir:he,input:be},Ge)}catch(Je){const lt=Je instanceof gn&&Je.reason?Je.reason:Je instanceof Error?Je.message:"Local execution failed.";Rt="failed",St=!0,De=lt,fe=new Date().toISOString();const wt={step:"run-local",attempt:1,input:be,status:"threw",startedAt:st,finishedAt:fe,error:{name:"RunLocalError",message:lt},logs:[{level:"error",msg:lt}]},Bt=We.findIndex(Jn=>Jn.step===wt.step&&Jn.attempt===wt.attempt);Bt>=0?We[Bt]=wt:We.push(wt),Qe(),L(Ks(lt))}finally{const Je=f7(Rt),lt=Date.now()-ze;Je==="succeeded"?Vs("agent.run_succeeded",{...it,duration_ms:lt}):Je==="failed"&&Vs("agent.run_failed",{...it,duration_ms:lt,error_kind:St?"exception":"failed"}),dt()}},[dt]),$s=O.useCallback((re,he)=>{ce(be=>new Map(be).set(re,he)),Ss(he)},[Ss]),as=O.useMemo(()=>{const re=new Map;return se.forEach((he,be)=>{const xe=V.get(be),Ae=xe&&he.includes(xe)?xe:he[he.length-1],ze=Ae?P.get(Ae):void 0;ze&&re.set(be,ze)}),re},[se,V,P]);O.useEffect(()=>{Ut.current=(e==null?void 0:e.sessions)??[]},[e]),O.useEffect(()=>{const re=oe.current;return()=>{re.forEach(he=>clearInterval(he)),re.clear()}},[]),O.useEffect(()=>{const re=U.current;return()=>{re.forEach(he=>clearTimeout(he)),re.clear()}},[]);const Et=O.useRef(null);O.useEffect(()=>{let re=!1;return v>0&&(w(!0),E(null),b(null)),Promise.all([Pt.getState(),Pt.getSettings()]).then(([he,be])=>{if(re)return;t(he);const xe=Et.current??(Et.current=new Set);for(const ze of he.workflows)xe.add(ze.path);r(be),b(null),he.tasks&&H(he.tasks);const Ae=he.sessions.find(ze=>ze.status!=="exited");Ae&&T(Ae.id),he.workflows[0]&&C(he.workflows[0].path)}).catch(he=>{re||(E(he.message),b(he instanceof gn?{status:he.status}:{networkError:!0}))}).finally(()=>!re&&w(!1)),()=>{re=!0}},[v]);const It=O.useCallback(()=>_(re=>re+1),[]);O.useEffect(()=>{if(!x)return;const re=e==null?void 0:e.sessions.find(he=>he.id===x);C(Ma(re)??null)},[x]);const Hs=O.useCallback(async()=>{const re=await Pt.listWorkflows();return t(he=>he&&{...he,workflows:re}),re},[]);O.useEffect(()=>u7(re=>{if(ne(re),re.type==="session.status"){if(t(he=>{if(!he)return he;const xe=he.sessions.some(Ae=>Ae.id===re.session.id)?he.sessions.map(Ae=>Ae.id===re.session.id?re.session:Ae):[...he.sessions,re.session];return{...he,sessions:xe}}),re.session.status==="exited"){const he=re.session.id,be=U.current.get(he);be&&(clearTimeout(be),U.current.delete(he)),B(xe=>{if(!xe.has(he))return xe;const Ae=new Set(xe);return Ae.delete(he),Ae})}}else if(re.type==="workflows.changed")Hs().then(he=>{const be=Et.current;if(be===null){Et.current=new Set(he.map(xe=>xe.path));return}for(const xe of d7(be,he))be.add(xe),Vs("agent.created",{workflow_slug:ch(xe),...Xx(he.find(Ae=>Ae.path===xe))})});else if(re.type==="system-graph.changed")Uo.invalidate(re.workspaceKey,re.revision);else if(re.type==="execution.started")Yt(re.harnessSessionId,re.executionId,re.target);else if(re.type==="port.detected")pe(he=>new Map(he).set(re.harnessSessionId,{port:re.port,url:re.url}));else if(re.type==="task.status")H(he=>he.some(xe=>xe.id===re.task.id)?he.map(xe=>xe.id===re.task.id?re.task:xe):[...he,re.task]);else if(re.type==="session.activity"){const he=re.harnessSessionId;B(xe=>xe.has(he)?xe:new Set(xe).add(he));const be=U.current.get(he);be&&clearTimeout(be),U.current.set(he,setTimeout(()=>{U.current.delete(he),B(xe=>{if(!xe.has(he))return xe;const Ae=new Set(xe);return Ae.delete(he),Ae})},C7))}else re.type==="auth.changed"&&(t(he=>he&&{...he,authenticated:re.authenticated,organizationName:re.organizationName}),Hs())}),[Hs,Yt]);const Xs=O.useCallback(async re=>{const he=Array.from(new Set(re)),be=he.map(xe=>{const Ae=Y.current.get(xe);if(Ae)return Ae;const ze=Pt.sessionHistory(xe).finally(()=>{Y.current.delete(xe)});return Y.current.set(xe,ze),ze});Q.current+=1,F(!0);try{const xe=await Promise.allSettled(be),Ae=[],ze=new Set;xe.forEach((st,We)=>{st.status==="fulfilled"&&(ze.add(he[We]),Ae.push(...st.value))}),M(st=>rD(st,Ae,ze))}finally{Q.current-=1,Q.current===0&&F(!1)}},[]),In=O.useCallback(async()=>{const re=await Pt.getState();t(he=>he&&{...he,workspaceScopes:re.workspaceScopes})},[]),Gs=O.useCallback(async re=>{var be;g([re]);const he=[re,...(((be=o.current)==null?void 0:be.recentDirs)??[]).filter(xe=>xe!==re)].slice(0,E7);r(xe=>xe&&{...xe,recentDirs:he});try{const xe=await Pt.updateSettings({recentDirs:he});r(Ae=>Ae&&{...Ae,recentDirs:xe.recentDirs}),await In()}catch{}},[In,g]),ot=O.useCallback(async re=>{const he=await Pt.createSession(re);return t(be=>be&&!be.sessions.some(xe=>xe.id===he.id)?{...be,sessions:[...be.sessions,he]}:be),mt(he.id),await Gs(re.cwd),he},[mt,Gs]),Us=O.useCallback((re,he)=>Pt.attachFile(re,he),[]),os=O.useCallback(()=>Pt.listTemplates(),[]),js=O.useCallback(re=>Pt.getTemplate(re),[]),un=O.useCallback(re=>Pt.sessionRecord(re),[]),Js=O.useCallback(async re=>{const he=Lt.current;try{const be=await Pt.resumeSession(re);return t(xe=>xe&&{...xe,sessions:xe.sessions.map(Ae=>Ae.id===be.id?be:Ae)}),Lt.current===he&&mt(be.id),be}catch(be){throw L(Ks(be instanceof gn&&be.reason?be.reason:be.message)),be}},[mt]),_n=O.useCallback(async({cwd:re,harness:he,from:be})=>{const xe=await ot({cwd:re,harness:he,rehydrateFrom:be});return xe.rehydratedFrom||L(Ks("Nothing was recorded for that session, so this one starts fresh.","info")),xe},[ot]),Pn=O.useCallback(async re=>{var be;const he=re.harnessSessionId??((be=e==null?void 0:e.sessions.find(xe=>xe.agentSessionId===re.agentSessionId))==null?void 0:be.id);if(re.resumeMode==="rehydrate")return _n({cwd:re.cwd,harness:re.harness,from:he??re.agentSessionId});if(he)return Js(he);try{const xe=await Pt.adoptSession({agentSessionId:re.agentSessionId,harness:re.harness,cwd:re.cwd,title:re.title,lastActiveAt:re.lastActiveAt});return t(Ae=>{if(!Ae)return Ae;const ze=Ae.sessions.some(st=>st.id===xe.id)?Ae.sessions.map(st=>st.id===xe.id?xe:st):[...Ae.sessions,xe];return{...Ae,sessions:ze}}),mt(xe.id),xe}catch(xe){throw L(Ks(xe instanceof gn&&xe.reason?xe.reason:xe.message)),xe}},[e,Js,_n,mt]),ls=O.useCallback(async re=>{try{await Pt.killSession(re)}catch(be){throw L(Ks(be instanceof gn&&be.reason?be.reason:be.message)),be}const he=((e==null?void 0:e.sessions)??[]).filter(be=>be.id!==re);if(t(be=>be&&{...be,sessions:he}),x===re){const be=he.find(xe=>xe.status!=="exited");mt(be?be.id:null)}},[e,x,mt]),mi=O.useCallback(async re=>{var xe;const he=await Pt.connectWorkflow(re);t(Ae=>Ae&&{...Ae,workflows:[...Ae.workflows.filter(ze=>ze.path!==he.path),he]}),(Et.current??(Et.current=new Set)).add(he.path);const be=e8(m.current,he.path);if(be.length>0)g(be);else{const Ae=[...((xe=o.current)==null?void 0:xe.recentDirs)??[],...Ut.current.map(ze=>ze.cwd)];XL(he.path,Ae)&&await Gs(he.path)}return he},[Gs,g]),xs=O.useCallback(async re=>{const he=await Pt.scanWorkflows(re),be=await Hs(),xe=Et.current??(Et.current=new Set);for(const Ae of be)xe.add(Ae.path);return h(Ae=>he.repositoryBoundaries.length>0?{...Ae,[re]:he.repositoryBoundaries}:Object.keys(Ae).includes(re)?Object.fromEntries(Object.entries(Ae).filter(([ze])=>ze!==re)):Ae),he},[Hs]),kn=O.useCallback(async re=>{const he=m.current.filter(be=>pi(re,be));he.length>0&&g(he),await Gs(re);try{await xs(re)}catch(be){console.warn("[harness] scan after opening project failed",re,be)}},[g,Gs,xs]),gi=O.useCallback(async re=>{var st;const he=W2({root:re,recentDirs:((st=o.current)==null?void 0:st.recentDirs)??[],sessions:Ut.current}),be=[...m.current.filter(We=>!Cn(We,re)),re];m.current=be,u(be),Ci({closedProjects:be});const xe=new Set(he.endSessionIds);xe.size>0&&(Lt.current+=1,T(We=>We!=null&&xe.has(We)?null:We));const Ae=await ZL(he,{endSession:We=>Pt.killSession(We),saveRecentDirs:async We=>{const Rt=[...We];r(le=>le&&{...le,recentDirs:Rt});try{const le=await Pt.updateSettings({recentDirs:Rt});r(De=>De&&{...De,recentDirs:le.recentDirs})}catch{}}}),ze=new Set(he.endSessionIds.filter(We=>!Ae.failedSessionIds.includes(We)));ze.size>0&&t(We=>We&&{...We,sessions:We.sessions.filter(Rt=>!ze.has(Rt.id))}),Ae.failedSessionIds.length>0&&L(Ks(Ae.failedSessionIds.length===1?"Project removed, but one session could not be ended.":`Project removed, but ${Ae.failedSessionIds.length} sessions could not be ended.`));try{await In()}catch{}},[In]),Ze=O.useCallback(()=>Pt.listHarnesses(),[]),Zs=O.useCallback(async(re,he)=>{const be=await Pt.bindWorkflow(re,he);t(xe=>xe&&{...xe,sessions:xe.sessions.map(Ae=>Ae.id===be.id?be:Ae)})},[]),tt=O.useCallback(async re=>{const he=await Pt.updateSettings(re);return r(he),re.telemetryOptIn!==void 0&&t(be=>be&&{...be,telemetryOptIn:he.telemetryOptIn}),re.productAnalyticsOptIn!==void 0&&t(be=>be&&{...be,productAnalyticsOptIn:he.productAnalyticsOptIn!==!1}),he},[]),jn=O.useCallback(async(re,he)=>{try{await Pt.runMacro(re,he)}catch(be){L(Ks(be instanceof gn&&be.reason?be.reason:be.message))}},[]),Ds=O.useCallback(re=>{const he=G.current.get(re);if(he)return he;const be=(async()=>{L(Ks("Deploying…","info"));const xe=ch(re),Ae=Xx(p.current.find(le=>le.path===re)),ze=performance.now();Vs("agent.deploy_started",{workflow_slug:xe,...Ae});let st=null,We=null,Rt=!1;try{const le=await Pt.deploy(re,De=>{De.phase==="linking"?(st="linking",Fe(re,{phase:"linking"}),L(Ks(`Deploying — creating the agent "${De.name}" on Sapiom…`,"info"))):De.phase==="warning"?(We=De.message,L(Ks(De.message))):De.phase==="building"&&(st="building",Fe(re,{phase:"building"}),L(Ks("Deploying — building on Sapiom…","info")),Hs())});if(le.phase==="ready")Fe(re,{phase:"ready"}),Vs("agent.deploy_succeeded",{workflow_slug:xe,duration_ms:Math.round(performance.now()-ze),...Ae}),Rt=!0,L(We?Ks(`Deployed to Sapiom. ${We}`):Ks("Deployed to Sapiom.","success")),Ee(De=>{if(!De.has(re))return De;const fe=new Map(De);return fe.delete(re),fe}),await Hs();else if(le.phase==="error"){const De=st==="linking"?"Couldn't create the agent":"Deploy failed",fe=le.hint?`${De}: ${le.message} (${le.hint})`:`${De}: ${le.message}`;Fe(re,{phase:"error",message:fe}),Vs("agent.deploy_failed",{workflow_slug:xe,error_kind:Yx(st,!1),...Ae}),Rt=!0,L(Ks(fe)),Ee(Le=>new Map(Le).set(re,fe)),await Hs()}}catch(le){const De=le instanceof gn&&le.reason?le.reason:le.message;Fe(re,{phase:"error",message:De}),Rt||Vs("agent.deploy_failed",{workflow_slug:xe,error_kind:Yx(st,!0),...Ae}),L(Ks(De)),Ee(fe=>new Map(fe).set(re,De))}finally{dt(),G.current.delete(re)}})();return G.current.set(re,be),be},[Hs,dt,Fe]),kt=O.useCallback(async(re,he,be)=>{try{const{executionId:xe}=await Pt.run({definitionId:he,input:be});Yt(re,xe,"prod")}catch(xe){L(Ks(xe instanceof gn&&xe.reason?xe.reason:xe.message))}finally{dt()}},[Yt,dt]),Xt=O.useCallback(async()=>Pt.startAuth(),[]),dn=O.useCallback(async()=>{try{await Pt.disconnect()}catch(re){L(Ks(re instanceof gn&&re.reason?re.reason:re.message))}},[]),Rs=O.useCallback(()=>L(null),[]),hn=O.useCallback(async(re,he)=>{await Pt.injectInput(re,{text:he,submit:!0})},[]),Rn=O.useCallback((re,he="error")=>{L(Ks(re,he))},[]),Qs=O.useCallback(re=>ye.get(re)??null,[ye]),Fs=O.useCallback(re=>Pt.listDir(re),[]),ws=O.useCallback(re=>Pt.getWorkflowInputContract(re),[]);return{state:e,loading:S,error:A,errorKind:y,reload:It,settings:n,bootToken:Fo(),selectedWorkflowPath:k,setSelectedWorkflowPath:C,activeSessionId:x,setActiveSessionId:mt,history:R,historyLoading:q,loadHistory:Xs,createSession:ot,attachFile:Us,listTemplates:os,getTemplate:js,getWorkflowInputContract:ws,sessionRecord:un,resumeSession:Js,rehydrateSession:_n,resumeFromHistory:Pn,closeSession:ls,connectWorkflow:mi,scanWorkflows:xs,closedProjects:l,unsearchedCheckouts:c,removeProject:gi,openProject:kn,listHarnesses:Ze,bindWorkflow:Zs,updateSettings:tt,runMacro:jn,deploy:Ds,startProdRun:kt,runLocal:_t,injectInput:hn,showToast:Rn,lastDeployErrorFor:Qs,deployStateByPath:Ie,dismissDeployState:re=>Fe(re,null),pendingWorkspaces:je,addPendingWorkspace:Ye,removePendingWorkspace:jt,directActionSettleSeq:rt,listDir:Fs,lastMessage:ee,runsBySession:as,runsByExecution:P,runIdsBySession:se,selectRun:$s,previewBySession:te,toast:D,dismissToast:Rs,busySessionIds:z,tasks:$,api:Pt,startAuth:Xt,disconnect:dn}}const R7=10*6e4,A7=4e3,Zx=Bc(),T7=()=>{var Pi,ol,Ga,ll,vr,Zn,Wa,_r,vi,Ka,Jr,cl,Zr,Qr,ul,en,Ri,ea,yr,Uc,Ya;const e=j7(),t=NI(),[n,r]=O.useState(!1),[o,c]=O.useState(null),h=O.useRef(new Map),l=O.useCallback(async J=>{const Se=h.current.get(J);try{const Ne=await e.getWorkflowInputContract(J);return Ne.status==="unavailable"&&Se?Se:Ne}catch(Ne){if(Se)return Se;throw Ne}},[e.getWorkflowInputContract]),[u,m]=O.useState(!1),[g,p]=O.useState(!1),S=O.useRef(!1),[w,A]=O.useState(null),[E,y]=O.useState(null),[b,v]=O.useState(null),_=O.useRef(null),k=O.useRef(null),C=O.useRef(MI()),x=O.useRef(!1),T=O.useRef(null),[R,M]=O.useState(null),[D,L]=O.useState(null),[q,F]=O.useState(!1),[Y,Q]=O.useState(()=>{const J=hi().rightTab;return J==="canvas"||J==="steps"||J==="code"?J:"canvas"}),[G,ee]=O.useState(Y==="code"),[ne,z]=O.useState(null),[B,$]=O.useState(!1),[H,U]=O.useState(!1),[P,W]=O.useState(()=>hi().sessionNames??{}),se=(J,Se)=>{W(Ne=>{const Ve={...Ne},pt=Se.trim();return pt?Ve[J]=pt:delete Ve[J],Ci({sessionNames:Ve}),Ve})},X=O.useRef(new Map),V=O.useRef([]),ce=O.useCallback(J=>{const Se=X.current.get(J);if(Se)return window.clearTimeout(Se.timer),window.clearTimeout(Se.hintTimer),X.current.delete(J),Se},[]),oe=O.useCallback(J=>{const Se=X.current.get(J);if(!Se)return;const Ne=V.current.find(Ve=>Ve.id===J);Ne&&(Ne.ready?(ce(J),e.injectInput(J,Se.prompt).catch(()=>e.showToast(Se.failMessage))):Ne.status==="exited"&&(ce(J),e.showToast(Se.failMessage)))},[ce,e.injectInput,e.showToast]),Z=O.useCallback((J,Se,Ne)=>{ce(J);const Ve=window.setTimeout(()=>{ce(J)&&e.showToast(Ne)},R7),pt=window.setTimeout(()=>{X.current.has(J)&&e.showToast("Finish signing in or dismiss any trust or setup prompt in the terminal — your prompt sends automatically once the coding agent is ready.")},A7);X.current.set(J,{prompt:Se,failMessage:Ne,timer:Ve,hintTimer:pt}),oe(J)},[ce,e.showToast,oe]);O.useEffect(()=>{var J;if(V.current=((J=e.state)==null?void 0:J.sessions)??[],X.current.size!==0)for(const Se of[...X.current.keys()])oe(Se)},[(Pi=e.state)==null?void 0:Pi.sessions,oe]);const[te,pe]=O.useState(()=>kv()||(hi().railCollapsed??!1)),[ye,Ee]=O.useState(()=>kv()||(hi().rightCollapsed??!1)),[Ie,Pe]=O.useState(!1),Fe=a7(),je=i7(),{widths:Ue,canvasResizing:Ye,railResizing:jt,startRailDrag:rt,startCanvasDrag:Ct,resetRail:dt,resetCanvas:Lt}=l7(),[mt,Ut]=O.useState(!1),Ss=O.useRef(!1),Yt=O.useRef(null),ms=O.useRef(null),_t=O.useRef(!1),$s=O.useRef(!1),as=O.useRef(null),Et=O.useRef(null),It=O.useCallback(J=>{J&&!Ss.current&&J.style.setProperty("--rp-w",`${J.offsetWidth}px`)},[]),Hs=O.useCallback(J=>{var Ne;if((Ne=Et.current)==null||Ne.disconnect(),as.current=J,!J){Et.current=null;return}const Se=new ResizeObserver(()=>{$s.current||It(J)});Se.observe(J),Et.current=Se},[It]);Ss.current=ye,$s.current=mt,O.useLayoutEffect(()=>{if(Fe)return;Ut(!0);const J=window.setTimeout(()=>{Ut(!1),It(as.current)},260);return()=>window.clearTimeout(J)},[ye,Fe,It]),O.useEffect(()=>{const J=Se=>{var Ve,pt;const Ne=Se.key.toLowerCase();if((Se.metaKey||Se.ctrlKey)&&(Ne==="k"||Ne==="p")){Se.preventDefault(),r(!0);return}if((Se.metaKey||Se.ctrlKey)&&/^[1-9]$/.test(Se.key)){const Jt=vc(((Ve=e.state)==null?void 0:Ve.sessions)??[],IS(((pt=e.state)==null?void 0:pt.sessions.find(br=>br.id===e.activeSessionId))??null,w))[Number(Se.key)-1];Jt&&(Se.preventDefault(),m(!1),z(null),y(null),$(!1),U(!1),e.setActiveSessionId(Jt.id))}};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[(ol=e.state)==null?void 0:ol.sessions,w]);const Xs=H$({settingsRoot:(Ga=e.settings)==null?void 0:Ga.projectRoot,defaultProjectRoot:(ll=e.state)==null?void 0:ll.defaultProjectRoot,launchDir:(vr=e.state)==null?void 0:vr.launchDir}),In=async J=>{await e.updateSettings({projectRoot:J})};O.useEffect(()=>{var Se;if(!n||!e.state)return;const J=c2(e.state.sessions,((Se=e.settings)==null?void 0:Se.recentDirs)??[],e.activeSessionId);J.length>0&&e.loadHistory(J)},[n]);const Gs=O.useRef(!1);O.useEffect(()=>{var Ve,pt;if(Gs.current||!e.state)return;Gs.current=!0;const J=e.state.sessions.find(vs=>vs.id===e.activeSessionId),Se=[...((Ve=e.settings)==null?void 0:Ve.recentDirs)??[],...e.state.sessions.map(vs=>vs.cwd)],Ne=e.state.workflows.find(vs=>Se.some(Jt=>pi(Jt,vs.path)));A(Ma(J)??(Ne==null?void 0:Ne.path)??((pt=e.state.workflows[0])==null?void 0:pt.path)??null)},[e.state,e.activeSessionId,e.settings]);const ot=e.state;O.useEffect(()=>{ot&&JI(ot)},[ot,ot==null?void 0:ot.authenticated,ot==null?void 0:ot.userId,ot==null?void 0:ot.tenantId,ot==null?void 0:ot.consentSource,ot==null?void 0:ot.productAnalyticsOptIn,ot==null?void 0:ot.version]),O.useEffect(()=>{if(!ot)return;const J=ot.sessions.find(Ne=>Ne.id===e.activeSessionId),Se={firstRun:ot.firstRun===!0,settingsOpen:q,templatesOpen:B,hasLiveSession:ot.sessions.some(Ne=>Ne.status!=="exited"),inspectingDeadSession:(J==null?void 0:J.status)==="exited",rightTab:Y};KM(Se),ZI((J==null?void 0:J.harness)??null)},[ot,e.activeSessionId,q,B,Y]);const Us=O.useRef(Fe);O.useEffect(()=>{Us.current!==Fe&&(Us.current=Fe,pe(Fe),Ee(Fe))},[Fe]),O.useEffect(()=>{Fe||Ci({railCollapsed:te,rightCollapsed:ye})},[te,ye,Fe]),O.useEffect(()=>{Ci({rightTab:Y})},[Y]);const os=je.record,js=e.activeSessionId,un=w!=null&&vc(((Zn=e.state)==null?void 0:Zn.sessions)??[],w).length>0,Js=O.useRef(!1);O.useEffect(()=>{if(Js.current){Js.current=!1;return}E&&b?os({kind:"project",workspaceKey:E,root:b.root,label:b.label}):B?os({kind:"templates"}):ne?os({kind:"review",summary:ne}):u?os({kind:"composer"}):js&&(w==null||un)?os({kind:"session",sessionId:js,agentPath:w}):w&&os({kind:"agent",agentPath:w})},[os,E,b,B,ne,u,js,w,un]);const _n=e.setActiveSessionId,Pn=O.useCallback(J=>{J&&(Js.current=!0,U(!1),$(J.kind==="templates"),m(J.kind==="composer"),z(J.kind==="review"?J.summary:null),J.kind==="project"?(y(J.workspaceKey),v({workspaceKey:J.workspaceKey,root:J.root,label:J.label})):(y(null),v(null)),J.kind==="session"?(A(J.agentPath),_n(J.sessionId)):J.kind==="agent"&&A(J.agentPath))},[_n]),ls=((Wa=e.state)==null?void 0:Wa.sessions.find(J=>J.id===e.activeSessionId&&J.status==="exited"))??null,mi=ls!=null&&ls.agentSessionId?(_r=e.history.find(J=>J.agentSessionId===ls.agentSessionId))==null?void 0:_r.resumeMode:"rehydrate",xs=(ls==null?void 0:ls.agentSessionId)!=null&&mi===void 0?ls.cwd:null,kn=e.loadHistory;O.useEffect(()=>{xs&&kn([xs])},[xs,kn]);const gi=O.useRef(new Map);if(O.useEffect(()=>{for(const J of e.tasks){if(J.macroId!=="describe")continue;gi.current.get(J.id)==="running"&&J.status!=="running"&&e.showToast(J.status==="failed"?"Couldn't generate descriptions — check the agent terminal for details.":"Describe run finished — the canvas updates if the agent changed the source.",J.status==="failed"?"error":"success"),gi.current.set(J.id,J.status)}},[e.tasks,e.showToast]),O.useEffect(()=>{const J=pr();if(J!=null&&J.onDeepLink)return J.onDeepLink(Se=>{var Ne;return(Ne=_.current)==null?void 0:Ne.call(_,Se)})},[]),O.useEffect(()=>{var Se;if(e.loading)return;const J=C.current;!J||x.current||(x.current=!0,(Se=_.current)==null||Se.call(_,J))},[e.loading]),O.useEffect(()=>{var Se;const J=T.current;J&&((Se=k.current)!=null&&Se.call(k,J))&&(T.current=null)},[(vi=e.state)==null?void 0:vi.workflows]),e.loading)return d.jsx("div",{className:"app-status",children:"Loading Agent Studio…"});if(e.error||!e.state){const J=TI({online:t,error:e.errorKind});return d.jsx(nD,{status:J==="online"?"error":J,onRetry:e.reload,detail:e.error,onStartAuth:J==="auth"?e.startAuth:void 0})}const{state:Ze}=e,Zs=()=>{var J;return[...((J=e.settings)==null?void 0:J.recentDirs)??[],...Ze.launchDir?[Ze.launchDir]:[]]},tt=Ze.sessions.find(J=>J.id===e.activeSessionId)??null,jn=Ma(tt),Ds=Ze.workflows.find(J=>J.path===jn)??null,kt=Ze.workflows.find(J=>J.path===w)??null,Xt=IS(tt,w),dn=vc(Ze.sessions,Xt),Rs=ne!=null,hn=!Rs&&(tt==null?void 0:tt.status)==="exited",Rn=!Rs&&!hn&&!u&&kt!=null&&!g2(tt,w,Zs()),Qs=!Rs&&!hn&&!u&&!Rn&&tt!=null&&tt.status!=="exited",Fs=!Rs&&!hn&&(u||!Rn&&!Qs),ws=E!=null,re=Fs&&!ws,he=Ze.workspaceScopes??[],be=E?he.find(J=>J.workspaceKey===E)??null:null,xe=(b==null?void 0:b.workspaceKey)===E?b.label:be?zs(be.cwd):"Project",Ae=u&&tt!=null&&tt.status!=="exited",ze=kD({selection:kt,suppressed:Fs||Rs}),st=jD({subjectPath:(ze==null?void 0:ze.path)??null,bindingPath:jn,sessionId:e.activeSessionId}),We=`${e.activeSessionId??""}::${(ze==null?void 0:ze.path)??""}`,Rt=()=>{ms.current=e.activeSessionId??null,_t.current=e.activeSessionId==null,Ee(!1)},le=ze?Pa(ze,e.lastDeployErrorFor(ze.path)):null,De=(ze==null?void 0:ze.path)??null,fe=e.activeSessionId?e.runIdsBySession.get(e.activeSessionId)??[]:[],Le=fe.map(J=>e.runsByExecution.get(J)).filter(J=>J!==void 0),Me=[...e.runsByExecution.values()].filter(J=>!fe.includes(J.run.executionId)).sort((J,Se)=>J.observedAt-Se.observedAt),Qe=TD(gv(Le,De),gv(Me,De)),it=MD(Qe,ND(Qe,e.activeSessionId?e.runsBySession.get(e.activeSessionId)??null:null,De)),St=(it==null?void 0:it.run.status)==="running"?it.target:null,Ge=()=>{Fe&&pe(!0)},Je=(J,Se,Ne)=>{y(J),v({workspaceKey:J,root:Se,label:Ne}),$(!1),U(!1),Ge()},lt=J=>n_(J,Zs()),wt=async(J,Se,Ne={})=>{Ne.keepComposerOpen||m(!1),z(null),y(null),U(!1),A(J),e.addPendingWorkspace(J),Ge();try{const Ve=await e.createSession({cwd:J,harness:Se});return Lc("session.created"),Vs("session.started",{harness_kind:Se,origin:"user"}),Ve}catch(Ve){throw e.removePendingWorkspace(J),Ve}},Bt=async(J,Se)=>{await wt(J,Se)},Jn=(J,Se,Ne)=>{const Ve=`Scaffold a new Sapiom agent project in this directory: ${pv(Se,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to`,pt=Ne==null?void 0:Ne.trim();Z(J.id,pt?`${Ve} build this:
507
+
508
+ ${pt}`:`${Ve} define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},gt=async(J,Se,Ne)=>{const Ve=await wt(J,Se);Jn(Ve,J,Ne)},gs=J=>{var vs;if(S.current)return;S.current=!0,p(!0);const Se=w,Ne=Ma(J),Ve=Ne?((vs=Ze.workflows.find(Jt=>Cn(Jt.path,Ne)))==null?void 0:vs.name)??zs(Ne):null,pt=lt(J.cwd);(async()=>{try{const Jt=await wt(pt,J.harness);if(!Ne){A(pt);return}try{await e.bindWorkflow(Jt.id,Ne),A(Ne)}catch{A(pt),e.showToast(`Session started, but couldn't attach it to ${Ve??"the agent"}.`)}}catch{A(Se??Ne??J.cwd),e.setActiveSessionId(J.id),e.showToast("Couldn't start the session.")}finally{S.current=!1,p(!1)}})()},Ha=J=>{(async()=>{const Se=Zs(),Ne=vc(Ze.sessions,J.path).find(pt=>Se.some(vs=>Cn(vs,pt.cwd))),Ve=(Ne==null?void 0:Ne.cwd)??lt(J.path);try{const pt=await wt(Ve,"claude-code");await e.bindWorkflow(pt.id,J.path),A(J.path)}catch(pt){e.showToast(pt.message||"Couldn't start the session.")}})()},sl=J=>{var Ne;const Se=((Ne=Ze.sessions.find(Ve=>Ve.id===J))==null?void 0:Ne.cwd)??".";Z(J,`Scaffold a new Sapiom agent project in this directory: ${pv(Se,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},Ii=async(J,Se,Ne="template_gallery")=>{const Ve=await wt(J,"claude-code");Vs("agent.template_cloned",{template_slug:Se.id,template_id:Se.id,surface:Ne}),Z(Ve.id,W$(Se,J),Se.kind==="gallery"?"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.":"Couldn't send the starter prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},Ua=J=>{const Se=new Set;for(const Ne of Ze.sessions){const Ve=zs(Ne.cwd);Ve&&Se.add(Ve)}for(const Ne of Ze.workflows){const Ve=zs(Ne.path);Ve&&Se.add(Ve)}return o2(F$(J,Se),Xs||null)},zc=async(J,Se,Ne)=>{const Ve=Ua(J.trim()?z$(J):t_);if(!Ve)throw new Error("Set a project folder first — use the + to open one.");Ee(!0);const pt=await wt(Ve,Se,{keepComposerOpen:!0});try{const vs=await dL(pt.id,Ne,e.attachFile);Jn(pt,Ve,hL(J,vs)),m(!1)}catch(vs){throw await e.closeSession(pt.id).catch(Jt=>{console.error("[harness] attachment rollback failed:",Jt)}),e.removePendingWorkspace(Ve),vs}},mr=J=>{const Se=Ua(J.id);if(!Se){e.showToast("Set a project folder first — use the + to open one.");return}Ee(!0),Ii(Se,J,"welcome")},nl=async J=>{const{found:Se,repositoryBoundaries:Ne}=await e.scanWorkflows(J),Ve=Ne.length;return e.showToast(Se.length===0?Ve===0?"No agent projects found under this folder.":`No agents here — ${Ve===1?"1 separate git checkout was":`${Ve} separate git checkouts were`} not searched. Open one as its own project.`:Se.length===1?"Found 1 agent project.":`Found ${Se.length} agent projects.`,Se.length===0?"info":"success"),Se.length},il=J=>{m(!1),z(null),$(!1),U(!1),y(null),Ge();const Se=Ze.sessions.find(Ne=>Ne.id===J);Se&&A(Ma(Se)??Se.cwd),e.setActiveSessionId(J)},Hc=J=>{m(!1),z(null),$(!1),U(!1),y(null),e.setActiveSessionId(J)},Fa=J=>{m(!1),z(J),$(!1),U(!1),y(null),Ge()},bf=J=>{var Ne;const Se=(Ne=e.settings)==null?void 0:Ne.editor;e.showToast(`Opening in ${kx(Se)}… Pick a different editor in Settings.`,"info"),window.location.href=PL(Se,J)},rl=J=>{var Ne,Ve;m(!1),z(null),$(!1),U(!1),y(null),A(J),Ge();const Se=ED({focusPath:J,active:tt,sessions:Ze.sessions,roots:Zs()});Se.kind==="switch"&&(((Ne=Se.to)==null?void 0:Ne.id)??null)!==e.activeSessionId&&e.setActiveSessionId(((Ve=Se.to)==null?void 0:Ve.id)??null)};k.current=J=>{const Se=Ze.workflows.find(Ne=>Ne.definitionId!=null&&String(Ne.definitionId)===J);return Se?(rl(Se.path),!0):!1},_.current=J=>{var Se;if(J.kind==="template"){L(J.templateId),$(!0),U(!1);return}(Se=k.current)!=null&&Se.call(k,J.definitionId)||M(J)};const qa=async J=>{var Ne;M(null);const Se=Ua(((Ne=J.slug)==null?void 0:Ne.trim())||`agent-${J.definitionId}`);if(!Se){e.showToast("Set a project folder first — use the + to open one.");return}T.current=J.definitionId,Ee(!0);try{const Ve=await wt(Se,"claude-code");Z(Ve.id,K$(J.definitionId,Se),"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.")}catch(Ve){T.current=null,e.showToast(Ve.message||"Couldn't start a session to clone the agent.")}},An=async J=>{y(null),Ge();const Se=Ze.sessions.filter(Jt=>Jt.status!=="exited"),Ne=Jt=>Jt.boundWorkflowPath===J||Li(Jt.cwd,J),Ve=Se.find(Jt=>Jt.id===e.activeSessionId),pt=Ve&&Ne(Ve)?Ve:Se.filter(Ne).sort((Jt,br)=>br.cwd.length-Jt.cwd.length||br.createdAt.localeCompare(Jt.createdAt))[0];let vs;if(pt)m(!1),z(null),U(!1),pt.id!==e.activeSessionId&&e.setActiveSessionId(pt.id),vs=pt.id;else try{vs=(await wt(lt(J),"claude-code")).id}catch(Jt){return e.showToast(Jt.message||"Couldn't start a session in this folder."),null}return await e.bindWorkflow(vs,J),A(J),vs},Va=(J,Se)=>{(async()=>{const Ne=m2(Se.id);((Ne==="deploy"||Ne==="run-local")&&J!=null||Ne==="prod-run"&&(J==null?void 0:J.definitionId)!=null&&bh(J))&&(Q("steps"),Ee(!1));let pt=e.activeSessionId;if(J&&(pt=await An(J.path)??pt),Se.action.kind==="open-url"){window.open(CD(Se.action.url,J),"_blank","noopener,noreferrer");return}if(pt){if(Ne!==null){if(Ne==="deploy")J?e.deploy(J.path):e.showToast("Select an agent first.");else if(Ne==="prod-run")if((J==null?void 0:J.definitionId)!=null&&bh(J))e.startProdRun(pt,String(J.definitionId));else{const vs=J?e.lastDeployErrorFor(J.path):null,Jt=J?Pa(J,vs):"draft";e.showToast(Jt==="failed"?"Last deploy failed — retry Deploy.":Jt==="building"?"The cloud build is still in progress.":Jt==="linked"?"No ready deployment yet — deploy it first.":"This agent isn't deployed yet — deploy it first.")}else Ne==="run-local"&&(J?e.runLocal(pt,J.path):e.showToast("Select an agent first."));return}e.runMacro(Se.id,{harnessSessionId:pt,workflowPath:J==null?void 0:J.path})}})()},al=J=>{const Se=o;Se&&(c(null),Q("steps"),Ee(!1),(async()=>{const Ne=await An(Se.workflow.path)??e.activeSessionId;if(Ne)if(Se.target==="prod"){if(Se.workflow.definitionId==null||!bh(Se.workflow)){e.showToast("This agent needs a ready cloud deployment first.");return}await e.startProdRun(Ne,String(Se.workflow.definitionId),J)}else await e.runLocal(Ne,Se.workflow.path,J)})())},gr=J=>{(async()=>{const Se=await An(J.path)??e.activeSessionId;Se&&e.runMacro("describe",{harnessSessionId:Se,workflowPath:J.path,subject:QI(J)})})()};return d.jsxs("div",{className:"app-shell","data-rail-collapsed":te||void 0,children:[Fe&&!te&&d.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>pe(!0)}),(!Fe||!te)&&d.jsx("div",{className:"rail-slot"+(jt?" is-resizing":"")+(!Fe&&te?" is-collapsed":""),inert:!Fe&&te?!0:void 0,style:Fe?void 0:{width:te?0:Ue.rail},children:d.jsx(F8,{projectRoot:Xs||null,onSaveProjectRoot:In,width:Ue.rail,minWidth:__,workflows:Ze.workflows,sessions:Ze.sessions,pendingWorkspaces:e.pendingWorkspaces,activeSessionId:e.activeSessionId,focusedAgentPath:ws?null:w,workspaceScopes:Ze.workspaceScopes,selectedWorkspaceKey:E,onSelectWorkspace:Je,onFocusAgent:rl,onOpenPalette:()=>r(!0),onConnect:async J=>{await e.connectWorkflow(J)},onCollapse:()=>pe(!0),canGoBack:je.canGoBack,canGoForward:je.canGoForward,onGoBack:()=>Pn(je.goBack()),onGoForward:()=>Pn(je.goForward()),onSelectSession:il,overviewSelected:H,onSelectOverview:()=>{y(null),U(!0),m(!1),z(null),$(!1),Ge()},onNewSession:()=>{y(null),m(!0),$(!1),U(!1)},onReviewSummary:Fa,history:e.history,historyLoading:e.historyLoading,onOpenHistory:J=>void e.loadHistory(J),recentDirs:((Ka=e.settings)==null?void 0:Ka.recentDirs)??[],closedProjects:e.closedProjects,unsearchedCheckouts:e.unsearchedCheckouts,onRemoveProject:async J=>{b&&Cn(b.root,J)&&(y(null),v(null)),await e.removeProject(J)},onOpenProject:e.openProject,launchDir:Ze.launchDir??null,listDir:e.listDir,onCreateSession:Bt,listHarnesses:e.listHarnesses,onScaffoldSession:gt,onScaffoldInSession:sl,onBrowseTemplates:()=>{y(null),$(!0),U(!1)},templatesActive:B,onScanWorkflows:nl,onToast:e.showToast,telemetryOptIn:((Jr=e.settings)==null?void 0:Jr.telemetryOptIn)??Ze.telemetryOptIn,consentSource:Ze.consentSource,consentEnvReason:Ze.consentEnvReason,authenticated:Ze.authenticated,organizationName:Ze.organizationName,onToggleTelemetry:async J=>{await e.updateSettings({telemetryOptIn:J})},productAnalyticsOptIn:Ze.productAnalyticsOptIn,onToggleProductAnalytics:async J=>{await e.updateSettings({productAnalyticsOptIn:J})},rollingSummary:((cl=e.settings)==null?void 0:cl.rollingSummary)===!0,onToggleRollingSummary:async J=>{await e.updateSettings({rollingSummary:J})},editor:_f((Zr=e.settings)==null?void 0:Zr.editor),onSelectEditor:async J=>{await e.updateSettings({editor:J})},onStartAuth:e.startAuth,onDisconnect:e.disconnect,settingsOpen:q,onSetSettingsOpen:F})}),!te&&!Fe&&d.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:Ue.rail},onPointerDown:rt,onDoubleClick:dt,role:"separator","aria-orientation":"vertical","aria-label":"Resize workspace rail","data-testid":"resize-handle-rail"}),d.jsxs("div",{className:"workspace-main",children:[!t&&d.jsx(iD,{}),Ze.consentSource==="default-silent"&&!((Qr=e.settings)!=null&&Qr.telemetryNoticeDismissed)&&d.jsx(v6,{onDismiss:()=>{e.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>F(!0)}),d.jsxs("div",{className:"app"+(B?" is-browsing":"")+(ws?" is-workspace-graph":"")+(!B&&!ws&&!Fe&&!re?" canvas-animated":"")+(mt?" canvas-sliding":"")+(Ye?" canvas-dragging":""),style:{gridTemplateColumns:B||ws||Fe||re?"minmax(0, 1fr)":`minmax(${Ic}px, 1fr) ${ye?Ue.canvas==null?"0fr":"0px":Ue.canvas==null?"1fr":`${Ue.canvas}px`}`},children:[B&&d.jsx(N6,{projectRoot:Xs||null,recentDirs:((ul=e.settings)==null?void 0:ul.recentDirs)??[],listDir:e.listDir,onExit:()=>$(!1),onUse:Ii,listTemplates:e.listTemplates,getTemplate:e.getTemplate,openTemplateId:D}),ws&&E&&d.jsx(kI,{workspaceKey:E,workspaceName:xe,api:e.api,workflows:Ze.workflows,workspaceScopes:he,lastMessage:e.lastMessage,onOpenAgent:rl,onExpandRail:te?()=>pe(!1):void 0},E),d.jsxs("div",{className:"center-pane",inert:ws?!0:void 0,"aria-hidden":ws||void 0,children:[d.jsx(SD,{openedAgentName:Rn?(kt==null?void 0:kt.name)??null:null,reviewTitle:ne?ne.title:null,composing:Fs,onBack:Ae?()=>m(!1):null,activeSession:Qs||hn?tt:null,sessionName:tt?Kh(tt,Ze.sessions,P):null,onRenameSession:se,boundWorkflowName:(Ds==null?void 0:Ds.name)??null,sessions:Qs?dn:[],busySessionIds:e.busySessionIds,onSelectSession:Hc,labelOf:J=>Kh(J,Ze.sessions,P),busy:tt!=null&&e.busySessionIds.has(tt.id),onCloseSession:J=>void e.closeSession(J),onOpenInEditor:bf,editorLabel:kx((en=e.settings)==null?void 0:en.editor),onToast:e.showToast,onExpandRail:te?()=>pe(!1):null,onExpandRight:ye?Rt:null,subjectName:(kt==null?void 0:kt.name)??(tt?zs(tt.cwd):null),newSessionPending:g,onNewSession:tt?()=>gs(tt):null,actions:ze?d.jsx(d6,{workflow:ze,activeSessionId:Qs?e.activeSessionId:null,sessionReady:Qs&&(tt==null?void 0:tt.ready)===!0&&tt.status!=="exited",macros:Ze.macros,onRunMacro:J=>Va(ze,J),onRequestRun:(J,Se)=>c({workflow:ze,target:J,returnFocus:Se}),preview:Qs&&tt?e.previewBySession.get(tt.id)??null:null,lastDeployError:e.lastDeployErrorFor(ze.path),authenticated:Ze.authenticated,directActionSettleSeq:e.directActionSettleSeq,runningTarget:St}):null}),d.jsx("div",{className:"terminal-slot",children:Rs&&ne?d.jsx(vD,{summary:ne,loadRecord:e.sessionRecord,onStart:()=>{const J=ne;z(null),e.resumeFromHistory(J)},onClose:()=>z(null)}):hn&&tt?d.jsx(gD,{session:tt,resumeMode:mi,loadRecord:e.sessionRecord,onResume:()=>void e.resumeSession(tt.id),onContinue:()=>void e.rehydrateSession({cwd:tt.cwd,harness:tt.harness,from:tt.id}),onClose:()=>void e.closeSession(tt.id)}):Rn&&kt?d.jsx(wn,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${kt.name}`,body:"Start a session to map, run, and inspect this agent.",cta:d.jsxs("button",{className:"btn-primary","data-testid":"open-agent-start-session",onClick:()=>Ha(kt),children:[d.jsx(ue,{name:"Plus",size:14})," Start session"]})}):Qs&&e.activeSessionId?d.jsx("div",{className:"agent-view","data-testid":"agent-view",children:d.jsx("div",{className:"agent-view-panel",id:"agent-panel-terminal",children:d.jsx(W6,{sessionId:e.activeSessionId,token:e.bootToken,cwd:(tt==null?void 0:tt.cwd)??null})})}):d.jsx(EL,{firstRun:Ze.firstRun===!0,onSubmitIdea:zc,onAttachmentError:e.showToast,onUseTemplate:mr,onBrowseTemplates:()=>$(!0),listHarnesses:e.listHarnesses,listTemplates:e.listTemplates,telemetryOptIn:((Ri=e.settings)==null?void 0:Ri.telemetryOptIn)??Ze.telemetryOptIn,onToggleTelemetry:async J=>{await e.updateSettings({telemetryOptIn:J})},recentDirs:((ea=e.settings)==null?void 0:ea.recentDirs)??[],projectRoot:Xs||null,listDir:e.listDir,onConnect:async J=>{await e.connectWorkflow(J)},onScan:nl,onScaffold:gt,onSaveProjectRoot:In})})]}),!ye&&!Fe&&!re&&d.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:Ue.canvas==null?"50%":`min(${Ue.canvas}px, calc(100% - ${Ic}px))`},onPointerDown:Ct,onDoubleClick:Lt,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),Fe&&!ws&&!ye&&d.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>Ee(!0)}),d.jsxs("div",{ref:Hs,className:"right-pane"+(ye||re?" is-collapsed":""),inert:ws?!0:void 0,"aria-hidden":ws||void 0,children:[d.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[d.jsxs("button",{role:"tab","aria-selected":Y==="canvas",className:"right-pane-tab"+(Y==="canvas"?" is-active":""),onClick:()=>Q("canvas"),"data-testid":"right-tab-canvas",children:[d.jsx(ue,{name:"Workflow",size:14}),"Canvas"]}),d.jsxs("button",{role:"tab","aria-selected":Y==="steps",className:"right-pane-tab"+(Y==="steps"?" is-active":""),onClick:()=>Q("steps"),"data-testid":"right-tab-steps",children:[d.jsx(ue,{name:"List",size:14}),"Steps"]}),d.jsxs("button",{role:"tab","aria-selected":Y==="code",className:"right-pane-tab"+(Y==="code"?" is-active":""),onClick:()=>{Q("code"),ee(!0)},"data-testid":"right-tab-code",children:[d.jsx(ue,{name:"Code",size:14}),"Code"]}),d.jsxs("div",{className:"right-pane-corner",children:[Y==="canvas"&&(ze==null?void 0:ze.definitionId)!=null&&d.jsxs("a",{className:"status-tag status-tag-action workflow-deployed-tag right-pane-deployed","data-testid":"workflow-dashboard-link","data-deployment-state":le??void 0,href:af(ze.definitionId),target:"_blank",rel:"noreferrer","aria-label":`${le} — open in the Sapiom dashboard`,"data-tooltip":"Open this agent in the Sapiom dashboard",children:[d.jsx(ue,{name:"Cloud",size:12}),le==="ready"?"deployed":le==="building"?"building":le==="failed"?"deploy failed":"linked"]}),(Y==="canvas"||Y==="steps")&&d.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand",hidden:Ie,"aria-label":Y==="steps"?"Open Focus mode":"Expand canvas",title:Y==="steps"?"Open Focus mode":"Expand canvas",onClick:()=>Pe(J=>!J),children:d.jsx(ue,{name:"Maximize2",size:15})}),d.jsx("button",{className:"theme-toggle right-pane-collapse","data-testid":"right-collapse","aria-label":"Collapse canvas panel",title:"Collapse canvas panel",onClick:()=>Ee(!0),children:d.jsx(ue,{name:"PanelRightClose",size:15})})]})]}),d.jsx("div",{className:"right-pane-panel"+(Y==="canvas"||Y==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:d.jsx(e$,{sessionId:e.activeSessionId,lastMessage:e.lastMessage,subjectWorkflow:ze,source:st,loadWorkflowGraph:Zx.getWorkflowGraph.bind(Zx),overviewActive:Fs,sessionExited:hn,onCanvasState:J=>{var Ve;if(ws||Fe)return;const Se=((Ve=Ze.sessions.find(pt=>pt.id===e.activeSessionId))==null?void 0:Ve.status)==="exited";if(J||Se){Yt.current=null,Ee(!1);return}if(_t.current){_t.current=!1,ms.current=e.activeSessionId??null;return}const Ne=ms.current;Ne!=null&&Ne===e.activeSessionId||Yt.current!==We&&(Yt.current=We,Ee(!0))},onGraphChange:(J,Se)=>{const Ne=o6(Se);Ne&&h.current.set(J,Ne)},expanded:Ie,onToggleExpanded:()=>Pe(J=>!J),macros:Ze.macros,tasks:e.tasks,surface:Y==="steps"?"steps":"board",onOpenSteps:()=>Q("steps"),run:(it==null?void 0:it.run)??null,runTarget:(it==null?void 0:it.target)??null,runs:Qe,onSelectRun:J=>{e.activeSessionId&&e.selectRun(e.activeSessionId,J)},preview:e.activeSessionId?e.previewBySession.get(e.activeSessionId)??null:null,deployState:ze?e.deployStateByPath.get(ze.path)??null:null,onDismissDeploy:()=>{ze&&e.dismissDeployState(ze.path)},onOpenCode:()=>{Q("code"),ee(!0)},workflows:Ze.workflows,onOpenWorkflow:J=>void An(J),onRunMacro:J=>Va(ze,J),onInjectPrompt:J=>{e.activeSessionId&&e.injectInput(e.activeSessionId,J)},onDescribeWorkflow:gr})}),(Y==="code"||G)&&d.jsx("div",{className:"right-pane-panel"+(Y==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:d.jsx(g$,{boundWorkflow:ze,noSessionAgent:null,agentsBaseUrl:Ze.agentsBaseUrl,lastDeployError:ze?e.lastDeployErrorFor(ze.path):null})})]})]})]}),H&&d.jsx(kL,{firstRun:Ze.firstRun===!0,appVersion:((yr=pr())==null?void 0:yr.appVersion)||"0.9.0",recentDirs:((Uc=e.settings)==null?void 0:Uc.recentDirs)??[],projectRoot:Xs||null,listDir:e.listDir,onConnect:async J=>{await e.connectWorkflow(J),U(!1)},onScan:nl,onBrowseTemplates:()=>{U(!1),$(!0)},onDismiss:()=>U(!1)}),n&&d.jsx(tD,{sessions:Ze.sessions,workflows:Ze.workflows,recentDirs:((Ya=e.settings)==null?void 0:Ya.recentDirs)??[],history:e.history,sessionNames:P,activeSessionId:e.activeSessionId,listDir:e.listDir,listTemplates:e.listTemplates,onSelectSession:il,onReviewSummary:Fa,onOpenPath:J=>void Bt(J,"claude-code"),onOpenTemplate:J=>{L(J),$(!0),U(!1)},actions:[{id:"browse-templates",label:"Browse templates",meta:"Gallery and starters",icon:"LayoutTemplate",run:()=>{$(!0),U(!1)}},{id:"toggle-theme",label:"Toggle theme",meta:"Light and dark",icon:"Sun",run:tC},{id:"toggle-rail",label:te?"Show workspace panel":"Hide workspace panel",meta:"Left pane",icon:"Menu",run:()=>pe(J=>!J)},{id:"toggle-right",label:ye?"Show canvas panel":"Hide canvas panel",meta:"Right pane",icon:ye?"PanelRightOpen":"PanelRightClose",run:()=>Ee(J=>!J)},...tt?[{id:"new-session-here",label:"New session in this folder",meta:lt(tt.cwd),icon:"Plus",run:()=>void Bt(lt(tt.cwd),"claude-code")}]:[]],onClose:()=>r(!1)}),R&&d.jsx($I,{agentLabel:R.slug?`“${R.slug}”`:`Agent ${R.definitionId}`,onCancel:()=>M(null),onConfirm:()=>void qa(R)}),o&&d.jsx(g6,{workflow:o.workflow,target:o.target,loadContract:l,returnFocus:o.returnFocus,onClose:()=>c(null),onRun:al}),e.toast&&d.jsx(J6,{message:e.toast.message,tone:e.toast.tone,onDismiss:e.dismissToast}),d.jsx(Z6,{})]})};function N7(e=document.documentElement,t=window){const n=c=>{e.dataset.windowFocused=c?"true":"false"};n(t.document.hasFocus());const r=()=>n(!0),o=()=>n(!1);return t.addEventListener("focus",r),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",r),t.removeEventListener("blur",o)}}function M7(e=typeof window>"u"?"":window.location.search){return new URLSearchParams(e).get("frame")==="macos"?"macos":"web"}document.documentElement.dataset.windowFrame=M7();N7();window.addEventListener("scroll",()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},{passive:!0});window.addEventListener("dragover",e=>{var t;(t=e.dataTransfer)!=null&&t.types.includes("Files")&&e.preventDefault()});window.addEventListener("drop",e=>{var t;(t=e.dataTransfer)!=null&&t.types.includes("Files")&&e.preventDefault()});_R.createRoot(document.getElementById("root")).render(d.jsx(O.StrictMode,{children:d.jsx(T7,{})}));