@sapiom/harness 0.2.5 → 0.2.7

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 (65) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +12 -10
  3. package/dist/cli/banner.d.ts +12 -0
  4. package/dist/cli/banner.d.ts.map +1 -0
  5. package/dist/cli/banner.js +21 -0
  6. package/dist/cli/banner.js.map +1 -0
  7. package/dist/cli/bin.js +4 -19
  8. package/dist/cli/bin.js.map +1 -1
  9. package/dist/cli/consent.js +3 -3
  10. package/dist/core/canvas-body.js +3 -3
  11. package/dist/core/canvas-body.js.map +1 -1
  12. package/dist/core/canvas-graph.js +1 -1
  13. package/dist/core/canvas-graph.js.map +1 -1
  14. package/dist/core/canvas-template.js +12 -12
  15. package/dist/core/example-seed.js +4 -4
  16. package/dist/core/inject/mcp-config.d.ts +9 -0
  17. package/dist/core/inject/mcp-config.d.ts.map +1 -1
  18. package/dist/core/inject/mcp-config.js +7 -3
  19. package/dist/core/inject/mcp-config.js.map +1 -1
  20. package/dist/core/macro-runner.js +1 -1
  21. package/dist/core/macro-runner.js.map +1 -1
  22. package/dist/core/macros.d.ts.map +1 -1
  23. package/dist/core/macros.js +16 -1
  24. package/dist/core/macros.js.map +1 -1
  25. package/dist/core/resume-brief.js +7 -7
  26. package/dist/core/resume-brief.js.map +1 -1
  27. package/dist/core/rolling-summary.js +1 -1
  28. package/dist/core/rolling-summary.js.map +1 -1
  29. package/dist/core/session-manager.d.ts +10 -12
  30. package/dist/core/session-manager.d.ts.map +1 -1
  31. package/dist/core/session-manager.js +8 -9
  32. package/dist/core/session-manager.js.map +1 -1
  33. package/dist/core/workspace-context.d.ts +30 -16
  34. package/dist/core/workspace-context.d.ts.map +1 -1
  35. package/dist/core/workspace-context.js +142 -46
  36. package/dist/core/workspace-context.js.map +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/profiles/default.d.ts.map +1 -1
  42. package/dist/profiles/default.js +29 -21
  43. package/dist/profiles/default.js.map +1 -1
  44. package/dist/server/actions.js +2 -2
  45. package/dist/server/actions.js.map +1 -1
  46. package/dist/server/canvas.js +2 -2
  47. package/dist/server/index.d.ts.map +1 -1
  48. package/dist/server/index.js +27 -22
  49. package/dist/server/index.js.map +1 -1
  50. package/dist/server/rest.js +1 -1
  51. package/dist/server/rest.js.map +1 -1
  52. package/dist/server/static.js +2 -2
  53. package/dist/shared/branding.d.ts +3 -0
  54. package/dist/shared/branding.d.ts.map +1 -0
  55. package/dist/shared/branding.js +3 -0
  56. package/dist/shared/branding.js.map +1 -0
  57. package/dist/shared/types.d.ts +18 -16
  58. package/dist/shared/types.d.ts.map +1 -1
  59. package/dist/shared/types.js +4 -4
  60. package/dist/web/assets/{index-AmeDnue_.css → index-AAGKe1y6.css} +1 -1
  61. package/dist/web/assets/index-DXRbHg-Q.js +448 -0
  62. package/dist/web/canvas/sess-boot/index.html +2 -2
  63. package/dist/web/index.html +3 -3
  64. package/package.json +7 -7
  65. package/dist/web/assets/index-DHqjuwrG.js +0 -447
@@ -1,447 +0,0 @@
1
- var Hw=Object.defineProperty;var zw=(s,t,n)=>t in s?Hw(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var hd=(s,t,n)=>zw(s,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const d of l)if(d.type==="childList")for(const v of d.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&a(v)}).observe(document,{childList:!0,subtree:!0});function n(l){const d={};return l.integrity&&(d.integrity=l.integrity),l.referrerPolicy&&(d.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?d.credentials="include":l.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function a(l){if(l.ep)return;l.ep=!0;const d=n(l);fetch(l.href,d)}})();var dd={exports:{}},lo={};/**
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 cg;function Iw(){if(cg)return lo;cg=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,l,d){var v=null;if(d!==void 0&&(v=""+d),l.key!==void 0&&(v=""+l.key),"key"in l){d={};for(var c in l)c!=="key"&&(d[c]=l[c])}else d=l;return l=d.ref,{$$typeof:s,type:a,key:v,ref:l!==void 0?l:null,props:d}}return lo.Fragment=t,lo.jsx=n,lo.jsxs=n,lo}var ug;function $w(){return ug||(ug=1,dd.exports=Iw()),dd.exports}var h=$w(),fd={exports:{}},Ye={};/**
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 hg;function Pw(){if(hg)return Ye;hg=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),v=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),w=Symbol.iterator;function E(L){return L===null||typeof L!="object"?null:(L=w&&L[w]||L["@@iterator"],typeof L=="function"?L:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function S(L,P,V){this.props=L,this.context=P,this.refs=b,this.updater=V||A}S.prototype.isReactComponent={},S.prototype.setState=function(L,P){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,P,"setState")},S.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function _(){}_.prototype=S.prototype;function g(L,P,V){this.props=L,this.context=P,this.refs=b,this.updater=V||A}var T=g.prototype=new _;T.constructor=g,C(T,S.prototype),T.isPureReactComponent=!0;var R=Array.isArray;function M(){}var j={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function D(L,P,V){var te=V.ref;return{$$typeof:s,type:L,key:P,ref:te!==void 0?te:null,props:V}}function B(L,P){return D(L.type,P,L.props)}function I(L){return typeof L=="object"&&L!==null&&L.$$typeof===s}function q(L){var P={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(V){return P[V]})}var $=/\/+/g;function J(L,P){return typeof L=="object"&&L!==null&&L.key!=null?q(""+L.key):P.toString(36)}function ee(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(M,M):(L.status="pending",L.then(function(P){L.status==="pending"&&(L.status="fulfilled",L.value=P)},function(P){L.status==="pending"&&(L.status="rejected",L.reason=P)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function W(L,P,V,te,de){var ge=typeof L;(ge==="undefined"||ge==="boolean")&&(L=null);var K=!1;if(L===null)K=!0;else switch(ge){case"bigint":case"string":case"number":K=!0;break;case"object":switch(L.$$typeof){case s:case t:K=!0;break;case y:return K=L._init,W(K(L._payload),P,V,te,de)}}if(K)return de=de(L),K=te===""?"."+J(L,0):te,R(de)?(V="",K!=null&&(V=K.replace($,"$&/")+"/"),W(de,P,V,"",function(Q){return Q})):de!=null&&(I(de)&&(de=B(de,V+(de.key==null||L&&L.key===de.key?"":(""+de.key).replace($,"$&/")+"/")+K)),P.push(de)),1;K=0;var z=te===""?".":te+":";if(R(L))for(var ie=0;ie<L.length;ie++)te=L[ie],ge=z+J(te,ie),K+=W(te,P,V,ge,de);else if(ie=E(L),typeof ie=="function")for(L=ie.call(L),ie=0;!(te=L.next()).done;)te=te.value,ge=z+J(te,ie++),K+=W(te,P,V,ge,de);else if(ge==="object"){if(typeof L.then=="function")return W(ee(L),P,V,te,de);throw P=String(L),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return K}function G(L,P,V){if(L==null)return L;var te=[],de=0;return W(L,te,"","",function(ge){return P.call(V,ge,de++)}),te}function Y(L){if(L._status===-1){var P=L._result;P=P(),P.then(function(V){(L._status===0||L._status===-1)&&(L._status=1,L._result=V)},function(V){(L._status===0||L._status===-1)&&(L._status=2,L._result=V)}),L._status===-1&&(L._status=0,L._result=P)}if(L._status===1)return L._result.default;throw L._result}var O=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},F={map:G,forEach:function(L,P,V){G(L,function(){P.apply(this,arguments)},V)},count:function(L){var P=0;return G(L,function(){P++}),P},toArray:function(L){return G(L,function(P){return P})||[]},only:function(L){if(!I(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ye.Activity=f,Ye.Children=F,Ye.Component=S,Ye.Fragment=n,Ye.Profiler=l,Ye.PureComponent=g,Ye.StrictMode=a,Ye.Suspense=u,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(L){return j.H.useMemoCache(L)}},Ye.cache=function(L){return function(){return L.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(L,P,V){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var te=C({},L.props),de=L.key;if(P!=null)for(ge in P.key!==void 0&&(de=""+P.key),P)!k.call(P,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&P.ref===void 0||(te[ge]=P[ge]);var ge=arguments.length-2;if(ge===1)te.children=V;else if(1<ge){for(var K=Array(ge),z=0;z<ge;z++)K[z]=arguments[z+2];te.children=K}return D(L.type,de,te)},Ye.createContext=function(L){return L={$$typeof:v,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:d,_context:L},L},Ye.createElement=function(L,P,V){var te,de={},ge=null;if(P!=null)for(te in P.key!==void 0&&(ge=""+P.key),P)k.call(P,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(de[te]=P[te]);var K=arguments.length-2;if(K===1)de.children=V;else if(1<K){for(var z=Array(K),ie=0;ie<K;ie++)z[ie]=arguments[ie+2];de.children=z}if(L&&L.defaultProps)for(te in K=L.defaultProps,K)de[te]===void 0&&(de[te]=K[te]);return D(L,ge,de)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(L){return{$$typeof:c,render:L}},Ye.isValidElement=I,Ye.lazy=function(L){return{$$typeof:y,_payload:{_status:-1,_result:L},_init:Y}},Ye.memo=function(L,P){return{$$typeof:p,type:L,compare:P===void 0?null:P}},Ye.startTransition=function(L){var P=j.T,V={};j.T=V;try{var te=L(),de=j.S;de!==null&&de(V,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(M,O)}catch(ge){O(ge)}finally{P!==null&&V.types!==null&&(P.types=V.types),j.T=P}},Ye.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Ye.use=function(L){return j.H.use(L)},Ye.useActionState=function(L,P,V){return j.H.useActionState(L,P,V)},Ye.useCallback=function(L,P){return j.H.useCallback(L,P)},Ye.useContext=function(L){return j.H.useContext(L)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(L,P){return j.H.useDeferredValue(L,P)},Ye.useEffect=function(L,P){return j.H.useEffect(L,P)},Ye.useEffectEvent=function(L){return j.H.useEffectEvent(L)},Ye.useId=function(){return j.H.useId()},Ye.useImperativeHandle=function(L,P,V){return j.H.useImperativeHandle(L,P,V)},Ye.useInsertionEffect=function(L,P){return j.H.useInsertionEffect(L,P)},Ye.useLayoutEffect=function(L,P){return j.H.useLayoutEffect(L,P)},Ye.useMemo=function(L,P){return j.H.useMemo(L,P)},Ye.useOptimistic=function(L,P){return j.H.useOptimistic(L,P)},Ye.useReducer=function(L,P,V){return j.H.useReducer(L,P,V)},Ye.useRef=function(L){return j.H.useRef(L)},Ye.useState=function(L){return j.H.useState(L)},Ye.useSyncExternalStore=function(L,P,V){return j.H.useSyncExternalStore(L,P,V)},Ye.useTransition=function(){return j.H.useTransition()},Ye.version="19.2.7",Ye}var dg;function Yf(){return dg||(dg=1,fd.exports=Pw()),fd.exports}var U=Yf(),pd={exports:{}},co={},vd={exports:{}},_d={};/**
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 fg;function Uw(){return fg||(fg=1,(function(s){function t(W,G){var Y=W.length;W.push(G);e:for(;0<Y;){var O=Y-1>>>1,F=W[O];if(0<l(F,G))W[O]=G,W[Y]=F,Y=O;else break e}}function n(W){return W.length===0?null:W[0]}function a(W){if(W.length===0)return null;var G=W[0],Y=W.pop();if(Y!==G){W[0]=Y;e:for(var O=0,F=W.length,L=F>>>1;O<L;){var P=2*(O+1)-1,V=W[P],te=P+1,de=W[te];if(0>l(V,Y))te<F&&0>l(de,V)?(W[O]=de,W[te]=Y,O=te):(W[O]=V,W[P]=Y,O=P);else if(te<F&&0>l(de,Y))W[O]=de,W[te]=Y,O=te;else break e}}return G}function l(W,G){var Y=W.sortIndex-G.sortIndex;return Y!==0?Y:W.id-G.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var v=Date,c=v.now();s.unstable_now=function(){return v.now()-c}}var u=[],p=[],y=1,f=null,w=3,E=!1,A=!1,C=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;function T(W){for(var G=n(p);G!==null;){if(G.callback===null)a(p);else if(G.startTime<=W)a(p),G.sortIndex=G.expirationTime,t(u,G);else break;G=n(p)}}function R(W){if(C=!1,T(W),!A)if(n(u)!==null)A=!0,M||(M=!0,q());else{var G=n(p);G!==null&&ee(R,G.startTime-W)}}var M=!1,j=-1,k=5,D=-1;function B(){return b?!0:!(s.unstable_now()-D<k)}function I(){if(b=!1,M){var W=s.unstable_now();D=W;var G=!0;try{e:{A=!1,C&&(C=!1,_(j),j=-1),E=!0;var Y=w;try{t:{for(T(W),f=n(u);f!==null&&!(f.expirationTime>W&&B());){var O=f.callback;if(typeof O=="function"){f.callback=null,w=f.priorityLevel;var F=O(f.expirationTime<=W);if(W=s.unstable_now(),typeof F=="function"){f.callback=F,T(W),G=!0;break t}f===n(u)&&a(u),T(W)}else a(u);f=n(u)}if(f!==null)G=!0;else{var L=n(p);L!==null&&ee(R,L.startTime-W),G=!1}}break e}finally{f=null,w=Y,E=!1}G=void 0}}finally{G?q():M=!1}}}var q;if(typeof g=="function")q=function(){g(I)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,J=$.port2;$.port1.onmessage=I,q=function(){J.postMessage(null)}}else q=function(){S(I,0)};function ee(W,G){j=S(function(){W(s.unstable_now())},G)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(W){W.callback=null},s.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<W?Math.floor(1e3/W):5},s.unstable_getCurrentPriorityLevel=function(){return w},s.unstable_next=function(W){switch(w){case 1:case 2:case 3:var G=3;break;default:G=w}var Y=w;w=G;try{return W()}finally{w=Y}},s.unstable_requestPaint=function(){b=!0},s.unstable_runWithPriority=function(W,G){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var Y=w;w=W;try{return G()}finally{w=Y}},s.unstable_scheduleCallback=function(W,G,Y){var O=s.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?O+Y:O):Y=O,W){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=Y+F,W={id:y++,callback:G,priorityLevel:W,startTime:Y,expirationTime:F,sortIndex:-1},Y>O?(W.sortIndex=Y,t(p,W),n(u)===null&&W===n(p)&&(C?(_(j),j=-1):C=!0,ee(R,Y-O))):(W.sortIndex=F,t(u,W),A||E||(A=!0,M||(M=!0,q()))),W},s.unstable_shouldYield=B,s.unstable_wrapCallback=function(W){var G=w;return function(){var Y=w;w=G;try{return W.apply(this,arguments)}finally{w=Y}}}})(_d)),_d}var pg;function Fw(){return pg||(pg=1,vd.exports=Uw()),vd.exports}var md={exports:{}},Ss={};/**
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 vg;function qw(){if(vg)return Ss;vg=1;var s=Yf();function t(u){var p="https://react.dev/errors/"+u;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={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},l=Symbol.for("react.portal");function d(u,p,y){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:f==null?null:""+f,children:u,containerInfo:p,implementation:y}}var v=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,p){if(u==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ss.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Ss.createPortal=function(u,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return d(u,p,null,y)},Ss.flushSync=function(u){var p=v.T,y=a.p;try{if(v.T=null,a.p=2,u)return u()}finally{v.T=p,a.p=y,a.d.f()}},Ss.preconnect=function(u,p){typeof u=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(u,p))},Ss.prefetchDNS=function(u){typeof u=="string"&&a.d.D(u)},Ss.preinit=function(u,p){if(typeof u=="string"&&p&&typeof p.as=="string"){var y=p.as,f=c(y,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,E=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?a.d.S(u,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:f,integrity:w,fetchPriority:E}):y==="script"&&a.d.X(u,{crossOrigin:f,integrity:w,fetchPriority:E,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ss.preinitModule=function(u,p){if(typeof u=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=c(p.as,p.crossOrigin);a.d.M(u,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(u)},Ss.preload=function(u,p){if(typeof u=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,f=c(y,p.crossOrigin);a.d.L(u,y,{crossOrigin:f,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ss.preloadModule=function(u,p){if(typeof u=="string")if(p){var y=c(p.as,p.crossOrigin);a.d.m(u,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(u)},Ss.requestFormReset=function(u){a.d.r(u)},Ss.unstable_batchedUpdates=function(u,p){return u(p)},Ss.useFormState=function(u,p,y){return v.H.useFormState(u,p,y)},Ss.useFormStatus=function(){return v.H.useHostTransitionStatus()},Ss.version="19.2.7",Ss}var _g;function ly(){if(_g)return md.exports;_g=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),md.exports=qw(),md.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 mg;function Ww(){if(mg)return co;mg=1;var s=Fw(),t=Yf(),n=ly();function a(e){var i="https://react.dev/errors/"+e;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)i+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var i=e,r=e;if(e.alternate)for(;i.return;)i=i.return;else{e=i;do i=e,(i.flags&4098)!==0&&(r=i.return),e=i.return;while(e)}return i.tag===3?r:null}function v(e){if(e.tag===13){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function c(e){if(e.tag===31){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function u(e){if(d(e)!==e)throw Error(a(188))}function p(e){var i=e.alternate;if(!i){if(i=d(e),i===null)throw Error(a(188));return i!==e?null:e}for(var r=e,o=i;;){var m=r.return;if(m===null)break;var x=m.alternate;if(x===null){if(o=m.return,o!==null){r=o;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===r)return u(m),e;if(x===o)return u(m),i;x=x.sibling}throw Error(a(188))}if(r.return!==o.return)r=m,o=x;else{for(var N=!1,H=m.child;H;){if(H===r){N=!0,r=m,o=x;break}if(H===o){N=!0,o=m,r=x;break}H=H.sibling}if(!N){for(H=x.child;H;){if(H===r){N=!0,r=x,o=m;break}if(H===o){N=!0,o=x,r=m;break}H=H.sibling}if(!N)throw Error(a(189))}}if(r.alternate!==o)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?e:i}function y(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e;for(e=e.child;e!==null;){if(i=y(e),i!==null)return i;e=e.sibling}return null}var f=Object.assign,w=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),g=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function q(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var $=Symbol.for("react.client.reference");function J(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case S:return"Profiler";case b:return"StrictMode";case R:return"Suspense";case M:return"SuspenseList";case D:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case g:return e.displayName||"Context";case _:return(e._context.displayName||"Context")+".Consumer";case T:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case j:return i=e.displayName||null,i!==null?i:J(e.type)||"Memo";case k:i=e._payload,e=e._init;try{return J(e(i))}catch{}}return null}var ee=Array.isArray,W=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},O=[],F=-1;function L(e){return{current:e}}function P(e){0>F||(e.current=O[F],O[F]=null,F--)}function V(e,i){F++,O[F]=e.current,e.current=i}var te=L(null),de=L(null),ge=L(null),K=L(null);function z(e,i){switch(V(ge,i),V(de,e),V(te,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?jm(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=jm(i),e=Nm(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(te),V(te,e)}function ie(){P(te),P(de),P(ge)}function Q(e){e.memoizedState!==null&&V(K,e);var i=te.current,r=Nm(i,e.type);i!==r&&(V(de,e),V(te,r))}function we(e){de.current===e&&(P(te),P(de)),K.current===e&&(P(K),no._currentValue=Y)}var fe,Le;function ze(e){if(fe===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);fe=i&&i[1]||"",Le=-1<r.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+fe+e+Le}var We=!1;function Ge(e,i){if(!e||We)return"";We=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(he){var ae=he}Reflect.construct(e,[],ye)}else{try{ye.call()}catch(he){ae=he}e.call(ye.prototype)}}else{try{throw Error()}catch(he){ae=he}(ye=e())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(he){if(he&&ae&&typeof he.stack=="string")return[he.stack,ae.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=o.DetermineComponentFrameRoot(),N=x[0],H=x[1];if(N&&H){var X=N.split(`
44
- `),re=H.split(`
45
- `);for(m=o=0;o<X.length&&!X[o].includes("DetermineComponentFrameRoot");)o++;for(;m<re.length&&!re[m].includes("DetermineComponentFrameRoot");)m++;if(o===X.length||m===re.length)for(o=X.length-1,m=re.length-1;1<=o&&0<=m&&X[o]!==re[m];)m--;for(;1<=o&&0<=m;o--,m--)if(X[o]!==re[m]){if(o!==1||m!==1)do if(o--,m--,0>m||X[o]!==re[m]){var pe=`
46
- `+X[o].replace(" at new "," at ");return e.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",e.displayName)),pe}while(1<=o&&0<=m);break}}}finally{We=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?ze(r):""}function De(e,i){switch(e.tag){case 26:case 27:case 5:return ze(e.type);case 16:return ze("Lazy");case 13:return e.child!==i&&i!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return Ge(e.type,!1);case 11:return Ge(e.type.render,!1);case 1:return Ge(e.type,!0);case 31:return ze("Activity");default:return""}}function dt(e){try{var i="",r=null;do i+=De(e,r),r=e,e=e.return;while(e);return i}catch(o){return`
47
- Error generating stack: `+o.message+`
48
- `+o.stack}}var At=Object.prototype.hasOwnProperty,qt=s.unstable_scheduleCallback,jt=s.unstable_cancelCallback,Nt=s.unstable_shouldYield,ct=s.unstable_requestPaint,ut=s.unstable_now,es=s.unstable_getCurrentPriorityLevel,Yt=s.unstable_ImmediatePriority,ts=s.unstable_UserBlockingPriority,ot=s.unstable_NormalPriority,Xt=s.unstable_LowPriority,Wt=s.unstable_IdlePriority,ss=s.log,nt=s.unstable_setDisableYieldValue,Ee=null,Ue=null;function Lt(e){if(typeof ss=="function"&&nt(e),Ue&&typeof Ue.setStrictMode=="function")try{Ue.setStrictMode(Ee,e)}catch{}}var mt=Math.clz32?Math.clz32:ji,un=Math.log,Kt=Math.LN2;function ji(e){return e>>>=0,e===0?32:31-(un(e)/Kt|0)|0}var Us=256,js=262144,mi=4194304;function Cs(e){var i=e&42;if(i!==0)return i;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function bs(e,i,r){var o=e.pendingLanes;if(o===0)return 0;var m=0,x=e.suspendedLanes,N=e.pingedLanes;e=e.warmLanes;var H=o&134217727;return H!==0?(o=H&~x,o!==0?m=Cs(o):(N&=H,N!==0?m=Cs(N):r||(r=H&~e,r!==0&&(m=Cs(r))))):(H=o&~x,H!==0?m=Cs(H):N!==0?m=Cs(N):r||(r=o&~e,r!==0&&(m=Cs(r)))),m===0?0:i!==0&&i!==m&&(i&x)===0&&(x=m&-m,r=i&-i,x>=r||x===32&&(r&4194048)!==0)?i:m}function Ns(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function le(e,i){switch(e){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 _e(){var e=mi;return mi<<=1,(mi&62914560)===0&&(mi=4194304),e}function Ce(e){for(var i=[],r=0;31>r;r++)i.push(e);return i}function Se(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Oe(e,i,r,o,m,x){var N=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var H=e.entanglements,X=e.expirationTimes,re=e.hiddenUpdates;for(r=N&~r;0<r;){var pe=31-mt(r),ye=1<<pe;H[pe]=0,X[pe]=-1;var ae=re[pe];if(ae!==null)for(re[pe]=null,pe=0;pe<ae.length;pe++){var he=ae[pe];he!==null&&(he.lane&=-536870913)}r&=~ye}o!==0&&et(e,o,0),x!==0&&m===0&&e.tag!==0&&(e.suspendedLanes|=x&~(N&~i))}function et(e,i,r){e.pendingLanes|=i,e.suspendedLanes&=~i;var o=31-mt(i);e.entangledLanes|=i,e.entanglements[o]=e.entanglements[o]|1073741824|r&261930}function Ke(e,i){var r=e.entangledLanes|=i;for(e=e.entanglements;r;){var o=31-mt(r),m=1<<o;m&i|e[o]&i&&(e[o]|=i),r&=~m}}function tt(e,i){var r=i&-i;return r=(r&42)!==0?1:ft(r),(r&(e.suspendedLanes|i))!==0?0:r}function ft(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Es(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function hs(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:sg(e.type))}function ue(e,i){var r=G.p;try{return G.p=e,i()}finally{G.p=r}}var xe=Math.random().toString(36).slice(2),Me="__reactFiber$"+xe,oe="__reactProps$"+xe,Ae="__reactContainer$"+xe,je="__reactEvents$"+xe,ht="__reactListeners$"+xe,qe="__reactHandles$"+xe,ks="__reactResources$"+xe,Fs="__reactMarker$"+xe;function ei(e){delete e[Me],delete e[oe],delete e[je],delete e[ht],delete e[qe]}function Ni(e){var i=e[Me];if(i)return i;for(var r=e.parentNode;r;){if(i=r[Ae]||r[Me]){if(r=i.alternate,i.child!==null||r!==null&&r.child!==null)for(e=$m(e);e!==null;){if(r=e[Me])return r;e=$m(e)}return i}e=r,r=e.parentNode}return null}function gi(e){if(e=e[Me]||e[Ae]){var i=e.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return e}return null}function ds(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(a(33))}function hn(e){var i=e[ks];return i||(i=e[ks]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function is(e){e[Fs]=!0}var ba=new Set,Sp={};function In(e,i){mr(e,i),mr(e+"Capture",i)}function mr(e,i){for(Sp[e]=i,e=0;e<i.length;e++)ba.add(i[e])}var A1=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]*$"),wp={},xp={};function R1(e){return At.call(xp,e)?!0:At.call(wp,e)?!1:A1.test(e)?xp[e]=!0:(wp[e]=!0,!1)}function Go(e,i,r){if(R1(i))if(r===null)e.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(i);return}}e.setAttribute(i,""+r)}}function Vo(e,i,r){if(r===null)e.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,""+r)}}function Li(e,i,r,o){if(o===null)e.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(i,r,""+o)}}function ti(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Cp(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function M1(e,i,r){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);if(!e.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var m=o.get,x=o.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return m.call(this)},set:function(N){r=""+N,x.call(this,N)}}),Object.defineProperty(e,i,{enumerable:o.enumerable}),{getValue:function(){return r},setValue:function(N){r=""+N},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function nu(e){if(!e._valueTracker){var i=Cp(e)?"checked":"value";e._valueTracker=M1(e,i,""+e[i])}}function Ep(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var r=i.getValue(),o="";return e&&(o=Cp(e)?e.checked?"true":"false":e.value),e=o,e!==r?(i.setValue(e),!0):!1}function Yo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var D1=/[\n"\\]/g;function si(e){return e.replace(D1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ru(e,i,r,o,m,x,N,H){e.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.type=N:e.removeAttribute("type"),i!=null?N==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+ti(i)):e.value!==""+ti(i)&&(e.value=""+ti(i)):N!=="submit"&&N!=="reset"||e.removeAttribute("value"),i!=null?au(e,N,ti(i)):r!=null?au(e,N,ti(r)):o!=null&&e.removeAttribute("value"),m==null&&x!=null&&(e.defaultChecked=!!x),m!=null&&(e.checked=m&&typeof m!="function"&&typeof m!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?e.name=""+ti(H):e.removeAttribute("name")}function kp(e,i,r,o,m,x,N,H){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),i!=null||r!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){nu(e);return}r=r!=null?""+ti(r):"",i=i!=null?""+ti(i):r,H||i===e.value||(e.value=i),e.defaultValue=i}o=o??m,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=H?e.checked:!!o,e.defaultChecked=!!o,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(e.name=N),nu(e)}function au(e,i,r){i==="number"&&Yo(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function gr(e,i,r,o){if(e=e.options,i){i={};for(var m=0;m<r.length;m++)i["$"+r[m]]=!0;for(r=0;r<e.length;r++)m=i.hasOwnProperty("$"+e[r].value),e[r].selected!==m&&(e[r].selected=m),m&&o&&(e[r].defaultSelected=!0)}else{for(r=""+ti(r),i=null,m=0;m<e.length;m++){if(e[m].value===r){e[m].selected=!0,o&&(e[m].defaultSelected=!0);return}i!==null||e[m].disabled||(i=e[m])}i!==null&&(i.selected=!0)}}function Tp(e,i,r){if(i!=null&&(i=""+ti(i),i!==e.value&&(e.value=i),r==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=r!=null?""+ti(r):""}function Ap(e,i,r,o){if(i==null){if(o!=null){if(r!=null)throw Error(a(92));if(ee(o)){if(1<o.length)throw Error(a(93));o=o[0]}r=o}r==null&&(r=""),i=r}r=ti(i),e.defaultValue=r,o=e.textContent,o===r&&o!==""&&o!==null&&(e.value=o),nu(e)}function yr(e,i){if(i){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=i;return}}e.textContent=i}var j1=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 Rp(e,i,r){var o=i.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?o?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":o?e.setProperty(i,r):typeof r!="number"||r===0||j1.has(i)?i==="float"?e.cssFloat=r:e[i]=(""+r).trim():e[i]=r+"px"}function Mp(e,i,r){if(i!=null&&typeof i!="object")throw Error(a(62));if(e=e.style,r!=null){for(var o in r)!r.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var m in i)o=i[m],i.hasOwnProperty(m)&&r[m]!==o&&Rp(e,m,o)}else for(var x in i)i.hasOwnProperty(x)&&Rp(e,x,i[x])}function ou(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var N1=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"]]),L1=/^[\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 Xo(e){return L1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Oi(){}var lu=null;function cu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var br=null,Sr=null;function Dp(e){var i=gi(e);if(i&&(e=i.stateNode)){var r=e[oe]||null;e:switch(e=i.stateNode,i.type){case"input":if(ru(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),i=r.name,r.type==="radio"&&i!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+si(""+i)+'"][type="radio"]'),i=0;i<r.length;i++){var o=r[i];if(o!==e&&o.form===e.form){var m=o[oe]||null;if(!m)throw Error(a(90));ru(o,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(i=0;i<r.length;i++)o=r[i],o.form===e.form&&Ep(o)}break e;case"textarea":Tp(e,r.value,r.defaultValue);break e;case"select":i=r.value,i!=null&&gr(e,!!r.multiple,i,!1)}}}var uu=!1;function jp(e,i,r){if(uu)return e(i,r);uu=!0;try{var o=e(i);return o}finally{if(uu=!1,(br!==null||Sr!==null)&&(Bl(),br&&(i=br,e=Sr,Sr=br=null,Dp(i),e)))for(i=0;i<e.length;i++)Dp(e[i])}}function Sa(e,i){var r=e.stateNode;if(r===null)return null;var o=r[oe]||null;if(o===null)return null;r=o[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":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(a(231,i,typeof r));return r}var Bi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hu=!1;if(Bi)try{var wa={};Object.defineProperty(wa,"passive",{get:function(){hu=!0}}),window.addEventListener("test",wa,wa),window.removeEventListener("test",wa,wa)}catch{hu=!1}var dn=null,du=null,Ko=null;function Np(){if(Ko)return Ko;var e,i=du,r=i.length,o,m="value"in dn?dn.value:dn.textContent,x=m.length;for(e=0;e<r&&i[e]===m[e];e++);var N=r-e;for(o=1;o<=N&&i[r-o]===m[x-o];o++);return Ko=m.slice(e,1<o?1-o:void 0)}function Jo(e){var i=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&i===13&&(e=13)):e=i,e===10&&(e=13),32<=e||e===13?e:0}function Zo(){return!0}function Lp(){return!1}function Ls(e){function i(r,o,m,x,N){this._reactName=r,this._targetInst=m,this.type=o,this.nativeEvent=x,this.target=N,this.currentTarget=null;for(var H in e)e.hasOwnProperty(H)&&(r=e[H],this[H]=r?r(x):x[H]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Zo:Lp,this.isPropagationStopped=Lp,this}return f(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Zo)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Zo)},persist:function(){},isPersistent:Zo}),i}var $n={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qo=Ls($n),xa=f({},$n,{view:0,detail:0}),O1=Ls(xa),fu,pu,Ca,el=f({},xa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_u,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ca&&(Ca&&e.type==="mousemove"?(fu=e.screenX-Ca.screenX,pu=e.screenY-Ca.screenY):pu=fu=0,Ca=e),fu)},movementY:function(e){return"movementY"in e?e.movementY:pu}}),Op=Ls(el),B1=f({},el,{dataTransfer:0}),H1=Ls(B1),z1=f({},xa,{relatedTarget:0}),vu=Ls(z1),I1=f({},$n,{animationName:0,elapsedTime:0,pseudoElement:0}),$1=Ls(I1),P1=f({},$n,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),U1=Ls(P1),F1=f({},$n,{data:0}),Bp=Ls(F1),q1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W1={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"},G1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function V1(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=G1[e])?!!i[e]:!1}function _u(){return V1}var Y1=f({},xa,{key:function(e){if(e.key){var i=q1[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=Jo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?W1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_u,charCode:function(e){return e.type==="keypress"?Jo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),X1=Ls(Y1),K1=f({},el,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hp=Ls(K1),J1=f({},xa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_u}),Z1=Ls(J1),Q1=f({},$n,{propertyName:0,elapsedTime:0,pseudoElement:0}),eS=Ls(Q1),tS=f({},el,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),sS=Ls(tS),iS=f({},$n,{newState:0,oldState:0}),nS=Ls(iS),rS=[9,13,27,32],mu=Bi&&"CompositionEvent"in window,Ea=null;Bi&&"documentMode"in document&&(Ea=document.documentMode);var aS=Bi&&"TextEvent"in window&&!Ea,zp=Bi&&(!mu||Ea&&8<Ea&&11>=Ea),Ip=" ",$p=!1;function Pp(e,i){switch(e){case"keyup":return rS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Up(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wr=!1;function oS(e,i){switch(e){case"compositionend":return Up(i);case"keypress":return i.which!==32?null:($p=!0,Ip);case"textInput":return e=i.data,e===Ip&&$p?null:e;default:return null}}function lS(e,i){if(wr)return e==="compositionend"||!mu&&Pp(e,i)?(e=Np(),Ko=du=dn=null,wr=!1,e):null;switch(e){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 zp&&i.locale!=="ko"?null:i.data;default:return null}}var cS={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 Fp(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!cS[e.type]:i==="textarea"}function qp(e,i,r,o){br?Sr?Sr.push(o):Sr=[o]:br=o,i=Fl(i,"onChange"),0<i.length&&(r=new Qo("onChange","change",null,r,o),e.push({event:r,listeners:i}))}var ka=null,Ta=null;function uS(e){km(e,0)}function tl(e){var i=ds(e);if(Ep(i))return e}function Wp(e,i){if(e==="change")return i}var Gp=!1;if(Bi){var gu;if(Bi){var yu="oninput"in document;if(!yu){var Vp=document.createElement("div");Vp.setAttribute("oninput","return;"),yu=typeof Vp.oninput=="function"}gu=yu}else gu=!1;Gp=gu&&(!document.documentMode||9<document.documentMode)}function Yp(){ka&&(ka.detachEvent("onpropertychange",Xp),Ta=ka=null)}function Xp(e){if(e.propertyName==="value"&&tl(Ta)){var i=[];qp(i,Ta,e,cu(e)),jp(uS,i)}}function hS(e,i,r){e==="focusin"?(Yp(),ka=i,Ta=r,ka.attachEvent("onpropertychange",Xp)):e==="focusout"&&Yp()}function dS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return tl(Ta)}function fS(e,i){if(e==="click")return tl(i)}function pS(e,i){if(e==="input"||e==="change")return tl(i)}function vS(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var qs=typeof Object.is=="function"?Object.is:vS;function Aa(e,i){if(qs(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var r=Object.keys(e),o=Object.keys(i);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var m=r[o];if(!At.call(i,m)||!qs(e[m],i[m]))return!1}return!0}function Kp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jp(e,i){var r=Kp(e);e=0;for(var o;r;){if(r.nodeType===3){if(o=e+r.textContent.length,e<=i&&o>=i)return{node:r,offset:i-e};e=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kp(r)}}function Zp(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Zp(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function Qp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=Yo(e.document);i instanceof e.HTMLIFrameElement;){try{var r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)e=i.contentWindow;else break;i=Yo(e.document)}return i}function bu(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var _S=Bi&&"documentMode"in document&&11>=document.documentMode,xr=null,Su=null,Ra=null,wu=!1;function ev(e,i,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;wu||xr==null||xr!==Yo(o)||(o=xr,"selectionStart"in o&&bu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Ra&&Aa(Ra,o)||(Ra=o,o=Fl(Su,"onSelect"),0<o.length&&(i=new Qo("onSelect","select",null,i,r),e.push({event:i,listeners:o}),i.target=xr)))}function Pn(e,i){var r={};return r[e.toLowerCase()]=i.toLowerCase(),r["Webkit"+e]="webkit"+i,r["Moz"+e]="moz"+i,r}var Cr={animationend:Pn("Animation","AnimationEnd"),animationiteration:Pn("Animation","AnimationIteration"),animationstart:Pn("Animation","AnimationStart"),transitionrun:Pn("Transition","TransitionRun"),transitionstart:Pn("Transition","TransitionStart"),transitioncancel:Pn("Transition","TransitionCancel"),transitionend:Pn("Transition","TransitionEnd")},xu={},tv={};Bi&&(tv=document.createElement("div").style,"AnimationEvent"in window||(delete Cr.animationend.animation,delete Cr.animationiteration.animation,delete Cr.animationstart.animation),"TransitionEvent"in window||delete Cr.transitionend.transition);function Un(e){if(xu[e])return xu[e];if(!Cr[e])return e;var i=Cr[e],r;for(r in i)if(i.hasOwnProperty(r)&&r in tv)return xu[e]=i[r];return e}var sv=Un("animationend"),iv=Un("animationiteration"),nv=Un("animationstart"),mS=Un("transitionrun"),gS=Un("transitionstart"),yS=Un("transitioncancel"),rv=Un("transitionend"),av=new Map,Cu="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(" ");Cu.push("scrollEnd");function yi(e,i){av.set(e,i),In(i,[e])}var sl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ii=[],Er=0,Eu=0;function il(){for(var e=Er,i=Eu=Er=0;i<e;){var r=ii[i];ii[i++]=null;var o=ii[i];ii[i++]=null;var m=ii[i];ii[i++]=null;var x=ii[i];if(ii[i++]=null,o!==null&&m!==null){var N=o.pending;N===null?m.next=m:(m.next=N.next,N.next=m),o.pending=m}x!==0&&ov(r,m,x)}}function nl(e,i,r,o){ii[Er++]=e,ii[Er++]=i,ii[Er++]=r,ii[Er++]=o,Eu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function ku(e,i,r,o){return nl(e,i,r,o),rl(e)}function Fn(e,i){return nl(e,null,null,i),rl(e)}function ov(e,i,r){e.lanes|=r;var o=e.alternate;o!==null&&(o.lanes|=r);for(var m=!1,x=e.return;x!==null;)x.childLanes|=r,o=x.alternate,o!==null&&(o.childLanes|=r),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(m=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,m&&i!==null&&(m=31-mt(r),e=x.hiddenUpdates,o=e[m],o===null?e[m]=[i]:o.push(i),i.lane=r|536870912),x):null}function rl(e){if(50<Ja)throw Ja=0,Oh=null,Error(a(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var kr={};function bS(e,i,r,o){this.tag=e,this.key=r,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ws(e,i,r,o){return new bS(e,i,r,o)}function Tu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hi(e,i){var r=e.alternate;return r===null?(r=Ws(e.tag,i,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=i,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,i=e.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function lv(e,i){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=i,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,i=r.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function al(e,i,r,o,m,x){var N=0;if(o=e,typeof e=="function")Tu(e)&&(N=1);else if(typeof e=="string")N=Ew(e,r,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case D:return e=Ws(31,r,i,m),e.elementType=D,e.lanes=x,e;case C:return qn(r.children,m,x,i);case b:N=8,m|=24;break;case S:return e=Ws(12,r,i,m|2),e.elementType=S,e.lanes=x,e;case R:return e=Ws(13,r,i,m),e.elementType=R,e.lanes=x,e;case M:return e=Ws(19,r,i,m),e.elementType=M,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case g:N=10;break e;case _:N=9;break e;case T:N=11;break e;case j:N=14;break e;case k:N=16,o=null;break e}N=29,r=Error(a(130,e===null?"null":typeof e,"")),o=null}return i=Ws(N,r,i,m),i.elementType=e,i.type=o,i.lanes=x,i}function qn(e,i,r,o){return e=Ws(7,e,o,i),e.lanes=r,e}function Au(e,i,r){return e=Ws(6,e,null,i),e.lanes=r,e}function cv(e){var i=Ws(18,null,null,0);return i.stateNode=e,i}function Ru(e,i,r){return i=Ws(4,e.children!==null?e.children:[],e.key,i),i.lanes=r,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var uv=new WeakMap;function ni(e,i){if(typeof e=="object"&&e!==null){var r=uv.get(e);return r!==void 0?r:(i={value:e,source:i,stack:dt(i)},uv.set(e,i),i)}return{value:e,source:i,stack:dt(i)}}var Tr=[],Ar=0,ol=null,Ma=0,ri=[],ai=0,fn=null,Ci=1,Ei="";function zi(e,i){Tr[Ar++]=Ma,Tr[Ar++]=ol,ol=e,Ma=i}function hv(e,i,r){ri[ai++]=Ci,ri[ai++]=Ei,ri[ai++]=fn,fn=e;var o=Ci;e=Ei;var m=32-mt(o)-1;o&=~(1<<m),r+=1;var x=32-mt(i)+m;if(30<x){var N=m-m%5;x=(o&(1<<N)-1).toString(32),o>>=N,m-=N,Ci=1<<32-mt(i)+m|r<<m|o,Ei=x+e}else Ci=1<<x|r<<m|o,Ei=e}function Mu(e){e.return!==null&&(zi(e,1),hv(e,1,0))}function Du(e){for(;e===ol;)ol=Tr[--Ar],Tr[Ar]=null,Ma=Tr[--Ar],Tr[Ar]=null;for(;e===fn;)fn=ri[--ai],ri[ai]=null,Ei=ri[--ai],ri[ai]=null,Ci=ri[--ai],ri[ai]=null}function dv(e,i){ri[ai++]=Ci,ri[ai++]=Ei,ri[ai++]=fn,Ci=i.id,Ei=i.overflow,fn=e}var fs=null,Ot=null,lt=!1,pn=null,oi=!1,ju=Error(a(519));function vn(e){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Da(ni(i,e)),ju}function fv(e){var i=e.stateNode,r=e.type,o=e.memoizedProps;switch(i[Me]=e,i[oe]=o,r){case"dialog":it("cancel",i),it("close",i);break;case"iframe":case"object":case"embed":it("load",i);break;case"video":case"audio":for(r=0;r<Qa.length;r++)it(Qa[r],i);break;case"source":it("error",i);break;case"img":case"image":case"link":it("error",i),it("load",i);break;case"details":it("toggle",i);break;case"input":it("invalid",i),kp(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":it("invalid",i);break;case"textarea":it("invalid",i),Ap(i,o.value,o.defaultValue,o.children)}r=o.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||i.textContent===""+r||o.suppressHydrationWarning===!0||Mm(i.textContent,r)?(o.popover!=null&&(it("beforetoggle",i),it("toggle",i)),o.onScroll!=null&&it("scroll",i),o.onScrollEnd!=null&&it("scrollend",i),o.onClick!=null&&(i.onclick=Oi),i=!0):i=!1,i||vn(e,!0)}function pv(e){for(fs=e.return;fs;)switch(fs.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:fs=fs.return}}function Rr(e){if(e!==fs)return!1;if(!lt)return pv(e),lt=!0,!1;var i=e.tag,r;if((r=i!==3&&i!==27)&&((r=i===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Kh(e.type,e.memoizedProps)),r=!r),r&&Ot&&vn(e),pv(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ot=Im(e)}else if(i===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ot=Im(e)}else i===27?(i=Ot,Rn(e.type)?(e=td,td=null,Ot=e):Ot=i):Ot=fs?ci(e.stateNode.nextSibling):null;return!0}function Wn(){Ot=fs=null,lt=!1}function Nu(){var e=pn;return e!==null&&(zs===null?zs=e:zs.push.apply(zs,e),pn=null),e}function Da(e){pn===null?pn=[e]:pn.push(e)}var Lu=L(null),Gn=null,Ii=null;function _n(e,i,r){V(Lu,i._currentValue),i._currentValue=r}function $i(e){e._currentValue=Lu.current,P(Lu)}function Ou(e,i,r){for(;e!==null;){var o=e.alternate;if((e.childLanes&i)!==i?(e.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),e===r)break;e=e.return}}function Bu(e,i,r,o){var m=e.child;for(m!==null&&(m.return=e);m!==null;){var x=m.dependencies;if(x!==null){var N=m.child;x=x.firstContext;e:for(;x!==null;){var H=x;x=m;for(var X=0;X<i.length;X++)if(H.context===i[X]){x.lanes|=r,H=x.alternate,H!==null&&(H.lanes|=r),Ou(x.return,r,e),o||(N=null);break e}x=H.next}}else if(m.tag===18){if(N=m.return,N===null)throw Error(a(341));N.lanes|=r,x=N.alternate,x!==null&&(x.lanes|=r),Ou(N,r,e),N=null}else N=m.child;if(N!==null)N.return=m;else for(N=m;N!==null;){if(N===e){N=null;break}if(m=N.sibling,m!==null){m.return=N.return,N=m;break}N=N.return}m=N}}function Mr(e,i,r,o){e=null;for(var m=i,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var N=m.alternate;if(N===null)throw Error(a(387));if(N=N.memoizedProps,N!==null){var H=m.type;qs(m.pendingProps.value,N.value)||(e!==null?e.push(H):e=[H])}}else if(m===K.current){if(N=m.alternate,N===null)throw Error(a(387));N.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(e!==null?e.push(no):e=[no])}m=m.return}e!==null&&Bu(i,e,r,o),i.flags|=262144}function ll(e){for(e=e.firstContext;e!==null;){if(!qs(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Vn(e){Gn=e,Ii=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ps(e){return vv(Gn,e)}function cl(e,i){return Gn===null&&Vn(e),vv(e,i)}function vv(e,i){var r=i._currentValue;if(i={context:i,memoizedValue:r,next:null},Ii===null){if(e===null)throw Error(a(308));Ii=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else Ii=Ii.next=i;return r}var SS=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(r,o){e.push(o)}};this.abort=function(){i.aborted=!0,e.forEach(function(r){return r()})}},wS=s.unstable_scheduleCallback,xS=s.unstable_NormalPriority,ns={$$typeof:g,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hu(){return{controller:new SS,data:new Map,refCount:0}}function ja(e){e.refCount--,e.refCount===0&&wS(xS,function(){e.controller.abort()})}var Na=null,zu=0,Dr=0,jr=null;function CS(e,i){if(Na===null){var r=Na=[];zu=0,Dr=Ph(),jr={status:"pending",value:void 0,then:function(o){r.push(o)}}}return zu++,i.then(_v,_v),i}function _v(){if(--zu===0&&Na!==null){jr!==null&&(jr.status="fulfilled");var e=Na;Na=null,Dr=0,jr=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function ES(e,i){var r=[],o={status:"pending",value:null,reason:null,then:function(m){r.push(m)}};return e.then(function(){o.status="fulfilled",o.value=i;for(var m=0;m<r.length;m++)(0,r[m])(i)},function(m){for(o.status="rejected",o.reason=m,m=0;m<r.length;m++)(0,r[m])(void 0)}),o}var mv=W.S;W.S=function(e,i){em=ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&CS(e,i),mv!==null&&mv(e,i)};var Yn=L(null);function Iu(){var e=Yn.current;return e!==null?e:Rt.pooledCache}function ul(e,i){i===null?V(Yn,Yn.current):V(Yn,i.pool)}function gv(){var e=Iu();return e===null?null:{parent:ns._currentValue,pool:e}}var Nr=Error(a(460)),$u=Error(a(474)),hl=Error(a(542)),dl={then:function(){}};function yv(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bv(e,i,r){switch(r=e[r],r===void 0?e.push(i):r!==i&&(i.then(Oi,Oi),i=r),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,wv(e),e;default:if(typeof i.status=="string")i.then(Oi,Oi);else{if(e=Rt,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=i,e.status="pending",e.then(function(o){if(i.status==="pending"){var m=i;m.status="fulfilled",m.value=o}},function(o){if(i.status==="pending"){var m=i;m.status="rejected",m.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,wv(e),e}throw Kn=i,Nr}}function Xn(e){try{var i=e._init;return i(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Kn=r,Nr):r}}var Kn=null;function Sv(){if(Kn===null)throw Error(a(459));var e=Kn;return Kn=null,e}function wv(e){if(e===Nr||e===hl)throw Error(a(483))}var Lr=null,La=0;function fl(e){var i=La;return La+=1,Lr===null&&(Lr=[]),bv(Lr,e,i)}function Oa(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function pl(e,i){throw i.$$typeof===w?Error(a(525)):(e=Object.prototype.toString.call(i),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function xv(e){function i(se,Z){if(e){var ne=se.deletions;ne===null?(se.deletions=[Z],se.flags|=16):ne.push(Z)}}function r(se,Z){if(!e)return null;for(;Z!==null;)i(se,Z),Z=Z.sibling;return null}function o(se){for(var Z=new Map;se!==null;)se.key!==null?Z.set(se.key,se):Z.set(se.index,se),se=se.sibling;return Z}function m(se,Z){return se=Hi(se,Z),se.index=0,se.sibling=null,se}function x(se,Z,ne){return se.index=ne,e?(ne=se.alternate,ne!==null?(ne=ne.index,ne<Z?(se.flags|=67108866,Z):ne):(se.flags|=67108866,Z)):(se.flags|=1048576,Z)}function N(se){return e&&se.alternate===null&&(se.flags|=67108866),se}function H(se,Z,ne,ve){return Z===null||Z.tag!==6?(Z=Au(ne,se.mode,ve),Z.return=se,Z):(Z=m(Z,ne),Z.return=se,Z)}function X(se,Z,ne,ve){var $e=ne.type;return $e===C?pe(se,Z,ne.props.children,ve,ne.key):Z!==null&&(Z.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===k&&Xn($e)===Z.type)?(Z=m(Z,ne.props),Oa(Z,ne),Z.return=se,Z):(Z=al(ne.type,ne.key,ne.props,null,se.mode,ve),Oa(Z,ne),Z.return=se,Z)}function re(se,Z,ne,ve){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==ne.containerInfo||Z.stateNode.implementation!==ne.implementation?(Z=Ru(ne,se.mode,ve),Z.return=se,Z):(Z=m(Z,ne.children||[]),Z.return=se,Z)}function pe(se,Z,ne,ve,$e){return Z===null||Z.tag!==7?(Z=qn(ne,se.mode,ve,$e),Z.return=se,Z):(Z=m(Z,ne),Z.return=se,Z)}function ye(se,Z,ne){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=Au(""+Z,se.mode,ne),Z.return=se,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case E:return ne=al(Z.type,Z.key,Z.props,null,se.mode,ne),Oa(ne,Z),ne.return=se,ne;case A:return Z=Ru(Z,se.mode,ne),Z.return=se,Z;case k:return Z=Xn(Z),ye(se,Z,ne)}if(ee(Z)||q(Z))return Z=qn(Z,se.mode,ne,null),Z.return=se,Z;if(typeof Z.then=="function")return ye(se,fl(Z),ne);if(Z.$$typeof===g)return ye(se,cl(se,Z),ne);pl(se,Z)}return null}function ae(se,Z,ne,ve){var $e=Z!==null?Z.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return $e!==null?null:H(se,Z,""+ne,ve);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case E:return ne.key===$e?X(se,Z,ne,ve):null;case A:return ne.key===$e?re(se,Z,ne,ve):null;case k:return ne=Xn(ne),ae(se,Z,ne,ve)}if(ee(ne)||q(ne))return $e!==null?null:pe(se,Z,ne,ve,null);if(typeof ne.then=="function")return ae(se,Z,fl(ne),ve);if(ne.$$typeof===g)return ae(se,Z,cl(se,ne),ve);pl(se,ne)}return null}function he(se,Z,ne,ve,$e){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return se=se.get(ne)||null,H(Z,se,""+ve,$e);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case E:return se=se.get(ve.key===null?ne:ve.key)||null,X(Z,se,ve,$e);case A:return se=se.get(ve.key===null?ne:ve.key)||null,re(Z,se,ve,$e);case k:return ve=Xn(ve),he(se,Z,ne,ve,$e)}if(ee(ve)||q(ve))return se=se.get(ne)||null,pe(Z,se,ve,$e,null);if(typeof ve.then=="function")return he(se,Z,ne,fl(ve),$e);if(ve.$$typeof===g)return he(se,Z,ne,cl(Z,ve),$e);pl(Z,ve)}return null}function Ne(se,Z,ne,ve){for(var $e=null,pt=null,He=Z,Ze=Z=0,at=null;He!==null&&Ze<ne.length;Ze++){He.index>Ze?(at=He,He=null):at=He.sibling;var vt=ae(se,He,ne[Ze],ve);if(vt===null){He===null&&(He=at);break}e&&He&&vt.alternate===null&&i(se,He),Z=x(vt,Z,Ze),pt===null?$e=vt:pt.sibling=vt,pt=vt,He=at}if(Ze===ne.length)return r(se,He),lt&&zi(se,Ze),$e;if(He===null){for(;Ze<ne.length;Ze++)He=ye(se,ne[Ze],ve),He!==null&&(Z=x(He,Z,Ze),pt===null?$e=He:pt.sibling=He,pt=He);return lt&&zi(se,Ze),$e}for(He=o(He);Ze<ne.length;Ze++)at=he(He,se,Ze,ne[Ze],ve),at!==null&&(e&&at.alternate!==null&&He.delete(at.key===null?Ze:at.key),Z=x(at,Z,Ze),pt===null?$e=at:pt.sibling=at,pt=at);return e&&He.forEach(function(Ln){return i(se,Ln)}),lt&&zi(se,Ze),$e}function Pe(se,Z,ne,ve){if(ne==null)throw Error(a(151));for(var $e=null,pt=null,He=Z,Ze=Z=0,at=null,vt=ne.next();He!==null&&!vt.done;Ze++,vt=ne.next()){He.index>Ze?(at=He,He=null):at=He.sibling;var Ln=ae(se,He,vt.value,ve);if(Ln===null){He===null&&(He=at);break}e&&He&&Ln.alternate===null&&i(se,He),Z=x(Ln,Z,Ze),pt===null?$e=Ln:pt.sibling=Ln,pt=Ln,He=at}if(vt.done)return r(se,He),lt&&zi(se,Ze),$e;if(He===null){for(;!vt.done;Ze++,vt=ne.next())vt=ye(se,vt.value,ve),vt!==null&&(Z=x(vt,Z,Ze),pt===null?$e=vt:pt.sibling=vt,pt=vt);return lt&&zi(se,Ze),$e}for(He=o(He);!vt.done;Ze++,vt=ne.next())vt=he(He,se,Ze,vt.value,ve),vt!==null&&(e&&vt.alternate!==null&&He.delete(vt.key===null?Ze:vt.key),Z=x(vt,Z,Ze),pt===null?$e=vt:pt.sibling=vt,pt=vt);return e&&He.forEach(function(Bw){return i(se,Bw)}),lt&&zi(se,Ze),$e}function Ct(se,Z,ne,ve){if(typeof ne=="object"&&ne!==null&&ne.type===C&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case E:e:{for(var $e=ne.key;Z!==null;){if(Z.key===$e){if($e=ne.type,$e===C){if(Z.tag===7){r(se,Z.sibling),ve=m(Z,ne.props.children),ve.return=se,se=ve;break e}}else if(Z.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===k&&Xn($e)===Z.type){r(se,Z.sibling),ve=m(Z,ne.props),Oa(ve,ne),ve.return=se,se=ve;break e}r(se,Z);break}else i(se,Z);Z=Z.sibling}ne.type===C?(ve=qn(ne.props.children,se.mode,ve,ne.key),ve.return=se,se=ve):(ve=al(ne.type,ne.key,ne.props,null,se.mode,ve),Oa(ve,ne),ve.return=se,se=ve)}return N(se);case A:e:{for($e=ne.key;Z!==null;){if(Z.key===$e)if(Z.tag===4&&Z.stateNode.containerInfo===ne.containerInfo&&Z.stateNode.implementation===ne.implementation){r(se,Z.sibling),ve=m(Z,ne.children||[]),ve.return=se,se=ve;break e}else{r(se,Z);break}else i(se,Z);Z=Z.sibling}ve=Ru(ne,se.mode,ve),ve.return=se,se=ve}return N(se);case k:return ne=Xn(ne),Ct(se,Z,ne,ve)}if(ee(ne))return Ne(se,Z,ne,ve);if(q(ne)){if($e=q(ne),typeof $e!="function")throw Error(a(150));return ne=$e.call(ne),Pe(se,Z,ne,ve)}if(typeof ne.then=="function")return Ct(se,Z,fl(ne),ve);if(ne.$$typeof===g)return Ct(se,Z,cl(se,ne),ve);pl(se,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Z!==null&&Z.tag===6?(r(se,Z.sibling),ve=m(Z,ne),ve.return=se,se=ve):(r(se,Z),ve=Au(ne,se.mode,ve),ve.return=se,se=ve),N(se)):r(se,Z)}return function(se,Z,ne,ve){try{La=0;var $e=Ct(se,Z,ne,ve);return Lr=null,$e}catch(He){if(He===Nr||He===hl)throw He;var pt=Ws(29,He,null,se.mode);return pt.lanes=ve,pt.return=se,pt}finally{}}}var Jn=xv(!0),Cv=xv(!1),mn=!1;function Pu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uu(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function gn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yn(e,i,r){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(_t&2)!==0){var m=o.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),o.pending=i,i=rl(e),ov(e,null,r),i}return nl(e,o,i,r),rl(e)}function Ba(e,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var o=i.lanes;o&=e.pendingLanes,r|=o,i.lanes=r,Ke(e,r)}}function Fu(e,i){var r=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var m=null,x=null;if(r=r.firstBaseUpdate,r!==null){do{var N={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};x===null?m=x=N:x=x.next=N,r=r.next}while(r!==null);x===null?m=x=i:x=x.next=i}else m=x=i;r={baseState:o.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:o.shared,callbacks:o.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=i:e.next=i,r.lastBaseUpdate=i}var qu=!1;function Ha(){if(qu){var e=jr;if(e!==null)throw e}}function za(e,i,r,o){qu=!1;var m=e.updateQueue;mn=!1;var x=m.firstBaseUpdate,N=m.lastBaseUpdate,H=m.shared.pending;if(H!==null){m.shared.pending=null;var X=H,re=X.next;X.next=null,N===null?x=re:N.next=re,N=X;var pe=e.alternate;pe!==null&&(pe=pe.updateQueue,H=pe.lastBaseUpdate,H!==N&&(H===null?pe.firstBaseUpdate=re:H.next=re,pe.lastBaseUpdate=X))}if(x!==null){var ye=m.baseState;N=0,pe=re=X=null,H=x;do{var ae=H.lane&-536870913,he=ae!==H.lane;if(he?(rt&ae)===ae:(o&ae)===ae){ae!==0&&ae===Dr&&(qu=!0),pe!==null&&(pe=pe.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Ne=e,Pe=H;ae=i;var Ct=r;switch(Pe.tag){case 1:if(Ne=Pe.payload,typeof Ne=="function"){ye=Ne.call(Ct,ye,ae);break e}ye=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Pe.payload,ae=typeof Ne=="function"?Ne.call(Ct,ye,ae):Ne,ae==null)break e;ye=f({},ye,ae);break e;case 2:mn=!0}}ae=H.callback,ae!==null&&(e.flags|=64,he&&(e.flags|=8192),he=m.callbacks,he===null?m.callbacks=[ae]:he.push(ae))}else he={lane:ae,tag:H.tag,payload:H.payload,callback:H.callback,next:null},pe===null?(re=pe=he,X=ye):pe=pe.next=he,N|=ae;if(H=H.next,H===null){if(H=m.shared.pending,H===null)break;he=H,H=he.next,he.next=null,m.lastBaseUpdate=he,m.shared.pending=null}}while(!0);pe===null&&(X=ye),m.baseState=X,m.firstBaseUpdate=re,m.lastBaseUpdate=pe,x===null&&(m.shared.lanes=0),Cn|=N,e.lanes=N,e.memoizedState=ye}}function Ev(e,i){if(typeof e!="function")throw Error(a(191,e));e.call(i)}function kv(e,i){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Ev(r[e],i)}var Or=L(null),vl=L(0);function Tv(e,i){e=Xi,V(vl,e),V(Or,i),Xi=e|i.baseLanes}function Wu(){V(vl,Xi),V(Or,Or.current)}function Gu(){Xi=vl.current,P(Or),P(vl)}var Gs=L(null),li=null;function bn(e){var i=e.alternate;V(Jt,Jt.current&1),V(Gs,e),li===null&&(i===null||Or.current!==null||i.memoizedState!==null)&&(li=e)}function Vu(e){V(Jt,Jt.current),V(Gs,e),li===null&&(li=e)}function Av(e){e.tag===22?(V(Jt,Jt.current),V(Gs,e),li===null&&(li=e)):Sn()}function Sn(){V(Jt,Jt.current),V(Gs,Gs.current)}function Vs(e){P(Gs),li===e&&(li=null),P(Jt)}var Jt=L(0);function _l(e){for(var i=e;i!==null;){if(i.tag===13){var r=i.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Qh(r)||ed(r)))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===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Pi=0,Je=null,wt=null,rs=null,ml=!1,Br=!1,Zn=!1,gl=0,Ia=0,Hr=null,kS=0;function Gt(){throw Error(a(321))}function Yu(e,i){if(i===null)return!1;for(var r=0;r<i.length&&r<e.length;r++)if(!qs(e[r],i[r]))return!1;return!0}function Xu(e,i,r,o,m,x){return Pi=x,Je=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,W.H=e===null||e.memoizedState===null?h_:uh,Zn=!1,x=r(o,m),Zn=!1,Br&&(x=Mv(i,r,o,m)),Rv(e),x}function Rv(e){W.H=Ua;var i=wt!==null&&wt.next!==null;if(Pi=0,rs=wt=Je=null,ml=!1,Ia=0,Hr=null,i)throw Error(a(300));e===null||as||(e=e.dependencies,e!==null&&ll(e)&&(as=!0))}function Mv(e,i,r,o){Je=e;var m=0;do{if(Br&&(Hr=null),Ia=0,Br=!1,25<=m)throw Error(a(301));if(m+=1,rs=wt=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}W.H=d_,x=i(r,o)}while(Br);return x}function TS(){var e=W.H,i=e.useState()[0];return i=typeof i.then=="function"?$a(i):i,e=e.useState()[0],(wt!==null?wt.memoizedState:null)!==e&&(Je.flags|=1024),i}function Ku(){var e=gl!==0;return gl=0,e}function Ju(e,i,r){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~r}function Zu(e){if(ml){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}ml=!1}Pi=0,rs=wt=Je=null,Br=!1,Ia=gl=0,Hr=null}function Ts(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rs===null?Je.memoizedState=rs=e:rs=rs.next=e,rs}function Zt(){if(wt===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=wt.next;var i=rs===null?Je.memoizedState:rs.next;if(i!==null)rs=i,wt=e;else{if(e===null)throw Je.alternate===null?Error(a(467)):Error(a(310));wt=e,e={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},rs===null?Je.memoizedState=rs=e:rs=rs.next=e}return rs}function yl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $a(e){var i=Ia;return Ia+=1,Hr===null&&(Hr=[]),e=bv(Hr,e,i),i=Je,(rs===null?i.memoizedState:rs.next)===null&&(i=i.alternate,W.H=i===null||i.memoizedState===null?h_:uh),e}function bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $a(e);if(e.$$typeof===g)return ps(e)}throw Error(a(438,String(e)))}function Qu(e){var i=null,r=Je.updateQueue;if(r!==null&&(i=r.memoCache),i==null){var o=Je.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(m){return m.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),r===null&&(r=yl(),Je.updateQueue=r),r.memoCache=i,r=i.data[i.index],r===void 0)for(r=i.data[i.index]=Array(e),o=0;o<e;o++)r[o]=B;return i.index++,r}function Ui(e,i){return typeof i=="function"?i(e):i}function Sl(e){var i=Zt();return eh(i,wt,e)}function eh(e,i,r){var o=e.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=r;var m=e.baseQueue,x=o.pending;if(x!==null){if(m!==null){var N=m.next;m.next=x.next,x.next=N}i.baseQueue=m=x,o.pending=null}if(x=e.baseState,m===null)e.memoizedState=x;else{i=m.next;var H=N=null,X=null,re=i,pe=!1;do{var ye=re.lane&-536870913;if(ye!==re.lane?(rt&ye)===ye:(Pi&ye)===ye){var ae=re.revertLane;if(ae===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ye===Dr&&(pe=!0);else if((Pi&ae)===ae){re=re.next,ae===Dr&&(pe=!0);continue}else ye={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},X===null?(H=X=ye,N=x):X=X.next=ye,Je.lanes|=ae,Cn|=ae;ye=re.action,Zn&&r(x,ye),x=re.hasEagerState?re.eagerState:r(x,ye)}else ae={lane:ye,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},X===null?(H=X=ae,N=x):X=X.next=ae,Je.lanes|=ye,Cn|=ye;re=re.next}while(re!==null&&re!==i);if(X===null?N=x:X.next=H,!qs(x,e.memoizedState)&&(as=!0,pe&&(r=jr,r!==null)))throw r;e.memoizedState=x,e.baseState=N,e.baseQueue=X,o.lastRenderedState=x}return m===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function th(e){var i=Zt(),r=i.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var o=r.dispatch,m=r.pending,x=i.memoizedState;if(m!==null){r.pending=null;var N=m=m.next;do x=e(x,N.action),N=N.next;while(N!==m);qs(x,i.memoizedState)||(as=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),r.lastRenderedState=x}return[x,o]}function Dv(e,i,r){var o=Je,m=Zt(),x=lt;if(x){if(r===void 0)throw Error(a(407));r=r()}else r=i();var N=!qs((wt||m).memoizedState,r);if(N&&(m.memoizedState=r,as=!0),m=m.queue,nh(Lv.bind(null,o,m,e),[e]),m.getSnapshot!==i||N||rs!==null&&rs.memoizedState.tag&1){if(o.flags|=2048,zr(9,{destroy:void 0},Nv.bind(null,o,m,r,i),null),Rt===null)throw Error(a(349));x||(Pi&127)!==0||jv(o,i,r)}return r}function jv(e,i,r){e.flags|=16384,e={getSnapshot:i,value:r},i=Je.updateQueue,i===null?(i=yl(),Je.updateQueue=i,i.stores=[e]):(r=i.stores,r===null?i.stores=[e]:r.push(e))}function Nv(e,i,r,o){i.value=r,i.getSnapshot=o,Ov(i)&&Bv(e)}function Lv(e,i,r){return r(function(){Ov(i)&&Bv(e)})}function Ov(e){var i=e.getSnapshot;e=e.value;try{var r=i();return!qs(e,r)}catch{return!0}}function Bv(e){var i=Fn(e,2);i!==null&&Is(i,e,2)}function sh(e){var i=Ts();if(typeof e=="function"){var r=e;if(e=r(),Zn){Lt(!0);try{r()}finally{Lt(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:e},i}function Hv(e,i,r,o){return e.baseState=r,eh(e,wt,typeof o=="function"?o:Ui)}function AS(e,i,r,o,m){if(Cl(e))throw Error(a(485));if(e=i.action,e!==null){var x={payload:m,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){x.listeners.push(N)}};W.T!==null?r(!0):x.isTransition=!1,o(x),r=i.pending,r===null?(x.next=i.pending=x,zv(i,x)):(x.next=r.next,i.pending=r.next=x)}}function zv(e,i){var r=i.action,o=i.payload,m=e.state;if(i.isTransition){var x=W.T,N={};W.T=N;try{var H=r(m,o),X=W.S;X!==null&&X(N,H),Iv(e,i,H)}catch(re){ih(e,i,re)}finally{x!==null&&N.types!==null&&(x.types=N.types),W.T=x}}else try{x=r(m,o),Iv(e,i,x)}catch(re){ih(e,i,re)}}function Iv(e,i,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){$v(e,i,o)},function(o){return ih(e,i,o)}):$v(e,i,r)}function $v(e,i,r){i.status="fulfilled",i.value=r,Pv(i),e.state=r,i=e.pending,i!==null&&(r=i.next,r===i?e.pending=null:(r=r.next,i.next=r,zv(e,r)))}function ih(e,i,r){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=r,Pv(i),i=i.next;while(i!==o)}e.action=null}function Pv(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function Uv(e,i){return i}function Fv(e,i){if(lt){var r=Rt.formState;if(r!==null){e:{var o=Je;if(lt){if(Ot){t:{for(var m=Ot,x=oi;m.nodeType!==8;){if(!x){m=null;break t}if(m=ci(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Ot=ci(m.nextSibling),o=m.data==="F!";break e}}vn(o)}o=!1}o&&(i=r[0])}}return r=Ts(),r.memoizedState=r.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Uv,lastRenderedState:i},r.queue=o,r=l_.bind(null,Je,o),o.dispatch=r,o=sh(!1),x=ch.bind(null,Je,!1,o.queue),o=Ts(),m={state:i,dispatch:null,action:e,pending:null},o.queue=m,r=AS.bind(null,Je,m,x,r),m.dispatch=r,o.memoizedState=e,[i,r,!1]}function qv(e){var i=Zt();return Wv(i,wt,e)}function Wv(e,i,r){if(i=eh(e,i,Uv)[0],e=Sl(Ui)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=$a(i)}catch(N){throw N===Nr?hl:N}else o=i;i=Zt();var m=i.queue,x=m.dispatch;return r!==i.memoizedState&&(Je.flags|=2048,zr(9,{destroy:void 0},RS.bind(null,m,r),null)),[o,x,e]}function RS(e,i){e.action=i}function Gv(e){var i=Zt(),r=wt;if(r!==null)return Wv(i,r,e);Zt(),i=i.memoizedState,r=Zt();var o=r.queue.dispatch;return r.memoizedState=e,[i,o,!1]}function zr(e,i,r,o){return e={tag:e,create:r,deps:o,inst:i,next:null},i=Je.updateQueue,i===null&&(i=yl(),Je.updateQueue=i),r=i.lastEffect,r===null?i.lastEffect=e.next=e:(o=r.next,r.next=e,e.next=o,i.lastEffect=e),e}function Vv(){return Zt().memoizedState}function wl(e,i,r,o){var m=Ts();Je.flags|=e,m.memoizedState=zr(1|i,{destroy:void 0},r,o===void 0?null:o)}function xl(e,i,r,o){var m=Zt();o=o===void 0?null:o;var x=m.memoizedState.inst;wt!==null&&o!==null&&Yu(o,wt.memoizedState.deps)?m.memoizedState=zr(i,x,r,o):(Je.flags|=e,m.memoizedState=zr(1|i,x,r,o))}function Yv(e,i){wl(8390656,8,e,i)}function nh(e,i){xl(2048,8,e,i)}function MS(e){Je.flags|=4;var i=Je.updateQueue;if(i===null)i=yl(),Je.updateQueue=i,i.events=[e];else{var r=i.events;r===null?i.events=[e]:r.push(e)}}function Xv(e){var i=Zt().memoizedState;return MS({ref:i,nextImpl:e}),function(){if((_t&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Kv(e,i){return xl(4,2,e,i)}function Jv(e,i){return xl(4,4,e,i)}function Zv(e,i){if(typeof i=="function"){e=e();var r=i(e);return function(){typeof r=="function"?r():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function Qv(e,i,r){r=r!=null?r.concat([e]):null,xl(4,4,Zv.bind(null,i,e),r)}function rh(){}function e_(e,i){var r=Zt();i=i===void 0?null:i;var o=r.memoizedState;return i!==null&&Yu(i,o[1])?o[0]:(r.memoizedState=[e,i],e)}function t_(e,i){var r=Zt();i=i===void 0?null:i;var o=r.memoizedState;if(i!==null&&Yu(i,o[1]))return o[0];if(o=e(),Zn){Lt(!0);try{e()}finally{Lt(!1)}}return r.memoizedState=[o,i],o}function ah(e,i,r){return r===void 0||(Pi&1073741824)!==0&&(rt&261930)===0?e.memoizedState=i:(e.memoizedState=r,e=sm(),Je.lanes|=e,Cn|=e,r)}function s_(e,i,r,o){return qs(r,i)?r:Or.current!==null?(e=ah(e,r,o),qs(e,i)||(as=!0),e):(Pi&42)===0||(Pi&1073741824)!==0&&(rt&261930)===0?(as=!0,e.memoizedState=r):(e=sm(),Je.lanes|=e,Cn|=e,i)}function i_(e,i,r,o,m){var x=G.p;G.p=x!==0&&8>x?x:8;var N=W.T,H={};W.T=H,ch(e,!1,i,r);try{var X=m(),re=W.S;if(re!==null&&re(H,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var pe=ES(X,o);Pa(e,i,pe,Ks(e))}else Pa(e,i,o,Ks(e))}catch(ye){Pa(e,i,{then:function(){},status:"rejected",reason:ye},Ks())}finally{G.p=x,N!==null&&H.types!==null&&(N.types=H.types),W.T=N}}function DS(){}function oh(e,i,r,o){if(e.tag!==5)throw Error(a(476));var m=n_(e).queue;i_(e,m,i,Y,r===null?DS:function(){return r_(e),r(o)})}function n_(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:Y},next:null};var r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:r},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function r_(e){var i=n_(e);i.next===null&&(i=e.alternate.memoizedState),Pa(e,i.next.queue,{},Ks())}function lh(){return ps(no)}function a_(){return Zt().memoizedState}function o_(){return Zt().memoizedState}function jS(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var r=Ks();e=gn(r);var o=yn(i,e,r);o!==null&&(Is(o,i,r),Ba(o,i,r)),i={cache:Hu()},e.payload=i;return}i=i.return}}function NS(e,i,r){var o=Ks();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Cl(e)?c_(i,r):(r=ku(e,i,r,o),r!==null&&(Is(r,e,o),u_(r,i,o)))}function l_(e,i,r){var o=Ks();Pa(e,i,r,o)}function Pa(e,i,r,o){var m={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Cl(e))c_(i,m);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var N=i.lastRenderedState,H=x(N,r);if(m.hasEagerState=!0,m.eagerState=H,qs(H,N))return nl(e,i,m,0),Rt===null&&il(),!1}catch{}finally{}if(r=ku(e,i,m,o),r!==null)return Is(r,e,o),u_(r,i,o),!0}return!1}function ch(e,i,r,o){if(o={lane:2,revertLane:Ph(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Cl(e)){if(i)throw Error(a(479))}else i=ku(e,r,o,2),i!==null&&Is(i,e,2)}function Cl(e){var i=e.alternate;return e===Je||i!==null&&i===Je}function c_(e,i){Br=ml=!0;var r=e.pending;r===null?i.next=i:(i.next=r.next,r.next=i),e.pending=i}function u_(e,i,r){if((r&4194048)!==0){var o=i.lanes;o&=e.pendingLanes,r|=o,i.lanes=r,Ke(e,r)}}var Ua={readContext:ps,use:bl,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useLayoutEffect:Gt,useInsertionEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useSyncExternalStore:Gt,useId:Gt,useHostTransitionStatus:Gt,useFormState:Gt,useActionState:Gt,useOptimistic:Gt,useMemoCache:Gt,useCacheRefresh:Gt};Ua.useEffectEvent=Gt;var h_={readContext:ps,use:bl,useCallback:function(e,i){return Ts().memoizedState=[e,i===void 0?null:i],e},useContext:ps,useEffect:Yv,useImperativeHandle:function(e,i,r){r=r!=null?r.concat([e]):null,wl(4194308,4,Zv.bind(null,i,e),r)},useLayoutEffect:function(e,i){return wl(4194308,4,e,i)},useInsertionEffect:function(e,i){wl(4,2,e,i)},useMemo:function(e,i){var r=Ts();i=i===void 0?null:i;var o=e();if(Zn){Lt(!0);try{e()}finally{Lt(!1)}}return r.memoizedState=[o,i],o},useReducer:function(e,i,r){var o=Ts();if(r!==void 0){var m=r(i);if(Zn){Lt(!0);try{r(i)}finally{Lt(!1)}}}else m=i;return o.memoizedState=o.baseState=m,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:m},o.queue=e,e=e.dispatch=NS.bind(null,Je,e),[o.memoizedState,e]},useRef:function(e){var i=Ts();return e={current:e},i.memoizedState=e},useState:function(e){e=sh(e);var i=e.queue,r=l_.bind(null,Je,i);return i.dispatch=r,[e.memoizedState,r]},useDebugValue:rh,useDeferredValue:function(e,i){var r=Ts();return ah(r,e,i)},useTransition:function(){var e=sh(!1);return e=i_.bind(null,Je,e.queue,!0,!1),Ts().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,r){var o=Je,m=Ts();if(lt){if(r===void 0)throw Error(a(407));r=r()}else{if(r=i(),Rt===null)throw Error(a(349));(rt&127)!==0||jv(o,i,r)}m.memoizedState=r;var x={value:r,getSnapshot:i};return m.queue=x,Yv(Lv.bind(null,o,x,e),[e]),o.flags|=2048,zr(9,{destroy:void 0},Nv.bind(null,o,x,r,i),null),r},useId:function(){var e=Ts(),i=Rt.identifierPrefix;if(lt){var r=Ei,o=Ci;r=(o&~(1<<32-mt(o)-1)).toString(32)+r,i="_"+i+"R_"+r,r=gl++,0<r&&(i+="H"+r.toString(32)),i+="_"}else r=kS++,i="_"+i+"r_"+r.toString(32)+"_";return e.memoizedState=i},useHostTransitionStatus:lh,useFormState:Fv,useActionState:Fv,useOptimistic:function(e){var i=Ts();i.memoizedState=i.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=r,i=ch.bind(null,Je,!0,r),r.dispatch=i,[e,i]},useMemoCache:Qu,useCacheRefresh:function(){return Ts().memoizedState=jS.bind(null,Je)},useEffectEvent:function(e){var i=Ts(),r={impl:e};return i.memoizedState=r,function(){if((_t&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},uh={readContext:ps,use:bl,useCallback:e_,useContext:ps,useEffect:nh,useImperativeHandle:Qv,useInsertionEffect:Kv,useLayoutEffect:Jv,useMemo:t_,useReducer:Sl,useRef:Vv,useState:function(){return Sl(Ui)},useDebugValue:rh,useDeferredValue:function(e,i){var r=Zt();return s_(r,wt.memoizedState,e,i)},useTransition:function(){var e=Sl(Ui)[0],i=Zt().memoizedState;return[typeof e=="boolean"?e:$a(e),i]},useSyncExternalStore:Dv,useId:a_,useHostTransitionStatus:lh,useFormState:qv,useActionState:qv,useOptimistic:function(e,i){var r=Zt();return Hv(r,wt,e,i)},useMemoCache:Qu,useCacheRefresh:o_};uh.useEffectEvent=Xv;var d_={readContext:ps,use:bl,useCallback:e_,useContext:ps,useEffect:nh,useImperativeHandle:Qv,useInsertionEffect:Kv,useLayoutEffect:Jv,useMemo:t_,useReducer:th,useRef:Vv,useState:function(){return th(Ui)},useDebugValue:rh,useDeferredValue:function(e,i){var r=Zt();return wt===null?ah(r,e,i):s_(r,wt.memoizedState,e,i)},useTransition:function(){var e=th(Ui)[0],i=Zt().memoizedState;return[typeof e=="boolean"?e:$a(e),i]},useSyncExternalStore:Dv,useId:a_,useHostTransitionStatus:lh,useFormState:Gv,useActionState:Gv,useOptimistic:function(e,i){var r=Zt();return wt!==null?Hv(r,wt,e,i):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Qu,useCacheRefresh:o_};d_.useEffectEvent=Xv;function hh(e,i,r,o){i=e.memoizedState,r=r(o,i),r=r==null?i:f({},i,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var dh={enqueueSetState:function(e,i,r){e=e._reactInternals;var o=Ks(),m=gn(o);m.payload=i,r!=null&&(m.callback=r),i=yn(e,m,o),i!==null&&(Is(i,e,o),Ba(i,e,o))},enqueueReplaceState:function(e,i,r){e=e._reactInternals;var o=Ks(),m=gn(o);m.tag=1,m.payload=i,r!=null&&(m.callback=r),i=yn(e,m,o),i!==null&&(Is(i,e,o),Ba(i,e,o))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var r=Ks(),o=gn(r);o.tag=2,i!=null&&(o.callback=i),i=yn(e,o,r),i!==null&&(Is(i,e,r),Ba(i,e,r))}};function f_(e,i,r,o,m,x,N){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,x,N):i.prototype&&i.prototype.isPureReactComponent?!Aa(r,o)||!Aa(m,x):!0}function p_(e,i,r,o){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(r,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(r,o),i.state!==e&&dh.enqueueReplaceState(i,i.state,null)}function Qn(e,i){var r=i;if("ref"in i){r={};for(var o in i)o!=="ref"&&(r[o]=i[o])}if(e=e.defaultProps){r===i&&(r=f({},r));for(var m in e)r[m]===void 0&&(r[m]=e[m])}return r}function v_(e){sl(e)}function __(e){console.error(e)}function m_(e){sl(e)}function El(e,i){try{var r=e.onUncaughtError;r(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function g_(e,i,r){try{var o=e.onCaughtError;o(r.value,{componentStack:r.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function fh(e,i,r){return r=gn(r),r.tag=3,r.payload={element:null},r.callback=function(){El(e,i)},r}function y_(e){return e=gn(e),e.tag=3,e}function b_(e,i,r,o){var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var x=o.value;e.payload=function(){return m(x)},e.callback=function(){g_(i,r,o)}}var N=r.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(e.callback=function(){g_(i,r,o),typeof m!="function"&&(En===null?En=new Set([this]):En.add(this));var H=o.stack;this.componentDidCatch(o.value,{componentStack:H!==null?H:""})})}function LS(e,i,r,o,m){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=r.alternate,i!==null&&Mr(i,r,m,!0),r=Gs.current,r!==null){switch(r.tag){case 31:case 13:return li===null?Hl():r.alternate===null&&Vt===0&&(Vt=3),r.flags&=-257,r.flags|=65536,r.lanes=m,o===dl?r.flags|=16384:(i=r.updateQueue,i===null?r.updateQueue=new Set([o]):i.add(o),zh(e,o,m)),!1;case 22:return r.flags|=65536,o===dl?r.flags|=16384:(i=r.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},r.updateQueue=i):(r=i.retryQueue,r===null?i.retryQueue=new Set([o]):r.add(o)),zh(e,o,m)),!1}throw Error(a(435,r.tag))}return zh(e,o,m),Hl(),!1}if(lt)return i=Gs.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=m,o!==ju&&(e=Error(a(422),{cause:o}),Da(ni(e,r)))):(o!==ju&&(i=Error(a(423),{cause:o}),Da(ni(i,r))),e=e.current.alternate,e.flags|=65536,m&=-m,e.lanes|=m,o=ni(o,r),m=fh(e.stateNode,o,m),Fu(e,m),Vt!==4&&(Vt=2)),!1;var x=Error(a(520),{cause:o});if(x=ni(x,r),Ka===null?Ka=[x]:Ka.push(x),Vt!==4&&(Vt=2),i===null)return!0;o=ni(o,r),r=i;do{switch(r.tag){case 3:return r.flags|=65536,e=m&-m,r.lanes|=e,e=fh(r.stateNode,o,e),Fu(r,e),!1;case 1:if(i=r.type,x=r.stateNode,(r.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(En===null||!En.has(x))))return r.flags|=65536,m&=-m,r.lanes|=m,m=y_(m),b_(m,e,r,o),Fu(r,m),!1}r=r.return}while(r!==null);return!1}var ph=Error(a(461)),as=!1;function vs(e,i,r,o){i.child=e===null?Cv(i,null,r,o):Jn(i,e.child,r,o)}function S_(e,i,r,o,m){r=r.render;var x=i.ref;if("ref"in o){var N={};for(var H in o)H!=="ref"&&(N[H]=o[H])}else N=o;return Vn(i),o=Xu(e,i,r,N,x,m),H=Ku(),e!==null&&!as?(Ju(e,i,m),Fi(e,i,m)):(lt&&H&&Mu(i),i.flags|=1,vs(e,i,o,m),i.child)}function w_(e,i,r,o,m){if(e===null){var x=r.type;return typeof x=="function"&&!Tu(x)&&x.defaultProps===void 0&&r.compare===null?(i.tag=15,i.type=x,x_(e,i,x,o,m)):(e=al(r.type,null,o,i,i.mode,m),e.ref=i.ref,e.return=i,i.child=e)}if(x=e.child,!wh(e,m)){var N=x.memoizedProps;if(r=r.compare,r=r!==null?r:Aa,r(N,o)&&e.ref===i.ref)return Fi(e,i,m)}return i.flags|=1,e=Hi(x,o),e.ref=i.ref,e.return=i,i.child=e}function x_(e,i,r,o,m){if(e!==null){var x=e.memoizedProps;if(Aa(x,o)&&e.ref===i.ref)if(as=!1,i.pendingProps=o=x,wh(e,m))(e.flags&131072)!==0&&(as=!0);else return i.lanes=e.lanes,Fi(e,i,m)}return vh(e,i,r,o,m)}function C_(e,i,r,o){var m=o.children,x=e!==null?e.memoizedState:null;if(e===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|r:r,e!==null){for(o=i.child=e.child,m=0;o!==null;)m=m|o.lanes|o.childLanes,o=o.sibling;o=m&~x}else o=0,i.child=null;return E_(e,i,x,r,o)}if((r&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&ul(i,x!==null?x.cachePool:null),x!==null?Tv(i,x):Wu(),Av(i);else return o=i.lanes=536870912,E_(e,i,x!==null?x.baseLanes|r:r,r,o)}else x!==null?(ul(i,x.cachePool),Tv(i,x),Sn(),i.memoizedState=null):(e!==null&&ul(i,null),Wu(),Sn());return vs(e,i,m,r),i.child}function Fa(e,i){return e!==null&&e.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function E_(e,i,r,o,m){var x=Iu();return x=x===null?null:{parent:ns._currentValue,pool:x},i.memoizedState={baseLanes:r,cachePool:x},e!==null&&ul(i,null),Wu(),Av(i),e!==null&&Mr(e,i,o,!0),i.childLanes=m,null}function kl(e,i){return i=Al({mode:i.mode,children:i.children},e.mode),i.ref=e.ref,e.child=i,i.return=e,i}function k_(e,i,r){return Jn(i,e.child,null,r),e=kl(i,i.pendingProps),e.flags|=2,Vs(i),i.memoizedState=null,e}function OS(e,i,r){var o=i.pendingProps,m=(i.flags&128)!==0;if(i.flags&=-129,e===null){if(lt){if(o.mode==="hidden")return e=kl(i,o),i.lanes=536870912,Fa(null,e);if(Vu(i),(e=Ot)?(e=zm(e,oi),e=e!==null&&e.data==="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:fn!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=cv(e),r.return=i,i.child=r,fs=i,Ot=null)):e=null,e===null)throw vn(i);return i.lanes=536870912,null}return kl(i,o)}var x=e.memoizedState;if(x!==null){var N=x.dehydrated;if(Vu(i),m)if(i.flags&256)i.flags&=-257,i=k_(e,i,r);else if(i.memoizedState!==null)i.child=e.child,i.flags|=128,i=null;else throw Error(a(558));else if(as||Mr(e,i,r,!1),m=(r&e.childLanes)!==0,as||m){if(o=Rt,o!==null&&(N=tt(o,r),N!==0&&N!==x.retryLane))throw x.retryLane=N,Fn(e,N),Is(o,e,N),ph;Hl(),i=k_(e,i,r)}else e=x.treeContext,Ot=ci(N.nextSibling),fs=i,lt=!0,pn=null,oi=!1,e!==null&&dv(i,e),i=kl(i,o),i.flags|=4096;return i}return e=Hi(e.child,{mode:o.mode,children:o.children}),e.ref=i.ref,i.child=e,e.return=i,e}function Tl(e,i){var r=i.ref;if(r===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(i.flags|=4194816)}}function vh(e,i,r,o,m){return Vn(i),r=Xu(e,i,r,o,void 0,m),o=Ku(),e!==null&&!as?(Ju(e,i,m),Fi(e,i,m)):(lt&&o&&Mu(i),i.flags|=1,vs(e,i,r,m),i.child)}function T_(e,i,r,o,m,x){return Vn(i),i.updateQueue=null,r=Mv(i,o,r,m),Rv(e),o=Ku(),e!==null&&!as?(Ju(e,i,x),Fi(e,i,x)):(lt&&o&&Mu(i),i.flags|=1,vs(e,i,r,x),i.child)}function A_(e,i,r,o,m){if(Vn(i),i.stateNode===null){var x=kr,N=r.contextType;typeof N=="object"&&N!==null&&(x=ps(N)),x=new r(o,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=dh,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=o,x.state=i.memoizedState,x.refs={},Pu(i),N=r.contextType,x.context=typeof N=="object"&&N!==null?ps(N):kr,x.state=i.memoizedState,N=r.getDerivedStateFromProps,typeof N=="function"&&(hh(i,r,N,o),x.state=i.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(N=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),N!==x.state&&dh.enqueueReplaceState(x,x.state,null),za(i,o,x,m),Ha(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(e===null){x=i.stateNode;var H=i.memoizedProps,X=Qn(r,H);x.props=X;var re=x.context,pe=r.contextType;N=kr,typeof pe=="object"&&pe!==null&&(N=ps(pe));var ye=r.getDerivedStateFromProps;pe=typeof ye=="function"||typeof x.getSnapshotBeforeUpdate=="function",H=i.pendingProps!==H,pe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(H||re!==N)&&p_(i,x,o,N),mn=!1;var ae=i.memoizedState;x.state=ae,za(i,o,x,m),Ha(),re=i.memoizedState,H||ae!==re||mn?(typeof ye=="function"&&(hh(i,r,ye,o),re=i.memoizedState),(X=mn||f_(i,r,X,o,ae,re,N))?(pe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=re),x.props=o,x.state=re,x.context=N,o=X):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{x=i.stateNode,Uu(e,i),N=i.memoizedProps,pe=Qn(r,N),x.props=pe,ye=i.pendingProps,ae=x.context,re=r.contextType,X=kr,typeof re=="object"&&re!==null&&(X=ps(re)),H=r.getDerivedStateFromProps,(re=typeof H=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N!==ye||ae!==X)&&p_(i,x,o,X),mn=!1,ae=i.memoizedState,x.state=ae,za(i,o,x,m),Ha();var he=i.memoizedState;N!==ye||ae!==he||mn||e!==null&&e.dependencies!==null&&ll(e.dependencies)?(typeof H=="function"&&(hh(i,r,H,o),he=i.memoizedState),(pe=mn||f_(i,r,pe,o,ae,he,X)||e!==null&&e.dependencies!==null&&ll(e.dependencies))?(re||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(o,he,X),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(o,he,X)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||N===e.memoizedProps&&ae===e.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&ae===e.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=he),x.props=o,x.state=he,x.context=X,o=pe):(typeof x.componentDidUpdate!="function"||N===e.memoizedProps&&ae===e.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&ae===e.memoizedState||(i.flags|=1024),o=!1)}return x=o,Tl(e,i),o=(i.flags&128)!==0,x||o?(x=i.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,e!==null&&o?(i.child=Jn(i,e.child,null,m),i.child=Jn(i,null,r,m)):vs(e,i,r,m),i.memoizedState=x.state,e=i.child):e=Fi(e,i,m),e}function R_(e,i,r,o){return Wn(),i.flags|=256,vs(e,i,r,o),i.child}var _h={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mh(e){return{baseLanes:e,cachePool:gv()}}function gh(e,i,r){return e=e!==null?e.childLanes&~r:0,i&&(e|=Xs),e}function M_(e,i,r){var o=i.pendingProps,m=!1,x=(i.flags&128)!==0,N;if((N=x)||(N=e!==null&&e.memoizedState===null?!1:(Jt.current&2)!==0),N&&(m=!0,i.flags&=-129),N=(i.flags&32)!==0,i.flags&=-33,e===null){if(lt){if(m?bn(i):Sn(),(e=Ot)?(e=zm(e,oi),e=e!==null&&e.data!=="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:fn!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=cv(e),r.return=i,i.child=r,fs=i,Ot=null)):e=null,e===null)throw vn(i);return ed(e)?i.lanes=32:i.lanes=536870912,null}var H=o.children;return o=o.fallback,m?(Sn(),m=i.mode,H=Al({mode:"hidden",children:H},m),o=qn(o,m,r,null),H.return=i,o.return=i,H.sibling=o,i.child=H,o=i.child,o.memoizedState=mh(r),o.childLanes=gh(e,N,r),i.memoizedState=_h,Fa(null,o)):(bn(i),yh(i,H))}var X=e.memoizedState;if(X!==null&&(H=X.dehydrated,H!==null)){if(x)i.flags&256?(bn(i),i.flags&=-257,i=bh(e,i,r)):i.memoizedState!==null?(Sn(),i.child=e.child,i.flags|=128,i=null):(Sn(),H=o.fallback,m=i.mode,o=Al({mode:"visible",children:o.children},m),H=qn(H,m,r,null),H.flags|=2,o.return=i,H.return=i,o.sibling=H,i.child=o,Jn(i,e.child,null,r),o=i.child,o.memoizedState=mh(r),o.childLanes=gh(e,N,r),i.memoizedState=_h,i=Fa(null,o));else if(bn(i),ed(H)){if(N=H.nextSibling&&H.nextSibling.dataset,N)var re=N.dgst;N=re,o=Error(a(419)),o.stack="",o.digest=N,Da({value:o,source:null,stack:null}),i=bh(e,i,r)}else if(as||Mr(e,i,r,!1),N=(r&e.childLanes)!==0,as||N){if(N=Rt,N!==null&&(o=tt(N,r),o!==0&&o!==X.retryLane))throw X.retryLane=o,Fn(e,o),Is(N,e,o),ph;Qh(H)||Hl(),i=bh(e,i,r)}else Qh(H)?(i.flags|=192,i.child=e.child,i=null):(e=X.treeContext,Ot=ci(H.nextSibling),fs=i,lt=!0,pn=null,oi=!1,e!==null&&dv(i,e),i=yh(i,o.children),i.flags|=4096);return i}return m?(Sn(),H=o.fallback,m=i.mode,X=e.child,re=X.sibling,o=Hi(X,{mode:"hidden",children:o.children}),o.subtreeFlags=X.subtreeFlags&65011712,re!==null?H=Hi(re,H):(H=qn(H,m,r,null),H.flags|=2),H.return=i,o.return=i,o.sibling=H,i.child=o,Fa(null,o),o=i.child,H=e.child.memoizedState,H===null?H=mh(r):(m=H.cachePool,m!==null?(X=ns._currentValue,m=m.parent!==X?{parent:X,pool:X}:m):m=gv(),H={baseLanes:H.baseLanes|r,cachePool:m}),o.memoizedState=H,o.childLanes=gh(e,N,r),i.memoizedState=_h,Fa(e.child,o)):(bn(i),r=e.child,e=r.sibling,r=Hi(r,{mode:"visible",children:o.children}),r.return=i,r.sibling=null,e!==null&&(N=i.deletions,N===null?(i.deletions=[e],i.flags|=16):N.push(e)),i.child=r,i.memoizedState=null,r)}function yh(e,i){return i=Al({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function Al(e,i){return e=Ws(22,e,null,i),e.lanes=0,e}function bh(e,i,r){return Jn(i,e.child,null,r),e=yh(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function D_(e,i,r){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i),Ou(e.return,i,r)}function Sh(e,i,r,o,m,x){var N=e.memoizedState;N===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:m,treeForkCount:x}:(N.isBackwards=i,N.rendering=null,N.renderingStartTime=0,N.last=o,N.tail=r,N.tailMode=m,N.treeForkCount=x)}function j_(e,i,r){var o=i.pendingProps,m=o.revealOrder,x=o.tail;o=o.children;var N=Jt.current,H=(N&2)!==0;if(H?(N=N&1|2,i.flags|=128):N&=1,V(Jt,N),vs(e,i,o,r),o=lt?Ma:0,!H&&e!==null&&(e.flags&128)!==0)e:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&D_(e,r,i);else if(e.tag===19)D_(e,r,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break e;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(m){case"forwards":for(r=i.child,m=null;r!==null;)e=r.alternate,e!==null&&_l(e)===null&&(m=r),r=r.sibling;r=m,r===null?(m=i.child,i.child=null):(m=r.sibling,r.sibling=null),Sh(i,!1,m,r,x,o);break;case"backwards":case"unstable_legacy-backwards":for(r=null,m=i.child,i.child=null;m!==null;){if(e=m.alternate,e!==null&&_l(e)===null){i.child=m;break}e=m.sibling,m.sibling=r,r=m,m=e}Sh(i,!0,r,null,x,o);break;case"together":Sh(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Fi(e,i,r){if(e!==null&&(i.dependencies=e.dependencies),Cn|=i.lanes,(r&i.childLanes)===0)if(e!==null){if(Mr(e,i,r,!1),(r&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(a(153));if(i.child!==null){for(e=i.child,r=Hi(e,e.pendingProps),i.child=r,r.return=i;e.sibling!==null;)e=e.sibling,r=r.sibling=Hi(e,e.pendingProps),r.return=i;r.sibling=null}return i.child}function wh(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&ll(e)))}function BS(e,i,r){switch(i.tag){case 3:z(i,i.stateNode.containerInfo),_n(i,ns,e.memoizedState.cache),Wn();break;case 27:case 5:Q(i);break;case 4:z(i,i.stateNode.containerInfo);break;case 10:_n(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Vu(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(bn(i),i.flags|=128,null):(r&i.child.childLanes)!==0?M_(e,i,r):(bn(i),e=Fi(e,i,r),e!==null?e.sibling:null);bn(i);break;case 19:var m=(e.flags&128)!==0;if(o=(r&i.childLanes)!==0,o||(Mr(e,i,r,!1),o=(r&i.childLanes)!==0),m){if(o)return j_(e,i,r);i.flags|=128}if(m=i.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),V(Jt,Jt.current),o)break;return null;case 22:return i.lanes=0,C_(e,i,r,i.pendingProps);case 24:_n(i,ns,e.memoizedState.cache)}return Fi(e,i,r)}function N_(e,i,r){if(e!==null)if(e.memoizedProps!==i.pendingProps)as=!0;else{if(!wh(e,r)&&(i.flags&128)===0)return as=!1,BS(e,i,r);as=(e.flags&131072)!==0}else as=!1,lt&&(i.flags&1048576)!==0&&hv(i,Ma,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(e=Xn(i.elementType),i.type=e,typeof e=="function")Tu(e)?(o=Qn(e,o),i.tag=1,i=A_(null,i,e,o,r)):(i.tag=0,i=vh(null,i,e,o,r));else{if(e!=null){var m=e.$$typeof;if(m===T){i.tag=11,i=S_(null,i,e,o,r);break e}else if(m===j){i.tag=14,i=w_(null,i,e,o,r);break e}}throw i=J(e)||e,Error(a(306,i,""))}}return i;case 0:return vh(e,i,i.type,i.pendingProps,r);case 1:return o=i.type,m=Qn(o,i.pendingProps),A_(e,i,o,m,r);case 3:e:{if(z(i,i.stateNode.containerInfo),e===null)throw Error(a(387));o=i.pendingProps;var x=i.memoizedState;m=x.element,Uu(e,i),za(i,o,null,r);var N=i.memoizedState;if(o=N.cache,_n(i,ns,o),o!==x.cache&&Bu(i,[ns],r,!0),Ha(),o=N.element,x.isDehydrated)if(x={element:o,isDehydrated:!1,cache:N.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=R_(e,i,o,r);break e}else if(o!==m){m=ni(Error(a(424)),i),Da(m),i=R_(e,i,o,r);break e}else{switch(e=i.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ot=ci(e.firstChild),fs=i,lt=!0,pn=null,oi=!0,r=Cv(i,null,o,r),i.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(Wn(),o===m){i=Fi(e,i,r);break e}vs(e,i,o,r)}i=i.child}return i;case 26:return Tl(e,i),e===null?(r=qm(i.type,null,i.pendingProps,null))?i.memoizedState=r:lt||(r=i.type,e=i.pendingProps,o=ql(ge.current).createElement(r),o[Me]=i,o[oe]=e,_s(o,r,e),is(o),i.stateNode=o):i.memoizedState=qm(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return Q(i),e===null&&lt&&(o=i.stateNode=Pm(i.type,i.pendingProps,ge.current),fs=i,oi=!0,m=Ot,Rn(i.type)?(td=m,Ot=ci(o.firstChild)):Ot=m),vs(e,i,i.pendingProps.children,r),Tl(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&lt&&((m=o=Ot)&&(o=dw(o,i.type,i.pendingProps,oi),o!==null?(i.stateNode=o,fs=i,Ot=ci(o.firstChild),oi=!1,m=!0):m=!1),m||vn(i)),Q(i),m=i.type,x=i.pendingProps,N=e!==null?e.memoizedProps:null,o=x.children,Kh(m,x)?o=null:N!==null&&Kh(m,N)&&(i.flags|=32),i.memoizedState!==null&&(m=Xu(e,i,TS,null,null,r),no._currentValue=m),Tl(e,i),vs(e,i,o,r),i.child;case 6:return e===null&&lt&&((e=r=Ot)&&(r=fw(r,i.pendingProps,oi),r!==null?(i.stateNode=r,fs=i,Ot=null,e=!0):e=!1),e||vn(i)),null;case 13:return M_(e,i,r);case 4:return z(i,i.stateNode.containerInfo),o=i.pendingProps,e===null?i.child=Jn(i,null,o,r):vs(e,i,o,r),i.child;case 11:return S_(e,i,i.type,i.pendingProps,r);case 7:return vs(e,i,i.pendingProps,r),i.child;case 8:return vs(e,i,i.pendingProps.children,r),i.child;case 12:return vs(e,i,i.pendingProps.children,r),i.child;case 10:return o=i.pendingProps,_n(i,i.type,o.value),vs(e,i,o.children,r),i.child;case 9:return m=i.type._context,o=i.pendingProps.children,Vn(i),m=ps(m),o=o(m),i.flags|=1,vs(e,i,o,r),i.child;case 14:return w_(e,i,i.type,i.pendingProps,r);case 15:return x_(e,i,i.type,i.pendingProps,r);case 19:return j_(e,i,r);case 31:return OS(e,i,r);case 22:return C_(e,i,r,i.pendingProps);case 24:return Vn(i),o=ps(ns),e===null?(m=Iu(),m===null&&(m=Rt,x=Hu(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=r),m=x),i.memoizedState={parent:o,cache:m},Pu(i),_n(i,ns,m)):((e.lanes&r)!==0&&(Uu(e,i),za(i,null,null,r),Ha()),m=e.memoizedState,x=i.memoizedState,m.parent!==o?(m={parent:o,cache:o},i.memoizedState=m,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=m),_n(i,ns,o)):(o=x.cache,_n(i,ns,o),o!==m.cache&&Bu(i,[ns],r,!0))),vs(e,i,i.pendingProps.children,r),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function qi(e){e.flags|=4}function xh(e,i,r,o,m){if((i=(e.mode&32)!==0)&&(i=!1),i){if(e.flags|=16777216,(m&335544128)===m)if(e.stateNode.complete)e.flags|=8192;else if(am())e.flags|=8192;else throw Kn=dl,$u}else e.flags&=-16777217}function L_(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xm(i))if(am())e.flags|=8192;else throw Kn=dl,$u}function Rl(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?_e():536870912,e.lanes|=i,Ur|=i)}function qa(e,i){if(!lt)switch(e.tailMode){case"hidden":i=e.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Bt(e){var i=e.alternate!==null&&e.alternate.child===e.child,r=0,o=0;if(i)for(var m=e.child;m!==null;)r|=m.lanes|m.childLanes,o|=m.subtreeFlags&65011712,o|=m.flags&65011712,m.return=e,m=m.sibling;else for(m=e.child;m!==null;)r|=m.lanes|m.childLanes,o|=m.subtreeFlags,o|=m.flags,m.return=e,m=m.sibling;return e.subtreeFlags|=o,e.childLanes=r,i}function HS(e,i,r){var o=i.pendingProps;switch(Du(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(i),null;case 1:return Bt(i),null;case 3:return r=i.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),$i(ns),ie(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Rr(i)?qi(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Nu())),Bt(i),null;case 26:var m=i.type,x=i.memoizedState;return e===null?(qi(i),x!==null?(Bt(i),L_(i,x)):(Bt(i),xh(i,m,null,o,r))):x?x!==e.memoizedState?(qi(i),Bt(i),L_(i,x)):(Bt(i),i.flags&=-16777217):(e=e.memoizedProps,e!==o&&qi(i),Bt(i),xh(i,m,e,o,r)),null;case 27:if(we(i),r=ge.current,m=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&qi(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Bt(i),null}e=te.current,Rr(i)?fv(i):(e=Pm(m,o,r),i.stateNode=e,qi(i))}return Bt(i),null;case 5:if(we(i),m=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&qi(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Bt(i),null}if(x=te.current,Rr(i))fv(i);else{var N=ql(ge.current);switch(x){case 1:x=N.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=N.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=N.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=N.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=N.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof o.is=="string"?N.createElement("select",{is:o.is}):N.createElement("select"),o.multiple?x.multiple=!0:o.size&&(x.size=o.size);break;default:x=typeof o.is=="string"?N.createElement(m,{is:o.is}):N.createElement(m)}}x[Me]=i,x[oe]=o;e:for(N=i.child;N!==null;){if(N.tag===5||N.tag===6)x.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===i)break e;for(;N.sibling===null;){if(N.return===null||N.return===i)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}i.stateNode=x;e:switch(_s(x,m,o),m){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&qi(i)}}return Bt(i),xh(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,r),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==o&&qi(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(e=ge.current,Rr(i)){if(e=i.stateNode,r=i.memoizedProps,o=null,m=fs,m!==null)switch(m.tag){case 27:case 5:o=m.memoizedProps}e[Me]=i,e=!!(e.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||Mm(e.nodeValue,r)),e||vn(i,!0)}else e=ql(e).createTextNode(o),e[Me]=i,i.stateNode=e}return Bt(i),null;case 31:if(r=i.memoizedState,e===null||e.memoizedState!==null){if(o=Rr(i),r!==null){if(e===null){if(!o)throw Error(a(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Me]=i}else Wn(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Bt(i),e=!1}else r=Nu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return i.flags&256?(Vs(i),i):(Vs(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Bt(i),null;case 13:if(o=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(m=Rr(i),o!==null&&o.dehydrated!==null){if(e===null){if(!m)throw Error(a(318));if(m=i.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(a(317));m[Me]=i}else Wn(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Bt(i),m=!1}else m=Nu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=m),m=!0;if(!m)return i.flags&256?(Vs(i),i):(Vs(i),null)}return Vs(i),(i.flags&128)!==0?(i.lanes=r,i):(r=o!==null,e=e!==null&&e.memoizedState!==null,r&&(o=i.child,m=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(m=o.alternate.memoizedState.cachePool.pool),x=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(x=o.memoizedState.cachePool.pool),x!==m&&(o.flags|=2048)),r!==e&&r&&(i.child.flags|=8192),Rl(i,i.updateQueue),Bt(i),null);case 4:return ie(),e===null&&Wh(i.stateNode.containerInfo),Bt(i),null;case 10:return $i(i.type),Bt(i),null;case 19:if(P(Jt),o=i.memoizedState,o===null)return Bt(i),null;if(m=(i.flags&128)!==0,x=o.rendering,x===null)if(m)qa(o,!1);else{if(Vt!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(x=_l(e),x!==null){for(i.flags|=128,qa(o,!1),e=x.updateQueue,i.updateQueue=e,Rl(i,e),i.subtreeFlags=0,e=r,r=i.child;r!==null;)lv(r,e),r=r.sibling;return V(Jt,Jt.current&1|2),lt&&zi(i,o.treeForkCount),i.child}e=e.sibling}o.tail!==null&&ut()>Ll&&(i.flags|=128,m=!0,qa(o,!1),i.lanes=4194304)}else{if(!m)if(e=_l(x),e!==null){if(i.flags|=128,m=!0,e=e.updateQueue,i.updateQueue=e,Rl(i,e),qa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!x.alternate&&!lt)return Bt(i),null}else 2*ut()-o.renderingStartTime>Ll&&r!==536870912&&(i.flags|=128,m=!0,qa(o,!1),i.lanes=4194304);o.isBackwards?(x.sibling=i.child,i.child=x):(e=o.last,e!==null?e.sibling=x:i.child=x,o.last=x)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=ut(),e.sibling=null,r=Jt.current,V(Jt,m?r&1|2:r&1),lt&&zi(i,o.treeForkCount),e):(Bt(i),null);case 22:case 23:return Vs(i),Gu(),o=i.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(r&536870912)!==0&&(i.flags&128)===0&&(Bt(i),i.subtreeFlags&6&&(i.flags|=8192)):Bt(i),r=i.updateQueue,r!==null&&Rl(i,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048),e!==null&&P(Yn),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),$i(ns),Bt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function zS(e,i){switch(Du(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return $i(ns),ie(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return we(i),null;case 31:if(i.memoizedState!==null){if(Vs(i),i.alternate===null)throw Error(a(340));Wn()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(Vs(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Wn()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return P(Jt),null;case 4:return ie(),null;case 10:return $i(i.type),null;case 22:case 23:return Vs(i),Gu(),e!==null&&P(Yn),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return $i(ns),null;case 25:return null;default:return null}}function O_(e,i){switch(Du(i),i.tag){case 3:$i(ns),ie();break;case 26:case 27:case 5:we(i);break;case 4:ie();break;case 31:i.memoizedState!==null&&Vs(i);break;case 13:Vs(i);break;case 19:P(Jt);break;case 10:$i(i.type);break;case 22:case 23:Vs(i),Gu(),e!==null&&P(Yn);break;case 24:$i(ns)}}function Wa(e,i){try{var r=i.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var m=o.next;r=m;do{if((r.tag&e)===e){o=void 0;var x=r.create,N=r.inst;o=x(),N.destroy=o}r=r.next}while(r!==m)}}catch(H){bt(i,i.return,H)}}function wn(e,i,r){try{var o=i.updateQueue,m=o!==null?o.lastEffect:null;if(m!==null){var x=m.next;o=x;do{if((o.tag&e)===e){var N=o.inst,H=N.destroy;if(H!==void 0){N.destroy=void 0,m=i;var X=r,re=H;try{re()}catch(pe){bt(m,X,pe)}}}o=o.next}while(o!==x)}}catch(pe){bt(i,i.return,pe)}}function B_(e){var i=e.updateQueue;if(i!==null){var r=e.stateNode;try{kv(i,r)}catch(o){bt(e,e.return,o)}}}function H_(e,i,r){r.props=Qn(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(o){bt(e,i,o)}}function Ga(e,i){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof r=="function"?e.refCleanup=r(o):r.current=o}}catch(m){bt(e,i,m)}}function ki(e,i){var r=e.ref,o=e.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(m){bt(e,i,m)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(m){bt(e,i,m)}else r.current=null}function z_(e){var i=e.type,r=e.memoizedProps,o=e.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(m){bt(e,e.return,m)}}function Ch(e,i,r){try{var o=e.stateNode;aw(o,e.type,r,i),o[oe]=i}catch(m){bt(e,e.return,m)}}function I_(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Rn(e.type)||e.tag===4}function Eh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||I_(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Rn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kh(e,i,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(e),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=Oi));else if(o!==4&&(o===27&&Rn(e.type)&&(r=e.stateNode,i=null),e=e.child,e!==null))for(kh(e,i,r),e=e.sibling;e!==null;)kh(e,i,r),e=e.sibling}function Ml(e,i,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?r.insertBefore(e,i):r.appendChild(e);else if(o!==4&&(o===27&&Rn(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Ml(e,i,r),e=e.sibling;e!==null;)Ml(e,i,r),e=e.sibling}function $_(e){var i=e.stateNode,r=e.memoizedProps;try{for(var o=e.type,m=i.attributes;m.length;)i.removeAttributeNode(m[0]);_s(i,o,r),i[Me]=e,i[oe]=r}catch(x){bt(e,e.return,x)}}var Wi=!1,os=!1,Th=!1,P_=typeof WeakSet=="function"?WeakSet:Set,us=null;function IS(e,i){if(e=e.containerInfo,Yh=Jl,e=Qp(e),bu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var m=o.anchorOffset,x=o.focusNode;o=o.focusOffset;try{r.nodeType,x.nodeType}catch{r=null;break e}var N=0,H=-1,X=-1,re=0,pe=0,ye=e,ae=null;t:for(;;){for(var he;ye!==r||m!==0&&ye.nodeType!==3||(H=N+m),ye!==x||o!==0&&ye.nodeType!==3||(X=N+o),ye.nodeType===3&&(N+=ye.nodeValue.length),(he=ye.firstChild)!==null;)ae=ye,ye=he;for(;;){if(ye===e)break t;if(ae===r&&++re===m&&(H=N),ae===x&&++pe===o&&(X=N),(he=ye.nextSibling)!==null)break;ye=ae,ae=ye.parentNode}ye=he}r=H===-1||X===-1?null:{start:H,end:X}}else r=null}r=r||{start:0,end:0}}else r=null;for(Xh={focusedElem:e,selectionRange:r},Jl=!1,us=i;us!==null;)if(i=us,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,us=e;else for(;us!==null;){switch(i=us,x=i.alternate,e=i.flags,i.tag){case 0:if((e&4)!==0&&(e=i.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)m=e[r],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,r=i,m=x.memoizedProps,x=x.memoizedState,o=r.stateNode;try{var Ne=Qn(r.type,m);e=o.getSnapshotBeforeUpdate(Ne,x),o.__reactInternalSnapshotBeforeUpdate=e}catch(Pe){bt(r,r.return,Pe)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,r=e.nodeType,r===9)Zh(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Zh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=i.sibling,e!==null){e.return=i.return,us=e;break}us=i.return}}function U_(e,i,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:Vi(e,r),o&4&&Wa(5,r);break;case 1:if(Vi(e,r),o&4)if(e=r.stateNode,i===null)try{e.componentDidMount()}catch(N){bt(r,r.return,N)}else{var m=Qn(r.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(m,i,e.__reactInternalSnapshotBeforeUpdate)}catch(N){bt(r,r.return,N)}}o&64&&B_(r),o&512&&Ga(r,r.return);break;case 3:if(Vi(e,r),o&64&&(e=r.updateQueue,e!==null)){if(i=null,r.child!==null)switch(r.child.tag){case 27:case 5:i=r.child.stateNode;break;case 1:i=r.child.stateNode}try{kv(e,i)}catch(N){bt(r,r.return,N)}}break;case 27:i===null&&o&4&&$_(r);case 26:case 5:Vi(e,r),i===null&&o&4&&z_(r),o&512&&Ga(r,r.return);break;case 12:Vi(e,r);break;case 31:Vi(e,r),o&4&&W_(e,r);break;case 13:Vi(e,r),o&4&&G_(e,r),o&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=YS.bind(null,r),pw(e,r))));break;case 22:if(o=r.memoizedState!==null||Wi,!o){i=i!==null&&i.memoizedState!==null||os,m=Wi;var x=os;Wi=o,(os=i)&&!x?Yi(e,r,(r.subtreeFlags&8772)!==0):Vi(e,r),Wi=m,os=x}break;case 30:break;default:Vi(e,r)}}function F_(e){var i=e.alternate;i!==null&&(e.alternate=null,F_(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&ei(i)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Pt=null,Os=!1;function Gi(e,i,r){for(r=r.child;r!==null;)q_(e,i,r),r=r.sibling}function q_(e,i,r){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(Ee,r)}catch{}switch(r.tag){case 26:os||ki(r,i),Gi(e,i,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:os||ki(r,i);var o=Pt,m=Os;Rn(r.type)&&(Pt=r.stateNode,Os=!1),Gi(e,i,r),to(r.stateNode),Pt=o,Os=m;break;case 5:os||ki(r,i);case 6:if(o=Pt,m=Os,Pt=null,Gi(e,i,r),Pt=o,Os=m,Pt!==null)if(Os)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(r.stateNode)}catch(x){bt(r,i,x)}else try{Pt.removeChild(r.stateNode)}catch(x){bt(r,i,x)}break;case 18:Pt!==null&&(Os?(e=Pt,Bm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Kr(e)):Bm(Pt,r.stateNode));break;case 4:o=Pt,m=Os,Pt=r.stateNode.containerInfo,Os=!0,Gi(e,i,r),Pt=o,Os=m;break;case 0:case 11:case 14:case 15:wn(2,r,i),os||wn(4,r,i),Gi(e,i,r);break;case 1:os||(ki(r,i),o=r.stateNode,typeof o.componentWillUnmount=="function"&&H_(r,i,o)),Gi(e,i,r);break;case 21:Gi(e,i,r);break;case 22:os=(o=os)||r.memoizedState!==null,Gi(e,i,r),os=o;break;default:Gi(e,i,r)}}function W_(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Kr(e)}catch(r){bt(i,i.return,r)}}}function G_(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Kr(e)}catch(r){bt(i,i.return,r)}}function $S(e){switch(e.tag){case 31:case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new P_),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new P_),i;default:throw Error(a(435,e.tag))}}function Dl(e,i){var r=$S(e);i.forEach(function(o){if(!r.has(o)){r.add(o);var m=XS.bind(null,e,o);o.then(m,m)}})}function Bs(e,i){var r=i.deletions;if(r!==null)for(var o=0;o<r.length;o++){var m=r[o],x=e,N=i,H=N;e:for(;H!==null;){switch(H.tag){case 27:if(Rn(H.type)){Pt=H.stateNode,Os=!1;break e}break;case 5:Pt=H.stateNode,Os=!1;break e;case 3:case 4:Pt=H.stateNode.containerInfo,Os=!0;break e}H=H.return}if(Pt===null)throw Error(a(160));q_(x,N,m),Pt=null,Os=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)V_(i,e),i=i.sibling}var bi=null;function V_(e,i){var r=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Bs(i,e),Hs(e),o&4&&(wn(3,e,e.return),Wa(3,e),wn(5,e,e.return));break;case 1:Bs(i,e),Hs(e),o&512&&(os||r===null||ki(r,r.return)),o&64&&Wi&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?o:r.concat(o))));break;case 26:var m=bi;if(Bs(i,e),Hs(e),o&512&&(os||r===null||ki(r,r.return)),o&4){var x=r!==null?r.memoizedState:null;if(o=e.memoizedState,r===null)if(o===null)if(e.stateNode===null){e:{o=e.type,r=e.memoizedProps,m=m.ownerDocument||m;t:switch(o){case"title":x=m.getElementsByTagName("title")[0],(!x||x[Fs]||x[Me]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(o),m.head.insertBefore(x,m.querySelector("head > title"))),_s(x,o,r),x[Me]=e,is(x),o=x;break e;case"link":var N=Vm("link","href",m).get(o+(r.href||""));if(N){for(var H=0;H<N.length;H++)if(x=N[H],x.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&x.getAttribute("rel")===(r.rel==null?null:r.rel)&&x.getAttribute("title")===(r.title==null?null:r.title)&&x.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){N.splice(H,1);break t}}x=m.createElement(o),_s(x,o,r),m.head.appendChild(x);break;case"meta":if(N=Vm("meta","content",m).get(o+(r.content||""))){for(H=0;H<N.length;H++)if(x=N[H],x.getAttribute("content")===(r.content==null?null:""+r.content)&&x.getAttribute("name")===(r.name==null?null:r.name)&&x.getAttribute("property")===(r.property==null?null:r.property)&&x.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&x.getAttribute("charset")===(r.charSet==null?null:r.charSet)){N.splice(H,1);break t}}x=m.createElement(o),_s(x,o,r),m.head.appendChild(x);break;default:throw Error(a(468,o))}x[Me]=e,is(x),o=x}e.stateNode=o}else Ym(m,e.type,e.stateNode);else e.stateNode=Gm(m,o,e.memoizedProps);else x!==o?(x===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):x.count--,o===null?Ym(m,e.type,e.stateNode):Gm(m,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Ch(e,e.memoizedProps,r.memoizedProps)}break;case 27:Bs(i,e),Hs(e),o&512&&(os||r===null||ki(r,r.return)),r!==null&&o&4&&Ch(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Bs(i,e),Hs(e),o&512&&(os||r===null||ki(r,r.return)),e.flags&32){m=e.stateNode;try{yr(m,"")}catch(Ne){bt(e,e.return,Ne)}}o&4&&e.stateNode!=null&&(m=e.memoizedProps,Ch(e,m,r!==null?r.memoizedProps:m)),o&1024&&(Th=!0);break;case 6:if(Bs(i,e),Hs(e),o&4){if(e.stateNode===null)throw Error(a(162));o=e.memoizedProps,r=e.stateNode;try{r.nodeValue=o}catch(Ne){bt(e,e.return,Ne)}}break;case 3:if(Vl=null,m=bi,bi=Wl(i.containerInfo),Bs(i,e),bi=m,Hs(e),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Kr(i.containerInfo)}catch(Ne){bt(e,e.return,Ne)}Th&&(Th=!1,Y_(e));break;case 4:o=bi,bi=Wl(e.stateNode.containerInfo),Bs(i,e),Hs(e),bi=o;break;case 12:Bs(i,e),Hs(e);break;case 31:Bs(i,e),Hs(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Dl(e,o)));break;case 13:Bs(i,e),Hs(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Nl=ut()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Dl(e,o)));break;case 22:m=e.memoizedState!==null;var X=r!==null&&r.memoizedState!==null,re=Wi,pe=os;if(Wi=re||m,os=pe||X,Bs(i,e),os=pe,Wi=re,Hs(e),o&8192)e:for(i=e.stateNode,i._visibility=m?i._visibility&-2:i._visibility|1,m&&(r===null||X||Wi||os||er(e)),r=null,i=e;;){if(i.tag===5||i.tag===26){if(r===null){X=r=i;try{if(x=X.stateNode,m)N=x.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{H=X.stateNode;var ye=X.memoizedProps.style,ae=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;H.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Ne){bt(X,X.return,Ne)}}}else if(i.tag===6){if(r===null){X=i;try{X.stateNode.nodeValue=m?"":X.memoizedProps}catch(Ne){bt(X,X.return,Ne)}}}else if(i.tag===18){if(r===null){X=i;try{var he=X.stateNode;m?Hm(he,!0):Hm(X.stateNode,!1)}catch(Ne){bt(X,X.return,Ne)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===e)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break e;for(;i.sibling===null;){if(i.return===null||i.return===e)break e;r===i&&(r=null),i=i.return}r===i&&(r=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=e.updateQueue,o!==null&&(r=o.retryQueue,r!==null&&(o.retryQueue=null,Dl(e,r))));break;case 19:Bs(i,e),Hs(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Dl(e,o)));break;case 30:break;case 21:break;default:Bs(i,e),Hs(e)}}function Hs(e){var i=e.flags;if(i&2){try{for(var r,o=e.return;o!==null;){if(I_(o)){r=o;break}o=o.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var m=r.stateNode,x=Eh(e);Ml(e,x,m);break;case 5:var N=r.stateNode;r.flags&32&&(yr(N,""),r.flags&=-33);var H=Eh(e);Ml(e,H,N);break;case 3:case 4:var X=r.stateNode.containerInfo,re=Eh(e);kh(e,re,X);break;default:throw Error(a(161))}}catch(pe){bt(e,e.return,pe)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function Y_(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;Y_(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),e=e.sibling}}function Vi(e,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)U_(e,i.alternate,i),i=i.sibling}function er(e){for(e=e.child;e!==null;){var i=e;switch(i.tag){case 0:case 11:case 14:case 15:wn(4,i,i.return),er(i);break;case 1:ki(i,i.return);var r=i.stateNode;typeof r.componentWillUnmount=="function"&&H_(i,i.return,r),er(i);break;case 27:to(i.stateNode);case 26:case 5:ki(i,i.return),er(i);break;case 22:i.memoizedState===null&&er(i);break;case 30:er(i);break;default:er(i)}e=e.sibling}}function Yi(e,i,r){for(r=r&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,m=e,x=i,N=x.flags;switch(x.tag){case 0:case 11:case 15:Yi(m,x,r),Wa(4,x);break;case 1:if(Yi(m,x,r),o=x,m=o.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(re){bt(o,o.return,re)}if(o=x,m=o.updateQueue,m!==null){var H=o.stateNode;try{var X=m.shared.hiddenCallbacks;if(X!==null)for(m.shared.hiddenCallbacks=null,m=0;m<X.length;m++)Ev(X[m],H)}catch(re){bt(o,o.return,re)}}r&&N&64&&B_(x),Ga(x,x.return);break;case 27:$_(x);case 26:case 5:Yi(m,x,r),r&&o===null&&N&4&&z_(x),Ga(x,x.return);break;case 12:Yi(m,x,r);break;case 31:Yi(m,x,r),r&&N&4&&W_(m,x);break;case 13:Yi(m,x,r),r&&N&4&&G_(m,x);break;case 22:x.memoizedState===null&&Yi(m,x,r),Ga(x,x.return);break;case 30:break;default:Yi(m,x,r)}i=i.sibling}}function Ah(e,i){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&ja(r))}function Rh(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&ja(e))}function Si(e,i,r,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)X_(e,i,r,o),i=i.sibling}function X_(e,i,r,o){var m=i.flags;switch(i.tag){case 0:case 11:case 15:Si(e,i,r,o),m&2048&&Wa(9,i);break;case 1:Si(e,i,r,o);break;case 3:Si(e,i,r,o),m&2048&&(e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&ja(e)));break;case 12:if(m&2048){Si(e,i,r,o),e=i.stateNode;try{var x=i.memoizedProps,N=x.id,H=x.onPostCommit;typeof H=="function"&&H(N,i.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(X){bt(i,i.return,X)}}else Si(e,i,r,o);break;case 31:Si(e,i,r,o);break;case 13:Si(e,i,r,o);break;case 23:break;case 22:x=i.stateNode,N=i.alternate,i.memoizedState!==null?x._visibility&2?Si(e,i,r,o):Va(e,i):x._visibility&2?Si(e,i,r,o):(x._visibility|=2,Ir(e,i,r,o,(i.subtreeFlags&10256)!==0||!1)),m&2048&&Ah(N,i);break;case 24:Si(e,i,r,o),m&2048&&Rh(i.alternate,i);break;default:Si(e,i,r,o)}}function Ir(e,i,r,o,m){for(m=m&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=e,N=i,H=r,X=o,re=N.flags;switch(N.tag){case 0:case 11:case 15:Ir(x,N,H,X,m),Wa(8,N);break;case 23:break;case 22:var pe=N.stateNode;N.memoizedState!==null?pe._visibility&2?Ir(x,N,H,X,m):Va(x,N):(pe._visibility|=2,Ir(x,N,H,X,m)),m&&re&2048&&Ah(N.alternate,N);break;case 24:Ir(x,N,H,X,m),m&&re&2048&&Rh(N.alternate,N);break;default:Ir(x,N,H,X,m)}i=i.sibling}}function Va(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var r=e,o=i,m=o.flags;switch(o.tag){case 22:Va(r,o),m&2048&&Ah(o.alternate,o);break;case 24:Va(r,o),m&2048&&Rh(o.alternate,o);break;default:Va(r,o)}i=i.sibling}}var Ya=8192;function $r(e,i,r){if(e.subtreeFlags&Ya)for(e=e.child;e!==null;)K_(e,i,r),e=e.sibling}function K_(e,i,r){switch(e.tag){case 26:$r(e,i,r),e.flags&Ya&&e.memoizedState!==null&&kw(r,bi,e.memoizedState,e.memoizedProps);break;case 5:$r(e,i,r);break;case 3:case 4:var o=bi;bi=Wl(e.stateNode.containerInfo),$r(e,i,r),bi=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Ya,Ya=16777216,$r(e,i,r),Ya=o):$r(e,i,r));break;default:$r(e,i,r)}}function J_(e){var i=e.alternate;if(i!==null&&(e=i.child,e!==null)){i.child=null;do i=e.sibling,e.sibling=null,e=i;while(e!==null)}}function Xa(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var o=i[r];us=o,Q_(o,e)}J_(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Z_(e),e=e.sibling}function Z_(e){switch(e.tag){case 0:case 11:case 15:Xa(e),e.flags&2048&&wn(9,e,e.return);break;case 3:Xa(e);break;case 12:Xa(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,jl(e)):Xa(e);break;default:Xa(e)}}function jl(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var o=i[r];us=o,Q_(o,e)}J_(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:wn(8,i,i.return),jl(i);break;case 22:r=i.stateNode,r._visibility&2&&(r._visibility&=-3,jl(i));break;default:jl(i)}e=e.sibling}}function Q_(e,i){for(;us!==null;){var r=us;switch(r.tag){case 0:case 11:case 15:wn(8,r,i);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var o=r.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ja(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,us=o;else e:for(r=e;us!==null;){o=us;var m=o.sibling,x=o.return;if(F_(o),o===r){us=null;break e}if(m!==null){m.return=x,us=m;break e}us=x}}}var PS={getCacheForType:function(e){var i=ps(ns),r=i.data.get(e);return r===void 0&&(r=e(),i.data.set(e,r)),r},cacheSignal:function(){return ps(ns).controller.signal}},US=typeof WeakMap=="function"?WeakMap:Map,_t=0,Rt=null,st=null,rt=0,yt=0,Ys=null,xn=!1,Pr=!1,Mh=!1,Xi=0,Vt=0,Cn=0,tr=0,Dh=0,Xs=0,Ur=0,Ka=null,zs=null,jh=!1,Nl=0,em=0,Ll=1/0,Ol=null,En=null,cs=0,kn=null,Fr=null,Ki=0,Nh=0,Lh=null,tm=null,Ja=0,Oh=null;function Ks(){return(_t&2)!==0&&rt!==0?rt&-rt:W.T!==null?Ph():hs()}function sm(){if(Xs===0)if((rt&536870912)===0||lt){var e=js;js<<=1,(js&3932160)===0&&(js=262144),Xs=e}else Xs=536870912;return e=Gs.current,e!==null&&(e.flags|=32),Xs}function Is(e,i,r){(e===Rt&&(yt===2||yt===9)||e.cancelPendingCommit!==null)&&(qr(e,0),Tn(e,rt,Xs,!1)),Se(e,r),((_t&2)===0||e!==Rt)&&(e===Rt&&((_t&2)===0&&(tr|=r),Vt===4&&Tn(e,rt,Xs,!1)),Ti(e))}function im(e,i,r){if((_t&6)!==0)throw Error(a(327));var o=!r&&(i&127)===0&&(i&e.expiredLanes)===0||Ns(e,i),m=o?WS(e,i):Hh(e,i,!0),x=o;do{if(m===0){Pr&&!o&&Tn(e,i,0,!1);break}else{if(r=e.current.alternate,x&&!FS(r)){m=Hh(e,i,!1),x=!1;continue}if(m===2){if(x=i,e.errorRecoveryDisabledLanes&x)var N=0;else N=e.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){i=N;e:{var H=e;m=Ka;var X=H.current.memoizedState.isDehydrated;if(X&&(qr(H,N).flags|=256),N=Hh(H,N,!1),N!==2){if(Mh&&!X){H.errorRecoveryDisabledLanes|=x,tr|=x,m=4;break e}x=zs,zs=m,x!==null&&(zs===null?zs=x:zs.push.apply(zs,x))}m=N}if(x=!1,m!==2)continue}}if(m===1){qr(e,0),Tn(e,i,0,!0);break}e:{switch(o=e,x=m,x){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Tn(o,i,Xs,!xn);break e;case 2:zs=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(m=Nl+300-ut(),10<m)){if(Tn(o,i,Xs,!xn),bs(o,0,!0)!==0)break e;Ki=i,o.timeoutHandle=Lm(nm.bind(null,o,r,zs,Ol,jh,i,Xs,tr,Ur,xn,x,"Throttled",-0,0),m);break e}nm(o,r,zs,Ol,jh,i,Xs,tr,Ur,xn,x,null,-0,0)}}break}while(!0);Ti(e)}function nm(e,i,r,o,m,x,N,H,X,re,pe,ye,ae,he){if(e.timeoutHandle=-1,ye=i.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Oi},K_(i,x,ye);var Ne=(x&62914560)===x?Nl-ut():(x&4194048)===x?em-ut():0;if(Ne=Tw(ye,Ne),Ne!==null){Ki=x,e.cancelPendingCommit=Ne(dm.bind(null,e,i,x,r,o,m,N,H,X,pe,ye,null,ae,he)),Tn(e,x,N,!re);return}}dm(e,i,x,r,o,m,N,H,X)}function FS(e){for(var i=e;;){var r=i.tag;if((r===0||r===11||r===15)&&i.flags&16384&&(r=i.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var o=0;o<r.length;o++){var m=r[o],x=m.getSnapshot;m=m.value;try{if(!qs(x(),m))return!1}catch{return!1}}if(r=i.child,i.subtreeFlags&16384&&r!==null)r.return=i,i=r;else{if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Tn(e,i,r,o){i&=~Dh,i&=~tr,e.suspendedLanes|=i,e.pingedLanes&=~i,o&&(e.warmLanes|=i),o=e.expirationTimes;for(var m=i;0<m;){var x=31-mt(m),N=1<<x;o[x]=-1,m&=~N}r!==0&&et(e,r,i)}function Bl(){return(_t&6)===0?(Za(0),!1):!0}function Bh(){if(st!==null){if(yt===0)var e=st.return;else e=st,Ii=Gn=null,Zu(e),Lr=null,La=0,e=st;for(;e!==null;)O_(e.alternate,e),e=e.return;st=null}}function qr(e,i){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,cw(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),Ki=0,Bh(),Rt=e,st=r=Hi(e.current,null),rt=i,yt=0,Ys=null,xn=!1,Pr=Ns(e,i),Mh=!1,Ur=Xs=Dh=tr=Cn=Vt=0,zs=Ka=null,jh=!1,(i&8)!==0&&(i|=i&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=i;0<o;){var m=31-mt(o),x=1<<m;i|=e[m],o&=~x}return Xi=i,il(),r}function rm(e,i){Je=null,W.H=Ua,i===Nr||i===hl?(i=Sv(),yt=3):i===$u?(i=Sv(),yt=4):yt=i===ph?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Ys=i,st===null&&(Vt=1,El(e,ni(i,e.current)))}function am(){var e=Gs.current;return e===null?!0:(rt&4194048)===rt?li===null:(rt&62914560)===rt||(rt&536870912)!==0?e===li:!1}function om(){var e=W.H;return W.H=Ua,e===null?Ua:e}function lm(){var e=W.A;return W.A=PS,e}function Hl(){Vt=4,xn||(rt&4194048)!==rt&&Gs.current!==null||(Pr=!0),(Cn&134217727)===0&&(tr&134217727)===0||Rt===null||Tn(Rt,rt,Xs,!1)}function Hh(e,i,r){var o=_t;_t|=2;var m=om(),x=lm();(Rt!==e||rt!==i)&&(Ol=null,qr(e,i)),i=!1;var N=Vt;e:do try{if(yt!==0&&st!==null){var H=st,X=Ys;switch(yt){case 8:Bh(),N=6;break e;case 3:case 2:case 9:case 6:Gs.current===null&&(i=!0);var re=yt;if(yt=0,Ys=null,Wr(e,H,X,re),r&&Pr){N=0;break e}break;default:re=yt,yt=0,Ys=null,Wr(e,H,X,re)}}qS(),N=Vt;break}catch(pe){rm(e,pe)}while(!0);return i&&e.shellSuspendCounter++,Ii=Gn=null,_t=o,W.H=m,W.A=x,st===null&&(Rt=null,rt=0,il()),N}function qS(){for(;st!==null;)cm(st)}function WS(e,i){var r=_t;_t|=2;var o=om(),m=lm();Rt!==e||rt!==i?(Ol=null,Ll=ut()+500,qr(e,i)):Pr=Ns(e,i);e:do try{if(yt!==0&&st!==null){i=st;var x=Ys;t:switch(yt){case 1:yt=0,Ys=null,Wr(e,i,x,1);break;case 2:case 9:if(yv(x)){yt=0,Ys=null,um(i);break}i=function(){yt!==2&&yt!==9||Rt!==e||(yt=7),Ti(e)},x.then(i,i);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:yv(x)?(yt=0,Ys=null,um(i)):(yt=0,Ys=null,Wr(e,i,x,7));break;case 5:var N=null;switch(st.tag){case 26:N=st.memoizedState;case 5:case 27:var H=st;if(N?Xm(N):H.stateNode.complete){yt=0,Ys=null;var X=H.sibling;if(X!==null)st=X;else{var re=H.return;re!==null?(st=re,zl(re)):st=null}break t}}yt=0,Ys=null,Wr(e,i,x,5);break;case 6:yt=0,Ys=null,Wr(e,i,x,6);break;case 8:Bh(),Vt=6;break e;default:throw Error(a(462))}}GS();break}catch(pe){rm(e,pe)}while(!0);return Ii=Gn=null,W.H=o,W.A=m,_t=r,st!==null?0:(Rt=null,rt=0,il(),Vt)}function GS(){for(;st!==null&&!Nt();)cm(st)}function cm(e){var i=N_(e.alternate,e,Xi);e.memoizedProps=e.pendingProps,i===null?zl(e):st=i}function um(e){var i=e,r=i.alternate;switch(i.tag){case 15:case 0:i=T_(r,i,i.pendingProps,i.type,void 0,rt);break;case 11:i=T_(r,i,i.pendingProps,i.type.render,i.ref,rt);break;case 5:Zu(i);default:O_(r,i),i=st=lv(i,Xi),i=N_(r,i,Xi)}e.memoizedProps=e.pendingProps,i===null?zl(e):st=i}function Wr(e,i,r,o){Ii=Gn=null,Zu(i),Lr=null,La=0;var m=i.return;try{if(LS(e,m,i,r,rt)){Vt=1,El(e,ni(r,e.current)),st=null;return}}catch(x){if(m!==null)throw st=m,x;Vt=1,El(e,ni(r,e.current)),st=null;return}i.flags&32768?(lt||o===1?e=!0:Pr||(rt&536870912)!==0?e=!1:(xn=e=!0,(o===2||o===9||o===3||o===6)&&(o=Gs.current,o!==null&&o.tag===13&&(o.flags|=16384))),hm(i,e)):zl(i)}function zl(e){var i=e;do{if((i.flags&32768)!==0){hm(i,xn);return}e=i.return;var r=HS(i.alternate,i,Xi);if(r!==null){st=r;return}if(i=i.sibling,i!==null){st=i;return}st=i=e}while(i!==null);Vt===0&&(Vt=5)}function hm(e,i){do{var r=zS(e.alternate,e);if(r!==null){r.flags&=32767,st=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!i&&(e=e.sibling,e!==null)){st=e;return}st=e=r}while(e!==null);Vt=6,st=null}function dm(e,i,r,o,m,x,N,H,X){e.cancelPendingCommit=null;do Il();while(cs!==0);if((_t&6)!==0)throw Error(a(327));if(i!==null){if(i===e.current)throw Error(a(177));if(x=i.lanes|i.childLanes,x|=Eu,Oe(e,r,x,N,H,X),e===Rt&&(st=Rt=null,rt=0),Fr=i,kn=e,Ki=r,Nh=x,Lh=m,tm=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,KS(ot,function(){return mm(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=W.T,W.T=null,m=G.p,G.p=2,N=_t,_t|=4;try{IS(e,i,r)}finally{_t=N,G.p=m,W.T=o}}cs=1,fm(),pm(),vm()}}function fm(){if(cs===1){cs=0;var e=kn,i=Fr,r=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||r){r=W.T,W.T=null;var o=G.p;G.p=2;var m=_t;_t|=4;try{V_(i,e);var x=Xh,N=Qp(e.containerInfo),H=x.focusedElem,X=x.selectionRange;if(N!==H&&H&&H.ownerDocument&&Zp(H.ownerDocument.documentElement,H)){if(X!==null&&bu(H)){var re=X.start,pe=X.end;if(pe===void 0&&(pe=re),"selectionStart"in H)H.selectionStart=re,H.selectionEnd=Math.min(pe,H.value.length);else{var ye=H.ownerDocument||document,ae=ye&&ye.defaultView||window;if(ae.getSelection){var he=ae.getSelection(),Ne=H.textContent.length,Pe=Math.min(X.start,Ne),Ct=X.end===void 0?Pe:Math.min(X.end,Ne);!he.extend&&Pe>Ct&&(N=Ct,Ct=Pe,Pe=N);var se=Jp(H,Pe),Z=Jp(H,Ct);if(se&&Z&&(he.rangeCount!==1||he.anchorNode!==se.node||he.anchorOffset!==se.offset||he.focusNode!==Z.node||he.focusOffset!==Z.offset)){var ne=ye.createRange();ne.setStart(se.node,se.offset),he.removeAllRanges(),Pe>Ct?(he.addRange(ne),he.extend(Z.node,Z.offset)):(ne.setEnd(Z.node,Z.offset),he.addRange(ne))}}}}for(ye=[],he=H;he=he.parentNode;)he.nodeType===1&&ye.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<ye.length;H++){var ve=ye[H];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Jl=!!Yh,Xh=Yh=null}finally{_t=m,G.p=o,W.T=r}}e.current=i,cs=2}}function pm(){if(cs===2){cs=0;var e=kn,i=Fr,r=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||r){r=W.T,W.T=null;var o=G.p;G.p=2;var m=_t;_t|=4;try{U_(e,i.alternate,i)}finally{_t=m,G.p=o,W.T=r}}cs=3}}function vm(){if(cs===4||cs===3){cs=0,ct();var e=kn,i=Fr,r=Ki,o=tm;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?cs=5:(cs=0,Fr=kn=null,_m(e,e.pendingLanes));var m=e.pendingLanes;if(m===0&&(En=null),Es(r),i=i.stateNode,Ue&&typeof Ue.onCommitFiberRoot=="function")try{Ue.onCommitFiberRoot(Ee,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=W.T,m=G.p,G.p=2,W.T=null;try{for(var x=e.onRecoverableError,N=0;N<o.length;N++){var H=o[N];x(H.value,{componentStack:H.stack})}}finally{W.T=i,G.p=m}}(Ki&3)!==0&&Il(),Ti(e),m=e.pendingLanes,(r&261930)!==0&&(m&42)!==0?e===Oh?Ja++:(Ja=0,Oh=e):Ja=0,Za(0)}}function _m(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,ja(i)))}function Il(){return fm(),pm(),vm(),mm()}function mm(){if(cs!==5)return!1;var e=kn,i=Nh;Nh=0;var r=Es(Ki),o=W.T,m=G.p;try{G.p=32>r?32:r,W.T=null,r=Lh,Lh=null;var x=kn,N=Ki;if(cs=0,Fr=kn=null,Ki=0,(_t&6)!==0)throw Error(a(331));var H=_t;if(_t|=4,Z_(x.current),X_(x,x.current,N,r),_t=H,Za(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot=="function")try{Ue.onPostCommitFiberRoot(Ee,x)}catch{}return!0}finally{G.p=m,W.T=o,_m(e,i)}}function gm(e,i,r){i=ni(r,i),i=fh(e.stateNode,i,2),e=yn(e,i,2),e!==null&&(Se(e,2),Ti(e))}function bt(e,i,r){if(e.tag===3)gm(e,e,r);else for(;i!==null;){if(i.tag===3){gm(i,e,r);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(En===null||!En.has(o))){e=ni(r,e),r=y_(2),o=yn(i,r,2),o!==null&&(b_(r,o,i,e),Se(o,2),Ti(o));break}}i=i.return}}function zh(e,i,r){var o=e.pingCache;if(o===null){o=e.pingCache=new US;var m=new Set;o.set(i,m)}else m=o.get(i),m===void 0&&(m=new Set,o.set(i,m));m.has(r)||(Mh=!0,m.add(r),e=VS.bind(null,e,i,r),i.then(e,e))}function VS(e,i,r){var o=e.pingCache;o!==null&&o.delete(i),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Rt===e&&(rt&r)===r&&(Vt===4||Vt===3&&(rt&62914560)===rt&&300>ut()-Nl?(_t&2)===0&&qr(e,0):Dh|=r,Ur===rt&&(Ur=0)),Ti(e)}function ym(e,i){i===0&&(i=_e()),e=Fn(e,i),e!==null&&(Se(e,i),Ti(e))}function YS(e){var i=e.memoizedState,r=0;i!==null&&(r=i.retryLane),ym(e,r)}function XS(e,i){var r=0;switch(e.tag){case 31:case 13:var o=e.stateNode,m=e.memoizedState;m!==null&&(r=m.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),ym(e,r)}function KS(e,i){return qt(e,i)}var $l=null,Gr=null,Ih=!1,Pl=!1,$h=!1,An=0;function Ti(e){e!==Gr&&e.next===null&&(Gr===null?$l=Gr=e:Gr=Gr.next=e),Pl=!0,Ih||(Ih=!0,ZS())}function Za(e,i){if(!$h&&Pl){$h=!0;do for(var r=!1,o=$l;o!==null;){if(e!==0){var m=o.pendingLanes;if(m===0)var x=0;else{var N=o.suspendedLanes,H=o.pingedLanes;x=(1<<31-mt(42|e)+1)-1,x&=m&~(N&~H),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(r=!0,xm(o,x))}else x=rt,x=bs(o,o===Rt?x:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(x&3)===0||Ns(o,x)||(r=!0,xm(o,x));o=o.next}while(r);$h=!1}}function JS(){bm()}function bm(){Pl=Ih=!1;var e=0;An!==0&&lw()&&(e=An);for(var i=ut(),r=null,o=$l;o!==null;){var m=o.next,x=Sm(o,i);x===0?(o.next=null,r===null?$l=m:r.next=m,m===null&&(Gr=r)):(r=o,(e!==0||(x&3)!==0)&&(Pl=!0)),o=m}cs!==0&&cs!==5||Za(e),An!==0&&(An=0)}function Sm(e,i){for(var r=e.suspendedLanes,o=e.pingedLanes,m=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var N=31-mt(x),H=1<<N,X=m[N];X===-1?((H&r)===0||(H&o)!==0)&&(m[N]=le(H,i)):X<=i&&(e.expiredLanes|=H),x&=~H}if(i=Rt,r=rt,r=bs(e,e===i?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,r===0||e===i&&(yt===2||yt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&jt(o),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Ns(e,r)){if(i=r&-r,i===e.callbackPriority)return i;switch(o!==null&&jt(o),Es(r)){case 2:case 8:r=ts;break;case 32:r=ot;break;case 268435456:r=Wt;break;default:r=ot}return o=wm.bind(null,e),r=qt(r,o),e.callbackPriority=i,e.callbackNode=r,i}return o!==null&&o!==null&&jt(o),e.callbackPriority=2,e.callbackNode=null,2}function wm(e,i){if(cs!==0&&cs!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(Il()&&e.callbackNode!==r)return null;var o=rt;return o=bs(e,e===Rt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(im(e,o,i),Sm(e,ut()),e.callbackNode!=null&&e.callbackNode===r?wm.bind(null,e):null)}function xm(e,i){if(Il())return null;im(e,i,!0)}function ZS(){uw(function(){(_t&6)!==0?qt(Yt,JS):bm()})}function Ph(){if(An===0){var e=Dr;e===0&&(e=Us,Us<<=1,(Us&261888)===0&&(Us=256)),An=e}return An}function Cm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Xo(""+e)}function Em(e,i){var r=i.ownerDocument.createElement("input");return r.name=i.name,r.value=i.value,e.id&&r.setAttribute("form",e.id),i.parentNode.insertBefore(r,i),e=new FormData(e),r.parentNode.removeChild(r),e}function QS(e,i,r,o,m){if(i==="submit"&&r&&r.stateNode===m){var x=Cm((m[oe]||null).action),N=o.submitter;N&&(i=(i=N[oe]||null)?Cm(i.formAction):N.getAttribute("formAction"),i!==null&&(x=i,N=null));var H=new Qo("action","action",null,o,m);e.push({event:H,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(An!==0){var X=N?Em(m,N):new FormData(m);oh(r,{pending:!0,data:X,method:m.method,action:x},null,X)}}else typeof x=="function"&&(H.preventDefault(),X=N?Em(m,N):new FormData(m),oh(r,{pending:!0,data:X,method:m.method,action:x},x,X))},currentTarget:m}]})}}for(var Uh=0;Uh<Cu.length;Uh++){var Fh=Cu[Uh],ew=Fh.toLowerCase(),tw=Fh[0].toUpperCase()+Fh.slice(1);yi(ew,"on"+tw)}yi(sv,"onAnimationEnd"),yi(iv,"onAnimationIteration"),yi(nv,"onAnimationStart"),yi("dblclick","onDoubleClick"),yi("focusin","onFocus"),yi("focusout","onBlur"),yi(mS,"onTransitionRun"),yi(gS,"onTransitionStart"),yi(yS,"onTransitionCancel"),yi(rv,"onTransitionEnd"),mr("onMouseEnter",["mouseout","mouseover"]),mr("onMouseLeave",["mouseout","mouseover"]),mr("onPointerEnter",["pointerout","pointerover"]),mr("onPointerLeave",["pointerout","pointerover"]),In("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),In("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),In("onBeforeInput",["compositionend","keypress","textInput","paste"]),In("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),In("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),In("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),sw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qa));function km(e,i){i=(i&4)!==0;for(var r=0;r<e.length;r++){var o=e[r],m=o.event;o=o.listeners;e:{var x=void 0;if(i)for(var N=o.length-1;0<=N;N--){var H=o[N],X=H.instance,re=H.currentTarget;if(H=H.listener,X!==x&&m.isPropagationStopped())break e;x=H,m.currentTarget=re;try{x(m)}catch(pe){sl(pe)}m.currentTarget=null,x=X}else for(N=0;N<o.length;N++){if(H=o[N],X=H.instance,re=H.currentTarget,H=H.listener,X!==x&&m.isPropagationStopped())break e;x=H,m.currentTarget=re;try{x(m)}catch(pe){sl(pe)}m.currentTarget=null,x=X}}}}function it(e,i){var r=i[je];r===void 0&&(r=i[je]=new Set);var o=e+"__bubble";r.has(o)||(Tm(i,e,2,!1),r.add(o))}function qh(e,i,r){var o=0;i&&(o|=4),Tm(r,e,o,i)}var Ul="_reactListening"+Math.random().toString(36).slice(2);function Wh(e){if(!e[Ul]){e[Ul]=!0,ba.forEach(function(r){r!=="selectionchange"&&(sw.has(r)||qh(r,!1,e),qh(r,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[Ul]||(i[Ul]=!0,qh("selectionchange",!1,i))}}function Tm(e,i,r,o){switch(sg(i)){case 2:var m=Mw;break;case 8:m=Dw;break;default:m=ad}r=m.bind(null,i,r,e),m=void 0,!hu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(m=!0),o?m!==void 0?e.addEventListener(i,r,{capture:!0,passive:m}):e.addEventListener(i,r,!0):m!==void 0?e.addEventListener(i,r,{passive:m}):e.addEventListener(i,r,!1)}function Gh(e,i,r,o,m){var x=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var N=o.tag;if(N===3||N===4){var H=o.stateNode.containerInfo;if(H===m)break;if(N===4)for(N=o.return;N!==null;){var X=N.tag;if((X===3||X===4)&&N.stateNode.containerInfo===m)return;N=N.return}for(;H!==null;){if(N=Ni(H),N===null)return;if(X=N.tag,X===5||X===6||X===26||X===27){o=x=N;continue e}H=H.parentNode}}o=o.return}jp(function(){var re=x,pe=cu(r),ye=[];e:{var ae=av.get(e);if(ae!==void 0){var he=Qo,Ne=e;switch(e){case"keypress":if(Jo(r)===0)break e;case"keydown":case"keyup":he=X1;break;case"focusin":Ne="focus",he=vu;break;case"focusout":Ne="blur",he=vu;break;case"beforeblur":case"afterblur":he=vu;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=Op;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=H1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=Z1;break;case sv:case iv:case nv:he=$1;break;case rv:he=eS;break;case"scroll":case"scrollend":he=O1;break;case"wheel":he=sS;break;case"copy":case"cut":case"paste":he=U1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Hp;break;case"toggle":case"beforetoggle":he=nS}var Pe=(i&4)!==0,Ct=!Pe&&(e==="scroll"||e==="scrollend"),se=Pe?ae!==null?ae+"Capture":null:ae;Pe=[];for(var Z=re,ne;Z!==null;){var ve=Z;if(ne=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||ne===null||se===null||(ve=Sa(Z,se),ve!=null&&Pe.push(eo(Z,ve,ne))),Ct)break;Z=Z.return}0<Pe.length&&(ae=new he(ae,Ne,null,r,pe),ye.push({event:ae,listeners:Pe}))}}if((i&7)===0){e:{if(ae=e==="mouseover"||e==="pointerover",he=e==="mouseout"||e==="pointerout",ae&&r!==lu&&(Ne=r.relatedTarget||r.fromElement)&&(Ni(Ne)||Ne[Ae]))break e;if((he||ae)&&(ae=pe.window===pe?pe:(ae=pe.ownerDocument)?ae.defaultView||ae.parentWindow:window,he?(Ne=r.relatedTarget||r.toElement,he=re,Ne=Ne?Ni(Ne):null,Ne!==null&&(Ct=d(Ne),Pe=Ne.tag,Ne!==Ct||Pe!==5&&Pe!==27&&Pe!==6)&&(Ne=null)):(he=null,Ne=re),he!==Ne)){if(Pe=Op,ve="onMouseLeave",se="onMouseEnter",Z="mouse",(e==="pointerout"||e==="pointerover")&&(Pe=Hp,ve="onPointerLeave",se="onPointerEnter",Z="pointer"),Ct=he==null?ae:ds(he),ne=Ne==null?ae:ds(Ne),ae=new Pe(ve,Z+"leave",he,r,pe),ae.target=Ct,ae.relatedTarget=ne,ve=null,Ni(pe)===re&&(Pe=new Pe(se,Z+"enter",Ne,r,pe),Pe.target=ne,Pe.relatedTarget=Ct,ve=Pe),Ct=ve,he&&Ne)t:{for(Pe=iw,se=he,Z=Ne,ne=0,ve=se;ve;ve=Pe(ve))ne++;ve=0;for(var $e=Z;$e;$e=Pe($e))ve++;for(;0<ne-ve;)se=Pe(se),ne--;for(;0<ve-ne;)Z=Pe(Z),ve--;for(;ne--;){if(se===Z||Z!==null&&se===Z.alternate){Pe=se;break t}se=Pe(se),Z=Pe(Z)}Pe=null}else Pe=null;he!==null&&Am(ye,ae,he,Pe,!1),Ne!==null&&Ct!==null&&Am(ye,Ct,Ne,Pe,!0)}}e:{if(ae=re?ds(re):window,he=ae.nodeName&&ae.nodeName.toLowerCase(),he==="select"||he==="input"&&ae.type==="file")var pt=Wp;else if(Fp(ae))if(Gp)pt=pS;else{pt=dS;var He=hS}else he=ae.nodeName,!he||he.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?re&&ou(re.elementType)&&(pt=Wp):pt=fS;if(pt&&(pt=pt(e,re))){qp(ye,pt,r,pe);break e}He&&He(e,ae,re),e==="focusout"&&re&&ae.type==="number"&&re.memoizedProps.value!=null&&au(ae,"number",ae.value)}switch(He=re?ds(re):window,e){case"focusin":(Fp(He)||He.contentEditable==="true")&&(xr=He,Su=re,Ra=null);break;case"focusout":Ra=Su=xr=null;break;case"mousedown":wu=!0;break;case"contextmenu":case"mouseup":case"dragend":wu=!1,ev(ye,r,pe);break;case"selectionchange":if(_S)break;case"keydown":case"keyup":ev(ye,r,pe)}var Ze;if(mu)e:{switch(e){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else wr?Pp(e,r)&&(at="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(at="onCompositionStart");at&&(zp&&r.locale!=="ko"&&(wr||at!=="onCompositionStart"?at==="onCompositionEnd"&&wr&&(Ze=Np()):(dn=pe,du="value"in dn?dn.value:dn.textContent,wr=!0)),He=Fl(re,at),0<He.length&&(at=new Bp(at,e,null,r,pe),ye.push({event:at,listeners:He}),Ze?at.data=Ze:(Ze=Up(r),Ze!==null&&(at.data=Ze)))),(Ze=aS?oS(e,r):lS(e,r))&&(at=Fl(re,"onBeforeInput"),0<at.length&&(He=new Bp("onBeforeInput","beforeinput",null,r,pe),ye.push({event:He,listeners:at}),He.data=Ze)),QS(ye,e,re,r,pe)}km(ye,i)})}function eo(e,i,r){return{instance:e,listener:i,currentTarget:r}}function Fl(e,i){for(var r=i+"Capture",o=[];e!==null;){var m=e,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=Sa(e,r),m!=null&&o.unshift(eo(e,m,x)),m=Sa(e,i),m!=null&&o.push(eo(e,m,x))),e.tag===3)return o;e=e.return}return[]}function iw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Am(e,i,r,o,m){for(var x=i._reactName,N=[];r!==null&&r!==o;){var H=r,X=H.alternate,re=H.stateNode;if(H=H.tag,X!==null&&X===o)break;H!==5&&H!==26&&H!==27||re===null||(X=re,m?(re=Sa(r,x),re!=null&&N.unshift(eo(r,re,X))):m||(re=Sa(r,x),re!=null&&N.push(eo(r,re,X)))),r=r.return}N.length!==0&&e.push({event:i,listeners:N})}var nw=/\r\n?/g,rw=/\u0000|\uFFFD/g;function Rm(e){return(typeof e=="string"?e:""+e).replace(nw,`
49
- `).replace(rw,"")}function Mm(e,i){return i=Rm(i),Rm(e)===i}function xt(e,i,r,o,m,x){switch(r){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||yr(e,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&yr(e,""+o);break;case"className":Vo(e,"class",o);break;case"tabIndex":Vo(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Vo(e,r,o);break;case"style":Mp(e,o,x);break;case"data":if(i!=="object"){Vo(e,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||r!=="href")){e.removeAttribute(r);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(r);break}o=Xo(""+o),e.setAttribute(r,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(r,"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 x=="function"&&(r==="formAction"?(i!=="input"&&xt(e,i,"name",m.name,m,null),xt(e,i,"formEncType",m.formEncType,m,null),xt(e,i,"formMethod",m.formMethod,m,null),xt(e,i,"formTarget",m.formTarget,m,null)):(xt(e,i,"encType",m.encType,m,null),xt(e,i,"method",m.method,m,null),xt(e,i,"target",m.target,m,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(r);break}o=Xo(""+o),e.setAttribute(r,o);break;case"onClick":o!=null&&(e.onclick=Oi);break;case"onScroll":o!=null&&it("scroll",e);break;case"onScrollEnd":o!=null&&it("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(m.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}r=Xo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,""+o):e.removeAttribute(r);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":o===!0?e.setAttribute(r,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,o):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(r,o):e.removeAttribute(r);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(r):e.setAttribute(r,o);break;case"popover":it("beforetoggle",e),it("toggle",e),Go(e,"popover",o);break;case"xlinkActuate":Li(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Li(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Li(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Li(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Li(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Li(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Li(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Li(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Li(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Go(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=N1.get(r)||r,Go(e,r,o))}}function Vh(e,i,r,o,m,x){switch(r){case"style":Mp(e,o,x);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(m.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"children":typeof o=="string"?yr(e,o):(typeof o=="number"||typeof o=="bigint")&&yr(e,""+o);break;case"onScroll":o!=null&&it("scroll",e);break;case"onScrollEnd":o!=null&&it("scrollend",e);break;case"onClick":o!=null&&(e.onclick=Oi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sp.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(m=r.endsWith("Capture"),i=r.slice(2,m?r.length-7:void 0),x=e[oe]||null,x=x!=null?x[r]:null,typeof x=="function"&&e.removeEventListener(i,x,m),typeof o=="function")){typeof x!="function"&&x!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(i,o,m);break e}r in e?e[r]=o:o===!0?e.setAttribute(r,""):Go(e,r,o)}}}function _s(e,i,r){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",e),it("load",e);var o=!1,m=!1,x;for(x in r)if(r.hasOwnProperty(x)){var N=r[x];if(N!=null)switch(x){case"src":o=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:xt(e,i,x,N,r,null)}}m&&xt(e,i,"srcSet",r.srcSet,r,null),o&&xt(e,i,"src",r.src,r,null);return;case"input":it("invalid",e);var H=x=N=m=null,X=null,re=null;for(o in r)if(r.hasOwnProperty(o)){var pe=r[o];if(pe!=null)switch(o){case"name":m=pe;break;case"type":N=pe;break;case"checked":X=pe;break;case"defaultChecked":re=pe;break;case"value":x=pe;break;case"defaultValue":H=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(a(137,i));break;default:xt(e,i,o,pe,r,null)}}kp(e,x,H,X,re,N,m,!1);return;case"select":it("invalid",e),o=N=x=null;for(m in r)if(r.hasOwnProperty(m)&&(H=r[m],H!=null))switch(m){case"value":x=H;break;case"defaultValue":N=H;break;case"multiple":o=H;default:xt(e,i,m,H,r,null)}i=x,r=N,e.multiple=!!o,i!=null?gr(e,!!o,i,!1):r!=null&&gr(e,!!o,r,!0);return;case"textarea":it("invalid",e),x=m=o=null;for(N in r)if(r.hasOwnProperty(N)&&(H=r[N],H!=null))switch(N){case"value":o=H;break;case"defaultValue":m=H;break;case"children":x=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(a(91));break;default:xt(e,i,N,H,r,null)}Ap(e,o,m,x);return;case"option":for(X in r)if(r.hasOwnProperty(X)&&(o=r[X],o!=null))switch(X){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:xt(e,i,X,o,r,null)}return;case"dialog":it("beforetoggle",e),it("toggle",e),it("cancel",e),it("close",e);break;case"iframe":case"object":it("load",e);break;case"video":case"audio":for(o=0;o<Qa.length;o++)it(Qa[o],e);break;case"image":it("error",e),it("load",e);break;case"details":it("toggle",e);break;case"embed":case"source":case"link":it("error",e),it("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in r)if(r.hasOwnProperty(re)&&(o=r[re],o!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:xt(e,i,re,o,r,null)}return;default:if(ou(i)){for(pe in r)r.hasOwnProperty(pe)&&(o=r[pe],o!==void 0&&Vh(e,i,pe,o,r,void 0));return}}for(H in r)r.hasOwnProperty(H)&&(o=r[H],o!=null&&xt(e,i,H,o,r,null))}function aw(e,i,r,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,N=null,H=null,X=null,re=null,pe=null;for(he in r){var ye=r[he];if(r.hasOwnProperty(he)&&ye!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":X=ye;default:o.hasOwnProperty(he)||xt(e,i,he,null,o,ye)}}for(var ae in o){var he=o[ae];if(ye=r[ae],o.hasOwnProperty(ae)&&(he!=null||ye!=null))switch(ae){case"type":x=he;break;case"name":m=he;break;case"checked":re=he;break;case"defaultChecked":pe=he;break;case"value":N=he;break;case"defaultValue":H=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(a(137,i));break;default:he!==ye&&xt(e,i,ae,he,o,ye)}}ru(e,N,H,X,re,pe,x,m);return;case"select":he=N=H=ae=null;for(x in r)if(X=r[x],r.hasOwnProperty(x)&&X!=null)switch(x){case"value":break;case"multiple":he=X;default:o.hasOwnProperty(x)||xt(e,i,x,null,o,X)}for(m in o)if(x=o[m],X=r[m],o.hasOwnProperty(m)&&(x!=null||X!=null))switch(m){case"value":ae=x;break;case"defaultValue":H=x;break;case"multiple":N=x;default:x!==X&&xt(e,i,m,x,o,X)}i=H,r=N,o=he,ae!=null?gr(e,!!r,ae,!1):!!o!=!!r&&(i!=null?gr(e,!!r,i,!0):gr(e,!!r,r?[]:"",!1));return;case"textarea":he=ae=null;for(H in r)if(m=r[H],r.hasOwnProperty(H)&&m!=null&&!o.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:xt(e,i,H,null,o,m)}for(N in o)if(m=o[N],x=r[N],o.hasOwnProperty(N)&&(m!=null||x!=null))switch(N){case"value":ae=m;break;case"defaultValue":he=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(a(91));break;default:m!==x&&xt(e,i,N,m,o,x)}Tp(e,ae,he);return;case"option":for(var Ne in r)if(ae=r[Ne],r.hasOwnProperty(Ne)&&ae!=null&&!o.hasOwnProperty(Ne))switch(Ne){case"selected":e.selected=!1;break;default:xt(e,i,Ne,null,o,ae)}for(X in o)if(ae=o[X],he=r[X],o.hasOwnProperty(X)&&ae!==he&&(ae!=null||he!=null))switch(X){case"selected":e.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:xt(e,i,X,ae,o,he)}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 Pe in r)ae=r[Pe],r.hasOwnProperty(Pe)&&ae!=null&&!o.hasOwnProperty(Pe)&&xt(e,i,Pe,null,o,ae);for(re in o)if(ae=o[re],he=r[re],o.hasOwnProperty(re)&&ae!==he&&(ae!=null||he!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:xt(e,i,re,ae,o,he)}return;default:if(ou(i)){for(var Ct in r)ae=r[Ct],r.hasOwnProperty(Ct)&&ae!==void 0&&!o.hasOwnProperty(Ct)&&Vh(e,i,Ct,void 0,o,ae);for(pe in o)ae=o[pe],he=r[pe],!o.hasOwnProperty(pe)||ae===he||ae===void 0&&he===void 0||Vh(e,i,pe,ae,o,he);return}}for(var se in r)ae=r[se],r.hasOwnProperty(se)&&ae!=null&&!o.hasOwnProperty(se)&&xt(e,i,se,null,o,ae);for(ye in o)ae=o[ye],he=r[ye],!o.hasOwnProperty(ye)||ae===he||ae==null&&he==null||xt(e,i,ye,ae,o,he)}function Dm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ow(){if(typeof performance.getEntriesByType=="function"){for(var e=0,i=0,r=performance.getEntriesByType("resource"),o=0;o<r.length;o++){var m=r[o],x=m.transferSize,N=m.initiatorType,H=m.duration;if(x&&H&&Dm(N)){for(N=0,H=m.responseEnd,o+=1;o<r.length;o++){var X=r[o],re=X.startTime;if(re>H)break;var pe=X.transferSize,ye=X.initiatorType;pe&&Dm(ye)&&(X=X.responseEnd,N+=pe*(X<H?1:(H-re)/(X-re)))}if(--o,i+=8*(x+N)/(m.duration/1e3),e++,10<e)break}}if(0<e)return i/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Yh=null,Xh=null;function ql(e){return e.nodeType===9?e:e.ownerDocument}function jm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Nm(e,i){if(e===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&i==="foreignObject"?0:e}function Kh(e,i){return e==="textarea"||e==="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 Jh=null;function lw(){var e=window.event;return e&&e.type==="popstate"?e===Jh?!1:(Jh=e,!0):(Jh=null,!1)}var Lm=typeof setTimeout=="function"?setTimeout:void 0,cw=typeof clearTimeout=="function"?clearTimeout:void 0,Om=typeof Promise=="function"?Promise:void 0,uw=typeof queueMicrotask=="function"?queueMicrotask:typeof Om<"u"?function(e){return Om.resolve(null).then(e).catch(hw)}:Lm;function hw(e){setTimeout(function(){throw e})}function Rn(e){return e==="head"}function Bm(e,i){var r=i,o=0;do{var m=r.nextSibling;if(e.removeChild(r),m&&m.nodeType===8)if(r=m.data,r==="/$"||r==="/&"){if(o===0){e.removeChild(m),Kr(i);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")to(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,to(r);for(var x=r.firstChild;x;){var N=x.nextSibling,H=x.nodeName;x[Fs]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&x.rel.toLowerCase()==="stylesheet"||r.removeChild(x),x=N}}else r==="body"&&to(e.ownerDocument.body);r=m}while(r);Kr(i)}function Hm(e,i){var r=e;e=0;do{var o=r.nextSibling;if(r.nodeType===1?i?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(i?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=o}while(r)}function Zh(e){var i=e.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var r=i;switch(i=i.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Zh(r),ei(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function dw(e,i,r,o){for(;e.nodeType===1;){var m=r;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[Fs])switch(i){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(x=e.getAttribute("rel"),x==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(x!==m.rel||e.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||e.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||e.getAttribute("title")!==(m.title==null?null:m.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(m.src==null?null:m.src)||e.getAttribute("type")!==(m.type==null?null:m.type)||e.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=ci(e.nextSibling),e===null)break}return null}function fw(e,i,r){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=ci(e.nextSibling),e===null))return null;return e}function zm(e,i){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ci(e.nextSibling),e===null))return null;return e}function Qh(e){return e.data==="$?"||e.data==="$~"}function ed(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function pw(e,i){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=i;else if(e.data!=="$?"||r.readyState!=="loading")i();else{var o=function(){i(),r.removeEventListener("DOMContentLoaded",o)};r.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function ci(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return e}var td=null;function Im(e){e=e.nextSibling;for(var i=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(i===0)return ci(e.nextSibling);i--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||i++}e=e.nextSibling}return null}function $m(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(i===0)return e;i--}else r!=="/$"&&r!=="/&"||i++}e=e.previousSibling}return null}function Pm(e,i,r){switch(i=ql(r),e){case"html":if(e=i.documentElement,!e)throw Error(a(452));return e;case"head":if(e=i.head,!e)throw Error(a(453));return e;case"body":if(e=i.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function to(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);ei(e)}var ui=new Map,Um=new Set;function Wl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ji=G.d;G.d={f:vw,r:_w,D:mw,C:gw,L:yw,m:bw,X:ww,S:Sw,M:xw};function vw(){var e=Ji.f(),i=Bl();return e||i}function _w(e){var i=gi(e);i!==null&&i.tag===5&&i.type==="form"?r_(i):Ji.r(e)}var Vr=typeof document>"u"?null:document;function Fm(e,i,r){var o=Vr;if(o&&typeof i=="string"&&i){var m=si(i);m='link[rel="'+e+'"][href="'+m+'"]',typeof r=="string"&&(m+='[crossorigin="'+r+'"]'),Um.has(m)||(Um.add(m),e={rel:e,crossOrigin:r,href:i},o.querySelector(m)===null&&(i=o.createElement("link"),_s(i,"link",e),is(i),o.head.appendChild(i)))}}function mw(e){Ji.D(e),Fm("dns-prefetch",e,null)}function gw(e,i){Ji.C(e,i),Fm("preconnect",e,i)}function yw(e,i,r){Ji.L(e,i,r);var o=Vr;if(o&&e&&i){var m='link[rel="preload"][as="'+si(i)+'"]';i==="image"&&r&&r.imageSrcSet?(m+='[imagesrcset="'+si(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(m+='[imagesizes="'+si(r.imageSizes)+'"]')):m+='[href="'+si(e)+'"]';var x=m;switch(i){case"style":x=Yr(e);break;case"script":x=Xr(e)}ui.has(x)||(e=f({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:e,as:i},r),ui.set(x,e),o.querySelector(m)!==null||i==="style"&&o.querySelector(so(x))||i==="script"&&o.querySelector(io(x))||(i=o.createElement("link"),_s(i,"link",e),is(i),o.head.appendChild(i)))}}function bw(e,i){Ji.m(e,i);var r=Vr;if(r&&e){var o=i&&typeof i.as=="string"?i.as:"script",m='link[rel="modulepreload"][as="'+si(o)+'"][href="'+si(e)+'"]',x=m;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Xr(e)}if(!ui.has(x)&&(e=f({rel:"modulepreload",href:e},i),ui.set(x,e),r.querySelector(m)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(io(x)))return}o=r.createElement("link"),_s(o,"link",e),is(o),r.head.appendChild(o)}}}function Sw(e,i,r){Ji.S(e,i,r);var o=Vr;if(o&&e){var m=hn(o).hoistableStyles,x=Yr(e);i=i||"default";var N=m.get(x);if(!N){var H={loading:0,preload:null};if(N=o.querySelector(so(x)))H.loading=5;else{e=f({rel:"stylesheet",href:e,"data-precedence":i},r),(r=ui.get(x))&&sd(e,r);var X=N=o.createElement("link");is(X),_s(X,"link",e),X._p=new Promise(function(re,pe){X.onload=re,X.onerror=pe}),X.addEventListener("load",function(){H.loading|=1}),X.addEventListener("error",function(){H.loading|=2}),H.loading|=4,Gl(N,i,o)}N={type:"stylesheet",instance:N,count:1,state:H},m.set(x,N)}}}function ww(e,i){Ji.X(e,i);var r=Vr;if(r&&e){var o=hn(r).hoistableScripts,m=Xr(e),x=o.get(m);x||(x=r.querySelector(io(m)),x||(e=f({src:e,async:!0},i),(i=ui.get(m))&&id(e,i),x=r.createElement("script"),is(x),_s(x,"link",e),r.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},o.set(m,x))}}function xw(e,i){Ji.M(e,i);var r=Vr;if(r&&e){var o=hn(r).hoistableScripts,m=Xr(e),x=o.get(m);x||(x=r.querySelector(io(m)),x||(e=f({src:e,async:!0,type:"module"},i),(i=ui.get(m))&&id(e,i),x=r.createElement("script"),is(x),_s(x,"link",e),r.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},o.set(m,x))}}function qm(e,i,r,o){var m=(m=ge.current)?Wl(m):null;if(!m)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(i=Yr(r.href),r=hn(m).hoistableStyles,o=r.get(i),o||(o={type:"style",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Yr(r.href);var x=hn(m).hoistableStyles,N=x.get(e);if(N||(m=m.ownerDocument||m,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,N),(x=m.querySelector(so(e)))&&!x._p&&(N.instance=x,N.state.loading=5),ui.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ui.set(e,r),x||Cw(m,e,r,N.state))),i&&o===null)throw Error(a(528,""));return N}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Xr(r),r=hn(m).hoistableScripts,o=r.get(i),o||(o={type:"script",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Yr(e){return'href="'+si(e)+'"'}function so(e){return'link[rel="stylesheet"]['+e+"]"}function Wm(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Cw(e,i,r,o){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=e.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),_s(i,"link",r),is(i),e.head.appendChild(i))}function Xr(e){return'[src="'+si(e)+'"]'}function io(e){return"script[async]"+e}function Gm(e,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var o=e.querySelector('style[data-href~="'+si(r.href)+'"]');if(o)return i.instance=o,is(o),o;var m=f({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),is(o),_s(o,"style",m),Gl(o,r.precedence,e),i.instance=o;case"stylesheet":m=Yr(r.href);var x=e.querySelector(so(m));if(x)return i.state.loading|=4,i.instance=x,is(x),x;o=Wm(r),(m=ui.get(m))&&sd(o,m),x=(e.ownerDocument||e).createElement("link"),is(x);var N=x;return N._p=new Promise(function(H,X){N.onload=H,N.onerror=X}),_s(x,"link",o),i.state.loading|=4,Gl(x,r.precedence,e),i.instance=x;case"script":return x=Xr(r.src),(m=e.querySelector(io(x)))?(i.instance=m,is(m),m):(o=r,(m=ui.get(x))&&(o=f({},r),id(o,m)),e=e.ownerDocument||e,m=e.createElement("script"),is(m),_s(m,"link",o),e.head.appendChild(m),i.instance=m);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Gl(o,r.precedence,e));return i.instance}function Gl(e,i,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=o.length?o[o.length-1]:null,x=m,N=0;N<o.length;N++){var H=o[N];if(H.dataset.precedence===i)x=H;else if(x!==m)break}x?x.parentNode.insertBefore(e,x.nextSibling):(i=r.nodeType===9?r.head:r,i.insertBefore(e,i.firstChild))}function sd(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function id(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var Vl=null;function Vm(e,i,r){if(Vl===null){var o=new Map,m=Vl=new Map;m.set(r,o)}else m=Vl,o=m.get(r),o||(o=new Map,m.set(r,o));if(o.has(e))return o;for(o.set(e,null),r=r.getElementsByTagName(e),m=0;m<r.length;m++){var x=r[m];if(!(x[Fs]||x[Me]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var N=x.getAttribute(i)||"";N=e+N;var H=o.get(N);H?H.push(x):o.set(N,[x])}}return o}function Ym(e,i,r){e=e.ownerDocument||e,e.head.insertBefore(r,i==="title"?e.querySelector("head > title"):null)}function Ew(e,i,r){if(r===1||i.itemProp!=null)return!1;switch(e){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 e=i.disabled,typeof i.precedence=="string"&&e==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 Xm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function kw(e,i,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var m=Yr(o.href),x=i.querySelector(so(m));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=Yl.bind(e),i.then(e,e)),r.state.loading|=4,r.instance=x,is(x);return}x=i.ownerDocument||i,o=Wm(o),(m=ui.get(m))&&sd(o,m),x=x.createElement("link"),is(x);var N=x;N._p=new Promise(function(H,X){N.onload=H,N.onerror=X}),_s(x,"link",o),r.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Yl.bind(e),i.addEventListener("load",r),i.addEventListener("error",r))}}var nd=0;function Tw(e,i){return e.stylesheets&&e.count===0&&Kl(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var o=setTimeout(function(){if(e.stylesheets&&Kl(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+i);0<e.imgBytes&&nd===0&&(nd=62500*ow());var m=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Kl(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>nd?50:800)+i);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(m)}}:null}function Yl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xl=null;function Kl(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xl=new Map,i.forEach(Aw,e),Xl=null,Yl.call(e))}function Aw(e,i){if(!(i.state.loading&4)){var r=Xl.get(e);if(r)var o=r.get(null);else{r=new Map,Xl.set(e,r);for(var m=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var N=m[x];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(r.set(N.dataset.precedence,N),o=N)}o&&r.set(null,o)}m=i.instance,N=m.getAttribute("data-precedence"),x=r.get(N)||o,x===o&&r.set(null,m),r.set(N,m),this.count++,o=Yl.bind(this),m.addEventListener("load",o),m.addEventListener("error",o),x?x.parentNode.insertBefore(m,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(m,e.firstChild)),i.state.loading|=4}}var no={$$typeof:g,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function Rw(e,i,r,o,m,x,N,H,X){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ce(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ce(0),this.hiddenUpdates=Ce(null),this.identifierPrefix=o,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function Km(e,i,r,o,m,x,N,H,X,re,pe,ye){return e=new Rw(e,i,r,N,X,re,pe,ye,H),i=1,x===!0&&(i|=24),x=Ws(3,null,null,i),e.current=x,x.stateNode=e,i=Hu(),i.refCount++,e.pooledCache=i,i.refCount++,x.memoizedState={element:o,isDehydrated:r,cache:i},Pu(x),e}function Jm(e){return e?(e=kr,e):kr}function Zm(e,i,r,o,m,x){m=Jm(m),o.context===null?o.context=m:o.pendingContext=m,o=gn(i),o.payload={element:r},x=x===void 0?null:x,x!==null&&(o.callback=x),r=yn(e,o,i),r!==null&&(Is(r,e,i),Ba(r,e,i))}function Qm(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<i?r:i}}function rd(e,i){Qm(e,i),(e=e.alternate)&&Qm(e,i)}function eg(e){if(e.tag===13||e.tag===31){var i=Fn(e,67108864);i!==null&&Is(i,e,67108864),rd(e,67108864)}}function tg(e){if(e.tag===13||e.tag===31){var i=Ks();i=ft(i);var r=Fn(e,i);r!==null&&Is(r,e,i),rd(e,i)}}var Jl=!0;function Mw(e,i,r,o){var m=W.T;W.T=null;var x=G.p;try{G.p=2,ad(e,i,r,o)}finally{G.p=x,W.T=m}}function Dw(e,i,r,o){var m=W.T;W.T=null;var x=G.p;try{G.p=8,ad(e,i,r,o)}finally{G.p=x,W.T=m}}function ad(e,i,r,o){if(Jl){var m=od(o);if(m===null)Gh(e,i,o,Zl,r),ig(e,o);else if(Nw(m,e,i,r,o))o.stopPropagation();else if(ig(e,o),i&4&&-1<jw.indexOf(e)){for(;m!==null;){var x=gi(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var N=Cs(x.pendingLanes);if(N!==0){var H=x;for(H.pendingLanes|=2,H.entangledLanes|=2;N;){var X=1<<31-mt(N);H.entanglements[1]|=X,N&=~X}Ti(x),(_t&6)===0&&(Ll=ut()+500,Za(0))}}break;case 31:case 13:H=Fn(x,2),H!==null&&Is(H,x,2),Bl(),rd(x,2)}if(x=od(o),x===null&&Gh(e,i,o,Zl,r),x===m)break;m=x}m!==null&&o.stopPropagation()}else Gh(e,i,o,null,r)}}function od(e){return e=cu(e),ld(e)}var Zl=null;function ld(e){if(Zl=null,e=Ni(e),e!==null){var i=d(e);if(i===null)e=null;else{var r=i.tag;if(r===13){if(e=v(i),e!==null)return e;e=null}else if(r===31){if(e=c(i),e!==null)return e;e=null}else if(r===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return Zl=e,null}function sg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(es()){case Yt:return 2;case ts:return 8;case ot:case Xt:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var cd=!1,Mn=null,Dn=null,jn=null,ro=new Map,ao=new Map,Nn=[],jw="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 ig(e,i){switch(e){case"focusin":case"focusout":Mn=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":ro.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ao.delete(i.pointerId)}}function oo(e,i,r,o,m,x){return e===null||e.nativeEvent!==x?(e={blockedOn:i,domEventName:r,eventSystemFlags:o,nativeEvent:x,targetContainers:[m]},i!==null&&(i=gi(i),i!==null&&eg(i)),e):(e.eventSystemFlags|=o,i=e.targetContainers,m!==null&&i.indexOf(m)===-1&&i.push(m),e)}function Nw(e,i,r,o,m){switch(i){case"focusin":return Mn=oo(Mn,e,i,r,o,m),!0;case"dragenter":return Dn=oo(Dn,e,i,r,o,m),!0;case"mouseover":return jn=oo(jn,e,i,r,o,m),!0;case"pointerover":var x=m.pointerId;return ro.set(x,oo(ro.get(x)||null,e,i,r,o,m)),!0;case"gotpointercapture":return x=m.pointerId,ao.set(x,oo(ao.get(x)||null,e,i,r,o,m)),!0}return!1}function ng(e){var i=Ni(e.target);if(i!==null){var r=d(i);if(r!==null){if(i=r.tag,i===13){if(i=v(r),i!==null){e.blockedOn=i,ue(e.priority,function(){tg(r)});return}}else if(i===31){if(i=c(r),i!==null){e.blockedOn=i,ue(e.priority,function(){tg(r)});return}}else if(i===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ql(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var r=od(e.nativeEvent);if(r===null){r=e.nativeEvent;var o=new r.constructor(r.type,r);lu=o,r.target.dispatchEvent(o),lu=null}else return i=gi(r),i!==null&&eg(i),e.blockedOn=r,!1;i.shift()}return!0}function rg(e,i,r){Ql(e)&&r.delete(i)}function Lw(){cd=!1,Mn!==null&&Ql(Mn)&&(Mn=null),Dn!==null&&Ql(Dn)&&(Dn=null),jn!==null&&Ql(jn)&&(jn=null),ro.forEach(rg),ao.forEach(rg)}function ec(e,i){e.blockedOn===i&&(e.blockedOn=null,cd||(cd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Lw)))}var tc=null;function ag(e){tc!==e&&(tc=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){tc===e&&(tc=null);for(var i=0;i<e.length;i+=3){var r=e[i],o=e[i+1],m=e[i+2];if(typeof o!="function"){if(ld(o||r)===null)continue;break}var x=gi(r);x!==null&&(e.splice(i,3),i-=3,oh(x,{pending:!0,data:m,method:r.method,action:o},o,m))}}))}function Kr(e){function i(X){return ec(X,e)}Mn!==null&&ec(Mn,e),Dn!==null&&ec(Dn,e),jn!==null&&ec(jn,e),ro.forEach(i),ao.forEach(i);for(var r=0;r<Nn.length;r++){var o=Nn[r];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Nn.length&&(r=Nn[0],r.blockedOn===null);)ng(r),r.blockedOn===null&&Nn.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var m=r[o],x=r[o+1],N=m[oe]||null;if(typeof x=="function")N||ag(r);else if(N){var H=null;if(x&&x.hasAttribute("formAction")){if(m=x,N=x[oe]||null)H=N.formAction;else if(ld(m)!==null)continue}else H=N.action;typeof H=="function"?r[o+1]=H:(r.splice(o,3),o-=3),ag(r)}}}function og(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(N){return m=N})},focusReset:"manual",scroll:"manual"})}function i(){m!==null&&(m(),m=null),o||setTimeout(r,20)}function r(){if(!o&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,m=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(r,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),m!==null&&(m(),m=null)}}}function ud(e){this._internalRoot=e}sc.prototype.render=ud.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(a(409));var r=i.current,o=Ks();Zm(r,o,e,i,null,null)},sc.prototype.unmount=ud.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;Zm(e.current,2,null,e,null,null),Bl(),i[Ae]=null}};function sc(e){this._internalRoot=e}sc.prototype.unstable_scheduleHydration=function(e){if(e){var i=hs();e={blockedOn:null,target:e,priority:i};for(var r=0;r<Nn.length&&i!==0&&i<Nn[r].priority;r++);Nn.splice(r,0,e),r===0&&ng(e)}};var lg=t.version;if(lg!=="19.2.7")throw Error(a(527,lg,"19.2.7"));G.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=p(i),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Ow={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ic.isDisabled&&ic.supportsFiber)try{Ee=ic.inject(Ow),Ue=ic}catch{}}return co.createRoot=function(e,i){if(!l(e))throw Error(a(299));var r=!1,o="",m=v_,x=__,N=m_;return i!=null&&(i.unstable_strictMode===!0&&(r=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(N=i.onRecoverableError)),i=Km(e,1,!1,null,null,r,o,null,m,x,N,og),e[Ae]=i.current,Wh(e),new ud(i)},co.hydrateRoot=function(e,i,r){if(!l(e))throw Error(a(299));var o=!1,m="",x=v_,N=__,H=m_,X=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(m=r.identifierPrefix),r.onUncaughtError!==void 0&&(x=r.onUncaughtError),r.onCaughtError!==void 0&&(N=r.onCaughtError),r.onRecoverableError!==void 0&&(H=r.onRecoverableError),r.formState!==void 0&&(X=r.formState)),i=Km(e,1,!0,i,r??null,o,m,X,x,N,H,og),i.context=Jm(null),r=i.current,o=Ks(),o=ft(o),m=gn(o),m.callback=null,yn(r,m,o),r=o,i.current.lanes=r,Se(i,r),Ti(i),e[Ae]=i.current,Wh(e),new sc(i)},co.version="19.2.7",co}var gg;function Gw(){if(gg)return pd.exports;gg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),pd.exports=Ww(),pd.exports}var Vw=Gw();const cy=Date.now(),ms=s=>new Date(cy-s*6e4).toISOString(),Qe=s=>new Date(cy-s*24*60*6e4).toISOString(),yg="/Users/demo/acme-app";ms(1),ms(1),ms(42),ms(20),Qe(2),Qe(1),Qe(1),Qe(1),Qe(3),Qe(3),ms(0),ms(0),ms(3),ms(3);ms(1),Qe(1),Qe(1),Qe(3),Qe(6),Qe(45),Qe(1);ms(48),ms(1),ms(48),ms(47),ms(46),ms(45),ms(3),ms(2),Qe(1),Qe(1),Qe(1),Qe(1),Qe(1),Qe(1),Qe(1),Qe(1),Qe(1),Qe(3),Qe(3),Qe(3),Qe(3),Qe(3),Qe(3),Qe(3),Qe(3),Qe(1),Qe(1),Qe(1),Qe(1),Qe(45),Qe(45),Qe(45),Qe(45),Qe(45),Qe(45),Qe(45),Qe(45);function uy(){return!1}function aa(s){return(s==null?void 0:s.boundWorkflowPath)??null}class As extends Error{constructor(n,a,l){super(a);hd(this,"status");hd(this,"reason");this.name="ApiError",this.status=n,this.reason=l}}function oa(){const s=window.__HARNESS__;return s!=null&&s.token?s.token:new URLSearchParams(window.location.search).get("token")??""}class Yw{startAuth(){return this.request("/api/auth/start",{method:"POST"})}disconnect(){return this.request("/api/auth/disconnect",{method:"POST"})}authStatus(){return this.request("/api/auth/status")}async request(t,n){const a=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":oa(),...n==null?void 0:n.headers}});if(!a.ok){const l=await a.text().catch(()=>"");let d;try{const v=l?JSON.parse(l):void 0;v&&typeof v=="object"&&typeof v.error=="string"&&(d=v.error)}catch{}throw new As(a.status,`${(n==null?void 0:n.method)??"GET"} ${t} → ${a.status}${l?`: ${l}`:""}`,d)}if(a.status!==204)return await a.json()}getState(){return this.request("/api/state")}createSession(t){return this.request("/api/sessions",{method:"POST",body:JSON.stringify(t)})}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 As&&(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)})}attachImage(t,n){return this.request(`/api/sessions/${encodeURIComponent(t)}/image`,{method:"POST",body:JSON.stringify(n)})}listWorkflows(){return this.request("/api/workflows")}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})})}listHarnesses(){return this.request("/api/harnesses")}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 a={workflowPath:n};return this.request(`/api/sessions/${encodeURIComponent(t)}/workflow`,{method:"PATCH",body:JSON.stringify(a)})}listTemplates(){return this.request("/api/templates")}getTemplate(t){return this.request(`/api/templates/${encodeURIComponent(t)}`)}getRunState(t){return this.request(`/api/runs/${encodeURIComponent(t)}/state`)}async runLocal(t,n){const a=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":oa()},body:JSON.stringify(t)});if(!a.ok||!a.body){const u=await a.text().catch(()=>"");throw new As(a.status,`POST /api/runs/local → ${a.status}${u?`: ${u}`:""}`,void 0)}const l=a.body.getReader(),d=new TextDecoder;let v="";const c=(u,p)=>{v+=u;const{lines:y,rest:f}=Kw(v,p);v=f;for(const w of y){const E=Jw(w);E&&n(E)}};for(;;){const{done:u,value:p}=await l.read();if(u)break;c(d.decode(p,{stream:!0}),!1)}c(d.decode(),!0)}async deploy(t,n){const a=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},n);return Zw(a)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,n,a){const l=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":oa(),...n.headers}});if(!l.ok||!l.body){const y=await l.text().catch(()=>"");let f;try{const w=y?JSON.parse(y):void 0;w&&typeof w=="object"&&typeof w.error=="string"&&(f=w.error)}catch{}throw new As(l.status,`${n.method??"GET"} ${t} → ${l.status}${y?`: ${y}`:""}`,f)}const d=[],v=l.body.getReader(),c=new TextDecoder;let u="";const p=y=>{u+=y;let f=u.indexOf(`
50
- `);for(;f!==-1;){const w=u.slice(0,f);u=u.slice(f+1);const E=Xw(w);E!==void 0&&(d.push(E),a==null||a(E)),f=u.indexOf(`
51
- `)}};for(;;){const{done:y,value:f}=await v.read();if(y)break;p(c.decode(f,{stream:!0}))}return p(c.decode()+`
52
- `),d}}function Xw(s){const t=s.trim();if(t==="")return;let n;try{n=JSON.parse(t)}catch{return}return n===null?void 0:n}function Kw(s,t){const n=s.split(`
53
- `);if(t)return{lines:n.filter(l=>l.trim()!==""),rest:""};const a=n.pop()??"";return{lines:n.filter(l=>l.trim()!==""),rest:a}}function Jw(s){const t=s.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 Zw(s){for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.phase==="ready"||n.phase==="error")return n}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function Qw(){return new Yw}const hy="sapiom-harness-theme",rf=new Set;function ex(){const s=typeof window<"u"?window.localStorage.getItem(hy):null;return s==="light"||s==="dark"?s:"dark"}let Xf=ex();function Kf(){return Xf}function tx(s){Xf=s,document.documentElement.dataset.theme=s,window.localStorage.setItem(hy,s),rf.forEach(t=>t(s))}function sx(){tx(Xf==="dark"?"light":"dark")}function Jf(s){return rf.add(s),()=>rf.delete(s)}function To(s){var a,l;const t=(a=s.inputSchema)==null?void 0:a.properties;if(!t)return[];const n=new Set(((l=s.inputSchema)==null?void 0:l.required)??[]);return Object.entries(t).map(([d,v])=>({name:d,type:(v==null?void 0:v.type)??"unknown",required:n.has(d)})).sort((d,v)=>Number(v.required)-Number(d.required))}function vr(s){return s<1e3?`${s}ms`:`${Math.round(s/100)/10}s`}function ix(s,t){const n=[],a=To(s).length;a>0&&n.push(a===1?"1 input":`${a} inputs`);const l=t.filter(d=>d.from===s.id&&d.kind==="branching").length;return l>1&&n.push(`${l} branches`),s.timeoutMs&&s.timeoutMs>0&&n.push(`${vr(s.timeoutMs)} limit`),n}function nx(s){const t=s.nodes.filter(n=>n.kind==="terminal-success"||n.kind==="terminal-warn").length;return{steps:s.nodes.length-t,exits:t}}function rx(s){const{steps:t,exits:n}=nx(s),a=[`${t} ${t===1?"step":"steps"}`];return n>0&&a.push(`${n} ${n===1?"exit":"exits"}`),a.join(" · ")}function dy(s){switch(s){case"entry":return"Entry step";case"pause":return"Pause";case"terminal-success":return"Terminal · success";case"terminal-warn":return"Terminal · needs attention";case"launched-workflow":return"Launched workflow";default:return"Step"}}function ax(s){if(!s||typeof s!="object")return null;const t=s;if(!t.properties||typeof t.properties!="object")return null;const n={};for(const[a,l]of Object.entries(t.properties)){const d=l&&typeof l=="object"?l.type:void 0;n[a]=typeof d=="string"?{type:d}:{}}return Object.keys(n).length===0?null:{properties:n,required:Array.isArray(t.required)?t.required.filter(a=>typeof a=="string"):[]}}function ox(s){if(!s||typeof s!="object")return null;const t=s;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const n=a=>typeof a=="string"?a:"";return{name:n(t.name),entry:n(t.entry),nodes:t.nodes.map(a=>({id:n(a.id),kind:n(a.kind),label:n(a.label),role:n(a.role),description:n(a.description),timeoutMs:typeof a.timeoutMs=="number"&&a.timeoutMs>0?a.timeoutMs:null,inputSchema:ax(a.inputSchema),capabilities:Array.isArray(a.capabilities)?a.capabilities.filter(l=>typeof l=="string"):[]})),edges:t.edges.map(a=>({from:n(a.from),to:n(a.to),kind:n(a.kind),label:n(a.label)})),groups:Array.isArray(t.groups)?t.groups.map(a=>({label:n(a.label),nodeIds:Array.isArray(a.nodeIds)?a.nodeIds.filter(l=>typeof l=="string"):[]})):[],warnings:Array.isArray(t.warnings)?t.warnings.filter(a=>typeof a=="string"):[]}}const fy="sapiom-harness-ui-prefs";function Mi(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(fy);return s?JSON.parse(s):{}}catch{return{}}}function la(s){if(!(typeof window>"u"))try{window.localStorage.setItem(fy,JSON.stringify({...Mi(),...s}))}catch{}}function Xc(s,t){return!s||s.stubbed!==!0?!1:s.steps.some(n=>n.name===t)}function lx(s){if(!s)return null;const t={};return s.unusedStubs&&s.unusedStubs.length>0&&(t.unusedStubs=s.unusedStubs),s.stubWarnings&&s.stubWarnings.length>0&&(t.stubWarnings=s.stubWarnings),t.unusedStubs||t.stubWarnings?t:null}function Bo(s){if(typeof s=="string")return s;try{return JSON.stringify(s,null,2)??String(s)}catch{return String(s)}}const bg=3e3,Sg=2e3;function cx(s){return s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`}function wg(s){let t;if(typeof s=="string")t=s;else try{t=JSON.stringify(s,null,2)??String(s)}catch{t=String(s)}return t.length>Sg?`${t.slice(0,Sg)}
54
- … (truncated, ${t.length} chars total)`:t}function ux(s,t,n){const a=[];a.push(`Step: ${s.name}`),a.push(`Status: ${s.status}`),s.latencyMs!=null&&a.push(`Latency: ${cx(s.latencyMs)}`),s.status==="failed"&&s.error&&a.push(`Error: ${s.error}`),(t==null?void 0:t.input)!==void 0&&a.push(`
55
- Input:
56
- ${wg(t.input)}`),(t==null?void 0:t.output)!==void 0&&a.push(`
57
- Output:
58
- ${wg(t.output)}`);const l=t==null?void 0:t.calls;if(l!==void 0)if(l.length>0){a.push(`
59
- Capabilities called:`);for(const d of l){const v=d.stubUsed?" (stubbed)":"";a.push(` - ${d.capability}${v}`)}}else a.push(`
60
- Capabilities called: none (the step made zero capability calls).`);else if(n!=null&&n.capabilities&&n.capabilities.length>0){a.push(`
61
- Capabilities declared (no call trace):`);for(const d of n.capabilities)a.push(` - ${d}`)}if(t!=null&&t.unusedStubs&&t.unusedStubs.length>0){a.push(`
62
- Unused stubs (supplied but matched no call):`);for(const d of t.unusedStubs)a.push(` - ${d}`)}if(t!=null&&t.stubWarnings&&t.stubWarnings.length>0){a.push(`
63
- Stub warnings:`);for(const d of t.stubWarnings)a.push(` - ${d}`)}if(s.logSlice){const d=s.logSlice.trimEnd(),v=d.length>bg?d.slice(d.length-bg):d;a.push(`
64
- Logs:
65
- ${v}`)}return a.join(`
66
- `)}const hx=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,dx=/https?:\/\/[^\s"'<>`\])\]]+/gi,fx=/[.,;:)\]}\s]+$/;function xg(s){if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}}function px(s){const t=new Set,n=[],a=l=>{const d=l.matchAll(dx);for(const[v]of d){const c=v.replace(fx,"");if(!c||t.has(c))continue;t.add(c);const u=hx.test(c)?"image":"other";n.push({url:c,kind:u})}};if(s.output!==void 0&&a(xg(s.output)),s.logSlice&&a(s.logSlice),s.calls)for(const l of s.calls)l.result!==void 0&&a(xg(l.result));return n}/**
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 py=(...s)=>s.filter((t,n,a)=>!!t&&t.trim()!==""&&a.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 vx=s=>s.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 _x=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.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 Cg=s=>{const t=_x(s);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 gd={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 mx=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},gx=U.createContext({}),yx=()=>U.useContext(gx),bx=U.forwardRef(({color:s,size:t,strokeWidth:n,absoluteStrokeWidth:a,className:l="",children:d,iconNode:v,...c},u)=>{const{size:p=24,strokeWidth:y=2,absoluteStrokeWidth:f=!1,color:w="currentColor",className:E=""}=yx()??{},A=a??f?Number(n??y)*24/Number(t??p):n??y;return U.createElement("svg",{ref:u,...gd,width:t??p??gd.width,height:t??p??gd.height,stroke:s??w,strokeWidth:A,className:py("lucide",E,l),...!d&&!mx(c)&&{"aria-hidden":"true"},...c},[...v.map(([C,b])=>U.createElement(C,b)),...Array.isArray(d)?d:[d]])});/**
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 Be=(s,t)=>{const n=U.forwardRef(({className:a,...l},d)=>U.createElement(bx,{ref:d,iconNode:t,className:py(`lucide-${vx(Cg(s))}`,`lucide-${s}`,a),...l}));return n.displayName=Cg(s),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 Sx=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],wx=Be("arrow-down",Sx);/**
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 xx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Cx=Be("arrow-left",xx);/**
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 Ex=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kx=Be("arrow-right",Ex);/**
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 Tx=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Ax=Be("arrow-up-right",Tx);/**
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 Rx=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Mx=Be("arrow-up",Rx);/**
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 Dx=[["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"}]],jx=Be("book-open",Dx);/**
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 Nx=[["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"}]],Lx=Be("brain",Nx);/**
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 Ox=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Bx=Be("check",Ox);/**
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 Hx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zx=Be("chevron-down",Hx);/**
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 Ix=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$x=Be("chevron-right",Ix);/**
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 Px=[["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"}]],Ux=Be("circle-question-mark",Px);/**
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 Fx=[["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"}]],qx=Be("cloud-off",Fx);/**
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 Wx=[["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"}]],Gx=Be("cloud-upload",Wx);/**
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 Vx=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Yx=Be("cloud",Vx);/**
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 Xx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Kx=Be("code",Xx);/**
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 Jx=[["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"}]],Zx=Be("copy",Jx);/**
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 Qx=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],eC=Be("corner-down-right",Qx);/**
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 tC=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],sC=Be("corner-left-up",tC);/**
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 iC=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],nC=Be("ellipsis",iC);/**
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 rC=[["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"}]],aC=Be("external-link",rC);/**
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 oC=[["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"}]],lC=Be("flask-conical",oC);/**
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 cC=[["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"}]],uC=Be("folder",cC);/**
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 hC=[["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"}]],dC=Be("frame",hC);/**
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 fC=[["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"}]],pC=Be("hammer",fC);/**
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 vC=[["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"}]],_C=Be("history",vC);/**
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 mC=[["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"}]],gC=Be("image-up",mC);/**
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 yC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],bC=Be("info",yC);/**
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 SC=[["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"}]],wC=Be("layout-template",SC);/**
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 xC=[["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"}]],CC=Be("list-checks",xC);/**
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 EC=[["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"}]],kC=Be("list",EC);/**
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 TC=[["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"}]],AC=Be("loader",TC);/**
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 RC=[["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"}]],MC=Be("log-out",RC);/**
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 DC=[["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"}]],jC=Be("maximize-2",DC);/**
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 NC=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],LC=Be("menu",NC);/**
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 OC=[["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"}]],BC=Be("message-square",OC);/**
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 HC=[["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"}]],zC=Be("minimize-2",HC);/**
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 IC=[["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"}]],$C=Be("moon",IC);/**
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 PC=[["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"}]],UC=Be("panel-left-close",PC);/**
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 FC=[["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"}]],qC=Be("panel-left-open",FC);/**
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 WC=[["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"}]],GC=Be("panel-right-close",WC);/**
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 VC=[["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"}]],YC=Be("panel-right-open",VC);/**
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 XC=[["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"}]],KC=Be("paperclip",XC);/**
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 JC=[["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"}]],ZC=Be("pencil",JC);/**
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 QC=[["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"}]],e2=Be("play",QC);/**
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 t2=[["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"}]],s2=Be("plug",t2);/**
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 i2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],n2=Be("plus",i2);/**
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 r2=[["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"}]],a2=Be("radio",r2);/**
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 o2=[["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"}]],l2=Be("refresh-cw",o2);/**
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 c2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],u2=Be("search",c2);/**
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 h2=[["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"}]],d2=Be("settings",h2);/**
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 f2=[["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"}]],p2=Be("sparkles",f2);/**
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 v2=[["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"}]],_2=Be("square-terminal",v2);/**
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 m2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],g2=Be("square",m2);/**
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 y2=[["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"}]],b2=Be("sun",y2);/**
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 S2=[["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"}]],w2=Be("tags",S2);/**
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 x2=[["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"}]],C2=Be("trash-2",x2);/**
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 E2=[["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"}]],k2=Be("triangle-alert",E2);/**
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 T2=[["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"}]],A2=Be("wand-sparkles",T2);/**
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 R2=[["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"}]],M2=Be("workflow",R2);/**
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 D2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],j2=Be("x",D2);/**
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 N2=[["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"}]],L2=Be("zap",N2);/**
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 O2=[["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"}]],B2=Be("zoom-in",O2);/**
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 H2=[["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"}]],z2=Be("zoom-out",H2),I2={ArrowDown:wx,ArrowLeft:Cx,ArrowRight:kx,ArrowUp:Mx,ArrowUpRight:Ax,BookOpen:jx,Brain:Lx,Check:Bx,ChevronDown:zx,ChevronRight:$x,Cloud:Yx,CloudOff:qx,CloudUpload:Gx,Code:Kx,Copy:Zx,CornerDownRight:eC,CornerLeftUp:sC,ExternalLink:aC,FlaskConical:lC,Folder:uC,Frame:dC,Hammer:pC,History:_C,ImageUp:gC,Info:bC,LayoutTemplate:wC,List:kC,ListChecks:CC,Loader:AC,LogOut:MC,Maximize2:jC,Menu:LC,MessageSquare:BC,Minimize2:zC,MoreHorizontal:nC,Moon:$C,PanelLeftClose:UC,PanelLeftOpen:qC,PanelRightClose:GC,PanelRightOpen:YC,Paperclip:KC,Pencil:ZC,Play:e2,Plug:s2,Plus:n2,Radio:a2,RefreshCw:l2,Search:u2,Settings:d2,Sparkles:p2,Square:g2,SquareTerminal:_2,Sun:b2,Tags:w2,Trash2:C2,TriangleAlert:k2,Wand2:A2,Workflow:M2,X:j2,Zap:L2,ZoomIn:B2,ZoomOut:z2};function me({name:s,size:t=16}){const n=I2[s]??Ux;return h.jsx(n,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}function Kc(){return h.jsx("span",{className:"canvas-run-stub-chip","data-testid":"canvas-run-stub-chip","data-tooltip":"Capability calls in this step were served by stubs (offline run) — not real calls",children:"stubbed"})}function vy({step:s}){const t=px(s);return t.length===0?null:h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-links",children:[h.jsx("h4",{children:"Links"}),h.jsx("div",{className:"canvas-links-list",children:t.map(({url:n,kind:a})=>a==="image"?h.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:h.jsx("img",{src:n,alt:"",className:"canvas-link-thumb",loading:"lazy"})},n):h.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-item","data-testid":"canvas-link-other",children:[h.jsx(me,{name:"ExternalLink",size:12}),h.jsx("span",{className:"canvas-link-url",children:"Open"})]},n))})]})}function _y({step:s}){return!s.calls||s.calls.length===0?null:h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-capability-calls",children:[h.jsx("h4",{children:"Capability calls"}),h.jsx("div",{className:"canvas-capability-calls",children:s.calls.map((t,n)=>h.jsxs("div",{className:"canvas-capability-call",children:[h.jsxs("div",{className:"canvas-capability-call-head",children:[h.jsx("code",{className:"canvas-input-field",children:t.capability}),t.stubUsed&&h.jsx("span",{className:"canvas-run-stub-chip","data-testid":`canvas-call-stub-chip-${t.capability}`,children:"stubbed"})]}),t.result!==void 0&&h.jsxs("details",{className:"canvas-run-logs canvas-capability-call-result","data-testid":`canvas-call-result-${t.capability}`,children:[h.jsx("summary",{children:"Result"}),h.jsx("pre",{children:Bo(t.result)})]})]},`${t.capability}-${n}`))})]})}function Zf({run:s}){const t=lx(s);return t?h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-stub-notice",children:[h.jsx("h4",{children:"Stub notices"}),t.unusedStubs&&h.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-unused",children:[h.jsx("span",{className:"canvas-input-label",children:"Unused stubs"}),h.jsx("p",{className:"canvas-stub-notice-hint",children:"Supplied but matched no capability call — likely a typo or wrong path."}),h.jsx("ul",{className:"canvas-detail-warnings",children:t.unusedStubs.map(n=>h.jsxs("li",{children:[h.jsx("code",{className:"canvas-input-field",children:n.key})," in ",n.step]},`${n.step} ${n.key}`))})]}),t.stubWarnings&&h.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-warnings",children:[h.jsx("span",{className:"canvas-input-label",children:"Stub warnings"}),h.jsx("p",{className:"canvas-stub-notice-hint",children:"Matched a call but had the wrong shape."}),h.jsx("ul",{className:"canvas-detail-warnings",children:t.stubWarnings.map(n=>h.jsx("li",{children:n},n))})]})]}):null}function Jc(s,t){return(s==null?void 0:s.steps.find(n=>n.name===t))??null}function my(s){return s?`${s} run`:"run"}function Zc({status:s}){return s==="passed"?h.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:h.jsx(me,{name:"Check",size:11})}):s==="failed"?h.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:h.jsx(me,{name:"X",size:11})}):s==="running"?h.jsx("span",{className:"canvas-run-status is-running","data-status":"running","aria-label":"running"}):h.jsx("span",{className:"canvas-run-status is-pending","data-status":"pending","aria-label":"pending"})}function nc(s){return s.kind==="branching"?"branch":s.kind==="cross"?"pause resume":s.kind==="launch"?"launch":null}function gy({node:s}){const t=To(s);return t.length===0?null:h.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-input-${s.id}`,children:[h.jsx("span",{className:"canvas-input-label",children:"Input"}),h.jsx("span",{className:"canvas-input-fields",children:t.map(n=>h.jsxs("code",{className:"canvas-input-field"+(n.required?" is-required":""),"aria-label":`${n.name}, ${n.type}${n.required?", required":""}`,children:[n.name,n.required&&h.jsx("span",{"aria-hidden":"true",children:"*"}),h.jsx("span",{className:"canvas-input-type",children:n.type})]},n.name))})]})}function yy({node:s}){return s.capabilities.length===0?null:h.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-capabilities-${s.id}`,children:[h.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),h.jsx("span",{className:"canvas-input-fields",children:s.capabilities.map(t=>h.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:t},t))})]})}function $2({graph:s,node:t}){const n=s.edges.filter(v=>v.from===t.id),a=s.edges.filter(v=>v.to===t.id);if(n.length===0&&a.length===0)return null;const l=v=>{var c;return((c=s.nodes.find(u=>u.id===v))==null?void 0:c.label)??v},d=(v,c,u)=>{const p=`${u}${v.from}->${v.to}`;return h.jsxs("div",{className:"canvas-step-transition",children:[h.jsx(me,{name:u,size:12}),h.jsx("span",{className:"canvas-step-transition-target",children:l(c)}),v.label&&h.jsx("span",{className:"canvas-step-transition-cond",children:v.label})]},p)};return h.jsxs(h.Fragment,{children:[n.map(v=>d(v,v.to,"CornerDownRight")),a.map(v=>d(v,v.from,"CornerLeftUp"))]})}function P2(s,t){return s.kind!=="launched-workflow"?null:t.find(n=>n.path===s.label)??t.find(n=>n.name===s.label)??t.find(n=>n.path.endsWith(`/${s.label}`))??null}function Qf({node:s,workflows:t,onOpenWorkflow:n}){const a=P2(s,t);return a?h.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${s.id}`,"data-tooltip":`Switch to ${a.name}`,onClick:()=>n(a.path),children:["Open workflow ",h.jsx(me,{name:"ArrowRight",size:12})]}):null}function Eg({run:s,target:t}){return h.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-run-fallback",children:[h.jsxs("div",{className:"canvas-steps-label",children:["Run steps",h.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:my(t)})]}),s.steps.map((n,a)=>{const l=[n.latencyMs!==void 0?vr(n.latencyMs):null].filter(d=>d!==null);return h.jsxs("div",{className:"canvas-step-item",children:[h.jsxs("div",{className:"canvas-step-row is-static","data-testid":`canvas-run-step-${n.name}`,children:[h.jsx("span",{className:"canvas-step-index",children:String(a+1).padStart(2,"0")}),h.jsx(Zc,{status:n.status}),h.jsxs("span",{className:"canvas-step-copy",children:[h.jsx("span",{className:"canvas-step-name",children:n.name}),h.jsx("span",{className:"canvas-step-role",children:n.status})]}),Xc(s,n.name)&&h.jsx(Kc,{}),h.jsx("span",{className:"canvas-step-meta",children:l.join(" · ")}),h.jsx("span",{"aria-hidden":"true"})]}),(n.error||n.logSlice)&&h.jsxs("div",{className:"canvas-step-expand",children:[n.error&&h.jsx("pre",{className:"canvas-run-error",children:n.error}),n.logSlice&&h.jsxs("details",{className:"canvas-run-logs",children:[h.jsx("summary",{children:"Logs"}),h.jsx("pre",{children:n.logSlice})]})]})]},n.id)}),h.jsx(Zf,{run:s}),h.jsx("p",{className:"canvas-empty-hint",children:"Run data only. Open the Canvas tab for the diagram — transitions and contracts come from the workflow."})]})}function U2({graph:s,run:t,runTarget:n,workflows:a,onOpenWorkflow:l,expandedId:d,onToggle:v,onOpenDetail:c}){const u=new Set(s.nodes.map(w=>w.id)),p=s.groups.filter(w=>w.nodeIds.length>0&&w.nodeIds.every(E=>u.has(E))),y=w=>{var E;return((E=p.find(A=>A.nodeIds.includes(w)))==null?void 0:E.label)??null},f=[];return s.nodes.forEach((w,E)=>{const A=y(w.id),C=f[f.length-1];C&&C.group===A?C.nodes.push({node:w,index:E}):f.push({group:A,nodes:[{node:w,index:E}]})}),h.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-steps-list",children:[h.jsxs("div",{className:"canvas-steps-label",children:["Steps",t&&h.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:my(n)})]}),f.map((w,E)=>h.jsxs("div",{className:w.group?"canvas-step-band":void 0,children:[w.group&&h.jsx("div",{className:"canvas-step-group",children:w.group}),w.nodes.map(({node:A,index:C})=>{const b=d===A.id,S=ix(A,s.edges),_=Jc(t,A.id),g=_?[_.latencyMs!==void 0?vr(_.latencyMs):null].filter(T=>T!==null):[];return h.jsxs("div",{className:"canvas-step-item"+(b?" is-open":""),children:[h.jsxs("button",{className:"canvas-step-row","data-testid":`canvas-step-row-${A.id}`,"aria-expanded":b,onClick:()=>v(A.id),children:[h.jsx("span",{className:"canvas-step-index",children:String(C+1).padStart(2,"0")}),_?h.jsx(Zc,{status:_.status}):h.jsx("span",{className:"canvas-step-dot dot--"+A.kind,"aria-hidden":"true"}),h.jsxs("span",{className:"canvas-step-copy",children:[h.jsx("span",{className:"canvas-step-name",children:A.label}),h.jsx("span",{className:"canvas-step-role",children:A.role})]}),_&&Xc(t,A.id)&&h.jsx(Kc,{}),h.jsx("span",{className:"canvas-step-meta",children:(g.length>0?g:S).join(" · ")}),h.jsx("span",{className:"canvas-step-caret"+(b?" is-open":""),"aria-hidden":"true",children:h.jsx(me,{name:"ChevronDown",size:13})})]}),b&&h.jsxs("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${A.id}`,children:[A.description&&h.jsx("p",{className:"canvas-step-desc",children:A.description}),h.jsx(gy,{node:A}),h.jsx(yy,{node:A}),h.jsx($2,{graph:s,node:A}),h.jsx(Qf,{node:A,workflows:a,onOpenWorkflow:l}),h.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-step-open-${A.id}`,onClick:()=>c(A.id),children:["Full details ",h.jsx(me,{name:"ArrowRight",size:12})]})]})]},A.id)})]},`${w.group??"ungrouped"}-${E}`))]})}function F2({graph:s,node:t,run:n,workflows:a,onOpenWorkflow:l}){const d=Jc(n,t.id),v=s.edges.filter(y=>y.from===t.id),c=s.edges.filter(y=>y.to===t.id),u=y=>{var f;return((f=s.nodes.find(w=>w.id===y))==null?void 0:f.label)??y},p=s.groups.filter(y=>y.nodeIds.includes(t.id));return h.jsx("div",{className:"canvas-detail","data-testid":"canvas-step-detail",children:h.jsxs("div",{className:"canvas-detail-body",children:[t.role&&h.jsx("p",{className:"canvas-detail-role",children:t.role}),t.description&&h.jsx("p",{className:"canvas-detail-desc",children:t.description}),p.length>0&&h.jsxs("p",{className:"canvas-detail-groups",children:["Part of ",p.map(y=>y.label).join(", ")]}),h.jsx(Qf,{node:t,workflows:a,onOpenWorkflow:l}),d&&h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-run",children:[h.jsx("h4",{children:"Last run"}),h.jsxs("div",{className:"canvas-detail-contract",children:[h.jsx("span",{className:"canvas-input-label",children:"Status"}),h.jsxs("span",{className:"canvas-run-text is-"+d.status,children:[h.jsx(Zc,{status:d.status}),d.status,Xc(n,t.id)&&h.jsx(Kc,{})]})]}),d.latencyMs!==void 0&&h.jsxs("div",{className:"canvas-detail-contract",children:[h.jsx("span",{className:"canvas-input-label",children:"Duration"}),h.jsx("span",{className:"canvas-detail-timeout",children:vr(d.latencyMs)})]}),d.input!==void 0&&h.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-detail-run-input-${t.id}`,children:[h.jsx("summary",{children:"Input"}),h.jsx("pre",{children:Bo(d.input)})]}),d.output!==void 0&&h.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-detail-run-output-${t.id}`,children:[h.jsx("summary",{children:"Output"}),h.jsx("pre",{children:Bo(d.output)})]}),d.error&&h.jsx("pre",{className:"canvas-run-error",children:d.error}),d.logSlice&&h.jsxs("details",{className:"canvas-run-logs",children:[h.jsx("summary",{children:"Logs"}),h.jsx("pre",{children:d.logSlice})]})]}),d&&h.jsx(_y,{step:d}),d&&h.jsx(vy,{step:d}),h.jsx(Zf,{run:n}),(To(t).length>0||t.timeoutMs!==null||t.capabilities.length>0)&&h.jsxs("section",{className:"canvas-detail-section",children:[h.jsx("h4",{children:"Contract"}),t.capabilities.length>0&&h.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-capabilities",children:[h.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),h.jsx("span",{className:"canvas-input-fields",children:t.capabilities.map(y=>h.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:y},y))})]}),To(t).length>0&&h.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-input",children:[h.jsx("span",{className:"canvas-input-label",children:"Input"}),h.jsx("span",{className:"canvas-input-fields",children:To(t).map(y=>h.jsxs("code",{className:"canvas-input-field"+(y.required?" is-required":""),"aria-label":`${y.name}, ${y.type}${y.required?", required":""}`,"data-tooltip":y.required?"Required field":"Optional field",children:[y.name,y.required&&h.jsx("span",{"aria-hidden":"true",children:"*"}),h.jsx("span",{className:"canvas-input-type",children:y.type})]},y.name))})]}),t.timeoutMs!==null&&h.jsxs("div",{className:"canvas-detail-contract",children:[h.jsx("span",{className:"canvas-input-label",children:"Timeout"}),h.jsx("span",{className:"canvas-detail-timeout",children:vr(t.timeoutMs)})]})]}),h.jsxs("section",{className:"canvas-detail-section",children:[h.jsxs("h4",{children:["Leads to ",h.jsx("span",{className:"canvas-detail-count",children:v.length})]}),v.length===0?h.jsx("p",{className:"canvas-detail-empty",children:"Terminal step: nothing follows."}):h.jsx("ul",{className:"canvas-detail-edges",children:v.map(y=>h.jsx("li",{children:h.jsxs("div",{className:"canvas-detail-edge",children:[h.jsx(me,{name:"CornerDownRight",size:13}),h.jsx("span",{className:"canvas-detail-edge-target",children:u(y.to)}),nc(y)&&h.jsx("span",{className:"canvas-detail-edge-kind",children:nc(y)}),y.label&&h.jsx("span",{className:"canvas-detail-edge-cond",children:y.label})]})},`${y.from}->${y.to}`))})]}),h.jsxs("section",{className:"canvas-detail-section",children:[h.jsxs("h4",{children:["Reached from ",h.jsx("span",{className:"canvas-detail-count",children:c.length})]}),c.length===0?h.jsx("p",{className:"canvas-detail-empty",children:t.kind==="entry"?"Entry point: the workflow starts here.":"No step routes here."}):h.jsx("ul",{className:"canvas-detail-edges",children:c.map(y=>h.jsx("li",{children:h.jsxs("div",{className:"canvas-detail-edge",children:[h.jsx(me,{name:"CornerLeftUp",size:13}),h.jsx("span",{className:"canvas-detail-edge-target",children:u(y.from)}),nc(y)&&h.jsx("span",{className:"canvas-detail-edge-kind",children:nc(y)}),y.label&&h.jsx("span",{className:"canvas-detail-edge-cond",children:y.label})]})},`${y.from}->${y.to}`))})]}),s.warnings.length>0&&h.jsxs("section",{className:"canvas-detail-section",children:[h.jsxs("h4",{children:["Graph warnings ",h.jsx("span",{className:"canvas-detail-count",children:s.warnings.length})]}),h.jsx("ul",{className:"canvas-detail-warnings",children:s.warnings.map(y=>h.jsx("li",{children:y},y))})]})]})})}function q2({node:s,run:t,workflows:n,onOpenWorkflow:a}){const l=Jc(t,s.id);return h.jsxs("div",{className:"canvas-inspector","data-testid":"canvas-step-inspector",children:[s.role&&h.jsx("p",{className:"canvas-detail-role",children:s.role}),s.description&&h.jsx("p",{className:"canvas-step-desc",children:s.description}),h.jsx(gy,{node:s}),h.jsx(yy,{node:s}),s.timeoutMs!==null&&h.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-inspector-timeout-${s.id}`,children:[h.jsx("span",{className:"canvas-input-label",children:"Timeout"}),h.jsx("span",{className:"canvas-detail-timeout",children:vr(s.timeoutMs)})]}),h.jsx(Qf,{node:s,workflows:n,onOpenWorkflow:a}),l&&h.jsxs("div",{className:"canvas-inspector-run","data-testid":"canvas-inspector-run",children:[h.jsx("span",{className:"canvas-input-label",children:"Last run"}),h.jsxs("span",{className:"canvas-run-text is-"+l.status,children:[h.jsx(Zc,{status:l.status}),l.status,Xc(t,s.id)&&h.jsx(Kc,{})]}),l.latencyMs!==void 0&&h.jsx("span",{className:"canvas-inspector-run-meta",children:vr(l.latencyMs)})]}),(l==null?void 0:l.input)!==void 0&&h.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-inspector-run-input-${s.id}`,children:[h.jsx("summary",{children:"Input"}),h.jsx("pre",{children:Bo(l.input)})]}),(l==null?void 0:l.output)!==void 0&&h.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-inspector-run-output-${s.id}`,children:[h.jsx("summary",{children:"Output"}),h.jsx("pre",{children:Bo(l.output)})]}),(l==null?void 0:l.error)&&h.jsx("pre",{className:"canvas-run-error",children:l.error}),(l==null?void 0:l.logSlice)&&h.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-inspector-run-logs-${s.id}`,children:[h.jsx("summary",{children:"Logs"}),h.jsx("pre",{children:l.logSlice})]}),l&&h.jsx(_y,{step:l}),l&&h.jsx(vy,{step:l}),h.jsx(Zf,{run:t})]})}function W2({node:s,run:t,onInjectPrompt:n,onClose:a}){const l=s?Jc(t,s.id):null,[d,v]=U.useState("");function c(p){var E;if(!s){n(p);return}const y=l?{input:l.input,output:l.output,calls:l.calls,unusedStubs:(E=t==null?void 0:t.unusedStubs)==null?void 0:E.map(A=>A.key),stubWarnings:t==null?void 0:t.stubWarnings}:void 0,f=s.capabilities.length>0?{capabilities:s.capabilities}:void 0,w=ux(l??{id:s.id,name:s.id,status:"pending"},y,f);n(`${w}
417
-
418
- ${p}`)}function u(){const p=d.trim();p&&(c(p),v(""))}return h.jsxs("div",{className:"canvas-chat-panel","data-testid":"canvas-chat-panel",children:[h.jsxs("div",{className:"canvas-chat-head",children:[h.jsx("span",{className:"canvas-chat-title","data-testid":"canvas-chat-title",children:s?`Chat · ${s.label}`:"Chat"}),h.jsx("button",{className:"theme-toggle canvas-chat-close","data-testid":"canvas-chat-close","aria-label":"Close chat","data-tooltip":"Close chat",onClick:a,children:h.jsx(me,{name:"X",size:13})})]}),h.jsxs("div",{className:"canvas-inspector-macros","data-testid":"canvas-inspector-macros",children:[s&&h.jsxs(h.Fragment,{children:[h.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-slow",onClick:()=>c("Why is this step slow / stuck?"),children:"Why slow / stuck?"}),h.jsx("button",{className:"canvas-inspector-macro-btn "+((l==null?void 0:l.status)==="failed"?"btn-primary":"btn-ghost"),"data-testid":"canvas-macro-debug",onClick:()=>c("Debug this step"),children:"Debug this step"}),h.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-explain",onClick:()=>c("Explain this step"),children:"Explain this step"})]}),h.jsxs("div",{className:"canvas-inspector-freeform",children:[h.jsx("textarea",{className:"canvas-inspector-freeform-input","data-testid":"canvas-freeform-input",placeholder:s?"Ask about this step…":"Ask about this workflow…",rows:2,value:d,onChange:p=>v(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.metaKey||p.ctrlKey)&&(p.preventDefault(),u())}}),h.jsx("button",{className:"btn-primary canvas-inspector-freeform-ask","data-testid":"canvas-freeform-ask",disabled:!d.trim(),onClick:u,children:"Ask"})]})]})]})}const kg=24;function G2({overview:s,selectedNode:t,graph:n,run:a,workflows:l,onOpenWorkflow:d,onOpenSteps:v,onDeselect:c,onCollapse:u}){const p=U.useRef(null),y=U.useRef(null),f=U.useRef(null),w=U.useRef(null),E=U.useRef(Mi().canvasInspectorHeight??null),[A,C]=U.useState(null),[b,S]=U.useState(!1),_=()=>{var I;const B=(I=p.current)==null?void 0:I.parentElement;return B?Math.round(B.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},g=()=>{var B;return(((B=y.current)==null?void 0:B.offsetHeight)??40)+1},T=U.useCallback(()=>{const B=y.current,I=f.current,q=w.current;if(!B||!I||!q)return;const $=_(),J=E.current,ee=window.getComputedStyle(I),W=(parseFloat(ee.paddingTop)||0)+(parseFloat(ee.paddingBottom)||0),G=B.offsetHeight+q.offsetHeight+W+1,Y=J!=null?Math.min(Math.max(J,g()),$):Math.min(G,$);C(Y)},[]);U.useLayoutEffect(T),U.useEffect(()=>{var q;if(typeof ResizeObserver>"u")return;const B=new ResizeObserver(T),I=(q=p.current)==null?void 0:q.parentElement;return I&&B.observe(I),w.current&&B.observe(w.current),()=>B.disconnect()},[T]);const R=B=>{E.current=Math.round(Math.min(Math.max(B,g()),_())),T()},M=()=>{la({canvasInspectorHeight:E.current})},j=()=>{E.current=null,la({canvasInspectorHeight:null}),T()},k=B=>{if(B.button!==0)return;const I=B.currentTarget,q=p.current;if(!q)return;try{I.setPointerCapture(B.pointerId)}catch{}S(!0);const $=B.clientY,J=q.getBoundingClientRect().height,ee=G=>{R(J+($-G.clientY))},W=()=>{S(!1),M(),window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",W),window.removeEventListener("pointercancel",W)};window.addEventListener("pointermove",ee),window.addEventListener("pointerup",W),window.addEventListener("pointercancel",W)},D=B=>{var q;const I=((q=p.current)==null?void 0:q.getBoundingClientRect().height)??0;B.key==="ArrowUp"?(B.preventDefault(),R(I+kg),M()):B.key==="ArrowDown"?(B.preventDefault(),R(I-kg),M()):B.key==="Home"&&(B.preventDefault(),j())};return h.jsxs("div",{ref:p,className:"canvas-overview"+(b?" is-resizing":"")+(t?" is-inspecting":""),"data-testid":"canvas-overview",style:A!=null?{height:A}:void 0,children:[h.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:k,onDoubleClick:j,onKeyDown:D}),h.jsx("div",{ref:y,className:"canvas-overview-head",children:t?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"canvas-step-dot dot--"+t.kind,"aria-hidden":"true"}),h.jsx("span",{className:"canvas-overview-title","data-testid":"canvas-inspector-title",children:t.label}),h.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:dy(t.kind)}),h.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:v,children:["Open step ",h.jsx(me,{name:"ArrowRight",size:12})]}),h.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-inspector-close","aria-label":"Back to the workflow overview","data-tooltip":"Back to the workflow overview (Esc)",onClick:c,children:h.jsx(me,{name:"X",size:13})})]}):h.jsxs(h.Fragment,{children:[h.jsx(me,{name:"Radio",size:13}),"Overview",h.jsx("span",{className:"canvas-overview-stats",children:((s==null?void 0:s.stats)??"").split("·").map(B=>{const I=B.trim();if(!I)return null;const q=I.indexOf(" "),$=q===-1?I:I.slice(0,q),J=q===-1?"":I.slice(q+1);return h.jsxs("span",{className:"canvas-overview-stat",children:[h.jsx("strong",{children:$})," ",J]},I)})}),h.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-overview-toggle","aria-label":"Collapse workflow overview","data-tooltip":"Collapse workflow overview",onClick:u,children:h.jsx(me,{name:"X",size:13})})]})}),h.jsx("div",{ref:f,className:"canvas-overview-body",children:h.jsx("div",{ref:w,className:"canvas-overview-content",children:t&&n?h.jsx(q2,{graph:n,node:t,run:a,workflows:l,onOpenWorkflow:d}):s&&h.jsxs(h.Fragment,{children:[s.description&&h.jsx("p",{className:"canvas-overview-desc",children:s.description}),s.notes.length>0&&h.jsx("ul",{className:"canvas-overview-notes",children:s.notes.map(B=>h.jsx("li",{children:B},B))}),h.jsxs("div",{className:"canvas-legend-row","aria-hidden":"true",children:[h.jsxs("span",{children:[h.jsx("span",{className:"dot dot--entry"}),"entry / active step"]}),h.jsxs("span",{children:[h.jsx("span",{className:"dot dot--step"}),"step"]}),h.jsxs("span",{children:[h.jsx("span",{className:"dot dot--terminal"}),"terminal"]})]})]})})})]})}function fi({eyebrow:s,icon:t,title:n,body:a,cta:l,className:d,testId:v,children:c}){return h.jsxs("div",{className:"empty-state"+(d?` ${d}`:""),"data-empty-state":!0,"data-testid":v,children:[t&&h.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:h.jsx(me,{name:t,size:18})}),s&&h.jsx("span",{className:"empty-state-eyebrow",children:s}),h.jsx("span",{className:"empty-state-title",children:n}),a&&h.jsx("span",{className:"empty-state-body",children:a}),l&&h.jsx("span",{className:"empty-state-cta",children:l}),c]})}function by(s,t=Date.now()){const n=Math.max(0,Math.round((t-s)/1e3));if(n<45)return"just now";const a=Math.round(n/60);if(a<60)return`${a}m ago`;const l=Math.round(a/60);return l<24?`${l}h ago`:`${Math.round(l/24)}d ago`}var V2=ly();function ga(s,{onDismiss:t,containerRef:n,triggerRef:a}){U.useEffect(()=>{if(!s)return;const l=v=>{var u;const c=n.current;!c||!(v.target instanceof Node)||c.contains(v.target)||(u=a==null?void 0:a.current)!=null&&u.contains(v.target)||t()},d=v=>{var c;v.key==="Escape"&&(t(),(c=a==null?void 0:a.current)==null||c.focus())};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d)}},[s,t,n,a])}const uo=4,wi=8;function Y2(s,t,n){const a=s.getBoundingClientRect(),l={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto",overflowY:"auto"};return n&&(l.width=a.width),l.maxWidth=window.innerWidth-2*wi,t.startsWith("right")?(l.left=a.right+uo,t.endsWith("start")?(l.top=a.top,l.maxHeight=window.innerHeight-a.top-wi):(l.bottom=window.innerHeight-a.bottom,l.maxHeight=a.bottom-wi),l):(t.startsWith("down")?(l.top=a.bottom+uo,l.maxHeight=window.innerHeight-a.bottom-uo-wi):(l.bottom=window.innerHeight-a.top+uo,l.maxHeight=a.top-uo-wi),t.endsWith("start")?l.left=Math.max(wi,a.left):l.right=Math.max(wi,window.innerWidth-a.right),l)}function cn({open:s,anchorRef:t,onDismiss:n,placement:a,matchWidth:l=!1,className:d,role:v,testid:c,children:u}){const p=U.useRef(null),[y,f]=U.useState(null);ga(s,{onDismiss:n,containerRef:p,triggerRef:t});const w=U.useCallback(()=>{const E=t.current;E&&f(Y2(E,a,l))},[t,a,l]);return U.useLayoutEffect(()=>{s?w():f(null)},[s,w]),U.useLayoutEffect(()=>{if(!s||y==null)return;const E=p.current;if(!E)return;const A=E.getBoundingClientRect();let C=0;A.left<wi?C=wi-A.left:A.right>window.innerWidth-wi&&(C=window.innerWidth-wi-A.right),!(Math.abs(C)<.5)&&f(b=>b==null?b:{...b,left:typeof b.left=="number"?b.left+C:b.left,right:typeof b.right=="number"?b.right-C:b.right})},[s,y]),U.useEffect(()=>{if(s)return window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0)}},[s,w]),!s||y==null?null:V2.createPortal(h.jsx("div",{ref:p,className:d,role:v,"data-testid":c,style:y,children:u}),document.body)}function X2(s,t){return`${t?`${t} run`:"run"} ${s.status}`}function K2({workflow:s,detailStep:t,onBack:n,onAskAgent:a,surface:l,stepsSummary:d,run:v,runTarget:c,runs:u,onSelectRun:p}){const[y,f]=U.useState(!1),w=U.useRef(null),E=U.useCallback(()=>f(!1),[]),[A,C]=U.useState(!1),b=U.useRef(null),S=U.useCallback(()=>C(!1),[]);if(t)return h.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",children:[h.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:h.jsx(me,{name:"ArrowLeft",size:14})}),h.jsx("span",{className:"workflow-actions-name","data-testid":"canvas-detail-title",children:t.label}),h.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:dy(t.kind)}),h.jsxs("button",{className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","aria-label":"Ask agent","data-tooltip":"Sends the request to the agent in the terminal",onClick:()=>a(`Walk me through the "${t.label}" step of this workflow: what it does, its inputs and outputs, and its transitions.`),children:[h.jsx(me,{name:"MessageSquare",size:13}),h.jsx("span",{className:"canvas-detail-ask-label",children:"Ask agent"})]}),h.jsxs("div",{className:"canvas-detail-menu-wrap",children:[h.jsx("button",{ref:w,className:"theme-toggle","data-testid":"canvas-detail-menu","aria-label":`More actions for ${t.label}`,"data-tooltip":"More actions","aria-haspopup":"menu","aria-expanded":y,onClick:()=>f(_=>!_),children:h.jsx(me,{name:"MoreHorizontal",size:14})}),h.jsxs(cn,{open:y,anchorRef:w,onDismiss:E,placement:"down-end",className:"canvas-detail-menu",role:"menu",testid:"canvas-detail-menu-popover",children:[h.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{a(`Modify the "${t.label}" step of this workflow. Show me the step's code first, then propose the change.`),E()},children:[h.jsx(me,{name:"Wand2",size:13}),"Ask agent to modify"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var _;(_=navigator.clipboard)==null||_.writeText(t.label).catch(()=>{}),E()},children:[h.jsx(me,{name:"Copy",size:13}),"Copy step name"]})]})]})]});if(l==="steps"){const _=v&&h.jsxs(h.Fragment,{children:[v.status==="running"&&h.jsx("span",{className:"canvas-run-status is-running","aria-hidden":"true"}),X2(v,c)]});return h.jsxs("div",{className:"workflow-actions-header"+(v?" has-run":""),"data-testid":"workflow-actions-header",children:[h.jsx("span",{className:"workflow-actions-name",children:s.name}),h.jsx("span",{className:"workflow-actions-count","data-testid":"canvas-steps-count",children:d??"no steps"}),v&&u.length<=1&&h.jsx("span",{className:"status-tag canvas-run-chip is-"+v.status,"data-testid":"canvas-run-chip",children:_}),v&&u.length>1&&h.jsxs("div",{className:"canvas-run-picker-wrap",children:[h.jsxs("button",{ref:b,className:"status-tag status-tag-action canvas-run-chip canvas-run-chip--picker is-"+v.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:()=>C(g=>!g),children:[_,h.jsx(me,{name:"ChevronDown",size:12})]}),h.jsx(cn,{open:A,anchorRef:b,onDismiss:S,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...u].reverse().map((g,T)=>{const R=u.length-T,M=g.run.executionId===v.executionId,j=by(g.observedAt);return h.jsxs("button",{role:"menuitemradio","aria-checked":M,className:"profile-menu-item"+(M?" is-selected":""),"data-testid":`canvas-run-option-${g.run.executionId}`,title:g.run.executionId,onClick:()=>{p(g.run.executionId),S()},children:[h.jsx(me,{name:M?"Check":"Play",size:13}),h.jsx("span",{children:`run ${R} · ${g.run.status} · ${g.target}`}),h.jsx("span",{className:"canvas-run-option-meta",children:j})]},g.run.executionId)})})]})]})}return null}const J2=4e3;function Z2({sessionId:s,lastMessage:t,boundWorkflow:n,noSessionAgent:a=null,overviewActive:l,sessionExited:d,expanded:v,onToggleExpanded:c,macros:u,tasks:p,onRunMacro:y,onInjectPrompt:f,surface:w,onOpenSteps:E,run:A,runTarget:C,runs:b,onSelectRun:S,workflows:_,onOpenWorkflow:g}){const[T,R]=U.useState(!1),[M,j]=U.useState(0),[k,D]=U.useState(Kf()),[B,I]=U.useState(!1),[q,$]=U.useState(!0),[J,ee]=U.useState(!1),W=U.useRef(null),G=U.useRef(null),Y=U.useRef(0),O=U.useCallback(()=>{$(!1),ee(!0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>ee(!1),360)},[]),F=()=>{const oe=Y.current-Date.now();G.current&&clearTimeout(G.current),oe>0?G.current=setTimeout(O,oe):O()};U.useEffect(()=>()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current)},[]),U.useEffect(()=>{if(!q)return;const oe=window.setTimeout(O,J2);return()=>window.clearTimeout(oe)},[q,O]);const[L,P]=U.useState(1),[V,te]=U.useState({x:0,y:0}),[de,ge]=U.useState(!1),K=U.useRef(null),z=U.useRef(null),[ie,Q]=U.useState(.25),we=oe=>Math.min(3,Math.max(ie,Math.round(oe*100)/100)),[fe,Le]=U.useState(null),ze=U.useRef(!1),[We,Ge]=U.useState({zoom:1,x:0,y:0}),De=U.useCallback(()=>{const oe=K.current;if(!fe||!oe)return null;const Ae=oe.getBoundingClientRect();if(Ae.width<80||Ae.height<80)return null;const je=Ae.width-fe.insetX*2,ht=Ae.height-fe.insetTop-fe.insetBottom;if(je<=0||ht<=0)return null;const qe=Math.min(1,je/fe.width,ht/fe.height);return{zoom:Math.max(.1,Math.round(qe*100)/100),x:0,y:0}},[fe]),dt=U.useCallback(()=>{let oe=12;const Ae=()=>{const je=De();if(je){Q(Math.min(.25,je.zoom)),ze.current=!1,P(je.zoom),te({x:je.x,y:je.y}),Ge(je);return}if(fe&&oe-- >0){requestAnimationFrame(Ae);return}Q(.25),ze.current=!1,P(1),te({x:0,y:0}),Ge({zoom:1,x:0,y:0})};Ae()},[De,fe]);U.useEffect(()=>{!fe||ze.current||dt()},[fe,dt]),U.useEffect(()=>{const oe=K.current;if(!oe||typeof ResizeObserver>"u")return;const Ae=new ResizeObserver(()=>{ze.current||dt()});return Ae.observe(oe),()=>Ae.disconnect()},[dt]),U.useEffect(()=>{var je,ht,qe;(ht=(je=z.current)==null?void 0:je.contentWindow)==null||ht.postMessage({type:"sapiom-canvas:view",zoom:L,x:V.x,y:V.y},"*");const oe=ut.current,Ae=z.current;if(oe&&Ae){const ks=Ae.getBoundingClientRect();(qe=Ae.contentWindow)==null||qe.postMessage({type:"sapiom-canvas:hover",x:oe.x-ks.left,y:oe.y-ks.top},"*")}},[L,V]),U.useEffect(()=>{const oe=K.current;if(!oe)return;const Ae=je=>{je.preventDefault(),ze.current=!0,P(ht=>we(ht*(je.deltaY<0?1.1:1/1.1)))};return oe.addEventListener("wheel",Ae,{passive:!1}),()=>oe.removeEventListener("wheel",Ae)});const At=oe=>{var ht,qe;const Ae=z.current;if(!Ae)return;const je=Ae.getBoundingClientRect();if(typeof oe.clientX=="number"&&typeof oe.clientY=="number"){const{clientX:ks,clientY:Fs,...ei}=oe;(ht=Ae.contentWindow)==null||ht.postMessage({...ei,x:ks-je.left,y:Fs-je.top},"*");return}(qe=Ae.contentWindow)==null||qe.postMessage(oe,"*")},[qt,jt]=U.useState(!1),Nt=U.useRef(!1),ct=U.useRef(0),ut=U.useRef(null),es=oe=>{if(ut.current={x:oe.clientX,y:oe.clientY},de)return;const{clientX:Ae,clientY:je}=oe;cancelAnimationFrame(ct.current),ct.current=requestAnimationFrame(()=>{At({type:"sapiom-canvas:hover",clientX:Ae,clientY:je})})},Yt=()=>{cancelAnimationFrame(ct.current),ut.current=null,jt(!1),Nt.current=!1,At({type:"sapiom-canvas:hover",x:-1,y:-1})},ts=oe=>{if(oe.button!==0)return;const Ae=oe.currentTarget;try{Ae.setPointerCapture(oe.pointerId)}catch{}ge(!0),At({type:"sapiom-canvas:press",clientX:oe.clientX,clientY:oe.clientY,down:!0});let je=!0;const ht=()=>{je&&(je=!1,At({type:"sapiom-canvas:press",down:!1}))};let qe=oe.clientX,ks=oe.clientY;const Fs=oe.clientX,ei=oe.clientY,Ni=ds=>{const hn=ds.clientX-qe,is=ds.clientY-ks;qe=ds.clientX,ks=ds.clientY,(Math.abs(ds.clientX-Fs)>=4||Math.abs(ds.clientY-ei)>=4)&&(ht(),ze.current=!0),te(ba=>({x:ba.x+hn,y:ba.y+is}))},gi=ds=>{ge(!1),ht(),Ae.removeEventListener("pointermove",Ni),Ae.removeEventListener("pointerup",gi),Ae.removeEventListener("pointercancel",gi),Math.abs(ds.clientX-Fs)<4&&Math.abs(ds.clientY-ei)<4&&(At({type:"sapiom-canvas:pick",clientX:ds.clientX,clientY:ds.clientY}),Nt.current||Xt(null))};Ae.addEventListener("pointermove",Ni),Ae.addEventListener("pointerup",gi),Ae.addEventListener("pointercancel",gi)},[ot,Xt]=U.useState(null);U.useEffect(()=>{if(!v&&ot==null)return;const oe=Ae=>{Ae.key==="Escape"&&(ot!=null?Xt(null):c())};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[v,ot,c]);const[Wt,ss]=U.useState(!0),[nt,Ee]=U.useState(!1),[Ue,Lt]=U.useState(null),[mt,un]=U.useState(null),[Kt,ji]=U.useState(null),[Us,js]=U.useState(null),[mi,Cs]=U.useState(null);U.useEffect(()=>{const oe=Ae=>{var ht;const je=Ae.data;if(!(!je||Ae.source!==((ht=z.current)==null?void 0:ht.contentWindow))){if(je.type==="sapiom-canvas:overview")Lt({description:typeof je.description=="string"?je.description:"",stats:typeof je.stats=="string"?je.stats:"",notes:Array.isArray(je.notes)?je.notes.filter(qe=>typeof qe=="string"):[]});else if(je.type==="sapiom-canvas:graph")ji(ox(je.graph));else if(je.type==="sapiom-canvas:node"){const qe=je.id;typeof qe=="string"&&Xt(qe)}else if(je.type==="sapiom:node-click"){const qe=je.stepName;typeof qe=="string"&&ji(ks=>{if(ks){const Fs=ks.nodes.find(ei=>ei.label===qe)??ks.nodes.find(ei=>ei.id===qe)??null;Fs&&Xt(Fs.id)}return ks})}else if(je.type==="sapiom-canvas:hit"){const qe=typeof je.id=="string";jt(qe),Nt.current=qe}else if(je.type==="sapiom-canvas:size"){const qe=je;typeof qe.width=="number"&&qe.width>0&&typeof qe.height=="number"&&qe.height>0&&Le({width:qe.width,height:qe.height,insetTop:typeof qe.insetTop=="number"&&qe.insetTop>=0?qe.insetTop:0,insetBottom:typeof qe.insetBottom=="number"&&qe.insetBottom>=0?qe.insetBottom:0,insetX:typeof qe.insetX=="number"&&qe.insetX>=0?qe.insetX:0})}else if(je.type==="sapiom-canvas:error"){const qe=je;un({title:typeof qe.title=="string"?qe.title:"",reason:typeof qe.reason=="string"?qe.reason:""})}}};return window.addEventListener("message",oe),()=>window.removeEventListener("message",oe)},[]),U.useEffect(()=>{Lt(null),un(null),ji(null),js(null),Xt(null),Cs(null),ss(!0),jt(!1),Nt.current=!1,Le(null),P(1),te({x:0,y:0}),Ge({zoom:1,x:0,y:0}),ze.current=!1},[s,M]);const bs=Kt&&Us?Kt.nodes.find(oe=>oe.id===Us)??null:null,Ns=U.useRef(null);bs&&(Ns.current=bs),Kt||(Ns.current=null);const le=bs??Ns.current,_e=Kt&&ot?Kt.nodes.find(oe=>oe.id===ot)??null:null;U.useEffect(()=>{var oe,Ae;(Ae=(oe=z.current)==null?void 0:oe.contentWindow)==null||Ae.postMessage({type:"sapiom-canvas:select",id:Us??ot},"*")},[Us,ot]);const Ce=U.useCallback(()=>{var oe,Ae;!A||!C||!s||uy()||q||(Ae=(oe=z.current)==null?void 0:oe.contentWindow)==null||Ae.postMessage({type:"sapiom:run-state",steps:A.steps,status:A.status,target:C},"*")},[A,C,s,q]);U.useEffect(()=>{Ce()},[Ce]);const Se=Ue??void 0,[Oe,et]=U.useState(new Set);U.useEffect(()=>Jf(D),[]),U.useEffect(()=>{if($(!0),!s){R(!1);return}R(!1);let oe=!1;return I(!0),fetch(`/canvas/${s}/`,{method:"HEAD"}).then(Ae=>!oe&&R(Ae.ok)).catch(()=>{}).finally(()=>!oe&&I(!1)),()=>{oe=!0}},[s]),U.useEffect(()=>{!t||!s||t.type==="canvas.reload"&&t.harnessSessionId===s&&(R(!0),$(!0),j(oe=>oe+1))},[t,s]);const Ke=(n==null?void 0:n.path)??null;U.useEffect(()=>{$(!0),j(oe=>oe+1),P(1),te({x:0,y:0}),Ge({zoom:1,x:0,y:0}),ze.current=!1},[Ke]);const tt=p.filter(oe=>oe.harnessSessionId===s&&(oe.workflowPath==null||oe.workflowPath===Ke)),ft=tt.find(oe=>oe.status==="running")??null,Es=tt.filter(oe=>oe.status!=="running").sort((oe,Ae)=>(Ae.endedAt??"").localeCompare(oe.endedAt??""))[0],hs=!ft&&(Es==null?void 0:Es.status)==="failed"&&!Oe.has(Es.id)?Es:null,ue=hs?u.find(oe=>oe.id===hs.macroId)??null:null,xe=s!=null&&!0,Me=T&&xe;return h.jsxs("aside",{className:"canvas-pane",children:[n&&!l&&h.jsx(K2,{workflow:n,detailStep:bs,onBack:()=>js(null),onAskAgent:f,surface:w,stepsSummary:Kt&&Kt.nodes.length>0?rx(Kt):null,run:A,runTarget:C,runs:b,onSelectRun:S}),a?h.jsx(fi,{className:"canvas-empty",testId:"canvas-empty-no-session",icon:"Radio",title:`No running session for ${a}`,body:w==="steps"?"Start a session to map this agent's steps here.":"Start a session to map, run, and inspect this agent."}):l||!s?w==="steps"?h.jsx(fi,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its workflow steps here."}):h.jsx(fi,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its canvas here."}):hs?h.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[h.jsxs("p",{className:"canvas-task-title",children:[h.jsx(me,{name:"TriangleAlert",size:14})," ",hs.label," failed."]}),hs.errorTail&&h.jsx("pre",{className:"canvas-task-error",children:hs.errorTail}),h.jsxs("div",{className:"canvas-task-actions",children:[ue&&h.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>y(ue),children:"Retry"}),h.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>et(oe=>{const Ae=new Set(oe);return Ae.add(hs.id),Ae}),children:"Dismiss"})]})]}):ft&&!Me?h.jsxs("div",{className:"canvas-task-activity","data-testid":"canvas-task-activity",children:[h.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:h.jsx(me,{name:"Workflow",size:20})}),h.jsx("div",{className:"canvas-task-title",children:h.jsxs("span",{children:[ft.label," is running…"]})}),ft.statusLines.length>0&&h.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:ft.statusLines.slice(-8).map((oe,Ae)=>h.jsx("li",{children:oe},`${Ae}-${oe}`))}),h.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}):B?h.jsxs("div",{className:"canvas-loading","data-testid":"canvas-loading",children:[h.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),h.jsx("p",{className:"canvas-empty-hint",children:w==="steps"?"Loading steps…":"Loading canvas…"})]}):!Me&&w==="steps"&&A?h.jsx("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:h.jsx(Eg,{run:A,target:C})}):!Me&&d?h.jsx(fi,{className:"canvas-empty",testId:"canvas-empty-exited",icon:"History",title:"Session ended",body:`Resume the session to see its ${w==="steps"?"workflow steps":"workflow diagram"} here.`}):Me?h.jsx("div",{className:"canvas-frame-wrap"+(v?" is-expanded":""),"data-view":w==="board"?"board":bs?"detail":"steps",children:h.jsxs("div",{className:"canvas-slide-track",children:[h.jsxs("div",{className:"canvas-slide-pane",children:[h.jsxs("div",{className:"canvas-visual"+(w==="steps"?" is-offstage":""),children:[h.jsxs("div",{className:"canvas-view-controls","data-testid":"canvas-view-controls",children:[h.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-out","aria-label":"Zoom out",title:"Zoom out",disabled:L<=ie+.001,onClick:()=>{ze.current=!0,P(oe=>Math.max(ie,Math.round((oe-.25)*100)/100))},children:h.jsx(me,{name:"ZoomOut",size:14})}),h.jsxs("button",{className:"theme-toggle canvas-zoom-reset","data-testid":"canvas-zoom-reset","aria-label":"Reset zoom",title:"Reset zoom",disabled:L===1,onClick:()=>{ze.current=!0,P(1)},children:[Math.round(L*100),"%"]}),h.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:L>=2,onClick:()=>{ze.current=!0,P(oe=>Math.min(2,Math.round((oe+.25)*100)/100))},children:h.jsx(me,{name:"ZoomIn",size:14})}),h.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:L===We.zoom&&V.x===We.x&&V.y===We.y,onClick:dt,children:h.jsx(me,{name:"Frame",size:14})})]}),v&&h.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:c,children:h.jsx(me,{name:"Minimize2",size:14})}),(q||J)&&h.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(q?"":" is-fading"),"data-testid":"canvas-loading",role:"status","aria-label":"Rendering diagram",children:[h.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-title"}),h.jsxs("div",{className:"canvas-skeleton-row",children:[h.jsx("div",{className:"canvas-skeleton-block"}),h.jsx("div",{className:"canvas-skeleton-block"})]}),h.jsxs("div",{className:"canvas-skeleton-row",children:[h.jsx("div",{className:"canvas-skeleton-block"}),h.jsx("div",{className:"canvas-skeleton-block"}),h.jsx("div",{className:"canvas-skeleton-block"})]}),h.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-wide"})]}),mt&&h.jsxs("div",{className:"canvas-render-error","data-testid":"canvas-render-error",children:[h.jsx("span",{className:"canvas-error-icon","aria-hidden":"true",children:h.jsx(me,{name:"TriangleAlert",size:20})}),h.jsx("div",{className:"canvas-task-title",children:"Render failed"}),h.jsx("p",{className:"canvas-error-summary",children:(()=>{const oe=mt.reason.trim();return oe.length<4?"The workflow graph could not be extracted. Open the terminal for details.":oe.includes(": ")?oe.slice(oe.indexOf(": ")+2).split(". ")[0]:oe})()}),h.jsxs("div",{className:"canvas-error-actions",children:[h.jsx("button",{className:"btn-primary","data-testid":"canvas-error-fix",onClick:()=>f(`The canvas render for ${mt.title||"this workflow"} failed: ${mt.reason} Fix the project so the workflow graph extracts cleanly.`),children:"Ask agent to fix"}),h.jsx("button",{className:"btn-ghost","data-testid":"canvas-error-retry",onClick:()=>{Y.current=Date.now()+900,$(!0),j(oe=>oe+1)},children:"Retry"})]}),h.jsxs("details",{className:"canvas-error-details",children:[h.jsx("summary",{children:"Details"}),h.jsx("pre",{children:mt.reason.trim().length>=4?mt.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),ft&&h.jsxs("div",{className:"canvas-task-activity canvas-task-activity--overlay","data-testid":"canvas-task-activity",children:[h.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:h.jsx(me,{name:"Workflow",size:20})}),h.jsx("div",{className:"canvas-task-title",children:h.jsxs("span",{children:[ft.label," is running…"]})}),ft.statusLines.length>0&&h.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:ft.statusLines.slice(-8).map((oe,Ae)=>h.jsx("li",{children:oe},`${Ae}-${oe}`))}),h.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}),Se&&!Wt&&!_e&&h.jsx("button",{className:"theme-toggle canvas-overview-open","data-testid":"canvas-overview-toggle","aria-label":"Show workflow overview","data-tooltip":"Show workflow overview",onClick:()=>ss(!0),children:"i"}),w==="board"&&h.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(nt?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":nt?"Close chat":"Open chat","data-tooltip":"Chat — ask about this workflow or the selected step",onClick:()=>Ee(oe=>!oe),children:h.jsx(me,{name:"MessageSquare",size:14})}),h.jsx("iframe",{ref:z,className:"canvas-iframe",src:`/canvas/${s}/?theme=${k}`,sandbox:"allow-scripts",onLoad:()=>{var oe,Ae,je,ht;F(),(Ae=(oe=z.current)==null?void 0:oe.contentWindow)==null||Ae.postMessage({type:"sapiom-canvas:view",zoom:L,x:V.x,y:V.y},"*"),A&&C&&s&&((ht=(je=z.current)==null?void 0:je.contentWindow)==null||ht.postMessage({type:"sapiom:run-state",steps:A.steps,status:A.status,target:C},"*"))},onError:O},`${s}:${M}`),h.jsx("div",{ref:K,className:"canvas-pan-layer"+(de?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":qt&&!de?"true":void 0,onPointerDown:ts,onPointerMove:es,onPointerLeave:Yt,onDoubleClick:dt})]}),w==="steps"&&h.jsx("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:Kt&&Kt.nodes.length>0?h.jsx(U2,{graph:Kt,run:A,runTarget:C,workflows:_,onOpenWorkflow:g,expandedId:mi,onToggle:oe=>Cs(Ae=>Ae===oe?null:oe),onOpenDetail:js}):A?h.jsx(Eg,{run:A,target:C}):h.jsx(fi,{className:"canvas-empty",icon:"Workflow",title:"No steps yet",body:"This diagram has no step graph. It regenerates automatically from the bound workflow — check the terminal if it never appears."})}),w==="board"&&(Se&&Wt||_e)&&h.jsx(G2,{overview:Se??null,selectedNode:_e,graph:Kt,run:A,workflows:_,onOpenWorkflow:g,onOpenSteps:()=>{ot&&js(ot),E()},onDeselect:()=>Xt(null),onCollapse:()=>ss(!1)}),w==="board"&&nt&&h.jsx(W2,{node:_e,run:A,onInjectPrompt:f,onClose:()=>Ee(!1)})]}),h.jsx("div",{className:"canvas-slide-pane","aria-hidden":bs?void 0:!0,children:le&&Kt&&h.jsx(F2,{graph:Kt,node:le,run:A,workflows:_,onOpenWorkflow:g})})]})}):h.jsx(fi,{className:"canvas-empty",icon:"Workflow",title:w==="steps"?"No steps yet":"Nothing generated yet",body:w==="steps"?"Steps are read from the bound workflow's diagram — generated automatically from its code.":"Generated automatically from the bound workflow; it refreshes when the code changes."})]})}const Q2="https://tools.sapiom.ai",eE="x-sapiom-api-key",tE="YOUR_SAPIOM_API_KEY";function sE(s){return s==null?"{ /* your input */ }":JSON.stringify(s,null,2).replace(/\n/g,`
419
- `)}function iE(s){return s==null?"{}":JSON.stringify(s)}function nE(s){return s.replace(/'/g,"'\\''")}function rE(s,t){return`import { agents } from "@sapiom/tools";
420
-
421
- const result = await agents.run({
422
- definition: ${JSON.stringify(s)},
423
- input: ${sE(t)},
424
- });
425
-
426
- if (result.status === "completed") {
427
- console.log(result.output);
428
- }
429
- `}function aE(s,t,n){const a=nE(`{ "input": ${iE(t)} }`);return`curl -X POST ${n}/agents/v1/definitions/${s}/executions \\
430
- -H "${eE}: ${tE}" \\
431
- -H "Content-Type: application/json" \\
432
- -d '${a}'
433
- `}function oE(s){const{definition:t,inputSample:n,baseUrl:a=Q2}=s;return{typescript:rE(t,n),curl:aE(t,n,a)}}const lE="https://app.sapiom.ai/settings?tab=api-keys";function cE({boundWorkflow:s,agentsBaseUrl:t}){return s.definitionId==null?null:h.jsx(uE,{boundWorkflow:s,agentsBaseUrl:t})}function uE({boundWorkflow:s,agentsBaseUrl:t}){const[n,a]=U.useState("typescript"),[l,d]=U.useState(!1),v=s.definitionSlug==null,c=s.definitionSlug??s.name,{typescript:u,curl:p}=oE({definition:c,baseUrl:t}),y=n==="typescript"?u:p,f=()=>{navigator.clipboard.writeText(y).then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)}).catch(()=>{})};return h.jsxs("div",{className:"snippet-panel","data-testid":"snippet-panel",children:[h.jsx("div",{className:"snippet-panel-header",children:h.jsx("span",{className:"snippet-panel-title",children:"Trigger from your code"})}),h.jsxs("div",{className:"snippet-slug-row",children:[h.jsx("span",{className:"snippet-slug-label",children:"Agent"}),h.jsx("code",{className:"snippet-slug","data-testid":"snippet-slug",children:c})]}),v&&h.jsx("p",{className:"snippet-slug-inferred","data-testid":"snippet-slug-inferred",children:"Inferred from the project name. Confirm it matches your deployed agent."}),h.jsxs("div",{className:"snippet-tabs",role:"tablist","aria-label":"Snippet language",children:[h.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:()=>a("typescript"),children:"TypeScript (SDK)"}),h.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:()=>a("curl"),children:"cURL (HTTP)"})]}),h.jsxs("div",{className:"snippet-code-wrap",role:"tabpanel",id:"snippet-code-panel",children:[h.jsx("pre",{className:"snippet-code","data-testid":"snippet-code",children:h.jsx("code",{children:y})}),h.jsx("button",{className:"snippet-copy"+(l?" is-copied":""),"data-testid":"snippet-copy","aria-label":l?"Copied":"Copy snippet",onClick:f,children:l?"Copied":"Copy"})]}),h.jsxs("p",{className:"snippet-hint",children:["Replace ",h.jsx("code",{children:"YOUR_SAPIOM_API_KEY"})," with a key from your"," ",h.jsx("a",{className:"snippet-link","data-testid":"snippet-api-key-link",href:lE,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),". Add ",h.jsx("code",{children:"idempotencyKey"})," to the body to deduplicate retries."]})]})}function hE({boundWorkflow:s,noSessionAgent:t=null,agentsBaseUrl:n}){if(!s)return h.jsx(fi,{className:"code-panel-empty",icon:"Code",title:t?`No running session for ${t}`:"No agent bound",body:t?"Start a session to trigger this agent from your code.":"Open an agent to see how to trigger it from your code."});const a=s.definitionId!=null;return h.jsxs("div",{className:"code-panel",children:[h.jsxs("div",{className:"workflow-actions-header code-panel-header","data-testid":"code-panel-header",children:[h.jsx("span",{className:"workflow-actions-name",children:s.name}),a?h.jsxs("span",{className:"status-tag workflow-deployed-tag","data-testid":"code-panel-status","data-tooltip":"Deployed to production",children:[h.jsx("span",{className:"workflow-dot workflow-dot-pinned","aria-hidden":"true"}),"Deployed"]}):h.jsxs("span",{className:"status-tag code-panel-draft-tag","data-testid":"code-panel-status","data-tooltip":"Exists locally only. Deploy it to call it from your code.",children:[h.jsx(me,{name:"CloudOff",size:13}),"Draft"]})]}),a?h.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:h.jsx(cE,{boundWorkflow:s,agentsBaseUrl:n},s.path)}):h.jsx(fi,{className:"code-panel-empty",icon:"Code",title:"Deploy to trigger from code",body:`${s.name} is a draft. Once it deploys, copy-paste TypeScript SDK and cURL calls for it appear here.`})]})}function Tg(s,t){if(!s)return{score:0,indices:[]};const n=s.toLowerCase(),a=t.toLowerCase();let l=0,d=0,v=0;const c=[];for(let u=0;u<n.length;u++){const p=n[u],y=a.indexOf(p,d);if(y===-1)return null;v=y===d?v+1:0,l+=10-Math.min(y-d,8),l+=v*3,y===0&&(l+=5),c.push(y),d=y+1}return{score:l,indices:c}}const dE={command:"LayoutTemplate",session:"Radio",past:"History",workflow:"Workflow",recent:"Folder",path:"Folder"},yd={command:"Actions",session:"Sessions",past:"Past sessions",workflow:"Workflows",recent:"Folders",path:"Folders"},fE=6;function Ag(s,t){if(!t||t.length===0)return s;const n=new Set(t),a=[];let l="",d=n.has(0);const v=c=>{l&&(a.push(d?h.jsx("b",{className:"palette-match",children:l},c):l),l="")};for(let c=0;c<s.length;c++){const u=n.has(c);u!==d&&(v(c),d=u),l+=s[c]}return v(s.length),a}function pE(s,t){const n=Tg(s,t.label);if(n)return{item:{...t,labelIndices:n.indices},score:1e3+n.score};const a=Tg(s,t.meta);return a?{item:{...t,metaIndices:a.indices},score:a.score}:null}function vE({sessions:s,workflows:t,recentDirs:n,history:a,listDir:l,onSelectSession:d,onReviewSummary:v,onOpenPath:c,onBrowseTemplates:u,onClose:p}){const[y,f]=U.useState(""),[w,E]=U.useState([]),[A,C]=U.useState(!1),[b,S]=U.useState(!1),[_,g]=U.useState(0),T=U.useRef(null);U.useEffect(()=>{var D;(D=T.current)==null||D.focus()},[]);const R=y.startsWith("/")||y.startsWith("~");U.useEffect(()=>{if(!R){E([]),S(!1);return}let D=!1;C(!0),S(!1);const B=setTimeout(()=>{l(y).then(I=>{D||E(I.dirs)}).catch(()=>{D||(E([]),S(!0))}).finally(()=>!D&&C(!1))},150);return()=>{D=!0,clearTimeout(B)}},[y,R,l]);const M=U.useMemo(()=>{if(R){const G=y.trim(),Y=G?[{id:`confirm:${G}`,kind:"path",label:G,meta:"Open this path",path:G}]:[],O=w.map(F=>({id:`dir:${F.path}`,kind:"path",label:F.name,meta:F.path,path:F.path}));return[...Y,...O]}const D=s.filter(G=>G.status!=="exited").map(G=>({id:`session:${G.id}`,kind:"session",label:G.title,meta:G.cwd,sessionId:G.id})),B=new Set(s.map(G=>G.id)),I=new Set(s.map(G=>G.agentSessionId).filter(G=>G!=null)),q=[...s.filter(G=>G.status==="exited").map(G=>({id:`past:${G.id}`,kind:"past",label:G.title,meta:G.cwd,sessionId:G.id})),...a.filter(G=>!(G.harnessSessionId!=null&&B.has(G.harnessSessionId))&&!I.has(G.agentSessionId)).map(G=>({id:`summary:${G.agentSessionId}`,kind:"past",label:G.title,meta:G.cwd,summary:G}))],$=t.map(G=>({id:`workflow:${G.path}`,kind:"workflow",label:G.name,meta:G.path,path:G.path})),J=[{id:"command:browse-templates",kind:"command",label:"Browse templates",meta:"Gallery and starters"}],ee=new Set(t.map(G=>G.path)),W=n.filter(G=>!ee.has(G)).map(G=>({id:`recent:${G}`,kind:"recent",label:G.split("/").filter(Boolean).pop()??G,meta:G,path:G}));return y?[D,q,$,W,J].flatMap(G=>G.map(Y=>pE(y,Y)).filter(Y=>Y!==null).sort((Y,O)=>O.score-Y.score).map(Y=>Y.item)).slice(0,20):[...D,...q.slice(0,fE),...$,...W].slice(0,20-J.length).concat(J)},[y,R,w,s,t,n,a]);U.useEffect(()=>g(0),[M.length,y]);const j=D=>{D.kind==="command"?u():(D.kind==="session"||D.kind==="past")&&D.sessionId?d(D.sessionId):D.kind==="past"&&D.summary?v(D.summary):D.path&&c(D.path),p()},k=D=>{if(D.key==="ArrowDown")D.preventDefault(),g(B=>Math.min(B+1,M.length-1));else if(D.key==="ArrowUp")D.preventDefault(),g(B=>Math.max(B-1,0));else if(D.key==="Enter"){D.preventDefault();const B=M[_];B&&j(B)}else D.key==="Escape"&&p()};return h.jsx("div",{className:"modal-backdrop",onClick:p,children:h.jsxs("div",{className:"modal command-palette",onClick:D=>D.stopPropagation(),children:[h.jsx("input",{ref:T,className:"command-palette-input","data-testid":"command-palette-input",placeholder:"Jump to a session, workflow, or path…",value:y,onChange:D=>f(D.target.value),onKeyDown:k}),h.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[R&&A&&h.jsx("div",{className:"command-palette-empty",children:"Loading…"}),R&&b&&!A&&h.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),M.length===0&&!A&&!b&&h.jsx("div",{className:"command-palette-empty",children:"No matches"}),M.map((D,B)=>h.jsxs("div",{className:"command-palette-row",children:[!R&&(B===0||yd[D.kind]!==yd[M[B-1].kind])&&h.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:yd[D.kind]}),h.jsxs("button",{type:"button",className:"command-palette-item"+(B===_?" is-selected":""),"data-testid":`command-palette-item-${B}`,onMouseEnter:()=>g(B),onClick:()=>j(D),children:[h.jsx(me,{name:dE[D.kind],size:14}),h.jsx("span",{className:"command-palette-item-label",children:Ag(D.label,D.labelIndices)}),h.jsx("span",{className:"command-palette-item-meta",children:Ag(D.meta,D.metaIndices)})]})]},D.id))]})]})})}const _E={offline:{icon:"CloudOff",title:"You're offline",body:"Sapiom Studio can't reach the network. Check your connection — the moment you're back, retry to pick up right where you left off."},auth:{icon:"Plug",title:"Session needs a refresh",body:"Your credential was rejected — it may have rotated or expired. Retry to reconnect with the current key; you won't lose your place."},error:{icon:"TriangleAlert",title:"Couldn't reach Sapiom Studio",body:"The server didn't respond as expected. This is usually temporary — retry in a moment."}};function mE({status:s,onRetry:t,retrying:n=!1,detail:a,onStartAuth:l}){const d=_E[s],[v,c]=U.useState({status:"idle"}),u=async()=>{if(l){c({status:"pending"});try{await l(),c({status:"idle"})}catch(p){const y=p instanceof Error?p.message:"Could not start sign-in. Try again.";c({status:"error",message:y})}}};return h.jsx("div",{className:"app-status connectivity-screen","data-testid":"connectivity-screen","data-status":s,role:"alert",children:h.jsxs("div",{className:"connectivity-screen-inner",children:[h.jsx("span",{className:"connectivity-screen-icon","aria-hidden":"true",children:h.jsx(me,{name:d.icon,size:22})}),h.jsx("span",{className:"connectivity-screen-title",children:d.title}),h.jsx("span",{className:"connectivity-screen-body",children:d.body}),s==="error"&&a&&h.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:a}),h.jsx("button",{className:"btn-primary connectivity-screen-retry","data-testid":"connectivity-retry",onClick:t,disabled:n||v.status==="pending",children:n?"Reconnecting…":"Retry"}),s==="auth"&&l&&h.jsxs("div",{className:"connectivity-screen-auth-section",children:[v.status==="pending"?h.jsxs("span",{className:"connectivity-auth-pending","data-testid":"connectivity-auth-pending",children:[h.jsx(me,{name:"Loader",size:14}),"Opening browser… waiting for sign-in"]}):h.jsxs("button",{className:"btn-secondary connectivity-connect-btn","data-testid":"connectivity-connect-btn",onClick:()=>void u(),children:[h.jsx(me,{name:"Plug",size:14}),"Connect account"]}),v.status==="error"&&h.jsx("span",{className:"connectivity-auth-error","data-testid":"connectivity-auth-error",children:v.message})]})]})})}function gE({onDismiss:s}){return h.jsxs("div",{className:"connectivity-banner",role:"status","data-testid":"connectivity-banner",children:[h.jsx("span",{className:"connectivity-banner-icon","aria-hidden":"true",children:h.jsx(me,{name:"CloudOff",size:14})}),h.jsx("span",{className:"connectivity-banner-text",children:"You're offline. The Studio stays usable, but live actions (runs, deploys, the terminal) pause until your connection returns."}),s&&h.jsx("button",{className:"connectivity-banner-dismiss","aria-label":"Dismiss offline notice","data-testid":"connectivity-banner-dismiss",onClick:s,children:"×"})]})}function yE(s,t,n){const a=new Map;for(const l of t)a.has(l.agentSessionId)||a.set(l.agentSessionId,l);for(const l of s)n.has(l.cwd)||a.has(l.agentSessionId)||a.set(l.agentSessionId,l);return Array.from(a.values()).sort((l,d)=>d.lastActiveAt.localeCompare(l.lastActiveAt))}const bE=12;function Sy(s,t,n){var d;const a=[],l=v=>{v&&!a.includes(v)&&a.push(v)};return l((d=s.find(v=>v.id===n))==null?void 0:d.cwd),s.forEach(v=>l(v.cwd)),t.forEach(v=>l(v)),a.slice(0,bE)}const ya={"claude-code":"Claude Code",codex:"Codex"};function wy(s,t=Date.now()){const n=t-new Date(s).getTime(),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const l=Math.floor(a/60);if(l<24)return`${l}h ago`;const d=Math.floor(l/24);return d<7?`${d}d ago`:new Date(s).toLocaleDateString([],{month:"short",day:"numeric"})}function SE(s,t){const n=new Date(t).getTime()-new Date(s).getTime();if(!Number.isFinite(n)||n<=0)return null;const a=Math.floor(n/6e4);if(a<1)return"under a minute";if(a<60)return`${a}m`;const l=Math.floor(a/60);return l<24?`${l}h ${a%60}m`:`${Math.floor(l/24)}d ${l%24}h`}function Rg(s){return s.resumeMode===void 0?"checking":s.resumeMode==="agent-resume"?"resume":(s.turnCount??s.messageCount??0)>0?"from-summary":"empty"}function wE(s){switch(s){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function af(s,t=Date.now(),n={}){const a=[];n.includeHarness!==!1&&a.push(ya[s.harness]),s.gitBranch&&a.push(s.gitBranch);const l=s.turnCount??s.messageCount;l!=null&&l>0&&a.push(`${l} ${l===1?"turn":"turns"}`);const d=n.state?wE(n.state):null;return d&&a.push(d),a.push(wy(s.lastActiveAt,t)),a.join(" · ")}function xy(s,t){const[n,a]=U.useState(s===null?{status:"empty"}:{status:"loading"});return U.useEffect(()=>{if(s===null){a({status:"empty"});return}let l=!1;return a({status:"loading"}),t(s).then(d=>{l||a(d?{status:"ready",record:d}:{status:"empty"})},d=>{l||a({status:"error",message:d instanceof Error?d.message:String(d)})}),()=>{l=!0}},[s,t]),n}function Cy({text:s}){const t=s.split(`
434
- `),n=[];let a=0,l=0;function d(){return l++}function v(c){const u=[],p=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*)/g;let y=0,f;for(;(f=p.exec(c))!==null;){f.index>y&&u.push(c.slice(y,f.index));const w=f[0];w.startsWith("`")&&w.endsWith("`")?u.push(h.jsx("code",{className:"chat-inline-code",children:w.slice(1,-1)},d())):w.startsWith("**")&&w.endsWith("**")?u.push(h.jsx("strong",{children:w.slice(2,-2)},d())):w.startsWith("*")&&w.endsWith("*")?u.push(h.jsx("em",{children:w.slice(1,-1)},d())):u.push(w),y=f.index+w.length}return y<c.length&&u.push(c.slice(y)),u}for(;a<t.length;){const c=t[a];if(c.startsWith("```")){const f=c.slice(3).trim(),w=[];for(a++;a<t.length&&!t[a].startsWith("```");)w.push(t[a]),a++;a++,n.push(h.jsx("pre",{className:"chat-code-block","data-lang":f||void 0,children:h.jsx("code",{className:f?`language-${f}`:void 0,children:w.join(`
435
- `)})},d()));continue}const u=c.match(/^(#{1,3})\s+(.+)/);if(u){const w=`h${u[1].length}`;n.push(h.jsx(w,{className:"chat-heading",children:v(u[2])},d())),a++;continue}if(c.startsWith("> ")){n.push(h.jsx("blockquote",{className:"chat-blockquote",children:v(c.slice(2))},d())),a++;continue}if(/^- \[[ x]\]/.test(c)){const f=[];for(;a<t.length&&/^- \[[ x]\]/.test(t[a]);){const w=t[a][3]==="x";f.push({text:t[a].replace(/^- \[[ x]\]\s?/,""),checked:w}),a++}n.push(h.jsx("ul",{className:"chat-list chat-checklist",children:f.map((w,E)=>h.jsx("li",{children:v(w.text)},E))},d()));continue}if(/^[-*+]\s+/.test(c)){const f=[];for(;a<t.length&&/^[-*+]\s+/.test(t[a]);){const w=t[a].replace(/^[-*+]\s+/,"");f.push(h.jsx("li",{children:v(w)},d())),a++}n.push(h.jsx("ul",{className:"chat-list",children:f},d()));continue}if(!c.trim()){a++;continue}const p=f=>f.startsWith("```")||/^#{1,3}\s+/.test(f)||f.startsWith("> ")||/^[-*+]\s+/.test(f),y=[c];for(a++;a<t.length&&t[a].trim()&&!p(t[a]);)y.push(t[a]),a++;n.push(h.jsx("p",{className:"chat-paragraph",children:v(y.join(" "))},d()))}return h.jsx(h.Fragment,{children:n})}const Mg={"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."},xE=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function CE(s){const t=new Set(s),n=xE.filter(l=>t.has(l)).map(l=>Mg[l]),a=[...t].filter(l=>!(l in Mg)).map(l=>`Known gap reported by the harness: ${l}.`);return[...n,...a]}function EE(s){if(!s)return null;const t=[];return s.inputTokens!=null&&t.push(`${Dg(s.inputTokens)} in`),s.outputTokens!=null&&t.push(`${Dg(s.outputTokens)} out`),t.length>0?t.join(" · "):null}function Dg(s){if(s<1e3)return String(s);const t=s/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function Ey(s,t=Date.now()){if(!s)return null;const n=new Date(s);if(Number.isNaN(n.getTime()))return null;const a=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),l=new Date(t);return n.getFullYear()===l.getFullYear()&&n.getMonth()===l.getMonth()&&n.getDate()===l.getDate()?a:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${a}`}function kE(s,t){const n=s??"unknown tool";if(!t)return n;const a=t.replace(/\s+/g," ").trim();if(!a)return n;const l=a.length>80?`${a.slice(0,80)}…`:a;return`${n} · ${l}`}function TE({record:s}){const t=CE(s.limitations),n=Ey(s.archivedAt);return h.jsxs("div",{className:"transcript","data-testid":"session-transcript",children:[h.jsxs("div",{className:"transcript-notice","data-testid":"transcript-reconstructed",children:[h.jsx("span",{className:"transcript-badge",children:"Reconstructed"}),h.jsxs("div",{className:"transcript-notice-body",children:[h.jsx("p",{className:"transcript-notice-lead",children:"Rebuilt from the harness's own recording of this session, not a replay of your terminal."}),s.archivedAt!==null&&h.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&&h.jsx("ul",{className:"transcript-notice-list","data-testid":"transcript-limitations",children:t.map(a=>h.jsx("li",{children:a},a))})]})]}),h.jsx("ol",{className:"transcript-turns",children:s.turns.map(a=>h.jsx(AE,{turn:a},a.index))})]})}function AE({turn:s}){const t=EE(s.usage),n=Ey(s.promptAt);return h.jsxs("li",{className:"transcript-turn","data-testid":"transcript-turn","data-turn":s.index,children:[h.jsxs("div",{className:"transcript-role transcript-role-user",children:[h.jsx("span",{className:"transcript-role-label",children:"You"}),n&&h.jsx("span",{className:"transcript-time",children:n})]}),s.prompt!==null?h.jsx("div",{className:"transcript-prompt","data-testid":"transcript-prompt",children:s.prompt}):h.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-prompt",children:"No prompt recorded for this turn — the harness started recording after it began."}),s.toolCalls.length>0&&h.jsx("ul",{className:"transcript-tools","data-testid":"transcript-tools",children:s.toolCalls.map((a,l)=>h.jsx(RE,{call:a},`${a.at}-${l}`))}),h.jsxs("div",{className:"transcript-role transcript-role-agent",children:[h.jsx("span",{className:"transcript-role-label",children:"Agent"}),s.model&&h.jsx("span",{className:"transcript-model",children:s.model}),t&&h.jsx("span",{className:"transcript-usage",children:t})]}),s.assistantText!==null?h.jsx("div",{className:"transcript-assistant","data-testid":"transcript-assistant",children:h.jsx(Cy,{text:s.assistantText})}):h.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-assistant",children:s.incomplete?"This turn never completed — no reply was recorded.":"No assistant text was recorded for this turn."}),s.incomplete&&h.jsx("div",{className:"transcript-incomplete","data-testid":"transcript-incomplete",children:"Turn incomplete"})]})}function RE({call:s}){return h.jsx("li",{className:"transcript-tool",children:h.jsxs("details",{"data-testid":"transcript-tool-call",children:[h.jsxs("summary",{className:"transcript-tool-summary",children:[h.jsx("span",{className:"transcript-tool-name",children:kE(s.name,s.input)}),s.responseTruncated&&h.jsx("span",{className:"transcript-tool-truncated","data-testid":"transcript-tool-truncated",children:"truncated"})]}),h.jsxs("div",{className:"transcript-tool-body",children:[s.input&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"transcript-tool-heading",children:"Input"}),h.jsx("pre",{className:"transcript-tool-pre",children:s.input})]}),h.jsx("div",{className:"transcript-tool-heading",children:"Result"}),s.responseSummary?h.jsx("pre",{className:"transcript-tool-pre",children:s.responseSummary}):h.jsx("div",{className:"transcript-absent",children:"No result recorded."}),s.responseTruncated&&h.jsx("div",{className:"transcript-absent",children:"The recorded result was truncated at the collector's size cap; the rest isn't recoverable."})]})]})})}function jg(s){return s.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${ya[s.harness]} has no saved conversation for this session, so there's nothing to hand back. That happens when a session ends before its first prompt — the agent never writes a transcript for those.`}function ME({session:s,resumeMode:t,loadRecord:n,onResume:a,onContinue:l,onClose:d}){const v=s.agentSessionId!=null&&t!=="rehydrate",c=SE(s.createdAt,s.lastActiveAt),u=xy(s.id,n),p=u.status!=="empty",y=!v&&u.status==="ready";return h.jsxs("div",{className:"dead-session-pane","data-testid":"dead-session-pane","data-has-record":p,children:[h.jsxs("div",{className:"dead-session-summary",children:[h.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:h.jsx(me,{name:"SquareTerminal",size:18})}),h.jsx("div",{className:"dead-session-title",children:"Session exited"}),h.jsxs("div",{className:"dead-session-meta",children:[s.cwd,s.exitCode!=null&&` · exit code ${s.exitCode}`]}),h.jsxs("dl",{className:"dead-session-detail","data-testid":"dead-session-detail",children:[s.title&&h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Session"}),h.jsx("dd",{children:s.title})]}),h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Agent"}),h.jsx("dd",{children:ya[s.harness]})]}),c&&h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Ran for"}),h.jsx("dd",{children:c})]}),h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Ended"}),h.jsx("dd",{children:wy(s.lastActiveAt)})]})]}),h.jsxs("div",{className:"dead-session-actions",children:[y?h.jsx("button",{className:"btn-primary","data-testid":"dead-session-continue",onClick:l,children:"Continue here"}):h.jsx("button",{className:"btn-primary","data-testid":"dead-session-resume",onClick:a,disabled:!v,title:v?void 0:jg(s),children:"Resume"}),h.jsx("button",{className:"btn-ghost","data-testid":"dead-session-close",onClick:d,children:"Close"})]}),!v&&h.jsxs("div",{className:"dead-session-resume-reason","data-testid":"dead-session-resume-reason",children:[jg(s)," ",y?"Continuing opens a fresh session in this directory, seeded with the reconstruction below — a briefing about this session, not its context. The new agent will need to check the repository before relying on any of it.":"Start a new session in this directory instead; there is no recording of this one to carry over either."]})]}),p&&h.jsx("div",{className:"dead-session-record","data-testid":"dead-session-record",children:h.jsx(ky,{state:u})})]})}function DE({summary:s,loadRecord:t,onStart:n,onClose:a}){const l=s.resumeMode==="agent-resume",d=s.harnessSessionId??s.agentSessionId,v=xy(d,t),c=!l&&v.status==="ready";return h.jsxs("div",{className:"past-session-pane","data-testid":"past-session-pane",children:[h.jsxs("header",{className:"past-session-header",children:[h.jsxs("div",{className:"past-session-heading",children:[h.jsx("div",{className:"dead-session-title",children:s.title}),h.jsxs("div",{className:"dead-session-meta",children:[af(s)," · ",s.cwd]})]}),h.jsxs("div",{className:"dead-session-actions",children:[h.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:n,children:l?"Resume":c?"Continue here":"New session here"}),h.jsx("button",{className:"btn-ghost","data-testid":"past-session-close",onClick:a,children:"Close"})]})]}),!l&&h.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[ya[s.harness]," has no saved conversation for this session, so it can't be reattached — sessions that end before their first prompt are never written to the agent's history."," ",c?"Continuing opens a fresh session here, seeded with the reconstruction below. The new agent gets a briefing about this session, not its context — it will need to check the repository before relying on any of it.":"Starting opens a fresh session in the same directory, with no context from this one."]}),h.jsx("div",{className:"past-session-body",children:h.jsx(ky,{state:v})})]})}function ky({state:s}){return s.status==="loading"?h.jsx("div",{className:"past-session-status","data-testid":"past-session-loading",children:"Rebuilding this session's transcript…"}):s.status==="error"?h.jsxs("div",{className:"past-session-status","data-testid":"past-session-error",children:["Couldn't load this session's transcript: ",s.message]}):s.status==="empty"?h.jsxs("div",{className:"past-session-status","data-testid":"past-session-empty",children:[h.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:h.jsx(me,{name:"SquareTerminal",size:18})}),"No transcript for this session: the harness has no recorded events for it. Sessions the Studio didn't run — or ones whose events have aged out of the local log — show up here as history rows only."]}):h.jsx(TE,{record:s.record})}const jE="~/.sapiom/harness",NE={events:`${jE}/events.ndjson`},LE=["image/png","image/jpeg","image/gif","image/webp"],Ng=10*1024*1024,Ty=["claude-code","codex"],OE=U.createContext(null),bd=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`,BE=s=>new Promise((t,n)=>{const a=new FileReader;a.onload=()=>t(String(a.result)),a.onerror=()=>n(a.error??new Error("could not read file")),a.readAsDataURL(s)}),HE=({sessionId:s,harness:t,api:n,showToast:a,children:l})=>{const[d,v]=U.useState(null),[c,u]=U.useState([]),[p,y]=U.useState(!1),[f,w]=U.useState(!1),E=U.useRef(null),A=U.useRef(0);U.useEffect(()=>{let k=!1;return n.listHarnesses().then(D=>{k||v(D)}).catch(()=>{}),()=>{k=!0}},[n]);const C=U.useMemo(()=>{var k;return d?((k=d.find(D=>D.id===t))==null?void 0:k.imageInput)??!1:!0},[d,t]);U.useEffect(()=>{u([]),A.current=0,y(!1)},[s]);const b=U.useCallback(async k=>{const D=k.filter(I=>I.type.startsWith("image/"));if(D.length===0)return;const B=[];for(const I of D){if(!LE.includes(I.type)){a(`${I.name||"image"}: ${I.type} isn't a supported image type.`);continue}if(I.size>Ng){a(`${I.name||"image"} is ${bd(I.size)}, over the ${bd(Ng)} limit.`);continue}try{const q=await BE(I);B.push({id:crypto.randomUUID(),dataUrl:q,filename:I.name||"pasted-image",mediaType:I.type,bytes:I.size})}catch{a(`Could not read ${I.name||"image"}.`)}}B.length>0&&u(I=>[...I,...B])},[a]);U.useEffect(()=>{if(!C)return;const k=D=>{var q;const B=(q=D.clipboardData)==null?void 0:q.items;if(!B)return;const I=[];for(let $=0;$<B.length;$+=1){const J=B[$];if(J.kind==="file"&&J.type.startsWith("image/")){const ee=J.getAsFile();ee&&I.push(ee)}}I.length!==0&&(D.preventDefault(),b(I))};return window.addEventListener("paste",k),()=>window.removeEventListener("paste",k)},[C,b]);const S=U.useCallback(k=>{u(D=>D.filter(B=>B.id!==k))},[]),_=U.useCallback(async()=>{if(c.length===0||f)return;w(!0);let k=null;for(const D of c)try{await n.attachImage(s,{dataUrl:D.dataUrl,filename:D.filename}),u(B=>B.filter(I=>I.id!==D.id))}catch(B){k=B instanceof As&&B.reason?B.reason:B.message;break}w(!1),k&&a(k)},[c,f,n,s,a]),g=U.useCallback(k=>{Array.from(k.dataTransfer.types).includes("Files")&&(A.current+=1,y(!0))},[]),T=U.useCallback(k=>{Array.from(k.dataTransfer.types).includes("Files")&&k.preventDefault()},[]),R=U.useCallback(()=>{A.current=Math.max(0,A.current-1),A.current===0&&y(!1)},[]),M=U.useCallback(k=>{Array.from(k.dataTransfer.types).includes("Files")&&(k.preventDefault(),A.current=0,y(!1),b(Array.from(k.dataTransfer.files)))},[b]),j=U.useCallback(()=>{var k;(k=E.current)==null||k.click()},[]);return C?h.jsxs("div",{className:"image-composer","data-testid":"image-composer",onDragEnter:g,onDragOver:T,onDragLeave:R,onDrop:M,children:[h.jsx(OE.Provider,{value:j,children:h.jsx("div",{className:"image-composer-pane",children:l})}),p&&h.jsxs("div",{className:"image-composer-dropzone","data-testid":"image-composer-dropzone",children:[h.jsx(me,{name:"ImageUp",size:28}),h.jsx("span",{children:"Drop an image to attach it"})]}),c.length>0&&h.jsxs("div",{className:"image-composer-bar",children:[h.jsx("ul",{className:"image-composer-thumbs","data-testid":"image-composer-thumbs",children:c.map(k=>h.jsxs("li",{className:"image-composer-thumb",title:`${k.filename} · ${bd(k.bytes)}`,children:[h.jsx("img",{src:k.dataUrl,alt:k.filename}),h.jsx("button",{type:"button",className:"image-composer-thumb-remove",onClick:()=>S(k.id),disabled:f,"aria-label":`Remove ${k.filename}`,"data-tooltip":`Remove ${k.filename}`,"data-testid":"image-composer-thumb-remove",children:h.jsx(me,{name:"X",size:11})})]},k.id))}),h.jsx("button",{type:"button",className:"image-composer-send btn-primary",onClick:()=>void _(),disabled:f,"data-testid":"image-composer-send",children:f?"Sending…":`Send ${c.length} to agent`})]}),h.jsx("input",{ref:E,type:"file",accept:"image/*",multiple:!0,hidden:!0,"data-testid":"image-composer-file-input",onChange:k=>{const D=k.target.files?Array.from(k.target.files):[];b(D),k.target.value=""}})]}):h.jsx(h.Fragment,{children:l})};function Ay({onCancel:s,onConfirm:t,triggerRef:n}){const a=U.useRef(null);return ga(!0,{onDismiss:s,containerRef:a,triggerRef:n}),h.jsx("div",{className:"modal-backdrop",onClick:s,children:h.jsxs("div",{ref:a,className:"modal modal-confirm",role:"alertdialog","aria-label":"End session","data-testid":"end-session-confirm",onClick:l=>l.stopPropagation(),children:[h.jsxs("div",{className:"modal-header",children:["End session?",h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:s,children:h.jsx(me,{name:"X",size:14})})]}),h.jsx("div",{className:"modal-body",children:h.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."})}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:s,children:"Keep session"}),h.jsx("button",{className:"btn-danger","data-testid":"end-session-confirm-btn",onClick:t,children:"End session"})]})]})})}const zE="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",IE="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",$E={"claude-code":zE,codex:IE},PE=["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 Wo({kind:s,size:t=16}){if(s==="sapiom")return h.jsx("svg",{viewBox:"0 0 115 122",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:PE.map(a=>h.jsx("path",{d:a},a.slice(0,16)))});const n=$E[s];return n?h.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:h.jsx("path",{d:n})}):h.jsx(me,{name:"SquareTerminal",size:t})}function UE(s,t){return s.status==="exited"?"exited":t?"busy":s.status==="running"?"live":s.status}function FE(s){return s.split("/").filter(Boolean).pop()??s}function qE({overviewMode:s=!1,openedAgentName:t=null,reviewTitle:n=null,activeSession:a,sessionName:l,onRenameSession:d,boundWorkflowName:v,busy:c,onExpandRail:u,onExpandRight:p,onCloseSession:y,onOpenInEditor:f,onToast:w}){const[E,A]=U.useState(!1),[C,b]=U.useState(!1),[S,_]=U.useState(!1),[g,T]=U.useState(""),R=U.useRef(null),M=()=>b(!1),j=()=>{a&&d(a.id,g),_(!1)};return h.jsxs("div",{className:"session-bar",children:[u&&h.jsx("button",{className:"gear-btn","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:u,children:h.jsx(me,{name:"Menu",size:15})}),h.jsx("div",{className:"session-context","data-testid":"session-context","data-session-id":(a==null?void 0:a.id)??"",children:s?h.jsxs(h.Fragment,{children:[h.jsx(me,{name:"Radio",size:13}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Overview"})]}):t?h.jsxs(h.Fragment,{children:[h.jsx(me,{name:"Zap",size:13}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:t}),h.jsx("span",{className:"status-tag session-status-tag session-context-status","data-testid":"session-status-tag","data-status":"none","data-tooltip":"No running session for this agent. Start one to work on it.",children:"no session"})]}):n?h.jsxs(h.Fragment,{children:[h.jsx(me,{name:"History",size:13}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:n}),h.jsxs("span",{className:"status-tag session-status-tag session-context-status","data-testid":"session-status-tag","data-status":"exited","data-tooltip":"A past session under review. Resume it from the pane below.",children:[h.jsx("span",{className:"session-dot","data-status":"exited"}),"past"]})]}):a?h.jsxs(h.Fragment,{children:[h.jsx(Wo,{kind:a.harness,size:13}),S?h.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:g,autoFocus:!0,onFocus:k=>k.currentTarget.select(),onChange:k=>T(k.target.value),onKeyDown:k=>{k.key==="Enter"&&j(),k.key==="Escape"&&_(!1)},onBlur:j}):h.jsx("span",{className:"session-context-title","data-testid":"session-context-title","data-tooltip":`${ya[a.harness]} · ${FE(a.cwd)} · ${a.cwd}`,children:l??a.title}),v&&h.jsxs("span",{className:"session-workflow-chip","data-testid":"session-workflow-chip","data-tooltip":`Bound to ${v}; shown in Canvas`,children:["· ",v]}),h.jsxs("span",{className:"status-tag session-status-tag session-context-status","data-testid":"session-status-tag","data-status":a.status,"data-tooltip":c?"The agent produced output in the last few seconds":a.status==="running"?"Session is live; the terminal is connected":a.status==="exited"?"Session ended; resume it from the dead-session pane or history":"Session is starting",children:[c?h.jsx("span",{className:"session-busy","data-testid":"session-busy","aria-hidden":"true"}):h.jsx("span",{className:"session-dot","data-status":a.status}),UE(a,c)]})]}):h.jsx("span",{className:"session-context-none",children:"No active session"})}),!s&&!n&&!t&&a&&h.jsxs("div",{className:"session-menu-wrap",children:[h.jsx("button",{ref:R,className:"theme-toggle","data-testid":"session-menu","aria-label":"Session options","data-tooltip":"Session options","aria-haspopup":"menu","aria-expanded":C,onClick:()=>b(k=>!k),children:h.jsx(me,{name:"MoreHorizontal",size:14})}),h.jsxs(cn,{open:C,anchorRef:R,onDismiss:M,placement:"down-end",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[h.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var k;(k=navigator.clipboard)==null||k.writeText(a.cwd).then(()=>w("Path copied.")).catch(()=>w("Couldn't copy the path.")),M()},children:[h.jsx(me,{name:"Copy",size:13}),"Copy path"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{T(l??a.title),_(!0),M()},children:[h.jsx(me,{name:"Pencil",size:13}),"Rename session"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{f(a.cwd),M()},children:[h.jsx(me,{name:"Code",size:13}),"Open in editor"]}),a.status!=="exited"&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{M(),A(!0)},children:[h.jsx(me,{name:"X",size:13}),"End session…"]})]})]}),p&&h.jsx("button",{className:"gear-btn","data-testid":"right-expand","aria-label":"Expand canvas panel",title:"Expand canvas panel",onClick:p,children:h.jsx(me,{name:"List",size:15})}),E&&a&&h.jsx(Ay,{triggerRef:R,onCancel:()=>A(!1),onConfirm:()=>{A(!1),y(a.id)}})]})}function WE(s,t,n){if(s.requiresWorkflow){if(!t)return"Select a workflow first";if(s.action.kind==="open-url"&&s.action.url.includes("{{workflow.definitionId}}")&&t.definitionId==null)return"Not deployed yet"}return s.action.kind!=="open-url"&&!n?"Start a session first":null}function GE(s,t){return s.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}function Ho(s,t,n){const a={event:s,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":oa()},body:JSON.stringify(a),keepalive:!0}).catch(()=>{})}function VE({workflow:s,activeSessionId:t,sessionReady:n,macros:a,onRunMacro:l,preview:d,lastDeployError:v,authenticated:c,directActionSettleSeq:u}){const p=A=>a.find(C=>C.id===A),y=s.definitionId!=null,[f,w]=U.useState(null);U.useEffect(()=>{w(null)},[s.path,y,v,u]);const E=[{id:"local",label:"Local Run",icon:"FlaskConical",macro:p("run_local"),testId:"session-step-local",hint:"Test: run locally with every capability stubbed - no real calls."},{id:"run",label:"Prod Run",icon:"Play",macro:p("prod_run"),testId:"session-step-run",hint:"Ship: start a real cloud execution on Sapiom.",needsDeploy:!0,needsAuth:!0},{id:"deploy",label:"Deploy",icon:"CloudUpload",macro:p("deploy"),testId:"session-step-deploy",hint:"Ship: push and build on Sapiom.",primary:!0,needsAuth:!0}].filter(A=>A.macro);return h.jsxs("div",{className:"session-steps","data-testid":"session-steps","aria-label":"Agent actions",children:[h.jsxs("span",{className:"status-tag session-lifecycle-chip","data-testid":"session-lifecycle-chip","data-deployed":y,"data-deploy-error":v!=null&&!y?"":void 0,"data-tooltip":y?`Deployed to Sapiom (definition ${s.definitionId}). Run starts real cloud executions.`:v!=null?"Last deploy failed. Retry Deploy to push to Sapiom.":"Draft: exists locally only. Building here uses your Claude Code account; Deploy publishes to Sapiom.",children:[h.jsx(me,{name:y?"Cloud":"CloudOff",size:13}),h.jsx("span",{className:"session-lifecycle-label",children:y?"Deployed":v!=null?"Deploy failed":"Draft"})]}),d&&h.jsxs("a",{className:"status-tag status-tag-action session-preview-chip","data-testid":"session-preview-chip",href:d.url,target:"_blank",rel:"noreferrer","aria-label":`Preview :${d.port}`,"data-tooltip":`The agent is serving an app on port ${d.port}. Opens ${d.url}`,children:[h.jsx(me,{name:"ExternalLink",size:12}),h.jsx("span",{className:"session-preview-label",children:"Preview "}),":",d.port]}),h.jsx("div",{className:"session-actions",children:E.map(A=>{const C=A.needsAuth&&!c?"Connect your account first":null,b=A.needsDeploy&&!y?v!=null?"Last deploy failed — retry Deploy":"Not deployed yet":null,S=!n&&A.macro&&A.macro.action.kind!=="open-url"?"Session is starting":null,_=C??b??S??(A.macro?WE(A.macro,s,t):null),g=A.label;return h.jsxs("button",{className:"session-step"+(A.primary?" session-action-primary":""),"data-testid":A.testId,"data-pending":f===A.id||void 0,disabled:!!_,"data-tooltip":_?`${g}: ${_}`:A.hint,"aria-label":_?`${g}: ${_}`:g,onClick:()=>{A.macro&&(l(A.macro),w(A.id),Ho("macro.invoked",{macroId:A.macro.id}))},children:[h.jsx(me,{name:A.icon,size:14}),h.jsx("span",{className:"session-step-label",children:A.label})]},A.id)})})]})}function YE({sessions:s,activeSessionId:t,busySessionIds:n,labelOf:a,agentName:l,onSelect:d,onClose:v,onNew:c}){const[u,p]=U.useState(null),y=U.useRef(null);return h.jsxs("div",{className:"session-tabs",role:"tablist","aria-label":"Sessions","data-testid":"session-tabs",children:[s.map(f=>{const w=f.id===t,E=n.has(f.id),A=a(f);return h.jsxs("div",{className:"session-tab"+(w?" is-active":""),"data-testid":`session-tab-${f.id}`,children:[h.jsxs("button",{type:"button",role:"tab","aria-selected":w,className:"session-tab-main","data-testid":`session-tab-main-${f.id}`,title:`${A} · ${ya[f.harness]}`,onClick:()=>d(f.id),children:[h.jsx(Wo,{kind:f.harness,size:13}),h.jsx("span",{className:"session-tab-label",children:A}),E?h.jsx("span",{className:"session-tab-busy","data-testid":`session-tab-busy-${f.id}`,"aria-hidden":"true"}):h.jsx("span",{className:"session-tab-dot","data-status":f.status,"aria-hidden":"true"})]}),h.jsx("button",{type:"button",className:"session-tab-close","data-testid":`session-tab-close-${f.id}`,"aria-label":`Close ${A}`,"data-tooltip":"End session",onClick:C=>{y.current=C.currentTarget,p(f.id)},children:h.jsx(me,{name:"X",size:12})})]},f.id)}),h.jsx("button",{type:"button",className:"session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${l}`,"data-tooltip":"New session on this agent",onClick:c,children:h.jsx(me,{name:"Plus",size:14})}),u&&h.jsx(Ay,{triggerRef:y,onCancel:()=>p(null),onConfirm:()=>{const f=u;p(null),v(f)}})]})}function XE({onDismiss:s,onOpenSettings:t}){return h.jsxs("div",{className:"telemetry-notice",role:"status","data-testid":"telemetry-notice",children:[h.jsx("div",{className:"telemetry-notice-body",children:h.jsxs("p",{className:"telemetry-notice-text",children:["Sharing session details with Sapiom is ",h.jsx("strong",{children:"off by default"}),". Your prompts and tool calls stay local unless you opt in to help us improve the Studio. Turn it on any time in"," ",h.jsx("button",{className:"telemetry-notice-settings-link",onClick:()=>{t(),s()},children:"Settings"}),", or use the indicator in the top bar."]})}),h.jsx("button",{className:"telemetry-notice-dismiss","aria-label":"Dismiss analytics notice","data-testid":"telemetry-notice-dismiss",onClick:s,children:"×"})]})}const KE=/^[a-z0-9][a-z0-9-]{0,213}$/,Ry="sapiom-agent",JE=3,Lg=32,ZE=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 ep(s){return KE.test(s)}function QE(s){var v;const t=s.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),n=t.filter(c=>!ZE.has(c)),a=n.length>0?n:t,l=[];for(const c of a.slice(0,JE)){if((l.length===0?c:`${l.join("-")}-${c}`).length>Lg)break;l.push(c)}const d=l.join("-")||((v=a[0])==null?void 0:v.slice(0,Lg))||"";return ep(d)?d:Ry}function My(s,t){const n=(t==null?void 0:t.trim().replace(/\/+$/,""))??"",a=s.trim();return!n||!a?"":`${n}/${a}`}function ek(s){var t,n,a;return((t=s.settingsRoot)==null?void 0:t.trim())||((n=s.defaultProjectRoot)==null?void 0:n.trim())||((a=s.launchDir)==null?void 0:a.trim())||""}function tk(s){const t=s.replace(/\/+$/,""),n=t.lastIndexOf("/");if(n<0)return null;const a=t.slice(0,n);return a===t?null:a||"/"}function sk(s,t){const n=new Set(t);if(!n.has(s))return s;for(let a=2;a<1e3;a+=1){const l=`${s}-${a}`;if(!n.has(l)&&ep(l))return l}return s}const ik=[{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."}],nk={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 rk(s){return s?nk[s]??s.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function Dy(s){return s!=null&&s.label?s.score>0?`${s.label} ${s.score}/5`:s.label:"—"}function jy(s){const{basis:t}=s,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 a=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${n.join(", ")}${a}`}function ak(s){return`${s.label}: ${jy(s)}`}function Og(s,t){const n=t.trim().toLowerCase();return n?[s.name,s.description,s.id,...s.kind==="gallery"?s.tags:[],...s.kind==="gallery"?s.capabilities:[]].join(" ").toLowerCase().includes(n):!0}function ok(s,t){const n="When the project is ready, offer a free local test run (sapiom_dev_agents_run_local) as the next step.";return s.kind==="gallery"?`Clone the Sapiom gallery template "${s.id}" into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and templateId "${s.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 "${s.id}" starter in this directory: run \`sapiom agents init . -t ${s.id}\`, then run npm install and read AGENTS.md. Use the sapiom-agent-authoring skill to adapt the workflow. `+n}function lk(s){var l,d;const t=s.steps.map(v=>({id:v.name,kind:v.kind,label:v.name,role:v.kind.startsWith("terminal")?"terminal":v.kind==="entry"?"entry":"step",description:v.description??"",timeoutMs:null,inputSchema:null,capabilities:v.capabilities})),n=new Map;for(const v of s.transitions)v.kind==="continue"&&n.set(v.from,(n.get(v.from)??0)+1);const a=s.transitions.map(v=>({from:v.from,to:v.to,kind:v.kind==="pause"?"cross":(n.get(v.from)??0)>1?"branching":"sequential",label:v.label??""}));return{name:s.name,entry:((l=s.steps.find(v=>v.kind==="entry"))==null?void 0:l.name)??((d=s.steps[0])==null?void 0:d.name)??"",nodes:t,edges:a,groups:[],warnings:[]}}function ck(s,t){const n=s.kind==="starter"&&s.id==="default"?Ry:s.id;return My(n,t)}const ca="(none)",Bg={query:"",category:null,cadence:null};function uk(s){return s.query.trim()!==""||s.category!==null||s.cadence!==null}const hk={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function Ny(s){return s?hk[s]??s.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function Ly(s,t,n){const a=new Map;for(const l of s){const d=t(l)??ca;a.set(d,(a.get(d)??0)+1)}return[...a.entries()].map(([l,d])=>({value:l,label:n(l),count:d})).sort((l,d)=>l.value===ca?1:d.value===ca?-1:d.count-l.count||l.label.localeCompare(d.label))}function dk(s){return Ly(s,t=>t.category,t=>t===ca?"Uncategorised":rk(t))}function fk(s){return Ly(s,t=>t.cadence,t=>t===ca?"No trigger declared":Ny(t))}function Hg(s,t){return t===null?!0:t===ca?s===null:s===t}function pk(s,t,n){return s.filter(a=>n(a,t.query)&&Hg(a.category,t.category)&&Hg(a.cadence,t.cadence))}function mc({children:s,variant:t="tag",title:n}){return h.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:n,children:s})}const zg=3;function vk({template:s,onPreview:t,onUse:n}){const[a,l]=U.useState(!1),d=U.useRef(null),v=[{term:"Steps",value:String(s.stepCount)},{term:"Trigger",value:s.cadence?Ny(s.cadence):"Not declared"},{term:"Complexity",value:Dy(s.complexity),...s.complexity?{title:ak(s.complexity)}:{title:"This catalog response carried no complexity band."}},{term:"Capabilities",value:s.capabilities.length>0?String(s.capabilities.length):"None"}];return h.jsxs(h.Fragment,{children:[h.jsx("button",{ref:d,type:"button",className:"theme-toggle template-card-info","data-testid":`template-card-info-${s.id}`,"aria-label":`What ${s.name} runs and costs`,"aria-expanded":a,onClick:()=>l(c=>!c),children:h.jsx(me,{name:"Info",size:14})}),h.jsxs(cn,{open:a,anchorRef:d,onDismiss:()=>l(!1),placement:"down-end",className:"template-facts",testid:"template-facts",children:[h.jsx("dl",{className:"template-fact-list",children:v.map(c=>h.jsxs("div",{className:"template-fact",children:[h.jsx("dt",{children:c.term}),h.jsx("dd",{title:c.title,children:c.value})]},c.term))}),h.jsxs("div",{className:"template-fact-actions",children:[h.jsx("button",{type:"button",className:"btn-line","data-testid":`template-facts-preview-${s.id}`,onClick:()=>{l(!1),t(s)},children:"Preview"}),h.jsx("button",{type:"button",className:"btn-primary","data-testid":`template-facts-use-${s.id}`,onClick:()=>{l(!1),n(s)},children:"Use"})]})]})]})}function Ig({template:s,onOpen:t,onUse:n}){const a=s.kind==="gallery"?s.tags.slice(0,zg):[],l=s.kind==="gallery"?s.tags.length-a.length:0;return h.jsxs("article",{className:"template-card","data-testid":`template-card-${s.id}`,children:[h.jsx("button",{type:"button",className:"template-card-hitbox","data-testid":`template-card-open-${s.id}`,onClick:()=>t(s),children:h.jsxs("span",{className:"visually-hidden",children:["Open ",s.name]})}),h.jsxs("div",{className:"template-card-header",children:[h.jsx("h3",{className:"template-card-name",children:s.name}),s.kind==="gallery"&&h.jsx(vk,{template:s,onPreview:t,onUse:n})]}),h.jsx("p",{className:"template-card-desc","data-testid":"template-card-desc",children:s.description}),s.kind==="starter"?h.jsx("div",{className:"template-card-tags",children:h.jsx(mc,{children:"offline"})}):a.length>0&&h.jsxs("div",{className:"template-card-tags",children:[a.map(d=>h.jsx(mc,{children:d},d)),l>0&&h.jsxs(mc,{variant:"count",title:s.tags.slice(zg).join(", "),children:["+",l]})]})]})}function _k({detail:s}){const t=lk(s);return h.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(n=>{const a=t.edges.filter(l=>l.from===n.id);return h.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${n.id}`,children:[h.jsxs("div",{className:"template-graph-node",children:[h.jsx("span",{className:"canvas-step-dot dot--"+n.kind,"aria-hidden":"true"}),h.jsx("span",{className:"template-graph-name",children:n.label}),n.kind==="terminal-success"&&h.jsx("span",{className:"template-step-exit",children:"exit"}),n.kind==="terminal-warn"&&h.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),n.kind==="pause"&&h.jsx("span",{className:"template-step-pause",children:"pause"}),n.capabilities.map(l=>h.jsx("code",{className:"template-cap",children:l},l))]}),a.map(l=>h.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[h.jsx(me,{name:"CornerDownRight",size:12}),h.jsx("span",{className:"canvas-step-transition-target",children:l.to}),l.label&&h.jsx("span",{className:"canvas-step-transition-label",children:l.label})]},`${l.from}->${l.to}`))]},n.id)})})}function mk({example:s,index:t}){return h.jsxs("details",{className:"template-example",children:[h.jsx("summary",{className:"template-example-summary",children:s.title??`Example ${t+1}`}),h.jsxs("div",{className:"template-example-body",children:[h.jsx("span",{className:"template-example-label",children:"Input"}),h.jsx("pre",{className:"template-example-json",children:JSON.stringify(s.input,null,2)}),s.output!==null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"template-example-label",children:"Output"}),h.jsx("pre",{className:"template-example-json",children:JSON.stringify(s.output,null,2)})]})]})]})}function gk({detail:s}){return h.jsxs(h.Fragment,{children:[s.whatItDoes&&h.jsx("p",{className:"template-lead",children:s.whatItDoes}),s.steps.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Steps"}),h.jsx(_k,{detail:s}),h.jsx("ol",{className:"template-steps",children:s.steps.map((t,n)=>h.jsxs("li",{className:"template-step",children:[h.jsx("span",{className:"template-step-index","aria-hidden":"true",children:n+1}),h.jsxs("span",{className:"template-step-copy",children:[h.jsxs("span",{className:"template-step-name",children:[t.name,h.jsx("span",{className:"template-step-role",children:t.sublabel})]}),t.description&&h.jsx("span",{className:"template-step-desc",children:t.description})]}),t.capabilities.map(a=>h.jsx("code",{className:"template-cap",children:a},a))]},t.name))})]}),h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Capabilities and complexity"}),s.capabilities.length>0?h.jsx("div",{className:"template-caps",children:s.capabilities.map(t=>h.jsx("code",{className:"template-cap",children:t},t))}):h.jsx("p",{className:"template-note","data-testid":"template-caps-none",children:"Declares no metered capabilities."}),h.jsx("p",{className:"template-note","data-testid":"template-complexity-note",children:s.complexity?h.jsxs(h.Fragment,{children:[h.jsx("strong",{children:Dy(s.complexity)})," —"," ",jy(s.complexity),". A rough estimate of how involved this template is, not a price. Local test runs stub every capability and are free."]}):h.jsx(h.Fragment,{children:"This catalog response carried no complexity band, so none is shown. Local test runs stub every capability and are free."})})]}),s.requiredSecrets.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Credentials you supply"}),h.jsx("ul",{className:"template-usecases",children:s.requiredSecrets.map(t=>h.jsxs("li",{children:[h.jsx("code",{className:"template-cap",children:t.key})," ",t.label,t.description&&h.jsxs(h.Fragment,{children:[" — ",t.description]})]},t.key))})]}),s.useCases.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Use cases"}),h.jsx("ul",{className:"template-usecases",children:s.useCases.map(t=>h.jsx("li",{children:t},t))})]}),s.examples.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Examples"}),s.examples.map((t,n)=>h.jsx(mk,{example:t,index:n},t.title??n))]}),s.notes&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Notes"}),h.jsx("div",{className:"template-notes",children:h.jsx(Cy,{text:s.notes})})]})]})}function yk({template:s,getTemplate:t}){const[n,a]=U.useState(null),[l,d]=U.useState(null);return U.useEffect(()=>{if(s.kind!=="gallery"){a(null),d(null);return}let v=!1;return a(null),d(null),t(s.id).then(c=>{v||a(c)}).catch(c=>{v||d(c instanceof Error?c.message:String(c))}),()=>{v=!0}},[s.kind,s.id,t]),h.jsxs("div",{className:"template-detail","data-testid":"template-detail",children:[h.jsxs("div",{className:"template-detail-head",children:[h.jsx("h3",{className:"template-detail-name",children:s.name}),h.jsx("div",{className:"template-tags",children:(s.kind==="gallery"?s.tags:["bundled"]).map(v=>h.jsx("span",{className:"template-tag",children:v},v))})]}),s.kind==="gallery"?h.jsxs(h.Fragment,{children:[(n==null?void 0:n.author)&&h.jsxs("span",{className:"template-byline",children:["By"," ",n.author.url?h.jsx("a",{href:n.author.url,target:"_blank",rel:"noopener noreferrer",children:n.author.name}):n.author.name]}),!n&&!l&&h.jsx("p",{className:"template-lead",children:s.description}),l&&h.jsxs("p",{className:"template-note","data-testid":"template-detail-error",children:["Could not load this template’s details: ",l]}),n&&h.jsx(gk,{detail:n})]}):h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"template-lead",children:s.description}),h.jsx("p",{className:"template-note",children:"Scaffolds an npm-install-ready TypeScript project with a starter agent in index.ts."})]}),h.jsx("p",{className:"template-handoff","data-testid":"template-handoff",children:s.kind==="gallery"?"Using it forks the template into a repo you own, then clones it here. Needs a signed-in Sapiom account; the agent asks you to sign in if it is missing.":"Scaffolds offline from the template bundled with the CLI. No account, no network."})]})}function $g({title:s,allLabel:t,allCount:n,options:a,value:l,onSelect:d,testIdPrefix:v}){if(a.length<2)return null;const c=[{value:"",label:t,count:n,testId:`${v}-all`,selects:null},...a.map(u=>({...u,testId:`${v}-${u.value}`,selects:u.value}))];return h.jsxs("div",{className:"facet",children:[h.jsx("span",{className:"facet-title",children:s}),h.jsx("div",{className:"facet-rows",role:"radiogroup","aria-label":s,children:c.map(u=>{const p=l===u.selects;return h.jsxs("button",{type:"button",role:"radio","aria-checked":p,className:p?"facet-row is-active":"facet-row","data-testid":u.testId,onClick:()=>d(u.selects),children:[h.jsx("span",{className:"facet-row-label",children:u.label}),h.jsx(mc,{variant:"count",children:u.count})]},u.testId)})})]})}function bk({catalog:s,filter:t,onChange:n}){return h.jsxs("div",{className:"template-filters","data-testid":"template-filters",children:[h.jsxs("div",{className:"template-search",children:[h.jsx(me,{name:"Search",size:14}),h.jsx("input",{className:"template-search-input",type:"search",value:t.query,placeholder:"Search templates","aria-label":"Search templates","data-testid":"template-search",onChange:a=>n({...t,query:a.target.value})})]}),h.jsx($g,{title:"Category",allLabel:"All templates",allCount:s.length,options:dk(s),value:t.category,onSelect:a=>n({...t,category:a}),testIdPrefix:"templates-category"}),h.jsx($g,{title:"Trigger",allLabel:"Any trigger",allCount:s.length,options:fk(s),value:t.cadence,onSelect:a=>n({...t,cadence:a}),testIdPrefix:"templates-cadence"})]})}function Sk(s){const t=s.split("/").filter(Boolean);return t.length<=2?s:`/${t[0]}/…/${t[t.length-1]}`}function Qc({value:s,onChange:t,onSubmit:n,recentDirs:a,listDir:l,onNewDirChange:d}){const[v,c]=U.useState(s),[u,p]=U.useState([]),[y,f]=U.useState(s),[w,E]=U.useState(!1),[A,C]=U.useState(null),[b,S]=U.useState(0),[_,g]=U.useState(!0),[T,R]=U.useState(!1),[M,j]=U.useState(0),k=U.useRef(null),[D,B]=U.useState("none"),I=()=>{const Y=k.current;if(!Y)return;const O=Y.scrollLeft>2,F=Y.scrollLeft+Y.clientWidth<Y.scrollWidth-2;B(O&&F?"both":O?"left":F?"right":"none")};U.useEffect(()=>{I()},[a]),U.useEffect(()=>{let Y=!1;E(!0),C(null),R(!1);const O=L=>{const P=L.replace(/\/+$/,""),V=P.slice(0,P.lastIndexOf("/"));return!P.includes("/")||V===P?null:V||"/"},F=setTimeout(()=>{l(s||void 0).then(L=>{Y||(c(L.path),p(L.dirs),f(L.parent))}).catch(async()=>{const L=O(s);if(!L||Y){Y||C("Couldn't read that directory.");return}try{const P=await l(L);if(Y)return;c(P.path),p(P.dirs),f(P.parent),R(!0)}catch{Y||C("Couldn't read that directory.")}}).finally(()=>!Y&&E(!1))},150);return()=>{Y=!0,clearTimeout(F)}},[s,M]);const q=s.startsWith(v)?s.slice(v.length).replace(/^\//,""):"",$=q?u.filter(Y=>Y.name.toLowerCase().startsWith(q.toLowerCase())):u,J=Math.min(b,Math.max($.length-1,0)),ee=!w&&!A&&$.length===0&&(T||q!=="");U.useEffect(()=>{d==null||d(ee)},[ee]);const W=Y=>t(Y),G=Y=>{var F;const O=_&&$.length>0;Y.key==="ArrowDown"&&O?(Y.preventDefault(),S(Math.min(J+1,$.length-1))):Y.key==="ArrowUp"&&O?(Y.preventDefault(),S(Math.max(J-1,0))):Y.key==="Enter"&&(O?(W(((F=$[J])==null?void 0:F.path)??$[0].path),S(0)):n())};return h.jsxs("div",{className:"dir-picker",children:[h.jsxs("div",{className:"dir-picker-inputrow",children:[h.jsx("button",{type:"button",className:"dir-picker-up","data-testid":"dir-picker-up",disabled:y===v,onClick:()=>W(y),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:h.jsx(me,{name:"CornerLeftUp",size:14})}),h.jsx("input",{id:"new-session-cwd",autoFocus:!0,"aria-label":"Workspace folder",className:"modal-input dir-picker-input","data-testid":"dir-picker-input",value:s,placeholder:"/path/to/workspace",onChange:Y=>t(Y.target.value),onKeyDown:G}),h.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(_?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":_,onClick:()=>{if(!_){g(!0);return}ee&&v&&v!==s?W(v):g(!1)},"aria-label":"Browse subdirectories","data-tooltip":_?ee?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:h.jsx(me,{name:"Folder",size:14})})]}),a.length>0&&h.jsx("div",{className:"recent-dirs",ref:k,"data-fade":D,onScroll:I,children:a.map(Y=>h.jsx("button",{type:"button",className:"recent-dir-chip",title:Y,onClick:()=>W(Y),children:Sk(Y)},Y))}),_&&h.jsxs("div",{className:"dir-picker-listing","data-testid":"dir-picker-listing",children:[h.jsx("div",{className:"dir-picker-path",children:v}),w&&h.jsx("div",{className:"dir-picker-empty",children:"Loading…"}),!w&&A&&h.jsxs("div",{className:"dir-picker-error","data-testid":"dir-picker-error",role:"alert",children:[h.jsx(me,{name:"TriangleAlert",size:14}),h.jsx("span",{children:A}),h.jsx("button",{type:"button",className:"btn-ghost dir-picker-retry","data-testid":"dir-picker-retry",onClick:()=>j(Y=>Y+1),children:"Retry"})]}),ee&&h.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!w&&!A&&!ee&&$.length===0&&h.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!w&&!A&&$.map((Y,O)=>h.jsxs("button",{type:"button",className:"dir-picker-item"+(O===J?" is-selected":""),"data-testid":`dir-picker-item-${Y.name}`,onMouseEnter:()=>S(O),onClick:()=>W(Y.path),children:[h.jsx(me,{name:"Folder",size:13}),h.jsx("span",{className:"dir-picker-item-name",children:Y.name}),Y.hasAgentProject&&h.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${Y.name}`,title:"Contains sapiom.json",children:[h.jsx(me,{name:"Check",size:11}),"Agent"]})]},Y.path))]})]})}function wk({template:s,initialDest:t,recentDirs:n,listDir:a,onCancel:l,onConfirm:d,triggerRef:v}){const[c,u]=U.useState(t),[p,y]=U.useState(!1),[f,w]=U.useState(null),E=U.useRef(null);ga(!p,{onDismiss:l,containerRef:E,triggerRef:v});const A=async()=>{const C=c.trim();if(!(!C||p)){y(!0),w(null);try{await d(C)}catch(b){w(b.message),y(!1)}}};return h.jsx("div",{className:"modal-backdrop",children:h.jsxs("div",{className:"modal modal-confirm modal-template-use",role:"dialog","aria-label":`Use ${s.name}`,"data-testid":"template-use-dialog",ref:E,children:[h.jsxs("div",{className:"modal-header",children:["Use ",s.name,h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",disabled:p,onClick:l,children:h.jsx(me,{name:"X",size:14})})]}),h.jsxs("div",{className:"modal-body",children:[h.jsx(Qc,{value:c,onChange:u,onSubmit:()=>void A(),recentDirs:n,listDir:a}),f?h.jsx("p",{className:"modal-error","data-testid":"template-use-error",children:f}):h.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."})]}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",disabled:p,onClick:l,children:"Cancel"}),h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"template-use-confirm",disabled:p||!c.trim(),onClick:()=>void A(),children:p?"Starting…":"Start session"})]})]})})}function xk({projectRoot:s,recentDirs:t,listDir:n,onExit:a,onUse:l,listTemplates:d,getTemplate:v}){const[c,u]=U.useState(null),[p,y]=U.useState(null),[f,w]=U.useState(Bg),[E,A]=U.useState(null),[C,b]=U.useState(null),S=U.useRef(null);U.useEffect(()=>{let j=!1;return d().then(k=>{j||u(k)}).catch(k=>{j||y(k instanceof Error?k.message:String(k))}),()=>{j=!0}},[]);const _=U.useMemo(()=>((c==null?void 0:c.templates)??[]).map(j=>({...j,kind:"gallery"})),[c]),g=U.useMemo(()=>pk(_,f,Og),[_,f]),T=U.useMemo(()=>f.category!==null||f.cadence!==null?[]:ik.filter(j=>Og(j,f.query)),[f]),R=c===null&&p===null,M=p?`Could not load the template gallery: ${p}`:!c||c.source==="live"?null:c.reason==="signed-out"?"Sign in to Sapiom to browse the template gallery. The bundled starters below work offline.":"The template gallery is unreachable right now. The bundled starters below work offline.";return h.jsxs("section",{className:"templates-panel","data-testid":"templates-panel","aria-label":"Templates",children:[h.jsxs("div",{className:"templates-bar",children:[h.jsx("button",{type:"button",className:"theme-toggle templates-back","data-testid":E?"template-detail-back":"templates-exit","aria-label":E?"Back to all templates":"Back to the session",title:E?"All templates":"Back to the session",onClick:()=>E?A(null):a(),children:h.jsx(me,{name:"ArrowLeft",size:14})}),h.jsx("span",{className:"templates-bar-title",children:E?E.name:"Templates"}),E&&h.jsx("button",{ref:S,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>b(E),children:"Use template"})]}),h.jsx("div",{className:"templates-scroll",children:h.jsx("div",{className:"templates-measure",children:E?h.jsx(yk,{template:E,getTemplate:v}):h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"templates-hero",children:[h.jsx("h2",{className:"templates-hero-title",children:"Start from a template"}),h.jsx("p",{className:"templates-hero-copy",children:R?"Loading the catalog…":`${_.length} runnable agent workflows. Open one to read what it does, then use it. A session starts in a new folder and sets it up for you.`})]}),M&&h.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[h.jsx(me,{name:"TriangleAlert",size:14}),h.jsx("span",{children:M})]}),h.jsxs("div",{className:"templates-layout",children:[h.jsx(bk,{catalog:_,filter:f,onChange:w}),h.jsxs("div",{className:"templates-results",children:[g.length>0&&h.jsx("div",{className:"templates-grid","data-testid":"templates-grid",children:g.map(j=>h.jsx(Ig,{template:j,onOpen:A,onUse:b},j.id))}),g.length===0&&!R&&_.length>0&&h.jsx(fi,{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:uk(f)?h.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>w(Bg),children:"Clear filters"}):void 0}),T.length>0&&h.jsxs("section",{className:"templates-starters","data-testid":"templates-starters",children:[h.jsx("span",{className:"facet-title",children:"Bundled starters"}),h.jsx("p",{className:"templates-starters-copy",children:"Shipped with the CLI. These scaffold with no account and no network."}),h.jsx("div",{className:"templates-grid",children:T.map(j=>h.jsx(Ig,{template:j,onOpen:A,onUse:b},j.id))})]})]})]})]})})}),C&&h.jsx(wk,{template:C,initialDest:ck(C,s),recentDirs:t,listDir:n,onCancel:()=>b(null),triggerRef:S,onConfirm:async j=>{await l(j,C),a()}})]})}var Sd={exports:{}},Pg;function Ck(){return Pg||(Pg=1,(function(s,t){(function(n,a){s.exports=a()})(globalThis,(()=>(()=>{var n={4567:function(v,c,u){var p=this&&this.__decorate||function(_,g,T,R){var M,j=arguments.length,k=j<3?g:R===null?R=Object.getOwnPropertyDescriptor(g,T):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,g,T,R);else for(var D=_.length-1;D>=0;D--)(M=_[D])&&(k=(j<3?M(k):j>3?M(g,T,k):M(g,T))||k);return j>3&&k&&Object.defineProperty(g,T,k),k},y=this&&this.__param||function(_,g){return function(T,R){g(T,R,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=u(9042),w=u(9924),E=u(844),A=u(4725),C=u(2585),b=u(3656);let S=c.AccessibilityManager=class extends E.Disposable{constructor(_,g,T,R){super(),this._terminal=_,this._coreBrowserService=T,this._renderService=R,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 M=0;M<this._terminal.rows;M++)this._rowElements[M]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[M]);if(this._topBoundaryFocusListener=M=>this._handleBoundaryFocus(M,0),this._bottomBoundaryFocusListener=M=>this._handleBoundaryFocus(M,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 w.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((M=>this._handleResize(M.rows)))),this.register(this._terminal.onRender((M=>this._refreshRows(M.start,M.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((M=>this._handleChar(M)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
436
- `)))),this.register(this._terminal.onA11yTab((M=>this._handleTab(M)))),this.register(this._terminal.onKey((M=>this._handleKey(M.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,E.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(_){for(let g=0;g<_;g++)this._handleChar(" ")}_handleChar(_){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==_&&(this._charsToAnnounce+=_):this._charsToAnnounce+=_,_===`
437
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(_){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(_)||this._charsToConsume.push(_)}_refreshRows(_,g){this._liveRegionDebouncer.refresh(_,g,this._terminal.rows)}_renderRows(_,g){const T=this._terminal.buffer,R=T.lines.length.toString();for(let M=_;M<=g;M++){const j=T.lines.get(T.ydisp+M),k=[],D=(j==null?void 0:j.translateToString(!0,void 0,void 0,k))||"",B=(T.ydisp+M+1).toString(),I=this._rowElements[M];I&&(D.length===0?(I.innerText=" ",this._rowColumns.set(I,[0,1])):(I.textContent=D,this._rowColumns.set(I,k)),I.setAttribute("aria-posinset",B),I.setAttribute("aria-setsize",R))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(_,g){const T=_.target,R=this._rowElements[g===0?1:this._rowElements.length-2];if(T.getAttribute("aria-posinset")===(g===0?"1":`${this._terminal.buffer.lines.length}`)||_.relatedTarget!==R)return;let M,j;if(g===0?(M=T,j=this._rowElements.pop(),this._rowContainer.removeChild(j)):(M=this._rowElements.shift(),j=T,this._rowContainer.removeChild(M)),M.removeEventListener("focus",this._topBoundaryFocusListener),j.removeEventListener("focus",this._bottomBoundaryFocusListener),g===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(g===0?-1:1),this._rowElements[g===0?1:this._rowElements.length-2].focus(),_.preventDefault(),_.stopImmediatePropagation()}_handleSelectionChange(){var D;if(this._rowElements.length===0)return;const _=document.getSelection();if(!_)return;if(_.isCollapsed)return void(this._rowContainer.contains(_.anchorNode)&&this._terminal.clearSelection());if(!_.anchorNode||!_.focusNode)return void console.error("anchorNode and/or focusNode are null");let g={node:_.anchorNode,offset:_.anchorOffset},T={node:_.focusNode,offset:_.focusOffset};if((g.node.compareDocumentPosition(T.node)&Node.DOCUMENT_POSITION_PRECEDING||g.node===T.node&&g.offset>T.offset)&&([g,T]=[T,g]),g.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(g={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(g.node))return;const R=this._rowElements.slice(-1)[0];if(T.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(T={node:R,offset:((D=R.textContent)==null?void 0:D.length)??0}),!this._rowContainer.contains(T.node))return;const M=({node:B,offset:I})=>{const q=B instanceof Text?B.parentNode:B;let $=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN($))return console.warn("row is invalid. Race condition?"),null;const J=this._rowColumns.get(q);if(!J)return console.warn("columns is null. Race condition?"),null;let ee=I<J.length?J[I]:J.slice(-1)[0]+1;return ee>=this._terminal.cols&&(++$,ee=0),{row:$,column:ee}},j=M(g),k=M(T);if(j&&k){if(j.row>k.row||j.row===k.row&&j.column>=k.column)throw new Error("invalid range");this._terminal.select(j.column,j.row,(k.row-j.row)*this._terminal.cols-j.column+k.column)}}_handleResize(_){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let g=this._rowContainer.children.length;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);for(;this._rowElements.length>_;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const _=this._coreBrowserService.mainDocument.createElement("div");return _.setAttribute("role","listitem"),_.tabIndex=-1,this._refreshRowDimensions(_),_}_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 _=0;_<this._terminal.rows;_++)this._refreshRowDimensions(this._rowElements[_])}}_refreshRowDimensions(_){_.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=S=p([y(1,C.IInstantiationService),y(2,A.ICoreBrowserService),y(3,A.IRenderService)],S)},3614:(v,c)=>{function u(w){return w.replace(/\r?\n/g,"\r")}function p(w,E){return E?"\x1B[200~"+w+"\x1B[201~":w}function y(w,E,A,C){w=p(w=u(w),A.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),A.triggerDataEvent(w,!0),E.value=""}function f(w,E,A){const C=A.getBoundingClientRect(),b=w.clientX-C.left-10,S=w.clientY-C.top-10;E.style.width="20px",E.style.height="20px",E.style.left=`${b}px`,E.style.top=`${S}px`,E.style.zIndex="1000",E.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=u,c.bracketTextForPaste=p,c.copyHandler=function(w,E){w.clipboardData&&w.clipboardData.setData("text/plain",E.selectionText),w.preventDefault()},c.handlePasteEvent=function(w,E,A,C){w.stopPropagation(),w.clipboardData&&y(w.clipboardData.getData("text/plain"),E,A,C)},c.paste=y,c.moveTextAreaUnderMouseCursor=f,c.rightClickHandler=function(w,E,A,C,b){f(w,E,A),b&&C.rightClickSelect(w),E.value=C.selectionText,E.select()}},7239:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const p=u(1505);c.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(y,f,w){this._css.set(y,f,w)}getCss(y,f){return this._css.get(y,f)}setColor(y,f,w){this._color.set(y,f,w)}getColor(y,f){return this._color.get(y,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(u,p,y,f){u.addEventListener(p,y,f);let w=!1;return{dispose:()=>{w||(w=!0,u.removeEventListener(p,y,f))}}}},3551:function(v,c,u){var p=this&&this.__decorate||function(S,_,g,T){var R,M=arguments.length,j=M<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,g):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(S,_,g,T);else for(var k=S.length-1;k>=0;k--)(R=S[k])&&(j=(M<3?R(j):M>3?R(_,g,j):R(_,g))||j);return M>3&&j&&Object.defineProperty(_,g,j),j},y=this&&this.__param||function(S,_){return function(g,T){_(g,T,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const f=u(3656),w=u(8460),E=u(844),A=u(2585),C=u(4725);let b=c.Linkifier=class extends E.Disposable{get currentLink(){return this._currentLink}constructor(S,_,g,T,R){super(),this._element=S,this._mouseService=_,this._renderService=g,this._bufferService=T,this._linkProviderService=R,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new w.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new w.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,E.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,E.toDisposable)((()=>{var M;this._lastMouseEvent=void 0,(M=this._activeProviderReplies)==null||M.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(S){this._lastMouseEvent=S;const _=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!_)return;this._isMouseOut=!1;const g=S.composedPath();for(let T=0;T<g.length;T++){const R=g[T];if(R.classList.contains("xterm"))break;if(R.classList.contains("xterm-hover"))return}this._lastBufferCell&&_.x===this._lastBufferCell.x&&_.y===this._lastBufferCell.y||(this._handleHover(_),this._lastBufferCell=_)}_handleHover(S){if(this._activeLine!==S.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(S,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,S)||(this._clearCurrentLink(),this._askForLink(S,!0))}_askForLink(S,_){var T,R;this._activeProviderReplies&&_||((T=this._activeProviderReplies)==null||T.forEach((M=>{M==null||M.forEach((j=>{j.link.dispose&&j.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let g=!1;for(const[M,j]of this._linkProviderService.linkProviders.entries())_?(R=this._activeProviderReplies)!=null&&R.get(M)&&(g=this._checkLinkProviderResult(M,S,g)):j.provideLinks(S.y,(k=>{var B,I;if(this._isMouseOut)return;const D=k==null?void 0:k.map((q=>({link:q})));(B=this._activeProviderReplies)==null||B.set(M,D),g=this._checkLinkProviderResult(M,S,g),((I=this._activeProviderReplies)==null?void 0:I.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,_){const g=new Set;for(let T=0;T<_.size;T++){const R=_.get(T);if(R)for(let M=0;M<R.length;M++){const j=R[M],k=j.link.range.start.y<S?0:j.link.range.start.x,D=j.link.range.end.y>S?this._bufferService.cols:j.link.range.end.x;for(let B=k;B<=D;B++){if(g.has(B)){R.splice(M--,1);break}g.add(B)}}}}_checkLinkProviderResult(S,_,g){var M;if(!this._activeProviderReplies)return g;const T=this._activeProviderReplies.get(S);let R=!1;for(let j=0;j<S;j++)this._activeProviderReplies.has(j)&&!this._activeProviderReplies.get(j)||(R=!0);if(!R&&T){const j=T.find((k=>this._linkAtPosition(k.link,_)));j&&(g=!0,this._handleNewLink(j))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!g)for(let j=0;j<this._activeProviderReplies.size;j++){const k=(M=this._activeProviderReplies.get(j))==null?void 0:M.find((D=>this._linkAtPosition(D.link,_)));if(k){g=!0,this._handleNewLink(k);break}}return g}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const _=this._positionFromMouseEvent(S,this._element,this._mouseService);_&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,_)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,_){this._currentLink&&this._lastMouseEvent&&(!S||!_||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=_)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,E.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._linkAtPosition(S.link,_)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var g,T;return(T=(g=this._currentLink)==null?void 0:g.state)==null?void 0:T.decorations.pointerCursor},set:g=>{var T;(T=this._currentLink)!=null&&T.state&&this._currentLink.state.decorations.pointerCursor!==g&&(this._currentLink.state.decorations.pointerCursor=g,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",g))}},underline:{get:()=>{var g,T;return(T=(g=this._currentLink)==null?void 0:g.state)==null?void 0:T.decorations.underline},set:g=>{var T,R,M;(T=this._currentLink)!=null&&T.state&&((M=(R=this._currentLink)==null?void 0:R.state)==null?void 0:M.decorations.underline)!==g&&(this._currentLink.state.decorations.underline=g,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,g))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((g=>{if(!this._currentLink)return;const T=g.start===0?0:g.start+1+this._bufferService.buffer.ydisp,R=this._bufferService.buffer.ydisp+1+g.end;if(this._currentLink.link.range.start.y>=T&&this._currentLink.link.range.end.y<=R&&(this._clearCurrentLink(T,R),this._lastMouseEvent)){const M=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);M&&this._askForLink(M,!1)}}))))}_linkHover(S,_,g){var T;(T=this._currentLink)!=null&&T.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),_.hover&&_.hover(g,_.text)}_fireUnderlineEvent(S,_){const g=S.range,T=this._bufferService.buffer.ydisp,R=this._createLinkUnderlineEvent(g.start.x-1,g.start.y-T-1,g.end.x,g.end.y-T-1,void 0);(_?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(R)}_linkLeave(S,_,g){var T;(T=this._currentLink)!=null&&T.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),_.leave&&_.leave(g,_.text)}_linkAtPosition(S,_){const g=S.range.start.y*this._bufferService.cols+S.range.start.x,T=S.range.end.y*this._bufferService.cols+S.range.end.x,R=_.y*this._bufferService.cols+_.x;return g<=R&&R<=T}_positionFromMouseEvent(S,_,g){const T=g.getCoords(S,_,this._bufferService.cols,this._bufferService.rows);if(T)return{x:T[0],y:T[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,_,g,T,R){return{x1:S,y1:_,x2:g,y2:T,cols:this._bufferService.cols,fg:R}}};c.Linkifier=b=p([y(1,C.IMouseService),y(2,C.IRenderService),y(3,A.IBufferService),y(4,C.ILinkProviderService)],b)},9042:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(v,c,u){var p=this&&this.__decorate||function(C,b,S,_){var g,T=arguments.length,R=T<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,S):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,_);else for(var M=C.length-1;M>=0;M--)(g=C[M])&&(R=(T<3?g(R):T>3?g(b,S,R):g(b,S))||R);return T>3&&R&&Object.defineProperty(b,S,R),R},y=this&&this.__param||function(C,b){return function(S,_){b(S,_,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const f=u(511),w=u(2585);let E=c.OscLinkProvider=class{constructor(C,b,S){this._bufferService=C,this._optionsService=b,this._oscLinkService=S}provideLinks(C,b){var D;const S=this._bufferService.buffer.lines.get(C-1);if(!S)return void b(void 0);const _=[],g=this._optionsService.rawOptions.linkHandler,T=new f.CellData,R=S.getTrimmedLength();let M=-1,j=-1,k=!1;for(let B=0;B<R;B++)if(j!==-1||S.hasContent(B)){if(S.loadCell(B,T),T.hasExtendedAttrs()&&T.extended.urlId){if(j===-1){j=B,M=T.extended.urlId;continue}k=T.extended.urlId!==M}else j!==-1&&(k=!0);if(k||j!==-1&&B===R-1){const I=(D=this._oscLinkService.getLinkData(M))==null?void 0:D.uri;if(I){const q={start:{x:j+1,y:C},end:{x:B+(k||B!==R-1?0:1),y:C}};let $=!1;if(!(g!=null&&g.allowNonHttpProtocols))try{const J=new URL(I);["http:","https:"].includes(J.protocol)||($=!0)}catch{$=!0}$||_.push({text:I,range:q,activate:(J,ee)=>g?g.activate(J,ee,q):A(0,ee),hover:(J,ee)=>{var W;return(W=g==null?void 0:g.hover)==null?void 0:W.call(g,J,ee,q)},leave:(J,ee)=>{var W;return(W=g==null?void 0:g.leave)==null?void 0:W.call(g,J,ee,q)}})}k=!1,T.hasExtendedAttrs()&&T.extended.urlId?(j=B,M=T.extended.urlId):(j=-1,M=-1)}}b(_)}};function A(C,b){if(confirm(`Do you want to navigate to ${b}?
438
-
439
- WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=E=p([y(0,w.IBufferService),y(1,w.IOptionsService),y(2,w.IOscLinkService)],E)},6193:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(u,p){this._renderCallback=u,this._coreBrowserService=p,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,p,y){this._rowCount=y,u=u!==void 0?u:0,p=p!==void 0?p: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,p):p,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),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,p),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const p=u(3614),y=u(3656),f=u(3551),w=u(9042),E=u(3730),A=u(1680),C=u(3107),b=u(5744),S=u(2950),_=u(1296),g=u(428),T=u(4269),R=u(5114),M=u(8934),j=u(3230),k=u(9312),D=u(4725),B=u(6731),I=u(8055),q=u(8969),$=u(8460),J=u(844),ee=u(6114),W=u(8437),G=u(2584),Y=u(7399),O=u(5941),F=u(9074),L=u(2585),P=u(5435),V=u(4567),te=u(779);class de 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(K={}){super(K),this.browser=ee,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new J.MutableDisposable),this._onCursorMove=this.register(new $.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new $.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new $.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new $.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new $.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new $.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new $.EventEmitter),this._onBlur=this.register(new $.EventEmitter),this._onA11yCharEmitter=this.register(new $.EventEmitter),this._onA11yTabEmitter=this.register(new $.EventEmitter),this._onWillOpen=this.register(new $.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(F.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(te.LinkProviderService),this._instantiationService.setService(D.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(E.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((z,ie)=>this.refresh(z,ie)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((z=>this._reportWindowsOptions(z)))),this.register(this._inputHandler.onColor((z=>this._handleColorEvent(z)))),this.register((0,$.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,$.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((z=>this._afterResize(z.cols,z.rows)))),this.register((0,J.toDisposable)((()=>{var z,ie;this._customKeyEventHandler=void 0,(ie=(z=this.element)==null?void 0:z.parentNode)==null||ie.removeChild(this.element)})))}_handleColorEvent(K){if(this._themeService)for(const z of K){let ie,Q="";switch(z.index){case 256:ie="foreground",Q="10";break;case 257:ie="background",Q="11";break;case 258:ie="cursor",Q="12";break;default:ie="ansi",Q="4;"+z.index}switch(z.type){case 0:const we=I.color.toColorRGB(ie==="ansi"?this._themeService.colors.ansi[z.index]:this._themeService.colors[ie]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${Q};${(0,O.toRgbString)(we)}${G.C1_ESCAPED.ST}`);break;case 1:if(ie==="ansi")this._themeService.modifyColors((fe=>fe.ansi[z.index]=I.channels.toColor(...z.color)));else{const fe=ie;this._themeService.modifyColors((Le=>Le[fe]=I.channels.toColor(...z.color)))}break;case 2:this._themeService.restoreColor(z.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(K){K?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(K){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var K;return(K=this.textarea)==null?void 0:K.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 K=this.buffer.ybase+this.buffer.y,z=this.buffer.lines.get(K);if(!z)return;const ie=Math.min(this.buffer.x,this.cols-1),Q=this._renderService.dimensions.css.cell.height,we=z.getWidth(ie),fe=this._renderService.dimensions.css.cell.width*we,Le=this.buffer.y*this._renderService.dimensions.css.cell.height,ze=ie*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ze+"px",this.textarea.style.top=Le+"px",this.textarea.style.width=fe+"px",this.textarea.style.height=Q+"px",this.textarea.style.lineHeight=Q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,y.addDisposableDomListener)(this.element,"copy",(z=>{this.hasSelection()&&(0,p.copyHandler)(z,this._selectionService)})));const K=z=>(0,p.handlePasteEvent)(z,this.textarea,this.coreService,this.optionsService);this.register((0,y.addDisposableDomListener)(this.textarea,"paste",K)),this.register((0,y.addDisposableDomListener)(this.element,"paste",K)),ee.isFirefox?this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(z=>{z.button===2&&(0,p.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,y.addDisposableDomListener)(this.element,"contextmenu",(z=>{(0,p.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),ee.isLinux&&this.register((0,y.addDisposableDomListener)(this.element,"auxclick",(z=>{z.button===1&&(0,p.moveTextAreaUnderMouseCursor)(z,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,y.addDisposableDomListener)(this.textarea,"keyup",(K=>this._keyUp(K)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keydown",(K=>this._keyDown(K)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keypress",(K=>this._keyPress(K)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionupdate",(K=>this._compositionHelper.compositionupdate(K)))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,y.addDisposableDomListener)(this.textarea,"input",(K=>this._inputEvent(K)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(K){var ie;if(!K)throw new Error("Terminal requires a parent element.");if(K.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ie=this.element)==null?void 0:ie.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=K.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"),K.appendChild(this.element);const z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),z.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,y.addDisposableDomListener)(this.screenElement,"mousemove",(Q=>this.updateCursorStyle(Q)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),z.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",w.promptLabel),ee.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(R.CoreBrowserService,this.textarea,K.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(D.ICoreBrowserService,this._coreBrowserService),this.register((0,y.addDisposableDomListener)(this.textarea,"focus",(Q=>this._handleTextAreaFocus(Q)))),this.register((0,y.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(g.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(D.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(D.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(T.CharacterJoinerService),this._instantiationService.setService(D.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(j.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(D.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Q=>this._onRender.fire(Q)))),this.onResize((Q=>this._renderService.resize(Q.cols,Q.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(M.MouseService),this._instantiationService.setService(D.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(z);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((Q=>this.scrollLines(Q.amount,Q.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(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(D.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Q=>this.scrollLines(Q.amount,Q.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Q=>this._renderService.handleSelectionChanged(Q.start,Q.end,Q.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Q=>{this.textarea.value=Q,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Q=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,y.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(Q=>this._selectionService.handleMouseDown(Q)))),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(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Q=>this._handleScreenReaderModeOptionChange(Q)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Q=>{!this._overviewRulerRenderer&&Q&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const K=this,z=this.element;function ie(fe){const Le=K._mouseService.getMouseReportCoords(fe,K.screenElement);if(!Le)return!1;let ze,We;switch(fe.overrideType||fe.type){case"mousemove":We=32,fe.buttons===void 0?(ze=3,fe.button!==void 0&&(ze=fe.button<3?fe.button:3)):ze=1&fe.buttons?0:4&fe.buttons?1:2&fe.buttons?2:3;break;case"mouseup":We=0,ze=fe.button<3?fe.button:3;break;case"mousedown":We=1,ze=fe.button<3?fe.button:3;break;case"wheel":if(K._customWheelEventHandler&&K._customWheelEventHandler(fe)===!1||K.viewport.getLinesScrolled(fe)===0)return!1;We=fe.deltaY<0?0:1,ze=4;break;default:return!1}return!(We===void 0||ze===void 0||ze>4)&&K.coreMouseService.triggerMouseEvent({col:Le.col,row:Le.row,x:Le.x,y:Le.y,button:ze,action:We,ctrl:fe.ctrlKey,alt:fe.altKey,shift:fe.shiftKey})}const Q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},we={mouseup:fe=>(ie(fe),fe.buttons||(this._document.removeEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.removeEventListener("mousemove",Q.mousedrag)),this.cancel(fe)),wheel:fe=>(ie(fe),this.cancel(fe,!0)),mousedrag:fe=>{fe.buttons&&ie(fe)},mousemove:fe=>{fe.buttons||ie(fe)}};this.register(this.coreMouseService.onProtocolChange((fe=>{fe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(fe)),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&fe?Q.mousemove||(z.addEventListener("mousemove",we.mousemove),Q.mousemove=we.mousemove):(z.removeEventListener("mousemove",Q.mousemove),Q.mousemove=null),16&fe?Q.wheel||(z.addEventListener("wheel",we.wheel,{passive:!1}),Q.wheel=we.wheel):(z.removeEventListener("wheel",Q.wheel),Q.wheel=null),2&fe?Q.mouseup||(Q.mouseup=we.mouseup):(this._document.removeEventListener("mouseup",Q.mouseup),Q.mouseup=null),4&fe?Q.mousedrag||(Q.mousedrag=we.mousedrag):(this._document.removeEventListener("mousemove",Q.mousedrag),Q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,y.addDisposableDomListener)(z,"mousedown",(fe=>{if(fe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(fe))return ie(fe),Q.mouseup&&this._document.addEventListener("mouseup",Q.mouseup),Q.mousedrag&&this._document.addEventListener("mousemove",Q.mousedrag),this.cancel(fe)}))),this.register((0,y.addDisposableDomListener)(z,"wheel",(fe=>{if(!Q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(fe)===!1)return!1;if(!this.buffer.hasScrollback){const Le=this.viewport.getLinesScrolled(fe);if(Le===0)return;const ze=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(fe.deltaY<0?"A":"B");let We="";for(let Ge=0;Ge<Math.abs(Le);Ge++)We+=ze;return this.coreService.triggerDataEvent(We,!0),this.cancel(fe,!0)}return this.viewport.handleWheel(fe)?this.cancel(fe):void 0}}),{passive:!1})),this.register((0,y.addDisposableDomListener)(z,"touchstart",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(fe),this.cancel(fe)}),{passive:!0})),this.register((0,y.addDisposableDomListener)(z,"touchmove",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(fe)?void 0:this.cancel(fe)}),{passive:!1}))}refresh(K,z){var ie;(ie=this._renderService)==null||ie.refreshRows(K,z)}updateCursorStyle(K){var z;(z=this._selectionService)!=null&&z.shouldColumnSelect(K)?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(K,z,ie=0){var Q;ie===1?(super.scrollLines(K,z,ie),this.refresh(0,this.rows-1)):(Q=this.viewport)==null||Q.scrollLines(K)}paste(K){(0,p.paste)(K,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(K){this._customKeyEventHandler=K}attachCustomWheelEventHandler(K){this._customWheelEventHandler=K}registerLinkProvider(K){return this._linkProviderService.registerLinkProvider(K)}registerCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const z=this._characterJoinerService.register(K);return this.refresh(0,this.rows-1),z}deregisterCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(K)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(K){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+K)}registerDecoration(K){return this._decorationService.registerDecoration(K)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(K,z,ie){this._selectionService.setSelection(K,z,ie)}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 K;(K=this._selectionService)==null||K.clearSelection()}selectAll(){var K;(K=this._selectionService)==null||K.selectAll()}selectLines(K,z){var ie;(ie=this._selectionService)==null||ie.selectLines(K,z)}_keyDown(K){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;const z=this.browser.isMac&&this.options.macOptionIsMeta&&K.altKey;if(!z&&!this._compositionHelper.keydown(K))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;z||K.key!=="Dead"&&K.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ie=(0,Y.evaluateKeyboardEvent)(K,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(K),ie.type===3||ie.type===2){const Q=this.rows-1;return this.scrollLines(ie.type===2?-Q:Q),this.cancel(K,!0)}return ie.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,K)||(ie.cancel&&this.cancel(K,!0),!ie.key||!!(K.key&&!K.ctrlKey&&!K.altKey&&!K.metaKey&&K.key.length===1&&K.key.charCodeAt(0)>=65&&K.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ie.key!==G.C0.ETX&&ie.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ie.key,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(ie.key,!0),!this.optionsService.rawOptions.screenReaderMode||K.altKey||K.ctrlKey?this.cancel(K,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(K,z){const ie=K.isMac&&!this.options.macOptionIsMeta&&z.altKey&&!z.ctrlKey&&!z.metaKey||K.isWindows&&z.altKey&&z.ctrlKey&&!z.metaKey||K.isWindows&&z.getModifierState("AltGraph");return z.type==="keypress"?ie:ie&&(!z.keyCode||z.keyCode>47)}_keyUp(K){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1||((function(z){return z.keyCode===16||z.keyCode===17||z.keyCode===18})(K)||this.focus(),this.updateCursorStyle(K),this._keyPressHandled=!1)}_keyPress(K){let z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(this.cancel(K),K.charCode)z=K.charCode;else if(K.which===null||K.which===void 0)z=K.keyCode;else{if(K.which===0||K.charCode===0)return!1;z=K.which}return!(!z||(K.altKey||K.ctrlKey||K.metaKey)&&!this._isThirdLevelShift(this.browser,K)||(z=String.fromCharCode(z),this._onKey.fire({key:z,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(K){if(K.data&&K.inputType==="insertText"&&(!K.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const z=K.data;return this.coreService.triggerDataEvent(z,!0),this.cancel(K),!0}return!1}resize(K,z){K!==this.cols||z!==this.rows?super.resize(K,z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(K,z){var ie,Q;(ie=this._charSizeService)==null||ie.measure(),(Q=this.viewport)==null||Q.syncScrollArea(!0)}clear(){var K;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 z=1;z<this.rows;z++)this.buffer.lines.push(this.buffer.getBlankLine(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(K=this.viewport)==null||K.reset(),this.refresh(0,this.rows-1)}}reset(){var z,ie;this.options.rows=this.rows,this.options.cols=this.cols;const K=this._customKeyEventHandler;this._setup(),super.reset(),(z=this._selectionService)==null||z.reset(),this._decorationService.reset(),(ie=this.viewport)==null||ie.reset(),this._customKeyEventHandler=K,this.refresh(0,this.rows-1)}clearTextureAtlas(){var K;(K=this._renderService)==null||K.clearTextureAtlas()}_reportFocus(){var K;(K=this.element)!=null&&K.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(K){if(this._renderService)switch(K){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const z=this._renderService.dimensions.css.canvas.width.toFixed(0),ie=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${ie};${z}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Q=this._renderService.dimensions.css.cell.width.toFixed(0),we=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${we};${Q}t`)}}cancel(K,z){if(this.options.cancelEvents||z)return K.preventDefault(),K.stopPropagation(),!1}}c.Terminal=de},9924:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(u,p=1e3){this._renderCallback=u,this._debounceThresholdMS=p,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,p,y){this._rowCount=y,u=u!==void 0?u:0,p=p!==void 0?p: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,p):p;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const w=f-this._lastRefreshMs,E=this._debounceThresholdMS-w;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),E)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,p)}}},1680:function(v,c,u){var p=this&&this.__decorate||function(S,_,g,T){var R,M=arguments.length,j=M<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,g):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(S,_,g,T);else for(var k=S.length-1;k>=0;k--)(R=S[k])&&(j=(M<3?R(j):M>3?R(_,g,j):R(_,g))||j);return M>3&&j&&Object.defineProperty(_,g,j),j},y=this&&this.__param||function(S,_){return function(g,T){_(g,T,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const f=u(3656),w=u(4725),E=u(8460),A=u(844),C=u(2585);let b=c.Viewport=class extends A.Disposable{constructor(S,_,g,T,R,M,j,k){super(),this._viewportElement=S,this._scrollArea=_,this._bufferService=g,this._optionsService=T,this._charSizeService=R,this._renderService=M,this._coreBrowserService=j,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 E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((D=>this._renderDimensions=D))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((D=>this._handleThemeChange(D)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.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(S){if(S)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 _=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==_&&(this._lastRecordedBufferHeight=_,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){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 _=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<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(S,_){const g=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(_<0&&this._viewportElement.scrollTop!==0||_>0&&g<this._lastRecordedBufferHeight)||(S.cancelable&&S.preventDefault(),!1)}handleWheel(S){const _=this._getPixelsScrolled(S);return _!==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+_:this._smoothScrollState.target+=_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=_,this._bubbleScroll(S,_))}scrollLines(S){if(S!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const _=S*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:S,suppressScrollEvent:!1})}_getPixelsScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let _=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_LINE?_*=this._currentRowHeight:S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._currentRowHeight*this._bufferService.rows),_}getBufferElements(S,_){var k;let g,T="";const R=[],M=_??this._bufferService.buffer.lines.length,j=this._bufferService.buffer.lines;for(let D=S;D<M;D++){const B=j.get(D);if(!B)continue;const I=(k=j.get(D+1))==null?void 0:k.isWrapped;if(T+=B.translateToString(!I),!I||D===j.length-1){const q=document.createElement("div");q.textContent=T,R.push(q),T.length>0&&(g=q),T=""}}return{bufferElements:R,cursorElement:g}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let _=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(_/=this._currentRowHeight+0,this._wheelPartialScroll+=_,_=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._bufferService.rows),_}_applyScrollModifier(S,_){const g=this._optionsService.rawOptions.fastScrollModifier;return g==="alt"&&_.altKey||g==="ctrl"&&_.ctrlKey||g==="shift"&&_.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const _=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,_!==0&&(this._viewportElement.scrollTop+=_,this._bubbleScroll(S,_))}};c.Viewport=b=p([y(2,C.IBufferService),y(3,C.IOptionsService),y(4,w.ICharSizeService),y(5,w.IRenderService),y(6,w.ICoreBrowserService),y(7,w.IThemeService)],b)},3107:function(v,c,u){var p=this&&this.__decorate||function(C,b,S,_){var g,T=arguments.length,R=T<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,S):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,_);else for(var M=C.length-1;M>=0;M--)(g=C[M])&&(R=(T<3?g(R):T>3?g(b,S,R):g(b,S))||R);return T>3&&R&&Object.defineProperty(b,S,R),R},y=this&&this.__param||function(C,b){return function(S,_){b(S,_,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const f=u(4725),w=u(844),E=u(2585);let A=c.BufferDecorationRenderer=class extends w.Disposable{constructor(C,b,S,_,g){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=S,this._decorationService=_,this._renderService=g,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((T=>this._removeDecoration(T)))),this.register((0,w.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var _;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((_=C==null?void 0:C.options)==null?void 0:_.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=C.options.x??0;return S&&S>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let S=this._decorationElements.get(C);S||(S=this._createElement(C),C.element=S,this._decorationElements.set(C,S),this._container.appendChild(S),C.onDispose((()=>{this._decorationElements.delete(C),S.remove()}))),S.style.top=b*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(S)}}_refreshXPosition(C,b=C.element){if(!b)return;const S=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=A=p([y(1,E.IBufferService),y(2,f.ICoreBrowserService),y(3,E.IDecorationService),y(4,f.IRenderService)],A)},5871:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.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 p of this._zones)if(p.color===u.options.overviewRulerOptions.color&&p.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(p,u.marker.line))return;if(this._lineAdjacentToZone(p,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(p,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,p){return p>=u.startBufferLine&&p<=u.endBufferLine}_lineAdjacentToZone(u,p,y){return p>=u.startBufferLine-this._linePadding[y||"full"]&&p<=u.endBufferLine+this._linePadding[y||"full"]}_addLineToZone(u,p){u.startBufferLine=Math.min(u.startBufferLine,p),u.endBufferLine=Math.max(u.endBufferLine,p)}}},5744:function(v,c,u){var p=this&&this.__decorate||function(g,T,R,M){var j,k=arguments.length,D=k<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,R):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,T,R,M);else for(var B=g.length-1;B>=0;B--)(j=g[B])&&(D=(k<3?j(D):k>3?j(T,R,D):j(T,R))||D);return k>3&&D&&Object.defineProperty(T,R,D),D},y=this&&this.__param||function(g,T){return function(R,M){T(R,M,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const f=u(5871),w=u(4725),E=u(844),A=u(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let _=c.OverviewRulerRenderer=class extends E.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(g,T,R,M,j,k,D){var I;super(),this._viewportElement=g,this._screenElement=T,this._bufferService=R,this._decorationService=M,this._renderService=j,this._optionsService=k,this._coreBrowserService=D,this._colorZoneStore=new f.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(I=this._viewportElement.parentElement)==null||I.insertBefore(this._canvas,this._viewportElement);const B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,E.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 g=Math.floor(this._canvas.width/3),T=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=g,b.center=T,b.right=g,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=b.left,S.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const g=this._canvas.height/this._bufferService.buffer.lines.length,T=Math.round(Math.max(Math.min(g,12),6)*this._coreBrowserService.dpr);C.left=T,C.center=T,C.right=T}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 T of this._decorationService.decorations)this._colorZoneStore.addDecoration(T);this._ctx.lineWidth=1;const g=this._colorZoneStore.zones;for(const T of g)T.position!=="full"&&this._renderColorZone(T);for(const T of g)T.position==="full"&&this._renderColorZone(T);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(g){this._ctx.fillStyle=g.color,this._ctx.fillRect(S[g.position||"full"],Math.round((this._canvas.height-1)*(g.startBufferLine/this._bufferService.buffers.active.lines.length)-C[g.position||"full"]/2),b[g.position||"full"],Math.round((this._canvas.height-1)*((g.endBufferLine-g.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[g.position||"full"]))}_queueRefresh(g,T){this._shouldUpdateDimensions=g||this._shouldUpdateDimensions,this._shouldUpdateAnchor=T||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=_=p([y(2,A.IBufferService),y(3,A.IDecorationService),y(4,w.IRenderService),y(5,A.IOptionsService),y(6,w.ICoreBrowserService)],_)},2950:function(v,c,u){var p=this&&this.__decorate||function(C,b,S,_){var g,T=arguments.length,R=T<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,S):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,b,S,_);else for(var M=C.length-1;M>=0;M--)(g=C[M])&&(R=(T<3?g(R):T>3?g(b,S,R):g(b,S))||R);return T>3&&R&&Object.defineProperty(b,S,R),R},y=this&&this.__param||function(C,b){return function(S,_){b(S,_,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const f=u(4725),w=u(2585),E=u(2584);let A=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,S,_,g,T){this._textarea=C,this._compositionView=b,this._bufferService=S,this._optionsService=_,this._coreService=g,this._renderService=T,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,S=b.replace(C,"");this._dataAlreadySent=S,b.length>C.length?this._coreService.triggerDataEvent(S,!0):b.length<C.length?this._coreService.triggerDataEvent(`${E.C0.DEL}`,!0):b.length===C.length&&b!==C&&this._coreService.triggerDataEvent(b,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const b=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),S=this._renderService.dimensions.css.cell.height,_=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,g=b*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=g+"px",this._compositionView.style.top=_+"px",this._compositionView.style.height=S+"px",this._compositionView.style.lineHeight=S+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const T=this._compositionView.getBoundingClientRect();this._textarea.style.left=g+"px",this._textarea.style.top=_+"px",this._textarea.style.width=Math.max(T.width,1)+"px",this._textarea.style.height=Math.max(T.height,1)+"px",this._textarea.style.lineHeight=T.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=A=p([y(2,w.IBufferService),y(3,w.IOptionsService),y(4,w.ICoreService),y(5,f.IRenderService)],A)},9806:(v,c)=>{function u(p,y,f){const w=f.getBoundingClientRect(),E=p.getComputedStyle(f),A=parseInt(E.getPropertyValue("padding-left")),C=parseInt(E.getPropertyValue("padding-top"));return[y.clientX-w.left-A,y.clientY-w.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=u,c.getCoords=function(p,y,f,w,E,A,C,b,S){if(!A)return;const _=u(p,y,f);return _?(_[0]=Math.ceil((_[0]+(S?C/2:0))/C),_[1]=Math.ceil(_[1]/b),_[0]=Math.min(Math.max(_[0],1),w+(S?1:0)),_[1]=Math.min(Math.max(_[1],1),E),_):void 0}},9504:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const p=u(2584);function y(b,S,_,g){const T=b-f(b,_),R=S-f(S,_),M=Math.abs(T-R)-(function(j,k,D){let B=0;const I=j-f(j,D),q=k-f(k,D);for(let $=0;$<Math.abs(I-q);$++){const J=w(j,k)==="A"?-1:1,ee=D.buffer.lines.get(I+J*$);ee!=null&&ee.isWrapped&&B++}return B})(b,S,_);return C(M,A(w(b,S),g))}function f(b,S){let _=0,g=S.buffer.lines.get(b),T=g==null?void 0:g.isWrapped;for(;T&&b>=0&&b<S.rows;)_++,g=S.buffer.lines.get(--b),T=g==null?void 0:g.isWrapped;return _}function w(b,S){return b>S?"A":"B"}function E(b,S,_,g,T,R){let M=b,j=S,k="";for(;M!==_||j!==g;)M+=T?1:-1,T&&M>R.cols-1?(k+=R.buffer.translateBufferLineToString(j,!1,b,M),M=0,b=0,j++):!T&&M<0&&(k+=R.buffer.translateBufferLineToString(j,!1,0,b+1),M=R.cols-1,b=M,j--);return k+R.buffer.translateBufferLineToString(j,!1,b,M)}function A(b,S){const _=S?"O":"[";return p.C0.ESC+_+b}function C(b,S){b=Math.floor(b);let _="";for(let g=0;g<b;g++)_+=S;return _}c.moveToCellSequence=function(b,S,_,g){const T=_.buffer.x,R=_.buffer.y;if(!_.buffer.hasScrollback)return(function(k,D,B,I,q,$){return y(D,I,q,$).length===0?"":C(E(k,D,k,D-f(D,q),!1,q).length,A("D",$))})(T,R,0,S,_,g)+y(R,S,_,g)+(function(k,D,B,I,q,$){let J;J=y(D,I,q,$).length>0?I-f(I,q):D;const ee=I,W=(function(G,Y,O,F,L,P){let V;return V=y(O,F,L,P).length>0?F-f(F,L):Y,G<O&&V<=F||G>=O&&V<F?"C":"D"})(k,D,B,I,q,$);return C(E(k,J,B,ee,W==="C",q).length,A(W,$))})(T,R,b,S,_,g);let M;if(R===S)return M=T>b?"D":"C",C(Math.abs(T-b),A(M,g));M=R>S?"D":"C";const j=Math.abs(R-S);return C((function(k,D){return D.cols-k})(R>S?b:T,_)+(j-1)*_.cols+1+((R>S?T:b)-1),A(M,g))}},1296:function(v,c,u){var p=this&&this.__decorate||function($,J,ee,W){var G,Y=arguments.length,O=Y<3?J:W===null?W=Object.getOwnPropertyDescriptor(J,ee):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate($,J,ee,W);else for(var F=$.length-1;F>=0;F--)(G=$[F])&&(O=(Y<3?G(O):Y>3?G(J,ee,O):G(J,ee))||O);return Y>3&&O&&Object.defineProperty(J,ee,O),O},y=this&&this.__param||function($,J){return function(ee,W){J(ee,W,$)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const f=u(3787),w=u(2550),E=u(2223),A=u(6171),C=u(6052),b=u(4725),S=u(8055),_=u(8460),g=u(844),T=u(2585),R="xterm-dom-renderer-owner-",M="xterm-rows",j="xterm-fg-",k="xterm-bg-",D="xterm-focus",B="xterm-selection";let I=1,q=c.DomRenderer=class extends g.Disposable{constructor($,J,ee,W,G,Y,O,F,L,P,V,te,de){super(),this._terminal=$,this._document=J,this._element=ee,this._screenElement=W,this._viewportElement=G,this._helperContainer=Y,this._linkifier2=O,this._charSizeService=L,this._optionsService=P,this._bufferService=V,this._coreBrowserService=te,this._themeService=de,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new _.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(M),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(B),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((ge=>this._injectCss(ge)))),this._injectCss(this._themeService.colors),this._rowFactory=F.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(R+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ge=>this._handleLinkHover(ge)))),this.register(this._linkifier2.onHideLinkUnderline((ge=>this._handleLinkLeave(ge)))),this.register((0,g.toDisposable)((()=>{this._element.classList.remove(R+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new w.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 $=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*$,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*$),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/$),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/$),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 ee of this._rowElements)ee.style.width=`${this.dimensions.css.canvas.width}px`,ee.style.height=`${this.dimensions.css.cell.height}px`,ee.style.lineHeight=`${this.dimensions.css.cell.height}px`,ee.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const J=`${this._terminalSelector} .${M} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=J,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($){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let J=`${this._terminalSelector} .${M} { color: ${$.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;J+=`${this._terminalSelector} .${M} .xterm-dim { color: ${S.color.multiplyOpacity($.foreground,.5).css};}`,J+=`${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 ee=`blink_underline_${this._terminalClass}`,W=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;J+=`@keyframes ${ee} { 50% { border-bottom-style: hidden; }}`,J+=`@keyframes ${W} { 50% { box-shadow: none; }}`,J+=`@keyframes ${G} { 0% { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css}; } 50% { background-color: inherit; color: ${$.cursor.css}; }}`,J+=`${this._terminalSelector} .${M}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${ee} 1s step-end infinite;}${this._terminalSelector} .${M}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${M}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-block { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css};}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${$.cursor.css} !important; color: ${$.cursorAccent.css} !important;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${$.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${$.cursor.css} inset;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${$.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,J+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${$.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${$.selectionInactiveBackgroundOpaque.css};}`;for(const[Y,O]of $.ansi.entries())J+=`${this._terminalSelector} .${j}${Y} { color: ${O.css}; }${this._terminalSelector} .${j}${Y}.xterm-dim { color: ${S.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${k}${Y} { background-color: ${O.css}; }`;J+=`${this._terminalSelector} .${j}${E.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque($.background).css}; }${this._terminalSelector} .${j}${E.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque($.background),.5).css}; }${this._terminalSelector} .${k}${E.INVERTED_DEFAULT_COLOR} { background-color: ${$.foreground.css}; }`,this._themeStyleElement.textContent=J}_setDefaultSpacing(){const $=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${$}px`,this._rowFactory.defaultSpacing=$}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements($,J){for(let ee=this._rowElements.length;ee<=J;ee++){const W=this._document.createElement("div");this._rowContainer.appendChild(W),this._rowElements.push(W)}for(;this._rowElements.length>J;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize($,J){this._refreshRowElements($,J),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(D),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(D),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged($,J,ee){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged($,J,ee),this.renderRows(0,this._bufferService.rows-1),!$||!J)return;this._selectionRenderModel.update(this._terminal,$,J,ee);const W=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,Y=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(Y>=this._bufferService.rows||O<0)return;const F=this._document.createDocumentFragment();if(ee){const L=$[0]>J[0];F.appendChild(this._createSelectionElement(Y,L?J[0]:$[0],L?$[0]:J[0],O-Y+1))}else{const L=W===Y?$[0]:0,P=Y===G?J[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(Y,L,P));const V=O-Y-1;if(F.appendChild(this._createSelectionElement(Y+1,0,this._bufferService.cols,V)),Y!==O){const te=G===O?J[0]:this._bufferService.cols;F.appendChild(this._createSelectionElement(O,0,te))}}this._selectionContainer.appendChild(F)}_createSelectionElement($,J,ee,W=1){const G=this._document.createElement("div"),Y=J*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(ee-J);return Y+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-Y),G.style.height=W*this.dimensions.css.cell.height+"px",G.style.top=$*this.dimensions.css.cell.height+"px",G.style.left=`${Y}px`,G.style.width=`${O}px`,G}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 $ of this._rowElements)$.replaceChildren()}renderRows($,J){const ee=this._bufferService.buffer,W=ee.ybase+ee.y,G=Math.min(ee.x,this._bufferService.cols-1),Y=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,F=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=$;L<=J;L++){const P=L+ee.ydisp,V=this._rowElements[L],te=ee.lines.get(P);if(!V||!te)break;V.replaceChildren(...this._rowFactory.createRow(te,P,P===W,O,F,G,Y,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${R}${this._terminalClass}`}_handleLinkHover($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!0)}_handleLinkLeave($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!1)}_setCellUnderline($,J,ee,W,G,Y){ee<0&&($=0),W<0&&(J=0);const O=this._bufferService.rows-1;ee=Math.max(Math.min(ee,O),0),W=Math.max(Math.min(W,O),0),G=Math.min(G,this._bufferService.cols);const F=this._bufferService.buffer,L=F.ybase+F.y,P=Math.min(F.x,G-1),V=this._optionsService.rawOptions.cursorBlink,te=this._optionsService.rawOptions.cursorStyle,de=this._optionsService.rawOptions.cursorInactiveStyle;for(let ge=ee;ge<=W;++ge){const K=ge+F.ydisp,z=this._rowElements[ge],ie=F.lines.get(K);if(!z||!ie)break;z.replaceChildren(...this._rowFactory.createRow(ie,K,K===L,te,de,P,V,this.dimensions.css.cell.width,this._widthCache,Y?ge===ee?$:0:-1,Y?(ge===W?J:G)-1:-1))}}};c.DomRenderer=q=p([y(7,T.IInstantiationService),y(8,b.ICharSizeService),y(9,T.IOptionsService),y(10,T.IBufferService),y(11,b.ICoreBrowserService),y(12,b.IThemeService)],q)},3787:function(v,c,u){var p=this&&this.__decorate||function(M,j,k,D){var B,I=arguments.length,q=I<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(M,j,k,D);else for(var $=M.length-1;$>=0;$--)(B=M[$])&&(q=(I<3?B(q):I>3?B(j,k,q):B(j,k))||q);return I>3&&q&&Object.defineProperty(j,k,q),q},y=this&&this.__param||function(M,j){return function(k,D){j(k,D,M)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const f=u(2223),w=u(643),E=u(511),A=u(2585),C=u(8055),b=u(4725),S=u(4269),_=u(6171),g=u(3734);let T=c.DomRendererRowFactory=class{constructor(M,j,k,D,B,I,q){this._document=M,this._characterJoinerService=j,this._optionsService=k,this._coreBrowserService=D,this._coreService=B,this._decorationService=I,this._themeService=q,this._workCell=new E.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(M,j,k){this._selectionStart=M,this._selectionEnd=j,this._columnSelectMode=k}createRow(M,j,k,D,B,I,q,$,J,ee,W){const G=[],Y=this._characterJoinerService.getJoinedCharacters(j),O=this._themeService.colors;let F,L=M.getNoBgTrimmedLength();k&&L<I+1&&(L=I+1);let P=0,V="",te=0,de=0,ge=0,K=!1,z=0,ie=!1,Q=0;const we=[],fe=ee!==-1&&W!==-1;for(let Le=0;Le<L;Le++){M.loadCell(Le,this._workCell);let ze=this._workCell.getWidth();if(ze===0)continue;let We=!1,Ge=Le,De=this._workCell;if(Y.length>0&&Le===Y[0][0]){We=!0;const nt=Y.shift();De=new S.JoinedCellData(this._workCell,M.translateToString(!0,nt[0],nt[1]),nt[1]-nt[0]),Ge=nt[1]-1,ze=De.getWidth()}const dt=this._isCellInSelection(Le,j),At=k&&Le===I,qt=fe&&Le>=ee&&Le<=W;let jt=!1;this._decorationService.forEachDecorationAtCell(Le,j,void 0,(nt=>{jt=!0}));let Nt=De.getChars()||w.WHITESPACE_CELL_CHAR;if(Nt===" "&&(De.isUnderline()||De.isOverline())&&(Nt=" "),Q=ze*$-J.get(Nt,De.isBold(),De.isItalic()),F){if(P&&(dt&&ie||!dt&&!ie&&De.bg===te)&&(dt&&ie&&O.selectionForeground||De.fg===de)&&De.extended.ext===ge&&qt===K&&Q===z&&!At&&!We&&!jt){De.isInvisible()?V+=w.WHITESPACE_CELL_CHAR:V+=Nt,P++;continue}P&&(F.textContent=V),F=this._document.createElement("span"),P=0,V=""}else F=this._document.createElement("span");if(te=De.bg,de=De.fg,ge=De.extended.ext,K=qt,z=Q,ie=dt,We&&I>=Le&&I<=Ge&&(I=Le),!this._coreService.isCursorHidden&&At&&this._coreService.isCursorInitialized){if(we.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&we.push("xterm-cursor-blink"),we.push(D==="bar"?"xterm-cursor-bar":D==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":we.push("xterm-cursor-outline");break;case"block":we.push("xterm-cursor-block");break;case"bar":we.push("xterm-cursor-bar");break;case"underline":we.push("xterm-cursor-underline")}}if(De.isBold()&&we.push("xterm-bold"),De.isItalic()&&we.push("xterm-italic"),De.isDim()&&we.push("xterm-dim"),V=De.isInvisible()?w.WHITESPACE_CELL_CHAR:De.getChars()||w.WHITESPACE_CELL_CHAR,De.isUnderline()&&(we.push(`xterm-underline-${De.extended.underlineStyle}`),V===" "&&(V=" "),!De.isUnderlineColorDefault()))if(De.isUnderlineColorRGB())F.style.textDecorationColor=`rgb(${g.AttributeData.toColorRGB(De.getUnderlineColor()).join(",")})`;else{let nt=De.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&De.isBold()&&nt<8&&(nt+=8),F.style.textDecorationColor=O.ansi[nt].css}De.isOverline()&&(we.push("xterm-overline"),V===" "&&(V=" ")),De.isStrikethrough()&&we.push("xterm-strikethrough"),qt&&(F.style.textDecoration="underline");let ct=De.getFgColor(),ut=De.getFgColorMode(),es=De.getBgColor(),Yt=De.getBgColorMode();const ts=!!De.isInverse();if(ts){const nt=ct;ct=es,es=nt;const Ee=ut;ut=Yt,Yt=Ee}let ot,Xt,Wt,ss=!1;switch(this._decorationService.forEachDecorationAtCell(Le,j,void 0,(nt=>{nt.options.layer!=="top"&&ss||(nt.backgroundColorRGB&&(Yt=50331648,es=nt.backgroundColorRGB.rgba>>8&16777215,ot=nt.backgroundColorRGB),nt.foregroundColorRGB&&(ut=50331648,ct=nt.foregroundColorRGB.rgba>>8&16777215,Xt=nt.foregroundColorRGB),ss=nt.options.layer==="top")})),!ss&&dt&&(ot=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,es=ot.rgba>>8&16777215,Yt=50331648,ss=!0,O.selectionForeground&&(ut=50331648,ct=O.selectionForeground.rgba>>8&16777215,Xt=O.selectionForeground)),ss&&we.push("xterm-decoration-top"),Yt){case 16777216:case 33554432:Wt=O.ansi[es],we.push(`xterm-bg-${es}`);break;case 50331648:Wt=C.channels.toColor(es>>16,es>>8&255,255&es),this._addStyle(F,`background-color:#${R((es>>>0).toString(16),"0",6)}`);break;default:ts?(Wt=O.foreground,we.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):Wt=O.background}switch(ot||De.isDim()&&(ot=C.color.multiplyOpacity(Wt,.5)),ut){case 16777216:case 33554432:De.isBold()&&ct<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ct+=8),this._applyMinimumContrast(F,Wt,O.ansi[ct],De,ot,void 0)||we.push(`xterm-fg-${ct}`);break;case 50331648:const nt=C.channels.toColor(ct>>16&255,ct>>8&255,255&ct);this._applyMinimumContrast(F,Wt,nt,De,ot,Xt)||this._addStyle(F,`color:#${R(ct.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(F,Wt,O.foreground,De,ot,Xt)||ts&&we.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}we.length&&(F.className=we.join(" "),we.length=0),At||We||jt?F.textContent=V:P++,Q!==this.defaultSpacing&&(F.style.letterSpacing=`${Q}px`),G.push(F),Le=Ge}return F&&P&&(F.textContent=V),G}_applyMinimumContrast(M,j,k,D,B,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,_.treatGlyphAsBackgroundColor)(D.getCode()))return!1;const q=this._getContrastCache(D);let $;if(B||I||($=q.getColor(j.rgba,k.rgba)),$===void 0){const J=this._optionsService.rawOptions.minimumContrastRatio/(D.isDim()?2:1);$=C.color.ensureContrastRatio(B||j,I||k,J),q.setColor((B||j).rgba,(I||k).rgba,$??null)}return!!$&&(this._addStyle(M,`color:${$.css}`),!0)}_getContrastCache(M){return M.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(M,j){M.setAttribute("style",`${M.getAttribute("style")||""}${j};`)}_isCellInSelection(M,j){const k=this._selectionStart,D=this._selectionEnd;return!(!k||!D)&&(this._columnSelectMode?k[0]<=D[0]?M>=k[0]&&j>=k[1]&&M<D[0]&&j<=D[1]:M<k[0]&&j>=k[1]&&M>=D[0]&&j<=D[1]:j>k[1]&&j<D[1]||k[1]===D[1]&&j===k[1]&&M>=k[0]&&M<D[0]||k[1]<D[1]&&j===D[1]&&M<D[0]||k[1]<D[1]&&j===k[1]&&M>=k[0])}};function R(M,j,k){for(;M.length<k;)M=j+M;return M}c.DomRendererRowFactory=T=p([y(1,b.ICharacterJoinerService),y(2,A.IOptionsService),y(3,b.ICoreBrowserService),y(4,A.ICoreService),y(5,A.IDecorationService),y(6,b.IThemeService)],T)},2550:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(u,p){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 y=u.createElement("span");y.classList.add("xterm-char-measure-element");const f=u.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const w=u.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontStyle="italic";const E=u.createElement("span");E.classList.add("xterm-char-measure-element"),E.style.fontWeight="bold",E.style.fontStyle="italic",this._measureElements=[y,f,w,E],this._container.appendChild(y),this._container.appendChild(f),this._container.appendChild(w),this._container.appendChild(E),p.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,p,y,f){u===this._font&&p===this._fontSize&&y===this._weight&&f===this._weightBold||(this._font=u,this._fontSize=p,this._weight=y,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${y}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${y}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(u,p,y){let f=0;if(!p&&!y&&u.length===1&&(f=u.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const A=this._measure(u,0);return A>0&&(this._flat[f]=A),A}let w=u;p&&(w+="B"),y&&(w+="I");let E=this._holey.get(w);if(E===void 0){let A=0;p&&(A|=1),y&&(A|=2),E=this._measure(u,A),E>0&&this._holey.set(w,E)}return E}_measure(u,p){const y=this._measureElements[p];return y.textContent=u.repeat(32),y.offsetWidth/32}}},2223:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const p=u(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=p.isFirefox||p.isLegacyEdge?"bottom":"ideographic"},6171:(v,c)=>{function u(y){return 57508<=y&&y<=57558}function p(y){return y>=128512&&y<=128591||y>=127744&&y<=128511||y>=128640&&y<=128767||y>=9728&&y<=9983||y>=9984&&y<=10175||y>=65024&&y<=65039||y>=129280&&y<=129535||y>=127462&&y<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(y){if(!y)throw new Error("value must not be falsy");return y},c.isPowerlineGlyph=u,c.isRestrictedPowerlineGlyph=function(y){return 57520<=y&&y<=57527},c.isEmoji=p,c.allowRescaling=function(y,f,w,E){return f===1&&w>Math.ceil(1.5*E)&&y!==void 0&&y>255&&!p(y)&&!u(y)&&!(function(A){return 57344<=A&&A<=63743})(y)},c.treatGlyphAsBackgroundColor=function(y){return u(y)||(function(f){return 9472<=f&&f<=9631})(y)},c.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}}}},c.computeNextVariantOffset=function(y,f,w=0){return(y-(2*Math.round(f)-w))%(2*Math.round(f))}},6052:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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(y,f,w,E=!1){if(this.selectionStart=f,this.selectionEnd=w,!f||!w||f[0]===w[0]&&f[1]===w[1])return void this.clear();const A=y.buffers.active.ydisp,C=f[1]-A,b=w[1]-A,S=Math.max(C,0),_=Math.min(b,y.rows-1);S>=y.rows||_<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=S,this.viewportCappedEndRow=_,this.startCol=f[0],this.endCol=w[0])}isCellSelected(y,f,w){return!!this.hasSelection&&(w-=y.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&w>=this.viewportCappedStartRow&&f<this.endCol&&w<=this.viewportCappedEndRow:f<this.startCol&&w>=this.viewportCappedStartRow&&f>=this.endCol&&w<=this.viewportCappedEndRow:w>this.viewportStartRow&&w<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&w===this.viewportStartRow&&f>=this.startCol&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportEndRow&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportStartRow&&f>=this.startCol)}}c.createSelectionRenderModel=function(){return new u}},456:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.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,p=this.selectionEnd;return!(!u||!p)&&(u[1]>p[1]||u[1]===p[1]&&u[0]>p[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(v,c,u){var p=this&&this.__decorate||function(_,g,T,R){var M,j=arguments.length,k=j<3?g:R===null?R=Object.getOwnPropertyDescriptor(g,T):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,g,T,R);else for(var D=_.length-1;D>=0;D--)(M=_[D])&&(k=(j<3?M(k):j>3?M(g,T,k):M(g,T))||k);return j>3&&k&&Object.defineProperty(g,T,k),k},y=this&&this.__param||function(_,g){return function(T,R){g(T,R,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const f=u(2585),w=u(8460),E=u(844);let A=c.CharSizeService=class extends E.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(_,g,T){super(),this._optionsService=T,this.width=0,this.height=0,this._onCharSizeChange=this.register(new w.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new b(_,g,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const _=this._measureStrategy.measure();_.width===this.width&&_.height===this.height||(this.width=_.width,this.height=_.height,this._onCharSizeChange.fire())}};c.CharSizeService=A=p([y(2,f.IOptionsService)],A);class C extends E.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(g,T){g!==void 0&&g>0&&T!==void 0&&T>0&&(this._result.width=g,this._result.height=T)}}class b extends C{constructor(g,T,R){super(),this._document=g,this._parentElement=T,this._optionsService=R,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class S extends C{constructor(g){super(),this._optionsService=g,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const T=this._ctx.measureText("W");if(!("width"in T&&"fontBoundingBoxAscent"in T&&"fontBoundingBoxDescent"in T))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const g=this._ctx.measureText("W");return this._validateAndSet(g.width,g.fontBoundingBoxAscent+g.fontBoundingBoxDescent),this._result}}},4269:function(v,c,u){var p=this&&this.__decorate||function(S,_,g,T){var R,M=arguments.length,j=M<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,g):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(S,_,g,T);else for(var k=S.length-1;k>=0;k--)(R=S[k])&&(j=(M<3?R(j):M>3?R(_,g,j):R(_,g))||j);return M>3&&j&&Object.defineProperty(_,g,j),j},y=this&&this.__param||function(S,_){return function(g,T){_(g,T,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const f=u(3734),w=u(643),E=u(511),A=u(2585);class C extends f.AttributeData{constructor(_,g,T){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=g,this._width=T}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=C;let b=c.CharacterJoinerService=class Oy{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new E.CellData}register(_){const g={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(g),g.id}deregister(_){for(let g=0;g<this._characterJoiners.length;g++)if(this._characterJoiners[g].id===_)return this._characterJoiners.splice(g,1),!0;return!1}getJoinedCharacters(_){if(this._characterJoiners.length===0)return[];const g=this._bufferService.buffer.lines.get(_);if(!g||g.length===0)return[];const T=[],R=g.translateToString(!0);let M=0,j=0,k=0,D=g.getFg(0),B=g.getBg(0);for(let I=0;I<g.getTrimmedLength();I++)if(g.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==D||this._workCell.bg!==B){if(I-M>1){const q=this._getJoinedRanges(R,k,j,g,M);for(let $=0;$<q.length;$++)T.push(q[$])}M=I,k=j,D=this._workCell.fg,B=this._workCell.bg}j+=this._workCell.getChars().length||w.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-M>1){const I=this._getJoinedRanges(R,k,j,g,M);for(let q=0;q<I.length;q++)T.push(I[q])}return T}_getJoinedRanges(_,g,T,R,M){const j=_.substring(g,T);let k=[];try{k=this._characterJoiners[0].handler(j)}catch(D){console.error(D)}for(let D=1;D<this._characterJoiners.length;D++)try{const B=this._characterJoiners[D].handler(j);for(let I=0;I<B.length;I++)Oy._mergeRanges(k,B[I])}catch(B){console.error(B)}return this._stringRangesToCellRanges(k,R,M),k}_stringRangesToCellRanges(_,g,T){let R=0,M=!1,j=0,k=_[R];if(k){for(let D=T;D<this._bufferService.cols;D++){const B=g.getWidth(D),I=g.getString(D).length||w.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!M&&k[0]<=j&&(k[0]=D,M=!0),k[1]<=j){if(k[1]=D,k=_[++R],!k)break;k[0]<=j?(k[0]=D,M=!0):M=!1}j+=I}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(_,g){let T=!1;for(let R=0;R<_.length;R++){const M=_[R];if(T){if(g[1]<=M[0])return _[R-1][1]=g[1],_;if(g[1]<=M[1])return _[R-1][1]=Math.max(g[1],M[1]),_.splice(R,1),_;_.splice(R,1),R--}else{if(g[1]<=M[0])return _.splice(R,0,g),_;if(g[1]<=M[1])return M[0]=Math.min(g[0],M[0]),_;g[0]<M[1]&&(M[0]=Math.min(g[0],M[0]),T=!0)}}return T?_[_.length-1][1]=g[1]:_.push(g),_}};c.CharacterJoinerService=b=p([y(0,A.IBufferService)],b)},5114:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const p=u(844),y=u(8460),f=u(3656);class w extends p.Disposable{constructor(C,b,S){super(),this._textarea=C,this._window=b,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new E(this._window),this._onDprChange=this.register(new y.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new y.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((_=>this._screenDprMonitor.setWindow(_)))),this.register((0,y.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(C){this._window!==C&&(this._window=C,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}}c.CoreBrowserService=w;class E extends p.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new p.MutableDisposable),this._onDprChange=this.register(new y.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,p.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const p=u(844);class y extends p.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,p.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(w){return this.linkProviders.push(w),{dispose:()=>{const E=this.linkProviders.indexOf(w);E!==-1&&this.linkProviders.splice(E,1)}}}}c.LinkProviderService=y},8934:function(v,c,u){var p=this&&this.__decorate||function(A,C,b,S){var _,g=arguments.length,T=g<3?C:S===null?S=Object.getOwnPropertyDescriptor(C,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(A,C,b,S);else for(var R=A.length-1;R>=0;R--)(_=A[R])&&(T=(g<3?_(T):g>3?_(C,b,T):_(C,b))||T);return g>3&&T&&Object.defineProperty(C,b,T),T},y=this&&this.__param||function(A,C){return function(b,S){C(b,S,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const f=u(4725),w=u(9806);let E=c.MouseService=class{constructor(A,C){this._renderService=A,this._charSizeService=C}getCoords(A,C,b,S,_){return(0,w.getCoords)(window,A,C,b,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,_)}getMouseReportCoords(A,C){const b=(0,w.getCoordsRelativeToElement)(window,A,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};c.MouseService=E=p([y(0,f.IRenderService),y(1,f.ICharSizeService)],E)},3230:function(v,c,u){var p=this&&this.__decorate||function(_,g,T,R){var M,j=arguments.length,k=j<3?g:R===null?R=Object.getOwnPropertyDescriptor(g,T):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,g,T,R);else for(var D=_.length-1;D>=0;D--)(M=_[D])&&(k=(j<3?M(k):j>3?M(g,T,k):M(g,T))||k);return j>3&&k&&Object.defineProperty(g,T,k),k},y=this&&this.__param||function(_,g){return function(T,R){g(T,R,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const f=u(6193),w=u(4725),E=u(8460),A=u(844),C=u(7226),b=u(2585);let S=c.RenderService=class extends A.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(_,g,T,R,M,j,k,D){super(),this._rowCount=_,this._charSizeService=R,this._renderer=this.register(new A.MutableDisposable),this._pausedResizeTask=new C.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 E.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new E.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new E.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((B,I)=>this._renderRows(B,I)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(j.onResize((()=>this._fullRefresh()))),this.register(j.buffers.onBufferActivate((()=>{var B;return(B=this._renderer.value)==null?void 0:B.clear()}))),this.register(T.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(M.onDecorationRegistered((()=>this._fullRefresh()))),this.register(M.onDecorationRemoved((()=>this._fullRefresh()))),this.register(T.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(j.cols,j.rows),this._fullRefresh()}))),this.register(T.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(j.buffer.y,j.buffer.y,!0)))),this.register(D.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,g),this.register(k.onWindowChange((B=>this._registerIntersectionObserver(B,g))))}_registerIntersectionObserver(_,g){if("IntersectionObserver"in _){const T=new _.IntersectionObserver((R=>this._handleIntersectionChange(R[R.length-1])),{threshold:0});T.observe(g),this._observerDisposable.value=(0,A.toDisposable)((()=>T.disconnect()))}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.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(_,g,T=!1){this._isPaused?this._needsFullRefresh=!0:(T||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,g,this._rowCount))}_renderRows(_,g){this._renderer.value&&(_=Math.min(_,this._rowCount-1),g=Math.min(g,this._rowCount-1),this._renderer.value.renderRows(_,g),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:g}),this._onRender.fire({start:_,end:g}),this._isNextRenderRedrawOnly=!0)}resize(_,g){this._rowCount=g,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(_){this._renderer.value=_,this._renderer.value&&(this._renderer.value.onRequestRedraw((g=>this.refreshRows(g.start,g.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var _,g;this._renderer.value&&((g=(_=this._renderer.value).clearTextureAtlas)==null||g.call(_),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(_,g){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var T;return(T=this._renderer.value)==null?void 0:T.handleResize(_,g)})):this._renderer.value.handleResize(_,g),this._fullRefresh())}handleCharSizeChanged(){var _;(_=this._renderer.value)==null||_.handleCharSizeChanged()}handleBlur(){var _;(_=this._renderer.value)==null||_.handleBlur()}handleFocus(){var _;(_=this._renderer.value)==null||_.handleFocus()}handleSelectionChanged(_,g,T){var R;this._selectionState.start=_,this._selectionState.end=g,this._selectionState.columnSelectMode=T,(R=this._renderer.value)==null||R.handleSelectionChanged(_,g,T)}handleCursorMove(){var _;(_=this._renderer.value)==null||_.handleCursorMove()}clear(){var _;(_=this._renderer.value)==null||_.clear()}};c.RenderService=S=p([y(2,b.IOptionsService),y(3,w.ICharSizeService),y(4,b.IDecorationService),y(5,b.IBufferService),y(6,w.ICoreBrowserService),y(7,w.IThemeService)],S)},9312:function(v,c,u){var p=this&&this.__decorate||function(k,D,B,I){var q,$=arguments.length,J=$<3?D:I===null?I=Object.getOwnPropertyDescriptor(D,B):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(k,D,B,I);else for(var ee=k.length-1;ee>=0;ee--)(q=k[ee])&&(J=($<3?q(J):$>3?q(D,B,J):q(D,B))||J);return $>3&&J&&Object.defineProperty(D,B,J),J},y=this&&this.__param||function(k,D){return function(B,I){D(B,I,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const f=u(9806),w=u(9504),E=u(456),A=u(4725),C=u(8460),b=u(844),S=u(6114),_=u(4841),g=u(511),T=u(2585),R=" ",M=new RegExp(R,"g");let j=c.SelectionService=class extends b.Disposable{constructor(k,D,B,I,q,$,J,ee,W){super(),this._element=k,this._screenElement=D,this._linkifier=B,this._bufferService=I,this._coreService=q,this._mouseService=$,this._optionsService=J,this._renderService=ee,this._coreBrowserService=W,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new g.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((G=>this._handleTrim(G))),this.register(this._bufferService.buffers.onBufferActivate((G=>this._handleBufferActivate(G)))),this.enable(),this._model=new E.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.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 k=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!k||!D||k[0]===D[0]&&k[1]===D[1])}get selectionText(){const k=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;if(!k||!D)return"";const B=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(k[0]===D[0])return"";const q=k[0]<D[0]?k[0]:D[0],$=k[0]<D[0]?D[0]:k[0];for(let J=k[1];J<=D[1];J++){const ee=B.translateBufferLineToString(J,!0,q,$);I.push(ee)}}else{const q=k[1]===D[1]?D[0]:void 0;I.push(B.translateBufferLineToString(k[1],!0,k[0],q));for(let $=k[1]+1;$<=D[1]-1;$++){const J=B.lines.get($),ee=B.translateBufferLineToString($,!0);J!=null&&J.isWrapped?I[I.length-1]+=ee:I.push(ee)}if(k[1]!==D[1]){const $=B.lines.get(D[1]),J=B.translateBufferLineToString(D[1],!0,0,D[0]);$&&$.isWrapped?I[I.length-1]+=J:I.push(J)}}return I.map((q=>q.replace(M," "))).join(S.isWindows?`\r
440
- `:`
441
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&k&&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(k){const D=this._getMouseBufferCoords(k),B=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(B&&I&&D)&&this._areCoordsInSelection(D,B,I)}isCellInSelection(k,D){const B=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!B||!I)&&this._areCoordsInSelection([k,D],B,I)}_areCoordsInSelection(k,D,B){return k[1]>D[1]&&k[1]<B[1]||D[1]===B[1]&&k[1]===D[1]&&k[0]>=D[0]&&k[0]<B[0]||D[1]<B[1]&&k[1]===B[1]&&k[0]<B[0]||D[1]<B[1]&&k[1]===D[1]&&k[0]>=D[0]}_selectWordAtCursor(k,D){var q,$;const B=($=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:$.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const I=this._getMouseBufferCoords(k);return!!I&&(this._selectWordAt(I,D),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,D){this._model.clearSelection(),k=Math.max(k,0),D=Math.min(D,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,D],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const D=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(D)return D[0]--,D[1]--,D[1]+=this._bufferService.buffer.ydisp,D}_getMouseEventScrollAmount(k){let D=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const B=this._renderService.dimensions.css.canvas.height;return D>=0&&D<=B?0:(D>B&&(D-=B),D=Math.min(Math.max(D,-50),50),D/=50,D/Math.abs(D)+Math.round(14*D))}shouldForceSelection(k){return S.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),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(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const D=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);D&&D.length!==this._model.selectionStart[0]&&D.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const D=this._getMouseBufferCoords(k);D&&(this._activeSelectionMode=2,this._selectLineAt(D[1]))}shouldColumnSelect(k){return k.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const D=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!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(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const B=this._bufferService.buffer;if(this._model.selectionEnd[1]<B.lines.length){const I=B.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}D&&D[0]===this._model.selectionEnd[0]&&D[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 k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const D=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&D<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const B=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){const I=(0,w.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,D=this._model.finalSelectionEnd,B=!(!k||!D||k[0]===D[0]&&k[1]===D[1]);B?k&&D&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&D[0]===this._oldSelectionEnd[0]&&D[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,D,B)):this._oldHasSelection&&this._fireOnSelectionChange(k,D,B)}_fireOnSelectionChange(k,D,B){this._oldSelectionStart=k,this._oldSelectionEnd=D,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((D=>this._handleTrim(D)))}_convertViewportColToCharacterIndex(k,D){let B=D;for(let I=0;D>=I;I++){const q=k.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:q>1&&D!==I&&(B+=q-1)}return B}setSelection(k,D,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,D],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,D,B=!0,I=!0){if(k[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,$=q.lines.get(k[1]);if(!$)return;const J=q.translateBufferLineToString(k[1],!1);let ee=this._convertViewportColToCharacterIndex($,k[0]),W=ee;const G=k[0]-ee;let Y=0,O=0,F=0,L=0;if(J.charAt(ee)===" "){for(;ee>0&&J.charAt(ee-1)===" ";)ee--;for(;W<J.length&&J.charAt(W+1)===" ";)W++}else{let te=k[0],de=k[0];$.getWidth(te)===0&&(Y++,te--),$.getWidth(de)===2&&(O++,de++);const ge=$.getString(de).length;for(ge>1&&(L+=ge-1,W+=ge-1);te>0&&ee>0&&!this._isCharWordSeparator($.loadCell(te-1,this._workCell));){$.loadCell(te-1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===0?(Y++,te--):K>1&&(F+=K-1,ee-=K-1),ee--,te--}for(;de<$.length&&W+1<J.length&&!this._isCharWordSeparator($.loadCell(de+1,this._workCell));){$.loadCell(de+1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,de++):K>1&&(L+=K-1,W+=K-1),W++,de++}}W++;let P=ee+G-Y+F,V=Math.min(this._bufferService.cols,W-ee+Y+O-F-L);if(D||J.slice(ee,W).trim()!==""){if(B&&P===0&&$.getCodePoint(0)!==32){const te=q.lines.get(k[1]-1);if(te&&$.isWrapped&&te.getCodePoint(this._bufferService.cols-1)!==32){const de=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(de){const ge=this._bufferService.cols-de.start;P-=ge,V+=ge}}}if(I&&P+V===this._bufferService.cols&&$.getCodePoint(this._bufferService.cols-1)!==32){const te=q.lines.get(k[1]+1);if(te!=null&&te.isWrapped&&te.getCodePoint(0)!==32){const de=this._getWordAt([0,k[1]+1],!1,!1,!0);de&&(V+=de.length)}}return{start:P,length:V}}}_selectWordAt(k,D){const B=this._getWordAt(k,D);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[B.start,k[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(k){const D=this._getWordAt(k,!0);if(D){let B=k[1];for(;D.start<0;)D.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;D.start+D.length>this._bufferService.cols;)D.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?D.start:D.start+D.length,B]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const D=this._bufferService.buffer.getWrappedRangeForLine(k),B={start:{x:0,y:D.first},end:{x:this._bufferService.cols-1,y:D.last}};this._model.selectionStart=[0,D.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(B,this._bufferService.cols)}};c.SelectionService=j=p([y(3,T.IBufferService),y(4,T.ICoreService),y(5,A.IMouseService),y(6,T.IOptionsService),y(7,A.IRenderService),y(8,A.ICoreBrowserService)],j)},4725:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const p=u(8343);c.ICharSizeService=(0,p.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,p.createDecorator)("CoreBrowserService"),c.IMouseService=(0,p.createDecorator)("MouseService"),c.IRenderService=(0,p.createDecorator)("RenderService"),c.ISelectionService=(0,p.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,p.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,p.createDecorator)("ThemeService"),c.ILinkProviderService=(0,p.createDecorator)("LinkProviderService")},6731:function(v,c,u){var p=this&&this.__decorate||function(j,k,D,B){var I,q=arguments.length,$=q<3?k:B===null?B=Object.getOwnPropertyDescriptor(k,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(j,k,D,B);else for(var J=j.length-1;J>=0;J--)(I=j[J])&&($=(q<3?I($):q>3?I(k,D,$):I(k,D))||$);return q>3&&$&&Object.defineProperty(k,D,$),$},y=this&&this.__param||function(j,k){return function(D,B){k(D,B,j)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const f=u(7239),w=u(8055),E=u(8460),A=u(844),C=u(2585),b=w.css.toColor("#ffffff"),S=w.css.toColor("#000000"),_=w.css.toColor("#ffffff"),g=w.css.toColor("#000000"),T={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const j=[w.css.toColor("#2e3436"),w.css.toColor("#cc0000"),w.css.toColor("#4e9a06"),w.css.toColor("#c4a000"),w.css.toColor("#3465a4"),w.css.toColor("#75507b"),w.css.toColor("#06989a"),w.css.toColor("#d3d7cf"),w.css.toColor("#555753"),w.css.toColor("#ef2929"),w.css.toColor("#8ae234"),w.css.toColor("#fce94f"),w.css.toColor("#729fcf"),w.css.toColor("#ad7fa8"),w.css.toColor("#34e2e2"),w.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let D=0;D<216;D++){const B=k[D/36%6|0],I=k[D/6%6|0],q=k[D%6];j.push({css:w.channels.toCss(B,I,q),rgba:w.channels.toRgba(B,I,q)})}for(let D=0;D<24;D++){const B=8+10*D;j.push({css:w.channels.toCss(B,B,B),rgba:w.channels.toRgba(B,B,B)})}return j})());let R=c.ThemeService=class extends A.Disposable{get colors(){return this._colors}constructor(j){super(),this._optionsService=j,this._contrastCache=new f.ColorContrastCache,this._halfContrastCache=new f.ColorContrastCache,this._onChangeColors=this.register(new E.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:S,cursor:_,cursorAccent:g,selectionForeground:void 0,selectionBackgroundTransparent:T,selectionBackgroundOpaque:w.color.blend(S,T),selectionInactiveBackgroundTransparent:T,selectionInactiveBackgroundOpaque:w.color.blend(S,T),ansi:c.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(j={}){const k=this._colors;if(k.foreground=M(j.foreground,b),k.background=M(j.background,S),k.cursor=M(j.cursor,_),k.cursorAccent=M(j.cursorAccent,g),k.selectionBackgroundTransparent=M(j.selectionBackground,T),k.selectionBackgroundOpaque=w.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=M(j.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=w.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=j.selectionForeground?M(j.selectionForeground,w.NULL_COLOR):void 0,k.selectionForeground===w.NULL_COLOR&&(k.selectionForeground=void 0),w.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=w.color.opacity(k.selectionBackgroundTransparent,.3)),w.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=w.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=c.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=M(j.black,c.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=M(j.red,c.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=M(j.green,c.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=M(j.yellow,c.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=M(j.blue,c.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=M(j.magenta,c.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=M(j.cyan,c.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=M(j.white,c.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=M(j.brightBlack,c.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=M(j.brightRed,c.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=M(j.brightGreen,c.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=M(j.brightYellow,c.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=M(j.brightBlue,c.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=M(j.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=M(j.brightCyan,c.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=M(j.brightWhite,c.DEFAULT_ANSI_COLORS[15]),j.extendedAnsi){const D=Math.min(k.ansi.length-16,j.extendedAnsi.length);for(let B=0;B<D;B++)k.ansi[B+16]=M(j.extendedAnsi[B],c.DEFAULT_ANSI_COLORS[B+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(j){this._restoreColor(j),this._onChangeColors.fire(this.colors)}_restoreColor(j){if(j!==void 0)switch(j){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[j]=this._restoreColors.ansi[j]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(j){j(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 M(j,k){if(j!==void 0)try{return w.css.toColor(j)}catch{}return k}c.ThemeService=R=p([y(0,C.IOptionsService)],R)},6349:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const p=u(8460),y=u(844);class f extends y.Disposable{constructor(E){super(),this._maxLength=E,this.onDeleteEmitter=this.register(new p.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new p.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new p.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(E){if(this._maxLength===E)return;const A=new Array(E);for(let C=0;C<Math.min(E,this.length);C++)A[C]=this._array[this._getCyclicIndex(C)];this._array=A,this._maxLength=E,this._startIndex=0}get length(){return this._length}set length(E){if(E>this._length)for(let A=this._length;A<E;A++)this._array[A]=void 0;this._length=E}get(E){return this._array[this._getCyclicIndex(E)]}set(E,A){this._array[this._getCyclicIndex(E)]=A}push(E){this._array[this._getCyclicIndex(this._length)]=E,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(E,A,...C){if(A){for(let b=E;b<this._length-A;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+A)];this._length-=A,this.onDeleteEmitter.fire({index:E,amount:A})}for(let b=this._length-1;b>=E;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;b<C.length;b++)this._array[this._getCyclicIndex(E+b)]=C[b];if(C.length&&this.onInsertEmitter.fire({index:E,amount:C.length}),this._length+C.length>this._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(E){E>this._length&&(E=this._length),this._startIndex+=E,this._length-=E,this.onTrimEmitter.fire(E)}shiftElements(E,A,C){if(!(A<=0)){if(E<0||E>=this._length)throw new Error("start argument out of range");if(E+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let S=A-1;S>=0;S--)this.set(E+S+C,this.get(E+S));const b=E+A+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b<A;b++)this.set(E+b+C,this.get(E+b))}}_getCyclicIndex(E){return(this._startIndex+E)%this._maxLength}}c.CircularList=f},1439:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function u(p,y=5){if(typeof p!="object")return p;const f=Array.isArray(p)?[]:{};for(const w in p)f[w]=y<=1?p[w]:p[w]&&u(p[w],y-1);return f}},8055:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let u=0,p=0,y=0,f=0;var w,E,A,C,b;function S(g){const T=g.toString(16);return T.length<2?"0"+T:T}function _(g,T){return g<T?(T+.05)/(g+.05):(g+.05)/(T+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(g){g.toCss=function(T,R,M,j){return j!==void 0?`#${S(T)}${S(R)}${S(M)}${S(j)}`:`#${S(T)}${S(R)}${S(M)}`},g.toRgba=function(T,R,M,j=255){return(T<<24|R<<16|M<<8|j)>>>0},g.toColor=function(T,R,M,j){return{css:g.toCss(T,R,M,j),rgba:g.toRgba(T,R,M,j)}}})(w||(c.channels=w={})),(function(g){function T(R,M){return f=Math.round(255*M),[u,p,y]=b.toChannels(R.rgba),{css:w.toCss(u,p,y,f),rgba:w.toRgba(u,p,y,f)}}g.blend=function(R,M){if(f=(255&M.rgba)/255,f===1)return{css:M.css,rgba:M.rgba};const j=M.rgba>>24&255,k=M.rgba>>16&255,D=M.rgba>>8&255,B=R.rgba>>24&255,I=R.rgba>>16&255,q=R.rgba>>8&255;return u=B+Math.round((j-B)*f),p=I+Math.round((k-I)*f),y=q+Math.round((D-q)*f),{css:w.toCss(u,p,y),rgba:w.toRgba(u,p,y)}},g.isOpaque=function(R){return(255&R.rgba)==255},g.ensureContrastRatio=function(R,M,j){const k=b.ensureContrastRatio(R.rgba,M.rgba,j);if(k)return w.toColor(k>>24&255,k>>16&255,k>>8&255)},g.opaque=function(R){const M=(255|R.rgba)>>>0;return[u,p,y]=b.toChannels(M),{css:w.toCss(u,p,y),rgba:M}},g.opacity=T,g.multiplyOpacity=function(R,M){return f=255&R.rgba,T(R,f*M/255)},g.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(E||(c.color=E={})),(function(g){let T,R;try{const M=document.createElement("canvas");M.width=1,M.height=1;const j=M.getContext("2d",{willReadFrequently:!0});j&&(T=j,T.globalCompositeOperation="copy",R=T.createLinearGradient(0,0,1,1))}catch{}g.toColor=function(M){if(M.match(/#[\da-f]{3,8}/i))switch(M.length){case 4:return u=parseInt(M.slice(1,2).repeat(2),16),p=parseInt(M.slice(2,3).repeat(2),16),y=parseInt(M.slice(3,4).repeat(2),16),w.toColor(u,p,y);case 5:return u=parseInt(M.slice(1,2).repeat(2),16),p=parseInt(M.slice(2,3).repeat(2),16),y=parseInt(M.slice(3,4).repeat(2),16),f=parseInt(M.slice(4,5).repeat(2),16),w.toColor(u,p,y,f);case 7:return{css:M,rgba:(parseInt(M.slice(1),16)<<8|255)>>>0};case 9:return{css:M,rgba:parseInt(M.slice(1),16)>>>0}}const j=M.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(j)return u=parseInt(j[1]),p=parseInt(j[2]),y=parseInt(j[3]),f=Math.round(255*(j[5]===void 0?1:parseFloat(j[5]))),w.toColor(u,p,y,f);if(!T||!R)throw new Error("css.toColor: Unsupported css format");if(T.fillStyle=R,T.fillStyle=M,typeof T.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(T.fillRect(0,0,1,1),[u,p,y,f]=T.getImageData(0,0,1,1).data,f!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(u,p,y,f),css:M}}})(A||(c.css=A={})),(function(g){function T(R,M,j){const k=R/255,D=M/255,B=j/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}g.relativeLuminance=function(R){return T(R>>16&255,R>>8&255,255&R)},g.relativeLuminance2=T})(C||(c.rgb=C={})),(function(g){function T(M,j,k){const D=M>>24&255,B=M>>16&255,I=M>>8&255;let q=j>>24&255,$=j>>16&255,J=j>>8&255,ee=_(C.relativeLuminance2(q,$,J),C.relativeLuminance2(D,B,I));for(;ee<k&&(q>0||$>0||J>0);)q-=Math.max(0,Math.ceil(.1*q)),$-=Math.max(0,Math.ceil(.1*$)),J-=Math.max(0,Math.ceil(.1*J)),ee=_(C.relativeLuminance2(q,$,J),C.relativeLuminance2(D,B,I));return(q<<24|$<<16|J<<8|255)>>>0}function R(M,j,k){const D=M>>24&255,B=M>>16&255,I=M>>8&255;let q=j>>24&255,$=j>>16&255,J=j>>8&255,ee=_(C.relativeLuminance2(q,$,J),C.relativeLuminance2(D,B,I));for(;ee<k&&(q<255||$<255||J<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),$=Math.min(255,$+Math.ceil(.1*(255-$))),J=Math.min(255,J+Math.ceil(.1*(255-J))),ee=_(C.relativeLuminance2(q,$,J),C.relativeLuminance2(D,B,I));return(q<<24|$<<16|J<<8|255)>>>0}g.blend=function(M,j){if(f=(255&j)/255,f===1)return j;const k=j>>24&255,D=j>>16&255,B=j>>8&255,I=M>>24&255,q=M>>16&255,$=M>>8&255;return u=I+Math.round((k-I)*f),p=q+Math.round((D-q)*f),y=$+Math.round((B-$)*f),w.toRgba(u,p,y)},g.ensureContrastRatio=function(M,j,k){const D=C.relativeLuminance(M>>8),B=C.relativeLuminance(j>>8);if(_(D,B)<k){if(B<D){const $=T(M,j,k),J=_(D,C.relativeLuminance($>>8));if(J<k){const ee=R(M,j,k);return J>_(D,C.relativeLuminance(ee>>8))?$:ee}return $}const I=R(M,j,k),q=_(D,C.relativeLuminance(I>>8));if(q<k){const $=T(M,j,k);return q>_(D,C.relativeLuminance($>>8))?I:$}return I}},g.reduceLuminance=T,g.increaseLuminance=R,g.toChannels=function(M){return[M>>24&255,M>>16&255,M>>8&255,255&M]}})(b||(c.rgba=b={})),c.toPaddedHex=S,c.contrastRatio=_},8969:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const p=u(844),y=u(2585),f=u(4348),w=u(7866),E=u(744),A=u(7302),C=u(6975),b=u(8460),S=u(1753),_=u(1480),g=u(7994),T=u(9282),R=u(5435),M=u(5981),j=u(2660);let k=!1;class D extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((I=>{var q;(q=this._onScrollApi)==null||q.fire(I.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(I){for(const q in I)this.optionsService.options[q]=I[q]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new p.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new f.InstantiationService,this.optionsService=this.register(new A.OptionsService(I)),this._instantiationService.setService(y.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(E.BufferService)),this._instantiationService.setService(y.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(w.LogService)),this._instantiationService.setService(y.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(y.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(y.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(y.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(g.CharsetService),this._instantiationService.setService(y.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(j.OscLinkService),this._instantiationService.setService(y.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new R.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.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 M.WriteBuffer(((q,$)=>this._inputHandler.parse(q,$)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,q){this._writeBuffer.write(I,q)}writeSync(I,q){this._logService.logLevel<=y.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(I,q)}input(I,q=!0){this.coreService.triggerDataEvent(I,q)}resize(I,q){isNaN(I)||isNaN(q)||(I=Math.max(I,E.MINIMUM_COLS),q=Math.max(q,E.MINIMUM_ROWS),this._bufferService.resize(I,q))}scroll(I,q=!1){this._bufferService.scroll(I,q)}scrollLines(I,q,$){this._bufferService.scrollLines(I,q,$)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){const q=I-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(I,q){return this._inputHandler.registerEscHandler(I,q)}registerDcsHandler(I,q){return this._inputHandler.registerDcsHandler(I,q)}registerCsiHandler(I,q){return this._inputHandler.registerCsiHandler(I,q)}registerOscHandler(I,q){return this._inputHandler.registerOscHandler(I,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?I=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const I=[];I.push(this.onLineFeed(T.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,T.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,p.toDisposable)((()=>{for(const q of I)q.dispose()}))}}}c.CoreTerminal=D},8460:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.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 p=0;p<this._listeners.length;p++)if(this._listeners[p]===u)return void this._listeners.splice(p,1)}}})),this._event}fire(u,p){const y=[];for(let f=0;f<this._listeners.length;f++)y.push(this._listeners[f]);for(let f=0;f<y.length;f++)y[f].call(void 0,u,p)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(u,p){return u((y=>p.fire(y)))},c.runAndSubscribe=function(u,p){return p(void 0),u((y=>p(y)))}},5435:function(v,c,u){var p=this&&this.__decorate||function(Y,O,F,L){var P,V=arguments.length,te=V<3?O:L===null?L=Object.getOwnPropertyDescriptor(O,F):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(Y,O,F,L);else for(var de=Y.length-1;de>=0;de--)(P=Y[de])&&(te=(V<3?P(te):V>3?P(O,F,te):P(O,F))||te);return V>3&&te&&Object.defineProperty(O,F,te),te},y=this&&this.__param||function(Y,O){return function(F,L){O(F,L,Y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const f=u(2584),w=u(7116),E=u(2015),A=u(844),C=u(482),b=u(8437),S=u(8460),_=u(643),g=u(511),T=u(3734),R=u(2585),M=u(1480),j=u(6242),k=u(6351),D=u(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function q(Y,O){if(Y>24)return O.setWinLines||!1;switch(Y){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var $;(function(Y){Y[Y.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Y[Y.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})($||(c.WindowsOptionsReportType=$={}));let J=0;class ee extends A.Disposable{getAttrData(){return this._curAttrData}constructor(O,F,L,P,V,te,de,ge,K=new E.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=F,this._coreService=L,this._logService=P,this._optionsService=V,this._oscLinkService=te,this._coreMouseService=de,this._unicodeService=ge,this._parser=K,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new g.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.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 W(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((z=>this._activeBuffer=z.activeBuffer))),this._parser.setCsiHandlerFallback(((z,ie)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:ie.toArray()})})),this._parser.setEscHandlerFallback((z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})})),this._parser.setExecuteHandlerFallback((z=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})})),this._parser.setOscHandlerFallback(((z,ie,Q)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:ie,data:Q})})),this._parser.setDcsHandlerFallback(((z,ie,Q)=>{ie==="HOOK"&&(Q=Q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:ie,payload:Q})})),this._parser.setPrintHandler(((z,ie,Q)=>this.print(z,ie,Q))),this._parser.registerCsiHandler({final:"@"},(z=>this.insertChars(z))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z=>this.scrollLeft(z))),this._parser.registerCsiHandler({final:"A"},(z=>this.cursorUp(z))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z=>this.scrollRight(z))),this._parser.registerCsiHandler({final:"B"},(z=>this.cursorDown(z))),this._parser.registerCsiHandler({final:"C"},(z=>this.cursorForward(z))),this._parser.registerCsiHandler({final:"D"},(z=>this.cursorBackward(z))),this._parser.registerCsiHandler({final:"E"},(z=>this.cursorNextLine(z))),this._parser.registerCsiHandler({final:"F"},(z=>this.cursorPrecedingLine(z))),this._parser.registerCsiHandler({final:"G"},(z=>this.cursorCharAbsolute(z))),this._parser.registerCsiHandler({final:"H"},(z=>this.cursorPosition(z))),this._parser.registerCsiHandler({final:"I"},(z=>this.cursorForwardTab(z))),this._parser.registerCsiHandler({final:"J"},(z=>this.eraseInDisplay(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z=>this.eraseInDisplay(z,!0))),this._parser.registerCsiHandler({final:"K"},(z=>this.eraseInLine(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z=>this.eraseInLine(z,!0))),this._parser.registerCsiHandler({final:"L"},(z=>this.insertLines(z))),this._parser.registerCsiHandler({final:"M"},(z=>this.deleteLines(z))),this._parser.registerCsiHandler({final:"P"},(z=>this.deleteChars(z))),this._parser.registerCsiHandler({final:"S"},(z=>this.scrollUp(z))),this._parser.registerCsiHandler({final:"T"},(z=>this.scrollDown(z))),this._parser.registerCsiHandler({final:"X"},(z=>this.eraseChars(z))),this._parser.registerCsiHandler({final:"Z"},(z=>this.cursorBackwardTab(z))),this._parser.registerCsiHandler({final:"`"},(z=>this.charPosAbsolute(z))),this._parser.registerCsiHandler({final:"a"},(z=>this.hPositionRelative(z))),this._parser.registerCsiHandler({final:"b"},(z=>this.repeatPrecedingCharacter(z))),this._parser.registerCsiHandler({final:"c"},(z=>this.sendDeviceAttributesPrimary(z))),this._parser.registerCsiHandler({prefix:">",final:"c"},(z=>this.sendDeviceAttributesSecondary(z))),this._parser.registerCsiHandler({final:"d"},(z=>this.linePosAbsolute(z))),this._parser.registerCsiHandler({final:"e"},(z=>this.vPositionRelative(z))),this._parser.registerCsiHandler({final:"f"},(z=>this.hVPosition(z))),this._parser.registerCsiHandler({final:"g"},(z=>this.tabClear(z))),this._parser.registerCsiHandler({final:"h"},(z=>this.setMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z=>this.setModePrivate(z))),this._parser.registerCsiHandler({final:"l"},(z=>this.resetMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z=>this.resetModePrivate(z))),this._parser.registerCsiHandler({final:"m"},(z=>this.charAttributes(z))),this._parser.registerCsiHandler({final:"n"},(z=>this.deviceStatus(z))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z=>this.deviceStatusPrivate(z))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z=>this.softReset(z))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z=>this.setCursorStyle(z))),this._parser.registerCsiHandler({final:"r"},(z=>this.setScrollRegion(z))),this._parser.registerCsiHandler({final:"s"},(z=>this.saveCursor(z))),this._parser.registerCsiHandler({final:"t"},(z=>this.windowOptions(z))),this._parser.registerCsiHandler({final:"u"},(z=>this.restoreCursor(z))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z=>this.insertColumns(z))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z=>this.deleteColumns(z))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z=>this.selectProtected(z))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z=>this.requestMode(z,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z=>this.requestMode(z,!1))),this._parser.setExecuteHandler(f.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(f.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(f.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(f.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(f.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(f.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(f.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(f.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(f.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new j.OscHandler((z=>(this.setTitle(z),this.setIconName(z),!0)))),this._parser.registerOscHandler(1,new j.OscHandler((z=>this.setIconName(z)))),this._parser.registerOscHandler(2,new j.OscHandler((z=>this.setTitle(z)))),this._parser.registerOscHandler(4,new j.OscHandler((z=>this.setOrReportIndexedColor(z)))),this._parser.registerOscHandler(8,new j.OscHandler((z=>this.setHyperlink(z)))),this._parser.registerOscHandler(10,new j.OscHandler((z=>this.setOrReportFgColor(z)))),this._parser.registerOscHandler(11,new j.OscHandler((z=>this.setOrReportBgColor(z)))),this._parser.registerOscHandler(12,new j.OscHandler((z=>this.setOrReportCursorColor(z)))),this._parser.registerOscHandler(104,new j.OscHandler((z=>this.restoreIndexedColor(z)))),this._parser.registerOscHandler(110,new j.OscHandler((z=>this.restoreFgColor(z)))),this._parser.registerOscHandler(111,new j.OscHandler((z=>this.restoreBgColor(z)))),this._parser.registerOscHandler(112,new j.OscHandler((z=>this.restoreCursorColor(z)))),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 z in w.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:z},(()=>this.selectCharset("("+z))),this._parser.registerEscHandler({intermediates:")",final:z},(()=>this.selectCharset(")"+z))),this._parser.registerEscHandler({intermediates:"*",final:z},(()=>this.selectCharset("*"+z))),this._parser.registerEscHandler({intermediates:"+",final:z},(()=>this.selectCharset("+"+z))),this._parser.registerEscHandler({intermediates:"-",final:z},(()=>this.selectCharset("-"+z))),this._parser.registerEscHandler({intermediates:".",final:z},(()=>this.selectCharset("."+z))),this._parser.registerEscHandler({intermediates:"/",final:z},(()=>this.selectCharset("/"+z)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((z=>(this._logService.error("Parsing error: ",z),z))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((z,ie)=>this.requestStatusString(z,ie))))}_preserveStack(O,F,L,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=F,this._parseStack.decodedLength=L,this._parseStack.position=P}_logSlowResolvingAsync(O){this._logService.logLevel<=R.LogLevelEnum.WARN&&Promise.race([O,new Promise(((F,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((F=>{if(F!=="#SLOW_TIMEOUT")throw F;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,F){let L,P=this._activeBuffer.x,V=this._activeBuffer.y,te=0;const de=this._parseStack.paused;if(de){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,F))return this._logSlowResolvingAsync(L),L;P=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>I&&(te=this._parseStack.position+I)}if(this._logService.logLevel<=R.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(z=>String.fromCharCode(z))).join("")}"`),typeof O=="string"?O.split("").map((z=>z.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(O.length,I))),de||this._dirtyRowTracker.clearRange(),O.length>I)for(let z=te;z<O.length;z+=I){const ie=z+I<O.length?z+I:O.length,Q=typeof O=="string"?this._stringDecoder.decode(O.substring(z,ie),this._parseBuffer):this._utf8Decoder.decode(O.subarray(z,ie),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,Q))return this._preserveStack(P,V,Q,z),this._logSlowResolvingAsync(L),L}else if(!de){const z=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,z))return this._preserveStack(P,V,z,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===P&&this._activeBuffer.y===V||this._onCursorMove.fire();const ge=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),K=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);K<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(K,this._bufferService.rows-1),Math.min(ge,this._bufferService.rows-1))}print(O,F,L){let P,V;const te=this._charsetService.charset,de=this._optionsService.rawOptions.screenReaderMode,ge=this._bufferService.cols,K=this._coreService.decPrivateModes.wraparound,z=this._coreService.modes.insertMode,ie=this._curAttrData;let Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-F>0&&Q.getWidth(this._activeBuffer.x-1)===2&&Q.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ie);let we=this._parser.precedingJoinState;for(let fe=F;fe<L;++fe){if(P=O[fe],P<127&&te){const Ge=te[String.fromCharCode(P)];Ge&&(P=Ge.charCodeAt(0))}const Le=this._unicodeService.charProperties(P,we);V=M.UnicodeService.extractWidth(Le);const ze=M.UnicodeService.extractShouldJoin(Le),We=ze?M.UnicodeService.extractWidth(we):0;if(we=Le,de&&this._onA11yChar.fire((0,C.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-We>ge){if(K){const Ge=Q;let De=this._activeBuffer.x-We;for(this._activeBuffer.x=We,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),Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),We>0&&Q instanceof b.BufferLine&&Q.copyCellsFrom(Ge,De,0,We,!1);De<ge;)Ge.setCellFromCodepoint(De++,0,1,ie)}else if(this._activeBuffer.x=ge-1,V===2)continue}if(ze&&this._activeBuffer.x){const Ge=Q.getWidth(this._activeBuffer.x-1)?1:2;Q.addCodepointToCell(this._activeBuffer.x-Ge,P,V);for(let De=V-We;--De>=0;)Q.setCellFromCodepoint(this._activeBuffer.x++,0,0,ie)}else if(z&&(Q.insertCells(this._activeBuffer.x,V-We,this._activeBuffer.getNullCell(ie)),Q.getWidth(ge-1)===2&&Q.setCellFromCodepoint(ge-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,ie)),Q.setCellFromCodepoint(this._activeBuffer.x++,P,V,ie),V>0)for(;--V;)Q.setCellFromCodepoint(this._activeBuffer.x++,0,0,ie)}this._parser.precedingJoinState=we,this._activeBuffer.x<ge&&L-F>0&&Q.getWidth(this._activeBuffer.x)===0&&!Q.hasContent(this._activeBuffer.x)&&Q.setCellFromCodepoint(this._activeBuffer.x,0,1,ie),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,F){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,F):this._parser.registerCsiHandler(O,(L=>!q(L.params[0],this._optionsService.rawOptions.windowOptions)||F(L)))}registerDcsHandler(O,F){return this._parser.registerDcsHandler(O,new k.DcsHandler(F))}registerEscHandler(O,F){return this._parser.registerEscHandler(O,F)}registerOscHandler(O,F){return this._parser.registerOscHandler(O,new j.OscHandler(F))}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 O;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&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);F.hasWidth(this._activeBuffer.x)&&!F.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,F){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+F):(this._activeBuffer.x=O,this._activeBuffer.y=F),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,F){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+F)}cursorUp(O){const F=this._activeBuffer.y-this._activeBuffer.scrollTop;return F>=0?this._moveCursor(0,-Math.min(F,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const F=this._activeBuffer.scrollBottom-this._activeBuffer.y;return F>=0?this._moveCursor(0,Math.min(F,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const F=O.params[0];return F===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:F===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let F=O.params[0]||1;for(;F--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let F=O.params[0]||1;for(;F--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const F=O.params[0];return F===1&&(this._curAttrData.bg|=536870912),F!==2&&F!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,F,L,P=!1,V=!1){const te=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);te.replaceCells(F,L,this._activeBuffer.getNullCell(this._eraseAttrData()),V),P&&(te.isWrapped=!1)}_resetBufferLine(O,F=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),F),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),L.isWrapped=!1)}eraseInDisplay(O,F=!1){let L;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,F);L<this._bufferService.rows;L++)this._resetBufferLine(L,F);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,F),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,F);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,F);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(O,F=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,F);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,F);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,F)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let F=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;F--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let F=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;F--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(O){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let F=O.params[0]||1;for(;F--;)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(O){let F=O.params[0]||1;for(;F--;)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(b.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);P.deleteCells(0,F,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);P.insertCells(0,F,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);P.insertCells(this._activeBuffer.x,F,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);P.deleteCells(this._activeBuffer.x,F,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const F=this._parser.precedingJoinState;if(!F)return!0;const L=O.params[0]||1,P=M.UnicodeService.extractWidth(F),V=this._activeBuffer.x-P,te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),de=new Uint32Array(te.length*L);let ge=0;for(let z=0;z<te.length;){const ie=te.codePointAt(z)||0;de[ge++]=ie,z+=ie>65535?2:1}let K=ge;for(let z=1;z<L;++z)de.copyWithin(K,0,ge),K+=ge;return this.print(de,0,K),!0}sendDeviceAttributesPrimary(O){return O.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let F=0;F<O.length;F++)switch(O.params[F]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let F=0;F<O.length;F++)switch(O.params[F]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,w.DEFAULT_CHARSET),this._charsetService.setgCharset(1,w.DEFAULT_CHARSET),this._charsetService.setgCharset(2,w.DEFAULT_CHARSET),this._charsetService.setgCharset(3,w.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(O){for(let F=0;F<O.length;F++)switch(O.params[F]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let F=0;F<O.length;F++)switch(O.params[F]){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(),O.params[F]===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(O,F){const L=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:V}=this._coreMouseService,te=this._coreService,{buffers:de,cols:ge}=this._bufferService,{active:K,alt:z}=de,ie=this._optionsService.rawOptions,Q=ze=>ze?1:2,we=O.params[0];return fe=we,Le=F?we===2?4:we===4?Q(te.modes.insertMode):we===12?3:we===20?Q(ie.convertEol):0:we===1?Q(L.applicationCursorKeys):we===3?ie.windowOptions.setWinLines?ge===80?2:ge===132?1:0:0:we===6?Q(L.origin):we===7?Q(L.wraparound):we===8?3:we===9?Q(P==="X10"):we===12?Q(ie.cursorBlink):we===25?Q(!te.isCursorHidden):we===45?Q(L.reverseWraparound):we===66?Q(L.applicationKeypad):we===67?4:we===1e3?Q(P==="VT200"):we===1002?Q(P==="DRAG"):we===1003?Q(P==="ANY"):we===1004?Q(L.sendFocus):we===1005?4:we===1006?Q(V==="SGR"):we===1015?4:we===1016?Q(V==="SGR_PIXELS"):we===1048?1:we===47||we===1047||we===1049?Q(K===z):we===2004?Q(L.bracketedPasteMode):0,te.triggerDataEvent(`${f.C0.ESC}[${F?"":"?"}${fe};${Le}$y`),!0;var fe,Le}_updateAttrColor(O,F,L,P,V){return F===2?(O|=50331648,O&=-16777216,O|=T.AttributeData.fromColorRGB([L,P,V])):F===5&&(O&=-50331904,O|=33554432|255&L),O}_extractColor(O,F,L){const P=[0,0,-1,0,0,0];let V=0,te=0;do{if(P[te+V]=O.params[F+te],O.hasSubParams(F+te)){const de=O.getSubParams(F+te);let ge=0;do P[1]===5&&(V=1),P[te+ge+1+V]=de[ge];while(++ge<de.length&&ge+te+1+V<P.length);break}if(P[1]===5&&te+V>=2||P[1]===2&&te+V>=5)break;P[1]&&(V=1)}while(++te+F<O.length&&te+V<P.length);for(let de=2;de<P.length;++de)P[de]===-1&&(P[de]=0);switch(P[0]){case 38:L.fg=this._updateAttrColor(L.fg,P[1],P[3],P[4],P[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,P[1],P[3],P[4],P[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,P[1],P[3],P[4],P[5])}return te}_processUnderline(O,F){F.extended=F.extended.clone(),(!~O||O>5)&&(O=1),F.extended.underlineStyle=O,F.fg|=268435456,O===0&&(F.fg&=-268435457),F.updateExtended()}_processSGR0(O){O.fg=b.DEFAULT_ATTR_DATA.fg,O.bg=b.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const F=O.length;let L;const P=this._curAttrData;for(let V=0;V<F;V++)L=O.params[V],L>=30&&L<=37?(P.fg&=-50331904,P.fg|=16777216|L-30):L>=40&&L<=47?(P.bg&=-50331904,P.bg|=16777216|L-40):L>=90&&L<=97?(P.fg&=-50331904,P.fg|=16777224|L-90):L>=100&&L<=107?(P.bg&=-50331904,P.bg|=16777224|L-100):L===0?this._processSGR0(P):L===1?P.fg|=134217728:L===3?P.bg|=67108864:L===4?(P.fg|=268435456,this._processUnderline(O.hasSubParams(V)?O.getSubParams(V)[0]:1,P)):L===5?P.fg|=536870912:L===7?P.fg|=67108864:L===8?P.fg|=1073741824:L===9?P.fg|=2147483648:L===2?P.bg|=134217728:L===21?this._processUnderline(2,P):L===22?(P.fg&=-134217729,P.bg&=-134217729):L===23?P.bg&=-67108865:L===24?(P.fg&=-268435457,this._processUnderline(0,P)):L===25?P.fg&=-536870913:L===27?P.fg&=-67108865:L===28?P.fg&=-1073741825:L===29?P.fg&=2147483647:L===39?(P.fg&=-67108864,P.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):L===49?(P.bg&=-67108864,P.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?V+=this._extractColor(O,V,P):L===53?P.bg|=1073741824:L===55?P.bg&=-1073741825:L===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):L===100?(P.fg&=-67108864,P.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const F=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${F};${L}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const F=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${F};${L}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.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(O){const F=O.params[0]||1;switch(F){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 L=F%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(O){const F=O.params[0]||1;let L;return(O.length<2||(L=O.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>F&&(this._activeBuffer.scrollTop=F-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(O){if(!q(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const F=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:F!==2&&this._onRequestWindowsOptionsReport.fire($.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire($.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${f.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:F!==0&&F!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),F!==0&&F!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:F!==0&&F!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),F!==0&&F!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const F=[],L=O.split(";");for(;L.length>1;){const P=L.shift(),V=L.shift();if(/^\d+$/.exec(P)){const te=parseInt(P);if(G(te))if(V==="?")F.push({type:0,index:te});else{const de=(0,D.parseColor)(V);de&&F.push({type:1,index:te,color:de})}}}return F.length&&this._onColor.fire(F),!0}setHyperlink(O){const F=O.split(";");return!(F.length<2)&&(F[1]?this._createHyperlink(F[0],F[1]):!F[0]&&this._finishHyperlink())}_createHyperlink(O,F){this._getCurrentLinkId()&&this._finishHyperlink();const L=O.split(":");let P;const V=L.findIndex((te=>te.startsWith("id=")));return V!==-1&&(P=L[V].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:F}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,F){const L=O.split(";");for(let P=0;P<L.length&&!(F>=this._specialColors.length);++P,++F)if(L[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[F]}]);else{const V=(0,D.parseColor)(L[P]);V&&this._onColor.fire([{type:1,index:this._specialColors[F],color:V}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const F=[],L=O.split(";");for(let P=0;P<L.length;++P)if(/^\d+$/.exec(L[P])){const V=parseInt(L[P]);G(V)&&F.push({type:2,index:V})}return F.length&&this._onColor.fire(F),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){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,w.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset(B[O[0]],w.CHARSETS[O[1]]||w.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 O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new g.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let F=0;F<this._bufferService.rows;++F){const L=this._activeBuffer.ybase+this._activeBuffer.y+F,P=this._activeBuffer.lines.get(L);P&&(P.fill(O),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,F){const L=this._bufferService.buffer,P=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${f.C0.ESC}${V}${f.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,F){this._dirtyRowTracker.markRangeDirty(O,F)}}c.InputHandler=ee;let W=class{constructor(Y){this._bufferService=Y,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Y){Y<this.start?this.start=Y:Y>this.end&&(this.end=Y)}markRangeDirty(Y,O){Y>O&&(J=Y,Y=O,O=J),Y<this.start&&(this.start=Y),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(Y){return 0<=Y&&Y<256}W=p([y(0,R.IBufferService)],W)},844:(v,c)=>{function u(p){for(const y of p)y.dispose();p.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const p of this._disposables)p.dispose();this._disposables.length=0}register(p){return this._disposables.push(p),p}unregister(p){const y=this._disposables.indexOf(p);y!==-1&&this._disposables.splice(y,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(p){var y;this._isDisposed||p===this._value||((y=this._value)==null||y.dispose(),this._value=p)}clear(){this.value=void 0}dispose(){var p;this._isDisposed=!0,(p=this._value)==null||p.dispose(),this._value=void 0}},c.toDisposable=function(p){return{dispose:p}},c.disposeArray=u,c.getDisposeArrayDisposable=function(p){return{dispose:()=>u(p)}}},1505:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(y,f,w){this._data[y]||(this._data[y]={}),this._data[y][f]=w}get(y,f){return this._data[y]?this._data[y][f]:void 0}clear(){this._data={}}}c.TwoKeyMap=u,c.FourKeyMap=class{constructor(){this._data=new u}set(p,y,f,w,E){this._data.get(p,y)||this._data.set(p,y,new u),this._data.get(p,y).set(f,w,E)}get(p,y,f,w){var E;return(E=this._data.get(p,y))==null?void 0:E.get(f,w)}clear(){this._data.clear()}}},6114:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const u=c.isNode?"node":navigator.userAgent,p=c.isNode?"node":navigator.platform;c.isFirefox=u.includes("Firefox"),c.isLegacyEdge=u.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(u),c.getSafariVersion=function(){if(!c.isSafari)return 0;const y=u.match(/Version\/(\d+)/);return y===null||y.length<2?0:parseInt(y[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(p),c.isIpad=p==="iPad",c.isIphone=p==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(p),c.isLinux=p.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(u)},6106:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let u=0;c.SortedList=class{constructor(p){this._getKey=p,this._array=[]}clear(){this._array.length=0}insert(p){this._array.length!==0?(u=this._search(this._getKey(p)),this._array.splice(u,0,p)):this._array.push(p)}delete(p){if(this._array.length===0)return!1;const y=this._getKey(p);if(y===void 0||(u=this._search(y),u===-1)||this._getKey(this._array[u])!==y)return!1;do if(this._array[u]===p)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===y);return!1}*getKeyIterator(p){if(this._array.length!==0&&(u=this._search(p),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===p))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===p)}forEachByKey(p,y){if(this._array.length!==0&&(u=this._search(p),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===p))do y(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===p)}values(){return[...this._array].values()}_search(p){let y=0,f=this._array.length-1;for(;f>=y;){let w=y+f>>1;const E=this._getKey(this._array[w]);if(E>p)f=w-1;else{if(!(E<p)){for(;w>0&&this._getKey(this._array[w-1])===p;)w--;return w}y=w+1}}return y}}},7226:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const p=u(6114);class y{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let A=0,C=0,b=E.timeRemaining(),S=0;for(;this._i<this._tasks.length;){if(A=Date.now(),this._tasks[this._i]()||this._i++,A=Math.max(1,Date.now()-A),C=Math.max(A,C),S=E.timeRemaining(),1.5*C>S)return b-A<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-A))}ms`),void this._start();b=S}this.clear()}}class f extends y{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const A=Date.now()+E;return{timeRemaining:()=>Math.max(0,A-Date.now())}}}c.PriorityTaskQueue=f,c.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends y{_requestCallback(w){return requestIdleCallback(w)}_cancelCallback(w){cancelIdleCallback(w)}}:f,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(w){this._queue.clear(),this._queue.enqueue(w)}flush(){this._queue.flush()}}},9282:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const p=u(643);c.updateWindowsModeWrappedState=function(y){const f=y.buffer.lines.get(y.buffer.ybase+y.buffer.y-1),w=f==null?void 0:f.get(y.cols-1),E=y.buffer.lines.get(y.buffer.ybase+y.buffer.y);E&&w&&(E.isWrapped=w[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&w[p.CHAR_DATA_CODE_INDEX]!==p.WHITESPACE_CELL_CODE)}},3734:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new p}static toColorRGB(f){return[f>>>16&255,f>>>8&255,255&f]}static fromColorRGB(f){return(255&f[0])<<16|(255&f[1])<<8|255&f[2]}clone(){const f=new u;return f.fg=this.fg,f.bg=this.bg,f.extended=this.extended.clone(),f}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}}c.AttributeData=u;class p{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(f){this._ext=f}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(f){this._ext&=-469762049,this._ext|=f<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(f){this._ext&=-67108864,this._ext|=67108863&f}get urlId(){return this._urlId}set urlId(f){this._urlId=f}get underlineVariantOffset(){const f=(3758096384&this._ext)>>29;return f<0?4294967288^f:f}set underlineVariantOffset(f){this._ext&=536870911,this._ext|=f<<29&3758096384}constructor(f=0,w=0){this._ext=0,this._urlId=0,this._ext=f,this._urlId=w}clone(){return new p(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=p},9092:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const p=u(6349),y=u(7226),f=u(3734),w=u(8437),E=u(4634),A=u(511),C=u(643),b=u(4863),S=u(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(_,g,T){this._hasScrollback=_,this._optionsService=g,this._bufferService=T,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=w.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=A.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=A.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new y.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg,this._nullCell.extended=_.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new f.ExtendedAttrs),this._nullCell}getWhitespaceCell(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg,this._whitespaceCell.extended=_.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new f.ExtendedAttrs),this._whitespaceCell}getBlankLine(_,g){return new w.BufferLine(this._bufferService.cols,this.getNullCell(_),g)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const _=this.ybase+this.y-this.ydisp;return _>=0&&_<this._rows}_getCorrectBufferLength(_){if(!this._hasScrollback)return _;const g=_+this._optionsService.rawOptions.scrollback;return g>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:g}fillViewportRows(_){if(this.lines.length===0){_===void 0&&(_=w.DEFAULT_ATTR_DATA);let g=this._rows;for(;g--;)this.lines.push(this.getBlankLine(_))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(_,g){const T=this.getNullCell(w.DEFAULT_ATTR_DATA);let R=0;const M=this._getCorrectBufferLength(g);if(M>this.lines.maxLength&&(this.lines.maxLength=M),this.lines.length>0){if(this._cols<_)for(let k=0;k<this.lines.length;k++)R+=+this.lines.get(k).resize(_,T);let j=0;if(this._rows<g)for(let k=this._rows;k<g;k++)this.lines.length<g+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new w.BufferLine(_,T)):this.ybase>0&&this.lines.length<=this.ybase+this.y+j+1?(this.ybase--,j++,this.ydisp>0&&this.ydisp--):this.lines.push(new w.BufferLine(_,T)));else for(let k=this._rows;k>g;k--)this.lines.length>g+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(M<this.lines.maxLength){const k=this.lines.length-M;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=M}this.x=Math.min(this.x,_-1),this.y=Math.min(this.y,g-1),j&&(this.y+=j),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=g-1,this._isReflowEnabled&&(this._reflow(_,g),this._cols>_))for(let j=0;j<this.lines.length;j++)R+=+this.lines.get(j).resize(_,T);this._cols=_,this._rows=g,this._memoryCleanupQueue.clear(),R>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let _=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,_=!1);let g=0;for(;this._memoryCleanupPosition<this.lines.length;)if(g+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),g>100)return!0;return _}get _isReflowEnabled(){const _=this._optionsService.rawOptions.windowsPty;return _&&_.buildNumber?this._hasScrollback&&_.backend==="conpty"&&_.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(_,g){this._cols!==_&&(_>this._cols?this._reflowLarger(_,g):this._reflowSmaller(_,g))}_reflowLarger(_,g){const T=(0,E.reflowLargerGetLinesToRemove)(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(w.DEFAULT_ATTR_DATA));if(T.length>0){const R=(0,E.reflowLargerCreateNewLayout)(this.lines,T);(0,E.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(_,g,R.countRemoved)}}_reflowLargerAdjustViewport(_,g,T){const R=this.getNullCell(w.DEFAULT_ATTR_DATA);let M=T;for(;M-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<g&&this.lines.push(new w.BufferLine(_,R))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-T,0)}_reflowSmaller(_,g){const T=this.getNullCell(w.DEFAULT_ATTR_DATA),R=[];let M=0;for(let j=this.lines.length-1;j>=0;j--){let k=this.lines.get(j);if(!k||!k.isWrapped&&k.getTrimmedLength()<=_)continue;const D=[k];for(;k.isWrapped&&j>0;)k=this.lines.get(--j),D.unshift(k);const B=this.ybase+this.y;if(B>=j&&B<j+D.length)continue;const I=D[D.length-1].getTrimmedLength(),q=(0,E.reflowSmallerGetNewLineLengths)(D,this._cols,_),$=q.length-D.length;let J;J=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+$):Math.max(0,this.lines.length-this.lines.maxLength+$);const ee=[];for(let L=0;L<$;L++){const P=this.getBlankLine(w.DEFAULT_ATTR_DATA,!0);ee.push(P)}ee.length>0&&(R.push({start:j+D.length+M,newLines:ee}),M+=ee.length),D.push(...ee);let W=q.length-1,G=q[W];G===0&&(W--,G=q[W]);let Y=D.length-$-1,O=I;for(;Y>=0;){const L=Math.min(O,G);if(D[W]===void 0)break;if(D[W].copyCellsFrom(D[Y],O-L,G-L,L,!0),G-=L,G===0&&(W--,G=q[W]),O-=L,O===0){Y--;const P=Math.max(Y,0);O=(0,E.getWrappedLineTrimmedLength)(D,P,this._cols)}}for(let L=0;L<D.length;L++)q[L]<_&&D[L].setCell(q[L],T);let F=$-J;for(;F-- >0;)this.ybase===0?this.y<g-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+M)-g&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+g-1)}if(R.length>0){const j=[],k=[];for(let W=0;W<this.lines.length;W++)k.push(this.lines.get(W));const D=this.lines.length;let B=D-1,I=0,q=R[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+M);let $=0;for(let W=Math.min(this.lines.maxLength-1,D+M-1);W>=0;W--)if(q&&q.start>B+$){for(let G=q.newLines.length-1;G>=0;G--)this.lines.set(W--,q.newLines[G]);W++,j.push({index:B+1,amount:q.newLines.length}),$+=q.newLines.length,q=R[++I]}else this.lines.set(W,k[B--]);let J=0;for(let W=j.length-1;W>=0;W--)j[W].index+=J,this.lines.onInsertEmitter.fire(j[W]),J+=j[W].amount;const ee=Math.max(0,D+M-this.lines.maxLength);ee>0&&this.lines.onTrimEmitter.fire(ee)}}translateBufferLineToString(_,g,T=0,R){const M=this.lines.get(_);return M?M.translateToString(g,T,R):""}getWrappedRangeForLine(_){let g=_,T=_;for(;g>0&&this.lines.get(g).isWrapped;)g--;for(;T+1<this.lines.length&&this.lines.get(T+1).isWrapped;)T++;return{first:g,last:T}}setupTabStops(_){for(_!=null?this.tabs[_]||(_=this.prevStop(_)):(this.tabs={},_=0);_<this._cols;_+=this._optionsService.rawOptions.tabStopWidth)this.tabs[_]=!0}prevStop(_){for(_==null&&(_=this.x);!this.tabs[--_]&&_>0;);return _>=this._cols?this._cols-1:_<0?0:_}nextStop(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_<this._cols;);return _>=this._cols?this._cols-1:_<0?0:_}clearMarkers(_){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].line===_&&(this.markers[g].dispose(),this.markers.splice(g--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].dispose(),this.markers.splice(_--,1);this._isClearing=!1}addMarker(_){const g=new b.Marker(_);return this.markers.push(g),g.register(this.lines.onTrim((T=>{g.line-=T,g.line<0&&g.dispose()}))),g.register(this.lines.onInsert((T=>{g.line>=T.index&&(g.line+=T.amount)}))),g.register(this.lines.onDelete((T=>{g.line>=T.index&&g.line<T.index+T.amount&&g.dispose(),g.line>T.index&&(g.line-=T.amount)}))),g.register(g.onDispose((()=>this._removeMarker(g)))),g}_removeMarker(_){this._isClearing||this.markers.splice(this.markers.indexOf(_),1)}}},8437:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const p=u(3734),y=u(511),f=u(643),w=u(482);c.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let E=0;class A{constructor(b,S,_=!1){this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const g=S||y.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]);for(let T=0;T<b;++T)this.setCell(T,g);this.length=b}get(b){const S=this._data[3*b+0],_=2097151&S;return[this._data[3*b+1],2097152&S?this._combined[b]:_?(0,w.stringFromCodePoint)(_):"",S>>22,2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):_]}set(b,S){this._data[3*b+1]=S[f.CHAR_DATA_ATTR_INDEX],S[f.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=S[1],this._data[3*b+0]=2097152|b|S[f.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&S}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b]:2097151&S?(0,w.stringFromCodePoint)(2097151&S):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,S){return E=3*b,S.content=this._data[E+0],S.fg=this._data[E+1],S.bg=this._data[E+2],2097152&S.content&&(S.combinedData=this._combined[b]),268435456&S.bg&&(S.extended=this._extendedAttrs[b]),S}setCell(b,S){2097152&S.content&&(this._combined[b]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=S.content,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}setCellFromCodepoint(b,S,_,g){268435456&g.bg&&(this._extendedAttrs[b]=g.extended),this._data[3*b+0]=S|_<<22,this._data[3*b+1]=g.fg,this._data[3*b+2]=g.bg}addCodepointToCell(b,S,_){let g=this._data[3*b+0];2097152&g?this._combined[b]+=(0,w.stringFromCodePoint)(S):2097151&g?(this._combined[b]=(0,w.stringFromCodePoint)(2097151&g)+(0,w.stringFromCodePoint)(S),g&=-2097152,g|=2097152):g=S|4194304,_&&(g&=-12582913,g|=_<<22),this._data[3*b+0]=g}insertCells(b,S,_){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,_),S<this.length-b){const g=new y.CellData;for(let T=this.length-b-S-1;T>=0;--T)this.setCell(b+S+T,this.loadCell(b+T,g));for(let T=0;T<S;++T)this.setCell(b+T,_)}else for(let g=b;g<this.length;++g)this.setCell(g,_);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,_)}deleteCells(b,S,_){if(b%=this.length,S<this.length-b){const g=new y.CellData;for(let T=0;T<this.length-b-S;++T)this.setCell(b+T,this.loadCell(b+S+T,g));for(let T=this.length-S;T<this.length;++T)this.setCell(T,_)}else for(let g=b;g<this.length;++g)this.setCell(g,_);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,_),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,_)}replaceCells(b,S,_,g=!1){if(g)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,_),S<this.length&&this.getWidth(S-1)===2&&!this.isProtected(S)&&this.setCellFromCodepoint(S,0,1,_);b<S&&b<this.length;)this.isProtected(b)||this.setCell(b,_),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,_),S<this.length&&this.getWidth(S-1)===2&&this.setCellFromCodepoint(S,0,1,_);b<S&&b<this.length;)this.setCell(b++,_)}resize(b,S){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const _=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*_)this._data=new Uint32Array(this._data.buffer,0,_);else{const g=new Uint32Array(_);g.set(this._data),this._data=g}for(let g=this.length;g<b;++g)this.setCell(g,S)}else{this._data=this._data.subarray(0,_);const g=Object.keys(this._combined);for(let R=0;R<g.length;R++){const M=parseInt(g[R],10);M>=b&&delete this._combined[M]}const T=Object.keys(this._extendedAttrs);for(let R=0;R<T.length;R++){const M=parseInt(T[R],10);M>=b&&delete this._extendedAttrs[M]}}return this.length=b,4*_*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const b=new Uint32Array(this._data.length);return b.set(this._data),this._data=b,1}return 0}fill(b,S=!1){if(S)for(let _=0;_<this.length;++_)this.isProtected(_)||this.setCell(_,b);else{this._combined={},this._extendedAttrs={};for(let _=0;_<this.length;++_)this.setCell(_,b)}}copyFrom(b){this.length!==b.length?this._data=new Uint32Array(b._data):this._data.set(b._data),this.length=b.length,this._combined={};for(const S in b._combined)this._combined[S]=b._combined[S];this._extendedAttrs={};for(const S in b._extendedAttrs)this._extendedAttrs[S]=b._extendedAttrs[S];this.isWrapped=b.isWrapped}clone(){const b=new A(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const S in this._combined)b._combined[S]=this._combined[S];for(const S in this._extendedAttrs)b._extendedAttrs[S]=this._extendedAttrs[S];return b.isWrapped=this.isWrapped,b}getTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,S,_,g,T){const R=b._data;if(T)for(let j=g-1;j>=0;j--){for(let k=0;k<3;k++)this._data[3*(_+j)+k]=R[3*(S+j)+k];268435456&R[3*(S+j)+2]&&(this._extendedAttrs[_+j]=b._extendedAttrs[S+j])}else for(let j=0;j<g;j++){for(let k=0;k<3;k++)this._data[3*(_+j)+k]=R[3*(S+j)+k];268435456&R[3*(S+j)+2]&&(this._extendedAttrs[_+j]=b._extendedAttrs[S+j])}const M=Object.keys(b._combined);for(let j=0;j<M.length;j++){const k=parseInt(M[j],10);k>=S&&(this._combined[k-S+_]=b._combined[k])}}translateToString(b,S,_,g){S=S??0,_=_??this.length,b&&(_=Math.min(_,this.getTrimmedLength())),g&&(g.length=0);let T="";for(;S<_;){const R=this._data[3*S+0],M=2097151&R,j=2097152&R?this._combined[S]:M?(0,w.stringFromCodePoint)(M):f.WHITESPACE_CELL_CHAR;if(T+=j,g)for(let k=0;k<j.length;++k)g.push(S);S+=R>>22||1}return g&&g.push(S),T}}c.BufferLine=A},4841:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(u,p){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 p*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(v,c)=>{function u(p,y,f){if(y===p.length-1)return p[y].getTrimmedLength();const w=!p[y].hasContent(f-1)&&p[y].getWidth(f-1)===1,E=p[y+1].getWidth(0)===2;return w&&E?f-1:f}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(p,y,f,w,E){const A=[];for(let C=0;C<p.length-1;C++){let b=C,S=p.get(++b);if(!S.isWrapped)continue;const _=[p.get(C)];for(;b<p.length&&S.isWrapped;)_.push(S),S=p.get(++b);if(w>=C&&w<b){C+=_.length-1;continue}let g=0,T=u(_,g,y),R=1,M=0;for(;R<_.length;){const k=u(_,R,y),D=k-M,B=f-T,I=Math.min(D,B);_[g].copyCellsFrom(_[R],M,T,I,!1),T+=I,T===f&&(g++,T=0),M+=I,M===k&&(R++,M=0),T===0&&g!==0&&_[g-1].getWidth(f-1)===2&&(_[g].copyCellsFrom(_[g-1],f-1,T++,1,!1),_[g-1].setCell(f-1,E))}_[g].replaceCells(T,f,E);let j=0;for(let k=_.length-1;k>0&&(k>g||_[k].getTrimmedLength()===0);k--)j++;j>0&&(A.push(C+_.length-j),A.push(j)),C+=_.length-1}return A},c.reflowLargerCreateNewLayout=function(p,y){const f=[];let w=0,E=y[w],A=0;for(let C=0;C<p.length;C++)if(E===C){const b=y[++w];p.onDeleteEmitter.fire({index:C-A,amount:b}),C+=b-1,A+=b,E=y[++w]}else f.push(C);return{layout:f,countRemoved:A}},c.reflowLargerApplyNewLayout=function(p,y){const f=[];for(let w=0;w<y.length;w++)f.push(p.get(y[w]));for(let w=0;w<f.length;w++)p.set(w,f[w]);p.length=y.length},c.reflowSmallerGetNewLineLengths=function(p,y,f){const w=[],E=p.map(((S,_)=>u(p,_,y))).reduce(((S,_)=>S+_));let A=0,C=0,b=0;for(;b<E;){if(E-b<f){w.push(E-b);break}A+=f;const S=u(p,C,y);A>S&&(A-=S,C++);const _=p[C].getWidth(A-1)===2;_&&A--;const g=_?f-1:f;w.push(g),b+=g}return w},c.getWrappedLineTrimmedLength=u},5295:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const p=u(8460),y=u(844),f=u(9092);class w extends y.Disposable{constructor(A,C){super(),this._optionsService=A,this._bufferService=C,this._onBufferActivate=this.register(new p.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 f.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new f.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,C){this._normal.resize(A,C),this._alt.resize(A,C),this.setupTabStops(A)}setupTabStops(A){this._normal.setupTabStops(A),this._alt.setupTabStops(A)}}c.BufferSet=w},511:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const p=u(482),y=u(643),f=u(3734);class w extends f.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new f.ExtendedAttrs,this.combinedData=""}static fromCharData(A){const C=new w;return C.setFromCharData(A),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,p.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(A){this.fg=A[y.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(A[y.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(A[y.CHAR_DATA_CHAR_INDEX].length===2){const b=A[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const S=A[y.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(b-55296)+S-56320+65536|A[y.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=A[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|A[y.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=A[y.CHAR_DATA_CHAR_INDEX],this.content=2097152|A[y.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=w},643:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const p=u(8460),y=u(844);class f{get id(){return this._id}constructor(E){this.line=E,this.isDisposed=!1,this._disposables=[],this._id=f._nextId++,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,y.disposeArray)(this._disposables),this._disposables.length=0)}register(E){return this._disposables.push(E),E}}c.Marker=f,f._nextId=1},7116:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.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:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(v,c)=>{var u,p,y;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(f){f.NUL="\0",f.SOH="",f.STX="",f.ETX="",f.EOT="",f.ENQ="",f.ACK="",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=`
442
- `,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(u||(c.C0=u={})),(function(f){f.PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ"})(p||(c.C1=p={})),(function(f){f.ST=`${u.ESC}\\`})(y||(c.C1_ESCAPED=y={}))},7399:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const p=u(2584),y={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:["'",'"']};c.evaluateKeyboardEvent=function(f,w,E,A){const C={type:0,cancel:!1,key:void 0},b=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?C.key=w?p.C0.ESC+"OA":p.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?C.key=w?p.C0.ESC+"OD":p.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?C.key=w?p.C0.ESC+"OC":p.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(C.key=w?p.C0.ESC+"OB":p.C0.ESC+"[B");break;case 8:C.key=f.ctrlKey?"\b":p.C0.DEL,f.altKey&&(C.key=p.C0.ESC+C.key);break;case 9:if(f.shiftKey){C.key=p.C0.ESC+"[Z";break}C.key=p.C0.HT,C.cancel=!0;break;case 13:C.key=f.altKey?p.C0.ESC+p.C0.CR:p.C0.CR,C.cancel=!0;break;case 27:C.key=p.C0.ESC,f.altKey&&(C.key=p.C0.ESC+p.C0.ESC),C.cancel=!0;break;case 37:if(f.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(E?"b":"[1;5D"))):C.key=w?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(f.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(E?"f":"[1;5C"))):C.key=w?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(f.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"A",E||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=w?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(f.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"B",E||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=w?p.C0.ESC+"OB":p.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(C.key=p.C0.ESC+"[2~");break;case 46:C.key=b?p.C0.ESC+"[3;"+(b+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=b?p.C0.ESC+"[1;"+(b+1)+"H":w?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=b?p.C0.ESC+"[1;"+(b+1)+"F":w?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:f.shiftKey?C.type=2:f.ctrlKey?C.key=p.C0.ESC+"[5;"+(b+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:f.shiftKey?C.type=3:f.ctrlKey?C.key=p.C0.ESC+"[6;"+(b+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=b?p.C0.ESC+"[1;"+(b+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=b?p.C0.ESC+"[1;"+(b+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=b?p.C0.ESC+"[1;"+(b+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=b?p.C0.ESC+"[1;"+(b+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=b?p.C0.ESC+"[15;"+(b+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=b?p.C0.ESC+"[17;"+(b+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=b?p.C0.ESC+"[18;"+(b+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=b?p.C0.ESC+"[19;"+(b+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=b?p.C0.ESC+"[20;"+(b+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=b?p.C0.ESC+"[21;"+(b+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=b?p.C0.ESC+"[23;"+(b+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=b?p.C0.ESC+"[24;"+(b+1)+"~":p.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(E&&!A||!f.altKey||f.metaKey)!E||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?C.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(C.key=p.C0.US),f.key==="@"&&(C.key=p.C0.NUL)):f.keyCode===65&&(C.type=1);else{const S=y[f.keyCode],_=S==null?void 0:S[f.shiftKey?1:0];if(_)C.key=p.C0.ESC+_;else if(f.keyCode>=65&&f.keyCode<=90){const g=f.ctrlKey?f.keyCode-64:f.keyCode+32;let T=String.fromCharCode(g);f.shiftKey&&(T=T.toUpperCase()),C.key=p.C0.ESC+T}else if(f.keyCode===32)C.key=p.C0.ESC+(f.ctrlKey?p.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let g=f.code.slice(3,4);f.shiftKey||(g=g.toLowerCase()),C.key=p.C0.ESC+g,C.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?C.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?C.key=p.C0.NUL:f.keyCode>=51&&f.keyCode<=55?C.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?C.key=p.C0.DEL:f.keyCode===219?C.key=p.C0.ESC:f.keyCode===220?C.key=p.C0.FS:f.keyCode===221&&(C.key=p.C0.GS)}return C}},482:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},c.utf32ToString=function(u,p=0,y=u.length){let f="";for(let w=p;w<y;++w){let E=u[w];E>65535?(E-=65536,f+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):f+=String.fromCharCode(E)}return f},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,p){const y=u.length;if(!y)return 0;let f=0,w=0;if(this._interim){const E=u.charCodeAt(w++);56320<=E&&E<=57343?p[f++]=1024*(this._interim-55296)+E-56320+65536:(p[f++]=this._interim,p[f++]=E),this._interim=0}for(let E=w;E<y;++E){const A=u.charCodeAt(E);if(55296<=A&&A<=56319){if(++E>=y)return this._interim=A,f;const C=u.charCodeAt(E);56320<=C&&C<=57343?p[f++]=1024*(A-55296)+C-56320+65536:(p[f++]=A,p[f++]=C)}else A!==65279&&(p[f++]=A)}return f}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,p){const y=u.length;if(!y)return 0;let f,w,E,A,C=0,b=0,S=0;if(this.interim[0]){let T=!1,R=this.interim[0];R&=(224&R)==192?31:(240&R)==224?15:7;let M,j=0;for(;(M=63&this.interim[++j])&&j<4;)R<<=6,R|=M;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,D=k-j;for(;S<D;){if(S>=y)return 0;if(M=u[S++],(192&M)!=128){S--,T=!0;break}this.interim[j++]=M,R<<=6,R|=63&M}T||(k===2?R<128?S--:p[C++]=R:k===3?R<2048||R>=55296&&R<=57343||R===65279||(p[C++]=R):R<65536||R>1114111||(p[C++]=R)),this.interim.fill(0)}const _=y-4;let g=S;for(;g<y;){for(;!(!(g<_)||128&(f=u[g])||128&(w=u[g+1])||128&(E=u[g+2])||128&(A=u[g+3]));)p[C++]=f,p[C++]=w,p[C++]=E,p[C++]=A,g+=4;if(f=u[g++],f<128)p[C++]=f;else if((224&f)==192){if(g>=y)return this.interim[0]=f,C;if(w=u[g++],(192&w)!=128){g--;continue}if(b=(31&f)<<6|63&w,b<128){g--;continue}p[C++]=b}else if((240&f)==224){if(g>=y)return this.interim[0]=f,C;if(w=u[g++],(192&w)!=128){g--;continue}if(g>=y)return this.interim[0]=f,this.interim[1]=w,C;if(E=u[g++],(192&E)!=128){g--;continue}if(b=(15&f)<<12|(63&w)<<6|63&E,b<2048||b>=55296&&b<=57343||b===65279)continue;p[C++]=b}else if((248&f)==240){if(g>=y)return this.interim[0]=f,C;if(w=u[g++],(192&w)!=128){g--;continue}if(g>=y)return this.interim[0]=f,this.interim[1]=w,C;if(E=u[g++],(192&E)!=128){g--;continue}if(g>=y)return this.interim[0]=f,this.interim[1]=w,this.interim[2]=E,C;if(A=u[g++],(192&A)!=128){g--;continue}if(b=(7&f)<<18|(63&w)<<12|(63&E)<<6|63&A,b<65536||b>1114111)continue;p[C++]=b}}return C}}},225:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const p=u(1480),y=[[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]],f=[[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 w;c.UnicodeV6=class{constructor(){if(this.version="6",!w){w=new Uint8Array(65536),w.fill(1),w[0]=0,w.fill(0,1,32),w.fill(0,127,160),w.fill(2,4352,4448),w[9001]=2,w[9002]=2,w.fill(2,11904,42192),w[12351]=1,w.fill(2,44032,55204),w.fill(2,63744,64256),w.fill(2,65040,65050),w.fill(2,65072,65136),w.fill(2,65280,65377),w.fill(2,65504,65511);for(let E=0;E<y.length;++E)w.fill(0,y[E][0],y[E][1]+1)}}wcwidth(E){return E<32?0:E<127?1:E<65536?w[E]:(function(A,C){let b,S=0,_=C.length-1;if(A<C[0][0]||A>C[_][1])return!1;for(;_>=S;)if(b=S+_>>1,A>C[b][1])S=b+1;else{if(!(A<C[b][0]))return!0;_=b-1}return!1})(E,f)?0:E>=131072&&E<=196605||E>=196608&&E<=262141?2:1}charProperties(E,A){let C=this.wcwidth(E),b=C===0&&A!==0;if(b){const S=p.UnicodeService.extractWidth(A);S===0?b=!1:S>C&&(C=S)}return p.UnicodeService.createPropertyValue(0,C,b)}}},5981:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const p=u(8460),y=u(844);class f extends y.Disposable{constructor(E){super(),this._action=E,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new p.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(E,A){if(A!==void 0&&this._syncCalls>A)return void(this._syncCalls=0);if(this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(E,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+=E.length,this._writeBuffer.push(E),this._callbacks.push(A),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(A)}_innerWrite(E=0,A=!0){const C=E||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],S=this._action(b,A);if(S){const g=T=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,T))):this._innerWrite(C,T);return void S.catch((T=>(queueMicrotask((()=>{throw T})),Promise.resolve(!1)))).then(g)}const _=this._callbacks[this._bufferOffset];if(_&&_(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-C>=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()}}c.WriteBuffer=f},5941:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.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})$/,p=/^[\da-f]+$/;function y(f,w){const E=f.toString(16),A=E.length<2?"0"+E:E;switch(w){case 4:return E[0];case 8:return A;case 12:return(A+A).slice(0,3);default:return A+A}}c.parseColor=function(f){if(!f)return;let w=f.toLowerCase();if(w.indexOf("rgb:")===0){w=w.slice(4);const E=u.exec(w);if(E){const A=E[1]?15:E[4]?255:E[7]?4095:65535;return[Math.round(parseInt(E[1]||E[4]||E[7]||E[10],16)/A*255),Math.round(parseInt(E[2]||E[5]||E[8]||E[11],16)/A*255),Math.round(parseInt(E[3]||E[6]||E[9]||E[12],16)/A*255)]}}else if(w.indexOf("#")===0&&(w=w.slice(1),p.exec(w)&&[3,6,9,12].includes(w.length))){const E=w.length/3,A=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(w.slice(E*C,E*C+E),16);A[C]=E===1?b<<4:E===2?b:E===3?b>>4:b>>8}return A}},c.toRgbString=function(f,w=16){const[E,A,C]=f;return`rgb:${y(E,w)}/${y(A,w)}/${y(C,w)}`}},5770:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const p=u(482),y=u(8742),f=u(5770),w=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=w}registerHandler(A,C){this._handlers[A]===void 0&&(this._handlers[A]=[]);const b=this._handlers[A];return b.push(C),{dispose:()=>{const S=b.indexOf(C);S!==-1&&b.splice(S,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=w,this._ident=0}hook(A,C){if(this.reset(),this._ident=A,this._active=this._handlers[A]||w,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(A,C,b){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(A,C,b);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(A,C,b))}unhook(A,C=!0){if(this._active.length){let b=!1,S=this._active.length-1,_=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,b=C,_=this._stack.fallThrough,this._stack.paused=!1),!_&&b===!1){for(;S>=0&&(b=this._active[S].unhook(A),b!==!0);S--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,b;S--}for(;S>=0;S--)if(b=this._active[S].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",A);this._active=w,this._ident=0}};const E=new y.Params;E.addParam(0),c.DcsHandler=class{constructor(A){this._handler=A,this._data="",this._params=E,this._hitLimit=!1}hook(A){this._params=A.length>1||A.params[0]?A.clone():E,this._data="",this._hitLimit=!1}put(A,C,b){this._hitLimit||(this._data+=(0,p.utf32ToString)(A,C,b),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(A){let C=!1;if(this._hitLimit)C=!1;else if(A&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=E,this._data="",this._hitLimit=!1,b)));return this._params=E,this._data="",this._hitLimit=!1,C}}},2015:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const p=u(844),y=u(8742),f=u(6242),w=u(6351);class E{constructor(S){this.table=new Uint8Array(S)}setDefault(S,_){this.table.fill(S<<4|_)}add(S,_,g,T){this.table[_<<8|S]=g<<4|T}addMany(S,_,g,T){for(let R=0;R<S.length;R++)this.table[_<<8|S[R]]=g<<4|T}}c.TransitionTable=E;const A=160;c.VT500_TRANSITION_TABLE=(function(){const b=new E(4095),S=Array.apply(null,Array(256)).map(((j,k)=>k)),_=(j,k)=>S.slice(j,k),g=_(32,127),T=_(0,24);T.push(25),T.push.apply(T,_(28,32));const R=_(0,14);let M;for(M in b.setDefault(1,0),b.addMany(g,0,2,0),R)b.addMany([24,26,153,154],M,3,0),b.addMany(_(128,144),M,3,0),b.addMany(_(144,152),M,3,0),b.add(156,M,0,0),b.add(27,M,11,1),b.add(157,M,4,8),b.addMany([152,158,159],M,0,7),b.add(155,M,11,3),b.add(144,M,11,9);return b.addMany(T,0,3,0),b.addMany(T,1,3,1),b.add(127,1,0,1),b.addMany(T,8,0,8),b.addMany(T,3,3,3),b.add(127,3,0,3),b.addMany(T,4,3,4),b.add(127,4,0,4),b.addMany(T,6,3,6),b.addMany(T,5,3,5),b.add(127,5,0,5),b.addMany(T,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(g,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(_(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(g,7,0,7),b.addMany(T,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(_(64,127),3,7,0),b.addMany(_(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(_(48,60),4,8,4),b.addMany(_(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(_(32,64),6,0,6),b.add(127,6,0,6),b.addMany(_(64,127),6,0,0),b.addMany(_(32,48),3,9,5),b.addMany(_(32,48),5,9,5),b.addMany(_(48,64),5,0,6),b.addMany(_(64,127),5,7,0),b.addMany(_(32,48),4,9,5),b.addMany(_(32,48),1,9,2),b.addMany(_(32,48),2,9,2),b.addMany(_(48,127),2,10,0),b.addMany(_(48,80),1,10,0),b.addMany(_(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(_(96,127),1,10,0),b.add(80,1,11,9),b.addMany(T,9,0,9),b.add(127,9,0,9),b.addMany(_(28,32),9,0,9),b.addMany(_(32,48),9,9,12),b.addMany(_(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(T,11,0,11),b.addMany(_(32,128),11,0,11),b.addMany(_(28,32),11,0,11),b.addMany(T,10,0,10),b.add(127,10,0,10),b.addMany(_(28,32),10,0,10),b.addMany(_(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(_(32,48),10,9,12),b.addMany(T,12,0,12),b.add(127,12,0,12),b.addMany(_(28,32),12,0,12),b.addMany(_(32,48),12,9,12),b.addMany(_(48,64),12,0,11),b.addMany(_(64,127),12,12,13),b.addMany(_(64,127),10,12,13),b.addMany(_(64,127),9,12,13),b.addMany(T,13,13,13),b.addMany(g,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(A,0,2,0),b.add(A,8,5,8),b.add(A,6,0,6),b.add(A,11,0,11),b.add(A,13,13,13),b})();class C extends p.Disposable{constructor(S=c.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new y.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(_,g,T)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,g)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,p.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new w.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,_=[64,126]){let g=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(g=S.prefix.charCodeAt(0),g&&60>g||g>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let R=0;R<S.intermediates.length;++R){const M=S.intermediates.charCodeAt(R);if(32>M||M>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");g<<=8,g|=M}}if(S.final.length!==1)throw new Error("final must be a single byte");const T=S.final.charCodeAt(0);if(_[0]>T||T>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return g<<=8,g|=T,g}identToString(S){const _=[];for(;S;)_.push(String.fromCharCode(255&S)),S>>=8;return _.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,_){const g=this._identifier(S,[48,126]);this._escHandlers[g]===void 0&&(this._escHandlers[g]=[]);const T=this._escHandlers[g];return T.push(_),{dispose:()=>{const R=T.indexOf(_);R!==-1&&T.splice(R,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,_){this._executeHandlers[S.charCodeAt(0)]=_}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,_){const g=this._identifier(S);this._csiHandlers[g]===void 0&&(this._csiHandlers[g]=[]);const T=this._csiHandlers[g];return T.push(_),{dispose:()=>{const R=T.indexOf(_);R!==-1&&T.splice(R,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,_){return this._dcsParser.registerHandler(this._identifier(S),_)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,_){return this._oscParser.registerHandler(S,_)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}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(S,_,g,T,R){this._parseStack.state=S,this._parseStack.handlers=_,this._parseStack.handlerPos=g,this._parseStack.transition=T,this._parseStack.chunkPos=R}parse(S,_,g){let T,R=0,M=0,j=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,j=this._parseStack.chunkPos+1;else{if(g===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const k=this._parseStack.handlers;let D=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(g===!1&&D>-1){for(;D>=0&&(T=k[D](this._params),T!==!0);D--)if(T instanceof Promise)return this._parseStack.handlerPos=D,T}this._parseStack.handlers=[];break;case 4:if(g===!1&&D>-1){for(;D>=0&&(T=k[D](),T!==!0);D--)if(T instanceof Promise)return this._parseStack.handlerPos=D,T}this._parseStack.handlers=[];break;case 6:if(R=S[this._parseStack.chunkPos],T=this._dcsParser.unhook(R!==24&&R!==26,g),T)return T;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(R=S[this._parseStack.chunkPos],T=this._oscParser.end(R!==24&&R!==26,g),T)return T;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,j=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=j;k<_;++k){switch(R=S[k],M=this._transitions.table[this.currentState<<8|(R<160?R:A)],M>>4){case 2:for(let $=k+1;;++$){if($>=_||(R=S[$])<32||R>126&&R<A){this._printHandler(S,k,$),k=$-1;break}if(++$>=_||(R=S[$])<32||R>126&&R<A){this._printHandler(S,k,$),k=$-1;break}if(++$>=_||(R=S[$])<32||R>126&&R<A){this._printHandler(S,k,$),k=$-1;break}if(++$>=_||(R=S[$])<32||R>126&&R<A){this._printHandler(S,k,$),k=$-1;break}}break;case 3:this._executeHandlers[R]?this._executeHandlers[R]():this._executeHandlerFb(R),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:R,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const D=this._csiHandlers[this._collect<<8|R];let B=D?D.length-1:-1;for(;B>=0&&(T=D[B](this._params),T!==!0);B--)if(T instanceof Promise)return this._preserveStack(3,D,B,M,k),T;B<0&&this._csiHandlerFb(this._collect<<8|R,this._params),this.precedingJoinState=0;break;case 8:do switch(R){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(R-48)}while(++k<_&&(R=S[k])>47&&R<60);k--;break;case 9:this._collect<<=8,this._collect|=R;break;case 10:const I=this._escHandlers[this._collect<<8|R];let q=I?I.length-1:-1;for(;q>=0&&(T=I[q](),T!==!0);q--)if(T instanceof Promise)return this._preserveStack(4,I,q,M,k),T;q<0&&this._escHandlerFb(this._collect<<8|R),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|R,this._params);break;case 13:for(let $=k+1;;++$)if($>=_||(R=S[$])===24||R===26||R===27||R>127&&R<A){this._dcsParser.put(S,k,$),k=$-1;break}break;case 14:if(T=this._dcsParser.unhook(R!==24&&R!==26),T)return this._preserveStack(6,[],0,M,k),T;R===27&&(M|=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 $=k+1;;$++)if($>=_||(R=S[$])<32||R>127&&R<A){this._oscParser.put(S,k,$),k=$-1;break}break;case 6:if(T=this._oscParser.end(R!==24&&R!==26),T)return this._preserveStack(5,[],0,M,k),T;R===27&&(M|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&M}}}c.EscapeSequenceParser=C},6242:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const p=u(5770),y=u(482),f=[];c.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(w,E){this._handlers[w]===void 0&&(this._handlers[w]=[]);const A=this._handlers[w];return A.push(E),{dispose:()=>{const C=A.indexOf(E);C!==-1&&A.splice(C,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].start();else this._handlerFb(this._id,"START")}_put(w,E,A){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(w,E,A);else this._handlerFb(this._id,"PUT",(0,y.utf32ToString)(w,E,A))}start(){this.reset(),this._state=1}put(w,E,A){if(this._state!==3){if(this._state===1)for(;E<A;){const C=w[E++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&A-E>0&&this._put(w,E,A)}}end(w,E=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let A=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,A=E,b=this._stack.fallThrough,this._stack.paused=!1),!b&&A===!1){for(;C>=0&&(A=this._active[C].end(w),A!==!0);C--)if(A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,A;C--}for(;C>=0;C--)if(A=this._active[C].end(!1),A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,A}else this._handlerFb(this._id,"END",w);this._active=f,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(w){this._handler=w,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(w,E,A){this._hitLimit||(this._data+=(0,y.utf32ToString)(w,E,A),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(w){let E=!1;if(this._hitLimit)E=!1;else if(w&&(E=this._handler(this._data),E instanceof Promise))return E.then((A=>(this._data="",this._hitLimit=!1,A)));return this._data="",this._hitLimit=!1,E}}},8742:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const u=2147483647;class p{static fromArray(f){const w=new p;if(!f.length)return w;for(let E=Array.isArray(f[0])?1:0;E<f.length;++E){const A=f[E];if(Array.isArray(A))for(let C=0;C<A.length;++C)w.addSubParam(A[C]);else w.addParam(A)}return w}constructor(f=32,w=32){if(this.maxLength=f,this.maxSubParamsLength=w,w>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(w),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new p(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let w=0;w<this.length;++w){f.push(this.params[w]);const E=this._subParamsIdx[w]>>8,A=255&this._subParamsIdx[w];A-E>0&&f.push(Array.prototype.slice.call(this._subParams,E,A))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>u?u:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>u?u:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const w=this._subParamsIdx[f]>>8,E=255&this._subParamsIdx[f];return E-w>0?this._subParams.subarray(w,E):null}getSubParamsAll(){const f={};for(let w=0;w<this.length;++w){const E=this._subParamsIdx[w]>>8,A=255&this._subParamsIdx[w];A-E>0&&(f[w]=this._subParams.slice(E,A))}return f}addDigit(f){let w;if(this._rejectDigits||!(w=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const E=this._digitIsSub?this._subParams:this.params,A=E[w-1];E[w-1]=~A?Math.min(10*A+f,u):f}}c.Params=p},5741:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,p){const y={instance:p,dispose:p.dispose,isDisposed:!1};this._addons.push(y),p.dispose=()=>this._wrappedAddonDispose(y),p.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let p=-1;for(let y=0;y<this._addons.length;y++)if(this._addons[y]===u){p=y;break}if(p===-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(p,1)}}},8771:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const p=u(3785),y=u(511);c.BufferApiView=class{constructor(f,w){this._buffer=f,this.type=w}init(f){return this._buffer=f,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(f){const w=this._buffer.lines.get(f);if(w)return new p.BufferLineApiView(w)}getNullCell(){return new y.CellData}}},3785:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const p=u(511);c.BufferLineApiView=class{constructor(y){this._line=y}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(y,f){if(!(y<0||y>=this._line.length))return f?(this._line.loadCell(y,f),f):this._line.loadCell(y,new p.CellData)}translateToString(y,f,w){return this._line.translateToString(y,f,w)}}},8285:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const p=u(8771),y=u(8460),f=u(844);class w extends f.Disposable{constructor(A){super(),this._core=A,this._onBufferChange=this.register(new y.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new p.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)}}c.BufferNamespaceApi=w},7975:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,p){return this._core.registerCsiHandler(u,(y=>p(y.toArray())))}addCsiHandler(u,p){return this.registerCsiHandler(u,p)}registerDcsHandler(u,p){return this._core.registerDcsHandler(u,((y,f)=>p(y,f.toArray())))}addDcsHandler(u,p){return this.registerDcsHandler(u,p)}registerEscHandler(u,p){return this._core.registerEscHandler(u,p)}addEscHandler(u,p){return this.registerEscHandler(u,p)}registerOscHandler(u,p){return this._core.registerOscHandler(u,p)}addOscHandler(u,p){return this.registerOscHandler(u,p)}}},7090:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.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(v,c,u){var p=this&&this.__decorate||function(b,S,_,g){var T,R=arguments.length,M=R<3?S:g===null?g=Object.getOwnPropertyDescriptor(S,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,S,_,g);else for(var j=b.length-1;j>=0;j--)(T=b[j])&&(M=(R<3?T(M):R>3?T(S,_,M):T(S,_))||M);return R>3&&M&&Object.defineProperty(S,_,M),M},y=this&&this.__param||function(b,S){return function(_,g){S(_,g,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const f=u(8460),w=u(844),E=u(5295),A=u(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends w.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new E.BufferSet(b,this))}resize(b,S){this.cols=b,this.rows=S,this.buffers.resize(b,S),this._onResize.fire({cols:b,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,S=!1){const _=this.buffer;let g;g=this._cachedBlankLine,g&&g.length===this.cols&&g.getFg(0)===b.fg&&g.getBg(0)===b.bg||(g=_.getBlankLine(b,S),this._cachedBlankLine=g),g.isWrapped=S;const T=_.ybase+_.scrollTop,R=_.ybase+_.scrollBottom;if(_.scrollTop===0){const M=_.lines.isFull;R===_.lines.length-1?M?_.lines.recycle().copyFrom(g):_.lines.push(g.clone()):_.lines.splice(R+1,0,g.clone()),M?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const M=R-T+1;_.lines.shiftElements(T+1,M-1,-1),_.lines.set(R,g.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(b,S,_){const g=this.buffer;if(b<0){if(g.ydisp===0)return;this.isUserScrolling=!0}else b+g.ydisp>=g.ybase&&(this.isUserScrolling=!1);const T=g.ydisp;g.ydisp=Math.max(Math.min(g.ydisp+b,g.ybase),0),T!==g.ydisp&&(S||this._onScroll.fire(g.ydisp))}};c.BufferService=C=p([y(0,A.IOptionsService)],C)},7994:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.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,p){this._charsets[u]=p,this.glevel===u&&(this.charset=p)}}},1753:function(v,c,u){var p=this&&this.__decorate||function(g,T,R,M){var j,k=arguments.length,D=k<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,R):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,T,R,M);else for(var B=g.length-1;B>=0;B--)(j=g[B])&&(D=(k<3?j(D):k>3?j(T,R,D):j(T,R))||D);return k>3&&D&&Object.defineProperty(T,R,D),D},y=this&&this.__param||function(g,T){return function(R,M){T(R,M,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const f=u(2585),w=u(8460),E=u(844),A={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:g=>g.button!==4&&g.action===1&&(g.ctrl=!1,g.alt=!1,g.shift=!1,!0)},VT200:{events:19,restrict:g=>g.action!==32},DRAG:{events:23,restrict:g=>g.action!==32||g.button!==3},ANY:{events:31,restrict:g=>!0}};function C(g,T){let R=(g.ctrl?16:0)|(g.shift?4:0)|(g.alt?8:0);return g.button===4?(R|=64,R|=g.action):(R|=3&g.button,4&g.button&&(R|=64),8&g.button&&(R|=128),g.action===32?R|=32:g.action!==0||T||(R|=3)),R}const b=String.fromCharCode,S={DEFAULT:g=>{const T=[C(g,!1)+32,g.col+32,g.row+32];return T[0]>255||T[1]>255||T[2]>255?"":`\x1B[M${b(T[0])}${b(T[1])}${b(T[2])}`},SGR:g=>{const T=g.action===0&&g.button!==4?"m":"M";return`\x1B[<${C(g,!0)};${g.col};${g.row}${T}`},SGR_PIXELS:g=>{const T=g.action===0&&g.button!==4?"m":"M";return`\x1B[<${C(g,!0)};${g.x};${g.y}${T}`}};let _=c.CoreMouseService=class extends E.Disposable{constructor(g,T){super(),this._bufferService=g,this._coreService=T,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new w.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const R of Object.keys(A))this.addProtocol(R,A[R]);for(const R of Object.keys(S))this.addEncoding(R,S[R]);this.reset()}addProtocol(g,T){this._protocols[g]=T}addEncoding(g,T){this._encodings[g]=T}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(g){if(!this._protocols[g])throw new Error(`unknown protocol "${g}"`);this._activeProtocol=g,this._onProtocolChange.fire(this._protocols[g].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(g){if(!this._encodings[g])throw new Error(`unknown encoding "${g}"`);this._activeEncoding=g}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(g){if(g.col<0||g.col>=this._bufferService.cols||g.row<0||g.row>=this._bufferService.rows||g.button===4&&g.action===32||g.button===3&&g.action!==32||g.button!==4&&(g.action===2||g.action===3)||(g.col++,g.row++,g.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,g,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(g))return!1;const T=this._encodings[this._activeEncoding](g);return T&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(T):this._coreService.triggerDataEvent(T,!0)),this._lastEvent=g,!0}explainEvents(g){return{down:!!(1&g),up:!!(2&g),drag:!!(4&g),move:!!(8&g),wheel:!!(16&g)}}_equalEvents(g,T,R){if(R){if(g.x!==T.x||g.y!==T.y)return!1}else if(g.col!==T.col||g.row!==T.row)return!1;return g.button===T.button&&g.action===T.action&&g.ctrl===T.ctrl&&g.alt===T.alt&&g.shift===T.shift}};c.CoreMouseService=_=p([y(0,f.IBufferService),y(1,f.ICoreService)],_)},6975:function(v,c,u){var p=this&&this.__decorate||function(_,g,T,R){var M,j=arguments.length,k=j<3?g:R===null?R=Object.getOwnPropertyDescriptor(g,T):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,g,T,R);else for(var D=_.length-1;D>=0;D--)(M=_[D])&&(k=(j<3?M(k):j>3?M(g,T,k):M(g,T))||k);return j>3&&k&&Object.defineProperty(g,T,k),k},y=this&&this.__param||function(_,g){return function(T,R){g(T,R,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const f=u(1439),w=u(8460),E=u(844),A=u(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=c.CoreService=class extends E.Disposable{constructor(_,g,T){super(),this._bufferService=_,this._logService=g,this._optionsService=T,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new w.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new w.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new w.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new w.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(C),this.decPrivateModes=(0,f.clone)(b)}reset(){this.modes=(0,f.clone)(C),this.decPrivateModes=(0,f.clone)(b)}triggerDataEvent(_,g=!1){if(this._optionsService.rawOptions.disableStdin)return;const T=this._bufferService.buffer;g&&this._optionsService.rawOptions.scrollOnUserInput&&T.ybase!==T.ydisp&&this._onRequestScrollToBottom.fire(),g&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,(()=>_.split("").map((R=>R.charCodeAt(0))))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,(()=>_.split("").map((g=>g.charCodeAt(0))))),this._onBinary.fire(_))}};c.CoreService=S=p([y(0,A.IBufferService),y(1,A.ILogService),y(2,A.IOptionsService)],S)},9074:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const p=u(8055),y=u(8460),f=u(844),w=u(6106);let E=0,A=0;class C extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new w.SortedList((_=>_==null?void 0:_.marker.line)),this._onDecorationRegistered=this.register(new y.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new y.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(_){if(_.marker.isDisposed)return;const g=new b(_);if(g){const T=g.marker.onDispose((()=>g.dispose()));g.onDispose((()=>{g&&(this._decorations.delete(g)&&this._onDecorationRemoved.fire(g),T.dispose())})),this._decorations.insert(g),this._onDecorationRegistered.fire(g)}return g}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,g,T){let R=0,M=0;for(const j of this._decorations.getKeyIterator(g))R=j.options.x??0,M=R+(j.options.width??1),_>=R&&_<M&&(!T||(j.options.layer??"bottom")===T)&&(yield j)}forEachDecorationAtCell(_,g,T,R){this._decorations.forEachByKey(g,(M=>{E=M.options.x??0,A=E+(M.options.width??1),_>=E&&_<A&&(!T||(M.options.layer??"bottom")===T)&&R(M)}))}}c.DecorationService=C;class b extends f.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=p.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=p.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(_){super(),this.options=_,this.onRenderEmitter=this.register(new y.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new y.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=_.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const p=u(2585),y=u(8343);class f{constructor(...E){this._entries=new Map;for(const[A,C]of E)this.set(A,C)}set(E,A){const C=this._entries.get(E);return this._entries.set(E,A),C}forEach(E){for(const[A,C]of this._entries.entries())E(A,C)}has(E){return this._entries.has(E)}get(E){return this._entries.get(E)}}c.ServiceCollection=f,c.InstantiationService=class{constructor(){this._services=new f,this._services.set(p.IInstantiationService,this)}setService(w,E){this._services.set(w,E)}getService(w){return this._services.get(w)}createInstance(w,...E){const A=(0,y.getServiceDependencies)(w).sort(((S,_)=>S.index-_.index)),C=[];for(const S of A){const _=this._services.get(S.id);if(!_)throw new Error(`[createInstance] ${w.name} depends on UNKNOWN service ${S.id}.`);C.push(_)}const b=A.length>0?A[0].index:E.length;if(E.length!==b)throw new Error(`[createInstance] First service dependency of ${w.name} at position ${b+1} conflicts with ${E.length} static arguments`);return new w(...E,...C)}}},7866:function(v,c,u){var p=this&&this.__decorate||function(b,S,_,g){var T,R=arguments.length,M=R<3?S:g===null?g=Object.getOwnPropertyDescriptor(S,_):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,S,_,g);else for(var j=b.length-1;j>=0;j--)(T=b[j])&&(M=(R<3?T(M):R>3?T(S,_,M):T(S,_))||M);return R>3&&M&&Object.defineProperty(S,_,M),M},y=this&&this.__param||function(b,S){return function(_,g){S(_,g,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const f=u(844),w=u(2585),E={trace:w.LogLevelEnum.TRACE,debug:w.LogLevelEnum.DEBUG,info:w.LogLevelEnum.INFO,warn:w.LogLevelEnum.WARN,error:w.LogLevelEnum.ERROR,off:w.LogLevelEnum.OFF};let A,C=c.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=w.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),A=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let S=0;S<b.length;S++)typeof b[S]=="function"&&(b[S]=b[S]())}_log(b,S,_){this._evalLazyOptionalParams(_),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+S,..._)}trace(b,...S){var _;this._logLevel<=w.LogLevelEnum.TRACE&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.trace.bind(this._optionsService.options.logger))??console.log,b,S)}debug(b,...S){var _;this._logLevel<=w.LogLevelEnum.DEBUG&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.debug.bind(this._optionsService.options.logger))??console.log,b,S)}info(b,...S){var _;this._logLevel<=w.LogLevelEnum.INFO&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.info.bind(this._optionsService.options.logger))??console.info,b,S)}warn(b,...S){var _;this._logLevel<=w.LogLevelEnum.WARN&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.warn.bind(this._optionsService.options.logger))??console.warn,b,S)}error(b,...S){var _;this._logLevel<=w.LogLevelEnum.ERROR&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.error.bind(this._optionsService.options.logger))??console.error,b,S)}};c.LogService=C=p([y(0,w.IOptionsService)],C),c.setTraceLogger=function(b){A=b},c.traceCall=function(b,S,_){if(typeof _.value!="function")throw new Error("not supported");const g=_.value;_.value=function(...T){if(A.logLevel!==w.LogLevelEnum.TRACE)return g.apply(this,T);A.trace(`GlyphRenderer#${g.name}(${T.map((M=>JSON.stringify(M))).join(", ")})`);const R=g.apply(this,T);return A.trace(`GlyphRenderer#${g.name} return`,R),R}}},7302:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const p=u(8460),y=u(844),f=u(6114);c.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:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const w=["normal","bold","100","200","300","400","500","600","700","800","900"];class E extends y.Disposable{constructor(C){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...c.DEFAULT_OPTIONS};for(const S in C)if(S in b)try{const _=C[S];b[S]=this._sanitizeAndValidateOption(S,_)}catch(_){console.error(_)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,y.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((S=>{S===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((S=>{C.indexOf(S)!==-1&&b()}))}_setupOptions(){const C=S=>{if(!(S in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},b=(S,_)=>{if(!(S in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);_=this._sanitizeAndValidateOption(S,_),this.rawOptions[S]!==_&&(this.rawOptions[S]=_,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const _={get:C.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this.options,S,_)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=c.DEFAULT_OPTIONS[C]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=w.includes(b)?b:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}c.OptionsService=E},2660:function(v,c,u){var p=this&&this.__decorate||function(E,A,C,b){var S,_=arguments.length,g=_<3?A:b===null?b=Object.getOwnPropertyDescriptor(A,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(E,A,C,b);else for(var T=E.length-1;T>=0;T--)(S=E[T])&&(g=(_<3?S(g):_>3?S(A,C,g):S(A,C))||g);return _>3&&g&&Object.defineProperty(A,C,g),g},y=this&&this.__param||function(E,A){return function(C,b){A(C,b,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const f=u(2585);let w=c.OscLinkService=class{constructor(E){this._bufferService=E,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(E){const A=this._bufferService.buffer;if(E.id===void 0){const T=A.addMarker(A.ybase+A.y),R={data:E,id:this._nextId++,lines:[T]};return T.onDispose((()=>this._removeMarkerFromLink(R,T))),this._dataByLinkId.set(R.id,R),R.id}const C=E,b=this._getEntryIdKey(C),S=this._entriesWithId.get(b);if(S)return this.addLineToLink(S.id,A.ybase+A.y),S.id;const _=A.addMarker(A.ybase+A.y),g={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(g,_))),this._entriesWithId.set(g.key,g),this._dataByLinkId.set(g.id,g),g.id}addLineToLink(E,A){const C=this._dataByLinkId.get(E);if(C&&C.lines.every((b=>b.line!==A))){const b=this._bufferService.buffer.addMarker(A);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(E){var A;return(A=this._dataByLinkId.get(E))==null?void 0:A.data}_getEntryIdKey(E){return`${E.id};;${E.uri}`}_removeMarkerFromLink(E,A){const C=E.lines.indexOf(A);C!==-1&&(E.lines.splice(C,1),E.lines.length===0&&(E.data.id!==void 0&&this._entriesWithId.delete(E.key),this._dataByLinkId.delete(E.id)))}};c.OscLinkService=w=p([y(0,f.IBufferService)],w)},8343:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const u="di$target",p="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(y){return y[p]||[]},c.createDecorator=function(y){if(c.serviceRegistry.has(y))return c.serviceRegistry.get(y);const f=function(w,E,A){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,S){b[u]===b?b[p].push({id:C,index:S}):(b[p]=[{id:C,index:S}],b[u]=b)})(f,w,A)};return f.toString=()=>y,c.serviceRegistry.set(y,f),f}},2585:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const p=u(8343);var y;c.IBufferService=(0,p.createDecorator)("BufferService"),c.ICoreMouseService=(0,p.createDecorator)("CoreMouseService"),c.ICoreService=(0,p.createDecorator)("CoreService"),c.ICharsetService=(0,p.createDecorator)("CharsetService"),c.IInstantiationService=(0,p.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(y||(c.LogLevelEnum=y={})),c.ILogService=(0,p.createDecorator)("LogService"),c.IOptionsService=(0,p.createDecorator)("OptionsService"),c.IOscLinkService=(0,p.createDecorator)("OscLinkService"),c.IUnicodeService=(0,p.createDecorator)("UnicodeService"),c.IDecorationService=(0,p.createDecorator)("DecorationService")},1480:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const p=u(8460),y=u(225);class f{static extractShouldJoin(E){return(1&E)!=0}static extractWidth(E){return E>>1&3}static extractCharKind(E){return E>>3}static createPropertyValue(E,A,C=!1){return(16777215&E)<<3|(3&A)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const E=new y.UnicodeV6;this.register(E),this._active=E.version,this._activeProvider=E}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(E){if(!this._providers[E])throw new Error(`unknown Unicode version "${E}"`);this._active=E,this._activeProvider=this._providers[E],this._onChange.fire(E)}register(E){this._providers[E.version]=E}wcwidth(E){return this._activeProvider.wcwidth(E)}getStringCellWidth(E){let A=0,C=0;const b=E.length;for(let S=0;S<b;++S){let _=E.charCodeAt(S);if(55296<=_&&_<=56319){if(++S>=b)return A+this.wcwidth(_);const R=E.charCodeAt(S);56320<=R&&R<=57343?_=1024*(_-55296)+R-56320+65536:A+=this.wcwidth(R)}const g=this.charProperties(_,C);let T=f.extractWidth(g);f.extractShouldJoin(g)&&(T-=f.extractWidth(C)),A+=T,C=g}return A}charProperties(E,A){return this._activeProvider.charProperties(E,A)}}c.UnicodeService=f}},a={};function l(v){var c=a[v];if(c!==void 0)return c.exports;var u=a[v]={exports:{}};return n[v].call(u.exports,u,u.exports,l),u.exports}var d={};return(()=>{var v=d;Object.defineProperty(v,"__esModule",{value:!0}),v.Terminal=void 0;const c=l(9042),u=l(3236),p=l(844),y=l(5741),f=l(8285),w=l(7975),E=l(7090),A=["cols","rows"];class C extends p.Disposable{constructor(S){super(),this._core=this.register(new u.Terminal(S)),this._addonManager=this.register(new y.AddonManager),this._publicOptions={...this._core.options};const _=T=>this._core.options[T],g=(T,R)=>{this._checkReadonlyOptions(T),this._core.options[T]=R};for(const T in this._core.options){const R={get:_.bind(this,T),set:g.bind(this,T)};Object.defineProperty(this._publicOptions,T,R)}}_checkReadonlyOptions(S){if(A.includes(S))throw new Error(`Option "${S}" 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 w.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new E.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 f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const S=this._core.coreService.decPrivateModes;let _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const _ in S)this._publicOptions[_]=S[_]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,_=!0){this._core.input(S,_)}resize(S,_){this._verifyIntegers(S,_),this._core.resize(S,_)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,_,g){this._verifyIntegers(S,_,g),this._core.select(S,_,g)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,_){this._verifyIntegers(S,_),this._core.selectLines(S,_)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,_){this._core.write(S,_)}writeln(S,_){this._core.write(S),this._core.write(`\r
443
- `,_)}paste(S){this._core.paste(S)}refresh(S,_){this._verifyIntegers(S,_),this._core.refresh(S,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return c}_verifyIntegers(...S){for(const _ of S)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const _ of S)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}v.Terminal=C})(),d})()))})(Sd)),Sd.exports}var Ek=Ck(),wd={exports:{}},Ug;function kk(){return Ug||(Ug=1,(function(s,t){(function(n,a){s.exports=a()})(self,(()=>(()=>{var n={};return(()=>{var a=n;Object.defineProperty(a,"__esModule",{value:!0}),a.FitAddon=void 0,a.FitAddon=class{activate(l){this._terminal=l}dispose(){}fit(){const l=this.proposeDimensions();if(!l||!this._terminal||isNaN(l.cols)||isNaN(l.rows))return;const d=this._terminal._core;this._terminal.rows===l.rows&&this._terminal.cols===l.cols||(d._renderService.clear(),this._terminal.resize(l.cols,l.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const l=this._terminal._core,d=l._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;const v=this._terminal.options.scrollback===0?0:l.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(c.getPropertyValue("height")),p=Math.max(0,parseInt(c.getPropertyValue("width"))),y=window.getComputedStyle(this._terminal.element),f=u-(parseInt(y.getPropertyValue("padding-top"))+parseInt(y.getPropertyValue("padding-bottom"))),w=p-(parseInt(y.getPropertyValue("padding-right"))+parseInt(y.getPropertyValue("padding-left")))-v;return{cols:Math.max(2,Math.floor(w/d.css.cell.width)),rows:Math.max(1,Math.floor(f/d.css.cell.height))}}}})(),n})()))})(wd)),wd.exports}var Tk=kk(),xd={exports:{}},Fg;function Ak(){return Fg||(Fg=1,(function(s,t){(function(n,a){s.exports=a()})(self,(()=>(()=>{var n={6:(v,c)=>{function u(y){try{const f=new URL(y),w=f.password&&f.username?`${f.protocol}//${f.username}:${f.password}@${f.host}`:f.username?`${f.protocol}//${f.username}@${f.host}`:`${f.protocol}//${f.host}`;return y.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(y,f,w,E={}){this._terminal=y,this._regex=f,this._handler=w,this._options=E}provideLinks(y,f){const w=p.computeLink(y,this._regex,this._terminal,this._handler);f(this._addCallbacks(w))}_addCallbacks(y){return y.map((f=>(f.leave=this._options.leave,f.hover=(w,E)=>{if(this._options.hover){const{range:A}=f;this._options.hover(w,E,A)}},f)))}};class p{static computeLink(f,w,E,A){const C=new RegExp(w.source,(w.flags||"")+"g"),[b,S]=p._getWindowedLineStrings(f-1,E),_=b.join("");let g;const T=[];for(;g=C.exec(_);){const R=g[0];if(!u(R))continue;const[M,j]=p._mapStrIdx(E,S,0,g.index),[k,D]=p._mapStrIdx(E,M,j,R.length);if(M===-1||j===-1||k===-1||D===-1)continue;const B={start:{x:j+1,y:M+1},end:{x:D,y:k+1}};T.push({range:B,text:R,activate:A})}return T}static _getWindowedLineStrings(f,w){let E,A=f,C=f,b=0,S="";const _=[];if(E=w.buffer.active.getLine(f)){const g=E.translateToString(!0);if(E.isWrapped&&g[0]!==" "){for(b=0;(E=w.buffer.active.getLine(--A))&&b<2048&&(S=E.translateToString(!0),b+=S.length,_.push(S),E.isWrapped&&S.indexOf(" ")===-1););_.reverse()}for(_.push(g),b=0;(E=w.buffer.active.getLine(++C))&&E.isWrapped&&b<2048&&(S=E.translateToString(!0),b+=S.length,_.push(S),S.indexOf(" ")===-1););}return[_,A]}static _mapStrIdx(f,w,E,A){const C=f.buffer.active,b=C.getNullCell();let S=E;for(;A;){const _=C.getLine(w);if(!_)return[-1,-1];for(let g=S;g<_.length;++g){_.getCell(g,b);const T=b.getChars();if(b.getWidth()&&(A-=T.length||1,g===_.length-1&&T==="")){const R=C.getLine(w+1);R&&R.isWrapped&&(R.getCell(0,b),b.getWidth()===2&&(A+=1))}if(A<0)return[w,g]}w++,S=0}return[w,S]}}c.LinkComputer=p}},a={};function l(v){var c=a[v];if(c!==void 0)return c.exports;var u=a[v]={exports:{}};return n[v](u,u.exports,l),u.exports}var d={};return(()=>{var v=d;Object.defineProperty(v,"__esModule",{value:!0}),v.WebLinksAddon=void 0;const c=l(6),u=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function p(y,f){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}v.WebLinksAddon=class{constructor(y=p,f={}){this._handler=y,this._options=f}activate(y){this._terminal=y;const f=this._options,w=f.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,w,this._handler,f))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),d})()))})(xd)),xd.exports}var Rk=Ak();function Mk(s,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(s)}&token=${encodeURIComponent(t)}`}const Dk=15e3,jk=new Set([4001,4004]),Nk='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function gc(s,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(s).trim()||t}const Lk={black:"#1a1a1e",red:"#f87171",green:"#4ade80",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#9b8fc4",cyan:"#22d3ee",white:"#f3f3f5",brightBlack:"#404046",brightRed:"#ff9b96",brightGreen:"#86efac",brightYellow:"#ffd966",brightBlue:"#60a5fa",brightMagenta:"#c4b5fd",brightCyan:"#67e8f9",brightWhite:"#ffffff"},Ok={black:"#3a3a3e",red:"#dc2626",green:"#16a34a",yellow:"#b45309",blue:"#2563eb",magenta:"#7c3aed",cyan:"#0891b2",white:"#d4d4d8",brightBlack:"#6b6b75",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#f59e0b",brightBlue:"#3b82f6",brightMagenta:"#9b8fc4",brightCyan:"#22d3ee",brightWhite:"#ffffff"};function qg(s){const t=gc("--bg",s==="dark"?"#0c0c0e":"#fbfbfc"),n=gc("--ink",s==="dark"?"#f3f3f5":"#16161a"),a=gc("--brand",s==="dark"?"#6be195":"#167e3a");return{...s==="dark"?Lk:Ok,background:t,foreground:n,cursor:a,cursorAccent:t,selectionBackground:`${a}40`}}const Bk=({sessionId:s,token:t})=>{const n=U.useRef(null),a=U.useRef(null),[l,d]=U.useState("connecting"),[v,c]=U.useState(null);U.useEffect(()=>Jf(p=>{a.current&&(a.current.options.theme=qg(p))}),[]),U.useEffect(()=>{var T;const p=n.current;if(!p)return;let y=!1,f=0,w=null,E=null;const A=new Ek.Terminal({cursorBlink:!0,fontSize:13,fontFamily:gc("--mono",Nk),theme:qg(Kf()),scrollback:1e4,allowProposedApi:!0});a.current=A;const C=new Tk.FitAddon;A.loadAddon(C),A.loadAddon(new Rk.WebLinksAddon),A.parser.registerCsiHandler({prefix:">",final:"q"},()=>(A.write("\x1BP>|XTerm(370)\x1B\\"),!0)),A.parser.registerOscHandler(52,R=>{var k;const M=R.split(";");if(M.length<2)return!1;const j=M[M.length-1];try{const D=atob(j),B=Uint8Array.from(D,q=>q.charCodeAt(0)),I=new TextDecoder().decode(B);(k=navigator.clipboard)==null||k.writeText(I).catch(()=>{})}catch{}return!0}),A.open(p),C.fit(),(T=document.fonts)==null||T.ready.then(()=>{y||(C.fit(),S())});const b=A.onData(R=>{(E==null?void 0:E.readyState)===WebSocket.OPEN&&E.send(R)}),S=()=>{(E==null?void 0:E.readyState)===WebSocket.OPEN&&E.send(JSON.stringify({type:"resize",cols:A.cols,rows:A.rows}))},_=new ResizeObserver(()=>{C.fit(),S()});_.observe(p);function g(){if(y)return;const R=new WebSocket(Mk(s,t));E=R,R.onopen=()=>{f=0,d("connected"),c(null),C.fit(),S()},R.onmessage=M=>{const j=typeof M.data=="string"?M.data:new TextDecoder().decode(M.data);A.write(j)},R.onclose=M=>{if(y)return;if(jk.has(M.code)){d("error"),c(M.reason||`Connection refused (${M.code})`);return}const j=Math.min(1e3*2**f,Dk);f+=1,d("connecting"),w=setTimeout(g,j)}}return g(),()=>{y=!0,w&&clearTimeout(w),_.disconnect(),b.dispose(),E==null||E.close(),A.dispose(),a.current=null}},[s,t]);const u=l==="connected"?"Connected":l==="error"?v??"Error":"Connecting…";return h.jsxs("div",{className:"harness-terminal",children:[h.jsxs("div",{className:"terminal-statusbar","data-status":l,children:[h.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),h.jsx("span",{className:"terminal-status-label",children:u})]}),h.jsx("div",{ref:n,className:"terminal-screen"})]})},Hk=8e3;function zk({message:s,onDismiss:t}){return U.useEffect(()=>{const n=window.setTimeout(t,Hk);return()=>window.clearTimeout(n)},[s,t]),h.jsxs("div",{className:"toast",role:"alert","data-testid":"toast",children:[h.jsx("span",{className:"toast-message",children:s}),h.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:t,children:"×"})]})}function Ik(){const s=U.useRef(null);return U.useEffect(()=>{const t=s.current;if(!t)return;let n=null;const a=()=>{n=null,t.dataset.show="false",t.textContent=""},l=c=>{const u=c.closest("[data-tooltip], [title], [data-tip-stash]");if(!u||u===n)return;const p=u;p.title&&(p.dataset.tipStash=p.title,p.removeAttribute("title"));const y=p.dataset.tooltip||p.dataset.tipStash;if(!y)return;n=u,t.textContent=y,t.dataset.show="true";const f=u.getBoundingClientRect(),{offsetWidth:w,offsetHeight:E}=t,A=u.closest(".rail-workflows");if(A&&A.getBoundingClientRect().right+w+14<=window.innerWidth){const S=A.getBoundingClientRect().right+8,_=Math.min(Math.max(f.top+f.height/2-E/2,6),window.innerHeight-E-6);t.style.transform=`translate(${Math.round(S)}px, ${Math.round(_)}px)`;return}const C=Math.min(Math.max(f.left+f.width/2-w/2,6),window.innerWidth-w-6),b=f.top-E-7>=4?f.top-E-7:f.bottom+7;t.style.transform=`translate(${Math.round(C)}px, ${Math.round(b)}px)`},d=c=>l(c.target),v=c=>{n&&!n.contains(c.relatedTarget)&&a()};return document.addEventListener("pointerover",d,!0),document.addEventListener("pointerout",v,!0),document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",a,!0),document.addEventListener("scroll",a,!0),window.addEventListener("blur",a),()=>{document.removeEventListener("pointerover",d,!0),document.removeEventListener("pointerout",v,!0),document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",a,!0),document.removeEventListener("scroll",a,!0),window.removeEventListener("blur",a)}},[]),h.jsx("div",{ref:s,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const Wg=s=>s.split("/").filter(Boolean).pop()??s,$k=(s,t)=>s===t||s.startsWith(`${t}/`);function Pk(s,t,n){const a=new Map;for(const u of s){const p=a.get(u.cwd);(!p||u.lastActiveAt>p)&&a.set(u.cwd,u.lastActiveAt)}const l=u=>n.filter(p=>$k(p.path,u)).length,d=Array.from(a.entries()).sort(([u,p],[y,f])=>f.localeCompare(p)||u.localeCompare(y)).map(([u,p])=>({cwd:u,label:Wg(u),lastActiveAt:p,agentCount:l(u)})),v=new Set(a.keys()),c=[];for(const u of t)v.has(u)||(v.add(u),c.push({cwd:u,label:Wg(u),lastActiveAt:null,agentCount:l(u)}));return[...d,...c]}function Uk(s,t){const n=t.reduce((a,l)=>a+l.agentCount,0);return Math.max(0,s.length-n)}const Fk="data-ph-capture-attribute-";function Cd(s){const t={};for(const[n,a]of Object.entries(s)){if(a==null)continue;const l=String(a);l.length!==0&&(t[`${Fk}${n}`]=l)}return t}const By=[{id:"have",title:"Open a folder",sub:"Add a folder that already holds an agent",icon:"Folder"},{id:"template",title:"Start from a template",sub:"Ready-made workflows you can edit",icon:"LayoutTemplate"},{id:"idea",title:"Start from an idea",sub:"Describe it; the agent scaffolds it",icon:"Sparkles"}];function Hy({recentDirs:s,projectRoot:t,listDir:n,onClose:a,onConnect:l,onScan:d,onScaffold:v,onBrowseTemplates:c,onSaveProjectRoot:u,listHarnesses:p,triggerRef:y,initialDoor:f}){const[w,E]=U.useState(f??null),[A,C]=U.useState([]);U.useEffect(()=>{let g=!1;return p().then(T=>{g||C(T)}).catch(()=>{}),()=>{g=!0}},[p]);const b=U.useRef(null);ga(!0,{onDismiss:a,containerRef:b,triggerRef:y});const S=By.find(g=>g.id===w)??null,_=g=>{if(g==="template"){c();return}E(g)};return h.jsx("div",{className:"modal-backdrop",children:h.jsxs("div",{className:"modal modal-add-workspace",role:"dialog","aria-label":S?S.title:"Add to Sapiom",ref:b,children:[h.jsxs("div",{className:"modal-header",children:[w&&!f&&h.jsx("button",{type:"button",className:"theme-toggle aw-back","aria-label":"Back to all options","data-testid":"aw-back",onClick:()=>E(null),children:h.jsx(me,{name:"ArrowLeft",size:14})}),h.jsx("span",{className:"aw-title",children:S?S.title:"Add to Sapiom"}),h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:a,children:h.jsx(me,{name:"X",size:14})})]}),!w&&h.jsx(Iy,{onPick:_}),w==="have"&&h.jsx(qk,{recentDirs:s,listDir:n,onConnect:l,onScan:d,onScaffold:v,onBrowseTemplates:c,entries:A,onDone:a}),w==="idea"&&h.jsx(Vk,{projectRoot:t,listDir:n,onScaffold:v,onSaveProjectRoot:u,onDone:a})]})})}function zy({icon:s,title:t,sub:n,testid:a,onClick:l}){return h.jsxs("button",{type:"button",className:"aw-door","data-testid":a,onClick:l,children:[h.jsx("span",{className:"aw-door-icon","aria-hidden":"true",children:h.jsx(me,{name:s,size:15})}),h.jsxs("span",{className:"aw-door-text",children:[h.jsx("span",{className:"aw-door-title",children:t}),h.jsx("span",{className:"aw-door-sub",children:n})]}),h.jsx("span",{className:"aw-door-arrow","aria-hidden":"true",children:h.jsx(me,{name:"ArrowRight",size:14})})]})}function Iy({onPick:s,leading:t}){return h.jsxs("div",{className:"aw-doors","data-testid":"aw-doors",children:[t,By.map(n=>h.jsx(zy,{icon:n.icon,title:n.title,sub:n.sub,testid:`aw-door-${n.id}`,onClick:()=>s(n.id)},n.id))]})}function qk({recentDirs:s,listDir:t,onConnect:n,onScan:a,onScaffold:l,onBrowseTemplates:d,entries:v,onDone:c}){const[u,p]=U.useState(s[0]??""),[y,f]=U.useState(!1),[w,E]=U.useState(null),[A,C]=U.useState(!1),[b,S]=U.useState(!1),[_,g]=U.useState(null),T=U.useCallback(async()=>{const M=Ed(u.trim());if(!M)return;if(y){E({kind:"new"});return}C(!0),g(null);const j=tk(M);try{const k=j?await t(j):null;if(!!(k!=null&&k.dirs.some(q=>Ed(q.path)===M&&q.hasAgentProject))){E({kind:"project"});return}const B=await t(M);if(Ed(B.path)!==M){E({kind:"new"});return}const I=B.dirs.filter(q=>q.hasAgentProject).length;E(I>0?{kind:"multi",found:I}:{kind:"plain"})}catch{try{j&&await t(j),E({kind:"new"})}catch{g("Couldn't read that directory.")}}finally{C(!1)}},[u,y,t]),R=async M=>{S(!0),g(null);try{await M(),c()}catch(j){g(j.message)}finally{S(!1)}};return w?h.jsxs(h.Fragment,{children:[h.jsx(Gk,{path:u.trim(),outcome:w,busy:b,onChange:()=>E(null),onConnect:()=>void R(()=>n(u.trim())),onScan:()=>void R(async()=>{if(await a(u.trim())===0)throw new Error("No agent projects found under this folder.")}),onScaffold:()=>void R(()=>l(u.trim(),tp())),onBrowseTemplates:d,entries:v}),_&&h.jsx("div",{className:"modal-error",children:_})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"modal-body",children:[h.jsx("section",{className:"modal-section",children:h.jsx(Qc,{value:u,onChange:p,onSubmit:()=>void T(),recentDirs:s,listDir:t,onNewDirChange:f})}),h.jsx("p",{className:"modal-field-hint",children:"Any folder — we'll tell you what we find in it."}),_&&h.jsx("div",{className:"modal-error",children:_})]}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",onClick:c,disabled:A,children:"Cancel"}),h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-have-continue",onClick:()=>void T(),disabled:A||!u.trim(),children:A?"Checking…":"Continue"})]})]})}function Wk({entries:s}){const[t,n]=U.useState(!1),[a,l]=U.useState(null),d=U.useRef(null);U.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const v=s.filter(f=>f.installMcpPrompt.trim().length>0);if(v.length===0)return null;const c=tp(),u=v.find(f=>f.id===c)??v[0],p=v.filter(f=>f.id!==u.id),y=f=>{var w;(w=navigator.clipboard)==null||w.writeText(f.installMcpPrompt).then(()=>{Ho("mcp.install",{harness:f.id}),l(f.id),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>l(null),1600)}).catch(()=>{})};return h.jsxs("div",{className:"aw-mcp","data-testid":"mcp-install",children:[h.jsxs("div",{className:"aw-mcp-row",children:[h.jsxs("span",{className:"aw-mcp-text",children:["Also drive this project from your own terminal?"," ",h.jsx("span",{className:"aw-mcp-dim",children:"Sapiom MCP isn't set up here."})]}),h.jsxs("button",{type:"button",className:"btn-ghost","data-testid":`mcp-install-copy-${u.id}`,onClick:()=>y(u),children:[h.jsx(me,{name:"Copy",size:13}),a===u.id?"Copied":"Copy setup prompt"]}),p.length>0&&h.jsx("button",{type:"button",className:"btn-ghost aw-mcp-more","aria-expanded":t,"aria-label":"Setup prompts for other agents","data-testid":"mcp-install-more",onClick:()=>n(f=>!f),children:h.jsx(me,{name:t?"ChevronDown":"ChevronRight",size:13})})]}),t&&h.jsx("div",{className:"aw-mcp-list",children:p.map(f=>h.jsxs("div",{className:"aw-mcp-list-row",children:[h.jsx("span",{className:"aw-mcp-text",children:f.label}),h.jsxs("button",{type:"button",className:"btn-ghost","data-testid":`mcp-install-copy-${f.id}`,onClick:()=>y(f),children:[h.jsx(me,{name:"Copy",size:13}),a===f.id?"Copied":"Copy"]})]},f.id))})]})}function Gk({path:s,outcome:t,busy:n,onChange:a,onConnect:l,onScan:d,onScaffold:v,onBrowseTemplates:c,entries:u}){const p=t.kind==="project"||t.kind==="multi";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"aw-result","data-tone":p?"good":"todo","data-testid":"aw-result","aria-live":"polite",children:[h.jsxs("div",{className:"aw-result-head",children:[h.jsx("span",{className:"aw-result-glyph","aria-hidden":"true",children:h.jsx(me,{name:p?"Check":"TriangleAlert",size:14})}),h.jsxs("span",{className:"aw-result-text",children:[h.jsxs("span",{className:"aw-result-title",children:[t.kind==="project"&&"This is an agent project",t.kind==="multi"&&`${t.found} agent ${t.found===1?"project":"projects"} under this folder`,t.kind==="plain"&&"No agent project in this folder",t.kind==="new"&&"This folder doesn't exist yet"]}),h.jsx("span",{className:"aw-result-path",title:s,children:s})]}),h.jsx("button",{type:"button",className:"btn-ghost aw-result-change",onClick:a,disabled:n,children:"Change"})]}),t.kind==="plain"&&h.jsx(Wk,{entries:u})]}),h.jsxs("div",{className:"modal-actions",children:[t.kind==="project"&&h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add",onClick:l,disabled:n,children:n?"Adding…":"Add workspace"}),t.kind==="multi"&&h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add-all",onClick:d,disabled:n,children:n?"Adding…":`Add all ${t.found}`}),(t.kind==="plain"||t.kind==="new")&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",className:"btn-ghost",onClick:c,disabled:n,children:[h.jsx(me,{name:"LayoutTemplate",size:13}),"Start from a template"]}),t.kind==="plain"&&h.jsx("button",{type:"button",className:"btn-ghost","data-testid":"aw-add-anyway",onClick:l,disabled:n,title:"Add the folder as a workspace now and scaffold an agent in it later",children:"Add folder anyway"}),h.jsxs("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-scaffold-here",onClick:v,disabled:n,children:[h.jsx(me,{name:"Sparkles",size:13}),n?"Starting…":"Scaffold an agent here"]})]})]})]})}function Vk({projectRoot:s,listDir:t,onScaffold:n,onSaveProjectRoot:a,onDone:l}){const[d,v]=U.useState(""),[c,u]=U.useState(""),[p,y]=U.useState(!1),[f,w]=U.useState(s??""),[E,A]=U.useState(!1),[C,b]=U.useState(!1),[S,_]=U.useState(new Set),[g,T]=U.useState(!1),[R,M]=U.useState(null);U.useEffect(()=>{const W=f.trim();if(!W)return;let G=!1;return t(W).then(Y=>{G||_(new Set(Y.dirs.map(O=>O.name)))}).catch(()=>{G||_(new Set)}),()=>{G=!0}},[f,t]);const j=W=>{v(W),p||u(sk(QE(W),S))},k=c.trim(),D=ep(k),B=D&&S.has(k),I=My(k,f),q=!!d.trim()&&D&&!B&&!!I&&!g,$=()=>k?D?B?"That folder already exists here. Pick another name.":"Becomes the agent's name.":"Lowercase letters, numbers and dashes only — it becomes the package name.":"Becomes the agent's name.",J=async()=>{if(q){T(!0),M(null);try{await n(I,tp(),d.trim()),l()}catch(W){M(W.message),T(!1)}}},ee=async W=>{const G=W.trim();if(G){w(G),A(!1);try{await a(G),b(!0)}catch(Y){M(Y.message)}}};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"modal-body",children:[h.jsxs("label",{className:"aw-field",htmlFor:"aw-idea",children:[h.jsx("span",{className:"aw-field-label",children:"What should it do?"}),h.jsx("textarea",{id:"aw-idea",className:"modal-input aw-textarea","data-testid":"aw-idea",rows:3,value:d,placeholder:"Every morning, diff our competitors' pricing pages and Slack me the changes.",onChange:W=>j(W.target.value)})]}),h.jsxs("label",{className:"aw-field",htmlFor:"aw-name",children:[h.jsx("span",{className:"aw-field-label",children:"Name"}),h.jsx("input",{id:"aw-name",className:"modal-input","data-testid":"aw-name",value:c,spellCheck:!1,"aria-invalid":!!k&&(!D||B),onChange:W=>{u(W.target.value),y(!0)}})]}),E?h.jsxs("section",{className:"modal-section aw-root-picker",children:[h.jsx(Qc,{value:f,onChange:w,onSubmit:()=>void ee(f),recentDirs:[],listDir:t}),h.jsxs("div",{className:"aw-root-actions",children:[h.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>A(!1),children:"Cancel"}),h.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>void ee(f),children:"Use this folder"})]})]}):h.jsxs("div",{className:"aw-target",children:[h.jsx("span",{className:"aw-target-path","data-testid":"aw-target",title:I||f,children:I||`${f}/…`}),h.jsx("button",{type:"button",className:"btn-ghost aw-root-change","data-testid":"aw-change-root",onClick:()=>A(!0),children:"Change root…"})]}),h.jsx("p",{className:"modal-field-hint","data-invalid":!!k&&(!D||B),children:$()}),C&&h.jsx("p",{className:"modal-field-hint",children:"Saved as your default projects folder."}),R&&h.jsx("div",{className:"modal-error",children:R})]}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",onClick:l,disabled:g,children:"Cancel"}),h.jsxs("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-scaffold-it",onClick:()=>void J(),disabled:!q,children:[h.jsx(me,{name:"Sparkles",size:13}),g?"Starting…":"Scaffold it"]})]})]})}function tp(){return Mi().preferredHarness??"claude-code"}function Ed(s){return s.length>1?s.replace(/\/+$/,""):s}const Yk=5;function Xk({recentDirs:s,sessions:t,workflows:n,projectRoot:a,listDir:l,onCreateSession:d,onConnect:v,onScan:c,onScaffold:u,onSaveProjectRoot:p,listHarnesses:y,onBrowseTemplates:f,onDismiss:w,firstRun:E,telemetryOptIn:A,onToggleTelemetry:C}){const[b,S]=U.useState(!1),[_,g]=U.useState(null),[T,R]=U.useState(null),M=U.useRef(null),j=U.useRef(null),k=U.useRef(null);ga(!b,{onDismiss:w,containerRef:k});const D=Pk(t,s,n),B=D.slice(0,Yk),I=Uk(n,B),q=async $=>{var J;if(!T){R($),g(null);try{const W=(await y()).filter(O=>O.installed&&Ty.includes(O.id)),G=Mi().preferredHarness,Y=(G&&W.some(O=>O.id===G)?G:void 0)??((J=W[0])==null?void 0:J.id)??"claude-code";await d($,Y)}catch(ee){g(ee.message),R(null)}}};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"modal-backdrop welcome-panel","data-testid":"welcome-panel",role:"dialog","aria-modal":"true","aria-label":E?"Welcome to Sapiom Agent Studio":"Sapiom Agent Studio",children:h.jsxs("div",{className:"welcome-card",ref:k,children:[h.jsx("button",{type:"button",className:"theme-toggle modal-close welcome-close","data-testid":"welcome-close","aria-label":"Close",title:"Close",onClick:w,children:h.jsx(me,{name:"X",size:14})}),h.jsxs("div",{className:"welcome-body",...Cd({surface:"welcome"}),children:[h.jsx("h1",{className:"welcome-title",children:E?"Welcome to Sapiom Agent Studio":"Sapiom Agent Studio"}),h.jsx("p",{className:"welcome-intro",children:"Studio turns the agent workflows in your codebase into a diagram you can run. Local runs are free and offline, with every step’s input, output and capability call on screen. Nothing ships until you say so."}),_&&h.jsx("div",{className:"welcome-error",children:_}),h.jsxs("div",{className:"welcome-open","data-testid":"welcome-open-card",children:[h.jsx("span",{className:"welcome-open-icon","aria-hidden":"true",children:h.jsx(me,{name:"Folder",size:20})}),h.jsxs("span",{className:"welcome-open-copy",children:[h.jsx("span",{className:"welcome-open-title",children:"Open a folder"}),h.jsx("span",{className:"welcome-open-desc",children:"Workflows in the folder appear in the rail. Nothing is uploaded."})]}),h.jsx("button",{ref:M,type:"button",className:"btn-primary welcome-open-cta","data-testid":"welcome-start-project",onClick:()=>S(!0),...Cd({object:"workspace",intent:"open_folder"}),children:"Open folder"})]}),h.jsxs("div",{className:"welcome-open","data-testid":"welcome-templates-card",children:[h.jsx("span",{className:"welcome-open-icon","aria-hidden":"true",children:h.jsx(me,{name:"LayoutTemplate",size:20})}),h.jsxs("span",{className:"welcome-open-copy",children:[h.jsx("span",{className:"welcome-open-title",children:"Start from a template"}),h.jsx("span",{className:"welcome-open-desc",children:"Runnable starters, cloned locally and free to test."})]}),h.jsx("button",{ref:j,type:"button",className:"btn-line welcome-open-cta","data-testid":"welcome-browse-templates",onClick:f,...Cd({object:"template",intent:"browse_templates"}),children:"Browse templates"})]}),h.jsxs("a",{className:"welcome-docs-btn","data-testid":"welcome-docs",href:"https://docs.sapiom.ai/agents/quick-start",target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",h.jsx(me,{name:"ArrowUpRight",size:12})]}),h.jsxs("label",{className:"welcome-consent","data-testid":"welcome-consent",children:[h.jsx("button",{type:"button",role:"switch","aria-checked":A,"data-testid":"welcome-telemetry-toggle",className:"toggle-switch"+(A?" is-on":""),onClick:()=>void C(!A),children:h.jsx("span",{className:"toggle-knob"})}),h.jsx("span",{className:"welcome-consent-copy",children:"Help us optimize your experience — share your session details with Sapiom so we can improve how the Studio works for you. Off by default; change it anytime in Settings."})]}),D.length>0&&h.jsxs("div",{className:"welcome-recents-block",children:[h.jsx("h2",{className:"welcome-recents-title",children:"Recent workspaces"}),h.jsx("ul",{className:"welcome-recents","data-testid":"welcome-recents",children:B.map($=>h.jsx("li",{children:h.jsxs("button",{type:"button",className:"welcome-recent","data-testid":`welcome-recent-${$.label}`,title:$.cwd,disabled:T!==null,onClick:()=>void q($.cwd),children:[h.jsx(me,{name:"Folder",size:13}),h.jsx("span",{className:"welcome-recent-name",children:$.label}),h.jsx("span",{className:"welcome-recent-path",children:T===$.cwd?"Opening…":$.cwd}),h.jsxs("span",{className:"welcome-recent-meta",children:[$.agentCount>0&&`${$.agentCount} agent${$.agentCount===1?"":"s"}`,$.agentCount>0&&$.lastActiveAt&&" · ",$.lastActiveAt&&by(Date.parse($.lastActiveAt))]})]})},$.cwd))}),I>0&&h.jsxs("p",{className:"welcome-recents-note","data-testid":"welcome-recents-note",children:[n.length," agent"," ",n.length===1?"project":"projects"," known in total — the rail lists them all."]})]}),h.jsxs("span",{className:"welcome-hints-kbd",children:["or press ",h.jsx("kbd",{children:"⌘K"})]})]})]})}),b&&h.jsx(Hy,{recentDirs:s,projectRoot:a,listDir:l,onClose:()=>S(!1),onConnect:v,onScan:c,onScaffold:u,onSaveProjectRoot:p,listHarnesses:y,onBrowseTemplates:()=>{S(!1),f()},triggerRef:M,initialDoor:"have"})]})}const Kk="data:image/svg+xml,%3csvg%20width='115'%20height='122'%20viewBox='0%200%20115%20122'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M105.267%2060.7219L98.8902%2071.7648L92.1353%2083.4669L83.3114%2098.7521L70.18%20121.491H0L13.1249%2098.7521H57.042L72.6274%2071.7648L79.0038%2060.7219L72.2619%2049.0459H98.5247L105.267%2060.7219Z'%20fill='%236BE195'/%3e%3cpath%20d='M114.072%200L100.954%2022.7189H57.0694L57.0498%2022.6928L57.0368%2022.7189L41.8365%2049.047L35.0945%2060.723L41.471%2071.7659H15.2016L8.8252%2060.723L15.5671%2049.047L21.9631%2037.978L30.774%2022.7189L43.8923%200H114.072Z'%20fill='%236BE195'/%3e%3c/svg%3e";function Jk({onCollapse:s}){const[t,n]=U.useState(Kf());return U.useEffect(()=>Jf(n),[]),h.jsxs("header",{className:"brand-header",children:[h.jsxs("div",{className:"brand-lockup",children:[h.jsx("img",{src:Kk,alt:"",className:"brand-mark"}),h.jsx("span",{className:"brand-name",children:"Sapiom"}),h.jsx("span",{className:"brand-divider"}),h.jsx("span",{className:"brand-product",children:"Studio"})]}),h.jsxs("div",{className:"brand-header-tools",children:[h.jsx("button",{className:"theme-toggle","data-testid":"theme-toggle","aria-label":t==="dark"?"Switch to light mode":"Switch to dark mode",title:t==="dark"?"Switch to light mode":"Switch to dark mode",onClick:sx,children:h.jsx(me,{name:t==="dark"?"Sun":"Moon",size:15})}),h.jsx("button",{className:"theme-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:s,children:h.jsx(me,{name:"PanelLeftClose",size:15})})]})]})}const Zk=[{id:"claude-code",label:"Claude Code",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:"",imageInput:!1},{id:"codex",label:"Codex CLI",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:"",imageInput:!1}];function Qk(s){const t=s.filter(n=>n.id==="sapiom");return t.length===0?s:[...t,...s.filter(n=>n.id!=="sapiom")]}function sp(s){return s.mode==="embedded"&&s.installed&&Ty.includes(s.id)}function e3(s){if(sp(s))return null;if(s.mode==="external")return`${s.label} runs in its own app. Studio can't launch it yet.`;if(!s.installed){const t=s.installMcpPrompt.trim();return t.length>0?t:`${s.label} isn't on this machine's PATH. Install its CLI, then restart the Studio server.`}return`This Studio build can't launch ${s.label} yet.`}function t3(s,t){var n;return((n=s.find(a=>a.id===t))==null?void 0:n.label)??t}function s3({entries:s,activeId:t,testidPrefix:n,onPick:a}){return h.jsx(h.Fragment,{children:s.map(l=>{const d=sp(l),v=l.id===t,c=e3(l);return h.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":v,"aria-disabled":!d||void 0,className:"profile-menu-item provider-item"+(d?"":" is-unavailable"),"data-testid":`${n}-${l.id}`,"data-tooltip":c??void 0,onClick:()=>{d&&a(l.id)},children:[h.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:v&&h.jsx(me,{name:"Check",size:13})}),h.jsx(Wo,{kind:l.id,size:13}),l.label]},l.id)})})}function i3({recentDirs:s,launchDir:t,listDir:n,onClose:a,onCreate:l,listHarnesses:d,triggerRef:v}){const[c,u]=U.useState(t??s[0]??""),[p,y]=U.useState(()=>Mi().preferredHarness??"claude-code"),[f,w]=U.useState(Zk),[E,A]=U.useState(!1),[C,b]=U.useState(null),[S,_]=U.useState(!1),g=U.useCallback(()=>_(!1),[]),T=U.useRef(null),R=U.useRef(null);ga(!S,{onDismiss:a,containerRef:R,triggerRef:v}),U.useEffect(()=>{if(!d)return;let j=!1;return d().then(k=>{if(j||k.length===0)return;w(Qk(k));const D=k.filter(sp);y(B=>{var I;return D.some(q=>q.id===B)?B:((I=D[0])==null?void 0:I.id)??B})}).catch(()=>{}),()=>{j=!0}},[d]);const M=async()=>{const j=c.trim();if(j){A(!0),b(null);try{await l(j,p),a()}catch(k){b(k.message)}finally{A(!1)}}};return h.jsx("div",{className:"modal-backdrop",children:h.jsxs("div",{className:"modal modal-new-session",role:"dialog","aria-label":"New session",ref:R,children:[h.jsxs("div",{className:"modal-header",children:["New session",h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:a,disabled:E,children:h.jsx(me,{name:"X",size:14})})]}),h.jsxs("div",{className:"modal-body",children:[h.jsx("section",{className:"modal-section",children:h.jsx(Qc,{value:c,onChange:u,onSubmit:()=>void M(),recentDirs:s,listDir:n})}),h.jsx("p",{className:"modal-field-hint",children:"Pick the workspace folder the agent runs in; the session is named after the folder."}),C&&h.jsx("div",{className:"modal-error",children:C})]}),h.jsxs("div",{className:"modal-actions",children:[h.jsxs(h.Fragment,{children:[h.jsxs("button",{ref:T,type:"button",className:"harness-select","data-testid":"harness-select","aria-haspopup":"menu","aria-expanded":S,"aria-label":"Agent for this session","data-tooltip":"Which coding agent runs this session",disabled:E,onClick:()=>_(j=>!j),children:[h.jsx(Wo,{kind:p,size:14}),h.jsx("span",{className:"harness-select-label",children:t3(f,p)}),h.jsx("span",{className:"disclosure-caret"+(S?" is-open":""),"aria-hidden":"true",children:h.jsx(me,{name:"ChevronDown",size:12})})]}),h.jsx(cn,{open:S,anchorRef:T,onDismiss:g,placement:"up-start",className:"session-menu harness-select-menu",role:"menu",testid:"harness-select-menu",children:h.jsx(s3,{entries:f,activeId:p,testidPrefix:"harness-option",onPick:j=>{y(j),g()}})})]}),h.jsx("button",{className:"btn-ghost",onClick:a,disabled:E,children:"Cancel"}),h.jsx("button",{className:"btn-primary modal-primary-cta",onClick:()=>void M(),disabled:E||!c.trim(),children:E?"Starting…":"Start session"})]})]})})}function n3({authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:a,consentSource:l,consentEnvReason:d,onToggleTelemetry:v,onToggleProductAnalytics:c,rollingSummary:u,onToggleRollingSummary:p,onStartAuth:y,onDisconnect:f}){const[w,E]=U.useState(!1),[A,C]=U.useState({status:"idle"}),b=l==="env-forced-off",S=b?!1:n,_=b?!1:a,g=async()=>{const k=!n;E(!0);try{await v(k),Ho("consent.changed",{optIn:k})}finally{E(!1)}},T=async()=>{const k=!a;E(!0);try{await c(k),Ho("consent.changed",{productAnalytics:k})}finally{E(!1)}},R=async()=>{E(!0);try{await p(!u)}finally{E(!1)}},M=async()=>{C({status:"pending"});try{await y()}catch(k){const D=k instanceof Error?k.message:"Could not start sign-in. Try again.";C({status:"error",message:D})}},j=async()=>{E(!0);try{await f()}finally{E(!1)}};return s&&A.status==="pending"&&C({status:"idle"}),h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"settings-identity",children:s?t??"Signed in":"Not signed in"}),!s&&h.jsx("div",{className:"settings-auth-row",children:A.status==="pending"?h.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[h.jsx(me,{name:"Loader",size:13}),"Opening browser… waiting for sign-in"]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:"btn-primary settings-connect-btn","data-testid":"settings-connect-btn",onClick:()=>void M(),children:"Connect account"}),A.status==="error"&&h.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:A.message})]})}),s&&h.jsx("div",{className:"settings-auth-row",children:h.jsxs("button",{type:"button",className:"settings-disconnect-btn","data-testid":"settings-disconnect-btn",disabled:w,onClick:()=>void j(),children:[h.jsx(me,{name:"LogOut",size:13}),w?"Signing out…":"Disconnect"]})}),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Share session details with Sapiom"}),h.jsx("button",{type:"button",role:"switch","aria-checked":S,"data-testid":"telemetry-toggle",className:"toggle-switch"+(S?" is-on":""),disabled:w||b,onClick:()=>void g(),children:h.jsx("span",{className:"toggle-knob"})})]}),h.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 the Studio gets in your way. Off by default. Always written locally to ",h.jsx("code",{children:NE.events})," either way."]}),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Product analytics (clicks & usage)"}),h.jsx("button",{type:"button",role:"switch","aria-checked":_,"data-testid":"product-analytics-toggle",className:"toggle-switch"+(_?" is-on":""),disabled:w||b,onClick:()=>void T(),children:h.jsx("span",{className:"toggle-knob"})})]}),h.jsx("p",{className:"settings-note",children:"Anonymous-by-default usage: which buttons and screens you use, and how you move through the Studio. No prompt text, no file contents, and never a screen recording. On by default; turn it off here anytime."}),b&&h.jsxs("p",{className:"settings-note settings-env-note","data-testid":"telemetry-env-note",children:["All telemetry is turned off by ",d?`$${d}`:"an environment variable",". Unset it and restart the Studio server to manage consent here."]}),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Summarize sessions in the background"}),h.jsx("button",{type:"button",role:"switch","aria-checked":u,"data-testid":"rolling-summary-toggle",className:"toggle-switch"+(u?" is-on":""),disabled:w,onClick:()=>void R(),children:h.jsx("span",{className:"toggle-knob"})})]}),h.jsxs("p",{className:"settings-note",children:["Off by default, because it uses tokens you didn’t ask to use: every 10 turns, and once at the end, a cheap one-shot agent run folds the session into a short summary. Continuing a session the agent can no longer reattach to then explains what the work was"," ",h.jsx("em",{children:"for"}),", not just what it last did. With this off, continuing still works — it carries the last few turns instead."]})]})}function r3(){return typeof window>"u"?void 0:window}function a3(s=r3()){const t=s==null?void 0:s.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}}function o3(s){switch(s.kind){case"available":return{text:`Downloading ${s.version}…`,tone:"info"};case"downloaded":return{text:`${s.version} is ready to install.`,tone:"action"};case"up-to-date":return{text:`Up to date (${s.version}, ${s.channel}).`,tone:"info"};case"no-release":return{text:`No ${s.channel} release published yet.`,tone:"info"};case"disabled":return{text:`Updates are off: ${s.reason}.`,tone:"error"};case"failed":return{text:`Couldn't check: ${s.message}`,tone:"error"}}}function Gg({workflow:s,isFocused:t,onFocus:n}){const a=s.definitionId!=null;return h.jsx("div",{className:"workflow-item"+(t?" is-focused":""),"data-testid":`workflow-${s.name}`,children:h.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(s.path),"aria-pressed":t,"data-tooltip":t?"Focused agent":"Focus this agent",children:[h.jsx(me,{name:"Zap",size:13}),h.jsx("span",{className:"tree-row-label",children:s.name}),h.jsx("span",{className:"workflow-status","data-deployed":a,"data-testid":`workflow-status-${s.name}`,title:a?"Deployed to Sapiom":"Draft. Not deployed to Sapiom yet.",children:h.jsx(me,{name:a?"Cloud":"CloudOff",size:13})})]})})}const l3=s=>s.split("/").filter(Boolean).pop()??s,c3=(s,t)=>s===t||s.startsWith(`${t}/`);function u3(s,t){const n=t.filter(p=>p.status!=="exited"),a=new Set(s),l=new Map;for(const p of t){const y=l.get(p.cwd);(!y||p.createdAt>y)&&l.set(p.cwd,p.createdAt)}const d=Array.from(l.keys()).sort((p,y)=>{const f=(l.get(y)??"").localeCompare(l.get(p)??"");return f!==0?f:p.localeCompare(y)}),v=p=>{let y=null;for(const f of d)c3(p,f)&&(y===null||f.length>y.length)&&(y=f);return y},c=[];for(const p of d){const y=s.filter(w=>a.has(w)&&v(w.path)===p).sort((w,E)=>w.path.localeCompare(E.path)).map(w=>(a.delete(w),{workflow:w})),f=n.filter(w=>w.boundWorkflowPath==null&&v(w.cwd)===p).sort((w,E)=>E.createdAt.localeCompare(w.createdAt)||w.id.localeCompare(E.id));y.length===0&&f.length===0||c.push({cwd:p,label:l3(p),agents:y,bareSessions:f})}const u=Array.from(a).sort((p,y)=>p.path.localeCompare(y.path)).map(p=>({workflow:p}));return{workspaces:c,orphanAgents:u}}const h3="https://app.sapiom.ai/workflows",d3=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),f3=d3?"⌘K":"Ctrl+K";function p3({label:s,cwd:t,collapsed:n,onToggleCollapsed:a,onCopyPath:l}){return h.jsxs("div",{className:"workspace-row","data-testid":`workspace-group-${s}`,children:[h.jsxs("button",{className:"workspace-row-main",onClick:a,title:t,"aria-expanded":!n,children:[h.jsx(me,{name:"Folder",size:13}),h.jsx("span",{className:"tree-row-label",children:s}),h.jsx("span",{className:"workspace-caret"+(n?"":" is-open"),"aria-hidden":"true",children:h.jsx(me,{name:"ChevronDown",size:13})})]}),h.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${s}`,"data-tooltip":"Copy path",onClick:()=>l(t),children:h.jsx(me,{name:"Copy",size:13})})]})}function v3({label:s,cwd:t,sessionId:n,isFocused:a,onFocus:l,onScaffold:d,onCopyPath:v}){return h.jsxs("div",{className:"workspace-row"+(a?" is-selected":""),"data-testid":`workspace-group-${s}`,children:[h.jsxs("button",{className:"workspace-row-main","data-testid":`workspace-focus-${s}`,"aria-label":`Focus ${s}`,"aria-pressed":a,"data-tooltip":"Folder with sessions, no agent yet. Focus to work in it.",onClick:()=>l(t),children:[h.jsx(me,{name:"Folder",size:13}),h.jsx("span",{className:"tree-row-label",children:s})]}),h.jsx("button",{className:"workspace-row-action","data-testid":`workspace-scaffold-${s}`,"aria-label":`Scaffold an agent in ${s}`,"data-tooltip":"Scaffold an agent here",onClick:()=>d(n),children:h.jsx(me,{name:"Sparkles",size:13})}),h.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${s}`,"data-tooltip":"Copy path",onClick:()=>v(t),children:h.jsx(me,{name:"Copy",size:13})})]})}function Vg({testid:s,harness:t,title:n,meta:a,cwd:l,resumeMode:d,isSelected:v,onOpen:c}){const u=d==="agent-resume"?"true":d==="rehydrate"?"false":"unknown";return h.jsxs("button",{"data-testid":s,className:"session-dropdown-item"+(v?" is-selected":""),"data-resumable":u,title:l,onClick:c,children:[h.jsx("span",{className:"session-item-icon",children:h.jsx(Wo,{kind:t,size:13})}),h.jsxs("span",{className:"session-item-copy",children:[h.jsx("span",{className:"session-item-title",children:n}),h.jsx("span",{className:"session-item-meta",children:a})]})]})}function _3({width:s,minWidth:t,workflows:n,sessions:a,activeSessionId:l,focusedAgentPath:d,onFocusAgent:v,onOpenPalette:c,onConnect:u,onCollapse:p,onSelectSession:y,overviewSelected:f,onSelectOverview:w,onReviewSummary:E,history:A,historyLoading:C,onOpenHistory:b,recentDirs:S,launchDir:_,listDir:g,onCreateSession:T,listHarnesses:R,onScaffoldSession:M,onScaffoldInSession:j,projectRoot:k,onSaveProjectRoot:D,onBrowseTemplates:B,templatesActive:I,onScanWorkflows:q,onToast:$,telemetryOptIn:J,productAnalyticsOptIn:ee,rollingSummary:W,consentSource:G,consentEnvReason:Y,authenticated:O,organizationName:F,onToggleTelemetry:L,onToggleProductAnalytics:P,onToggleRollingSummary:V,onStartAuth:te,onDisconnect:de,settingsOpen:ge,onSetSettingsOpen:K}){const[z,ie]=U.useState(null),Q=U.useRef(null),[we,fe]=U.useState(!1),[Le,ze]=U.useState("have"),We=U.useCallback(()=>fe(!1),[]),[Ge,De]=U.useState(!1),dt=U.useRef(null),At=U.useCallback(()=>De(!1),[]),[qt,jt]=U.useState(()=>new Set(Mi().collapsedCwds??[])),Nt=Ee=>{jt(Ue=>{const Lt=new Set(Ue);return Lt.has(Ee)?Lt.delete(Ee):Lt.add(Ee),Lt})};U.useEffect(()=>{la({collapsedCwds:Array.from(qt)})},[qt]);const ct=a.filter(Ee=>Ee.status==="exited"),ut=()=>{const Ee=!Ge;if(Ee&&fe(!1),De(Ee),Ee){const Ue=Sy(a,S,l);Ue.length>0&&b(Ue)}},es=new Set(a.map(Ee=>Ee.id)),Yt=new Set(a.map(Ee=>Ee.agentSessionId).filter(Ee=>Ee!=null)),ts=A.filter(Ee=>!(Ee.harnessSessionId!=null&&es.has(Ee.harnessSessionId))&&!Yt.has(Ee.agentSessionId)),ot=[...ct.map(Ee=>({kind:"exited",at:Ee.lastActiveAt,session:Ee})),...ts.map(Ee=>({kind:"summary",at:Ee.lastActiveAt,summary:Ee}))].sort((Ee,Ue)=>Ue.at.localeCompare(Ee.at)),Xt=new Map(A.map(Ee=>[Ee.agentSessionId,Ee])),{workspaces:Wt,orphanAgents:ss}=u3(n,a),nt=Ee=>{var Ue;(Ue=navigator.clipboard)==null||Ue.writeText(Ee).then(()=>$("Path copied.")).catch(()=>$("Couldn't copy the path."))};return h.jsxs("aside",{className:"rail rail-workflows",style:{width:s,minWidth:t},children:[h.jsx(Jk,{onCollapse:p}),h.jsx("div",{className:"rail-search",children:h.jsxs("button",{className:"palette-trigger","data-testid":"palette-trigger","aria-label":"Jump to session, workflow, or path",onClick:c,children:[h.jsx(me,{name:"Search",size:13}),h.jsx("span",{className:"palette-trigger-text",children:"Jump to…"}),h.jsx("span",{className:"palette-trigger-hint",children:f3})]})}),h.jsxs("button",{type:"button",className:"rail-nav-row"+(I?" is-selected":""),"data-testid":"rail-templates","aria-current":I?"page":void 0,onClick:B,children:[h.jsx(me,{name:"LayoutTemplate",size:14}),h.jsx("span",{children:"Templates"})]}),h.jsxs("div",{className:"rail-header",children:["Workspaces",h.jsxs("div",{className:"rail-header-actions",children:[h.jsxs("button",{ref:dt,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Sessions and history",title:"Sessions and history",onClick:ut,children:[h.jsx(me,{name:"History",size:14}),ct.length>0&&h.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:ct.length})]}),h.jsx("button",{ref:Q,className:"theme-toggle rail-header-btn","data-testid":"add-workspace","aria-label":"Add workspace","aria-expanded":we,title:"Add a workspace: a folder containing an agent project (sapiom.json). Its agent appears in the rail.",onClick:()=>{De(!1),fe(Ee=>!Ee)},children:h.jsx(me,{name:"Plus",size:14})})]})]}),h.jsxs("div",{className:"rail-tree",children:[h.jsxs(cn,{open:we,anchorRef:Q,onDismiss:We,placement:"right-start",className:"connect-card add-card",testid:"add-menu",children:[h.jsxs("div",{className:"connect-card-header",children:[h.jsx("span",{children:"Add"}),h.jsx("button",{className:"theme-toggle connect-card-close",onClick:We,"aria-label":"Close",title:"Close",children:h.jsx(me,{name:"X",size:13})})]}),h.jsx("div",{className:"connect-card-body",children:h.jsx(Iy,{leading:h.jsx(zy,{icon:"Plus",title:"New session…",sub:"Start an agent in a folder",testid:"new-session-btn",onClick:()=>{fe(!1),ie("session")}}),onPick:Ee=>{if(fe(!1),Ee==="template"){B();return}ze(Ee),ie("workspace")}})})]}),h.jsxs(cn,{open:Ge,anchorRef:dt,onDismiss:At,placement:"down-end",className:"connect-card history-card",testid:"history-menu",children:[h.jsxs("div",{className:"connect-card-header",children:[h.jsx("span",{children:"Sessions"}),h.jsx("button",{className:"theme-toggle connect-card-close",onClick:At,"aria-label":"Close",title:"Close",children:h.jsx(me,{name:"X",size:13})})]}),h.jsxs("div",{className:"connect-card-body history-card-body",children:[h.jsx("div",{className:"session-dropdown-section",children:"Past sessions"}),ot.map(Ee=>{if(Ee.kind==="exited"){const Ue=Ee.session.agentSessionId==null?void 0:Xt.get(Ee.session.agentSessionId),Lt=Ee.session.agentSessionId==null?"rehydrate":Ue==null?void 0:Ue.resumeMode;return h.jsx(Vg,{testid:`exited-session-${Ee.session.id}`,harness:Ee.session.harness,title:Ee.session.title,meta:af({...Ee.session,gitBranch:Ue==null?void 0:Ue.gitBranch,turnCount:Ue==null?void 0:Ue.turnCount,messageCount:Ue==null?void 0:Ue.messageCount},void 0,{includeHarness:!1,state:Rg({resumeMode:Lt,turnCount:Ue==null?void 0:Ue.turnCount})}),cwd:Ee.session.cwd,resumeMode:Lt,isSelected:Ee.session.id===l,onOpen:()=>{y(Ee.session.id),De(!1)}},Ee.session.id)}return h.jsx(Vg,{testid:`history-${Ee.summary.agentSessionId}`,harness:Ee.summary.harness,title:Ee.summary.title,meta:af(Ee.summary,void 0,{includeHarness:!1,state:Rg(Ee.summary)}),cwd:Ee.summary.cwd,resumeMode:Ee.summary.resumeMode,isSelected:!1,onOpen:()=>{E(Ee.summary),De(!1)}},Ee.summary.agentSessionId)}),C&&h.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!C&&ot.length===0&&h.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]}),h.jsxs("div",{className:"rail-list",children:[Wt.length===0&&ss.length===0&&h.jsx(fi,{className:"rail-empty",icon:"Folder",title:"No agents yet",body:"Open a workspace folder to start a session, or add one. Agents (sapiom.json) appear here automatically."}),Wt.map(Ee=>{const Ue=qt.has(Ee.cwd);if(Ee.agents.length===0&&Ee.bareSessions.length>0){const mt=Ee.bareSessions[0];return h.jsx("div",{className:"workspace-group",children:h.jsx(v3,{label:Ee.label,cwd:Ee.cwd,sessionId:mt.id,isFocused:Ee.cwd===d,onFocus:v,onScaffold:j,onCopyPath:nt})},Ee.cwd)}return h.jsxs("div",{className:"workspace-group",children:[h.jsx(p3,{label:Ee.label,cwd:Ee.cwd,collapsed:Ue,onToggleCollapsed:()=>Nt(Ee.cwd),onCopyPath:nt}),!Ue&&Ee.agents.map(mt=>h.jsx(Gg,{workflow:mt.workflow,isFocused:mt.workflow.path===d,onFocus:v},mt.workflow.path))]},Ee.cwd)}),ss.length>0&&h.jsxs("div",{className:"workspace-group",children:[h.jsx("div",{className:"workspace-row",children:h.jsxs("div",{className:"workspace-row-main workspace-row-static","data-tooltip":"Agents that live outside any session folder. Focus one to start a session in its own folder.",children:[h.jsx(me,{name:"Folder",size:13}),h.jsx("span",{className:"tree-row-label",children:"No workspace"})]})}),ss.map(Ee=>h.jsx(Gg,{workflow:Ee.workflow,isFocused:Ee.workflow.path===d,onFocus:v},Ee.workflow.path))]})]})]}),h.jsx("div",{className:"rail-footer",children:h.jsx(m3,{onToast:$,authenticated:O,organizationName:F,telemetryOptIn:J,productAnalyticsOptIn:ee,rollingSummary:W,consentSource:G,consentEnvReason:Y,onToggleTelemetry:L,onToggleProductAnalytics:P,onToggleRollingSummary:V,onStartAuth:te,onDisconnect:de,settingsOpen:ge,onSetSettingsOpen:K,overviewSelected:f,onSelectOverview:w})}),z==="workspace"&&h.jsx(Hy,{recentDirs:S,projectRoot:k,listDir:g,onClose:()=>ie(null),onConnect:async Ee=>{await u(Ee)},onScan:q,onScaffold:M,onSaveProjectRoot:D,listHarnesses:R,onBrowseTemplates:()=>{ie(null),B()},triggerRef:Q,initialDoor:Le}),z==="session"&&h.jsx(i3,{recentDirs:S,launchDir:_,listDir:g,onClose:()=>ie(null),onCreate:T,listHarnesses:R,triggerRef:dt})]})}function m3({authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:a,rollingSummary:l,consentSource:d,consentEnvReason:v,onToggleTelemetry:c,onToggleProductAnalytics:u,onToggleRollingSummary:p,onStartAuth:y,onDisconnect:f,settingsOpen:w,onSetSettingsOpen:E,overviewSelected:A,onSelectOverview:C,onToast:b}){const[S,_]=U.useState(!1),[g,T]=U.useState({status:"idle"}),R=U.useRef(null),M=U.useCallback(()=>_(!1),[]),j=U.useCallback(()=>E(!1),[E]),k=uy(),D=g.status==="pending",B=a3(),[I,q]=U.useState(!1),$=async()=>{if(!(!B||I)){q(!0),M();try{b(o3(await B.checkForUpdates()).text)}catch{b("Couldn't check for updates.")}finally{q(!1)}}};s&&g.status==="pending"&&T({status:"idle"});const J=D?"Connecting…":s?t??"Signed in":"Not signed in",ee=D?"opening browser":s?"Sapiom account":"connect to get started",W=(t??"S").charAt(0).toUpperCase(),G=async()=>{M(),T({status:"pending"});try{await y()}catch(Y){const O=Y instanceof Error?Y.message:"Could not start sign-in. Try again.";T({status:"error",message:O})}};return h.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[h.jsxs("button",{ref:R,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":S,title:"Account",onClick:()=>_(Y=>!Y),children:[h.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:W}),h.jsxs("span",{className:"rail-profile-copy",children:[h.jsx("span",{className:"rail-profile-name",children:J}),h.jsx("span",{className:"rail-profile-meta",children:ee})]}),h.jsx("span",{className:"identity-dot","data-authenticated":s,"data-pending":D}),h.jsx(me,{name:"ChevronDown",size:13})]}),h.jsx(cn,{open:w,anchorRef:R,onDismiss:j,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:h.jsx(n3,{authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:a,rollingSummary:l,consentSource:d,consentEnvReason:v,onToggleTelemetry:c,onToggleProductAnalytics:u,onToggleRollingSummary:p,onStartAuth:y,onDisconnect:f})}),h.jsxs(cn,{open:S,anchorRef:R,onDismiss:M,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[h.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(A?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{C(),M()},children:[h.jsx(me,{name:"Info",size:13}),"Overview"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(h3,"_blank","noopener,noreferrer"),M()},children:[h.jsx(me,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{E(!0),M()},children:[h.jsx(me,{name:"Settings",size:13}),"Settings"]}),B&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-check-updates",disabled:I,onClick:()=>void $(),children:[h.jsx(me,{name:I?"Loader":"RefreshCw",size:13}),I?"Checking…":"Check for updates"]}),!s&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:D,onClick:()=>void G(),children:[h.jsx(me,{name:"Plug",size:13}),D?"Connecting…":"Connect account"]}),s&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{f(),M()},children:[h.jsx(me,{name:"LogOut",size:13}),"Disconnect"]}),k,g.status==="error"&&h.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:g.message})]})]})}const g3=new Set([401,403]);function y3(s){return s?s.networkError===!0||s.status===void 0:!1}function b3(s){return(s==null?void 0:s.status)!==void 0&&g3.has(s.status)}function S3(s){const{online:t,error:n}=s;return!t||y3(n)?"offline":b3(n)?"auth":n?"error":"online"}function Yg(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function w3(){const[s,t]=U.useState(Yg);return U.useEffect(()=>{const n=()=>t(Yg());return window.addEventListener("online",n),window.addEventListener("offline",n),n(),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",n)}},[]),s}var ce=typeof window<"u"?window:void 0,xs=typeof globalThis<"u"?globalThis:ce,Ms=xs==null?void 0:xs.navigator,Re=xs==null?void 0:xs.document,Qt=xs==null?void 0:xs.location,ip=xs==null?void 0:xs.fetch,of=xs!=null&&xs.XMLHttpRequest&&"withCredentials"in new xs.XMLHttpRequest?xs.XMLHttpRequest:void 0,Xg=xs==null?void 0:xs.AbortController,x3=xs==null?void 0:xs.CompressionStream,$s=Ms==null?void 0:Ms.userAgent;function $y(){return!(!ce||ce.navigator.onLine===!1)}var ho=typeof globalThis<"u"?globalThis:ce;ho&&typeof self>"u"&&(ho.self=ho),ho&&typeof File>"u"&&(ho.File=function(){});var Ie=ce??{},gt={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function Kg(s,t,n,a,l,d,v){try{var c=s[d](v),u=c.value}catch(p){return void n(p)}c.done?t(u):Promise.resolve(u).then(a,l)}function zt(s){return function(){var t=this,n=arguments;return new Promise((function(a,l){var d=s.apply(t,n);function v(u){Kg(d,a,l,v,c,"next",u)}function c(u){Kg(d,a,l,v,c,"throw",u)}v(void 0)}))}}function be(){return be=Object.assign?Object.assign.bind():function(s){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(s[a]=n[a])}return s},be.apply(null,arguments)}function Py(s,t){if(s==null)return{};var n={};for(var a in s)if({}.hasOwnProperty.call(s,a)){if(t.indexOf(a)!==-1)continue;n[a]=s[a]}return n}var Jg=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}};function Zg(s){return typeof s=="string"||s}function Qg(s){return typeof s=="string"?s:void 0}var fo,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"],sn=(function(s){return s.AnonymousId="anonymous_id",s.DistinctId="distinct_id",s.Props="props",s.EnablePersonProcessing="enable_person_processing",s.PersonMode="person_mode",s.FeatureFlagDetails="feature_flag_details",s.FeatureFlags="feature_flags",s.FeatureFlagPayloads="feature_flag_payloads",s.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",s.BootstrapFeatureFlags="bootstrap_feature_flags",s.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",s.OverrideFeatureFlags="override_feature_flags",s.Queue="queue",s.AiQueue="ai_queue",s.LogsQueue="logs_queue",s.OptedOut="opted_out",s.SessionId="session_id",s.SessionStartTimestamp="session_start_timestamp",s.SessionLastTimestamp="session_timestamp",s.PersonProperties="person_properties",s.GroupProperties="group_properties",s.InstalledAppBuild="installed_app_build",s.InstalledAppVersion="installed_app_version",s.SessionReplay="session_replay",s.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",s.SurveyLastSeenDate="survey_last_seen_date",s.SurveysSeen="surveys_seen",s.Surveys="surveys",s.RemoteConfig="remote_config",s.FlagsEndpointWasHit="flags_endpoint_was_hit",s.DeviceId="device_id",s})({}),e0=(function(s){return s.GZipJS="gzip-js",s.Base64="base64",s})({}),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"],Uy="NativeGzipValidationError",lf=s=>s.length>=2&&s[0]===31&&s[1]===139,t0=(s,t)=>s===e0.GZipJS||t===e0.GZipJS||t==="gzip",s0=s=>!(!s||typeof s!="object")&&("name"in s?String(s.name):"")==="NotReadableError",rc=s=>{var t=new Error("Native gzip produced invalid output: "+s);throw t.name=Uy,t},T3=(function(){var s=zt((function*(t,n){18>t.size&&rc("too-short");var a=new Uint8Array(yield t.slice(0,10).arrayBuffer());lf(a)&&a[2]===8||rc("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(v=>{for(var c=(()=>{if(fo)return fo;fo=[];for(var y=0;256>y;y++){for(var f=y,w=0;8>w;w++)f=1&f?3988292384^f>>>1:f>>>1;fo[y]=f>>>0}return fo})(),u=4294967295,p=0;v.length>p;p++)u=c[255&(u^v[p])]^u>>>8;return(4294967295^u)>>>0})(n)&&rc("invalid-crc");var d=n.length>>>0;l.getUint32(4,!0)!==d&&rc("invalid-size")}));return function(t,n){return s.apply(this,arguments)}})();function cf(){return cf=zt((function*(s,t,n){t===void 0&&(t=!0);try{var a=new TextEncoder().encode(s),l=new globalThis.CompressionStream("gzip"),d=l.writable.getWriter(),v=d.write(a).then((()=>d.close())).catch((function(){var p=zt((function*(y){try{yield d.abort(y)}catch{}throw y}));return function(y){return p.apply(this,arguments)}})()),c=new Response(l.readable).blob(),u=(yield Promise.all([c,v]))[0];return yield T3(u,a),u}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),cf.apply(this,arguments)}var A3=["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"],i0=function(s,t){if(t===void 0&&(t=[]),!s)return!1;var n=s.toLowerCase();return A3.concat(t).some((a=>{var l=a.toLowerCase();return n.indexOf(l)!==-1}))};function Fe(s,t){return s.indexOf(t)!==-1}var eu=function(s){return s.trim()},uf=function(s){return s.replace(/^\$/,"")};function Fy(s){var t,n=[];return(t=JSON.stringify(s,(function(a,l){if(typeof l=="bigint")return l.toString();if(typeof l!="function"&&typeof l!="symbol"){if(l instanceof Error)return{name:l.name,message:l.message,stack:l.stack};if(l&&typeof l=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(l))return"[Circular]";n.push(l)}return l}})))!==null&&t!==void 0?t:"null"}var qy=Object.prototype,Wy=qy.hasOwnProperty,tu=qy.toString,Ve=Array.isArray||function(s){return tu.call(s)==="[object Array]"},Js=s=>typeof s=="function",Ht=s=>s===Object(s)&&!Ve(s),Bn=s=>{if(Ht(s)){for(var t in s)if(Wy.call(s,t))return!1;return!0}return!1},ke=s=>s===void 0,kt=s=>tu.call(s)=="[object String]",hf=s=>kt(s)&&s.trim().length===0,Ds=s=>s===null,Xe=s=>ke(s)||Ds(s),ys=s=>tu.call(s)=="[object Number]"&&s==s,en=s=>ys(s)&&s>0,xi=s=>tu.call(s)==="[object Boolean]",R3=s=>s instanceof FormData,M3=s=>Fe(E3,s),D3=s=>Fe(k3,s);function Gy(s){return s===null||typeof s!="object"}function kc(s,t){return{}.toString.call(s)==="[object "+t+"]"}function np(s){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(s,Event)}var j3=[!0,"true",1,"1","yes"],kd=s=>Fe(j3,s),N3=[!1,"false",0,"0","no"];function Di(s,t,n,a,l){return t>n&&(a.warn("min cannot be greater than max."),t=n),ys(s)?s>n?(a.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>s?(a.warn(" cannot be less than min: "+t+". Using min value instead."),t):s:(a.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),Di(l||n,t,n,a))}class L3{constructor(t){this.tt={},this.et=t.et,this.rt=Di(t.bucketSize,0,100,t.it),this.nt=Di(t.refillRate,0,this.rt,t.it),this.st=Di(t.refillInterval,0,864e5,t.it)}ot(t,n){var a=Math.floor((n-t.lastAccess)/this.st);a>0&&(t.tokens=Math.min(t.tokens+a*this.nt,this.rt),t.lastAccess=t.lastAccess+a*this.st)}consumeRateLimit(t){var n,a=Date.now(),l=String(t),d=this.tt[l];return d?this.ot(d,a):this.tt[l]=d={tokens:this.rt,lastAccess:a},d.tokens===0||(d.tokens--,d.tokens===0&&((n=this.et)==null||n.call(this,t)),d.tokens===0)}stop(){this.tt={}}}var Qs="Mobile",Tc="iOS",ln="Android",da="Tablet",Vy=ln+" "+da,Yy="iPad",Xy="Apple",Ky=Xy+" Watch",Ao="Safari",fa="BlackBerry",Jy="Samsung",Zy=Jy+"Browser",Qy=Jy+" Internet",pr="Chrome",O3=pr+" OS",eb=pr+" "+Tc,rp="Internet Explorer",tb=rp+" "+Qs,ap="Opera",B3=ap+" Mini",op="Edge",sb="Microsoft "+op,ua="Firefox",ib=ua+" "+Tc,zo="Nintendo",Io="PlayStation",ha="Xbox",nb=ln+" "+Qs,rb=Qs+" "+Ao,wo="Windows",df=wo+" Phone",n0="Nokia",ff="Ouya",ab="Generic",H3=ab+" "+Qs.toLowerCase(),ob=ab+" "+da.toLowerCase(),pf="Konqueror",lb="Oculus Browser",Ac="Vivaldi",cb="Yandex",Rc="Whale",vf="DuckDuckGo",ub="Pale Moon",Mc="Waterfox",Ro="Brave",hb="Google Search App",Ut="(\\d+(\\.\\d+)?)",Td=new RegExp("Version/"+Ut),z3=new RegExp(ha,"i"),I3=new RegExp(Io+" \\w+","i"),$3=new RegExp(zo+" \\w+","i"),lp=new RegExp(fa+"|PlayBook|BB10","i"),P3={"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"},db=function(s,t,n,a){t=t||"";var l=(function(d){return d!=null&&d.brave?Ro:null})(n);return l||(a!=null&&a.detectGoogleSearchApp&&Fe(s,"GSA/")?hb:Fe(s," OPR/")&&Fe(s,"Mini")?B3:Fe(s," OPR/")?ap:lp.test(s)?fa:Fe(s,"IE"+Qs)||Fe(s,"WPDesktop")?tb:Fe(s,"OculusBrowser")?lb:Fe(s,Zy)?Qy:Fe(s,op)||Fe(s,"Edg/")?sb:Fe(s,Ac+"/")?Ac:Fe(s,"YaBrowser/")?cb:Fe(s,Rc+"/")?Rc:Fe(s,vf+"/")||Fe(s,"Ddg/")?vf:Fe(s,"FBIOS")?"Facebook "+Qs:Fe(s,"UCWEB")||Fe(s,"UCBrowser")?"UC Browser":Fe(s,"CriOS")?eb:Fe(s,"CrMo")||Fe(s,pr)?pr:Fe(s,ln)&&Fe(s,Ao)?nb:Fe(s,"FxiOS")?ib:Fe(s.toLowerCase(),pf.toLowerCase())?pf:Fe(s,Ro+"/")?Ro:((d,v)=>v&&Fe(v,Xy)||(function(c){return Fe(c,Ao)&&!Fe(c,pr)&&!Fe(c,ln)})(d))(s,t)?Fe(s,Qs)?rb:Ao:Fe(s,"PaleMoon/")?ub:Fe(s,Mc+"/")?Mc:Fe(s,ua)?ua:Fe(s,"MSIE")||Fe(s,"Trident/")?rp:Fe(s,"Gecko")?ua:"")},U3={[tb]:[new RegExp("rv:"+Ut)],[sb]:[new RegExp(op+"?\\/"+Ut)],[pr]:[new RegExp("("+pr+"|CrMo)\\/"+Ut)],[eb]:[new RegExp("CriOS\\/"+Ut)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ut)],[Ao]:[Td],[rb]:[Td],[ap]:[new RegExp("(Opera|OPR)\\/"+Ut)],[ua]:[new RegExp(ua+"\\/"+Ut)],[ib]:[new RegExp("FxiOS\\/"+Ut)],[pf]:[new RegExp("Konqueror[:/]?"+Ut,"i")],[fa]:[new RegExp(fa+" "+Ut),Td],[nb]:[new RegExp("android\\s"+Ut,"i")],[Qy]:[new RegExp(Zy+"\\/"+Ut)],[lb]:[new RegExp("OculusBrowser\\/"+Ut)],[Ac]:[new RegExp(Ac+"\\/"+Ut)],[cb]:[new RegExp("YaBrowser\\/"+Ut)],[Rc]:[new RegExp(Rc+"\\/"+Ut)],[Ro]:[new RegExp(Ro+"\\/"+Ut)],[vf]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ut)],[ub]:[new RegExp("PaleMoon\\/"+Ut)],[Mc]:[new RegExp(Mc+"\\/"+Ut)],[hb]:[new RegExp("GSA\\/"+Ut)],[rp]:[new RegExp("(rv:|MSIE )"+Ut)],Mozilla:[new RegExp("rv:"+Ut)]},F3=function(s,t,n,a){var l=db(s,t,n,a),d=U3[l];if(ke(d))return null;for(var v=0;d.length>v;v++){var c=s.match(d[v]);if(c)return parseFloat(c[c.length-2])}return null},r0=[[new RegExp(ha+"; "+ha+" (.*?)[);]","i"),s=>[ha,s&&s[1]||""]],[new RegExp(zo,"i"),[zo,""]],[new RegExp(Io,"i"),[Io,""]],[lp,[fa,""]],[new RegExp(wo,"i"),(s,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[df,""];if(new RegExp(Qs).test(t)&&!/IEMobile\b/.test(t))return[wo+" "+Qs,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var a=P3[n[1]]||"";return/arm/i.test(t)&&(a="RT"),[wo,a]}return[wo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,s=>s&&s[3]?[Tc,[s[3],s[4],s[5]||"0"].join(".")]:[Tc,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,s=>{var t="";return s&&s.length>=3&&(t=ke(s[2])?s[3]:s[2]),["watchOS",t]}],[new RegExp("("+ln+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ln+")","i"),s=>s&&s[2]?[ln,[s[2],s[3],s[4]||"0"].join(".")]:[ln,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,s=>{var t=["Mac OS X",""];return s&&s[1]&&(t[1]=[s[1],s[2],s[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[O3,""]],[/Linux|debian/i,["Linux",""]]],a0=function(s){return $3.test(s)?zo:I3.test(s)?Io:z3.test(s)?ha:new RegExp(ff,"i").test(s)?ff:new RegExp("("+df+"|WPDesktop)","i").test(s)?df:/iPad/.test(s)?Yy:/iPod/.test(s)?"iPod Touch":/iPhone/.test(s)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(s)?Ky:lp.test(s)?fa:/(kobo)\s(ereader|touch)/i.test(s)?"Kobo":new RegExp(n0,"i").test(s)?n0:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(s)||/(kf[a-z]+)( bui|\)).+silk\//i.test(s)?"Kindle Fire":/(Android|ZTE)/i.test(s)?new RegExp(Qs).test(s)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(s)||/pixel[\daxl ]{1,6}/i.test(s)&&!/pixel c/i.test(s)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(s)||/lmy47v/i.test(s)&&!/QTAQZ3/i.test(s)?ln:Vy:new RegExp("(pda|"+Qs+")","i").test(s)?H3:new RegExp(da,"i").test(s)&&!new RegExp(da+" pc","i").test(s)?ob:""},q3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function o0(s,t){return typeof(n=s)=="string"&&q3.test(n)?s:t();var n}function Hn(s){return s&&s.split("#")[0]}function yc(s,t){var n=setTimeout(s,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var W3=s=>s instanceof Error,fb={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=fb.info;function pb(s){if(xi(s))return{boolValue:s};if(typeof s=="number")return Number.isFinite(s)?Number.isInteger(s)?{intValue:s}:{doubleValue:s}:{stringValue:String(s)};if(typeof s=="string")return{stringValue:s};if(Ve(s))return{arrayValue:{values:s.map((t=>pb(t)))}};try{return{stringValue:JSON.stringify(s)}}catch{return{stringValue:String(s)}}}function Dc(s){var t=[];for(var n in s){var a=s[n];Ds(a)||ke(a)||t.push({key:n,value:pb(a)})}return t}function V3(s,t){var n=fb[s.level||"info"]||G3,a=n.text,l=n.number,d=String(Date.now())+"000000",v={};t.distinctId&&(v.posthogDistinctId=t.distinctId),t.sessionId&&(v.sessionId=t.sessionId),t.windowId&&(v["window.id"]=t.windowId),Xe(t.sessionStartTimestamp)||(v.sessionStartTimestamp=String(t.sessionStartTimestamp)),Xe(t.lastActivityTimestamp)||(v.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(v["url.full"]=t.currentUrl),t.screenName&&(v["screen.name"]=t.screenName),t.appState&&(v["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(v.feature_flags=t.activeFeatureFlags);var c=be({},v,s.attributes||{}),u={timeUnixNano:d,observedTimeUnixNano:d,severityNumber:l,severityText:a,body:{stringValue:s.body},attributes:Dc(c)};return s.trace_id&&(u.traceId=s.trace_id),s.span_id&&(u.spanId=s.span_id),ke(s.trace_flags)||(u.flags=s.trace_flags),u}function vb(s,t,n){return be({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function _b(s,t,n,a){return{resourceLogs:[{resource:{attributes:Dc(t)},scopeLogs:[{scope:{name:n,version:a},logRecords:s}]}]}}let Y3=class{constructor(s,t,n,a,l,d,v){var c;d===void 0&&(d=()=>Promise.resolve()),this._instance=s,this.Te=t,this.it=n,this.ut=a,this.ht=l,this.dt=d,this.ct=v,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((c=t.maxQueueSize)!==null&&c!==void 0?c: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(s){if(!this._instance.isDisabled&&!this._instance.optedOut&&s!=null&&s.body){var t=this.Rt(s);if(t!==null)if(t.body){if(this.Pt()){var n={record:V3(t,this.ut())};this.ht((()=>this.Ot(n)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(s){var t=this.Te.beforeSend;if(!t)return s;var n=Ve(t)?t:[t],a=s;for(var l of n)try{var d=l(a);if(!d)return this.it.info("Log was rejected in beforeSend function"),null;a=d}catch(v){return this.it.error("Error in beforeSend function for log:",v),null}return a}Pt(){if(this.It===void 0)return!0;var s=Date.now(),t=s-this.bt;return this.Mt>t&&t>=0||(this.bt=s,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 s=this;return zt((function*(){if(!s._instance.isDisabled)return s.vt||(s.vt=s.Ft().finally((()=>{s.vt=null}))),s.vt}))()}Ft(){var s=this;return zt((function*(){var t;s.Tt();var n=(t=s._instance.getPersistedProperty(sn.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var a=n.length,l=0;n.length>0&&a>l;){var d,v;s.ft=0;var c=Math.min(n.length,s.Ct),u=n.slice(0,c),p=_b(u.map((f=>f.record)),s.At(),(d=s.ct)!==null&&d!==void 0?d:s._instance.getLibraryId(),s._instance.getLibraryVersion()),y=yield s._instance.$t(p);if(y.kind==="too-large"&&u.length>1)s.Ct=Math.max(1,Math.floor(u.length/2)),s.it.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+s.Ct);else if(y.kind==="retry-later"||(y.kind==="too-large"?s.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."):y.kind==="ok"&&s.Te.maxBatchRecordsPerPost>s.Ct&&(s.Ct=Math.min(s.Te.maxBatchRecordsPerPost,s.Ct+1)),yield s.Lt(u.length),n=(v=s._instance.getPersistedProperty(sn.LogsQueue))!==null&&v!==void 0?v:[],l+=u.length,y.kind==="fatal"))throw y.error}}))()}Lt(s){var t=this;return zt((function*(){var n,a=Math.max(0,s-t.ft),l=(n=t._instance.getPersistedProperty(sn.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(sn.LogsQueue,l.slice(a)),yield t.dt()}))()}At(){return vb(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(s){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(sn.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(s),this._instance.setPersistedProperty(sn.LogsQueue,n),this.xt>n.length?this.Dt():this.Et()}}Dt(s){s===void 0&&(s=this.St),this.Nt||(this.Nt=yc((()=>{this.Nt=void 0,this.Et()}),s))}qt(){var s=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,s)}jt(){var s=this._instance.getPersistedProperty(sn.LogsQueue);return!!s&&s.length>0}shutdown(s){var t=this;return zt((function*(){t.Tt();var n=t.flush().catch((()=>{}));s!==void 0?yield Promise.race([n,new Promise((a=>yc(a,s)))]):yield n}))()}flushWithTimeout(s){var t=this;return zt((function*(){var n=!1,a=t.flush(),l=new Promise((d=>yc((()=>{n=!0,d()}),s)));try{yield Promise.race([a,l])}finally{n&&a.catch((()=>{}))}}))()}Et(){this.flush().then((()=>{this.yt=0}),(s=>{this.yt++,this.it.error("PostHog logs flush failed:",s)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())}))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Ad=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function l0(s){return String(s)+"000000"}function c0(s,t,n,a){var l="";return a&&(l=Object.keys(a).sort().map((d=>JSON.stringify(d)+":"+JSON.stringify(a[d]))).join(",")),s+"\0"+t+"\0"+(n??"")+"\0"+l}let X3=class{constructor(s,t,n){this._instance=s,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(s,t,n){t===void 0&&(t=1),this.Wt({name:s,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(s,t,n){this.Wt({name:s,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(s,t,n){this.Wt({name:s,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var s=this,t=this.vt,n=(function(){var l=zt((function*(){t&&(yield t.catch((()=>{}))),yield s.Zt()}));return function(){return l.apply(this,arguments)}})(),a=n().finally((()=>{this.vt===a&&(this.vt=null)}));return this.vt=a,a}drainWindow(){if(this.Bt.size===0)return null;var s=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(s)}reset(){this.Vt++,this.Tt(),this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Wt(s){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(s);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,a;try{n=t.attributes?be({},t.attributes):void 0,a=c0(t.type,t.name,t.unit,n)}catch(v){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",v)}var l=this.Bt.get(a);if(!l){if(!this.Qt())return;l={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(a,l)}var d=this.Ut.get(t.name);d===void 0?this.Ut.set(t.name,t.type):d===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+d+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(l,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(s,t){var n;switch(s.type){case"count":s.total=((n=s.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":s.last=t;break;case"histogram":s.hist||(s.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Ad.length+1).fill(0)});var a=s.hist;a.count+=1,a.sum+=t,a.min=Math.min(a.min,t),a.max=Math.max(a.max,t),a.bucketCounts[(function(l,d){for(var v=0;d.length>v;v++)if(d[v]>=l)return v;return d.length})(t,Ad)]+=1}}Rt(s){var t=this.Te.beforeSend;if(!t)return s;var n=Ve(t)?t:[t],a=s;for(var l of n)try{var d=l(a);if(!d)return this.it.info("Metric was rejected in beforeSend function"),null;a=d}catch(v){return this.it.error("Error in beforeSend function for metric:",v),null}return a}Dt(){this.Nt||(this.Nt=yc((()=>{this.Nt=void 0,this.flush().catch((s=>{this.it.error("Metrics flush failed:",s)}))}),this.Te.flushIntervalMs))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var s=this;return zt((function*(){if(s.Bt.size!==0){var t=s.Bt;s.Bt=new Map,s.Ht=!1,s.Ut=new Map,s.zt=new Set;var n=s.Vt,a=yield s._instance.Kt(s.Gt(t));if(n===s.Vt)switch(a.kind){case"ok":return;case"retry-later":return s.Yt(t),void s.Dt();case"too-large":return void s.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void s.it.error("Failed to send metrics batch:",a.error)}}}))()}Gt(s){return t=this.Xt(s),n=(function(d,v,c){return be({},d.resourceAttributes,{"service.name":d.serviceName||"unknown_service"},d.environment&&{"deployment.environment":d.environment},d.serviceVersion&&{"service.version":d.serviceVersion},{"telemetry.sdk.name":v,"telemetry.sdk.version":c})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),a=this._instance.getLibraryId(),l=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Dc(n)},scopeMetrics:[{scope:{name:a,version:l},metrics:t}]}]};var t,n,a,l}Xt(s){var t=l0(Date.now()),n=new Map;for(var a of s.values()){var l,d=c0(a.type,a.name,a.unit,void 0),v=n.get(d);v||(v=be({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?v.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?v.gauge={dataPoints:[]}:v.histogram={aggregationTemporality:1,dataPoints:[]},n.set(d,v));var c=Dc((l=a.attributes)!==null&&l!==void 0?l:{}),u=l0(a.windowStartMs);if(a.type==="count"){var p,y={attributes:c,startTimeUnixNano:u,timeUnixNano:t,asDouble:(p=a.total)!==null&&p!==void 0?p:0};v.sum.dataPoints.push(y)}else if(a.type==="gauge"){var f,w={attributes:c,timeUnixNano:t,asDouble:(f=a.last)!==null&&f!==void 0?f:0};v.gauge.dataPoints.push(w)}else a.hist&&v.histogram.dataPoints.push({attributes:c,startTimeUnixNano:u,timeUnixNano:t,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:Ad})}return Array.from(n.values())}Yt(s){var t,n;for(var a of s){var l=a[0],d=a[1],v=this.Bt.get(l);if(v)switch(v.windowStartMs=Math.min(v.windowStartMs,d.windowStartMs),v.type){case"count":v.total=((t=v.total)!==null&&t!==void 0?t:0)+((n=d.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(d.hist)if(v.hist){v.hist.count+=d.hist.count,v.hist.sum+=d.hist.sum,v.hist.min=Math.min(v.hist.min,d.hist.min),v.hist.max=Math.max(v.hist.max,d.hist.max);for(var c=0;v.hist.bucketCounts.length>c;c++)v.hist.bucketCounts[c]+=d.hist.bucketCounts[c]}else v.hist=d.hist}else this.Qt()&&this.Bt.set(l,d)}}};var ac,u0,Rd;function K3(s){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Rd&&n.length===u0||(u0=n.length,Rd=n.reduce(((a,l)=>{ac||(ac={});var d=ac[l];if(d)a[d[0]]=d[1];else for(var v=s(l),c=v.length-1;c>=0;c--){var u=v[c],p=u==null?void 0:u.filename,y=t[l];if(p&&y){a[p]=y,ac[l]=[p,y];break}}return a}),{})),Rd}}class J3{constructor(t,n,a){a===void 0&&(a=[]),this.coercers=t,this.stackParser=n,this.modifiers=a}buildFromUnknown(t,n){n===void 0&&(n={});var a=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(a,n,0).apply(t),d=this.buildParsingContext(n),v=this.parseStacktrace(l,d);return{$exception_list:this.convertToExceptionList(v,a),$exception_level:"error"}}modifyFrames(t){var n=this;return zt((function*(){for(var a of t)a.stacktrace&&a.stacktrace.frames&&Ve(a.stacktrace.frames)&&(a.stacktrace.frames=yield n.applyModifiers(a.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 a,l;return t.cause!=null&&(a=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),be({},t,{cause:a,stack:l})}applyChunkIds(t,n){return t.map((a=>(a.filename&&n&&(a.chunk_id=n[a.filename]),a)))}applyCoercers(t,n){for(var a of this.coercers)if(a.match(t))return a.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return zt((function*(){var a=t;for(var l of n.modifiers)a=yield l(a);return a}))()}convertToExceptionList(t,n){var a,l,d,v={type:t.type,value:t.value,mechanism:{type:(a=n.type)!==null&&a!==void 0?a:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(d=t.synthetic)!==null&&d!==void 0&&d}};t.stack&&(v.stacktrace={type:"raw",frames:t.stack});var c=[v];return t.cause!=null&&c.push(...this.convertToExceptionList(t.cause,be({},n,{handled:!0}))),c}buildParsingContext(t){var n;return{chunkIdMap:K3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,a){a===void 0&&(a=0);var l=(d,v)=>{if(4>=v){var c=this.buildCoercingContext(t,n,v);return this.applyCoercers(d,c)}};return be({},n,{syntheticException:a==0?n.syntheticException:void 0,mechanism:t,apply:d=>l(d,a),next:d=>l(d,a+1)})}}var pa="?";function _f(s,t,n,a,l){var d={platform:s,filename:t,function:n==="<anonymous>"?pa:n,in_app:!0};return ke(a)||(d.lineno=a),ke(l)||(d.colno=l),d}var mb=(s,t)=>{var n=s.indexOf("safari-extension")!==-1,a=s.indexOf("safari-web-extension")!==-1;return n||a?[s.indexOf("@")!==-1?s.split("@")[0]:pa,n?"safari-extension:"+t:"safari-web-extension:"+t]:[s,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=(s,t)=>{var n=Z3.exec(s);if(n)return _f(t,n[1],pa,+n[2],+n[3]);var a=Q3.exec(s);if(a){if(a[2]&&a[2].indexOf("eval")===0){var l=e4.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var d=mb(a[1]||pa,a[2]);return _f(t,d[1],d[0],a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},s4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,i4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,n4=(s,t)=>{var n=s4.exec(s);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var a=i4.exec(n[3]);a&&(n[1]=n[1]||"eval",n[3]=a[1],n[4]=a[2],n[5]="")}var l=n[3],d=n[1]||pa,v=mb(d,l);return _f(t,l=v[1],d=v[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},h0=/\(error: (.*)\)/;class r4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var a=kt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:a?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 kc(t,"DOMException")}isDOMError(t){return kc(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 a=t.message;return String(a.error&&typeof a.error.message=="string"?a.error.message:a)}getStack(t){return t.stacktrace||t.stack||void 0}}class o4{constructor(){}match(t){return kc(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var a;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(a=n.syntheticException)==null?void 0:a.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 a,l=this.getInfos(t),d=l[0],v=l[1];return{type:d??"Error",value:v??t,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}getInfos(t){var n="Error",a=t,l=t.match(l4);return l&&(n=l[1],a=l[2]),[n,a]}}var u4=["fatal","error","warning","log","info","debug"];function gb(s,t){t===void 0&&(t=40);var n=Object.keys(s);if(n.sort(),!n.length)return"[object has no keys]";for(var a=n.length;a>0;a--){var l=n.slice(0,a).join(", ");if(t>=l.length)return a===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class h4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var a,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return np(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 a=this.getObjectClassName(t);return(a&&a!=="Object"?"'"+a+"'":"Object")+" captured as exception with keys: "+gb(t)}isSeverityLevel(t){return kt(t)&&!hf(t)&&u4.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var a=t[n];if(W3(a))return a}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class d4{match(t){return np(t)}coerce(t,n){var a,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+gb(t),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class f4{match(t){return Gy(t)}coerce(t,n){var a;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class p4{match(t){return kc(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!np(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var a,l=this.getUnhandledRejectionReason(t);return Gy(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}:n.apply(l)}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 jc="$message",Nc="$timestamp",v4=new Set([jc,Nc]),Md={enabled:!0,max_bytes:32768};function Lc(s){var t;return s?{enabled:(t=s.enabled)!==null&&t!==void 0?t:Md.enabled,max_bytes:m4(s.max_bytes,Md.max_bytes)}:be({},Md)}class _4{constructor(t){this.$e=[],this.ze=0,this.Te=Lc(t)}setConfig(t){this.Te=Lc(t),this.Ze()}add(t){var n=(function(l){var d;try{d=Fy(l)}catch{return}try{var v=JSON.parse(d);if(!Ht(v))return;var c=v,u=c[jc],p=c[Nc];return!kt(u)||u.trim().length===0||!kt(p)&&!ys(p)?void 0:{step:c,json:d}}catch{return}})(t);if(n){var a=(function(l){if(typeof TextEncoder<"u")return new TextEncoder().encode(l).length;for(var d=encodeURIComponent(l),v=0,c=0;d.length>c;c++)d[c]==="%"?(v+=1,c+=2):v+=1;return v})(n.json);a>this.Te.max_bytes||(this.$e.push({step:n.step,bytes:a}),this.ze+=a,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 m4(s,t){if(!ys(s)||s===1/0||s===-1/0)return t;var n=Math.floor(s);return 0>n?t:n}var yb=function(s,t){var n=(t===void 0?{}:t).debugEnabled,a={k(l){if(ce&&(gt.DEBUG||ce.POSTHOG_DEBUG||n)&&!ke(ce.console)&&ce.console){for(var d=("__rrweb_original__"in ce.console[l])?ce.console[l].__rrweb_original__:ce.console[l],v=arguments.length,c=new Array(v>1?v-1:0),u=1;v>u;u++)c[u-1]=arguments[u];d(s,...c)}},debug(){for(var l=arguments.length,d=new Array(l),v=0;l>v;v++)d[v]=arguments[v];a.k("debug",...d)},info(){for(var l=arguments.length,d=new Array(l),v=0;l>v;v++)d[v]=arguments[v];a.k("log",...d)},warn(){for(var l=arguments.length,d=new Array(l),v=0;l>v;v++)d[v]=arguments[v];a.k("warn",...d)},error(){for(var l=arguments.length,d=new Array(l),v=0;l>v;v++)d[v]=arguments[v];a.k("error",...d)},critical(){for(var l=arguments.length,d=new Array(l),v=0;l>v;v++)d[v]=arguments[v];console.error(s,...d)},uninitializedWarning(l){a.error("You must initialize PostHog before calling "+l)},createLogger:(l,d)=>yb(s+" "+l,d)};return a},Te=yb("[PostHog.js]"),$t=Te.createLogger,g4=$t("[ExternalScriptsLoader]"),Dd=(s,t,n)=>{if(s.config.disable_external_dependency_loading)return g4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var a=Re==null?void 0:Re.querySelectorAll("script");if(a){for(var l,d=function(){if(a[v].src===t){var u=a[v];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",(p=>{u.__posthog_loading_callback_fired=!0,n(void 0,p)})),u.onerror=p=>n(p),{v:void 0})}},v=0;a.length>v;v++)if(l=d())return l.v}var c=()=>{if(!Re)return n("document not found");var u=Re.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=t,u.onload=f=>{u.__posthog_loading_callback_fired=!0,n(void 0,f)},u.onerror=f=>n(f),s.config.prepare_external_dependency_script&&(u=s.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(s.config.external_scripts_inject_target==="head")Re.head.appendChild(u);else{var p,y=Re.querySelectorAll("body > script");y.length>0?(p=y[0].parentNode)==null||p.insertBefore(u,y[0]):Re.body.appendChild(u)}};Re!=null&&Re.body?c():Re==null||Re.addEventListener("DOMContentLoaded",c)};Ie.__PosthogExtensions__=Ie.__PosthogExtensions__||{},Ie.__PosthogExtensions__.loadExternalDependency=(s,t,n)=>{if(t!=="remote-config"){var a;if(s.config.strict_script_versioning)a=s.requestRouter.endpointFor("assets","/static/"+s.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+s.version;if(t==="toolbar"){var d=3e5;l=l+"&t="+Math.floor(Date.now()/d)*d}a=s.requestRouter.endpointFor("assets",l)}Dd(s,a,n)}else{var v=s.requestRouter.endpointFor("assets","/array/"+s.config.token+"/config.js");Dd(s,v,n)}},Ie.__PosthogExtensions__.loadSiteApp=(s,t,n)=>{var a=s.requestRouter.endpointFor("api",t);Dd(s,a,n)};gt.DEBUG=!1,gt.LIB_VERSION="1.409.5",gt.LIB_NAME="web";var bb="$people_distinct_id",$o="$device_id",jd="$device_model",xo="__alias",Co="__timers",mf="$autocapture_disabled_server_side",gf="$heatmaps_enabled_server_side",yf="$exception_capture_enabled_server_side",bf="$error_tracking_suppression_rules",Sf="$error_tracking_capture_extension_exceptions",wf="$web_vitals_enabled_server_side",cp="$dead_clicks_enabled_server_side",up="$product_tours_enabled_server_side",xf="$web_vitals_allowed_metrics",fr="$session_recording_remote_config",Sb="$replay_sample_rate",wb="$replay_override_sampling",xb="$replay_override_linked_flag",Cb="$replay_override_url_trigger",Eb="$replay_override_event_trigger",na="$sesid",hp="$session_is_sampled",dr="$enabled_feature_flags",bc="$active_feature_flags",Eo="$early_access_features",Cf="$feature_flag_details",Sc="$feature_flag_payloads",Ef="$feature_flag_request_id",Oc="$minimal_flag_called_events",tn="$override_feature_flags",ta="$override_feature_flag_payloads",cr="$stored_person_properties",ur="$stored_group_properties",kf="$surveys",Bc="$surveys_loaded_at",Tf="$surveys_activated",wc="$surveys_activated_session",ko="ph_product_tours",Mo="$flag_call_reported",Af="$flag_call_reported_session_id",Rf="$feature_flag_errors",Po="$feature_flag_evaluated_at",di="$user_state",Mf="$client_session_props",Df="$capture_rate_limit",jf="$initial_campaign_params",Nf="$initial_referrer_info",Hc="$initial_person_info",zc="$epp",oc="$posthog_cookieless",kb="$cookieless_mode",Tb="$sdk_debug_extensions_init_method",Ab="$sdk_debug_extensions_init_time_ms",Rb="$sdk_debug_recording_script_not_loaded",dp="PostHog loadExternalDependency extension not found.",hr="on_reject",rn="always",Jr="anonymous",sr="identified",Lf="identified_only",Ic="visibilitychange",$c="beforeunload",sa="$pageview",Nd="$pageleave",Ld="$identify",d0="$groupidentify";function lc(s,t){Ve(s)&&s.forEach(t)}function Tt(s,t){if(!Xe(s))if(Ve(s))s.forEach(t);else if(R3(s))s.forEach(((a,l)=>t(a,l)));else for(var n in s)Wy.call(s,n)&&t(s[n],n)}var Dt=function(s){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;t>a;a++)n[a-1]=arguments[a];for(var l of n)for(var d in l)l[d]!==void 0&&(s[d]=l[d]);return s};function xc(s){for(var t=Object.keys(s),n=t.length,a=new Array(n);n--;)a[n]=[t[n],s[t[n]]];return a}var f0=function(s){try{return s()}catch{return}},y4=function(s){return function(){try{for(var t=arguments.length,n=new Array(t),a=0;t>a;a++)n[a]=arguments[a];return s.apply(this,n)}catch(l){Te.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Te.critical(l)}}},fp=function(s){var t={};return Tt(s,(function(n,a){(kt(n)&&n.length>0||ys(n))&&(t[a]=n)})),t},b4=["herokuapp.com","vercel.app","netlify.app"];function S4(s){var t=s==null?void 0:s.hostname;if(!kt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var a of b4)if(n===a)return!1;return!0}function Ft(s,t,n,a){var l=a??{},d=l.capture,v=l.passive;s==null||s.addEventListener(t,n,{capture:d!==void 0&&d,passive:v===void 0||v})}function Mb(s){return s.name==="ph_toolbar_internal"}var Db=s=>{if(Re){try{for(var t=s+"=",n=Re.cookie.split(";").filter((d=>d.length)),a=0;n.length>a;a++){for(var l=n[a];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(s){return 0>s?Math.ceil(s):Math.floor(s)}),Number.isInteger||(Number.isInteger=function(s){return ys(s)&&isFinite(s)&&Math.floor(s)===s});class Pc{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,a,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(a)||!Number.isInteger(l)||0>t||0>n||0>a||0>l||t>0xffffffffffff||n>4095||a>1073741823||l>4294967295)throw new RangeError("invalid field value");var d=new Uint8Array(16);return d[0]=t/Math.pow(2,40),d[1]=t/Math.pow(2,32),d[2]=t/Math.pow(2,24),d[3]=t/Math.pow(2,16),d[4]=t/256,d[5]=t,d[6]=112|n>>>8,d[7]=n,d[8]=128|a>>>24,d[9]=a>>>16,d[10]=a>>>8,d[11]=a,d[12]=l>>>24,d[13]=l>>>16,d[14]=l>>>8,d[15]=l,new Pc(d)}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 Pc(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var a=this.bytes[n]-t.bytes[n];if(a!==0)return Math.sign(a)}return 0}}class w4{generate(){var t=this.generateOrAbort();if(!ke(t))return t;this.S=0;var n=this.generateOrAbort();if(ke(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 Pc.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 p0,jb=s=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;s.length>t;t++)s[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return s};ce&&!ke(ce.crypto)&&crypto.getRandomValues&&(jb=s=>crypto.getRandomValues(s));class x4{nextUint32(){return this.R.length>this.O||(jb(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var nn=()=>C4().toString(),C4=()=>(p0||(p0=new w4)).generate(),po="",E4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,an={N:()=>!!Re,P(s){Te.error("cookieStore error: "+s)},q:Db,F(s){var t;try{t=JSON.parse(an.q(s))||{}}catch{}return t},A(s,t,n,a,l){if(!Re)return!1;try{var d="",v="",c=(function(y,f){if(f){var w=(function(A,C){if(C===void 0&&(C=Re),po)return po;if(!C||["localhost","127.0.0.1"].includes(A))return"";for(var b=A.split("."),S=Math.min(b.length,8),_="dmn_chk_"+nn();!po&&S--;){var g=b.slice(S).join("."),T=_+"=1;domain=."+g+";path=/";C.cookie=T+";max-age=3",C.cookie.includes(_)&&(C.cookie=T+";max-age=0",po=g)}return po})(y);if(!w){var E=(A=>{var C=A.match(E4);return C?C[0]:""})(y);E!==w&&Te.info("Warning: cookie subdomain discovery mismatch",E,w),w=E}return w?"; domain=."+w:""}return""})(Re.location.hostname,a);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),d="; expires="+u.toUTCString()}l&&(v="; secure");var p=s+"="+encodeURIComponent(JSON.stringify(t))+d+"; SameSite=Lax; path=/"+c+v;return p.length>3686.4&&Te.warn("cookieStore warning: large cookie, len="+p.length),Re.cookie=p,!0}catch{return!1}},D(s,t){if(Re!=null&&Re.cookie)try{an.A(s,"",-1,t)}catch{return}}},Od=null,Mt={N(){if(!Ds(Od))return Od;var s=!0;if(ke(ce))s=!1;else try{var t="__mplssupport__";Mt.A(t,"xyz"),Mt.q(t)!=='"xyz"'&&(s=!1),Mt.D(t)}catch{s=!1}return s||Te.error("localStorage unsupported; falling back to cookie store"),Od=s,s},P(s){Te.error("localStorage error: "+s)},q(s){try{return ce==null?void 0:ce.localStorage.getItem(s)}catch(t){Mt.P(t)}return null},F(s){try{return JSON.parse(Mt.q(s))||{}}catch{}return null},A(s,t){try{return ce==null||ce.localStorage.setItem(s,JSON.stringify(t)),!0}catch(n){Mt.P(n)}return!1},D(s){try{ce==null||ce.localStorage.removeItem(s)}catch(t){Mt.P(t)}}},k4=[$o,"distinct_id",na,hp,zc,Hc,di],cc={},T4={N:()=>!0,P(s){Te.error("memoryStorage error: "+s)},q:s=>cc[s]||null,F:s=>cc[s]||null,A:(s,t)=>(cc[s]=t,!0),D(s){delete cc[s]}},ir=null,gs={N(){if(!Ds(ir))return ir;if(ir=!0,ke(ce))ir=!1;else try{var s="__support__";gs.A(s,"xyz"),gs.q(s)!=='"xyz"'&&(ir=!1),gs.D(s)}catch{ir=!1}return ir},P(s){Te.error("sessionStorage error: ",s)},q(s){try{return ce==null?void 0:ce.sessionStorage.getItem(s)}catch(t){gs.P(t)}return null},F(s){try{return JSON.parse(gs.q(s))||null}catch{}return null},A(s,t){try{return ce==null||ce.sessionStorage.setItem(s,JSON.stringify(t)),!0}catch(n){gs.P(n)}return!1},D(s){try{ce==null||ce.sessionStorage.removeItem(s)}catch(t){gs.P(t)}}};class A4{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===rn||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===hr}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,a=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(a?a+n:"__ph_opt_in_out_"+n)}get Qe(){var t=this.Je.q(this.Ke);return kd(t)?1:Fe(N3,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?Mt:an;if(!this.Ye||this.Ye!==n){this.Ye=n;var a=t==="localStorage"?an:Mt;a.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(kd(a.q(this.Ke))),a.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[Ms==null?void 0:Ms.doNotTrack,Ms==null?void 0:Ms.msDoNotTrack,Ie.doNotTrack].some((t=>kd(t)))}}function Nb(s,t){var n,a=s==null||(n=s.config)==null?void 0:n.get_current_url;if(!Js(a))return t;try{var l=a(t);return kt(l)&&l?l:t}catch(d){return Te.error("Error in get_current_url, falling back to window.location.href",d),t}}var Lb="__POSTHOG_TOOLBAR__",R4=1,M4=3,D4=11;function v0(s){return s instanceof Element&&(s.id===Lb||!(s.closest==null||!s.closest(".toolbar-global-fade-container")))}function zn(s){return!!s&&s.nodeType===R4}function Zs(s,t){return!!s&&!!s.tagName&&s.tagName.toLowerCase()===t.toLowerCase()}function Ob(s){return!!s&&s.nodeType===M4}function Bb(s){return!!s&&s.nodeType===D4&&zn(s.host)}var Hb=1e3;function pp(s){return s?eu(s).split(/\s+/):[]}function _0(s,t){var n=(function(a){var l,d=ce==null||(l=ce.location)==null?void 0:l.href;return ke(d)?void 0:Nb(a,d)})(t);return!!(n&&s&&s.some((a=>n.match(a))))}function Uc(s){var t="";switch(typeof s.className){case"string":t=s.className;break;case"object":t=(s.className&&"baseVal"in s.className?s.className.baseVal:null)||s.getAttribute("class")||"";break;default:t=""}return pp(t)}function zb(s){return Xe(s)?null:eu(s).split(/(\s+)/).filter((t=>Do(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Uo(s){var t="";return Bf(s)&&!Ub(s)&&s.childNodes&&s.childNodes.length&&Tt(s.childNodes,(function(n){var a;Ob(n)&&n.textContent&&(t+=(a=zb(n.textContent))!==null&&a!==void 0?a:"")})),eu(t)}function Bd(s){var t;return ke(s.target)?s.srcElement||null:(t=s.target)!=null&&t.shadowRoot?s.composedPath()[0]||null:s.target||null}var vp=["a","button","form","input","select","textarea","label"];function Of(s,t){if(ke(t))return!0;var n,a=function(d){if(t.some((v=>(function(c,u){var p=c.matches||c.matchesSelector||c.msMatchesSelector||c.mozMatchesSelector||c.webkitMatchesSelector||c.oMatchesSelector;try{return!!p&&p.call(c,u)}catch{return!1}})(d,v))))return{v:!0}};for(var l of s)if(n=a(l))return n.v;return!1}function Ib(s){var t=s.parentNode;return!(!t||!zn(t))&&t}var j4=[".ph-no-autocapture","[data-ph-no-autocapture]"],$b=["next","previous","prev",">","<"],N4=[...$b,"+","-","−","–"],m0=(s,t)=>/[a-z0-9]/i.test(t)?s.includes(t):s===t,g0=[".ph-no-rageclick",".ph-no-capture"],L4=["","text","search","email","password","url","tel","number"];function y0(s,t){if(!ce||_p(s))return!1;var n,a,l,d,v;if(xi(t)?(n=!!t&&g0,a=void 0,l=!1):(n=(d=t==null?void 0:t.css_selector_ignorelist)!==null&&d!==void 0?d:g0,a=t==null?void 0:t.content_ignorelist,l=(v=t==null?void 0:t.ignore_text_selection)!==null&&v!==void 0&&v),n===!1||l&&(function(u){return!(!u||!zn(u))&&(!!Zs(u,"textarea")||(Zs(u,"input")?Fe(L4,(u.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var y=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return y==="true"||y===""})(u)))})(s))return!1;var c=Pb(s,!1).targetElementList;return!(function(u,p){if(u===!1||ke(u))return!1;var y;if(u===!0)y=$b;else{if(!Ve(u))return!1;if(u.length>10)return Te.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;y=u.map((f=>f.toLowerCase()))}return p.some((f=>{var w=f.safeText,E=f.ariaLabel;return y.some((A=>m0(w,A)||m0(E,A)))}))})(a,c.map((u=>{var p;return{safeText:Uo(u).toLowerCase(),ariaLabel:((p=u.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!Of(c,n)}var _p=s=>!s||Zs(s,"html")||!zn(s),Pb=(s,t)=>{if(!ce||_p(s))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,a=[s],l=s;l.parentNode&&!Zs(l,"body");)if(Bb(l.parentNode))a.push(l.parentNode.host),l=l.parentNode.host;else{var d=Ib(l);if(!d)break;if(t||vp.indexOf(d.tagName.toLowerCase())>-1)n=!0;else try{var v=ce.getComputedStyle(d);v&&v.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}a.push(d),l=d}return{parentIsUsefulElement:n,targetElementList:a}};function Bf(s){for(var t=new Set,n=0,a=s;a.parentNode&&!Zs(a,"body");a=a.parentNode){if(n++>=Hb||t.has(a))return!1;t.add(a);var l=Uc(a);if(Fe(l,"ph-sensitive")||Fe(l,"ph-no-capture"))return!1}if(Fe(Uc(s),"ph-include"))return!0;var d=s.type||"";if(kt(d))switch(d.toLowerCase()){case"hidden":case"password":return!1}var v=s.name||s.id||"";return!kt(v)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(v.replace(/[^a-zA-Z0-9]/g,""))}function Ub(s){return!!(Zs(s,"input")&&!["button","checkbox","submit","reset"].includes(s.type)||Zs(s,"select")||Zs(s,"textarea")||s.getAttribute("contenteditable")==="true")}var b0=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}))$"),S0=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,O4=[16,15,14,13],B4=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),w0=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),x0=/[0-9A-Za-z_]/;function H4(s){for(var t=0,n=!1,a=s.length-1;a>=0;a--){var l=s.charCodeAt(a)-48;n&&(l*=2)>9&&(l-=9),t+=l,n=!n}return t%10==0}function Do(s,t){if(t===void 0&&(t=!0),Xe(s))return!1;if(kt(s)){s=eu(s);var n=t?b0.test((s||"").replace(/[- ]/g,"")):(function(l){var d;for(S0.lastIndex=0;d=S0.exec(l);){var v=d[2];if(v)for(var c=v.replace(/[- ]/g,""),u=0;c.length>u;u++)for(var p of O4){var y=u+p;if(c.length>=y){var f=c.slice(u,y);if(b0.test(f)&&H4(f))return!0}}}return!1})(s);if(n)return!1;var a=t?B4.test(s):(function(l){var d;for(w0.lastIndex=0;d=w0.exec(l);){var v=d[1],c=d[3];if(!(v&&c&&x0.test(v)&&x0.test(c)))return!0}return!1})(s);if(a)return!1}return!0}function C0(s){var t=Uo(s);return Do(t=(t+" "+Fb(s)).trim())?t:""}function Fb(s){var t="";return s&&s.childNodes&&s.childNodes.length&&Tt(s.childNodes,(function(n){var a;if(n&&((a=n.tagName)==null?void 0:a.toLowerCase())==="span")try{var l=Uo(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+Fb(n)).trim())}catch(d){Te.error("[AutoCapture]",d)}})),t}function E0(s){return s.replace(/"|\\"/g,'\\"')}function z4(s){var t=s.attr__class;if(t)return Ve(t)?t:pp(t)}var uc=$t("[Dead Clicks]"),I4=()=>!0,$4=s=>{var t,n=!((t=s.instance.persistence)==null||!t.get_property(cp)),a=s.instance.config.capture_dead_clicks;return xi(a)?a:!!Ht(a)||n};class k0{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,n,a){this.instance=t,this.isEnabled=n,this.onCapture=a,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[cp]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var n,a;(n=Ie.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(a=Ie.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?uc.error("failed to load script",l):t()}))}er(){var t;if(Re){if(!this.Xe&&(t=Ie.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Ht(this.instance.config.capture_dead_clicks)?be({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xe=Ie.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xe.start(Re),uc.info("starting...")}}else uc.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,uc.info("stopping..."))}}var Hd=$t("[SegmentIntegration]"),qb="posthog-js";function Wb(s,t){var n=t===void 0?{}:t,a=n.organization,l=n.projectId,d=n.prefix,v=n.severityAllowList,c=v===void 0?["error"]:v,u=n.sendExceptionsToPostHog,p=u===void 0||u;return y=>{var f,w,E,A,C;if(c!=="*"&&!c.includes(y.level)||!s.__loaded)return y;y.tags||(y.tags={});var b=s.requestRouter.endpointFor("ui","/project/"+s.config.token+"/person/"+s.get_distinct_id());y.tags["PostHog Person URL"]=b,s.sessionRecordingStarted()&&(y.tags["PostHog Recording URL"]=s.get_session_replay_url({withTimestamp:!0}));var S,_=((f=y.exception)==null?void 0:f.values)||[],g=_.map((R=>be({},R,{stacktrace:R.stacktrace?be({},R.stacktrace,{type:"raw",frames:(R.stacktrace.frames||[]).map((M=>be({},M,{platform:"web:javascript"})))}):void 0}))),T={$exception_message:((w=_[0])==null?void 0:w.value)||y.message,$exception_type:(E=_[0])==null?void 0:E.type,$exception_level:y.level,$exception_list:g,$sentry_event_id:y.event_id,$sentry_exception:y.exception,$sentry_exception_message:((A=_[0])==null?void 0:A.value)||y.message,$sentry_exception_type:(C=_[0])==null?void 0:C.type,$sentry_tags:y.tags};return a&&l&&(T.$sentry_url=(d||"https://sentry.io/organizations/")+a+"/issues/?project="+l+"&query="+y.event_id),p&&((S=s.exceptions)==null||S.sendExceptionEvent(T)),y}}class P4{constructor(t,n,a,l,d,v){this.name=qb,this.setupOnce=function(c){c(Wb(t,{organization:n,projectId:a,prefix:l,severityAllowList:d,sendExceptionsToPostHog:v==null||v}))}}}class T0{constructor(t){this.rr=(n,a,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength||l.crossTabAdoption)&&(Te.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),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 a,l=this.ar(t,n);return this.ir={pathname:(a=ce==null?void 0:ce.location.pathname)!==null&&a!==void 0?a:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}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 a=this.ir;if(!a)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:a.pageViewId},d=this._instance.scrollManager.getContext();if(d&&!this._instance.config.disable_scroll_properties){var v=d.maxScrollHeight,c=d.lastScrollY,u=d.maxScrollY,p=d.maxContentHeight,y=d.lastContentY,f=d.maxContentY;if(!(ke(v)||ke(c)||ke(u)||ke(p)||ke(y)||ke(f))){v=Math.ceil(v),c=Math.ceil(c),u=Math.ceil(u),p=Math.ceil(p),y=Math.ceil(y),f=Math.ceil(f);var w=v>1?Di(c/v,0,1,Te):1,E=v>1?Di(u/v,0,1,Te):1,A=p>1?Di(y/p,0,1,Te):1,C=p>1?Di(f/p,0,1,Te):1;l=Dt(l,{$prev_pageview_last_scroll:c,$prev_pageview_last_scroll_percentage:w,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:E,$prev_pageview_last_content:y,$prev_pageview_last_content_percentage:A,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:C})}}return a.pathname&&(l.$prev_pageview_pathname=a.pathname),a.timestamp&&(l.$prev_pageview_duration=(t.getTime()-a.timestamp.getTime())/1e3),l}}var zd=["flags","surveys"],U4={[bb]:{exposure:"hidden"},[xo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Co]:{exposure:"hidden"},[mf]:{exposure:"event"},[gf]:{exposure:"hidden"},[yf]:{exposure:"event"},[bf]:{exposure:"hidden"},[Sf]:{exposure:"event"},[wf]:{exposure:"event"},[cp]:{exposure:"event"},[up]:{exposure:"hidden"},[xf]:{exposure:"event"},[fr]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[na]:{exposure:"hidden"},[hp]:{exposure:"event"},[Sb]:{exposure:"event",shouldSkipFromEventProperties:s=>Ds(s)},$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"},[dr]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(s,t)=>t(),transformToEventProperties(s){if(!Ht(s))return{};for(var t={},n=Object.keys(s),a=0;n.length>a;a++)t["$feature/"+n[a]]=s[n[a]];return t}},[bc]:{exposure:"event",storageGroup:"flags"},[Eo]:{exposure:"hidden"},[Cf]:{exposure:"hidden",storageGroup:"flags"},[Sc]:{exposure:"event",storageGroup:"flags"},[Ef]:{exposure:"event",storageGroup:"flags",volatile:!0},[Oc]:{exposure:"hidden",storageGroup:"flags"},[tn]:{exposure:"event"},[ta]:{exposure:"hidden"},[cr]:{exposure:"hidden"},[ur]:{exposure:"hidden"},[kf]:{exposure:"hidden",storageGroup:"surveys"},[Bc]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Tf]:{exposure:"event"},[wc]:{exposure:"hidden"},[ko]:{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"},[Mo]:{exposure:"hidden"},[Af]:{exposure:"hidden"},[Rf]:{exposure:"hidden"},[Po]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[di]:{exposure:"hidden"},[Mf]:{exposure:"hidden"},[Df]:{exposure:"hidden"},[jf]:{exposure:"hidden"},[Nf]:{exposure:"hidden"},[Hc]:{exposure:"hidden"},[zc]:{exposure:"hidden"},[wb]:{exposure:"event"},[xb]:{exposure:"event"},[Cb]:{exposure:"event"},[Eb]:{exposure:"event"},[Tb]:{exposure:"event"},[Ab]:{exposure:"event"},[Rb]:{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"}]],nr=s=>{var t=U4[s];if(t)return t;for(var n of F4){var a=n[1];if(s.indexOf(n[0])===0)return a}},ra=(s,t)=>{try{return JSON.stringify(s,((n,a)=>typeof a=="bigint"?a.toString():a),t)}catch{return Fy(s)}},Fc=s=>{var t=Re==null?void 0:Re.createElement("a");return ke(t)?null:(t.href=s,t)},va=function(s,t){for(var n,a=((s.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;a.length>l;l++){var d=a[l].split("=");if(d[0]===t){n=d;break}}if(!Ve(n)||2>n.length)return"";var v=n[1];try{v=decodeURIComponent(v)}catch{Te.error("Skipping decoding for malformed query param: "+v)}return v.replace(/\+/g," ")},Fo=function(s,t,n){if(!s||!t||!t.length)return s;for(var a=s.split("#"),l=a[1],d=(a[0]||"").split("?"),v=d[1],c=d[0],u=(v||"").split("&"),p=[],y=0;u.length>y;y++){var f=u[y].split("=");Ve(f)&&(t.includes(f[0])?p.push(f[0]+"="+n):p.push(u[y]))}var w=c;return v!=null&&(w+="?"+p.join("&")),l!=null&&(w+="#"+l),w},qc=function(s,t){var n=s.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Gb=(s,t)=>s>=t&&$y(),Vb=(s,t,n,a)=>{if(s===0){if($y()){var l=t+1;return l===n&&a(),l}return t}return 0},hc="https?://(.*)",_a=["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",..._a],qo="<masked>",W4=["li_fat_id"];function Yb(s,t,n){if(!Re)return{};var a,l=t?[..._a,...n||[]]:[],d=Xb(Fo(Re.URL,l,qo),s),v=(a={},Tt(W4,(function(c){var u=Db(c);a[c]=u||null})),a);return Dt(v,d)}function Xb(s,t){var n=q4.concat(t||[]),a={};return Tt(n,(function(l){var d=va(s,l);a[l]=d||null})),a}function Kb(s){var t=(function(d){return d?d.search(hc+"google.([^/?]*)")===0?"google":d.search(hc+"bing.com")===0?"bing":d.search(hc+"yahoo.com")===0?"yahoo":d.search(hc+"duckduckgo.com")===0?"duckduckgo":null:null})(s),n=t!="yahoo"?"q":"p",a={};if(!Ds(t)){a.$search_engine=t;var l=Re?va(Re.referrer,n):"";l.length&&(a.ph_keyword=l)}return a}function A0(){return navigator.language||navigator.userLanguage}var Wc="$direct";function Jb(){return(Re==null?void 0:Re.referrer)||Wc}function Zb(s,t,n){n===void 0&&(n=!1);var a=s?[..._a,...t||[]]:[],l=n?Hn(Qt==null?void 0:Qt.href):Qt==null?void 0:Qt.href,d=l==null?void 0:l.substring(0,1e3);return{r:Jb().substring(0,1e3),u:d?Fo(d,a,qo):void 0}}function Qb(s,t){var n;t===void 0&&(t=!1);var a=s.r,l=s.u,d=t?Hn(l):l,v={$referrer:a,$referring_domain:a==null?void 0:a==Wc?Wc:(n=Fc(a))==null?void 0:n.host};if(d){v.$current_url=d;var c=Fc(d);v.$host=c==null?void 0:c.host,v.$pathname=c==null?void 0:c.pathname;var u=Xb(d);Dt(v,u)}if(a){var p=Kb(a);Dt(v,p)}return v}function e1(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function G4(){try{return new Date().getTimezoneOffset()}catch{return}}var V4={flags:Po,surveys:Bc},Y4=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Zr="main";class Id{constructor(t,n,a){if(a===void 0&&(a=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=a,this.props={},this.cr=void 0,this.vr=(d=>{var v="";return d.token&&(v=d.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),d.persistence_name?"ph_"+d.persistence_name:"ph_"+v+"_posthog"})(t),this.Je=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Te.info("Persistence loaded",t.persistence,be({},this.props)),this.update_config(t,t,n),this.save(),ce){var l=()=>this.flush();Ft(ce,"beforeunload",l,{capture:!1}),Ft(ce,"pagehide",l,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return ys(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){Y4.indexOf(t.persistence.toLowerCase())===-1&&(Te.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,a=(function(v,c){v===void 0&&(v=[]),c===void 0&&(c=!1);var u=[...k4,...v];return be({},Mt,{F(p){try{var y={};try{y=an.F(p)||{}}catch{}var f,w=JSON.parse(Mt.q(p)||"{}");if(c){var E={};for(var A in y){var C=y[A];Ds(C)||C===""||(E[A]=C)}f=Dt(w,E)}else f=Dt(y,w);return Mt.A(p,f),f}catch{}return null},A(p,y,f,w,E,A){var C=Mt.A(p,y,void 0,void 0,A);try{var b={};u.forEach((S=>{y[S]&&(b[S]=y[S])})),Object.keys(b).length&&an.A(p,b,f,w,E,A)}catch(S){Mt.P(S)}return C},D(p,y){try{ce==null||ce.localStorage.removeItem(p),an.D(p,y)}catch(f){Mt.P(f)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,d=t.persistence.toLowerCase();return d==="localstorage"&&Mt.N()?(n=Mt,l=!0):d==="localstorage+cookie"&&a.N()?(n=a,l=!0):d==="sessionstorage"&&gs.N()?n=gs:d==="memory"?n=T4:d==="cookie"?n=an:a.N()?(n=a,l=!0):n=an,this.ur=l,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 a=this.props[Po];return!a||typeof a!="number"||Date.now()-a>n}properties(){var t={};return Tt(this.props,((n,a)=>{var l=nr(a);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,a===dr?()=>this._r():()=>!1))return;l.transformToEventProperties&&Dt(t,l.transformToEventProperties(n))}else if(!l||l.exposure==="event"){if(l!=null&&l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,(()=>!1)))return;t[a]=n}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=Dt({},t)),this.hr&&this.wr()}}wr(){for(var t of zd){var n=Mt.F(this.br(t));if(n&&!Bn(n)){var a=this.kr(t);a.persisted=!0,this.Sr(t)||(a.fingerprint=this.Cr(n,t)),this.Mr(t,n)||Dt(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var a;return((a=nr(n))==null?void 0:a.storageGroup)===t}))}Mr(t,n){var a=V4[t];if(!a)return!1;var l=n[a],d=this.props[a];return ys(l)&&ys(d)&&d>l}refreshKey(t){var n;if(!this.yr){var a=this.hr?(n=nr(t))==null?void 0:n.storageGroup:void 0,l=a?Mt.F(this.br(a)):this.Je.F(this.vr);if(l&&t in l)this.Ir(t,l[t]);else{if(a){var d=this.Je.F(this.vr);if(d&&t in d)return void this.Ir(t,d[t])}this.Tr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?ke(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){ke(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,Zr))}Pr(){var t=this.Fr(),n=t.main,a=t.groups;for(var l of(this.Or(this.Je,this.vr,n,Zr),zd)){var d,v=a[l];(!Bn(v)||(d=this.lr[l])!=null&&d.persisted)&&this.Or(Mt,this.br(l),v,l)}}Fr(){var t={},n={flags:{},surveys:{}};return Tt(this.props,((a,l)=>{var d,v=(d=nr(l))==null?void 0:d.storageGroup;v?n[v][l]=a:t[l]=a})),{main:t,groups:n}}Cr(t,n){if(n===Zr)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var a={};return Tt(t,((l,d)=>{var v;a[d]=(v=nr(d))!=null&&v.volatile?"__volatile__":l})),JSON.stringify(a)}Or(t,n,a,l){var d=this.kr(l);if(l===Zr||d.dirty||ke(d.fingerprint)){var v;try{if((v=this.Cr(a,l))===d.fingerprint)return void(d.dirty=!1)}catch{v=void 0}t.A(n,a,this.Ar,this.$r,this.Lr,this.Te.debug)?(d.dirty=!1,l!==Zr&&(d.persisted=!0),ke(v)||(d.fingerprint=v)):this.Te.debug&&Te.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,a=n!==void 0&&n;if(ke(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!a&&this.dr)for(var l of zd)Mt.D(this.br(l));a?delete this.lr[Zr]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,a){if(Ht(t)){ke(n)&&(n="None"),this.Ar=ke(a)?this.Dr:a;var l=!1;if(Tt(t,((d,v)=>{this.props.hasOwnProperty(v)&&this.props[v]!==n||(this.Ir(v,d),l=!0)})),l)return this.save(),!0}return!1}register(t,n){if(Ht(t)){this.Ar=ke(n)?this.Dr:n;var a=!1;if(Tt(t,((l,d)=>{t.hasOwnProperty(d)&&this.props[d]!==l&&(this.Ir(d,l),a=!0)})),a)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){var t=Re==null?void 0:Re.URL;if(t!==this.cr){var n=Yb(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Bn(fp(n))||this.register(n),this.cr=t}}update_search_keyword(){var t;this.register((t=Re==null?void 0:Re.referrer)?Kb(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Jb(),$referring_domain:Re!=null&&Re.referrer&&((t=Fc(Re.referrer))==null?void 0:t.host)||Wc},void 0)}set_initial_person_info(){this.props[jf]||this.props[Nf]||this.register_once({[Hc]:Zb(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={};Tt([Nf,jf],(l=>{var d=this.props[l];d&&Tt(d,(function(v,c){t["$initial_"+uf(c)]=v}))}));var n=this.props[Hc];if(n){var a=(function(l,d){d===void 0&&(d=!1);var v=Qb(l,d),c={};return Tt(v,(function(u,p){c["$initial_"+uf(p)]=u})),c})(n,this.Te.disable_capture_url_hashes);Dt(t,a)}return t}safe_merge(t){return Tt(this.props,(function(n,a){a in t||(t[a]=n)})),t}update_config(t,n,a){this.Dr=this.Ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var l=t.persistence!==n.persistence||!((u,p)=>{if(u.length!==p.length)return!1;var y=[...u].sort(),f=[...p].sort();return y.every(((w,E)=>w===f[E]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),d=l?this.pr(t):this.Je,v=this.gr(t);if(l||v!==this.hr){var c=this.props;this.clear(),this.Je=d,this.hr=v,this.props=c,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 a=this.props[Co]||{};a[t]=n,this.Ir(Co,a),this.save()}remove_event_timer(t){var n=this.props[Co]||{},a=n[t];return ke(a)||(delete n[t],this.Ir(Co,n),this.save()),a}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var a;this.props[t]=n,(a=nr(t))!=null&&a.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var n,a=(n=nr(t))==null?void 0:n.storageGroup;a&&(this.kr(a).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function dc(s){var t=!0;return{dispose(){if(t){t=!1;var n=s();n&&Js(n.then)&&n.then(void 0,(()=>{}))}}}}var Rs={GZipJS:"gzip-js",Base64:"base64"},vo={Activation:"events",Cancellation:"cancelEvents"},$d={Popover:"popover",API:"api",Widget:"widget"},on={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Pd={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Hf={Popover:"popover",Inline:"inline"},X4={SHOWN:"product tour shown"},R0={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},M0=$t("[RateLimiter]");class K4{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var a=n.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((l=>{M0.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void M0.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:a})}},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,a,l;t===void 0&&(t=!1);var d=this.captureEventsBurstLimit,v=this.captureEventsPerSecond,c=new Date().getTime(),u=(n=(a=this.instance.persistence)==null?void 0:a.get_property(Df))!==null&&n!==void 0?n:{tokens:d,last:c};u.tokens+=(c-u.last)/1e3*v,u.last=c,u.tokens>d&&(u.tokens=d);var p=1>u.tokens;return p||t||(u.tokens=Math.max(0,u.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+v+" events per second and "+d+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(l=this.instance.persistence)==null||l.set_property(Df,u),{isRateLimited:p,remainingTokens:u.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var rr=$t("[RemoteConfig]");class t1{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Ie._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,a;(n=Ie.__PosthogExtensions__)!=null&&n.loadExternalDependency?(a=Ie.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.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 rr.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void rr.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return rr.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){rr.error("Error loading remote config",t),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Re&&Re.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||rr.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(t?{ok:!0,config:t}:{ok:!1})}catch(a){rr.error("Error applying remote config",a)}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(a){rr.error("Error loading feature flags",a)}}}var _i=Uint8Array,Ps=Uint16Array,ma=Uint32Array,mp=new _i([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]),gp=new _i([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]),D0=new _i([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s1=function(s,t){for(var n=new Ps(31),a=0;31>a;++a)n[a]=t+=1<<s[a-1];var l=new ma(n[30]);for(a=1;30>a;++a)for(var d=n[a];n[a+1]>d;++d)l[d]=d-n[a]<<5|a;return[n,l]},i1=s1(mp,2),zf=i1[1];i1[0][28]=258,zf[258]=28;for(var j0=s1(gp,0)[1],n1=new Ps(32768),It=0;32768>It;++It){var Qr=(43690&It)>>>1|(21845&It)<<1;n1[It]=((65280&(Qr=(61680&(Qr=(52428&Qr)>>>2|(13107&Qr)<<2))>>>4|(3855&Qr)<<4))>>>8|(255&Qr)<<8)>>>1}var jo=function(s,t,n){for(var a=s.length,l=0,d=new Ps(t);a>l;++l)++d[s[l]-1];var v,c=new Ps(t);for(l=0;t>l;++l)c[l]=c[l-1]+d[l-1]<<1;for(v=new Ps(a),l=0;a>l;++l)v[l]=n1[c[s[l]-1]++]>>>15-s[l];return v},_r=new _i(288);for(It=0;144>It;++It)_r[It]=8;for(It=144;256>It;++It)_r[It]=9;for(It=256;280>It;++It)_r[It]=7;for(It=280;288>It;++It)_r[It]=8;var Gc=new _i(32);for(It=0;32>It;++It)Gc[It]=5;var J4=jo(_r,9),Z4=jo(Gc,5),r1=function(s){return(s/8>>0)+(7&s&&1)},a1=function(s,t,n){(n==null||n>s.length)&&(n=s.length);var a=new(s instanceof Ps?Ps:s instanceof ma?ma:_i)(n-t);return a.set(s.subarray(t,n)),a},Zi=function(s,t,n){var a=t/8>>0;s[a]|=n<<=7&t,s[a+1]|=n>>>8},_o=function(s,t,n){var a=t/8>>0;s[a]|=n<<=7&t,s[a+1]|=n>>>8,s[a+2]|=n>>>16},Ud=function(s,t){for(var n=[],a=0;s.length>a;++a)s[a]&&n.push({s:a,f:s[a]});var l=n.length,d=n.slice();if(!l)return[new _i(0),0];if(l==1){var v=new _i(n[0].s+1);return v[n[0].s]=1,[v,1]}n.sort((function(R,M){return R.f-M.f})),n.push({s:-1,f:25001});var c=n[0],u=n[1],p=0,y=1,f=2;for(n[0]={s:-1,f:c.f+u.f,l:c,r:u};y!=l-1;)c=n[n[f].f>n[p].f?p++:f++],u=n[p!=y&&n[f].f>n[p].f?p++:f++],n[y++]={s:-1,f:c.f+u.f,l:c,r:u};var w=d[0].s;for(a=1;l>a;++a)d[a].s>w&&(w=d[a].s);var E=new Ps(w+1),A=If(n[y-1],E,0);if(A>t){a=0;var C=0,b=A-t,S=1<<b;for(d.sort((function(R,M){return E[M.s]-E[R.s]||R.f-M.f}));l>a;++a){var _=d[a].s;if(t>=E[_])break;C+=S-(1<<A-E[_]),E[_]=t}for(C>>>=b;C>0;){var g=d[a].s;t>E[g]?C-=1<<t-E[g]++-1:++a}for(;a>=0&&C;--a){var T=d[a].s;E[T]==t&&(--E[T],++C)}A=t}return[new _i(E),A]},If=function(s,t,n){return s.s==-1?Math.max(If(s.l,t,n+1),If(s.r,t,n+1)):t[s.s]=n},N0=function(s){for(var t=s.length;t&&!s[--t];);for(var n=new Ps(++t),a=0,l=s[0],d=1,v=function(u){n[a++]=u},c=1;t>=c;++c)if(s[c]==l&&c!=t)++d;else{if(!l&&d>2){for(;d>138;d-=138)v(32754);d>2&&(v(d>10?d-11<<5|28690:d-3<<5|12305),d=0)}else if(d>3){for(v(l),--d;d>6;d-=6)v(8304);d>2&&(v(d-3<<5|8208),d=0)}for(;d--;)v(l);d=1,l=s[c]}return[n.subarray(0,a),t]},mo=function(s,t){for(var n=0,a=0;t.length>a;++a)n+=s[a]*t[a];return n},$f=function(s,t,n){var a=n.length,l=r1(t+2);s[l]=255&a,s[l+1]=a>>>8,s[l+2]=255^s[l],s[l+3]=255^s[l+1];for(var d=0;a>d;++d)s[l+d+4]=n[d];return 8*(l+4+a)},L0=function(s,t,n,a,l,d,v,c,u,p,y){Zi(t,y++,n),++l[256];for(var f=Ud(l,15),w=f[0],E=f[1],A=Ud(d,15),C=A[0],b=A[1],S=N0(w),_=S[0],g=S[1],T=N0(C),R=T[0],M=T[1],j=new Ps(19),k=0;_.length>k;++k)j[31&_[k]]++;for(k=0;R.length>k;++k)j[31&R[k]]++;for(var D=Ud(j,7),B=D[0],I=D[1],q=19;q>4&&!B[D0[q-1]];--q);var $,J,ee,W,G=p+5<<3,Y=mo(l,_r)+mo(d,Gc)+v,O=mo(l,w)+mo(d,C)+v+14+3*q+mo(j,B)+(2*j[16]+3*j[17]+7*j[18]);if(Y>=G&&O>=G)return $f(t,y,s.subarray(u,u+p));if(Zi(t,y,1+(Y>O)),y+=2,Y>O){$=jo(w,E),J=w,ee=jo(C,b),W=C;var F=jo(B,I);for(Zi(t,y,g-257),Zi(t,y+5,M-1),Zi(t,y+10,q-4),y+=14,k=0;q>k;++k)Zi(t,y+3*k,B[D0[k]]);y+=3*q;for(var L=[_,R],P=0;2>P;++P){var V=L[P];for(k=0;V.length>k;++k)Zi(t,y,F[te=31&V[k]]),y+=B[te],te>15&&(Zi(t,y,V[k]>>>5&127),y+=V[k]>>>12)}}else $=J4,J=_r,ee=Z4,W=Gc;for(k=0;c>k;++k)if(a[k]>255){var te;_o(t,y,$[257+(te=a[k]>>>18&31)]),y+=J[te+257],te>7&&(Zi(t,y,a[k]>>>23&31),y+=mp[te]);var de=31&a[k];_o(t,y,ee[de]),y+=W[de],de>3&&(_o(t,y,a[k]>>>5&8191),y+=gp[de])}else _o(t,y,$[a[k]]),y+=J[a[k]];return _o(t,y,$[256]),y+J[256]},Q4=new ma([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eT=(function(){for(var s=new ma(256),t=0;256>t;++t){for(var n=t,a=9;--a;)n=(1&n&&3988292384)^n>>>1;s[t]=n}return s})(),Fd=function(s,t,n){for(;n;++t)s[t]=n,n>>>=8};function tT(s,t){t===void 0&&(t={});var n=(function(){var f=4294967295;return{p(w){for(var E=f,A=0;w.length>A;++A)E=eT[255&E^w[A]]^E>>>8;f=E},d(){return 4294967295^f}}})(),a=s.length;n.p(s);var l,d,v,c,u,p=(c=10+((l=t).filename&&l.filename.length+1||0),u=8,(function(f,w,E,A,C,b){var S=f.length,_=new _i(A+S+5*(1+Math.floor(S/7e3))+C),g=_.subarray(A,_.length-C),T=0;if(!w||8>S)for(var R=0;S>=R;R+=65535){var M=R+65535;S>M?T=$f(g,T,f.subarray(R,M)):(g[R]=!0,T=$f(g,T,f.subarray(R,S)))}else{for(var j=Q4[w-1],k=j>>>13,D=8191&j,B=(1<<E)-1,I=new Ps(32768),q=new Ps(B+1),$=Math.ceil(E/3),J=2*$,ee=function(ct){return(f[ct]^f[ct+1]<<$^f[ct+2]<<J)&B},W=new ma(25e3),G=new Ps(288),Y=new Ps(32),O=0,F=0,L=(R=0,0),P=0,V=0;S>R;++R){var te=ee(R),de=32767&R,ge=q[te];if(I[de]=ge,q[te]=de,R>=P){var K=S-R;if((O>7e3||L>24576)&&K>423){T=L0(f,g,0,W,G,Y,F,L,V,R-V,T),L=O=F=0,V=R;for(var z=0;286>z;++z)G[z]=0;for(z=0;30>z;++z)Y[z]=0}var ie=2,Q=0,we=D,fe=de-ge&32767;if(K>2&&te==ee(R-fe))for(var Le=Math.min(k,K)-1,ze=Math.min(32767,R),We=Math.min(258,K);ze>=fe&&--we&&de!=ge;){if(f[R+ie]==f[R+ie-fe]){for(var Ge=0;We>Ge&&f[R+Ge]==f[R+Ge-fe];++Ge);if(Ge>ie){if(ie=Ge,Q=fe,Ge>Le)break;var De=Math.min(fe,Ge-2),dt=0;for(z=0;De>z;++z){var At=R-fe+z+32768&32767,qt=At-I[At]+32768&32767;qt>dt&&(dt=qt,ge=At)}}}fe+=(de=ge)-(ge=I[de])+32768&32767}if(Q){W[L++]=268435456|zf[ie]<<18|j0[Q];var jt=31&zf[ie],Nt=31&j0[Q];F+=mp[jt]+gp[Nt],++G[257+jt],++Y[Nt],P=R+ie,++O}else W[L++]=f[R],++G[f[R]]}}T=L0(f,g,!0,W,G,Y,F,L,V,R-V,T)}return a1(_,0,A+r1(T)+C)})(d=s,(v=t).level==null?6:v.level,v.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(d.length)))):12+v.mem,c,u)),y=p.length;return(function(f,w){var E=w.filename;if(f[0]=31,f[1]=139,f[2]=8,f[8]=2>w.level?4:w.level==9?2:0,f[9]=3,w.mtime!=0&&Fd(f,4,Math.floor(new Date(w.mtime||Date.now())/1e3)),E){f[3]=8;for(var A=0;E.length>=A;++A)f[A+10]=E.charCodeAt(A)}})(p,t),Fd(p,y-8,n.d()),Fd(p,y-4,a),p}var sT=!!of||!!ip,o1="text/plain",Cc=!1,l1=(s,t)=>{var n=s.split("#"),a=n[1],l=n[0].split("?"),d=l[0],v=l[1];if(!v)return s;var c=v.split("&").filter((u=>u.split("=")[0]!==t)).join("&");return d+(c?"?"+c:"")+(a?"#"+a:"")},su=function(s,t,n){var a;n===void 0&&(n=!0);var l=s.split("?"),d=l[0],v=l[1],c=be({},t),u=(a=v==null?void 0:v.split("&").map((y=>{var f,w=y.split("="),E=w[0],A=n&&(f=c[E])!==null&&f!==void 0?f:w[1];return delete c[E],E+"="+A})))!==null&&a!==void 0?a:[],p=(function(y,f){var w,E;f===void 0&&(f="&");var A=[];return Tt(y,(function(C,b){ke(C)||ke(b)||b==="undefined"||(w=encodeURIComponent((S=>S instanceof File)(C)?C.name:C.toString()),E=encodeURIComponent(b),A[A.length]=E+"="+w)})),A.join(f)})(c);return p&&u.push(p),u.length>0?d+"?"+u.join("&"):d},qd=s=>{if(s.Vr)return s.Vr;var t=s.data,n=s.compression;if(t){if(n===Rs.GZipJS){var a=tT((function(c,u){var p=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var y=new _i(c.length+(c.length>>>1)),f=0,w=function(b){y[f++]=b},E=0;p>E;++E){if(f+5>y.length){var A=new _i(f+8+(p-E<<1));A.set(y),y=A}var C=c.charCodeAt(E);128>C?w(C):2048>C?(w(192|C>>>6),w(128|63&C)):C>55295&&57344>C?(w(240|(C=65536+(1047552&C)|1023&c.charCodeAt(++E))>>>18),w(128|C>>>12&63),w(128|C>>>6&63),w(128|63&C)):(w(224|C>>>12),w(128|C>>>6&63),w(128|63&C))}return a1(y,0,f)})(ra(t)),{mtime:0});return{contentType:o1,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Rs.Base64){var l=(function(c){return c&&btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,((u,p)=>String.fromCharCode(parseInt(p,16)))))})(ra(t)),d=(c=>"data="+encodeURIComponent(typeof c=="string"?c:ra(c)))(l);return{contentType:"application/x-www-form-urlencoded",body:d,estimatedSize:new Blob([d]).size}}var v=ra(t);return{contentType:"application/json",body:v,estimatedSize:new Blob([v]).size}}},c1=s=>{var t,n,a=()=>s.transport==="sendBeacon"?{url:su(s.url,{compression:Rs.Base64}),encodedBody:qd(be({},s,{compression:Rs.Base64,Vr:void 0}))}:{url:l1(s.url,"compression"),encodedBody:qd(be({},s,{compression:void 0,Vr:void 0}))};try{t=qd(s)}catch(l){if(t0(s.compression,va(s.url,"compression")))return Te.error("Failed to gzip request body, sending uncompressed payload",l),a();throw l}return t&&t0(s.compression,va(s.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?lf(new Uint8Array(n)):ArrayBuffer.isView(n)&&lf(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Cc=!0,a()):{url:s.url,encodedBody:t}},u1=s=>{try{return c1(s)}catch(t){return Te.error(t),void(s.callback==null||s.callback({statusCode:0,error:t}))}},iT=(function(){var s=zt((function*(t){var n=ra(t.data),a=yield(function(d,v,c){return cf.apply(this,arguments)})(n,gt.DEBUG,{rethrow:!0});if(!a)return t;var l=yield a.arrayBuffer();return be({},t,{Vr:{contentType:o1,body:l,estimatedSize:l.byteLength}})}));return function(t){return s.apply(this,arguments)}})(),nT=/Failed to fetch|NetworkError|Load failed/i,h1=s=>{var t=u1(s);if(t){var n=t.url,a=t.encodedBody,l=a??{},d=l.contentType,v=l.body,c=l.estimatedSize,u=new Headers;Tt(s.headers,(function(A,C){u.append(C,A)})),d&&u.append("Content-Type",d);var p=null,y=!1;if(Xg){var f=new Xg;p={signal:f.signal,timeout:setTimeout((()=>{var A,C;y=!0,f.abort((A=s.timeout,(C=new Error("PostHog request timed out"+(A?" after "+A+"ms":""))).name="AbortError",C))}),s.timeout)}}var w=A=>{y&&(A==null?void 0:A.name)==="AbortError"||(C=>(C==null?void 0:C.name)==="TypeError"&&nT.test((C==null?void 0:C.message)||""))(A)?Te.warn(A):Te.error(A),s.callback==null||s.callback({statusCode:0,error:A})};try{var E;ip(n,be({method:(s==null?void 0:s.method)||"GET",headers:u,keepalive:s.method==="POST"&&!s.Wr&&52428.8>(c||0),body:v,signal:(E=p)==null?void 0:E.signal},s.fetchOptions)).then((A=>A.text().then((C=>{var b={statusCode:A.status,text:C};if(A.status===200)try{b.json=JSON.parse(C)}catch(S){Te.error(S)}s.callback==null||s.callback(b)})))).catch(w).finally((()=>p?clearTimeout(p.timeout):null))}catch(A){p&&clearTimeout(p.timeout),w(A)}}},Pf=s=>{try{var t,n=c1(s),a=n.url,l=n.encodedBody,d=l??{},v=d.body,c=d.estimatedSize;if(!v)return;var u=v instanceof Blob?v:new Blob([v],{type:d.contentType});if(Ms.sendBeacon(a,u))return;var p=Ve(s.data)?s.data:(t=s.data)==null?void 0:t.batch;if(Ve(p)&&p.length>1&&(c??0)>16384){var y=Math.ceil(p.length/2),f=w=>Ve(s.data)?w:be({},s.data,{batch:w});return Pf(be({},s,{data:f(p.slice(0,y))})),void Pf(be({},s,{data:f(p.slice(y))}))}Te.warn("Beacon of ~"+(c??0)+" bytes was rejected by the browser, falling back to fetch"),h1(be({},s,{Wr:!0}))}catch(w){Te.warn("Beacon send failed",w)}},O0=(s,t,n,a)=>{var l=a==="query"?t==="POST"?"sent_at":"_":void 0;return su(n===Rs.GZipJS?l1(s,"compression"):s,be({},l?{[l]:Date.now().toString()}:{},n===Rs.GZipJS?{}:{compression:n}))},Ec=[];ip&&Ec.push({transport:"fetch",method:h1}),of&&Ec.push({transport:"XHR",method(s){var t=u1(s);if(t){var n=new of,a=t.encodedBody;n.open(s.method||"GET",t.url,!0);var l=a??{},d=l.contentType,v=l.body;Tt(s.headers,(function(c,u){n.setRequestHeader(u,c)})),d&&n.setRequestHeader("Content-Type",d),s.timeout&&(n.timeout=s.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var c={statusCode:n.status,text:n.responseText};if(n.status===200)try{c.json=JSON.parse(n.responseText)}catch{}s.callback==null||s.callback(c)}},n.send(v)}}}),Ms!=null&&Ms.sendBeacon&&Ec.push({transport:"sendBeacon",method:Pf});var Uf=3e3;class rT{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=Di((n==null?void 0:n.flush_interval_ms)||Uf,250,5e3,Te.createLogger("flush interval"),Uf),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((a=>a.url.indexOf("/e")===0)),...n.filter((a=>a.url.indexOf("/e")!==0))].map((a=>{this.ei(be({},a,{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(),a=function(){var d=n[l],v=new Date().getTime();d.data&&Ve(d.data)&&Tt(d.data,(c=>{c.offset=Math.abs(c.timestamp-v),delete c.timestamp})),t.ei(d)};for(var l in n)a()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(n){Te.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return Tt(this.Gr,(n=>{var a,l=n,d=(l?l.batchKey:null)||l.url;ke(t[d])&&(t[d]=be({},l,{data:[]})),(a=t[d].data)==null||a.push(l.data)})),this.Gr=[],t}}var aT=["retriesPerformedSoFar"];class oT{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!ke(ce)&&"onLine"in ce.navigator&&(this.ni=ce.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},Ft(ce,"online",this.si),Ft(ce,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,a=Py(t,aT);en(n)&&(a.url=su(a.url,{retry_count:n})),this._instance._send_request(be({},a,{callback:l=>{if(l.statusCode!==200&&(400>l.statusCode||l.statusCode>=500)){if((l.statusCode===0?3:10)>(n??0))return void this.Ot(be({retriesPerformedSoFar:n},a));l.statusCode===0&&Te.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.")}a.callback==null||a.callback(l)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var a=(function(v){var c=3e3*Math.pow(2,v),u=c/2,p=Math.min(18e5,c),y=Math.random()-.5;return Math.ceil(p+y*(p-u))})(n),l=Date.now()+a;this.Gr.push({retryAt:l,requestOptions:t});var d="Enqueued failed request for retry in "+a;navigator.onLine||(d+=" (Browser is offline)"),Te.warn(d),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=[],a=this.Gr.filter((d=>t>d.retryAt||(n.push(d),!1)));if(this.Gr=n,a.length>0)for(var l of a)this.retriableRequest(l.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,ke(ce)||(this.si&&(ce.removeEventListener("online",this.si),this.si=void 0),this.ai&&(ce.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(be({},n,{transport:"sendBeacon"}))}catch(a){Te.error(a)}}this.Gr=[]}}class lT{constructor(t){this.hi=()=>{var n,a,l,d;this.di||(this.di={});var v=this.scrollElement(),c=this.scrollY(),u=v?Math.max(0,v.scrollHeight-v.clientHeight):0,p=c+((v==null?void 0:v.clientHeight)||0),y=(v==null?void 0:v.scrollHeight)||0;this.di.lastScrollY=Math.ceil(c),this.di.maxScrollY=Math.max(c,(n=this.di.maxScrollY)!==null&&n!==void 0?n:0),this.di.maxScrollHeight=Math.max(u,(a=this.di.maxScrollHeight)!==null&&a!==void 0?a:0),this.di.lastContentY=p,this.di.maxContentY=Math.max(p,(l=this.di.maxContentY)!==null&&l!==void 0?l:0),this.di.maxContentHeight=Math.max(y,(d=this.di.maxContentHeight)!==null&&d!==void 0?d: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(){Ft(ce,"scroll",this.hi,{capture:!0}),Ft(ce,"scrollend",this.hi,{capture:!0}),Ft(ce,"resize",this.hi)}scrollElement(){if(!this.ci)return ce==null?void 0:ce.document.documentElement;var t=Ve(this.ci)?this.ci:[this.ci];for(var n of t){var a=ce==null?void 0:ce.document.querySelector(n);if(a)return a}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var a=this.scrollElement();return a&&a[n]||0}return ce?t==="y"?ce.scrollY||ce.pageYOffset||ce.document.documentElement.scrollTop||0:ce.scrollX||ce.pageXOffset||ce.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var cT=s=>Zb(s==null?void 0:s.config.mask_personal_data_properties,s==null?void 0:s.config.custom_personal_data_properties,s==null?void 0:s.config.disable_capture_url_hashes);class B0{constructor(t,n,a,l){this.fi=d=>{var v=this.pi();if(!v||v.sessionId!==d){var c={sessionId:d,props:this.gi(this._instance)};this.mi.register({[Mf]:c})}},this._instance=t,this.yi=n,this.mi=a,this.gi=l||cT,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Mf]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?Qb(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 Tt(fp(this.getSetOnceProps()),((n,a)=>{a==="$current_url"&&(a="url"),t["$session_entry_"+uf(a)]=n})),t}}class yp{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((a=>a!==n))}}emit(t,n){for(var a of this.bi[t]||[])a(n);for(var l of this.bi["*"]||[])l(t,n)}constructor(){this.bi={}}}var go=$t("[SessionId]");class H0{on(t,n){return this.wi.on(t,n)}constructor(t,n,a){var l;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new yp,this.Mi=(p,y)=>!(!en(p)||!en(y))&&Math.abs(p-y)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===rn)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||nn,this.Ri=a||nn;var d=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Di(this.Te.session_idle_timeout_seconds||1800,60,36e3,go.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+d+"_window_id",this.Fi="ph_"+d+"_primary_window_exists",this.Ai()){var v=gs.F(this.Oi),c=gs.F(this.Fi);v&&!c?this.Ii=v:gs.D(this.Oi),gs.A(this.Fi,!0)}if((l=this.Te.bootstrap)!=null&&l.sessionID)try{var u=(p=>{var y=this.Te.bootstrap.sessionID.replace(/-/g,"");if(y.length!==32)throw new Error("Not a valid UUID");if(y[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(y.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(p){go.error("Invalid sessionID in bootstrap",p)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ke(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&&gs.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&gs.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?gs.F(this.Oi):null}qi(t){var n=this.xi;return!Ds(n)&&!Ds(t)&&5e3>Math.abs(t-n)}$i(t,n,a){var l=n!==this._sessionActivityTimestamp,d=!(t!==this.Ti||a!==this._sessionStartTimestamp);this._sessionStartTimestamp=a,this._sessionActivityTimestamp=n,this.Ti=t,d&&!l||d&&this.qi(n)||(this.xi=n,this.mi.register({[na]:[n,t,a]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return en(n)&&n>0}Bi(){this.ji()?this.mi.refreshKey(na):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!Ds(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({[na]:[this._sessionActivityTimestamp,(t=this.Ti)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=en(t)?t:0,a=en(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,a)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[na];return Ve(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&&ce&&(ce.removeEventListener($c,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&gs.D(this.Fi)},Ft(ce,$c,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===rn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),l=this.Ui(),d=l[1],v=l[2],c=this.zi(),u=this.Ni(),p=en(v)&&Math.abs(a-v)>864e5,y=!1,f=!1,w=!d,E=d,A=!w&&!t&&this.Mi(a,c);if(A){(A=this.Vi(a))||go.info("cross-tab refresh kept the session alive",{sessionId:d});var C=this.Ui();d=C[1],v=C[2]}w||A||p?(d=this.Ei(),u=this.Ri(),go.info("new session ID generated",{sessionId:d,windowId:u,changeReason:{noSessionId:w,activityTimeout:A,sessionPastMaximumLength:p}}),v=a,y=!0):(u||(u=this.Ri(),y=!0),(f=d!==E)&&(go.info("adopted cross-tab session id",{sessionId:d,windowId:u}),y=!0));var b=en(c)&&t&&!p?c:a,S=en(v)?v:new Date().getTime();this.Di(u),this.$i(d,b,S),t||this.Pi();var _={noSessionId:w,activityTimeout:A,sessionPastMaximumLength:p,crossTabAdoption:f};return y&&this.ki.forEach((g=>g(d,u,_))),{sessionId:d,windowId:u,sessionStartTimestamp:S,changeReason:y?_:void 0,lastActivityTimestamp:c}}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 d1=function(s,t){if(!s)return!1;var n=s.userAgent;if(n&&i0(n,t))return!0;try{var a=s==null?void 0:s.userAgentData;if(a!=null&&a.brands&&a.brands.some((l=>i0(l==null?void 0:l.brand,t))))return!0}catch{}return!!s.webdriver};function f1(){return(f1=zt((function*(){var s=Ms==null?void 0:Ms.userAgentData;if(s!=null&&s.getHighEntropyValues)try{var t=yield s.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return kt(n)&&n.length>0?n:void 0}catch(a){return void Te.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",a)}}))).apply(this,arguments)}var Vc=function(s,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(s)}catch{return!1}};function Wd(s,t,n){return ra({distinct_id:s,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var p1={exact:(s,t)=>t.some((n=>s.some((a=>n===a)))),is_not:(s,t)=>t.every((n=>s.every((a=>n!==a)))),regex:(s,t)=>t.some((n=>s.some((a=>Vc(n,a))))),not_regex:(s,t)=>t.every((n=>s.every((a=>!Vc(n,a))))),icontains:(s,t)=>t.map(fc).some((n=>s.map(fc).some((a=>n.includes(a))))),not_icontains:(s,t)=>t.map(fc).every((n=>s.map(fc).every((a=>!n.includes(a))))),gt:(s,t)=>t.some((n=>{var a=parseFloat(n);return!isNaN(a)&&s.some((l=>a>parseFloat(l)))})),lt:(s,t)=>t.some((n=>{var a=parseFloat(n);return!isNaN(a)&&s.some((l=>a<parseFloat(l)))}))},fc=s=>s.toLowerCase();function v1(s,t){return!s||Object.entries(s).every((n=>{var a=n[1],l=t==null?void 0:t[n[0]];if(ke(l)||Ds(l))return!1;var d=[String(l)],v=p1[a.operator];return!!v&&v(a.values,d)}))}var Ff="custom",z0="i.posthog.com",uT=/^\/static\//;class hT{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("."+z0,".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":Ff),this.Zi[this.apiHost]}Gi(t){if(uT.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 a=this.Gi(n);if(a)return""+a+n}if(this.region===Ff)return this.apiHost+n;var l=z0+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}function _1(s){var t;return!((t=s.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var St=$t("[Surveys]"),m1="seenSurvey_",g1=s=>{try{var t=(n=>((a,l)=>""+m1+(function(d){return d.current_iteration&&d.current_iteration>0?d.id+"_"+d.current_iteration:d.id})(l))(0,n))(s);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){St.error("Failed to persist survey seen state",n)}},dT=[$d.Popover,$d.Widget,$d.API],fT={ignoreConditions:!1,ignoreDelay:!1,displayType:Hf.Popover},pT=$t("[PostHog ExternalIntegrations]"),vT={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class _T{constructor(t){this._instance=t}tr(t,n){var a;(a=Ie.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,t,(l=>{if(l)return pT.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var d,v,c,u=a[0],p=a[1];!p||(d=Ie.__PosthogExtensions__)!=null&&(d=d.integrations)!=null&&d[u]||t.tr(vT[u],(()=>{var y;(y=Ie.__PosthogExtensions__)==null||(y=y.integrations)==null||(y=y[u])==null||y.start(t._instance)})),!p&&(v=Ie.__PosthogExtensions__)!=null&&(v=v.integrations)!=null&&v[u]&&((c=Ie.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[u])==null||c.stop())};for(var a of Object.entries((l=this._instance.config.integrations)!==null&&l!==void 0?l:{})){var l;n()}}}class mT{constructor(t,n){this.it=t,this.Qi=n,this.Ji=new Map,this.Ki=!1}add(t){var n=this;return zt((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 a=t.setup(n.Qi);a&&(yield a)}catch(d){var l=n.Ji.get(t.name)===t;l&&n.Ji.delete(t.name),n.it.error('Failed to set up browser extension "'+t.name+'"',d),l&&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&&Js(n.then)&&n.then(void 0,(a=>{this.it.error('Failed to dispose browser extension "'+t.name+'"',a)}))}catch(a){this.it.error('Failed to dispose browser extension "'+t.name+'"',a)}}}class gT{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 a;(a=this._instance.persistence)==null||a.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var I0="extensionsRemoteConfig";class yT{constructor(t){this.Ki=!1,this.instance=t,this.it=Te.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new gT(t),this.onEvent=n=>dc(this.instance.on("eventCaptured",(a=>{try{n({event:a.event,properties:a.properties})}catch(l){this.it.error("Browser extension event listener failed",l)}}))),this.onRemoteConfig=n=>{if(this.Ki)return dc((()=>{}));var a=d=>{try{n(d)}catch(v){this.it.error("Browser extension remote config listener failed",v)}},l=this.instance.en.on(I0,a);return this.Xi&&a(this.Xi),dc(l)},this.rn=new mT(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($o))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,a,l,d=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=d==null?void 0:d.sessionId)!==null&&n!==void 0?n:"",windowId:(a=d==null?void 0:d.windowId)!==null&&a!==void 0?a:"",sessionStartTimestamp:(l=d==null?void 0:d.sessionStartTimestamp)!==null&&l!==void 0?l:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.rn.add(t)}capture(t,n,a){var l=this;return zt((function*(){a?l.instance.capture(t,n,{timestamp:a.timestamp,uuid:a.uuid,$set:a.set,$set_once:a.setOnce}):l.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return dc(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(I0,t))}sendRequest(t,n){var a=this;return zt((function*(){var l;n===void 0&&(n={});var d=a.instance.requestRouter.endpointFor((l=n.target)!==null&&l!==void 0?l:"api",t),v={method:n.method,url:n.query?su(d,n.query):d,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(a.instance._send_request(v),{statusCode:202}):new Promise((c=>{v.callback=c,a.instance._send_request(v)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var No={},Gd=0,Yc=()=>{},$0='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',yo="Surveys module not available",P0="sanitize_properties is deprecated. Use before_send instead",y1="Invalid value for property_denylist config: ",bT=["token","distinct_id",kb],ia="posthog",b1=!sT&&($s==null?void 0:$s.indexOf("MSIE"))===-1&&($s==null?void 0:$s.indexOf("Mozilla"))===-1,Vd=s=>{var t;return be({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:S4(Re==null?void 0:Re.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Yc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:s??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Qt&&kt(Qt==null?void 0:Qt.search)&&Qt.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:(ce==null||(t=ce.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){Te.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:Lf,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Uf},error_tracking:{},_onCapture:Yc},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:N4,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)}))(s))},ST=[["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"]],U0=s=>{var t={};for(var n of ST){var a=n[0],l=n[1];ke(s[a])||(t[l]=s[a])}var d=Dt({},t,s),v=s.__preview_external_dependency_versioned_paths;return ke(v)||(ke(s.strict_script_versioning)&&(d.strict_script_versioning=!!v),kt(v)&&ke(s.asset_host)&&(d.asset_host=v)),Ve(s.property_blacklist)&&(ke(s.property_denylist)?d.property_denylist=s.property_blacklist:Ve(s.property_denylist)?d.property_denylist=[...s.property_blacklist,...s.property_denylist]:Te.error(y1+s.property_denylist)),d};class wT{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){Te.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class pi{an(t,n){if(t){var a=this.Ji.indexOf(t);a!==-1&&this.Ji.splice(a,1)}return this.Ji.push(n),n.initialize==null||n.initialize(),n}ln(){return this.config.cookieless_mode===rn||this.config.cookieless_mode===hr&&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 wT,this.un=!1,this.version=gt.LIB_VERSION,this.en=new yp,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Vd(),this.SentryIntegration=P4,this.sentryIntegration=a=>(function(l,d){var v=Wb(l,d);return{name:qb,processEvent:c=>v(c)}})(this,a),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dn=!1,this.cn=null,this.vn=null,this.fn=null,this.scrollManager=new lT(this),this.pageViewManager=new T0(this),this.rateLimiter=new K4(this),this.requestRouter=new hT(this),this.consent=new A4(this),this.externalIntegrations=new _T(this);var n=(t=pi.__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:(a,l,d)=>{var v=kt(a)?{[a]:l}:a;this.setPersonProperties(v),d==null||d({})},set_once:(a,l,d)=>{var v=kt(a)?{[a]:l}:a;this.setPersonProperties(void 0,v),d==null||d({})}},this.on("eventCaptured",(a=>Te.info('send "'+(a==null?void 0:a.event)+'"',a)))}init(t,n,a){if(a&&a!==ia){var l,d=(l=No[a])!==null&&l!==void 0?l:new pi;return d._init(t,n,a),No[a]=d,No[ia][a]=d,d}return this._init(t,n,a)}_init(t,n,a){var l,d;n===void 0&&(n={});var v=kt(t)?t.trim():"";if(!v)return Te.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=Vd(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 c=Vd(n.defaults),u=U0(n),p=Dt({},c,u,{name:a,token:v});Ht(c.rageclick)&&Ht(u.rageclick)&&(p.rageclick=Dt({},c.rageclick,u.rageclick)),Ht(c.session_recording)&&Ht(u.session_recording)&&(p.session_recording=Dt({},c.session_recording,u.session_recording)),this.set_config(p),this.config.on_xhr_error&&Te.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Rs.GZipJS;var y=this.yn();this.persistence=new Id(this.config,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Id(be({},this.config,{persistence:"sessionStorage"}),y,!1);var f=be({},this.persistence.props),w=be({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new rT((T=>this._n(T)),this.config.request_queue_config),this.wn=new oT(this),this.__request_queue=[];var E=this.ln();if(E||(this.sessionManager=new H0(this),this.sessionPropsManager=new B0(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Te.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(E)}),0)):(Te.info("Initializing extensions synchronously"),this.xn(E)),gt.DEBUG=gt.DEBUG||this.config.debug,gt.DEBUG&&Te.info("Starting in debug mode",{this:this,config:n,thisC:be({},this.config),p:f,s:w}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=be({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((d=n.bootstrap)==null?void 0:d.distinctID)!==void 0){var A=n.bootstrap.distinctID,C=this.get_distinct_id(),b=this.persistence.get_property(di);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==A&&b===Jr)this.identify(A);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==A&&b===sr)Te.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 S=this.config.get_device_id(nn()),_=n.bootstrap.isIdentifiedID?S:A;this.persistence.set_property(di,n.bootstrap.isIdentifiedID?sr:Jr),this.register({distinct_id:A,$device_id:_})}}if(E)this.register_once({distinct_id:oc,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(nn());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(di,Jr)}return Ft(ce,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(T,R){var M=T.config.segment;if(!M)return R();(function(j,k){var D=j.config.segment;if(!D)return k();var B=q=>{var $=()=>q.anonymousId()||nn();j.config.get_device_id=$,q.id()&&(j.register({distinct_id:q.id(),$device_id:$()}),j.persistence.set_property(di,sr)),k()},I=D.user();"then"in I&&Js(I.then)?I.then(B):B(I)})(T,(()=>{M.register((j=>{typeof Promise<"u"&&Promise.resolve||Hd.warn("This browser does not have Promise support, and can not use the segment integration");var k=(D,B)=>{if(!B)return D;D.event.userId||D.event.anonymousId===j.get_distinct_id()||(Hd.info("No userId set, resetting PostHog"),j.reset()),D.event.userId&&D.event.userId!==j.get_distinct_id()&&(Hd.info("UserId set, identifying with PostHog"),j.identify(D.event.userId));var I=j.calculateEventProperties(B,D.event.properties);return D.event.properties=Object.assign({},I,D.event.properties),D};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:D=>k(D,D.event.event),page:D=>k(D,sa),identify:D=>k(D,Ld),screen:D=>k(D,"$screen")}})(T)).then((()=>{R()}))}))})(this,(()=>this.kn())):this.kn(),Js(this.config._onCapture)&&this.config._onCapture!==Yc&&(Te.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(T=>this.config._onCapture(T.event,T)))),this.config.ip&&Te.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 f1.apply(this,arguments)})().then((T=>{T&&this.register({[jd]:T})})).catch(Yc),this}xn(t){var n,a,l,d,v,c,u,p,y=performance.now(),f=be({},pi.__defaultExtensionClasses,this.config.__extensionClasses),w=[];f.featureFlags&&this.Ji.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new f.featureFlags(this)),f.exceptions&&this.Ji.push(this.exceptions=(a=this.exceptions)!==null&&a!==void 0?a:new f.exceptions(this)),f.historyAutocapture&&this.Ji.push(this.historyAutocapture=new f.historyAutocapture(this)),f.tracingHeaders&&this.Ji.push(this.tracingHeaders=new f.tracingHeaders(this)),f.siteApps&&this.Ji.push(this.siteApps=new f.siteApps(this)),f.sessionRecording&&!t&&this.Ji.push(this.sessionRecording=new f.sessionRecording(this)),this.config.disable_scroll_properties||w.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),f.autocapture&&this.Ji.push(this.autocapture=new f.autocapture(this)),f.surveys&&this.Ji.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new f.surveys(this)),f.logs&&this.Ji.push(this.logs=(d=this.logs)!==null&&d!==void 0?d:new f.logs(this)),f.metrics&&this.Ji.push(this.metrics=(v=this.metrics)!==null&&v!==void 0?v:new f.metrics(this)),f.conversations&&this.Ji.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new f.conversations(this)),f.productTours&&this.Ji.push(this.productTours=new f.productTours(this)),f.heatmaps&&this.Ji.push(this.heatmaps=new f.heatmaps(this)),f.webVitalsAutocapture&&this.Ji.push(this.webVitalsAutocapture=new f.webVitalsAutocapture(this)),f.exceptionObserver&&this.Ji.push(this.exceptionObserver=new f.exceptionObserver(this)),f.deadClicksAutocapture&&this.Ji.push(this.deadClicksAutocapture=new f.deadClicksAutocapture(this,$4)),f.toolbar&&this.Ji.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new f.toolbar(this)),f.experiments&&this.Ji.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new f.experiments(this)),this.Ji.forEach((E=>{E.initialize&&w.push((()=>{E.initialize==null||E.initialize()}))})),w.push((()=>{if(this.Sn){var E=this.Sn;this.Sn=void 0,this.Ji.forEach((A=>A.onRemoteConfig==null?void 0:A.onRemoteConfig(E)))}})),this.Cn(w,y)}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 a=t.shift();if(a)try{a()}catch(d){Te.error("Error initializing extension:",d)}}var l=Math.round(performance.now()-n);this.register_for_session({[Tb]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ab]:l}),this.config.__preview_deferred_init_extensions&&Te.info("PostHog extensions initialized ("+l+"ms)")}Br(t){var n;if(!Re||!Re.body)return Te.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 a,l=t.config;l.supportedCompression&&!this.config.disable_compression&&(this.compression=Fe(l.supportedCompression,Rs.GZipJS)?Rs.GZipJS:Fe(l.supportedCompression,Rs.Base64)?Rs.Base64:void 0),(a=l.analytics)!=null&&a.endpoint&&(this.analyticsDefaultEndpoint=l.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:Lf}),(n=this.Mn)==null||n.handleRemoteConfig(t),this.Ji.forEach((d=>d.onRemoteConfig==null?void 0:d.onRemoteConfig(t)))}kn(){try{this.config.loaded(this)}catch(a){Te.critical("`loaded` function failed",a)}if(this.In(),this.config.internal_or_test_user_hostname&&Qt!=null&&Qt.hostname){var t=Qt.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 t1(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()&&lc(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,n,a,l,d;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture(Nd),(a=this.logs)==null||a.flushLogs("sendBeacon"),(l=this.bn)==null||l.unload(),(d=this.wn)==null||d.unload()):this.Rn()&&this.capture(Nd,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?b1?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=be({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(ke(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 a,l,d,v=be({},n);v.timeout=v.timeout||6e4;var c,u,p,y,f,w=(a=v.transport)!==null&&a!==void 0?a:"fetch";w==="sendBeacon"&&ke(v.compression)&&v.data&&(v.compression=Rs.Base64),v.method==="POST"&&v.data&&(v.timestampMode==="capture-body"?v.data={api_key:(u=(f=(y=Ve(c=v.data)?c:[c])[0])==null||(p=f.properties)==null?void 0:p.token)!==null&&u!==void 0?u:f==null?void 0:f.token,batch:y,sent_at:new Date().toISOString()}:v.timestampMode==="body"&&(v.data=(function(C,b){return b===void 0&&(b=new Date().toISOString()),Ve(C)?C.map((S=>be({},S,{sent_at:b}))):be({},C,{sent_at:b})})(v.data))),v.url=O0(v.url,v.method,v.compression,v.timestampMode);var E=Ec.filter((C=>!v.disableTransport||!C.transport||!v.disableTransport.includes(C.transport))),A=(l=(d=(function(C,b){for(var S=0;C.length>S;S++)if(C[S].transport===w)return C[S]})(E))==null?void 0:d.method)!==null&&l!==void 0?l:E[0].method;if(!A)throw new Error("No available transport method");w!=="sendBeacon"&&v.data&&v.compression===Rs.GZipJS&&x3&&typeof Promise<"u"&&!Cc?iT(v).then((C=>{A(C)})).catch((C=>{if(s0(C))return Cc=!0,void A(be({},v,{compression:void 0,url:O0(n.url,n.method,void 0,n.timestampMode)}));(b=>{if(!b||typeof b!="object")return!1;var S="name"in b?String(b.name):"";return s0(b)||S===Uy})(C)&&(Cc=!0),A(v)})):A(v)})(be({},t,{callback:n=>{var a,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(a=(l=this.config).on_request_error)==null||a.call(l,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){Gd++;try{var n,a=[],l=[],d=[];lc(t,(c=>{if(c)if(Ve(n=c[0]))d.push(c);else if(Js(c))try{c.call(this)}catch(u){Te.error("Error executing queued PostHog call",c,u)}else Ve(c)&&n==="alias"?a.push(c):Ve(c)&&n.indexOf("capture")!==-1&&Js(this[n])?d.push(c):l.push(c)}));var v=function(c,u){lc(c,(function(p){try{if(Ve(p[0])){var y=u;Tt(p,(function(f){y=y[f[0]].apply(y,f.slice(1))}))}else u[p[0]].apply(u,p.slice(1))}catch(f){Te.error("Error executing queued PostHog call",p,f)}}))};v(a,this),v(l,this),v(d,this)}finally{Gd--}}push(t){if(Gd>0&&Ve(t)&&kt(t[0])){var n=pi.prototype[t[0]];Js(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,a){var l,d,v,c,u,p,y;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!ke(t)&&kt(t)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var w=a!=null&&a.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(w==null||!w.isRateLimited){if(this.hn.length>0){var E={};for(var A of this.hn.slice())try{Dt(E,A())}catch(F){Te.error("Failed to produce browser extension event properties",F)}n=be({},E,n??{})}var C;(l=n)!=null&&l.$current_url&&!kt((d=n)==null?void 0:d.$current_url)&&(Te.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(C=n)==null||delete C.$current_url),t!=="$exception"||a!=null&&a.Pn||Te.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 b=new Date,S=(a==null?void 0:a.timestamp)||b,_=o0(a==null?void 0:a.uuid,nn),g={uuid:_,event:t,properties:this.calculateEventProperties(t,n||{},S,_)};t===sa&&this.config.__preview_capture_bot_pageviews&&f&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),w&&(g.properties.$lib_rate_limit_remaining_tokens=w.remainingTokens);var T=t==="$feature_flag_called"&&g.properties.$feature_flag_has_experiment===!1&&this.get_property(Oc)===!0;a!=null&&a.$set&&!T&&(g.$set=a==null?void 0:a.$set);var R=a==null?void 0:a.$unset;R&&(g.$unset=R);var M,j,k,D=T?void 0:this.On(a==null?void 0:a.$set_once,t!==d0,t===Ld);if(D&&(g.$set_once=D),a!=null&&a._noTruncate||(c=this.config.properties_string_max_length,u=g,p=F=>kt(F)?F.slice(0,c):F,y=new Set,g=(function F(L,P){if(L!==Object(L))return p?p(L):L;if(!y.has(L)){var V;if(y.add(L),Ve(L))V=[],lc(L,(de=>{V.push(F(de))}));else{var te={};Tt(L,((de,ge)=>{y.has(de)||(te[ge]=F(de))})),V=te}return V}})(u)),g.timestamp=S,ke(a==null?void 0:a.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=b),T&&(g.properties=(function(F,L){L===void 0&&(L=[]);var P={},V=te=>{F[te]!==void 0&&(P[te]=F[te])};return C3.forEach(V),L.forEach(V),P})(g.properties,bT)),t===on.DISMISSED||t===on.SENT){var B,I,q=(B=n)==null?void 0:B[Pd.SURVEY_ID],$=(I=n)==null?void 0:I[Pd.SURVEY_ITERATION];g1({id:q,current_iteration:$}),g.$set=be({},g.$set,{[(M={id:q,current_iteration:$},j=t===on.SENT?"responded":"dismissed",k="$survey_"+j+"/"+M.id,M.current_iteration&&M.current_iteration>0&&(k="$survey_"+j+"/"+M.id+"/"+M.current_iteration),k)]:!0})}else t===on.SHOWN&&(g.$set=be({},g.$set,{[Pd.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===X4.SHOWN){var J,ee=(J=n)==null?void 0:J[R0.TOUR_TYPE];ee&&(g.$set=be({},g.$set,{[R0.TOUR_LAST_SEEN_DATE+"/"+ee]:new Date().toISOString()}))}var W=be({},g.properties.$set,g.$set);if(Bn(W)||this.setPersonPropertiesForFlags(W),!Xe(this.config.before_send)){var G=this.Rt(g);if(!G)return;(g=G).uuid=o0(g.uuid,nn)}this.en.emit("eventCaptured",g);var Y=(v=a==null?void 0:a._url)!==null&&v!==void 0?v:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:Y,data:g,compression:"best-available",timestampMode:(a==null?void 0:a._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(Y)?"body":"capture-body",batchKey:a==null?void 0:a._batchKey,transport:a==null?void 0:a.transport};return!this.config.request_batching||a&&(a==null||!a._batchKey)||a!=null&&a.send_instantly?this._n(O):this.bn.enqueue(O),g}Te.critical("This capture call is ignored due to client rate limiting.")}}else Te.error("No event name provided to posthog.capture")}else Te.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 yT(this)}nn(t){this.hn.push(t);var n=!0;return()=>{if(n){n=!1;var a=this.hn.indexOf(t);a!==-1&&this.hn.splice(a,1)}}}calculateEventProperties(t,n,a,l,d){if(a=a||new Date,!this.persistence||!this.sessionPersistence)return n;var v=d?void 0:this.persistence.remove_event_timer(t),c=be({},n);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.ln()&&(c[kb]=!0),t==="$snapshot"){var u=be({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=u.distinct_id,(!kt(c.distinct_id)&&!ys(c.distinct_id)||hf(c.distinct_id))&&Te.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,y=(function(g,T,R,M){var j,k,D,B;if(M===void 0&&(M=!1),!$s)return{};var I,q=g?[..._a,...T||[]]:[],$=(function(Le){for(var ze=0;r0.length>ze;ze++){var We=r0[ze],Ge=We[1],De=We[0].exec(Le),dt=De&&(Js(Ge)?Ge(De,Le):Ge);if(dt)return dt}return["",""]})($s),J=$[0],ee=$[1],W=(I=typeof navigator<"u"?navigator:void 0)!=null&&I.brave?{brave:!0}:{},G={};ke(R)||(G.detectGoogleSearchApp=R);var Y={},O=(j=navigator)==null||(j=j.userAgentData)==null?void 0:j.platform,F=(k=navigator)==null?void 0:k.maxTouchPoints,L=ce==null||(D=ce.screen)==null?void 0:D.width,P=ce==null||(B=ce.screen)==null?void 0:B.height,V=ce==null?void 0:ce.devicePixelRatio;ke(O)||(Y.userAgentDataPlatform=O),ke(F)||(Y.maxTouchPoints=F),ke(L)||(Y.screenWidth=L),ke(P)||(Y.screenHeight=P),ke(V)||(Y.devicePixelRatio=V);var te,de,ge,K,z,ie,Q,we,fe=Dt(fp({$os:J,$os_version:ee,$browser:db($s,navigator.vendor,W,G),$device:a0($s),$device_type:(de=$s,ge=Y,we=a0(de),we===Yy||we===Vy||we==="Kobo"||we==="Kindle Fire"||we===ob?da:we===zo||we===ha||we===Io||we===ff?"Console":we===Ky?"Wearable":we?Qs:(ge==null?void 0:ge.userAgentDataPlatform)==="Android"&&((K=ge==null?void 0:ge.maxTouchPoints)!==null&&K!==void 0?K:0)>0?600>Math.min((z=ge==null?void 0:ge.screenWidth)!==null&&z!==void 0?z:0,(ie=ge==null?void 0:ge.screenHeight)!==null&&ie!==void 0?ie:0)/((Q=ge==null?void 0:ge.devicePixelRatio)!==null&&Q!==void 0?Q:1)?Qs:da:"Desktop"),$timezone:e1(),$timezone_offset:G4()}),{$current_url:Fo(M?Hn(Qt==null?void 0:Qt.href):Qt==null?void 0:Qt.href,q,qo),$host:Qt==null?void 0:Qt.host,$pathname:Qt==null?void 0:Qt.pathname,$raw_user_agent:$s.length>1e3?$s.substring(0,997)+"...":$s,$browser_version:F3($s,navigator.vendor,W,G),$browser_language:A0(),$browser_language_prefix:(te=A0(),typeof te=="string"?te.split("-")[0]:void 0),$screen_height:ce==null?void 0:ce.screen.height,$screen_width:ce==null?void 0:ce.screen.width,$viewport_height:ce==null?void 0:ce.innerHeight,$viewport_width:ce==null?void 0:ce.innerWidth,$lib:gt.LIB_NAME,$lib_version:gt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return gt.SDK_DIST_CHANNEL&&(fe.$sdk_dist_channel=gt.SDK_DIST_CHANNEL),fe})(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 f=this.sessionManager.checkAndGetSessionAndWindowId(d,a.getTime()),w=f.windowId;c.$session_id=f.sessionId,c.$window_id=w}this.sessionPropsManager&&Dt(c,this.sessionPropsManager.getSessionProps());try{var E;this.sessionRecording&&Dt(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=(E=this.wn)==null?void 0:E.length}catch(g){c.$sdk_debug_error_capturing_properties=String(g)}if(this.requestRouter.region===Ff&&(c.$lib_custom_api_host=this.config.api_host),p=t!==sa||d?t!==Nd||d?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(a):this.pageViewManager.doPageView(a,l),c=Dt(c,p),t===sa&&Re&&(c.title=Re.title),!ke(v)){var A=a.getTime()-v;c.$duration=parseFloat((A/1e3).toFixed(3))}$s&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");var C=this.persistence.properties(),b=this.sessionPersistence.properties();Tt(["$referrer","$referring_domain"],(g=>{g in C&&delete b[g]})),(c=Dt({},y,C,b,c)).$is_identified=this._isIdentified(),Ve(this.config.property_denylist)?Tt(this.config.property_denylist,(function(g){delete c[g]})):Te.error(y1+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(Te.error(P0),c=S(c,t));var _=this.An();return c.$process_person_profile=_,_&&!d&&this.$n("_calculate_event_properties"),c}On(t,n,a){var l;if(n===void 0&&(n=!0),a===void 0&&(a=!1),!this.persistence||!this.An()||this.un&&!a)return t;var d=this.persistence.get_initial_props(),v=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),c=Dt({},d,v||{},t||{}),u=this.config.sanitize_properties;return u&&(Te.error(P0),c=u(c,"$set_once")),n&&(this.un=!0),Bn(c)?void 0:c}register(t,n){var a;(a=this.persistence)==null||a.register(t,n)}register_once(t,n,a){var l;(l=this.persistence)==null||l.register_once(t,n,a)}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 a;return(a=this.featureFlags)==null?void 0:a.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var a;return(a=this.featureFlags)==null?void 0:a.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 a,l;return(a=(l=this.featureFlags)==null?void 0:l.isFeatureEnabled(t,n))!==null&&a!==void 0?a:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,a){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,a)}updateEarlyAccessFeatureEnrollment(t,n,a){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,a)}getEarlyAccessFeatures(t,n,a){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,a)}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:yo}),()=>{})}onSessionId(t){var n,a;return(n=(a=this.sessionManager)==null?void 0:a.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:yo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:yo})}renderSurvey(t,n){var a;(a=this.surveys)==null||a.renderSurvey(t,n)}displaySurvey(t,n){var a;n===void 0&&(n=fT),(a=this.surveys)==null||a.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,a;return(n=(a=this.surveys)==null?void 0:a.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:yo}}canRenderSurveyAsync(t,n){var a,l;return n===void 0&&(n=!1),(a=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&a!==void 0?a:Promise.resolve({visible:!1,disabledReason:yo})}Dn(t){return!t||hf(t)?(Te.critical("Unique user id has not been set in posthog.identify"),!1):t===oc?(Te.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())||(Te.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,a){if(!this.__loaded||!this.persistence)return Te.uninitializedWarning("posthog.identify");if(ys(t)&&(t=t.toString(),Te.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 l=this.get_distinct_id();this.register({$user_id:t}),this.get_property($o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(xo)&&(this.unregister(xo),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(di)||Jr)===Jr,c=t!==l,u=!c&&v;if(c&&v)this.persistence.set_property(di,sr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:a||{}},!1),this.capture(Ld,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:a||{}}),this.fn=Wd(t,n,a),(d=this.featureFlags)==null||d.setAnonymousDistinctId(l);else if(u){this.persistence.set_property(di,sr);var p=n||{},y=a||{};this.setPersonPropertiesForFlags({$set:p,$set_once:y},!1),this.capture("$set",{$set:p,$set_once:y}),this.fn=Wd(t,n,a)}else(n||a)&&this.setPersonProperties(n,a);c?(this.reloadFeatureFlags(),this.unregister(Mo)):u&&(n||a)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.$n("posthog.setPersonProperties")){var a=Wd(this.get_distinct_id(),t,n);this.fn!==a?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.fn=a):Te.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,a=(Ve(t)?t:[t]).filter((l=>kt(l)&&l.length>0));a.length!==0&&this.$n("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(a,!0),this.capture("$set",{$unset:a}),this.fn=null)}group(t,n,a){if(t&&n){var l=this.getGroups(),d=l[t]!==n;if(d&&this.resetGroupPropertiesForFlags(t),this.register({$groups:be({},l,{[t]:n})}),d||a){var v={$group_type:t,$group_key:n};a&&(v.$group_set=a),this.capture(d0,v)}a&&this.setGroupPropertiesForFlags({[t]:a}),d&&!a&&this.reloadFeatureFlags()}else Te.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var a;n===void 0&&(n=!0),(a=this.featureFlags)==null||a.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var a;n===void 0&&(n=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((a=this.featureFlags)==null||a.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,a,l,d,v,c,u,p,y,f;if(Te.info("reset"),!this.__loaded)return Te.uninitializedWarning("posthog.reset");var w,E=this.get_property($o),A=this.get_property(jd),C=this.get_property(fr);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(a=this.sessionPersistence)==null||a.clear(),ke(C)||(w=this.persistence)==null||w.register({[fr]:C}),(l=this.surveys)==null||l.reset(),(d=this.En)==null||d.stop(),(v=this.featureFlags)==null||v.reset(),(c=this.conversations)==null||c.reset(),(u=this.logs)==null||u.reset(),(p=this.metrics)==null||p.reset(),(y=this.persistence)==null||y.set_property(di,Jr),(f=this.sessionManager)==null||f.resetSessionId(),this.fn=null,this.config.cookieless_mode===rn)this.register_once({distinct_id:oc,$device_id:null},"");else{var b=this.config.get_device_id(nn());this.register_once({distinct_id:b,$device_id:t?b:E},""),t||ke(A)||this.register({[jd]: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 zt((function*(){var a,l,d,v,c,u,p;n.__loaded?((a=n.En)==null||a.stop(),(l=n.Mn)==null||l.dispose(),(d=n.logs)==null||d.flushLogs("sendBeacon"),(v=n.metrics)==null||v.flush("sendBeacon"),(c=n.bn)==null||c.unload(),(u=n.wn)==null||u.unload(),(p=n.featureFlags)==null||p.destroy()):Te.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var a;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(a=this.conversations)==null||a.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),a=n.sessionStartTimestamp,l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&a){var d,v=(d=t.timestampLookBack)!==null&&d!==void 0?d:10;if(!a)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-a)/1e3)-v,0)}return l}alias(t,n){return t===this.get_property(bb)?(Te.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(ke(n)&&(n=this.get_distinct_id()),t!==n?(this.Ln(xo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Te.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=be({},this.config);if(Ht(t)){var a,l,d,v,c,u,p,y,f,w,E;Dt(this.config,U0(t));var A=this.yn();(a=this.persistence)==null||a.update_config(this.config,n,A),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Id(be({},this.config,{persistence:"sessionStorage"}),A,!1);var C=this.pn(this.config.debug);xi(C)&&(this.config.debug=C),xi(this.config.debug)&&(this.config.debug?(gt.DEBUG=!0,Mt.N()&&Mt.A("ph_debug",!0),Te.info("set_config",{config:t,oldConfig:n,newConfig:be({},this.config)})):(gt.DEBUG=!1,Mt.N()&&Mt.D("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(d=this.exceptions)==null||d.onConfigChange(),(v=this.sessionRecording)==null||v.startIfEnabledOrStop(),(c=this.tracingHeaders)==null||c.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(y=this.exceptionObserver)==null||y.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)==null||f.startIfEnabledOrStop(),(w=this.surveys)==null||w.loadIfEnabled(),this.jn(),(E=this.externalIntegrations)==null||E.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){gt.LIB_NAME=t,gt.LIB_VERSION=n}startSessionRecording(t){var n,a,l,d,v,c=t===!0,u={sampling:c||!(t==null||!t.sampling),linked_flag:c||!(t==null||!t.linked_flag),url_trigger:c||!(t==null||!t.url_trigger),event_trigger:c||!(t==null||!t.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),u.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),u.url_trigger&&((d=this.sessionRecording)==null||d.overrideTrigger("url")),u.event_trigger&&((v=this.sessionRecording)==null||v.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 a=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:a});return this.exceptions.sendExceptionEvent(be({},l,n))}}addExceptionStep(t,n){var a;(a=this.exceptions)==null||a.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:pi.Bn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,a;return(n=(a=this.toolbar)==null?void 0:a.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:ia;return n!==ia&&(n=ia+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(di))===sr||((n=this.sessionPersistence)==null?void 0:n.get_property(di))===sr}An(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Lf&&!this._isIdentified()&&Bn(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[xo])&&((n=this.persistence)==null||(n=n.props)==null||!n[zc]))}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"?(Te.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(zc,!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!==hr)}jn(){var t,n,a,l,d=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==d&&((a=this.persistence)==null||a.set_disabled(d)),((n=this.sessionPersistence)==null?void 0:n.yr)!==d&&((l=this.sessionPersistence)==null||l.set_disabled(d)),d}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==rn){if(this.ln()){var a,l,d,v,c;this.reset(!0),(a=this.sessionManager)==null||a.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new H0(this),this.pageViewManager=new T0(this),this.persistence&&(this.sessionPropsManager=new B0(this,this.sessionManager,this.persistence));var u,p=(d=(v=this.config.__extensionClasses)==null?void 0:v.sessionRecording)!==null&&d!==void 0?d:(c=pi.__defaultExtensionClasses)==null?void 0:c.sessionRecording;p&&(this.sessionRecording=this.an(this.sessionRecording,new p(this)),this.tn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.tn)))}var y,f;this.consent.optInOut(!0),this.jn(),this.In(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==hr&&((y=this.surveys)==null||y.loadIfEnabled()),(ke(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((f=t==null?void 0:t.captureEventName)!==null&&f!==void 0?f:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Tn()}else Te.warn($0)}opt_out_capturing(){var t,n,a;this.config.cookieless_mode!==rn?(this.config.cookieless_mode===hr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===hr&&(this.register({distinct_id:oc,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):Te.warn($0)}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===rn||(this.config.cookieless_mode===hr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return Ms?d1(Ms,this.config.custom_blocked_useragents):void 0}Tn(){Re&&(Re.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(sa,{title:Re.title},{send_instantly:!0}),this.cn&&(Re.removeEventListener(Ic,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),Ft(Re,Ic,this.cn)))}debug(t){t===!1?(ce==null||ce.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ce==null||ce.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?(Te.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,a,l,d,v){var c=a in n&&!Xe(n[a]),u=l in n&&!Xe(n[l]);return c?n[a]:!!u&&(v&&v.warn("Config field '"+l+"' is deprecated. Please use '"+a+"' instead. The old field will be removed in a future major version."),n[l])})(t,"advanced_disable_flags","advanced_disable_decide",0,Te)}Rt(t){var n;if(Xe(this.config.before_send))return t;var a=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(D3),l=Ve(this.config.before_send)?this.config.before_send:[this.config.before_send],d=t;for(var v of l){if(d=v(d),Xe(d)){var c="Event '"+t.event+"' was rejected in beforeSend function";return M3(t.event)?Te.warn(c+". This can cause unexpected behavior."):Te.info(c),null}d.properties&&!Bn(d.properties)||Te.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of a)if(d.properties&&Xe(d.properties[u]))return Te.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 d}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,a){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(a)})}pn(t){var n=xi(t)&&!t,a=Mt.N()&&Mt.q("ph_debug")==="true";return!n&&(!!a||t)}}pi.__defaultExtensionClasses={},pi.Bn=(()=>{var s=()=>{};return{trace:s,debug:s,info:s,warn:s,error:s,fatal:s}})(),(function(s,t){for(var n=0;t.length>n;n++)s.prototype[t[n]]=y4(s.prototype[t[n]])})(pi,["identify"]);class F0{constructor(t){this.disabled=t===!1;var n=Ht(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,a){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>a-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:a}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:a}];return!1}}var Yd="$copy_autocapture",Xd=$t("[AutoCapture]");function Kd(s,t){return t.length>s?t.slice(0,s)+"...":t}function xT(s){if(s.previousElementSibling)return s.previousElementSibling;var t=s;do t=t.previousSibling;while(t&&!zn(t));return t}function CT(s,t){var n,a,l=t.e,d=t.maskAllElementAttributes,v=t.maskAllText,c=t.elementAttributeIgnoreList,u=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!zn(s))return{props:{}};for(var y=[s],f=new Set([s]),w=s;w.parentNode&&!Zs(w,"body")&&Hb>y.length;)if(Bb(w.parentNode)){var E=w.parentNode.host;if(f.has(E))break;f.add(E),y.push(E),w=E}else{if(!zn(w.parentNode)||f.has(w.parentNode))break;f.add(w.parentNode),y.push(w.parentNode),w=w.parentNode}var A,C,b=[],S={},_=!1,g=!1;if(Tt(y,(k=>{var D=Bf(k);if(Zs(k,"a")){var B=k.getAttribute("href");_=!!(D&&B&&Do(B))&&(p?Hn(B):B)}Fe(Uc(k),"ph-no-capture")&&(g=!0),b.push((function(q,$,J,ee,W){W===void 0&&(W=!1);var G=q.tagName.toLowerCase(),Y={tag_name:G};vp.indexOf(G)>-1&&!J&&(Y.$el_text=G.toLowerCase()==="a"||G.toLowerCase()==="button"?Kd(1024,C0(q)):Kd(1024,Uo(q)));var O=Uc(q);O.length>0&&(Y.classes=O.filter((function(V){return V!==""}))),Tt(q.attributes,(function(V){var te;if((!Ub(q)||["name","id","class","aria-label"].indexOf(V.name)!==-1)&&(ee==null||!ee.includes(V.name))&&!$&&Do(V.value)&&(!kt(te=V.name)||te.substring(0,10)!=="_ngcontent"&&te.substring(0,7)!=="_nghost")){var de=V.value;V.name==="class"&&(de=pp(de).join(" ")),Y["attr__"+V.name]=Kd(1024,V.name==="href"&&W?Hn(de):de)}}));for(var F=1,L=1,P=q;P=xT(P);)F++,P.tagName===q.tagName&&L++;return Y.nth_child=F,Y.nth_of_type=L,Y})(k,d,v,c,p));var I=(function(q){if(!Bf(q))return{};var $={};return Tt(q.attributes,(function(J){if(J.name&&J.name.indexOf("data-ph-capture-attribute")===0){var ee=J.name.replace("data-ph-capture-attribute-",""),W=J.value;ee&&W&&Do(W)&&($[ee]=W)}})),$})(k);Dt(S,I)})),g)return{props:{},explicitNoCapture:g};if(v||(b[0].$el_text=Zs(s,"a")||Zs(s,"button")?C0(s):Uo(s)),_){var T,R;b[0].attr__href=_;var M=(T=Fc(_))==null?void 0:T.host,j=ce==null||(R=ce.location)==null?void 0:R.host;M&&j&&M!==j&&(A=_)}return{props:Dt({$event_type:l.type,$ce_version:1},u?{}:{$elements:b},{$elements_chain:(C=b,(function(k){return k.map((D=>{var B,I,q="";if(D.tag_name&&(q+=D.tag_name),D.attr_class)for(var $ of(D.attr_class.sort(),D.attr_class))q+="."+$.replace(/"/g,"");var J=be({},D.text?{text:D.text}:{},{"nth-child":(B=D.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(I=D.nth_of_type)!==null&&I!==void 0?I:0},D.href?{href:D.href}:{},D.attr_id?{attr_id:D.attr_id}:{},D.attributes),ee={};return xc(J).sort(((W,G)=>W[0].localeCompare(G[0]))).forEach((W=>{var G=W[1];return ee[E0(W[0].toString())]=E0(G.toString())})),(q+=":")+xc(ee).map((W=>W[0]+'="'+W[1]+'"')).join("")})).join(";")})((function(k){return k.map((D=>{var B,I,q={text:(B=D.$el_text)==null?void 0:B.slice(0,400),tag_name:D.tag_name,href:(I=D.attr__href)==null?void 0:I.slice(0,2048),attr_class:z4(D),attr_id:D.attr__id,nth_child:D.nth_child,nth_of_type:D.nth_of_type,attributes:{}};return xc(D).filter(($=>$[0].indexOf("attr__")===0)).forEach(($=>q.attributes[$[0]]=$[1])),q}))})(C)))},(n=b[0])!=null&&n.$el_text?{$el_text:(a=b[0])==null?void 0:a.$el_text}:{},A&&l.type==="click"?{$external_click_url:A}:{},S)}}var bo=$t("[ExceptionAutocapture]"),q0=()=>{},ET=$t("[TracingHeaders]"),ar=$t("[Web Vitals]"),W0=9e5,G0="disabled",V0="lazy_loading",So="awaiting_config",pc="missing_config";$t("[SessionRecording]"),$t("[SessionRecording]");var qf="[SessionRecording]",Qi=$t(qf),kT=$t("[Heatmaps]");function Jd(s){return Ht(s)&&"clientX"in s&&"clientY"in s&&ys(s.clientX)&&ys(s.clientY)}var Zd=$t("[Product Tours]"),Qd=s=>{var t;return!s.config.disable_product_tours&&!((t=s.persistence)==null||!t.get_property(up))},TT=["$set_once","$set"],Ai=$t("[SiteApps]"),Y0="Error while initializing PostHog app with config id ";function ea(s,t,n){if(Xe(s))return!1;switch(n){case"exact":return s===t;case"contains":var a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(a,"i").test(s);case"regex":try{return new RegExp(t).test(s)}catch{return!1}default:return!1}}class AT{constructor(t){this.Hn=new yp,this.Un=(n,a)=>this.zn(n,a)&&this.Vn(n,a)&&this.Wn(n,a)&&this.Zn(n,a),this.zn=(n,a)=>a==null||!a.event||(n==null?void 0:n.event)===(a==null?void 0:a.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,n;ke((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((a,l)=>{this.on(a,l)}))}register(t){var n,a;if(!ke((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((v=>{var c,u;(c=this.Qn)==null||c.add(v),(u=v.steps)==null||u.forEach((p=>{var y;(y=this.Gn)==null||y.add((p==null?void 0:p.event)||"")}))})),(a=this._instance)!=null&&a.autocapture)){var l,d=new Set;t.forEach((v=>{var c;(c=v.steps)==null||c.forEach((u=>{u!=null&&u.selector&&d.add(u==null?void 0:u.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(d)}}on(t,n){var a;n!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(n.event))&&this.Qn&&((a=this.Qn)==null?void 0:a.size)>0&&this.Qn.forEach((l=>{this.Jn(n,l)&&this.Hn.emit("actionCaptured",l.name)}))}Kn(t){this.onAction("actionCaptured",(n=>t(n)))}Jn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var a of n.steps)if(this.Un(t,a))return!0;return!1}onAction(t,n){return this.Hn.on(t,n)}Vn(t,n){if(n!=null&&n.url){var a,l=t==null||(a=t.properties)==null?void 0:a.$current_url;if(!l||typeof l!="string"||!ea(l,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 a;if(n==null||!n.href)return!0;var l=this.es(t);if(l.length>0)return l.some((c=>ea(c.href,n.href,n.href_matching||"exact")));var d,v=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";return!!v&&ea((d=v.match(/(?::|")href="(.*?)"/))?d[1]:"",n.href,n.href_matching||"exact")}Xn(t,n){var a;if(n==null||!n.text)return!0;var l=this.es(t);if(l.length>0)return l.some((p=>ea(p.text,n.text,n.text_matching||"exact")||ea(p.$el_text,n.text,n.text_matching||"exact")));var d,v,c,u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";return!!u&&(d=(function(p){for(var y,f=[],w=/(?::|")text="(.*?)"/g;!Xe(y=w.exec(p));)f.includes(y[1])||f.push(y[1]);return f})(u),v=n.text,c=n.text_matching||"exact",d.some((p=>ea(p,v,c))))}ts(t,n){var a,l;if(n==null||!n.selector)return!0;var d=t==null||(a=t.properties)==null?void 0:a.$element_selectors;if(d!=null&&d.includes(n.selector))return!0;var v=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&v)try{return new RegExp(n.selector_regex).test(v)}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||v1(n.properties.reduce(((a,l)=>{var d=Ve(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return a[l.key]={values:d,operator:l.operator||"exact"},a}),{}),t==null?void 0:t.properties)}}class RT{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((a=>this.ls(a)))}us(t,n){return!!t&&v1(t.propertyFilters,n==null?void 0:n.properties)}hs(t,n){var a=new Map;return t.forEach((l=>{var d;(d=l.conditions)==null||(d=d[n])==null||(d=d.values)==null||d.forEach((v=>{if(v!=null&&v.name){var c=a.get(v.name)||[];c.push(l.id),a.set(v.name,c)}}))})),a}ds(t,n,a){var l=(a===vo.Activation?this.ns:this.ss).get(t),d=[];return this.cs((v=>{d=v.filter((c=>l==null?void 0:l.includes(c.id)))})),d.filter((v=>{var c,u=(c=v.conditions)==null||(c=c[a])==null||(c=c.values)==null?void 0:c.find((p=>p.name===t));return this.us(u,n)}))}register(t){var n;ke((n=this._instance)==null?void 0:n._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var n=t.filter((a=>{var l,d;return((l=a.conditions)==null?void 0:l.actions)&&((d=a.conditions)==null||(d=d.actions)==null||(d=d.values)==null?void 0:d.length)>0}));n.length!==0&&(this.ps==null&&(this.ps=new AT(this._instance),this.ps.init(),this.ps.Kn((a=>{this.onAction(a)}))),n.forEach((a=>{var l,d,v,c,u;a.conditions&&(l=a.conditions)!=null&&l.actions&&(d=a.conditions)!=null&&(d=d.actions)!=null&&d.values&&((v=a.conditions)==null||(v=v.actions)==null||(v=v.values)==null?void 0:v.length)>0&&((c=this.ps)==null||c.register(a.conditions.actions.values),(u=a.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((p=>{if(p&&p.name){var y=this.os.get(p.name);y&&y.push(a.id),this.os.set(p.name,y||[a.id])}})))})))}vs(t){var n,a=t.filter((d=>{var v,c;return((v=d.conditions)==null?void 0:v.events)&&((c=d.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),l=t.filter((d=>{var v,c;return((v=d.conditions)==null?void 0:v.cancelEvents)&&((c=d.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0}));a.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((d,v)=>{this.onEvent(d,v)})),this.ns=this.hs(t,vo.Activation),this.ss=this.hs(t,vo.Cancellation))}onEvent(t,n){var a,l,d=this.gs(),v=(n==null||(a=n.properties)==null?void 0:a.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(v&&this.getActivatedIds().includes(v)){var c=this.ys(t,v);if(c==="consume")return d.info("event consumed activated item, removing it",{event:t,itemId:v}),void this.bs([v]);if(c==="persist")return d.info("shown item promoted to persisted activation",{event:t,itemId:v}),void this._s(v)}if(this.ss.has(t)){var u=this.ds(t,n,vo.Cancellation);u.length>0&&(d.info("cancel event matched, cancelling items",{event:t,itemsToCancel:u.map((y=>y.id))}),this.bs(u.map((y=>y.id))),u.forEach((y=>this.ws(y.id))))}if(this.ns.has(t)){d.info("event name matched",{event:t,eventPayload:n,items:this.ns.get(t)});var p=this.ds(t,n,vo.Activation);this.xs(p.map((y=>y.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((a=>a!==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((d=>!n.has(d)));var a=this.Ms(),l=a.filter((d=>!n.has(d)));l.length!==a.length&&(this.Ss(l),l.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,a=this.Ms();if(a.length===0)return[];var l=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Es()],d=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return d&&l===d?a:[]}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,a=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Es()];a&&a!==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 MT extends RT{constructor(t){super(t)}Ts(){return Tf}Es(){return wc}As(){return on.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 St}Ss(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Tf]:t})}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[wc]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(wc)}Os(){return!1}ys(t,n){var a;this.cs((d=>{a=d.find((v=>v.id===n))}));var l=!a||(function(d){var v;return _1(d)&&!((v=d.conditions)==null||(v=v.events)==null||!v.repeatedActivation)||d.schedule==="always"})(a);return l?t===on.SHOWN?"consume":"ignore":t===on.SHOWN?"persist":t===on.DISMISSED||t===on.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var vc="SDK is not enabled or survey functionality is not yet loaded",X0="Disabled. Not loading surveys.",DT=ce!=null&&ce.location?qc(ce.location.hash,"__posthog")||qc(location.hash,"state"):null,K0="_postHogToolbarParams",J0=$t("[Toolbar]"),ls=$t("[FeatureFlags]"),or=$t("[FeatureFlags]",{debugEnabled:!0}),ef=`" failed. Feature flags didn't load in time.`,Z0=s=>{for(var t={},n=0;s.length>n;n++)t[s[n]]=!0;return t},Q0=s=>{var t={};for(var n of xc(s||{})){var a=n[1];a&&(t[n[0]]=a)}return t},Ri=$t("[Error tracking]"),ey="Refusing to render web experiment since the viewer is a likely bot",jT={icontains:(s,t)=>t.toLowerCase().indexOf(s.toLowerCase())>-1,not_icontains:(s,t)=>t.toLowerCase().indexOf(s.toLowerCase())===-1,regex:(s,t)=>Vc(t,s),not_regex:(s,t)=>!Vc(t,s),exact:(s,t)=>t===s,is_not:(s,t)=>t!==s};class ws{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(a){a===void 0&&(a=!1),n.getWebExperiments((l=>{ws.$s("retrieved web experiments from the server"),n.Ls=new Map,l.forEach((d=>{if(d.feature_flag_key){var v;n.Ls&&(ws.$s("setting flag key ",d.feature_flag_key," to web experiment ",d),(v=n.Ls)==null||v.set(d.feature_flag_key,d));var c=n._instance.getFeatureFlag(d.feature_flag_key);kt(c)&&d.variants[c]&&n.Ds(d.name,c,d.variants[c].transforms)}else if(d.variants)for(var u in d.variants){var p=d.variants[u];ws.Ns(p,n._instance)&&n.Ds(d.name,u,p.transforms)}}))}),a)},this._instance=t,this._instance.onFeatureFlags((a=>{this.onFeatureFlags(a)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())ws.$s(ey);else if(!this.Te.disable_web_experiments){if(Xe(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ws.$s("applying feature flags",t),t.forEach((n=>{var a;if(this.Ls&&(a=this.Ls)!=null&&a.has(n)){var l,d=this._instance.getFeatureFlag(n),v=(l=this.Ls)==null?void 0:l.get(n);d&&v!=null&&v.variants[d]&&this.Ds(v.name,d,v.variants[d].transforms)}}))}}previewWebExperiment(){var t=ws.getWindowLocation();if(t!=null&&t.search){var n=va(t==null?void 0:t.search,"__experiment_id"),a=va(t==null?void 0:t.search,"__experiment_variant");n&&a&&(ws.$s("previewing web experiments "+n+" && "+a),this.getWebExperiments((l=>{this.qs(parseInt(n),a,l)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,a){if(this.Te.disable_web_experiments&&!a)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:d=>t(d.statusCode===200&&d.json&&d.json.experiments||[])})}qs(t,n,a){var l=a.filter((d=>d.id===t));l&&l.length>0&&(ws.$s("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.Ds(l[0].name,n,l[0].variants[n].transforms))}static Ns(t,n){return!Xe(t.conditions)&&ws.js(t,n)&&ws.Bs(t)}static js(t,n){var a;if(Xe(t.conditions)||Xe((a=t.conditions)==null?void 0:a.url))return!0;var l=ws.getWindowLocation();if(l){var d,v,c,u=Nb(n,l.href);return(d=t.conditions)==null||!d.url||jT[(v=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&v!==void 0?v:"icontains"](t.conditions.url,u)}return!1}static getWindowLocation(){return ce==null?void 0:ce.location}static Bs(t){var n;if(Xe(t.conditions)||Xe((n=t.conditions)==null?void 0:n.utm))return!0;var a=Yb();if(a.utm_source){var l,d,v,c,u,p,y,f,w=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((d=t.conditions)==null||(d=d.utm)==null?void 0:d.utm_campaign)==a.utm_campaign,E=(v=t.conditions)==null||(v=v.utm)==null||!v.utm_source||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_source)==a.utm_source,A=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==a.utm_medium,C=(y=t.conditions)==null||(y=y.utm)==null||!y.utm_term||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==a.utm_term;return w&&A&&C&&E}return!1}static $s(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;n>l;l++)a[l-1]=arguments[l];Te.info("[WebExperiments] "+t,a)}Ds(t,n,a){this._is_bot()?ws.$s(ey):n!=="control"?a.forEach((l=>{if(l.selector){var d;ws.$s("applying transform of variant "+n+" for experiment "+t+" ",l);var v=(d=document)==null?void 0:d.querySelectorAll(l.selector);v==null||v.forEach((c=>{var u=c;l.html&&(u.innerHTML=l.html),l.css&&u.setAttribute("style",l.css)}))}})):ws.$s("Control variants leave the page unmodified.")}_is_bot(){return Ms&&this._instance?d1(Ms,this.Te.custom_blocked_useragents):void 0}}var hi=$t("[Conversations]"),lr="Conversations not available yet.",ty="console",iu={featureFlags:class{constructor(s){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=s,this.featureFlagEventHandlers=[],ce&&Ft(ce,"online",this.Ks)}destroy(){ce==null||ce.removeEventListener("online",this.Ks)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}Xs(s){return this._instance.get_property(s)}eo(){var s,t;return(s=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&s!==void 0&&s}ro(){return!!this.eo()&&(this.Qs||this.zs||(this.Qs=!0,ls.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}io(){var s,t=(s=this.Te.evaluation_contexts)!==null&&s!==void 0?s:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.Gs||(ls.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 a=n&&typeof n=="string"&&n.trim().length>0;return a||ls.error("Invalid evaluation context found:",n,"Expected non-empty string"),a})):[]}no(){return this.io().length>0}so(){var s=this.Te.flag_keys;if(!ke(s)){if(Ve(s))return s.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||ls.error("Invalid flag key found:",t,"Expected non-empty string"),n}));ls.error("Invalid flag_keys found:",s,"Expected array of non-empty strings")}}initialize(){var s,t,n=this._instance.config,a=(s=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&s!==void 0?s:{};if(Object.keys(a).length){var l,d,v=(l=(d=n.bootstrap)==null?void 0:d.featureFlagPayloads)!==null&&l!==void 0?l:{},c=Object.keys(a).filter((p=>!!a[p])).reduce(((p,y)=>(p[y]=a[y]||!1,p)),{}),u=Object.keys(v).filter((p=>c[p])).reduce(((p,y)=>(v[y]&&(p[y]=v[y]),p)),{});this.receivedFeatureFlags({featureFlags:c,featureFlagPayloads:u})}}updateFlags(s,t,n){var a,l,d=n!=null&&n.merge&&(a=this.Xs(dr))!==null&&a!==void 0?a:{},v=n!=null&&n.merge&&(l=this.Xs(Sc))!==null&&l!==void 0?l:{},c=be({},d,s),u=be({},v,t),p={};for(var y of Object.entries(c)){var f=y[0],w=y[1];p[f]={key:f,enabled:Zg(w),variant:Qg(w),reason:void 0,metadata:ke(u==null?void 0:u[f])?void 0:{id:0,version:void 0,description:void 0,payload:u[f]}}}this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.Us}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var s=this.Xs(Cf),t=this.Xs(tn),n=this.Xs(ta);if(!n&&!t)return s||{};var a=Dt({},s||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var d of l){var v,c,u=a[d],p=t==null?void 0:t[d],y=ke(p)?(v=u==null?void 0:u.enabled)!==null&&v!==void 0&&v:!!p,f=ke(p)?u.variant:typeof p=="string"?p:void 0,w=n==null?void 0:n[d],E=be({},u,{enabled:y,variant:y?f??(u==null?void 0:u.variant):void 0});y!==(u==null?void 0:u.enabled)&&(E.original_enabled=u==null?void 0:u.enabled),f!==(u==null?void 0:u.variant)&&(E.original_variant=u==null?void 0:u.variant),w&&(E.metadata=be({},u==null?void 0:u.metadata,{payload:w,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),a[d]=E}return this.Hs||(ls.warn(" Overriding feature flag details!",{flagDetails:s,overriddenPayloads:n,finalDetails:a}),this.Hs=!0),a}getAllFeatureFlags(){var s=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(s).map((n=>{var a=s[n];return{key:n,enabled:Zg(a),variant:Qg(a),payload:Jg(t[n])}}))}getFlagVariants(){var s=this.Xs(dr),t=this.Xs(tn);if(!t)return s||{};for(var n=Dt({},s),a=Object.keys(t),l=0;a.length>l;l++)n[a[l]]=t[a[l]];return this.Hs||(ls.warn(" Overriding feature flags!",{enabledFlags:s,overriddenFlags:t,finalFlags:n}),this.Hs=!0),n}getFlagPayloads(){var s=this.Xs(Sc),t=this.Xs(ta);if(!t)return s||{};for(var n=Dt({},s||{}),a=Object.keys(t),l=0;a.length>l;l++)n[a[l]]=t[a[l]];return this.Hs||(ls.warn(" Overriding feature flag payloads!",{flagPayloads:s,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(s){this.$anon_distinct_id=s}setReloadingPaused(s){this.Vs=s}ao(s){var t;if(this.lo(),!this._instance.Ur()&&!this.Ys())if(this.zs)this.Ws=!0;else{var n=this.Te.token,a=this.Xs($o),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:be({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(cr)||{},{$lib:gt.LIB_NAME,$lib_version:gt.LIB_VERSION}),group_properties:this.Xs(ur),timezone:e1()};Ds(a)||ke(a)||(l.$device_id=a),(s!=null&&s.disableFlags||this.Te.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.no()&&(l.evaluation_contexts=this.io());var d=this.so();ke(d)||(l.flag_keys=d);var v=!!this.Te.advanced_only_evaluate_survey_feature_flags,c=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:c,data:l,compression:this.Te.disable_compression?void 0:Rs.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var p,y,f,w=!0;if(this.uo(u.statusCode),u.statusCode===200&&(this.Ws||(this.$anon_distinct_id=void 0),w=!1),this.zs=!1,!l.disable_flags||this.Ws){this.Zs=!w;var E=[];u.error?u.error instanceof Error?E.push(u.error.name==="AbortError"?"timeout":"connection_error"):E.push("unknown_error"):u.statusCode!==200&&E.push("api_error_"+u.statusCode),(p=u.json)!=null&&p.errorsWhileComputingFlags&&E.push("errors_while_computing_flags");var A,C=!((y=u.json)==null||(y=y.quotaLimited)==null||!y.includes("feature_flags"));C&&E.push("quota_limited"),(f=this.mi)==null||f.register({[Rf]:E}),C?ls.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."):(l.disable_flags||this.receivedFeatureFlags((A=u.json)!==null&&A!==void 0?A:{},w,{partialResponse:v}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return Gb(this.Js,3)}uo(s){this.Js=Vb(s,this.Js,3,(()=>ls.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(s,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 a=this.getFeatureFlagResult(s,t);return(n=a==null?void 0:a.variant)!==null&&n!==void 0?n:a==null?void 0:a.enabled}}else ls.warn('getFeatureFlag for key "'+s+ef)}getFeatureFlagDetails(s){return this.getFlagsWithDetails()[s]}getFeatureFlagPayload(s){var t=this.getFeatureFlagResult(s,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(s,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(),a=s in n,l=n[s],d=this.getFlagPayloads()[s],v=String(l),c=this.Xs(Ef)||void 0,u=this.Xs(Po)||void 0,p=this.Xs(Mo)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var y,f=this._instance.get_session_id(),w=this.Xs(Af);f&&f!==w&&(p={},(y=this.mi)==null||y.register({[Mo]:p,[Af]:f}))}if((t.send_event||!("send_event"in t))&&(!(s in p)||!p[s].includes(v))){var E,A,C,b,S,_,g,T,R,M,j;Ve(p[s])?p[s].push(v):p[s]=[v],(E=this.mi)==null||E.register({[Mo]:p});var k=this.getFeatureFlagDetails(s),D=[...(A=this.Xs(Rf))!==null&&A!==void 0?A:[]];ke(l)&&D.push("flag_missing");var B={$feature_flag:s,$feature_flag_response:l,$feature_flag_payload:d||null,$feature_flag_request_id:c,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((C=this.Te.bootstrap)==null||(C=C.featureFlags)==null?void 0:C[s])||null,$feature_flag_bootstrapped_payload:((b=this.Te.bootstrap)==null||(b=b.featureFlagPayloads)==null?void 0:b[s])||null,$used_bootstrap_value:!this.Zs};ke(k==null||(S=k.metadata)==null?void 0:S.has_experiment)||(B.$feature_flag_has_experiment=k.metadata.has_experiment),ke(k==null||(_=k.metadata)==null?void 0:_.version)||(B.$feature_flag_version=k.metadata.version);var I,q=(g=k==null||(T=k.reason)==null?void 0:T.description)!==null&&g!==void 0?g:k==null||(R=k.reason)==null?void 0:R.code;q&&(B.$feature_flag_reason=q),k!=null&&(M=k.metadata)!=null&&M.id&&(B.$feature_flag_id=k.metadata.id),ke(k==null?void 0:k.original_variant)&&ke(k==null?void 0:k.original_enabled)||(B.$feature_flag_original_response=ke(k.original_variant)?k.original_enabled:k.original_variant),k!=null&&(j=k.metadata)!=null&&j.original_payload&&(B.$feature_flag_original_payload=k==null||(I=k.metadata)==null?void 0:I.original_payload),D.length&&(B.$feature_flag_error=D.join(",")),this._instance.capture("$feature_flag_called",B)}if(a)return{key:s,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:Jg(d)}}}else ls.warn('getFeatureFlagResult for key "'+s+ef)}getRemoteConfigPayload(s,t){var n=this.Te.token,a={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:gt.LIB_NAME,$lib_version:gt.LIB_VERSION}};this.no()&&(a.evaluation_contexts=this.io());var l=this.so();ke(l)||(a.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:a,compression:this.Te.disable_compression?void 0:Rs.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(d){var v,c=(v=d.json)==null?void 0:v.featureFlagPayloads;t((c==null?void 0:c[s])||void 0)}})}isFeatureEnabled(s,t){if(t===void 0&&(t={}),t.fresh&&!this.Zs)return t.defaultValue;if(!(this.Us||this.getFlags()&&this.getFlags().length>0))return ls.warn('isFeatureEnabled for key "'+s+ef),t.defaultValue;var n=this.getFeatureFlag(s,t);return ke(n)?t.defaultValue:!!n}addFeatureFlagsHandler(s){this.featureFlagEventHandlers.push(s)}removeFeatureFlagsHandler(s){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==s))}receivedFeatureFlags(s,t,n){if(this.mi){this.Us=!0;var a=this.getFlagVariants(),l=this.getFlagPayloads(),d=this.getFlagsWithDetails();(function(v,c,u,p,y,f){u===void 0&&(u={}),p===void 0&&(p={}),y===void 0&&(y={});var w=(k=>{var D=k.flags;return D?(k.featureFlags=Object.fromEntries(Object.keys(D).map((B=>{var I;return[B,(I=D[B].variant)!==null&&I!==void 0?I:D[B].enabled]}))),k.featureFlagPayloads=Object.fromEntries(Object.keys(D).filter((B=>D[B].enabled)).filter((B=>{var I;return(I=D[B].metadata)==null?void 0:I.payload})).map((B=>{var I;return[B,(I=D[B].metadata)==null?void 0:I.payload]})))):k.featureFlags&&ls.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(v),E=w.flags,A=w.featureFlags,C=w.featureFlagPayloads;if(A){var b=v.requestId,S=v.evaluatedAt;if(Ve(A)){ls.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(A)for(var g=0;A.length>g;g++)_[A[g]]=!0;c&&c.register({[bc]:A,[dr]:_,[Oc]:!1})}else{var T=A,R=C,M=E;if(f!=null&&f.partialResponse)T=be({},u,T),R=be({},p,R),M=be({},y,M);else if(v.errorsWhileComputingFlags)if(E){var j=new Set(Object.keys(E).filter((k=>{var D;return!((D=E[k])!=null&&D.failed)})));T=be({},u,Object.fromEntries(Object.entries(T).filter((k=>j.has(k[0]))))),R=be({},p,Object.fromEntries(Object.entries(R||{}).filter((k=>j.has(k[0]))))),M=be({},y,Object.fromEntries(Object.entries(M||{}).filter((k=>j.has(k[0])))))}else T=be({},u,T),R=be({},p,R),M=be({},y,M);c&&c.register(be({[bc]:Object.keys(Q0(T)),[dr]:T||{},[Sc]:R||{},[Cf]:M||{},[Oc]:v.minimalFlagCalledEvents===!0},b?{[Ef]:b}:{},S?{[Po]:S}:{}))}}})(s,this.mi,a,l,d,n),t||(this.Qs=!1),this.ho(t)}}override(s,t){t===void 0&&(t=!1),ls.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:s,suppressWarning:t})}overrideFeatureFlags(s){if(!this._instance.__loaded||!this.mi)return ls.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(s===!1)return this.mi.unregister(tn),this.mi.unregister(ta),this.ho(),or.info("All overrides cleared");if(Ve(s)){var t=Z0(s);return this.mi.register({[tn]:t}),this.ho(),or.info("Flag overrides set",{flags:s})}if(s&&typeof s=="object"&&("flags"in s||"payloads"in s)){var n,a=s;if(this.Hs=!!((n=a.suppressWarning)!==null&&n!==void 0&&n),"flags"in a){if(a.flags===!1)this.mi.unregister(tn),or.info("Flag overrides cleared");else if(a.flags){if(Ve(a.flags)){var l=Z0(a.flags);this.mi.register({[tn]:l})}else this.mi.register({[tn]:a.flags});or.info("Flag overrides set",{flags:a.flags})}}return"payloads"in a&&(a.payloads===!1?(this.mi.unregister(ta),or.info("Payload overrides cleared")):a.payloads&&(this.mi.register({[ta]:a.payloads}),or.info("Payload overrides set",{payloads:a.payloads}))),void this.ho()}if(s&&typeof s=="object")return this.mi.register({[tn]:s}),this.ho(),or.info("Flag overrides set",{flags:s});ls.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:s})}onFeatureFlags(s){if(this.addFeatureFlagsHandler(s),this.Us){var t=this.do(),n=t.flags,a=t.flagVariants;try{s(n,a)}catch(l){ls.error("Error while running feature flags callback",l)}}return()=>this.removeFeatureFlagsHandler(s)}updateEarlyAccessFeatureEnrollment(s,t,n){var a,l=(this.Xs(Eo)||[]).find((u=>u.flagKey===s)),d={["$feature_enrollment/"+s]:t},v={$feature_flag:s,$feature_enrollment:t,$set:d};l&&(v.$early_access_feature_name=l.name),n&&(v.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",v),this.setPersonPropertiesForFlags(d,!1);var c=be({},this.getFlagVariants(),{[s]:t});(a=this.mi)==null||a.register({[bc]:Object.keys(Q0(c)),[dr]:c}),this.ho()}getEarlyAccessFeatures(s,t,n){t===void 0&&(t=!1);var a=this.Xs(Eo),l=n?"&"+n.map((d=>"stage="+d)).join("&"):"";if(a&&!t)return s(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+l),method:"GET",timestampMode:"query",callback:d=>{var v,c;if(d.json){var u=d.json.earlyAccessFeatures;return(v=this.mi)==null||v.unregister(Eo),(c=this.mi)==null||c.register({[Eo]:u}),s(u)}}})}do(){var s=this.getFlags(),t=this.getFlagVariants();return{flags:s.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,a)=>(n[a]=t[a],n)),{})}}ho(s){var t=this.do(),n=t.flags,a=t.flagVariants;this.featureFlagEventHandlers.forEach((l=>{try{l(n,a,{errorsLoading:s})}catch(d){ls.error("Error while running feature flags callback",d)}}))}setPersonPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=this.Xs(cr)||{},a=(s==null?void 0:s.$set)||(s!=null&&s.$set_once?{}:s),l=s==null?void 0:s.$set_once,d={};if(l)for(var v in l)({}).hasOwnProperty.call(l,v)&&(v in n||(d[v]=l[v]));this._instance.register({[cr]:be({},n,d,a)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=be({},this.Xs(cr)||{});s.forEach((a=>{delete n[a]})),this._instance.register({[cr]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(s){s===void 0&&(s=!0),this._instance.unregister(cr),s&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=this.Xs(ur)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((a=>{n[a]=be({},n[a],s[a]),delete s[a]})),this._instance.register({[ur]:be({},n,s)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(s){if(s){var t=this.Xs(ur)||{};this._instance.register({[ur]:be({},t,{[s]:{}})})}else this._instance.unregister(ur)}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}}},NT={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var s;return!((s=this.co)==null||!s.isStarted)}get status(){var s,t;return this.vo===So||this.vo===pc?this.vo:(s=(t=this.co)==null?void 0:t.status)!==null&&s!==void 0?s:this.vo}constructor(s){if(this._forceAllowLocalhostNetworkCapture=!1,this.vo=G0,this.fo=void 0,this._instance=s,!this._instance.sessionManager)throw Qi.error("started without valid sessionManager"),new Error(qf+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===rn)throw new Error(qf+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var s,t=!((s=this._instance.get_property(fr))==null||!s.enabled),n=!this.Te.disable_session_recording,a=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return ce&&t&&n&&!a}startIfEnabledOrStop(s){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var n=!ke(Object.assign)&&!ke(Array.from);this.po&&n?(this.mo(s),Qi.info("starting")):(this.vo=G0,this.stopRecording())}}mo(s){var t,n,a;this.po&&(this.vo!==So&&this.vo!==pc&&(this.vo=V0),Ie!=null&&(t=Ie.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Ie.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yo(s):(a=Ie.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,this.bo,(l=>{if(l)return Qi.error("could not load recorder",l);this.yo(s)})))}stopRecording(){var s,t;(s=this.fo)==null||s.call(this),this.fo=void 0,(t=this.co)==null||t.stop()}_o(){var s,t;(s=this.fo)==null||s.call(this),this.fo=void 0,(t=this.co)==null||t.discard()}wo(){var s,t;(s=this.mi)==null||s.unregister(hp),(t=this.mi)==null||t.unregister(Sb)}xo(s,t){if(Xe(s))return null;var n,a=ys(s)?s:parseFloat(s);return typeof(n=a)!="number"||!Number.isFinite(n)||0>n||n>1?(Qi.warn(t+" must be between 0 and 1. Ignoring invalid value:",s),null):a}ko(s){if(this.mi){var t,n,a=this.mi,l=()=>{var d,v=s.sessionRecording===!1?void 0:s.sessionRecording,c=this.xo((d=this.Te.session_recording)==null?void 0:d.sampleRate,"session_recording.sampleRate"),u=this.xo(v==null?void 0:v.sampleRate,"remote config sampleRate"),p=c??u;Xe(p)&&this.wo();var y=v==null?void 0:v.minimumDurationMilliseconds;a.register({[fr]:be({cache_timestamp:Date.now(),enabled:!!v},v,{networkPayloadCapture:be({capturePerformance:s.capturePerformance},v==null?void 0:v.networkPayloadCapture),canvasRecording:{enabled:v==null?void 0:v.recordCanvas,fps:v==null?void 0:v.canvasFps,quality:v==null?void 0:v.canvasQuality},sampleRate:p,minimumDurationMilliseconds:ke(y)?null:y,endpoint:v==null?void 0:v.endpoint,triggerMatchType:v==null?void 0:v.triggerMatchType,masking:v==null?void 0:v.masking,urlTriggers:v==null?void 0:v.urlTriggers,version:v==null?void 0:v.version,triggerGroups:v==null?void 0:v.triggerGroups})})};l(),(t=this.fo)==null||t.call(this),this.fo=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(s){var t=s.ok?s.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===So&&(this.vo=pc,Qi.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(s,t){var n;t===void 0&&(t="log"),(n=this.co)!=null&&n.log?this.co.log(s,t):Qi.warn("log called before recorder was ready")}get bo(){var s,t,n=(s=this._instance)==null||(s=s.persistence)==null?void 0:s.get_property(fr);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var s,t,n=this._instance.get_property(fr);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(l){return Qi.warn("persisted remote config for session recording is invalid and will be ignored",l),!1}var a=(s=t.cache_timestamp)!==null&&s!==void 0?s:Date.now();return 36e5>=Date.now()-a}yo(s){var t,n;if((t=Ie.__PosthogExtensions__)==null||!t.initSessionRecording)return Qi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Rb]:!0});if(this.co||(this.co=(n=Ie.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===pc||this.vo===So?void 0:(this.vo=So,Qi.info("persisted remote config is stale, requesting fresh config before starting"),void new t1(this._instance).load());this.vo=V0,this.co.start(s)}onRRwebEmit(s){var t;(t=this.co)==null||t.onRRwebEmit==null||t.onRRwebEmit(s)}overrideLinkedFlag(){var s,t;this.co||(t=this.mi)==null||t.register({[xb]:!0}),(s=this.co)==null||s.overrideLinkedFlag()}overrideSampling(){var s,t;this.co||(t=this.mi)==null||t.register({[wb]:!0}),(s=this.co)==null||s.overrideSampling()}overrideTrigger(s){var t,n;this.co||(n=this.mi)==null||n.register({[s==="url"?Cb:Eb]:!0}),(t=this.co)==null||t.overrideTrigger(s)}get sdkDebugProperties(){var s;return((s=this.co)==null?void 0:s.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(s,t){var n;return!((n=this.co)==null||!n.tryAddCustomEvent(s,t))}}},LT={autocapture:class{constructor(s){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=s,this.rageclicks=new F0(s.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var s,t,n=Ht(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(s=n.url_allowlist)==null?void 0:s.map((a=>new RegExp(a))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((a=>new RegExp(a))),n}Ro(){if(this.isBrowserSupported()){if(ce&&Re){var s=n=>{n=n||(ce==null?void 0:ce.event);try{this.Po(n)}catch(a){Xd.error("Failed to capture event",a)}};if(Ft(Re,"submit",s,{capture:!0}),Ft(Re,"change",s,{capture:!0}),Ft(Re,"click",s,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(ce==null?void 0:ce.event);try{this.Po(n,Yd)}catch(a){Xd.error("Failed to capture copy/cut event",a)}};Ft(Re,"copy",t,{capture:!0}),Ft(Re,"cut",t,{capture:!0})}}}else Xd.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Co&&(this.Ro(),this.Co=!0)}onRemoteConfig(s){if(this.Io=!0,s.ok){var t=s.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);var n=t.autocapture_opt_out;xi(n)&&(this.instance.persistence&&this.instance.persistence.register({[mf]:n}),this.Mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(s){this.Eo=s}getElementSelectors(s){var t,n=[];return(t=this.Eo)==null||t.forEach((a=>{var l=Re==null?void 0:Re.querySelectorAll(a);l==null||l.forEach((d=>{s===d&&n.push(a)}))})),n}get isEnabled(){var s,t,n=(s=this.instance.persistence)==null?void 0:s.props[mf],a=this.Mo,l=this.instance.Ur()&&!this.Io;if(Ds(a)&&!xi(n)&&!l)return!1;var d=(t=this.Mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!d}Po(s,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,a=Bd(s);Ob(a)&&(a=a.parentNode||null),t==="$autocapture"&&s.type==="click"&&s instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(s.clientX,s.clientY,s.timeStamp||new Date().getTime())&&y0(a,this.instance.config.rageclick)&&this.Po(s,"$rageclick");var l=t===Yd;if(a&&(function(f,w,E,A,C,b){var S;if(!ce||_p(f)||E!=null&&E.url_allowlist&&!_0(E.url_allowlist,b)||E!=null&&E.url_ignorelist&&_0(E.url_ignorelist,b))return!1;if(E!=null&&E.dom_event_allowlist){var _=E.dom_event_allowlist;if(_&&!_.some((k=>w.type===k)))return!1}var g=Pb(f,A),T=g.parentIsUsefulElement,R=g.targetElementList;if(!(function(k,D){var B=D==null?void 0:D.element_allowlist;if(ke(B))return!0;var I,q=function(J){if(B.some((ee=>J.tagName.toLowerCase()===ee)))return{v:!0}};for(var $ of k)if(I=q($))return I.v;return!1})(R,E)||!Of(R,E==null?void 0:E.css_selector_allowlist)||Of(R,(S=E==null?void 0:E.css_selector_ignorelist)!==null&&S!==void 0?S:j4))return!1;try{var M=ce.getComputedStyle(f);if(M&&M.getPropertyValue("cursor")==="pointer"&&w.type==="click")return!0}catch{}var j=f.tagName.toLowerCase();switch(j){case"html":return!1;case"form":return(C||["submit"]).indexOf(w.type)>=0;case"input":case"select":case"textarea":return(C||["change","click"]).indexOf(w.type)>=0;default:return T?(C||["click"]).indexOf(w.type)>=0:(C||["click"]).indexOf(w.type)>=0&&(vp.indexOf(j)>-1||f.getAttribute("contenteditable")==="true")}})(a,s,this.Te,l,l?["copy","cut"]:void 0,this.instance)){var d=CT(a,{e:s,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}),v=d.props;if(d.explicitNoCapture)return!1;var c=this.getElementSelectors(a);if(c&&c.length>0&&(v.$element_selectors=c),t===Yd){var u,p=zb(ce==null||(u=ce.getSelection())==null?void 0:u.toString()),y=s.type||"clipboard";if(!p)return!1;v.$selected_content=p,v.$copy_type=y}return this.instance.capture(t,v),!0}}}isBrowserSupported(){return Js(Re==null?void 0:Re.querySelectorAll)}},historyAutocapture:class{constructor(s){var t;this._instance=s,this.Oo=(ce==null||(t=ce.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Te.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,Te.info("History API monitoring stopped")}monitorHistoryChanges(){ce&&ce.history&&(this.Ao("pushState"),this.Ao("replaceState"),this.$o())}Ao(s){var t;if(ce&&((t=ce.history[s])==null||!t.__posthog_wrapped__)){var n=this;(function(a,l,d){try{if(!(l in a))return q0;var v={next:a[l]},c=d((function(){for(var u=arguments.length,p=new Array(u),y=0;u>y;y++)p[y]=arguments[y];return v.next.apply(this,p)}));return Js(c)&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:v}})),a[l]=c,()=>{if(a[l]!==c)for(var u=a[l];Js(u)&&u.__posthog_layer__;){var p=u.__posthog_layer__;if(p.next===c)return void(p.next=v.next);u=p.next}else a[l]=v.next}}catch{return q0}})(ce.history,s,(a=>function(l,d,v){a.call(this,l,d,v),n.Lo(s)}))}}Lo(s){try{var t,n=ce==null||(t=ce.location)==null?void 0:t.pathname;if(!n)return;n!==this.Oo&&this.isEnabled&&this._instance.capture(sa,{navigation_type:s}),this.Oo=n}catch(a){Te.error("Error capturing "+s+" pageview",a)}}$o(){if(!this.Fo){var s=()=>{this.Lo("popstate")};Ft(ce,"popstate",s),this.Fo=()=>{ce&&ce.removeEventListener("popstate",s)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(s){var t;this.Do=!1,this.Co=!1,this.No=null,this.instance=s,this.Do=!((t=this.instance.persistence)==null||!t.props[gf]),this.rageclicks=new F0(s.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var s=5e3;return Ht(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(s=this.Te.capture_heatmaps.flush_interval_milliseconds),s}get isEnabled(){return Xe(this.Te.capture_heatmaps)?Xe(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;kT.info("starting..."),this.qo(),this.xe()}else{var s;clearInterval((s=this.No)!==null&&s!==void 0?s:void 0),this.jo(),this.getAndClearBuffer()}}onRemoteConfig(s){if(s.ok){var t=s.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[gf]:n}),this.Do=n,this.startIfEnabled()}}}getAndClearBuffer(){var s=this.R;return this.R=void 0,s}Bo(s){Jd(s.originalEvent)&&this.pe(s.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(Re==null?void 0:Re.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){ce&&Re&&(this.Ho=this.oi.bind(this),Ft(ce,$c,this.Ho),this.Uo=s=>this.pe(s||(ce==null?void 0:ce.event)),Ft(Re,"click",this.Uo,{capture:!0}),this.zo=s=>this.Vo(s||(ce==null?void 0:ce.event)),Ft(Re,"mousemove",this.zo,{capture:!0}),this.Wo=new k0(this.instance,I4,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),Ft(Re,Ic,this.Zo),this.Co=!0)}jo(){var s;ce&&Re&&(this.Ho&&ce.removeEventListener($c,this.Ho),this.Uo&&Re.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&Re.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&Re.removeEventListener(Ic,this.Zo),clearTimeout(this.Go),(s=this.Wo)==null||s.stop(),this.Co=!1)}Qo(s,t){var n=this.instance.scrollManager.scrollY(),a=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),d=(function(v,c,u){for(var p=v;p&&zn(p)&&!Zs(p,"body");){if(p===u)return!1;var y=void 0;try{var f,w,E;y=(f=(w=(E=p.ownerDocument)==null?void 0:E.defaultView)!==null&&w!==void 0?w:ce)==null?void 0:f.getComputedStyle(p).position}catch{return!1}if(Fe(c,y))return!0;p=Ib(p)}return!1})(Bd(s),["fixed","sticky"],l);return{x:s.clientX+(d?0:a),y:s.clientY+(d?0:n),target_fixed:d,type:t}}pe(s,t){var n;if(t===void 0&&(t="click"),!v0(s.target)&&Jd(s)){var a=this.Qo(s,t);(n=this.rageclicks)!=null&&n.isRageClick(s.clientX,s.clientY,new Date().getTime())&&y0(Bd(s),this.instance.config.rageclick)&&this.Wt(be({},a,{type:"rageclick"})),this.Wt(a)}}Vo(s){!v0(s.target)&&Jd(s)&&(clearTimeout(this.Go),this.Go=setTimeout((()=>{this.Wt(this.Qo(s,"mousemove"))}),500))}Wt(s){if(ce){var t=this.Te.disable_capture_url_hashes?Hn(ce.location.href):ce.location.href,n=this.Te.custom_personal_data_properties,a=this.Te.mask_personal_data_properties?[..._a,...n||[]]:[],l=Fo(t,a,qo);this.R=this.R||{},this.R[l]||(this.R[l]=[]),this.R[l].push(s)}}oi(){this.R&&!Bn(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:k0,webVitalsAutocapture:class{constructor(s){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,a)=>be({},n,{["$web_vitals_"+a.name+"_event"]:be({},a),["$web_vitals_"+a.name+"_value"]:a.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=n=>{var a;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.Xo();if(!ke(l))if(Xe(n==null?void 0:n.name)||Xe(n==null?void 0:n.value))ar.error("Invalid metric received",n);else if(!this.ta||this.ta>n.value){this.R.url!==l&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),ke(this.R.url)&&(this.R.url=l),this.R.firstMetricTimestamp=ke(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var d=(a=this._instance.sessionManager)==null?void 0:a.checkAndGetSessionAndWindowId(!0),v=be({},n,{$current_url:l,timestamp:Date.now()});ke(d)||(v.$session_id=d.sessionId,v.$window_id=d.windowId),this.R.metrics.push(v),this.R.metrics.length===this.allowedMetrics.length&&this.Jo()}else ar.error("Ignoring metric with value >= "+this.ta,n)},this.ea=()=>{if(!this.Co){var n,a,l,d,v=Ie.__PosthogExtensions__;if(!ke(v)&&!ke(v.postHogWebVitalsCallbacks)){var c=v.postHogWebVitalsCallbacks;n=c.onLCP,a=c.onCLS,l=c.onFCP,d=c.onINP}n&&a&&l&&d?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&a(this.Yo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.Yo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&d(this.Yo.bind(this)),this.Co=!0):ar.error("web vitals callbacks not loaded - not starting")}},this._instance=s,this.Do=!((t=this._instance.persistence)==null||!t.props[wf]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var s,t,n=Ht(this.ra)?(s=this.ra)==null?void 0:s.web_vitals_allowed_metrics:void 0;return Xe(n)?((t=this._instance.persistence)==null?void 0:t.props[xf])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ht(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var s=Ht(this.ra)?this.ra.web_vitals_attribution:void 0;return s!=null&&s}get ta(){var s=Ht(this.ra)&&ys(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:W0;return s>0&&6e4>=s?W0:s}get isEnabled(){var s=Qt==null?void 0:Qt.protocol;if(s!=="http:"&&s!=="https:")return ar.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ht(this.ra)?this.ra.web_vitals:xi(this.ra)?this.ra:void 0;return xi(t)?t:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(ar.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(s){if(s.ok){var t=s.config;if("capturePerformance"in t){var n=Ht(t.capturePerformance)&&!!t.capturePerformance.web_vitals,a=Ht(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[wf]:n}),this._instance.persistence.register({[xf]:a})),this.Do=n,this.startIfEnabled()}}}tr(s){var t,n;(t=Ie.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?s():(n=Ie.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(a=>{a?ar.error("failed to load script",a):s()}))}Xo(){var s=ce?this._instance.config.disable_capture_url_hashes?Hn(ce.location.href):ce.location.href:void 0;if(s){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[..._a,...t||[]]:[];return Fo(s,n,qo)}ar.error("Could not determine current URL")}}},OT={exceptionObserver:class{constructor(s){var t;this.ea=()=>{var n;if(ce&&this.isEnabled&&(n=Ie.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,l=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,d=Ie.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ia&&this.Te.capture_unhandled_errors&&(this.ia=a(this.captureException.bind(this))),!this.na&&this.Te.capture_unhandled_rejections&&(this.na=l(this.captureException.bind(this))),!this.sa&&this.Te.capture_console_errors&&(this.sa=d(this.captureException.bind(this)))}catch(v){bo.error("failed to start",v),this.oa()}}},this._instance=s,this.aa=!((t=this._instance.persistence)==null||!t.props[yf]),this.la=new L3(be({},(function(n){var a,l,d,v;return n===void 0&&(n={}),{refillRate:(a=(l=n.exceptionRateLimiterRefillRate)!==null&&l!==void 0?l:n.__exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:1,bucketSize:(d=(v=n.exceptionRateLimiterBucketSize)!==null&&v!==void 0?v:n.__exceptionRateLimiterBucketSize)!==null&&d!==void 0?d:10}})(this._instance.config.error_tracking),{refillInterval:1e4,it:bo})),this.Te=this.ua(),this.startIfEnabledOrStop()}ua(){var s=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ht(s)?t=be({},t,s):(ke(s)?this.aa:s)&&(t=be({},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?(bo.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(s){var t,n;(t=Ie.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?s():(n=Ie.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(a=>{if(a)return bo.error("failed to load script",a);s()}))}oa(){var s,t,n;(s=this.ia)==null||s.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(s){if(s.ok){var t=s.config;"autocaptureExceptions"in t&&(this.aa=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[yf]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(s){var t,n,a,l=(t=s==null||(n=s.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.la.consumeRateLimit(l)?bo.info("Skipping exception capture because of client rate limiting.",{exception:l}):(a=this._instance.exceptions)==null||a.sendExceptionEvent(s)}},exceptions:class{constructor(s){var t,n;this.ha=[],this.da=new J3([new r4,new p4,new o4,new a4,new d4,new h4,new c4,new f4],(function(a){for(var l=arguments.length,d=new Array(l>1?l-1:0),v=1;l>v;v++)d[v-1]=arguments[v];return function(c,u){u===void 0&&(u=0);for(var p=[],y=c.split(`
444
- `),f=u;y.length>f;f++){var w=y[f];if(1024>=w.length){var E=h0.test(w)?w.replace(h0,"$1"):w;if(!E.match(/\S*Error: /)){for(var A of d){var C=A(E,a);if(C){p.push(C);break}}if(p.length>=50)break}}}return(function(b){if(!b.length)return[];var S=Array.from(b);return S.reverse(),S.slice(0,50).map((_=>{return be({},_,{filename:_.filename||(g=S,g[g.length-1]||{}).filename,function:_.function||pa});var g}))})(p)}})("web:javascript",t4,n4)),this._instance=s,this.ha=(t=(n=this._instance.persistence)==null?void 0:n.get_property(bf))!==null&&t!==void 0?t:[],this.ca=Lc(this.va()),this.fa=new _4(this.ca)}onConfigChange(){this.ca=Lc(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(s){var t,n,a;if(s.ok){var l=s.config;if("errorTracking"in l){var d=(t=(n=l.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],v=(a=l.errorTracking)==null?void 0:a.captureExtensionExceptions;this.ha=d,this._instance.persistence&&this._instance.persistence.register({[bf]:this.ha,[Sf]:v})}}}get pa(){var s,t=!!this._instance.get_property(Sf),n=this._instance.config.error_tracking.captureExtensionExceptions;return(s=n??t)!==null&&s!==void 0&&s}buildProperties(s,t){return this.da.buildFromUnknown(s,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(s,t){if(this.ca.enabled)try{if(!kt(s)||s.trim().length===0)return void Ri.warn("Ignoring exception step because message must be a non-empty string");var n=(function(d){if(!d)return{sanitizedProperties:{},droppedKeys:[]};var v=[];return{sanitizedProperties:Object.keys(d).reduce(((c,u)=>v4.has(u)?(v.push(u),c):(c[u]=d[u],c)),{}),droppedKeys:v}})(this.ga(t)),a=n.sanitizedProperties,l=n.droppedKeys;l.length>0&&Ri.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this.fa.add(be({[jc]:s,[Nc]:new Date().toISOString()},a))}catch(d){Ri.error("Failed to add exception step. Ignoring breadcrumb.",d)}}sendExceptionEvent(s){try{var t=s.$exception_list;if(this.ma(t)){if(this.ya(t))return this.ba("Exception dropped: matched a suppression rule"),void Ri.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 Ri.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 Ri.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ca.enabled&&Xe(s.$exception_steps)?this.xa(s):s,a=typeof(d=globalThis._posthogReleaseId)=="string"&&d.length>0?d:void 0;a&&(n.$release_id=a);try{var l=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return l&&this.fa.clear(),l}catch(v){return Ri.error("Failed to capture exception event. Dropping this exception.",v),void this.fa.clear()}}catch(v){return void Ri.error("Failed to process exception event. Ignoring this exception.",v)}var d}xa(s){try{var t=this.fa.getAttachable();return t.length===0?s:be({},s,{$exception_steps:t})}catch(n){return Ri.error("Failed to read buffered exception steps. Capturing exception without steps.",n),s}}ba(s){this.ca.enabled&&this.fa.add({[jc]:s,[Nc]:new Date().toISOString()})}ga(s){return Ht(s)?be({},s):{}}va(){var s,t;return(s=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&s!==void 0?s:{}}ya(s){if(s.length===0)return!1;try{var t=s.reduce(((n,a)=>{var l=a.type,d=a.value;return kt(l)&&l.length>0&&n.$exception_types.push(l),kt(d)&&d.length>0&&n.$exception_values.push(d),n}),{$exception_types:[],$exception_values:[]});return this.ha.some((n=>{var a=n.values.map((l=>{var d=p1[l.operator],v=t[l.key];if(!d||!v)return!1;var c=Ve(l.value)?l.value:[l.value];return c.length>0&&d(c,v)}));return n.type==="OR"?a.some(Boolean):a.every(Boolean)}))}catch(n){return Ri.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}_a(s){return s.flatMap((t=>{var n,a;return(n=(a=t.stacktrace)==null?void 0:a.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(s){if(s.length>0){var t,n,a,l,d=(t=(n=s[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],v=d[d.length-1];return(a=v==null||(l=v.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&a!==void 0&&a}return!1}ma(s){return!Xe(s)&&Ve(s)}}},BT=be({productTours:class{get mi(){return this._instance.persistence}constructor(s){this.ka=null,this.Sa=null,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(s.ok){var t=s.config;if("productTours"in t){var n,a;if(this.mi&&this.mi.register({[up]:!!t.productTours}),!Qd(this._instance))return!this.ka&&Xe((n=this.mi)==null?void 0:n.props[ko])||Zd.info("product tours disabled; stopping and clearing cached tours"),(a=this.ka)==null||a.stop(),this.ka=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ka&&Qd(this._instance)&&this.tr((()=>this.Ca()))}tr(s){var t,n;(t=Ie.__PosthogExtensions__)!=null&&t.generateProductTours?s():(n=Ie.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(a=>{a?Zd.error("Could not load product tours script",a):s()}))}Ca(){var s;!this.ka&&(s=Ie.__PosthogExtensions__)!=null&&s.generateProductTours&&(this.ka=Ie.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(s,t){if(t===void 0&&(t=!1),!Ve(this.Sa)||t){var n=this.mi;if(n){var a=n.props[ko];if(Ve(a)&&!t)return this.Sa=a,void s(a,{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:l=>{if(Qd(this._instance)){var d=l.statusCode;if(d!==200||!l.json){var v="Product Tours API could not be loaded, status: "+d;return Zd.error(v),void s([],{isLoaded:!1,error:v})}var c=Ve(l.json.product_tours)?l.json.product_tours:[];this.Sa=c,n&&n.register({[ko]:c}),s(c,{isLoaded:!0})}else s([],{isLoaded:!0})}})}else s(this.Sa,{isLoaded:!0})}getActiveProductTours(s){Xe(this.ka)?s([],{isLoaded:!1,error:"Product tours not loaded"}):this.ka.getActiveProductTours(s)}showProductTour(s){var t;(t=this.ka)==null||t.showTourById(s)}previewTour(s){this.ka?this.ka.previewTour(s):this.tr((()=>{var t;this.Ca(),(t=this.ka)==null||t.previewTour(s)}))}dismissProductTour(){var s;(s=this.ka)==null||s.dismissTour("user_clicked_skip")}nextStep(){var s;(s=this.ka)==null||s.nextStep()}previousStep(){var s;(s=this.ka)==null||s.previousStep()}clearCache(){var s;this.Sa=null,(s=this.mi)==null||s.unregister(ko)}resetTour(s){var t;(t=this.ka)==null||t.resetTour(s)}resetAllTours(){var s;(s=this.ka)==null||s.resetAllTours()}cancelPendingTour(s){var t;(t=this.ka)==null||t.cancelPendingTour(s)}}},iu),HT={siteApps:class{constructor(s){this.Ma=0,this._instance=s,this.Ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ta(s,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 s;return(s=Ie._POSTHOG_REMOTE_CONFIG)==null||(s=s[this._instance.config.token])==null?void 0:s.siteApps}initialize(){if(this.isEnabled){var s=this._instance._addCaptureHook(this.Ta.bind(this));this.Ea=()=>{s(),this.Ia=[],this.Ea=void 0}}}globalsForEvent(s){var t,n,a,l,d,v,c;if(!s)throw new Error("Event payload is required");var u={},p=this._instance.get_property("$groups")||[],y=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(y)){var w=f[0];u[w]={id:p[w],type:w,properties:f[1]}}var E=s.$set_once,A=s.$set;return{event:be({},Py(s,TT),{properties:be({},s.properties,A?{$set:be({},(t=(n=s.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},A)}:{},E?{$set_once:be({},(a=(l=s.properties)==null?void 0:l.$set_once)!==null&&a!==void 0?a:{},E)}:{}),elements_chain:(d=(v=s.properties)==null?void 0:v.$elements_chain)!==null&&d!==void 0?d:"",distinct_id:(c=s.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Ra(s){var t,n=(t=s.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(s)||(Ai.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(s)||(Ai.error("prepare_external_dependency_script returned null"),null):s}Pa(){var s,t,n,a,l,d,v,c;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=Re==null?void 0:Re.defaultView,p=u==null||(s=u.Node)==null?void 0:s.prototype;if(!u||!p)return()=>{};if(this.Ma++,this.Oa)return this.Fa();var y=[],f=this,w=new WeakSet,E=(b,S,_)=>{if(b!=null&&b[S]){var g=b[S];b[S]=_(g),y.push((()=>{b[S]=g}))}},A=b=>{if(w.has(b))return b;var S=f.Ra(b);return S&&w.add(S),S},C=b=>b.map((S=>typeof S=="string"?S:A(S))).filter((S=>!Ds(S)));return E(p,"appendChild",(b=>function(S){var _=A(S);return _?b.call(this,_):S})),E(p,"insertBefore",(b=>function(S,_){var g=A(S);return g?b.call(this,g,_):S})),E(p,"replaceChild",(b=>function(S,_){var g=A(S);return g?b.call(this,g,_):_})),[(t=u.Element)==null?void 0:t.prototype,(n=u.Document)==null?void 0:n.prototype,(a=u.DocumentFragment)==null?void 0:a.prototype].forEach((b=>{E(b,"append",(S=>function(){for(var _=arguments.length,g=new Array(_),T=0;_>T;T++)g[T]=arguments[T];return S.apply(this,C(g))})),E(b,"prepend",(S=>function(){for(var _=arguments.length,g=new Array(_),T=0;_>T;T++)g[T]=arguments[T];return S.apply(this,C(g))}))})),[(l=u.Element)==null?void 0:l.prototype,(d=u.CharacterData)==null?void 0:d.prototype,(v=u.DocumentType)==null?void 0:v.prototype].forEach((b=>{E(b,"before",(S=>function(){for(var _=arguments.length,g=new Array(_),T=0;_>T;T++)g[T]=arguments[T];return S.apply(this,C(g))})),E(b,"after",(S=>function(){for(var _=arguments.length,g=new Array(_),T=0;_>T;T++)g[T]=arguments[T];return S.apply(this,C(g))})),E(b,"replaceWith",(S=>function(){for(var _=arguments.length,g=new Array(_),T=0;_>T;T++)g[T]=arguments[T];var R=C(g);return g.length&&!R.length?void 0:S.apply(this,R)}))})),E((c=u.Element)==null?void 0:c.prototype,"insertAdjacentElement",(b=>function(S,_){var g=A(_);return g?b.call(this,S,g):null})),this.Oa=()=>{y.forEach((b=>b())),this.Oa=void 0},this.Fa()}Fa(){var s=!1;return()=>{var t;s||(s=!0,this.Ma--,this.Ma===0&&((t=this.Oa)==null||t.call(this)))}}Aa(s,t){t===void 0&&(t=!0);var n=this.Pa();try{var a=s(n);return t&&n(),a}catch(l){throw n(),l}}setupSiteApp(s){var t=this.apps[s.id],n=()=>{var v;!t.errored&&this.Ia.length&&(Ai.info("Processing "+this.Ia.length+" events for site app with id "+s.id),this.Ia.forEach((c=>this.Aa((()=>t.processEvent==null?void 0:t.processEvent(c))))),t.processedBuffer=!0),Object.values(this.apps).every((c=>c.processedBuffer||c.errored))&&((v=this.Ea)==null||v.call(this))},a=!1,l=v=>{t.errored=!v,t.loaded=!0,Ai.info("Site app with id "+s.id+" "+(v?"loaded":"errored")),a&&n()};try{var d=this.Aa((v=>s.init({posthog:this._instance,callback(c){v(),l(c)}})),!1).processEvent;d&&(t.processEvent=d),a=!0}catch(v){Ai.error(Y0+s.id,v),l(!1)}if(a&&t.loaded)try{n()}catch(v){Ai.error("Error while processing buffered events PostHog app with config id "+s.id,v),t.errored=!0}}$a(){var s=this.siteAppLoaders||[];for(var t of s)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of s)this.setupSiteApp(n)}La(s){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(s),a=function(d){try{t.Aa((()=>d.processEvent==null?void 0:d.processEvent(n)))}catch(v){Ai.error("Error while processing event "+s.event+" for site app "+d.id,v)}};for(var l of Object.values(this.apps))a(l)}}onRemoteConfig(s){var t,n,a,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(u=>this.La(u)))):void Ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ea)==null||n.call(this),s.ok){var d=s.config;if((a=d.siteApps)!=null&&a.length)if(this.isEnabled){var v=function(){var u,p=c.id,y=c.url;Ie["__$$ph_site_app_"+p]=l._instance,(u=Ie.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(l._instance,y,(f=>{if(f)return Ai.error(Y0+p,f)}))};for(var c of d.siteApps)v()}else Ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},zT={tracingHeaders:class{constructor(s){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,n,a=this.ja();a?(ke(this.Da)&&(this.Da=(t=Ie.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(a,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ke(this.Na)&&(this.Na=(n=Ie.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(a,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=s}initialize(){this.startIfEnabledOrStop()}tr(s){var t,n;(t=Ie.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?s():(n=Ie.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(a=>{if(a)return ET.error("failed to load script",a);s()}))}Ba(){var s,t;return(s=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&s!==void 0?s:this._instance.config.__add_tracing_headers}ja(){var s=this.Ba();return Ve(s)?(Ve(this.qa)?this.qa.splice(0,this.qa.length,...s):this.qa=[...s],s.length>0?this.qa:void 0):(Ve(this.qa)&&this.qa.splice(0),this.qa=s||void 0,this.qa)}oa(){var s,t;(s=this.Da)==null||s.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()}}},IT=be({surveys:class{get Te(){return this._instance.config}constructor(s){this.Ha=void 0,this._surveyManager=null,this.Ua=!1,this.za=[],this.Va=null,this.Wa=null,this._instance=s,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(!this.Te.disable_surveys){if(!s.ok)return St.warn("Remote config unavailable. Not loading surveys.");var t=s.config.surveys;if(Xe(t))return St.warn("Flags not loaded yet. Not loading surveys.");var n=Ve(t);this.Ha=n?t.length>0:t,St.info("flags response received, isSurveysEnabled: "+this.Ha),this.loadIfEnabled()}}reset(){try{var s;(s=this._surveyEventReceiver)==null||s.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var a=localStorage.key(n);(a!=null&&a.startsWith(m1)||a!=null&&a.startsWith("inProgressSurvey_"))&&t.push(a)}t.forEach((l=>localStorage.removeItem(l)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Ua)St.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)St.info(X0);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())St.info("Not loading surveys in cookieless mode without consent.");else{var s=Ie==null?void 0:Ie.__PosthogExtensions__;if(s){if(!ke(this.Ha)||this.Te.advanced_enable_surveys){var t=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var n=s.generateSurveys;if(n)return void this.Za(n,t);var a=s.loadExternalDependency;if(!a)return void this.Ga(dp);a(this._instance,"surveys",(l=>{l||!s.generateSurveys?this.Ga("Could not load surveys script",l):this.Za(s.generateSurveys,t)}))}catch(l){throw this.Ga("Error initializing surveys",l),l}finally{this.Ua=!1}}}else St.error("PostHog Extensions not found.")}}Za(s,t){this._surveyManager=s(this._instance,t),this._surveyEventReceiver=new MT(this._instance),St.info("Surveys loaded successfully"),this.Qa({isLoaded:!0})}Ga(s,t){St.error(s,t),this.Qa({isLoaded:!1,error:s})}onSurveysLoaded(s){return this.za.push(s),this._surveyManager&&this.Qa({isLoaded:!0}),()=>{this.za=this.za.filter((t=>t!==s))}}getSurveys(s,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return St.info(X0),s([]);var n,a=this._instance.get_property(kf);if(a&&!t)return s(a,{isLoaded:!0}),void(this.Ja()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Va?this.Va.then((l=>s(l.surveys,l.context))):(typeof Promise<"u"&&(this.Va=new Promise((l=>{n=l}))),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:l=>{var d;this.Va=null;var v=l.statusCode;if(v!==200||!l.json){var c="Surveys API could not be loaded, status: "+v;St.error(c),this.Wa=Date.now();var u={isLoaded:!1,error:c};return s([],u),void(n==null||n({surveys:[],context:u}))}this.Wa=null;var p,y=l.json.surveys||[],f=y.filter((E=>(function(A){return!(!A.start_date||A.end_date)})(E)&&(_1(E)||(function(A){var C;return!((C=A.conditions)==null||(C=C.actions)==null||(C=C.values)==null||!C.length)})(E))));f.length>0&&((p=this._surveyEventReceiver)==null||p.register(f)),(d=this._instance.persistence)==null||d.register({[kf]:y,[Bc]:Date.now()});var w={isLoaded:!0};s(y,w),n==null||n({surveys:y,context:w})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var s=this._instance.get_property(Bc);return ys(s)&&Date.now()-s>3e5}Ya(){return ys(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(s,t){var n,a={id:s,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};g1(a);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Qa(s){for(var t of this.za)try{if(!s.isLoaded)return t([],s);this.getSurveys(t)}catch(n){St.error("Error in survey callback",n)}}getActiveMatchingSurveys(s,t){if(t===void 0&&(t=!1),!Xe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(s,t);St.warn("init was not called")}Xa(s){var t=null;return this.getSurveys((n=>{var a;t=(a=n.find((l=>l.id===s)))!==null&&a!==void 0?a:null})),t}tl(s){if(Xe(this._surveyManager))return{eligible:!1,reason:vc};var t=typeof s=="string"?this.Xa(s):s;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}el(s){if(Xe(this._surveyManager))return{eligible:!1,reason:vc};var t=typeof s=="string"?this.Xa(s):s;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(s){if(Xe(this._surveyManager))return St.warn("init was not called"),{visible:!1,disabledReason:vc};var t=this.el(s);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(s,t){return Xe(this._surveyManager)?(St.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vc})):new Promise((n=>{this.getSurveys((a=>{var l,d=(l=a.find((c=>c.id===s)))!==null&&l!==void 0?l:null;if(d){var v=this.el(d);n({visible:v.eligible,disabledReason:v.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(s,t,n){var a;if(Xe(this._surveyManager))St.warn("init was not called");else{var l=typeof s=="string"?this.Xa(s):s;if(l!=null&&l.id)if(dT.includes(l.type)){var d=Re==null?void 0:Re.querySelector(t);if(d)return(a=l.appearance)!=null&&a.surveyPopupDelaySeconds?(St.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var v,c;St.info("Rendering survey "+l.id+" with delay of "+((v=l.appearance)==null?void 0:v.surveyPopupDelaySeconds)+" seconds"),(c=this._surveyManager)==null||c.renderSurvey(l,d,n),St.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,d,n);St.warn("Survey element not found")}else St.warn("Surveys of type "+l.type+" cannot be rendered in the app");else St.warn("Survey not found")}}displaySurvey(s,t){var n;if(Xe(this._surveyManager))St.warn("init was not called");else{var a=this.Xa(s);if(a){var l=a;if((n=a.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=be({},a,{appearance:be({},a.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Hf.Popover&&t.initialResponses&&St.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var d=this.tl(a);if(!d.eligible)return void St.warn("Survey is not eligible to be displayed: ",d.reason)}t.displayType!==Hf.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else St.warn("Survey not found")}}cancelPendingSurvey(s){Xe(this._surveyManager)?St.warn("init was not called"):this._surveyManager.cancelSurvey(s)}handlePageUnload(){var s;(s=this._surveyManager)==null||s.handlePageUnload==null||s.handlePageUnload()}}},iu),$T={toolbar:class{constructor(s){this.instance=s}rl(s){Ie.ph_toolbar_state=s}il(){var s;return(s=Ie.ph_toolbar_state)!==null&&s!==void 0?s:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(s,t,n){if(s===void 0&&(s=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Mb(this.instance.config)||!ce||!Re)return!1;s=s??ce.location,n=n??ce.history;try{if(!t){try{ce.localStorage.setItem("test","test"),ce.localStorage.removeItem("test")}catch{return!1}t=ce==null?void 0:ce.localStorage}var a,l=DT||qc(s.hash,"__posthog")||qc(s.hash,"state"),d=l?f0((()=>JSON.parse(atob(decodeURIComponent(l)))))||f0((()=>JSON.parse(decodeURIComponent(l)))):null;return d&&d.action==="ph_authorize"?((a=d).source="url",a&&Object.keys(a).length>0&&(d.desiredHash?s.hash=d.desiredHash:n?n.replaceState(n.state,"",s.pathname+s.search):s.hash="")):((a=JSON.parse(t.getItem(K0)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}nl(s){var t=Ie.ph_load_toolbar||Ie.ph_load_editor;!Xe(t)&&Js(t)?t(s,this.instance):J0.warn("No toolbar load function found")}loadToolbar(s){var t=!(Re==null||!Re.getElementById(Lb));if(!ce||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,a=be({token:this.instance.config.token},s,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ce.localStorage.setItem(K0,JSON.stringify(be({},a,{source:void 0}))),this.il()===2)this.nl(a);else if(this.il()===0){var l;this.rl(1),(l=Ie.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(d=>{if(d)return J0.error("[Toolbar] Failed to load",d),void this.rl(0);this.rl(2),this.nl(a)})),Ft(ce,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(a)}))}return!0}sl(s){return this.loadToolbar(s)}maybeLoadEditor(s,t,n){return s===void 0&&(s=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(s,t,n)}}},PT=be({experiments:ws},iu),UT={conversations:class{constructor(s){this.ol=void 0,this._conversationsManager=null,this.al=!1,this.ll=null,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(!this._instance.config.disable_conversations&&s.ok){var t=s.config.conversations;Xe(t)||(xi(t)?this.ol=t:(this.ol=t.enabled,this.ll=t),this.loadIfEnabled())}}reset(){var s;(s=this._conversationsManager)==null||s.reset(),this._conversationsManager=null,this.ol=void 0,this.ll=null}loadIfEnabled(){if(!(this._conversationsManager||this.al||this._instance.config.disable_conversations||Mb(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var s=Ie==null?void 0:Ie.__PosthogExtensions__;if(s&&!ke(this.ol)&&this.ol)if(this.ll&&this.ll.token){this.al=!0;try{var t=s.initConversations;if(t)return this.ul(t),void(this.al=!1);var n=s.loadExternalDependency;if(!n)return void this.hl(dp);n(this._instance,"conversations",(a=>{a||!s.initConversations?this.hl("Could not load conversations script",a):this.ul(s.initConversations),this.al=!1}))}catch(a){this.hl("Error initializing conversations",a),this.al=!1}}else hi.error("Conversations enabled but missing token in remote config.")}}ul(s){if(this.ll)try{this._conversationsManager=s(this.ll,this._instance),hi.info("Conversations loaded successfully")}catch(t){this.hl("Error completing conversations initialization",t)}else hi.error("Cannot complete initialization: remote config is null")}hl(s,t){hi.error(s,t),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():hi.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!Ds(this._conversationsManager)}isVisible(){var s,t;return(s=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&s!==void 0&&s}sendMessage(s,t,n){var a=this;return zt((function*(){return a._conversationsManager?a._conversationsManager.sendMessage(s,t,n):(hi.warn(lr),null)}))()}getMessages(s,t){var n=this;return zt((function*(){return n._conversationsManager?n._conversationsManager.getMessages(s,t):(hi.warn(lr),null)}))()}markAsRead(s){var t=this;return zt((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(s):(hi.warn(lr),null)}))()}getTickets(s){var t=this;return zt((function*(){return t._conversationsManager?t._conversationsManager.getTickets(s):(hi.warn(lr),null)}))()}requestRestoreLink(s){var t=this;return zt((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(s):(hi.warn(lr),null)}))()}restoreFromToken(s){var t=this;return zt((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(s):(hi.warn(lr),null)}))()}restoreFromUrlToken(){var s=this;return zt((function*(){return s._conversationsManager?s._conversationsManager.restoreFromUrlToken():(hi.warn(lr),null)}))()}getCurrentTicketId(){var s,t;return(s=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&s!==void 0?s:null}getWidgetSessionId(){var s,t;return(s=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&s!==void 0?s:null}Nn(){var s;(s=this._conversationsManager)==null||s.setIdentity()}qn(){var s;(s=this._conversationsManager)==null||s.clearIdentity()}}},FT={logs:class{constructor(s){var t;this.dl=!1,this.cl=!1,this.it=$t("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var n,a;this.Js=0,(n=this.pl)==null||n.onReconnect(),(a=this.gl)==null||a.onReconnect()},this._instance=s,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),ce&&Ft(ce,"online",this.fl)}ml(s,t,n,a){var l,d=(function(v,c){var u,p,y,f,w,E,A,C=(u=v==null?void 0:v.flushIntervalMs)!==null&&u!==void 0?u:3e3,b=(p=v==null?void 0:v.maxBufferSize)!==null&&p!==void 0?p:100,S=c!=null&&c.consoleCapture?void 0:(y=v==null?void 0:v.maxLogsPerInterval)!==null&&y!==void 0?y:1e3,_=ke(S)?Math.max(b,2048):Math.max(b,S),g=v==null?void 0:v.resourceAttributes;return{serviceName:(f=(w=g==null?void 0:g["service.name"])!==null&&w!==void 0?w:v==null?void 0:v.serviceName)!==null&&f!==void 0?f:c==null?void 0:c.serviceNameDefault,serviceVersion:(E=g==null?void 0:g["service.version"])!==null&&E!==void 0?E:v==null?void 0:v.serviceVersion,environment:(A=g==null?void 0:g["deployment.environment"])!==null&&A!==void 0?A:v==null?void 0:v.environment,resourceAttributes:g,beforeSend:v==null?void 0:v.beforeSend,flushIntervalMs:C,maxBufferSize:b,maxQueueSize:_,maxBatchRecordsPerPost:100,rateCapWindowMs:C,maxLogsPerInterval:S,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((l=this._instance)==null||(l=l.config)==null?void 0:l.logs,n);return[new Y3(this.yl(s,t),d,this.it,(()=>this.bl()),(v=>v()),void 0,a),d]}_l(){var s,t=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.pl||this.wl!==t){var n;(n=this.pl)==null||n.reset(),this.wl=t;var a=this.ml((()=>this.Gr),(l=>{this.Gr=l}));this.pl=a[0],this.xl=a[1]}return this.pl}kl(){var s,t=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.gl||this.Sl!==t){var n;(n=this.gl)==null||n.reset(),this.Sl=t;var a=this.ml((()=>this.vl),(l=>{this.vl=l}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ty);this.gl=a[0],this.Cl=a[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(s){var t;if(s.ok){var n=(t=s.config.logs)==null?void 0:t.captureConsoleLogs;!Xe(n)&&n&&(this.dl=!0,this.loadIfEnabled())}}reset(){var s,t;this.Gr=[],(s=this.pl)==null||s.reset(),this.vl=[],(t=this.gl)==null||t.reset(),this.Js=0}captureLog(s){this._l().captureLog(s)}le(s){this.kl().captureLog(s)}get logger(){return this.Ml||(this.Ml={trace:(s,t)=>this.captureLog({body:s,level:"trace",attributes:t}),debug:(s,t)=>this.captureLog({body:s,level:"debug",attributes:t}),info:(s,t)=>this.captureLog({body:s,level:"info",attributes:t}),warn:(s,t)=>this.captureLog({body:s,level:"warn",attributes:t}),error:(s,t)=>this.captureLog({body:s,level:"error",attributes:t}),fatal:(s,t)=>this.captureLog({body:s,level:"fatal",attributes:t})}),this.Ml}flushLogs(s){s?this.Il(s):(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 s=Ie==null?void 0:Ie.__PosthogExtensions__;if(s){var t=s.loadExternalDependency;t?t(this._instance,"logs",(n=>{var a;n||(a=s.logs)==null||!a.initializeLogs?this.it.error("Could not load logs script",n):(s.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(dp)}else this.it.error("PostHog Extensions not found.")}}yl(s,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:a=>a===sn.LogsQueue?s():void 0,setPersistedProperty(a,l){var d;a===sn.LogsQueue&&t((d=l)!==null&&d!==void 0?d:[])},$t:a=>this.$t(a),getLibraryId:()=>gt.LIB_NAME,getLibraryVersion:()=>gt.LIB_VERSION}}$t(s){return new Promise((t=>{if(Gb(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,a=d=>{n||(n=!0,clearTimeout(l),t(d))},l=setTimeout((()=>a({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Tl(),data:s,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:d=>{var v=d.statusCode;if(this.El(v),v>=200&&300>v)a({kind:"ok"});else if(v===413)a({kind:"too-large"});else if(v!==0&&v!==429&&500>v)a({kind:"fatal",error:new Error("logs request failed with status "+v)});else{var c;a({kind:"retry-later",error:(c=d.error)!==null&&c!==void 0?c:new Error("logs request failed with status "+v)})}}})}}))}El(s){(s!==0||this._instance.__loaded)&&(this.Js=Vb(s,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(s){this.Gr.length>0&&this.Rl(s,this.Gr,this.xl,gt.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(s,this.vl,this.Cl,ty,(t=>{this.vl=t}))}Rl(s,t,n,a,l){if(t.length!==0){var d=t.map((c=>c.record));l([]);var v=_b(d,vb(n,gt.LIB_NAME,gt.LIB_VERSION),a,gt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tl(),data:v,compression:"best-available",batchKey:"logs",transport:s})}}Tl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}bl(){var s,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),a=n.windowId,l=n.sessionStartTimestamp,d=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=a,Xe(l)||(t.sessionStartTimestamp=l),Xe(d)||(t.lastActivityTimestamp=d)}if(Ie!=null&&(s=Ie.location)!=null&&s.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Hn(Ie.location.href):Ie.location.href),this._instance.featureFlags){var v=this._instance.featureFlags.getFlags();v&&v.length>0&&(t.activeFeatureFlags=v)}return t}}},qT={metrics:class{constructor(s){this.it=$t("[metrics]"),this._instance=s}initialize(){}_l(){var s,t,n=(s=this._instance)==null||(s=s.config)==null?void 0:s.metrics;return this.pl&&this.wl===n||((t=this.pl)==null||t.reset(),this.wl=n,this.pl=new X3(this.yl(),(function(a){var l,d,v,c,u,p=a==null?void 0:a.resourceAttributes;return{serviceName:(l=p==null?void 0:p["service.name"])!==null&&l!==void 0?l:a==null?void 0:a.serviceName,serviceVersion:(d=p==null?void 0:p["service.version"])!==null&&d!==void 0?d:a==null?void 0:a.serviceVersion,environment:(v=p==null?void 0:p["deployment.environment"])!==null&&v!==void 0?v:a==null?void 0:a.environment,resourceAttributes:p,beforeSend:a==null?void 0:a.beforeSend,flushIntervalMs:(c=a==null?void 0:a.flushIntervalMs)!==null&&c!==void 0?c:1e4,maxSeriesPerFlush:(u=a==null?void 0:a.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(n),this.it)),this.pl}count(s,t,n){t===void 0&&(t=1),this._l().count(s,t,n)}gauge(s,t,n){this._l().gauge(s,t,n)}histogram(s,t,n){this._l().histogram(s,t,n)}flush(s){if(!this.pl)return Promise.resolve();if(s){var t=this.pl.drainWindow();return t&&this.Kt(t,s),Promise.resolve()}return this.pl.flush().catch((n=>this.it.error("PostHog metrics flush failed:",n)))}reset(){var s;(s=this.pl)==null||s.reset()}yl(){var s=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},Kt:n=>t.Kt(n),getLibraryId:()=>gt.LIB_NAME,getLibraryVersion:()=>gt.LIB_VERSION}}Kt(s,t){return new Promise((n=>{var a=!1,l=v=>{a||(a=!0,clearTimeout(d),n(v))},d=setTimeout((()=>l({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(be({method:"POST",url:this.Pl(),data:s,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(v){var c=v.statusCode;if(c>=200&&300>c)l({kind:"ok"});else if(c===413)l({kind:"too-large"});else if(c!==0&&c!==429&&500>c)l({kind:"fatal",error:new Error("metrics request failed with status "+c)});else{var u;l({kind:"retry-later",error:(u=v.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+c)})}}}))}))}Pl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},WT=be({},iu,NT,LT,OT,BT,HT,IT,zT,$T,PT,UT,FT,qT);pi.__defaultExtensionClasses=be({},WT);var vi=(function(){gt.SDK_DIST_CHANNEL="npm";var s=No[ia]=new pi;return(function(){function t(){t.done||(t.done=!0,b1=!1,Tt(No,(function(n){n._dom_loaded()})))}Re!=null&&Re.addEventListener?Re.readyState==="complete"?t():Ft(Re,"DOMContentLoaded",t,{capture:!1}):ce&&Te.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),s})();const sy=120,GT=new Set(["attr__class","attr__id"]),VT=/attr__href="([^"]*)"/gi,YT=/(?:current_url|referrer|pathname)$/;function XT(s){const t=typeof s.surface=="string"?s.surface.toLowerCase():"",n=typeof s.object=="string"?s.object.toLowerCase():"";return/secret|vault|credential/.test(t)||/secret|vault|credential/.test(n)}function Lo(s){if(typeof s!="string"||s.length===0)return s;let t;try{t=new URL(s)}catch{return s}return`${t.origin}${t.pathname}`}function S1(s){return s.length>sy?`${s.slice(0,sy)}…`:s}function KT(s,t){if(t){delete s.$el_text;for(const n of Object.keys(s))n.startsWith("attr__")&&!GT.has(n)&&delete s[n];return}typeof s.$el_text=="string"&&(s.$el_text=S1(s.$el_text)),typeof s.attr__href=="string"&&(s.attr__href=Lo(s.attr__href))}function JT(s,t){const n=s.$elements;if(Array.isArray(n))for(const a of n)a&&typeof a=="object"&&KT(a,t);if(typeof s.$elements_chain=="string"){if(t){delete s.$elements_chain;return}s.$elements_chain=s.$elements_chain.replace(VT,(a,l)=>{const d=Lo(l);return typeof d=="string"?`attr__href="${d}"`:a})}}function ZT(s,t){t.$current_url=Lo(t.$current_url),t.$referrer=Lo(t.$referrer);for(const n of[s.$set,s.$set_once]){if(!n)continue;const a=n;for(const l of Object.keys(a))YT.test(l)&&(a[l]=Lo(a[l]))}}function QT(s,t){typeof s.$el_text=="string"&&(t?delete s.$el_text:s.$el_text=S1(s.$el_text)),JT(s,t)}function eA(s){if(!s)return s;try{const t=s.properties??{},n=XT(t);return ZT(s,t),QT(t,n),s.properties=t,s}catch{return s}}function tA(s){if(!s)return"unknown";if(s.settingsOpen)return"account";if(s.firstRun&&!s.hasLiveSession)return"onboarding";if(s.templatesOpen)return"agent_build";if(s.hasLiveSession){const t=s.rightTab??"";return t==="logs"||t==="diff"?"agent_observe":t==="canvas"||t==="preview"?"agent_operate":"agent_build"}return s.inspectingDeadSession?"agent_observe":"unknown"}function sA(s,t){try{vi.capture(s,t)}catch{}}function iA(s){try{const t={};for(const[n,a]of Object.entries(s))a!=null&&a!==""&&(t[n]=a);vi.register(t)}catch{}}function nA(s){try{const t=tA(s);vi.register({journey:t,view:rA(s)})}catch{}}function rA(s){return s.settingsOpen?"settings":s.firstRun&&!s.hasLiveSession?"welcome":s.templatesOpen?"templates":s.hasLiveSession?`workbench:${s.rightTab??"chat"}`:s.inspectingDeadSession?"session_history":"unknown"}function aA(){if(typeof window>"u")return null;const s=window.__HARNESS__,t=s==null?void 0:s.posthog;return t!=null&&t.key?t:null}function oA(s){return s.consentSource==="env-forced-off"}function w1(s){return!oA(s)&&s.productAnalyticsOptIn}let Oo=!1;function lA(s){if(Oo){tf(s),nf(s);return}const t=aA();if(t&&w1(s)){if(vi.__loaded){Oo=!0,tf(s),nf(s);return}vi.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:eA,persistence:"localStorage",disable_session_recording:!0}),Oo=!0,tf(s),nf(s)}}function tf(s){if(Oo)try{w1(s)?vi.has_opted_out_capturing()&&vi.opt_in_capturing():vi.has_opted_out_capturing()||vi.opt_out_capturing()}catch{}}let sf=null;function nf(s){if(Oo)try{if(s.authenticated&&s.userId){sf=s.userId,vi.identify(s.userId),s.tenantId&&vi.group("organization",s.tenantId,{...s.organizationName?{name:s.organizationName}:{}}),iA({active_organization_id:s.tenantId??void 0,app_version:s.version});return}sf&&(sf=null,vi.reset())}catch{}}const iy={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function cA(s){return Object.prototype.hasOwnProperty.call(iy,s)?iy[s]:null}const x1=s=>s.split("/").filter(Boolean).pop()??s;function ny(s,t){var n;return(n=t[s.id])!=null&&n.trim()?!1:!s.title||s.title===x1(s.cwd)}function ry(s,t,n){var c;const a=(c=n[s.id])==null?void 0:c.trim();if(a)return a;if(!ny(s,n))return s.title;const l=x1(s.cwd),v=t.filter(u=>u.cwd===s.cwd&&(u.status!=="exited"||u.id===s.id)&&ny(u,n)).sort((u,p)=>u.createdAt.localeCompare(p.createdAt)||u.id.localeCompare(p.id)).findIndex(u=>u.id===s.id);return v>0?`${l} ${v+1}`:l}const C1="(max-width: 768px)";function Wf(){return typeof window<"u"&&window.matchMedia(C1).matches}function uA(s){const t=window.matchMedia(C1);return t.addEventListener("change",s),()=>t.removeEventListener("change",s)}function hA(){return U.useSyncExternalStore(uA,Wf,()=>!1)}const E1="sapiom-harness-pane-widths",bp=180,k1=480,Gf=320,On=320,T1=720;function Vf(s,t,n){return Math.min(Math.max(s,t),n)}function dA(){const s={rail:Gf,canvas:null};if(typeof window>"u")return s;try{const t=window.localStorage.getItem(E1);if(!t)return s;const n=JSON.parse(t);return{rail:Vf(typeof n.rail=="number"?n.rail:Gf,bp,k1),canvas:typeof n.canvas=="number"?Vf(n.canvas,On,T1):null}}catch{return s}}function ay(s){window.localStorage.setItem(E1,JSON.stringify(s))}function fA(){const[s,t]=U.useState(dA),n=(l,d,v,c,u)=>p=>{const y=p.currentTarget;y.setPointerCapture(p.pointerId);const f=p.clientX,w=u(),E=C=>{const b=Vf(w+(C.clientX-f)*d,v,c);t(S=>S[l]===b?S:{...S,[l]:b})},A=()=>{y.removeEventListener("pointermove",E),y.removeEventListener("pointerup",A),t(C=>(ay(C),C))};y.addEventListener("pointermove",E),y.addEventListener("pointerup",A)},a=(l,d)=>{t(v=>{const c={...v,[l]:d};return ay(c),c})};return{widths:s,startRailDrag:n("rail",1,bp,k1,()=>s.rail),startCanvasDrag:n("canvas",-1,On,T1,()=>{if(s.canvas!=null)return s.canvas;const l=document.querySelector(".canvas-pane");return l?l.getBoundingClientRect().width:On}),resetRail:()=>a("rail",Gf),resetCanvas:()=>a("canvas",null)}}const pA=2e3;function vA(s){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",oa());let n=null,a=null,l=!1;const d=()=>{n=new WebSocket(t),n.addEventListener("message",v=>{try{s(JSON.parse(v.data))}catch{}}),n.addEventListener("close",()=>{l||(a=setTimeout(d,pA))})};return d(),()=>{l=!0,a&&clearTimeout(a),n==null||n.close()}}const oy=4e3;function _A(s){if(typeof s=="string")return s;if(s!==null&&typeof s=="object"){const t=s,n=[t.ts,t.level,t.msg??t.message].filter(a=>typeof a=="string"||typeof a=="number");if(n.length>0)return n.map(String).join(" ")}return String(s)}function mA(s){if(!Array.isArray(s)||s.length===0)return;const t=s.map(_A).join(`
445
- `).trim();if(t!=="")return t.length>oy?t.slice(t.length-oy):t}function gA(s){return s==="succeeded"?"passed":s==="threw"?"failed":"pending"}function yA(s){return s==="completed"?"completed":s==="failed"?"failed":"running"}function bA(s){var a;const t={id:`${s.step}-${s.attempt}`,name:s.step,status:gA(s.status)};s.input!==void 0&&(t.input=s.input),s.output!==void 0&&(t.output=s.output),(a=s.error)!=null&&a.message&&(t.error=s.error.message);const n=mA(s.logs);return n!==void 0&&(t.logSlice=n),s.calls&&s.calls.length>0&&(t.calls=s.calls.map(l=>({capability:l.capability,stubUsed:l.stubUsed,args:l.args,result:l.result}))),t}function SA(s,t={}){const n={executionId:t.executionId??"",status:yA(t.outcome),steps:s.map(bA),stubbed:!0};return t.unusedStubs&&t.unusedStubs.length>0&&(n.unusedStubs=t.unusedStubs),t.stubWarnings&&t.stubWarnings.length>0&&(n.stubWarnings=t.stubWarnings),n}const Et=Qw(),wA=3e3,xA=8;function CA(){const[s,t]=U.useState(null),[n,a]=U.useState(null),l=U.useRef(null);l.current=n;const[d,v]=U.useState(!0),[c,u]=U.useState(null),[p,y]=U.useState(null),[f,w]=U.useState(0),[E,A]=U.useState(null),[C,b]=U.useState(null),[S,_]=U.useState([]),[g,T]=U.useState(null),[R,M]=U.useState(!1),j=U.useRef(new Map),k=U.useRef(0),D=U.useRef(new Map),[B,I]=U.useState(null),[q,$]=U.useState(new Set),[J,ee]=U.useState([]),W=U.useRef(new Map),[G,Y]=U.useState(new Map),[O,F]=U.useState(new Map),[L,P]=U.useState(new Map),V=U.useRef(new Map),[te,de]=U.useState(new Map),[ge,K]=U.useState(new Map),[z,ie]=U.useState(0),Q=U.useCallback(()=>{ie(le=>le+1)},[]),we=U.useRef(0),fe=U.useCallback(le=>{we.current+=1,b(le)},[]),Le=U.useRef([]),ze=U.useCallback(le=>{Et.getRunState(le).then(_e=>Y(Ce=>{const Se=Ce.get(le);return Se?new Map(Ce).set(le,{...Se,run:_e}):Ce})).catch(()=>{})},[]),We=U.useCallback((le,_e,Ce)=>{const Se=V.current.get(le);Se&&clearInterval(Se);const Oe=aa(Le.current.find(tt=>tt.id===le)),et=Date.now();F(tt=>{const ft=tt.get(le)??[];return ft.includes(_e)?tt:new Map(tt).set(le,[...ft,_e])}),P(tt=>{if(!tt.has(le))return tt;const ft=new Map(tt);return ft.delete(le),ft});const Ke=async()=>{try{const tt=await Et.getRunState(_e);if(Y(ft=>new Map(ft).set(_e,{run:tt,target:Ce,workflowPath:Oe,observedAt:et})),tt.status!=="running"){const ft=V.current.get(le);ft&&clearInterval(ft),V.current.delete(le)}}catch{const tt=V.current.get(le);tt&&clearInterval(tt),V.current.delete(le)}};Ke(),V.current.set(le,setInterval(()=>void Ke(),2e3))},[]),Ge=U.useRef(0),De=U.useCallback(async(le,_e,Ce)=>{Ge.current+=1;const Se=`local-${Date.now()}-${Ge.current}`,Oe=aa(Le.current.find(xe=>xe.id===le)),et=Date.now(),Ke=[];let tt,ft,Es;F(xe=>{const Me=xe.get(le)??[];return Me.includes(Se)?xe:new Map(xe).set(le,[...Me,Se])}),P(xe=>{if(!xe.has(le))return xe;const Me=new Map(xe);return Me.delete(le),Me});const hs=()=>{const xe=SA(Ke,{executionId:Se,outcome:tt,unusedStubs:ft,stubWarnings:Es});Y(Me=>new Map(Me).set(Se,{run:xe,target:"local",workflowPath:Oe,observedAt:et}))};hs();const ue=xe=>{xe.kind==="summary"?(tt=xe.outcome,ft=xe.unusedStubs,Es=xe.stubWarnings):xe.kind==="error"?(tt="failed",Ke.push({step:"run-local",attempt:1,input:Ce,status:"threw",error:{name:"RunLocalError",message:xe.error},logs:[]})):Ke.push(xe),hs()};try{await Et.runLocal({sourceDir:_e,input:Ce},ue)}catch(xe){tt="failed",hs(),T(xe instanceof As&&xe.reason?xe.reason:xe.message)}finally{Q()}},[Q]),dt=U.useCallback((le,_e)=>{P(Ce=>new Map(Ce).set(le,_e)),ze(_e)},[ze]),At=U.useMemo(()=>{const le=new Map;return O.forEach((_e,Ce)=>{const Se=L.get(Ce),Oe=Se&&_e.includes(Se)?Se:_e[_e.length-1],et=Oe?G.get(Oe):void 0;et&&le.set(Ce,et)}),le},[O,L,G]);U.useEffect(()=>{Le.current=(s==null?void 0:s.sessions)??[]},[s]),U.useEffect(()=>{const le=V.current;return()=>{le.forEach(_e=>clearInterval(_e)),le.clear()}},[]),U.useEffect(()=>{const le=W.current;return()=>{le.forEach(_e=>clearTimeout(_e)),le.clear()}},[]),U.useEffect(()=>{let le=!1;return f>0&&(v(!0),u(null),y(null)),Promise.all([Et.getState(),Et.getSettings()]).then(([_e,Ce])=>{if(le)return;t(_e),a(Ce),y(null),_e.tasks&&ee(_e.tasks);const Se=_e.sessions.find(Oe=>Oe.status!=="exited");Se&&b(Se.id),_e.workflows[0]&&A(_e.workflows[0].path)}).catch(_e=>{le||(u(_e.message),y(_e instanceof As?{status:_e.status}:{networkError:!0}))}).finally(()=>!le&&v(!1)),()=>{le=!0}},[f]);const qt=U.useCallback(()=>w(le=>le+1),[]);U.useEffect(()=>{if(!C)return;const le=s==null?void 0:s.sessions.find(_e=>_e.id===C);A(aa(le)??null)},[C]);const jt=U.useCallback(async()=>{const le=await Et.listWorkflows();t(_e=>_e&&{..._e,workflows:le})},[]);U.useEffect(()=>vA(le=>{if(I(le),le.type==="session.status"){if(t(_e=>{if(!_e)return _e;const Se=_e.sessions.some(Oe=>Oe.id===le.session.id)?_e.sessions.map(Oe=>Oe.id===le.session.id?le.session:Oe):[..._e.sessions,le.session];return{..._e,sessions:Se}}),le.session.status==="exited"){const _e=le.session.id,Ce=W.current.get(_e);Ce&&(clearTimeout(Ce),W.current.delete(_e)),$(Se=>{if(!Se.has(_e))return Se;const Oe=new Set(Se);return Oe.delete(_e),Oe})}}else if(le.type==="workflows.changed")jt();else if(le.type==="execution.started")We(le.harnessSessionId,le.executionId,le.target);else if(le.type==="port.detected")de(_e=>new Map(_e).set(le.harnessSessionId,{port:le.port,url:le.url}));else if(le.type==="task.status")ee(_e=>_e.some(Se=>Se.id===le.task.id)?_e.map(Se=>Se.id===le.task.id?le.task:Se):[..._e,le.task]);else if(le.type==="session.activity"){const _e=le.harnessSessionId;$(Se=>Se.has(_e)?Se:new Set(Se).add(_e));const Ce=W.current.get(_e);Ce&&clearTimeout(Ce),W.current.set(_e,setTimeout(()=>{W.current.delete(_e),$(Se=>{if(!Se.has(_e))return Se;const Oe=new Set(Se);return Oe.delete(_e),Oe})},wA))}else le.type==="auth.changed"&&t(_e=>_e&&{..._e,authenticated:le.authenticated,organizationName:le.organizationName})}),[jt,We]);const Nt=U.useCallback(async le=>{const _e=Array.from(new Set(le)),Ce=_e.map(Se=>{const Oe=j.current.get(Se);if(Oe)return Oe;const et=Et.sessionHistory(Se).finally(()=>{j.current.delete(Se)});return j.current.set(Se,et),et});k.current+=1,M(!0);try{const Se=await Promise.allSettled(Ce),Oe=[],et=new Set;Se.forEach((Ke,tt)=>{Ke.status==="fulfilled"&&(et.add(_e[tt]),Oe.push(...Ke.value))}),_(Ke=>yE(Ke,Oe,et))}finally{k.current-=1,k.current===0&&M(!1)}},[]),ct=U.useCallback(async le=>{var Se;const _e=await Et.createSession(le);t(Oe=>Oe&&!Oe.sessions.some(et=>et.id===_e.id)?{...Oe,sessions:[...Oe.sessions,_e]}:Oe),fe(_e.id);const Ce=[le.cwd,...(((Se=l.current)==null?void 0:Se.recentDirs)??[]).filter(Oe=>Oe!==le.cwd)].slice(0,xA);a(Oe=>Oe&&{...Oe,recentDirs:Ce});try{const Oe=await Et.updateSettings({recentDirs:Ce});a(et=>et&&{...et,recentDirs:Oe.recentDirs})}catch{}return _e},[fe]),ut=U.useCallback(()=>Et.listTemplates(),[]),es=U.useCallback(le=>Et.getTemplate(le),[]),Yt=U.useCallback(le=>Et.sessionRecord(le),[]),ts=U.useCallback(async le=>{const _e=we.current;try{const Ce=await Et.resumeSession(le);return t(Se=>Se&&{...Se,sessions:Se.sessions.map(Oe=>Oe.id===Ce.id?Ce:Oe)}),we.current===_e&&fe(Ce.id),Ce}catch(Ce){throw T(Ce instanceof As&&Ce.reason?Ce.reason:Ce.message),Ce}},[fe]),ot=U.useCallback(async({cwd:le,harness:_e,from:Ce})=>{const Se=await ct({cwd:le,harness:_e,rehydrateFrom:Ce});return Se.rehydratedFrom||T("Nothing was recorded for that session, so this one starts fresh."),Se},[ct]),Xt=U.useCallback(async le=>{var Ce;const _e=le.harnessSessionId??((Ce=s==null?void 0:s.sessions.find(Se=>Se.agentSessionId===le.agentSessionId))==null?void 0:Ce.id);if(le.resumeMode==="rehydrate")return ot({cwd:le.cwd,harness:le.harness,from:_e??le.agentSessionId});if(_e)return ts(_e);try{const Se=await Et.adoptSession({agentSessionId:le.agentSessionId,harness:le.harness,cwd:le.cwd,title:le.title,lastActiveAt:le.lastActiveAt});return t(Oe=>{if(!Oe)return Oe;const et=Oe.sessions.some(Ke=>Ke.id===Se.id)?Oe.sessions.map(Ke=>Ke.id===Se.id?Se:Ke):[...Oe.sessions,Se];return{...Oe,sessions:et}}),fe(Se.id),Se}catch(Se){throw T(Se instanceof As&&Se.reason?Se.reason:Se.message),Se}},[s,ts,ot,fe]),Wt=U.useCallback(async le=>{try{await Et.killSession(le)}catch(Ce){throw T(Ce instanceof As&&Ce.reason?Ce.reason:Ce.message),Ce}const _e=((s==null?void 0:s.sessions)??[]).filter(Ce=>Ce.id!==le);if(t(Ce=>Ce&&{...Ce,sessions:_e}),C===le){const Ce=_e.find(Se=>Se.status!=="exited");fe(Ce?Ce.id:null)}},[s,C,fe]),ss=U.useCallback(async le=>{const _e=await Et.connectWorkflow(le);return t(Ce=>Ce&&{...Ce,workflows:[...Ce.workflows.filter(Se=>Se.path!==_e.path),_e]}),_e},[]),nt=U.useCallback(async le=>{const _e=await Et.scanWorkflows(le);return await jt(),_e},[jt]),Ee=U.useCallback(()=>Et.listHarnesses(),[]),Ue=U.useCallback(async(le,_e)=>{const Ce=await Et.bindWorkflow(le,_e);t(Se=>Se&&{...Se,sessions:Se.sessions.map(Oe=>Oe.id===Ce.id?Ce:Oe)})},[]),Lt=U.useCallback(async le=>{const _e=await Et.updateSettings(le);return a(_e),le.telemetryOptIn!==void 0&&t(Ce=>Ce&&{...Ce,telemetryOptIn:_e.telemetryOptIn}),le.productAnalyticsOptIn!==void 0&&t(Ce=>Ce&&{...Ce,productAnalyticsOptIn:_e.productAnalyticsOptIn!==!1}),_e},[]),mt=U.useCallback(async(le,_e)=>{try{await Et.runMacro(le,_e)}catch(Ce){T(Ce instanceof As&&Ce.reason?Ce.reason:Ce.message)}},[]),un=U.useCallback(le=>{const _e=D.current.get(le);if(_e)return _e;const Ce=(async()=>{T("Deploying…");let Se=null,Oe=null;try{const et=await Et.deploy(le,Ke=>{Ke.phase==="linking"?(Se="linking",T(`Deploying — creating the agent "${Ke.name}" on Sapiom…`)):Ke.phase==="warning"?(Oe=Ke.message,T(Ke.message)):Ke.phase==="building"&&(Se="building",T("Deploying — building on Sapiom…"))});if(et.phase==="ready")T(Oe?`Deployed to Sapiom. ${Oe}`:"Deployed to Sapiom."),K(Ke=>{if(!Ke.has(le))return Ke;const tt=new Map(Ke);return tt.delete(le),tt}),await jt();else if(et.phase==="error"){const Ke=Se==="linking"?"Couldn't create the agent":"Deploy failed",tt=et.hint?`${Ke}: ${et.message} (${et.hint})`:`${Ke}: ${et.message}`;T(tt),K(ft=>new Map(ft).set(le,tt))}}catch(et){const Ke=et instanceof As&&et.reason?et.reason:et.message;T(Ke),K(tt=>new Map(tt).set(le,Ke))}finally{Q(),D.current.delete(le)}})();return D.current.set(le,Ce),Ce},[jt,Q]),Kt=U.useCallback(async(le,_e,Ce)=>{try{const{executionId:Se}=await Et.run({definitionId:_e,input:Ce});We(le,Se,"prod")}catch(Se){T(Se instanceof As&&Se.reason?Se.reason:Se.message)}finally{Q()}},[We,Q]),ji=U.useCallback(async()=>Et.startAuth(),[]),Us=U.useCallback(async()=>{try{await Et.disconnect()}catch(le){T(le instanceof As&&le.reason?le.reason:le.message)}},[]),js=U.useCallback(()=>T(null),[]),mi=U.useCallback(async(le,_e)=>{await Et.injectInput(le,{text:_e,submit:!0})},[]),Cs=U.useCallback(le=>{T(le)},[]),bs=U.useCallback(le=>ge.get(le)??null,[ge]),Ns=U.useCallback(le=>Et.listDir(le),[]);return{state:s,loading:d,error:c,errorKind:p,reload:qt,settings:n,bootToken:oa(),selectedWorkflowPath:E,setSelectedWorkflowPath:A,activeSessionId:C,setActiveSessionId:fe,history:S,historyLoading:R,loadHistory:Nt,createSession:ct,listTemplates:ut,getTemplate:es,sessionRecord:Yt,resumeSession:ts,rehydrateSession:ot,resumeFromHistory:Xt,closeSession:Wt,connectWorkflow:ss,scanWorkflows:nt,listHarnesses:Ee,bindWorkflow:Ue,updateSettings:Lt,runMacro:mt,deploy:un,startProdRun:Kt,runLocal:De,injectInput:mi,showToast:Cs,lastDeployErrorFor:bs,directActionSettleSeq:z,listDir:Ns,lastMessage:B,runsBySession:At,runsByExecution:G,runIdsBySession:O,selectRun:dt,previewBySession:te,toast:g,dismissToast:js,busySessionIds:q,tasks:J,api:Et,startAuth:ji,disconnect:Us}}function _c(s,t){return t?s.filter(n=>n.status!=="exited"&&(n.boundWorkflowPath===t||n.boundWorkflowPath==null&&n.cwd===t)).sort((n,a)=>n.createdAt.localeCompare(a.createdAt)||n.id.localeCompare(a.id)):[]}const EA=()=>{var Cs,bs,Ns,le,_e,Ce,Se,Oe,et,Ke,tt,ft,Es,hs;const s=CA(),t=w3(),[n,a]=U.useState(!1),[l,d]=U.useState(!1),[v,c]=U.useState(!1),[u,p]=U.useState(null),[y,f]=U.useState(!1),[w,E]=U.useState(()=>{const ue=Mi().rightTab;return ue==="canvas"||ue==="steps"||ue==="code"?ue:"canvas"}),[A,C]=U.useState(w==="code"),[b,S]=U.useState(null),[_,g]=U.useState(!1),[T,R]=U.useState(()=>Mi().sessionNames??{}),M=()=>{d(!1),c(!0)},j=(ue,xe)=>{R(Me=>{const oe={...Me},Ae=xe.trim();return Ae?oe[ue]=Ae:delete oe[ue],la({sessionNames:oe}),oe})},[k,D]=U.useState(()=>Wf()||(Mi().railCollapsed??!1)),[B,I]=U.useState(()=>Wf()||(Mi().rightCollapsed??!1)),[q,$]=U.useState(!1),J=hA(),{widths:ee,startRailDrag:W,startCanvasDrag:G,resetRail:Y,resetCanvas:O}=fA();U.useEffect(()=>{const ue=xe=>{var oe;const Me=xe.key.toLowerCase();if((xe.metaKey||xe.ctrlKey)&&(Me==="k"||Me==="p")){xe.preventDefault(),a(!0);return}if((xe.metaKey||xe.ctrlKey)&&/^[1-9]$/.test(xe.key)){const je=_c(((oe=s.state)==null?void 0:oe.sessions)??[],u)[Number(xe.key)-1];je&&(xe.preventDefault(),d(!1),S(null),s.setActiveSessionId(je.id))}};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[(Cs=s.state)==null?void 0:Cs.sessions,u]);const F=ek({settingsRoot:(bs=s.settings)==null?void 0:bs.projectRoot,defaultProjectRoot:(Ns=s.state)==null?void 0:Ns.defaultProjectRoot,launchDir:(le=s.state)==null?void 0:le.launchDir}),L=async ue=>{await s.updateSettings({projectRoot:ue})};U.useEffect(()=>{var xe;if(!n||!s.state)return;const ue=Sy(s.state.sessions,((xe=s.settings)==null?void 0:xe.recentDirs)??[],s.activeSessionId);ue.length>0&&s.loadHistory(ue)},[n]);const P=U.useRef(!1);U.useEffect(()=>{var xe;if(P.current||!s.state)return;P.current=!0;const ue=s.state.sessions.find(Me=>Me.id===s.activeSessionId);p(aa(ue)??((xe=s.state.workflows[0])==null?void 0:xe.path)??null)},[s.state,s.activeSessionId]);const V=s.state;U.useEffect(()=>{V&&lA(V)},[V,V==null?void 0:V.authenticated,V==null?void 0:V.userId,V==null?void 0:V.tenantId,V==null?void 0:V.consentSource,V==null?void 0:V.productAnalyticsOptIn,V==null?void 0:V.version]),U.useEffect(()=>{if(!V)return;const ue=V.sessions.find(Me=>Me.id===s.activeSessionId),xe={firstRun:V.firstRun===!0,settingsOpen:y,templatesOpen:_,hasLiveSession:V.sessions.some(Me=>Me.status!=="exited"),inspectingDeadSession:(ue==null?void 0:ue.status)==="exited",rightTab:w};nA(xe)},[V,s.activeSessionId,y,_,w]);const te=U.useRef(J);U.useEffect(()=>{te.current!==J&&(te.current=J,D(J),I(J))},[J]),U.useEffect(()=>{J||la({railCollapsed:k,rightCollapsed:B})},[k,B,J]),U.useEffect(()=>{la({rightTab:w})},[w]);const de=((_e=s.state)==null?void 0:_e.sessions.find(ue=>ue.id===s.activeSessionId&&ue.status==="exited"))??null,ge=de!=null&&de.agentSessionId?(Ce=s.history.find(ue=>ue.agentSessionId===de.agentSessionId))==null?void 0:Ce.resumeMode:"rehydrate",K=(de==null?void 0:de.agentSessionId)!=null&&ge===void 0?de.cwd:null,z=s.loadHistory;if(U.useEffect(()=>{K&&z([K])},[K,z]),s.loading)return h.jsx("div",{className:"app-status",children:"Loading Sapiom Studio…"});if(s.error||!s.state){const ue=S3({online:t,error:s.errorKind});return h.jsx(mE,{status:ue==="online"?"error":ue,onRetry:s.reload,detail:s.error,onStartAuth:ue==="auth"?s.startAuth:void 0})}const{state:ie}=s,Q=ie.sessions.find(ue=>ue.id===s.activeSessionId)??null,we=aa(Q),fe=ie.workflows.find(ue=>ue.path===we)??null,Le=ie.workflows.find(ue=>ue.path===u)??null,ze=_c(ie.sessions,u),We=ie.sessions.some(ue=>ue.status!=="exited"),Ge=l||ie.firstRun===!0&&!We&&!v,De=b!=null,dt=!De&&(Q==null?void 0:Q.status)==="exited",At=!De&&!dt&&Le!=null&&ze.length===0,qt=!De&&!dt&&!At&&Q!=null&&Q.status!=="exited",jt=qt&&ze.length>0,Nt=At?null:fe,ct=At?(Le==null?void 0:Le.name)??null:null,ut=s.activeSessionId?s.runsBySession.get(s.activeSessionId)??null:null,es=s.activeSessionId?(s.runIdsBySession.get(s.activeSessionId)??[]).map(ue=>s.runsByExecution.get(ue)).filter(ue=>ue!==void 0):[],Yt=()=>{J&&D(!0)},ts=async(ue,xe)=>{d(!1),S(null),p(ue),Yt();const Me=await s.createSession({cwd:ue,harness:xe});return Ho("session.created"),sA("session.started",{harness_kind:xe,origin:"user"}),Me},ot=async(ue,xe)=>{await ts(ue,xe)},Xt=(ue,xe,Me)=>{const oe=async Ae=>{try{await s.injectInput(ue,xe)}catch(je){if(Ae<6&&je instanceof As&&je.status===409){window.setTimeout(()=>void oe(Ae+1),1500);return}s.showToast(Me)}};oe(0)},Wt=async(ue,xe,Me)=>{const oe=await ts(ue,xe),Ae="Scaffold a new Sapiom agent project in this directory: run `sapiom agents init .`, then use the sapiom-agent-authoring skill to",je=Me==null?void 0:Me.trim();Xt(oe.id,je?`${Ae} build this:
446
-
447
- ${je}`:`${Ae} define the first workflow.`,"Couldn't send the scaffold prompt. Ask the agent to run sapiom agents init.")},ss=ue=>{(async()=>{const xe=_c(ie.sessions,ue.path)[0],Me=(xe==null?void 0:xe.cwd)??ue.path;try{const oe=await ts(Me,"claude-code");await s.bindWorkflow(oe.id,ue.path),p(ue.path)}catch(oe){s.showToast(oe.message||"Couldn't start the session.")}})()},nt=ue=>{Xt(ue,"Scaffold a new Sapiom agent project in this directory: run `sapiom agents init .`, then use the sapiom-agent-authoring skill to define the first workflow.","Couldn't send the scaffold prompt. Ask the agent to run sapiom agents init.")},Ee=async(ue,xe)=>{const Me=await ts(ue,"claude-code");Xt(Me.id,ok(xe,ue),xe.kind==="gallery"?"Couldn't send the clone prompt. Ask the agent to run sapiom_dev_agents_clone.":"Couldn't send the starter prompt. Ask the agent to run sapiom agents init.")},Ue=async ue=>{const xe=await s.scanWorkflows(ue);return s.showToast(xe.length===0?"No agent projects found under this folder.":xe.length===1?"Found 1 agent project.":`Found ${xe.length} agent projects.`),xe.length},Lt=ue=>{d(!1),S(null),Yt();const xe=ie.sessions.find(Me=>Me.id===ue);xe&&p(aa(xe)??xe.cwd),s.setActiveSessionId(ue)},mt=ue=>{d(!1),S(null),s.setActiveSessionId(ue)},un=ue=>{(async()=>{const xe=ze.find(oe=>oe.id!==ue)??null,Me=s.activeSessionId===ue;try{await s.closeSession(ue)}catch{return}Me&&s.setActiveSessionId(xe?xe.id:null)})()},Kt=ue=>{d(!1),S(ue),Yt()},ji=ue=>{var Me;const xe=((Me=s.settings)==null?void 0:Me.editorUrlTemplate)??"vscode://file{path}";window.location.href=xe.replace("{path}",encodeURI(ue))},Us=ue=>{d(!1),S(null),p(ue),Yt();const xe=_c(ie.sessions,ue);if(xe.some(oe=>oe.id===s.activeSessionId))return;const Me=xe[xe.length-1]??null;s.setActiveSessionId(Me?Me.id:null)},js=async ue=>{Yt();const xe=ie.sessions.filter(ht=>ht.status!=="exited"),Me=ht=>ht.boundWorkflowPath===ue||ue===ht.cwd||ue.startsWith(`${ht.cwd}/`),oe=xe.find(ht=>ht.id===s.activeSessionId),Ae=oe&&Me(oe)?oe:xe.filter(Me).sort((ht,qe)=>qe.cwd.length-ht.cwd.length||qe.createdAt.localeCompare(ht.createdAt))[0];let je;if(Ae)d(!1),S(null),Ae.id!==s.activeSessionId&&s.setActiveSessionId(Ae.id),je=Ae.id;else try{je=(await ts(ue,"claude-code")).id}catch(ht){return s.showToast(ht.message||"Couldn't start a session in this folder."),null}return await s.bindWorkflow(je,ue),p(ue),je},mi=(ue,xe)=>{(async()=>{let Me=s.activeSessionId;if(ue&&(Me=await js(ue.path)??Me),xe.action.kind==="open-url"){window.open(GE(xe.action.url,ue),"_blank","noopener,noreferrer");return}if(!Me)return;const oe=cA(xe.id);if(oe!==null){if(oe==="deploy")ue?s.deploy(ue.path):s.showToast("Select a workflow first.");else if(oe==="prod-run")if((ue==null?void 0:ue.definitionId)!=null)s.startProdRun(Me,String(ue.definitionId));else{const Ae=ue?s.lastDeployErrorFor(ue.path):null;s.showToast(Ae?"Last deploy failed — retry Deploy.":"This agent isn't deployed yet — deploy it first.")}else oe==="run-local"&&(ue?s.runLocal(Me,ue.path):s.showToast("Select a workflow first."));return}s.runMacro(xe.id,{harnessSessionId:Me,workflowPath:ue==null?void 0:ue.path})})()};return h.jsxs("div",{className:"app-shell",children:[J&&!k&&h.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>D(!0)}),!k&&h.jsx(_3,{projectRoot:F||null,onSaveProjectRoot:L,width:ee.rail,minWidth:bp,workflows:ie.workflows,sessions:ie.sessions,activeSessionId:s.activeSessionId,focusedAgentPath:u,onFocusAgent:Us,onOpenPalette:()=>a(!0),onConnect:async ue=>{await s.connectWorkflow(ue)},onCollapse:()=>D(!0),onSelectSession:Lt,overviewSelected:l,onSelectOverview:()=>{d(!0),S(null),Yt()},onReviewSummary:Kt,history:s.history,historyLoading:s.historyLoading,onOpenHistory:ue=>void s.loadHistory(ue),recentDirs:((Se=s.settings)==null?void 0:Se.recentDirs)??[],launchDir:ie.launchDir??null,listDir:s.listDir,onCreateSession:ot,listHarnesses:s.listHarnesses,onScaffoldSession:Wt,onScaffoldInSession:nt,onBrowseTemplates:()=>g(!0),templatesActive:_,onScanWorkflows:Ue,onToast:s.showToast,telemetryOptIn:((Oe=s.settings)==null?void 0:Oe.telemetryOptIn)??ie.telemetryOptIn,consentSource:ie.consentSource,consentEnvReason:ie.consentEnvReason,authenticated:ie.authenticated,organizationName:ie.organizationName,onToggleTelemetry:async ue=>{await s.updateSettings({telemetryOptIn:ue})},productAnalyticsOptIn:ie.productAnalyticsOptIn,onToggleProductAnalytics:async ue=>{await s.updateSettings({productAnalyticsOptIn:ue})},rollingSummary:((et=s.settings)==null?void 0:et.rollingSummary)===!0,onToggleRollingSummary:async ue=>{await s.updateSettings({rollingSummary:ue})},onStartAuth:s.startAuth,onDisconnect:s.disconnect,settingsOpen:y,onSetSettingsOpen:f}),!k&&!J&&h.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:ee.rail},onPointerDown:W,onDoubleClick:Y,role:"separator","aria-orientation":"vertical","aria-label":"Resize workspace rail","data-testid":"resize-handle-rail"}),h.jsxs("div",{className:"workspace-main",children:[!t&&h.jsx(gE,{}),ie.consentSource==="default-silent"&&!((Ke=s.settings)!=null&&Ke.telemetryNoticeDismissed)&&h.jsx(XE,{onDismiss:()=>{s.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>f(!0)}),h.jsxs("div",{className:"app"+(_?" is-browsing":""),style:{gridTemplateColumns:_||J?"minmax(0, 1fr)":B?`minmax(${On}px, 1fr)`:ee.canvas==null?`minmax(${On}px, 1fr) minmax(${On}px, 1fr)`:`minmax(${On}px, 1fr) minmax(${On}px, ${ee.canvas}px)`},children:[_&&h.jsx(xk,{projectRoot:F||null,recentDirs:((tt=s.settings)==null?void 0:tt.recentDirs)??[],listDir:s.listDir,onExit:()=>g(!1),onUse:Ee,listTemplates:s.listTemplates,getTemplate:s.getTemplate}),h.jsxs("div",{className:"center-pane",children:[h.jsx(qE,{openedAgentName:ct,reviewTitle:b?b.title:null,activeSession:qt||dt?Q:null,sessionName:Q?ry(Q,ie.sessions,T):null,onRenameSession:j,boundWorkflowName:(fe==null?void 0:fe.name)??null,busy:Q!=null&&s.busySessionIds.has(Q.id),onCloseSession:ue=>void s.closeSession(ue),onOpenInEditor:ji,onToast:s.showToast,onExpandRail:k?()=>D(!1):null,onExpandRight:B?()=>I(!1):null}),jt&&h.jsx(YE,{sessions:ze,activeSessionId:s.activeSessionId,busySessionIds:s.busySessionIds,labelOf:ue=>ry(ue,ie.sessions,T),agentName:(Le==null?void 0:Le.name)??(Q==null?void 0:Q.title)??"this agent",onSelect:mt,onClose:un,onNew:()=>{Le?ss(Le):u&&ot(u,"claude-code")}}),qt&&Q&&fe&&h.jsx(VE,{workflow:fe,activeSessionId:s.activeSessionId,sessionReady:Q.ready===!0&&Q.status!=="exited",macros:ie.macros,onRunMacro:ue=>mi(fe,ue),preview:s.previewBySession.get(Q.id)??null,lastDeployError:s.lastDeployErrorFor(fe.path),authenticated:ie.authenticated,directActionSettleSeq:s.directActionSettleSeq}),h.jsx("div",{className:"terminal-slot",children:De&&b?h.jsx(DE,{summary:b,loadRecord:s.sessionRecord,onStart:()=>{const ue=b;S(null),s.resumeFromHistory(ue)},onClose:()=>S(null)}):dt&&Q?h.jsx(ME,{session:Q,resumeMode:ge,loadRecord:s.sessionRecord,onResume:()=>void s.resumeSession(Q.id),onContinue:()=>void s.rehydrateSession({cwd:Q.cwd,harness:Q.harness,from:Q.id}),onClose:()=>void s.closeSession(Q.id)}):At&&Le?h.jsx(fi,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${Le.name}`,body:"Start a session to map, run, and inspect this agent.",cta:h.jsxs("button",{className:"btn-primary","data-testid":"open-agent-start-session",onClick:()=>ss(Le),children:[h.jsx(me,{name:"Plus",size:14})," Start session"]})}):qt&&s.activeSessionId?h.jsx(HE,{sessionId:s.activeSessionId,harness:(Q==null?void 0:Q.harness)??"claude-code",api:s.api,showToast:s.showToast,children:h.jsx("div",{className:"agent-view","data-testid":"agent-view",children:h.jsx("div",{className:"agent-view-panel",id:"agent-panel-terminal",children:h.jsx(Bk,{sessionId:s.activeSessionId,token:s.bootToken})})})}):h.jsx(fi,{className:"terminal-empty",icon:"Radio",title:"No active session",body:"Focus an agent in the workspace panel, then start a session. Your coding agent runs right here, in a real terminal. ⌘K jumps anywhere."})})]}),!B&&!J&&h.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:ee.canvas??"50%"},onPointerDown:G,onDoubleClick:O,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),J&&!B&&h.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>I(!0)}),h.jsxs("div",{className:"right-pane"+(B?" is-collapsed":""),children:[h.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[h.jsx("button",{role:"tab","aria-selected":w==="canvas",className:"right-pane-tab"+(w==="canvas"?" is-active":""),onClick:()=>E("canvas"),"data-testid":"right-tab-canvas",children:"Canvas"}),h.jsx("button",{role:"tab","aria-selected":w==="steps",className:"right-pane-tab"+(w==="steps"?" is-active":""),onClick:()=>E("steps"),"data-testid":"right-tab-steps",children:"Steps"}),h.jsx("button",{role:"tab","aria-selected":w==="code",className:"right-pane-tab"+(w==="code"?" is-active":""),onClick:()=>{E("code"),C(!0)},"data-testid":"right-tab-code",children:"Code"}),h.jsxs("div",{className:"right-pane-corner",children:[w==="canvas"&&(Nt==null?void 0:Nt.definitionId)!=null&&h.jsxs("a",{className:"status-tag status-tag-action workflow-deployed-tag right-pane-deployed","data-testid":"workflow-dashboard-link",href:`https://app.sapiom.ai/workflows/${Nt.definitionId}`,target:"_blank",rel:"noreferrer","aria-label":"Deployed — open in the Sapiom dashboard","data-tooltip":"Open this workflow in the Sapiom dashboard",children:[h.jsx(me,{name:"Cloud",size:12}),"deployed"]}),w==="canvas"&&h.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand","aria-label":q?"Exit expanded canvas":"Expand canvas",title:q?"Exit expanded canvas":"Expand canvas",onClick:()=>$(ue=>!ue),children:h.jsx(me,{name:q?"Minimize2":"Maximize2",size:15})}),h.jsx("button",{className:"theme-toggle right-pane-collapse","data-testid":"right-collapse","aria-label":"Collapse canvas panel",title:"Collapse canvas panel",onClick:()=>I(!0),children:h.jsx(me,{name:"PanelRightClose",size:15})})]})]}),h.jsx("div",{className:"right-pane-panel"+(w==="canvas"||w==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:h.jsx(Z2,{sessionId:s.activeSessionId,lastMessage:s.lastMessage,boundWorkflow:Nt,noSessionAgent:ct,overviewActive:Ge,sessionExited:dt,expanded:q,onToggleExpanded:()=>$(ue=>!ue),macros:ie.macros,tasks:s.tasks,surface:w==="steps"?"steps":"board",onOpenSteps:()=>E("steps"),run:(ut==null?void 0:ut.run)??null,runTarget:(ut==null?void 0:ut.target)??null,runs:es,onSelectRun:ue=>{s.activeSessionId&&s.selectRun(s.activeSessionId,ue)},workflows:ie.workflows,onOpenWorkflow:ue=>void js(ue),onRunMacro:ue=>mi(fe,ue),onInjectPrompt:ue=>{s.activeSessionId&&s.injectInput(s.activeSessionId,ue)}})}),(w==="code"||A)&&h.jsx("div",{className:"right-pane-panel"+(w==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:h.jsx(hE,{boundWorkflow:Nt,noSessionAgent:ct,agentsBaseUrl:ie.agentsBaseUrl})})]})]})]}),n&&h.jsx(vE,{sessions:ie.sessions,workflows:ie.workflows,recentDirs:((ft=s.settings)==null?void 0:ft.recentDirs)??[],history:s.history,listDir:s.listDir,onSelectSession:Lt,onReviewSummary:Kt,onOpenPath:ue=>void ot(ue,"claude-code"),onBrowseTemplates:()=>g(!0),onClose:()=>a(!1)}),Ge&&h.jsx(Xk,{recentDirs:((Es=s.settings)==null?void 0:Es.recentDirs)??[],sessions:ie.sessions,workflows:ie.workflows,projectRoot:F||null,onConnect:async ue=>{await s.connectWorkflow(ue)},onScan:Ue,onScaffold:Wt,onSaveProjectRoot:L,listDir:s.listDir,onCreateSession:ot,listHarnesses:s.listHarnesses,onBrowseTemplates:()=>{M(),g(!0)},onDismiss:M,firstRun:ie.firstRun===!0,telemetryOptIn:((hs=s.settings)==null?void 0:hs.telemetryOptIn)??ie.telemetryOptIn,onToggleTelemetry:async ue=>{await s.updateSettings({telemetryOptIn:ue})}}),s.toast&&h.jsx(zk,{message:s.toast,onDismiss:s.dismissToast}),h.jsx(Ik,{})]})};window.addEventListener("scroll",()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},{passive:!0});Vw.createRoot(document.getElementById("root")).render(h.jsx(U.StrictMode,{children:h.jsx(EA,{})}));