@hellcoder/companion 0.114.1-preview.20260731000043.7c83aad → 0.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,139 @@
1
+ var Vj=Object.defineProperty;var Gj=(e,t,n)=>t in e?Vj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var db=(e,t,n)=>Gj(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const Yj="modulepreload",Wj=function(e){return"/"+e},fb={},qn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=u(n.map(p=>{if(p=Wj(p),p in fb)return;fb[p]=!0;const g=p.endsWith(".css"),x=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Yj,g||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),g)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})};function Hg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jp={exports:{}},Do={};/**
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 hb;function Qj(){if(hb)return Do;hb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:o}}return Do.Fragment=t,Do.jsx=n,Do.jsxs=n,Do}var pb;function Xj(){return pb||(pb=1,jp.exports=Qj()),jp.exports}var l=Xj(),Np={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 mb;function Kj(){if(mb)return Ye;mb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function k(z,Z,A){this.props=z,this.context=Z,this.refs=C,this.updater=A||_}k.prototype.isReactComponent={},k.prototype.setState=function(z,Z){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,Z,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function E(){}E.prototype=k.prototype;function N(z,Z,A){this.props=z,this.context=Z,this.refs=C,this.updater=A||_}var D=N.prototype=new E;D.constructor=N,j(D,k.prototype),D.isPureReactComponent=!0;var O=Array.isArray;function L(){}var G={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function Q(z,Z,A){var ue=A.ref;return{$$typeof:e,type:z,key:Z,ref:ue!==void 0?ue:null,props:A}}function B(z,Z){return Q(z.type,Z,z.props)}function I(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function M(z){var Z={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(A){return Z[A]})}var le=/\/+/g;function J(z,Z){return typeof z=="object"&&z!==null&&z.key!=null?M(""+z.key):Z.toString(36)}function Y(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(L,L):(z.status="pending",z.then(function(Z){z.status==="pending"&&(z.status="fulfilled",z.value=Z)},function(Z){z.status==="pending"&&(z.status="rejected",z.reason=Z)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function $(z,Z,A,ue,xe){var je=typeof z;(je==="undefined"||je==="boolean")&&(z=null);var Re=!1;if(z===null)Re=!0;else switch(je){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(z.$$typeof){case e:case t:Re=!0;break;case g:return Re=z._init,$(Re(z._payload),Z,A,ue,xe)}}if(Re)return xe=xe(z),Re=ue===""?"."+J(z,0):ue,O(xe)?(A="",Re!=null&&(A=Re.replace(le,"$&/")+"/"),$(xe,Z,A,"",function(Je){return Je})):xe!=null&&(I(xe)&&(xe=B(xe,A+(xe.key==null||z&&z.key===xe.key?"":(""+xe.key).replace(le,"$&/")+"/")+Re)),Z.push(xe)),1;Re=0;var Le=ue===""?".":ue+":";if(O(z))for(var Be=0;Be<z.length;Be++)ue=z[Be],je=Le+J(ue,Be),Re+=$(ue,Z,A,je,xe);else if(Be=y(z),typeof Be=="function")for(z=Be.call(z),Be=0;!(ue=z.next()).done;)ue=ue.value,je=Le+J(ue,Be++),Re+=$(ue,Z,A,je,xe);else if(je==="object"){if(typeof z.then=="function")return $(Y(z),Z,A,ue,xe);throw Z=String(z),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Re}function F(z,Z,A){if(z==null)return z;var ue=[],xe=0;return $(z,ue,"","",function(je){return Z.call(A,je,xe++)}),ue}function V(z){if(z._status===-1){var Z=z._result;Z=Z(),Z.then(function(A){(z._status===0||z._status===-1)&&(z._status=1,z._result=A)},function(A){(z._status===0||z._status===-1)&&(z._status=2,z._result=A)}),z._status===-1&&(z._status=0,z._result=Z)}if(z._status===1)return z._result.default;throw z._result}var ge=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},R={map:F,forEach:function(z,Z,A){F(z,function(){Z.apply(this,arguments)},A)},count:function(z){var Z=0;return F(z,function(){Z++}),Z},toArray:function(z){return F(z,function(Z){return Z})||[]},only:function(z){if(!I(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Ye.Activity=x,Ye.Children=R,Ye.Component=k,Ye.Fragment=n,Ye.Profiler=a,Ye.PureComponent=N,Ye.StrictMode=i,Ye.Suspense=h,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=G,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(z){return G.H.useMemoCache(z)}},Ye.cache=function(z){return function(){return z.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(z,Z,A){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ue=j({},z.props),xe=z.key;if(Z!=null)for(je in Z.key!==void 0&&(xe=""+Z.key),Z)!P.call(Z,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&Z.ref===void 0||(ue[je]=Z[je]);var je=arguments.length-2;if(je===1)ue.children=A;else if(1<je){for(var Re=Array(je),Le=0;Le<je;Le++)Re[Le]=arguments[Le+2];ue.children=Re}return Q(z.type,xe,ue)},Ye.createContext=function(z){return z={$$typeof:u,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},Ye.createElement=function(z,Z,A){var ue,xe={},je=null;if(Z!=null)for(ue in Z.key!==void 0&&(je=""+Z.key),Z)P.call(Z,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(xe[ue]=Z[ue]);var Re=arguments.length-2;if(Re===1)xe.children=A;else if(1<Re){for(var Le=Array(Re),Be=0;Be<Re;Be++)Le[Be]=arguments[Be+2];xe.children=Le}if(z&&z.defaultProps)for(ue in Re=z.defaultProps,Re)xe[ue]===void 0&&(xe[ue]=Re[ue]);return Q(z,je,xe)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(z){return{$$typeof:f,render:z}},Ye.isValidElement=I,Ye.lazy=function(z){return{$$typeof:g,_payload:{_status:-1,_result:z},_init:V}},Ye.memo=function(z,Z){return{$$typeof:p,type:z,compare:Z===void 0?null:Z}},Ye.startTransition=function(z){var Z=G.T,A={};G.T=A;try{var ue=z(),xe=G.S;xe!==null&&xe(A,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(L,ge)}catch(je){ge(je)}finally{Z!==null&&A.types!==null&&(Z.types=A.types),G.T=Z}},Ye.unstable_useCacheRefresh=function(){return G.H.useCacheRefresh()},Ye.use=function(z){return G.H.use(z)},Ye.useActionState=function(z,Z,A){return G.H.useActionState(z,Z,A)},Ye.useCallback=function(z,Z){return G.H.useCallback(z,Z)},Ye.useContext=function(z){return G.H.useContext(z)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(z,Z){return G.H.useDeferredValue(z,Z)},Ye.useEffect=function(z,Z){return G.H.useEffect(z,Z)},Ye.useEffectEvent=function(z){return G.H.useEffectEvent(z)},Ye.useId=function(){return G.H.useId()},Ye.useImperativeHandle=function(z,Z,A){return G.H.useImperativeHandle(z,Z,A)},Ye.useInsertionEffect=function(z,Z){return G.H.useInsertionEffect(z,Z)},Ye.useLayoutEffect=function(z,Z){return G.H.useLayoutEffect(z,Z)},Ye.useMemo=function(z,Z){return G.H.useMemo(z,Z)},Ye.useOptimistic=function(z,Z){return G.H.useOptimistic(z,Z)},Ye.useReducer=function(z,Z,A){return G.H.useReducer(z,Z,A)},Ye.useRef=function(z){return G.H.useRef(z)},Ye.useState=function(z){return G.H.useState(z)},Ye.useSyncExternalStore=function(z,Z,A){return G.H.useSyncExternalStore(z,Z,A)},Ye.useTransition=function(){return G.H.useTransition()},Ye.version="19.2.8",Ye}var gb;function qg(){return gb||(gb=1,Np.exports=Kj()),Np.exports}var S=qg();const ed=Hg(S);var Cp={exports:{}},zo={},Ep={exports:{}},Tp={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var xb;function Zj(){return xb||(xb=1,(function(e){function t($,F){var V=$.length;$.push(F);e:for(;0<V;){var ge=V-1>>>1,R=$[ge];if(0<a(R,F))$[ge]=F,$[V]=R,V=ge;else break e}}function n($){return $.length===0?null:$[0]}function i($){if($.length===0)return null;var F=$[0],V=$.pop();if(V!==F){$[0]=V;e:for(var ge=0,R=$.length,z=R>>>1;ge<z;){var Z=2*(ge+1)-1,A=$[Z],ue=Z+1,xe=$[ue];if(0>a(A,V))ue<R&&0>a(xe,A)?($[ge]=xe,$[ue]=V,ge=ue):($[ge]=A,$[Z]=V,ge=Z);else if(ue<R&&0>a(xe,V))$[ge]=xe,$[ue]=V,ge=ue;else break e}}return F}function a($,F){var V=$.sortIndex-F.sortIndex;return V!==0?V:$.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],g=1,x=null,b=3,y=!1,_=!1,j=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function D($){for(var F=n(p);F!==null;){if(F.callback===null)i(p);else if(F.startTime<=$)i(p),F.sortIndex=F.expirationTime,t(h,F);else break;F=n(p)}}function O($){if(j=!1,D($),!_)if(n(h)!==null)_=!0,L||(L=!0,M());else{var F=n(p);F!==null&&Y(O,F.startTime-$)}}var L=!1,G=-1,P=5,Q=-1;function B(){return C?!0:!(e.unstable_now()-Q<P)}function I(){if(C=!1,L){var $=e.unstable_now();Q=$;var F=!0;try{e:{_=!1,j&&(j=!1,E(G),G=-1),y=!0;var V=b;try{t:{for(D($),x=n(h);x!==null&&!(x.expirationTime>$&&B());){var ge=x.callback;if(typeof ge=="function"){x.callback=null,b=x.priorityLevel;var R=ge(x.expirationTime<=$);if($=e.unstable_now(),typeof R=="function"){x.callback=R,D($),F=!0;break t}x===n(h)&&i(h),D($)}else i(h);x=n(h)}if(x!==null)F=!0;else{var z=n(p);z!==null&&Y(O,z.startTime-$),F=!1}}break e}finally{x=null,b=V,y=!1}F=void 0}}finally{F?M():L=!1}}}var M;if(typeof N=="function")M=function(){N(I)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,J=le.port2;le.port1.onmessage=I,M=function(){J.postMessage(null)}}else M=function(){k(I,0)};function Y($,F){G=k(function(){$(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function($){switch(b){case 1:case 2:case 3:var F=3;break;default:F=b}var V=b;b=F;try{return $()}finally{b=V}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function($,F){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var V=b;b=$;try{return F()}finally{b=V}},e.unstable_scheduleCallback=function($,F,V){var ge=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?ge+V:ge):V=ge,$){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=V+R,$={id:g++,callback:F,priorityLevel:$,startTime:V,expirationTime:R,sortIndex:-1},V>ge?($.sortIndex=V,t(p,$),n(h)===null&&$===n(p)&&(j?(E(G),G=-1):j=!0,Y(O,V-ge))):($.sortIndex=R,t(h,$),_||y||(_=!0,L||(L=!0,M()))),$},e.unstable_shouldYield=B,e.unstable_wrapCallback=function($){var F=b;return function(){var V=b;b=F;try{return $.apply(this,arguments)}finally{b=V}}}})(Tp)),Tp}var vb;function Jj(){return vb||(vb=1,Ep.exports=Zj()),Ep.exports}var Ap={exports:{}},An={};/**
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 bb;function eN(){if(bb)return An;bb=1;var e=qg();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={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},a=Symbol.for("react.portal");function o(h,p,g){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:h,containerInfo:p,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return An.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,An.createPortal=function(h,p){var g=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 o(h,p,null,g)},An.flushSync=function(h){var p=u.T,g=i.p;try{if(u.T=null,i.p=2,h)return h()}finally{u.T=p,i.p=g,i.d.f()}},An.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(h,p))},An.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},An.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var g=p.as,x=f(g,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?i.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:y}):g==="script"&&i.d.X(h,{crossOrigin:x,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},An.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=f(p.as,p.crossOrigin);i.d.M(h,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(h)},An.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,x=f(g,p.crossOrigin);i.d.L(h,g,{crossOrigin:x,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})}},An.preloadModule=function(h,p){if(typeof h=="string")if(p){var g=f(p.as,p.crossOrigin);i.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(h)},An.requestFormReset=function(h){i.d.r(h)},An.unstable_batchedUpdates=function(h,p){return h(p)},An.useFormState=function(h,p,g){return u.H.useFormState(h,p,g)},An.useFormStatus=function(){return u.H.useHostTransitionStatus()},An.version="19.2.8",An}var yb;function m5(){if(yb)return Ap.exports;yb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ap.exports=eN(),Ap.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 _b;function tN(){if(_b)return zo;_b=1;var e=Jj(),t=qg(),n=m5();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var s=r,c=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(c=s.return),r=s.return;while(r)}return s.tag===3?c:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(o(r)!==r)throw Error(i(188))}function p(r){var s=r.alternate;if(!s){if(s=o(r),s===null)throw Error(i(188));return s!==r?null:r}for(var c=r,d=s;;){var m=c.return;if(m===null)break;var v=m.alternate;if(v===null){if(d=m.return,d!==null){c=d;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===c)return h(m),r;if(v===d)return h(m),s;v=v.sibling}throw Error(i(188))}if(c.return!==d.return)c=m,d=v;else{for(var w=!1,T=m.child;T;){if(T===c){w=!0,c=m,d=v;break}if(T===d){w=!0,d=m,c=v;break}T=T.sibling}if(!w){for(T=v.child;T;){if(T===c){w=!0,c=v,d=m;break}if(T===d){w=!0,d=v,c=m;break}T=T.sibling}if(!w)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:s}function g(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=g(r),s!==null)return s;r=r.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function M(r){return r===null||typeof r!="object"?null:(r=I&&r[I]||r["@@iterator"],typeof r=="function"?r:null)}var le=Symbol.for("react.client.reference");function J(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===le?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case O:return"Suspense";case L:return"SuspenseList";case Q:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case N:return r.displayName||"Context";case E:return(r._context.displayName||"Context")+".Consumer";case D:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case G:return s=r.displayName||null,s!==null?s:J(r.type)||"Memo";case P:s=r._payload,r=r._init;try{return J(r(s))}catch{}}return null}var Y=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},ge=[],R=-1;function z(r){return{current:r}}function Z(r){0>R||(r.current=ge[R],ge[R]=null,R--)}function A(r,s){R++,ge[R]=r.current,r.current=s}var ue=z(null),xe=z(null),je=z(null),Re=z(null);function Le(r,s){switch(A(je,s),A(xe,r),A(ue,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?D1(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=D1(s),r=z1(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(ue),A(ue,r)}function Be(){Z(ue),Z(xe),Z(je)}function Je(r){r.memoizedState!==null&&A(Re,r);var s=ue.current,c=z1(s,r.type);s!==c&&(A(xe,r),A(ue,c))}function it(r){xe.current===r&&(Z(ue),Z(xe)),Re.current===r&&(Z(Re),Ao._currentValue=V)}var ht,Jt;function pt(r){if(ht===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);ht=s&&s[1]||"",Jt=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ht+r+Jt}var _t=!1;function Nt(r,s){if(!r||_t)return"";_t=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(se){var re=se}Reflect.construct(r,[],de)}else{try{de.call()}catch(se){re=se}r.call(de.prototype)}}else{try{throw Error()}catch(se){re=se}(de=r())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(se){if(se&&re&&typeof se.stack=="string")return[se.stack,re.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),w=v[0],T=v[1];if(w&&T){var U=w.split(`
44
+ `),te=T.split(`
45
+ `);for(m=d=0;d<U.length&&!U[d].includes("DetermineComponentFrameRoot");)d++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(d===U.length||m===te.length)for(d=U.length-1,m=te.length-1;1<=d&&0<=m&&U[d]!==te[m];)m--;for(;1<=d&&0<=m;d--,m--)if(U[d]!==te[m]){if(d!==1||m!==1)do if(d--,m--,0>m||U[d]!==te[m]){var oe=`
46
+ `+U[d].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=d&&0<=m);break}}}finally{_t=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?pt(c):""}function ve(r,s){switch(r.tag){case 26:case 27:case 5:return pt(r.type);case 16:return pt("Lazy");case 13:return r.child!==s&&s!==null?pt("Suspense Fallback"):pt("Suspense");case 19:return pt("SuspenseList");case 0:case 15:return Nt(r.type,!1);case 11:return Nt(r.type.render,!1);case 1:return Nt(r.type,!0);case 31:return pt("Activity");default:return""}}function Fe(r){try{var s="",c=null;do s+=ve(r,c),c=r,r=r.return;while(r);return s}catch(d){return`
47
+ Error generating stack: `+d.message+`
48
+ `+d.stack}}var ct=Object.prototype.hasOwnProperty,xn=e.unstable_scheduleCallback,Ne=e.unstable_cancelCallback,ze=e.unstable_shouldYield,mt=e.unstable_requestPaint,Ee=e.unstable_now,$r=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,W=e.unstable_NormalPriority,pe=e.unstable_LowPriority,Me=e.unstable_IdlePriority,Qe=e.log,nt=e.unstable_setDisableYieldValue,rt=null,St=null;function vn(r){if(typeof Qe=="function"&&nt(r),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(rt,r)}catch{}}var et=Math.clz32?Math.clz32:Xr,rr=Math.log,En=Math.LN2;function Xr(r){return r>>>=0,r===0?32:31-(rr(r)/En|0)|0}var Fr=256,Ur=262144,ne=4194304;function me(r){var s=r&42;if(s!==0)return s;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function be(r,s,c){var d=r.pendingLanes;if(d===0)return 0;var m=0,v=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var T=d&134217727;return T!==0?(d=T&~v,d!==0?m=me(d):(w&=T,w!==0?m=me(w):c||(c=T&~r,c!==0&&(m=me(c))))):(T=d&~v,T!==0?m=me(T):w!==0?m=me(w):c||(c=d&~r,c!==0&&(m=me(c)))),m===0?0:s!==0&&s!==m&&(s&v)===0&&(v=m&-m,c=s&-s,v>=c||v===32&&(c&4194048)!==0)?s:m}function Xe(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function $t(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cn(){var r=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),r}function Tn(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function Ft(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function zn(r,s,c,d,m,v){var w=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var T=r.entanglements,U=r.expirationTimes,te=r.hiddenUpdates;for(c=w&~c;0<c;){var oe=31-et(c),de=1<<oe;T[oe]=0,U[oe]=-1;var re=te[oe];if(re!==null)for(te[oe]=null,oe=0;oe<re.length;oe++){var se=re[oe];se!==null&&(se.lane&=-536870913)}c&=~de}d!==0&&vr(r,d,0),v!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=v&~(w&~s))}function vr(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-et(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function ja(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var d=31-et(c),m=1<<d;m&s|r[d]&s&&(r[d]|=s),c&=~m}}function $l(r,s){var c=s&-s;return c=(c&42)!==0?1:On(c),(c&(r.suspendedLanes|s))!==0?0:c}function On(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Ds(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Fl(){var r=F.p;return r!==0?r:(r=window.event,r===void 0?32:ib(r.type))}function Ul(r,s){var c=F.p;try{return F.p=r,s()}finally{F.p=c}}var br=Math.random().toString(36).slice(2),Qt="__reactFiber$"+br,Sn="__reactProps$"+br,ir="__reactContainer$"+br,Il="__reactEvents$"+br,jf="__reactListeners$"+br,zs="__reactHandles$"+br,Os="__reactResources$"+br,Kr="__reactMarker$"+br;function Yi(r){delete r[Qt],delete r[Sn],delete r[Il],delete r[jf],delete r[zs]}function pi(r){var s=r[Qt];if(s)return s;for(var c=r.parentNode;c;){if(s=c[ir]||c[Qt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=I1(r);r!==null;){if(c=r[Qt])return c;r=I1(r)}return s}r=c,c=r.parentNode}return null}function Vn(r){if(r=r[Qt]||r[ir]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Bs(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Zr(r){var s=r[Os];return s||(s=r[Os]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function en(r){r[Kr]=!0}var Gn=new Set,Na={};function Ir(r,s){Jr(r,s),Jr(r+"Capture",s)}function Jr(r,s){for(Na[r]=s,r=0;r<s.length;r++)Gn.add(s[r])}var Hl=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]*$"),ql={},tn={};function Nf(r){return ct.call(tn,r)?!0:ct.call(ql,r)?!1:Hl.test(r)?tn[r]=!0:(ql[r]=!0,!1)}function Ps(r,s,c){if(Nf(s))if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+c)}}function Ca(r,s,c){if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+c)}}function Hr(r,s,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(s,c,""+d)}}function Yn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Pc(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Vl(r,s,c){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,v=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){c=""+w,v.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Ea(r){if(!r._valueTracker){var s=Pc(r)?"checked":"value";r._valueTracker=Vl(r,s,""+r[s])}}function ei(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),d="";return r&&(d=Pc(r)?r.checked?"true":"false":r.value),r=d,r!==c?(s.setValue(r),!0):!1}function Wi(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var yr=/[\n"\\]/g;function an(r){return r.replace(yr,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function $s(r,s,c,d,m,v,w,T){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Yn(s)):r.value!==""+Yn(s)&&(r.value=""+Yn(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?Ta(r,w,Yn(s)):c!=null?Ta(r,w,Yn(c)):d!=null&&r.removeAttribute("value"),m==null&&v!=null&&(r.defaultChecked=!!v),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?r.name=""+Yn(T):r.removeAttribute("name")}function $c(r,s,c,d,m,v,w,T){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),s!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){Ea(r);return}c=c!=null?""+Yn(c):"",s=s!=null?""+Yn(s):c,T||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=T?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Ea(r)}function Ta(r,s,c){s==="number"&&Wi(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Qi(r,s,c,d){if(r=r.options,s){s={};for(var m=0;m<c.length;m++)s["$"+c[m]]=!0;for(c=0;c<r.length;c++)m=s.hasOwnProperty("$"+r[c].value),r[c].selected!==m&&(r[c].selected=m),m&&d&&(r[c].defaultSelected=!0)}else{for(c=""+Yn(c),s=null,m=0;m<r.length;m++){if(r[m].value===c){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function Aa(r,s,c){if(s!=null&&(s=""+Yn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+Yn(c):""}function Gl(r,s,c,d){if(s==null){if(d!=null){if(c!=null)throw Error(i(92));if(Y(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),s=c}c=Yn(s),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),Ea(r)}function Xi(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var Cf=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 Fc(r,s,c){var d=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,c):typeof c!="number"||c===0||Cf.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function Uc(r,s,c){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in s)d=s[m],s.hasOwnProperty(m)&&c[m]!==d&&Fc(r,m,d)}else for(var v in s)s.hasOwnProperty(v)&&Fc(r,v,s[v])}function Ma(r){if(r.indexOf("-")===-1)return!1;switch(r){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 Ic=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"]]),Ef=/^[\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 Ra(r){return Ef.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function _r(){}var Ki=null;function La(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Zi=null,Ji=null;function Hc(r){var s=Vn(r);if(s&&(r=s.stateNode)){var c=r[Sn]||null;e:switch(r=s.stateNode,s.type){case"input":if($s(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+an(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var d=c[s];if(d!==r&&d.form===r.form){var m=d[Sn]||null;if(!m)throw Error(i(90));$s(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<c.length;s++)d=c[s],d.form===r.form&&ei(d)}break e;case"textarea":Aa(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Qi(r,!!c.multiple,s,!1)}}}var Yl=!1;function qc(r,s,c){if(Yl)return r(s,c);Yl=!0;try{var d=r(s);return d}finally{if(Yl=!1,(Zi!==null||Ji!==null)&&(Ru(),Zi&&(s=Zi,r=Ji,Ji=Zi=null,Hc(s),r)))for(s=0;s<r.length;s++)Hc(r[s])}}function Fs(r,s){var c=r.stateNode;if(c===null)return null;var d=c[Sn]||null;if(d===null)return null;c=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(i(231,s,typeof c));return c}var wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Da=!1;if(wr)try{var es={};Object.defineProperty(es,"passive",{get:function(){Da=!0}}),window.addEventListener("test",es,es),window.removeEventListener("test",es,es)}catch{Da=!1}var H=null,fe=null,Ke=null;function gt(){if(Ke)return Ke;var r,s=fe,c=s.length,d,m="value"in H?H.value:H.textContent,v=m.length;for(r=0;r<c&&s[r]===m[r];r++);var w=c-r;for(d=1;d<=w&&s[c-d]===m[v-d];d++);return Ke=m.slice(r,1<d?1-d:void 0)}function st(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function He(){return!0}function Bn(){return!1}function bn(r){function s(c,d,m,v,w){this._reactName=c,this._targetInst=m,this.type=d,this.nativeEvent=v,this.target=w,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(c=r[T],this[T]=c?c(v):v[T]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?He:Bn,this.isPropagationStopped=Bn,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=He)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=He)},persist:function(){},isPersistent:He}),s}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mi=bn(Sr),yn=x({},Sr,{view:0,detail:0}),Vc=bn(yn),Wl,Ql,Us,Is=x({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Af,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Us&&(Us&&r.type==="mousemove"?(Wl=r.screenX-Us.screenX,Ql=r.screenY-Us.screenY):Ql=Wl=0,Us=r),Wl)},movementY:function(r){return"movementY"in r?r.movementY:Ql}}),Tf=bn(Is),Gc=x({},Is,{dataTransfer:0}),Yc=bn(Gc),Wc=x({},yn,{relatedTarget:0}),ti=bn(Wc),Qc=x({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),Xc=bn(Qc),za=x({},Sr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),XS=bn(za),KS=x({},Sr,{data:0}),Px=bn(KS),ZS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JS={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"},ek={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tk(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=ek[r])?!!s[r]:!1}function Af(){return tk}var nk=x({},yn,{key:function(r){if(r.key){var s=ZS[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=st(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?JS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Af,charCode:function(r){return r.type==="keypress"?st(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?st(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),rk=bn(nk),ik=x({},Is,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$x=bn(ik),sk=x({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Af}),ak=bn(sk),lk=x({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ok=bn(lk),ck=x({},Is,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),uk=bn(ck),dk=x({},Sr,{newState:0,oldState:0}),fk=bn(dk),hk=[9,13,27,32],Mf=wr&&"CompositionEvent"in window,Xl=null;wr&&"documentMode"in document&&(Xl=document.documentMode);var pk=wr&&"TextEvent"in window&&!Xl,Fx=wr&&(!Mf||Xl&&8<Xl&&11>=Xl),Ux=" ",Ix=!1;function Hx(r,s){switch(r){case"keyup":return hk.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Oa=!1;function mk(r,s){switch(r){case"compositionend":return qx(s);case"keypress":return s.which!==32?null:(Ix=!0,Ux);case"textInput":return r=s.data,r===Ux&&Ix?null:r;default:return null}}function gk(r,s){if(Oa)return r==="compositionend"||!Mf&&Hx(r,s)?(r=gt(),Ke=fe=H=null,Oa=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Fx&&s.locale!=="ko"?null:s.data;default:return null}}var xk={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 Vx(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!xk[r.type]:s==="textarea"}function Gx(r,s,c,d){Zi?Ji?Ji.push(d):Ji=[d]:Zi=d,s=$u(s,"onChange"),0<s.length&&(c=new mi("onChange","change",null,c,d),r.push({event:c,listeners:s}))}var Kl=null,Zl=null;function vk(r){E1(r,0)}function Kc(r){var s=Bs(r);if(ei(s))return r}function Yx(r,s){if(r==="change")return s}var Wx=!1;if(wr){var Rf;if(wr){var Lf="oninput"in document;if(!Lf){var Qx=document.createElement("div");Qx.setAttribute("oninput","return;"),Lf=typeof Qx.oninput=="function"}Rf=Lf}else Rf=!1;Wx=Rf&&(!document.documentMode||9<document.documentMode)}function Xx(){Kl&&(Kl.detachEvent("onpropertychange",Kx),Zl=Kl=null)}function Kx(r){if(r.propertyName==="value"&&Kc(Zl)){var s=[];Gx(s,Zl,r,La(r)),qc(vk,s)}}function bk(r,s,c){r==="focusin"?(Xx(),Kl=s,Zl=c,Kl.attachEvent("onpropertychange",Kx)):r==="focusout"&&Xx()}function yk(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Kc(Zl)}function _k(r,s){if(r==="click")return Kc(s)}function wk(r,s){if(r==="input"||r==="change")return Kc(s)}function Sk(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var sr=typeof Object.is=="function"?Object.is:Sk;function Jl(r,s){if(sr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var c=Object.keys(r),d=Object.keys(s);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var m=c[d];if(!ct.call(s,m)||!sr(r[m],s[m]))return!1}return!0}function Zx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Jx(r,s){var c=Zx(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=s&&d>=s)return{node:c,offset:s-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Zx(c)}}function e0(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?e0(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function t0(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Wi(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=Wi(r.document)}return s}function Df(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var kk=wr&&"documentMode"in document&&11>=document.documentMode,Ba=null,zf=null,eo=null,Of=!1;function n0(r,s,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Of||Ba==null||Ba!==Wi(d)||(d=Ba,"selectionStart"in d&&Df(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),eo&&Jl(eo,d)||(eo=d,d=$u(zf,"onSelect"),0<d.length&&(s=new mi("onSelect","select",null,s,c),r.push({event:s,listeners:d}),s.target=Ba)))}function Hs(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var Pa={animationend:Hs("Animation","AnimationEnd"),animationiteration:Hs("Animation","AnimationIteration"),animationstart:Hs("Animation","AnimationStart"),transitionrun:Hs("Transition","TransitionRun"),transitionstart:Hs("Transition","TransitionStart"),transitioncancel:Hs("Transition","TransitionCancel"),transitionend:Hs("Transition","TransitionEnd")},Bf={},r0={};wr&&(r0=document.createElement("div").style,"AnimationEvent"in window||(delete Pa.animationend.animation,delete Pa.animationiteration.animation,delete Pa.animationstart.animation),"TransitionEvent"in window||delete Pa.transitionend.transition);function qs(r){if(Bf[r])return Bf[r];if(!Pa[r])return r;var s=Pa[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in r0)return Bf[r]=s[c];return r}var i0=qs("animationend"),s0=qs("animationiteration"),a0=qs("animationstart"),jk=qs("transitionrun"),Nk=qs("transitionstart"),Ck=qs("transitioncancel"),l0=qs("transitionend"),o0=new Map,Pf="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(" ");Pf.push("scrollEnd");function qr(r,s){o0.set(r,s),Ir(s,[r])}var Zc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},kr=[],$a=0,$f=0;function Jc(){for(var r=$a,s=$f=$a=0;s<r;){var c=kr[s];kr[s++]=null;var d=kr[s];kr[s++]=null;var m=kr[s];kr[s++]=null;var v=kr[s];if(kr[s++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}v!==0&&c0(c,m,v)}}function eu(r,s,c,d){kr[$a++]=r,kr[$a++]=s,kr[$a++]=c,kr[$a++]=d,$f|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Ff(r,s,c,d){return eu(r,s,c,d),tu(r)}function Vs(r,s){return eu(r,null,null,s),tu(r)}function c0(r,s,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var m=!1,v=r.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(m=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,m&&s!==null&&(m=31-et(c),r=v.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=c|536870912),v):null}function tu(r){if(50<So)throw So=0,Qh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Fa={};function Ek(r,s,c,d){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ar(r,s,c,d){return new Ek(r,s,c,d)}function Uf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function gi(r,s){var c=r.alternate;return c===null?(c=ar(r.tag,s,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=s,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,s=r.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function u0(r,s){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,s=c.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function nu(r,s,c,d,m,v){var w=0;if(d=r,typeof r=="function")Uf(r)&&(w=1);else if(typeof r=="string")w=Lj(r,c,ue.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Q:return r=ar(31,c,s,m),r.elementType=Q,r.lanes=v,r;case j:return Gs(c.children,m,v,s);case C:w=8,m|=24;break;case k:return r=ar(12,c,s,m|2),r.elementType=k,r.lanes=v,r;case O:return r=ar(13,c,s,m),r.elementType=O,r.lanes=v,r;case L:return r=ar(19,c,s,m),r.elementType=L,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case N:w=10;break e;case E:w=9;break e;case D:w=11;break e;case G:w=14;break e;case P:w=16,d=null;break e}w=29,c=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=ar(w,c,s,m),s.elementType=r,s.type=d,s.lanes=v,s}function Gs(r,s,c,d){return r=ar(7,r,d,s),r.lanes=c,r}function If(r,s,c){return r=ar(6,r,null,s),r.lanes=c,r}function d0(r){var s=ar(18,null,null,0);return s.stateNode=r,s}function Hf(r,s,c){return s=ar(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var f0=new WeakMap;function jr(r,s){if(typeof r=="object"&&r!==null){var c=f0.get(r);return c!==void 0?c:(s={value:r,source:s,stack:Fe(s)},f0.set(r,s),s)}return{value:r,source:s,stack:Fe(s)}}var Ua=[],Ia=0,ru=null,to=0,Nr=[],Cr=0,ts=null,ni=1,ri="";function xi(r,s){Ua[Ia++]=to,Ua[Ia++]=ru,ru=r,to=s}function h0(r,s,c){Nr[Cr++]=ni,Nr[Cr++]=ri,Nr[Cr++]=ts,ts=r;var d=ni;r=ri;var m=32-et(d)-1;d&=~(1<<m),c+=1;var v=32-et(s)+m;if(30<v){var w=m-m%5;v=(d&(1<<w)-1).toString(32),d>>=w,m-=w,ni=1<<32-et(s)+m|c<<m|d,ri=v+r}else ni=1<<v|c<<m|d,ri=r}function qf(r){r.return!==null&&(xi(r,1),h0(r,1,0))}function Vf(r){for(;r===ru;)ru=Ua[--Ia],Ua[Ia]=null,to=Ua[--Ia],Ua[Ia]=null;for(;r===ts;)ts=Nr[--Cr],Nr[Cr]=null,ri=Nr[--Cr],Nr[Cr]=null,ni=Nr[--Cr],Nr[Cr]=null}function p0(r,s){Nr[Cr++]=ni,Nr[Cr++]=ri,Nr[Cr++]=ts,ni=s.id,ri=s.overflow,ts=r}var kn=null,It=null,ft=!1,ns=null,Er=!1,Gf=Error(i(519));function rs(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw no(jr(s,r)),Gf}function m0(r){var s=r.stateNode,c=r.type,d=r.memoizedProps;switch(s[Qt]=r,s[Sn]=d,c){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(c=0;c<jo.length;c++)lt(jo[c],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":lt("invalid",s),$c(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",s);break;case"textarea":lt("invalid",s),Gl(s,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||d.suppressHydrationWarning===!0||R1(s.textContent,c)?(d.popover!=null&&(lt("beforetoggle",s),lt("toggle",s)),d.onScroll!=null&&lt("scroll",s),d.onScrollEnd!=null&&lt("scrollend",s),d.onClick!=null&&(s.onclick=_r),s=!0):s=!1,s||rs(r,!0)}function g0(r){for(kn=r.return;kn;)switch(kn.tag){case 5:case 31:case 13:Er=!1;return;case 27:case 3:Er=!0;return;default:kn=kn.return}}function Ha(r){if(r!==kn)return!1;if(!ft)return g0(r),ft=!0,!1;var s=r.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||up(r.type,r.memoizedProps)),c=!c),c&&It&&rs(r),g0(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));It=U1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));It=U1(r)}else s===27?(s=It,xs(r.type)?(r=mp,mp=null,It=r):It=s):It=kn?Ar(r.stateNode.nextSibling):null;return!0}function Ys(){It=kn=null,ft=!1}function Yf(){var r=ns;return r!==null&&(Kn===null?Kn=r:Kn.push.apply(Kn,r),ns=null),r}function no(r){ns===null?ns=[r]:ns.push(r)}var Wf=z(null),Ws=null,vi=null;function is(r,s,c){A(Wf,s._currentValue),s._currentValue=c}function bi(r){r._currentValue=Wf.current,Z(Wf)}function Qf(r,s,c){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===c)break;r=r.return}}function Xf(r,s,c,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var v=m.dependencies;if(v!==null){var w=m.child;v=v.firstContext;e:for(;v!==null;){var T=v;v=m;for(var U=0;U<s.length;U++)if(T.context===s[U]){v.lanes|=c,T=v.alternate,T!==null&&(T.lanes|=c),Qf(v.return,c,r),d||(w=null);break e}v=T.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=c,v=w.alternate,v!==null&&(v.lanes|=c),Qf(w,c,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function qa(r,s,c,d){r=null;for(var m=s,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var T=m.type;sr(m.pendingProps.value,w.value)||(r!==null?r.push(T):r=[T])}}else if(m===Re.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(Ao):r=[Ao])}m=m.return}r!==null&&Xf(s,r,c,d),s.flags|=262144}function iu(r){for(r=r.firstContext;r!==null;){if(!sr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Qs(r){Ws=r,vi=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function jn(r){return x0(Ws,r)}function su(r,s){return Ws===null&&Qs(r),x0(r,s)}function x0(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},vi===null){if(r===null)throw Error(i(308));vi=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else vi=vi.next=s;return c}var Tk=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(c){return c()})}},Ak=e.unstable_scheduleCallback,Mk=e.unstable_NormalPriority,un={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kf(){return{controller:new Tk,data:new Map,refCount:0}}function ro(r){r.refCount--,r.refCount===0&&Ak(Mk,function(){r.controller.abort()})}var io=null,Zf=0,Va=0,Ga=null;function Rk(r,s){if(io===null){var c=io=[];Zf=0,Va=tp(),Ga={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Zf++,s.then(v0,v0),s}function v0(){if(--Zf===0&&io!==null){Ga!==null&&(Ga.status="fulfilled");var r=io;io=null,Va=0,Ga=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Lk(r,s){var c=[],d={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<c.length;m++)(0,c[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),d}var b0=$.S;$.S=function(r,s){n1=Ee(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Rk(r,s),b0!==null&&b0(r,s)};var Xs=z(null);function Jf(){var r=Xs.current;return r!==null?r:Lt.pooledCache}function au(r,s){s===null?A(Xs,Xs.current):A(Xs,s.pool)}function y0(){var r=Jf();return r===null?null:{parent:un._currentValue,pool:r}}var Ya=Error(i(460)),eh=Error(i(474)),lu=Error(i(542)),ou={then:function(){}};function _0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function w0(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(_r,_r),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,k0(r),r;default:if(typeof s.status=="string")s.then(_r,_r);else{if(r=Lt,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var m=s;m.status="fulfilled",m.value=d}},function(d){if(s.status==="pending"){var m=s;m.status="rejected",m.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,k0(r),r}throw Zs=s,Ya}}function Ks(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Zs=c,Ya):c}}var Zs=null;function S0(){if(Zs===null)throw Error(i(459));var r=Zs;return Zs=null,r}function k0(r){if(r===Ya||r===lu)throw Error(i(483))}var Wa=null,so=0;function cu(r){var s=so;return so+=1,Wa===null&&(Wa=[]),w0(Wa,r,s)}function ao(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function uu(r,s){throw s.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function j0(r){function s(K,q){if(r){var ee=K.deletions;ee===null?(K.deletions=[q],K.flags|=16):ee.push(q)}}function c(K,q){if(!r)return null;for(;q!==null;)s(K,q),q=q.sibling;return null}function d(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function m(K,q){return K=gi(K,q),K.index=0,K.sibling=null,K}function v(K,q,ee){return K.index=ee,r?(ee=K.alternate,ee!==null?(ee=ee.index,ee<q?(K.flags|=67108866,q):ee):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function w(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function T(K,q,ee,ce){return q===null||q.tag!==6?(q=If(ee,K.mode,ce),q.return=K,q):(q=m(q,ee),q.return=K,q)}function U(K,q,ee,ce){var Pe=ee.type;return Pe===j?oe(K,q,ee.props.children,ce,ee.key):q!==null&&(q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===P&&Ks(Pe)===q.type)?(q=m(q,ee.props),ao(q,ee),q.return=K,q):(q=nu(ee.type,ee.key,ee.props,null,K.mode,ce),ao(q,ee),q.return=K,q)}function te(K,q,ee,ce){return q===null||q.tag!==4||q.stateNode.containerInfo!==ee.containerInfo||q.stateNode.implementation!==ee.implementation?(q=Hf(ee,K.mode,ce),q.return=K,q):(q=m(q,ee.children||[]),q.return=K,q)}function oe(K,q,ee,ce,Pe){return q===null||q.tag!==7?(q=Gs(ee,K.mode,ce,Pe),q.return=K,q):(q=m(q,ee),q.return=K,q)}function de(K,q,ee){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=If(""+q,K.mode,ee),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case y:return ee=nu(q.type,q.key,q.props,null,K.mode,ee),ao(ee,q),ee.return=K,ee;case _:return q=Hf(q,K.mode,ee),q.return=K,q;case P:return q=Ks(q),de(K,q,ee)}if(Y(q)||M(q))return q=Gs(q,K.mode,ee,null),q.return=K,q;if(typeof q.then=="function")return de(K,cu(q),ee);if(q.$$typeof===N)return de(K,su(K,q),ee);uu(K,q)}return null}function re(K,q,ee,ce){var Pe=q!==null?q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Pe!==null?null:T(K,q,""+ee,ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ee.key===Pe?U(K,q,ee,ce):null;case _:return ee.key===Pe?te(K,q,ee,ce):null;case P:return ee=Ks(ee),re(K,q,ee,ce)}if(Y(ee)||M(ee))return Pe!==null?null:oe(K,q,ee,ce,null);if(typeof ee.then=="function")return re(K,q,cu(ee),ce);if(ee.$$typeof===N)return re(K,q,su(K,ee),ce);uu(K,ee)}return null}function se(K,q,ee,ce,Pe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(ee)||null,T(q,K,""+ce,Pe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return K=K.get(ce.key===null?ee:ce.key)||null,U(q,K,ce,Pe);case _:return K=K.get(ce.key===null?ee:ce.key)||null,te(q,K,ce,Pe);case P:return ce=Ks(ce),se(K,q,ee,ce,Pe)}if(Y(ce)||M(ce))return K=K.get(ee)||null,oe(q,K,ce,Pe,null);if(typeof ce.then=="function")return se(K,q,ee,cu(ce),Pe);if(ce.$$typeof===N)return se(K,q,ee,su(q,ce),Pe);uu(q,ce)}return null}function Te(K,q,ee,ce){for(var Pe=null,bt=null,De=q,tt=q=0,dt=null;De!==null&&tt<ee.length;tt++){De.index>tt?(dt=De,De=null):dt=De.sibling;var yt=re(K,De,ee[tt],ce);if(yt===null){De===null&&(De=dt);break}r&&De&&yt.alternate===null&&s(K,De),q=v(yt,q,tt),bt===null?Pe=yt:bt.sibling=yt,bt=yt,De=dt}if(tt===ee.length)return c(K,De),ft&&xi(K,tt),Pe;if(De===null){for(;tt<ee.length;tt++)De=de(K,ee[tt],ce),De!==null&&(q=v(De,q,tt),bt===null?Pe=De:bt.sibling=De,bt=De);return ft&&xi(K,tt),Pe}for(De=d(De);tt<ee.length;tt++)dt=se(De,K,tt,ee[tt],ce),dt!==null&&(r&&dt.alternate!==null&&De.delete(dt.key===null?tt:dt.key),q=v(dt,q,tt),bt===null?Pe=dt:bt.sibling=dt,bt=dt);return r&&De.forEach(function(ws){return s(K,ws)}),ft&&xi(K,tt),Pe}function Ue(K,q,ee,ce){if(ee==null)throw Error(i(151));for(var Pe=null,bt=null,De=q,tt=q=0,dt=null,yt=ee.next();De!==null&&!yt.done;tt++,yt=ee.next()){De.index>tt?(dt=De,De=null):dt=De.sibling;var ws=re(K,De,yt.value,ce);if(ws===null){De===null&&(De=dt);break}r&&De&&ws.alternate===null&&s(K,De),q=v(ws,q,tt),bt===null?Pe=ws:bt.sibling=ws,bt=ws,De=dt}if(yt.done)return c(K,De),ft&&xi(K,tt),Pe;if(De===null){for(;!yt.done;tt++,yt=ee.next())yt=de(K,yt.value,ce),yt!==null&&(q=v(yt,q,tt),bt===null?Pe=yt:bt.sibling=yt,bt=yt);return ft&&xi(K,tt),Pe}for(De=d(De);!yt.done;tt++,yt=ee.next())yt=se(De,K,tt,yt.value,ce),yt!==null&&(r&&yt.alternate!==null&&De.delete(yt.key===null?tt:yt.key),q=v(yt,q,tt),bt===null?Pe=yt:bt.sibling=yt,bt=yt);return r&&De.forEach(function(qj){return s(K,qj)}),ft&&xi(K,tt),Pe}function Mt(K,q,ee,ce){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:e:{for(var Pe=ee.key;q!==null;){if(q.key===Pe){if(Pe=ee.type,Pe===j){if(q.tag===7){c(K,q.sibling),ce=m(q,ee.props.children),ce.return=K,K=ce;break e}}else if(q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===P&&Ks(Pe)===q.type){c(K,q.sibling),ce=m(q,ee.props),ao(ce,ee),ce.return=K,K=ce;break e}c(K,q);break}else s(K,q);q=q.sibling}ee.type===j?(ce=Gs(ee.props.children,K.mode,ce,ee.key),ce.return=K,K=ce):(ce=nu(ee.type,ee.key,ee.props,null,K.mode,ce),ao(ce,ee),ce.return=K,K=ce)}return w(K);case _:e:{for(Pe=ee.key;q!==null;){if(q.key===Pe)if(q.tag===4&&q.stateNode.containerInfo===ee.containerInfo&&q.stateNode.implementation===ee.implementation){c(K,q.sibling),ce=m(q,ee.children||[]),ce.return=K,K=ce;break e}else{c(K,q);break}else s(K,q);q=q.sibling}ce=Hf(ee,K.mode,ce),ce.return=K,K=ce}return w(K);case P:return ee=Ks(ee),Mt(K,q,ee,ce)}if(Y(ee))return Te(K,q,ee,ce);if(M(ee)){if(Pe=M(ee),typeof Pe!="function")throw Error(i(150));return ee=Pe.call(ee),Ue(K,q,ee,ce)}if(typeof ee.then=="function")return Mt(K,q,cu(ee),ce);if(ee.$$typeof===N)return Mt(K,q,su(K,ee),ce);uu(K,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,q!==null&&q.tag===6?(c(K,q.sibling),ce=m(q,ee),ce.return=K,K=ce):(c(K,q),ce=If(ee,K.mode,ce),ce.return=K,K=ce),w(K)):c(K,q)}return function(K,q,ee,ce){try{so=0;var Pe=Mt(K,q,ee,ce);return Wa=null,Pe}catch(De){if(De===Ya||De===lu)throw De;var bt=ar(29,De,null,K.mode);return bt.lanes=ce,bt.return=K,bt}finally{}}}var Js=j0(!0),N0=j0(!1),ss=!1;function th(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nh(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function as(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ls(r,s,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(wt&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=tu(r),c0(r,null,c),s}return eu(r,d,s,c),tu(r)}function lo(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,ja(r,c)}}function rh(r,s){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var m=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?m=v=w:v=v.next=w,c=c.next}while(c!==null);v===null?m=v=s:v=v.next=s}else m=v=s;c={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var ih=!1;function oo(){if(ih){var r=Ga;if(r!==null)throw r}}function co(r,s,c,d){ih=!1;var m=r.updateQueue;ss=!1;var v=m.firstBaseUpdate,w=m.lastBaseUpdate,T=m.shared.pending;if(T!==null){m.shared.pending=null;var U=T,te=U.next;U.next=null,w===null?v=te:w.next=te,w=U;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,T=oe.lastBaseUpdate,T!==w&&(T===null?oe.firstBaseUpdate=te:T.next=te,oe.lastBaseUpdate=U))}if(v!==null){var de=m.baseState;w=0,oe=te=U=null,T=v;do{var re=T.lane&-536870913,se=re!==T.lane;if(se?(ut&re)===re:(d&re)===re){re!==0&&re===Va&&(ih=!0),oe!==null&&(oe=oe.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Te=r,Ue=T;re=s;var Mt=c;switch(Ue.tag){case 1:if(Te=Ue.payload,typeof Te=="function"){de=Te.call(Mt,de,re);break e}de=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ue.payload,re=typeof Te=="function"?Te.call(Mt,de,re):Te,re==null)break e;de=x({},de,re);break e;case 2:ss=!0}}re=T.callback,re!==null&&(r.flags|=64,se&&(r.flags|=8192),se=m.callbacks,se===null?m.callbacks=[re]:se.push(re))}else se={lane:re,tag:T.tag,payload:T.payload,callback:T.callback,next:null},oe===null?(te=oe=se,U=de):oe=oe.next=se,w|=re;if(T=T.next,T===null){if(T=m.shared.pending,T===null)break;se=T,T=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);oe===null&&(U=de),m.baseState=U,m.firstBaseUpdate=te,m.lastBaseUpdate=oe,v===null&&(m.shared.lanes=0),fs|=w,r.lanes=w,r.memoizedState=de}}function C0(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function E0(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)C0(c[r],s)}var Qa=z(null),du=z(0);function T0(r,s){r=Ei,A(du,r),A(Qa,s),Ei=r|s.baseLanes}function sh(){A(du,Ei),A(Qa,Qa.current)}function ah(){Ei=du.current,Z(Qa),Z(du)}var lr=z(null),Tr=null;function os(r){var s=r.alternate;A(ln,ln.current&1),A(lr,r),Tr===null&&(s===null||Qa.current!==null||s.memoizedState!==null)&&(Tr=r)}function lh(r){A(ln,ln.current),A(lr,r),Tr===null&&(Tr=r)}function A0(r){r.tag===22?(A(ln,ln.current),A(lr,r),Tr===null&&(Tr=r)):cs()}function cs(){A(ln,ln.current),A(lr,lr.current)}function or(r){Z(lr),Tr===r&&(Tr=null),Z(ln)}var ln=z(0);function fu(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||hp(c)||pp(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var yi=0,Ze=null,Tt=null,dn=null,hu=!1,Xa=!1,ea=!1,pu=0,uo=0,Ka=null,Dk=0;function nn(){throw Error(i(321))}function oh(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!sr(r[c],s[c]))return!1;return!0}function ch(r,s,c,d,m,v){return yi=v,Ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,$.H=r===null||r.memoizedState===null?hv:kh,ea=!1,v=c(d,m),ea=!1,Xa&&(v=R0(s,c,d,m)),M0(r),v}function M0(r){$.H=po;var s=Tt!==null&&Tt.next!==null;if(yi=0,dn=Tt=Ze=null,hu=!1,uo=0,Ka=null,s)throw Error(i(300));r===null||fn||(r=r.dependencies,r!==null&&iu(r)&&(fn=!0))}function R0(r,s,c,d){Ze=r;var m=0;do{if(Xa&&(Ka=null),uo=0,Xa=!1,25<=m)throw Error(i(301));if(m+=1,dn=Tt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}$.H=pv,v=s(c,d)}while(Xa);return v}function zk(){var r=$.H,s=r.useState()[0];return s=typeof s.then=="function"?fo(s):s,r=r.useState()[0],(Tt!==null?Tt.memoizedState:null)!==r&&(Ze.flags|=1024),s}function uh(){var r=pu!==0;return pu=0,r}function dh(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function fh(r){if(hu){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}hu=!1}yi=0,dn=Tt=Ze=null,Xa=!1,uo=pu=0,Ka=null}function Pn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dn===null?Ze.memoizedState=dn=r:dn=dn.next=r,dn}function on(){if(Tt===null){var r=Ze.alternate;r=r!==null?r.memoizedState:null}else r=Tt.next;var s=dn===null?Ze.memoizedState:dn.next;if(s!==null)dn=s,Tt=r;else{if(r===null)throw Ze.alternate===null?Error(i(467)):Error(i(310));Tt=r,r={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},dn===null?Ze.memoizedState=dn=r:dn=dn.next=r}return dn}function mu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fo(r){var s=uo;return uo+=1,Ka===null&&(Ka=[]),r=w0(Ka,r,s),s=Ze,(dn===null?s.memoizedState:dn.next)===null&&(s=s.alternate,$.H=s===null||s.memoizedState===null?hv:kh),r}function gu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return fo(r);if(r.$$typeof===N)return jn(r)}throw Error(i(438,String(r)))}function hh(r){var s=null,c=Ze.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var d=Ze.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(m){return m.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=mu(),Ze.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(r),d=0;d<r;d++)c[d]=B;return s.index++,c}function _i(r,s){return typeof s=="function"?s(r):s}function xu(r){var s=on();return ph(s,Tt,r)}function ph(r,s,c){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var m=r.baseQueue,v=d.pending;if(v!==null){if(m!==null){var w=m.next;m.next=v.next,v.next=w}s.baseQueue=m=v,d.pending=null}if(v=r.baseState,m===null)r.memoizedState=v;else{s=m.next;var T=w=null,U=null,te=s,oe=!1;do{var de=te.lane&-536870913;if(de!==te.lane?(ut&de)===de:(yi&de)===de){var re=te.revertLane;if(re===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),de===Va&&(oe=!0);else if((yi&re)===re){te=te.next,re===Va&&(oe=!0);continue}else de={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(T=U=de,w=v):U=U.next=de,Ze.lanes|=re,fs|=re;de=te.action,ea&&c(v,de),v=te.hasEagerState?te.eagerState:c(v,de)}else re={lane:de,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(T=U=re,w=v):U=U.next=re,Ze.lanes|=de,fs|=de;te=te.next}while(te!==null&&te!==s);if(U===null?w=v:U.next=T,!sr(v,r.memoizedState)&&(fn=!0,oe&&(c=Ga,c!==null)))throw c;r.memoizedState=v,r.baseState=w,r.baseQueue=U,d.lastRenderedState=v}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function mh(r){var s=on(),c=s.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var d=c.dispatch,m=c.pending,v=s.memoizedState;if(m!==null){c.pending=null;var w=m=m.next;do v=r(v,w.action),w=w.next;while(w!==m);sr(v,s.memoizedState)||(fn=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),c.lastRenderedState=v}return[v,d]}function L0(r,s,c){var d=Ze,m=on(),v=ft;if(v){if(c===void 0)throw Error(i(407));c=c()}else c=s();var w=!sr((Tt||m).memoizedState,c);if(w&&(m.memoizedState=c,fn=!0),m=m.queue,vh(O0.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||dn!==null&&dn.memoizedState.tag&1){if(d.flags|=2048,Za(9,{destroy:void 0},z0.bind(null,d,m,c,s),null),Lt===null)throw Error(i(349));v||(yi&127)!==0||D0(d,s,c)}return c}function D0(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=Ze.updateQueue,s===null?(s=mu(),Ze.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function z0(r,s,c,d){s.value=c,s.getSnapshot=d,B0(s)&&P0(r)}function O0(r,s,c){return c(function(){B0(s)&&P0(r)})}function B0(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!sr(r,c)}catch{return!0}}function P0(r){var s=Vs(r,2);s!==null&&Zn(s,r,2)}function gh(r){var s=Pn();if(typeof r=="function"){var c=r;if(r=c(),ea){vn(!0);try{c()}finally{vn(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_i,lastRenderedState:r},s}function $0(r,s,c,d){return r.baseState=c,ph(r,Tt,typeof d=="function"?d:_i)}function Ok(r,s,c,d,m){if(yu(r))throw Error(i(485));if(r=s.action,r!==null){var v={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){v.listeners.push(w)}};$.T!==null?c(!0):v.isTransition=!1,d(v),c=s.pending,c===null?(v.next=s.pending=v,F0(s,v)):(v.next=c.next,s.pending=c.next=v)}}function F0(r,s){var c=s.action,d=s.payload,m=r.state;if(s.isTransition){var v=$.T,w={};$.T=w;try{var T=c(m,d),U=$.S;U!==null&&U(w,T),U0(r,s,T)}catch(te){xh(r,s,te)}finally{v!==null&&w.types!==null&&(v.types=w.types),$.T=v}}else try{v=c(m,d),U0(r,s,v)}catch(te){xh(r,s,te)}}function U0(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){I0(r,s,d)},function(d){return xh(r,s,d)}):I0(r,s,c)}function I0(r,s,c){s.status="fulfilled",s.value=c,H0(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,F0(r,c)))}function xh(r,s,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=c,H0(s),s=s.next;while(s!==d)}r.action=null}function H0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function q0(r,s){return s}function V0(r,s){if(ft){var c=Lt.formState;if(c!==null){e:{var d=Ze;if(ft){if(It){t:{for(var m=It,v=Er;m.nodeType!==8;){if(!v){m=null;break t}if(m=Ar(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){It=Ar(m.nextSibling),d=m.data==="F!";break e}}rs(d)}d=!1}d&&(s=c[0])}}return c=Pn(),c.memoizedState=c.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:q0,lastRenderedState:s},c.queue=d,c=uv.bind(null,Ze,d),d.dispatch=c,d=gh(!1),v=Sh.bind(null,Ze,!1,d.queue),d=Pn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,c=Ok.bind(null,Ze,m,v,c),m.dispatch=c,d.memoizedState=r,[s,c,!1]}function G0(r){var s=on();return Y0(s,Tt,r)}function Y0(r,s,c){if(s=ph(r,s,q0)[0],r=xu(_i)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=fo(s)}catch(w){throw w===Ya?lu:w}else d=s;s=on();var m=s.queue,v=m.dispatch;return c!==s.memoizedState&&(Ze.flags|=2048,Za(9,{destroy:void 0},Bk.bind(null,m,c),null)),[d,v,r]}function Bk(r,s){r.action=s}function W0(r){var s=on(),c=Tt;if(c!==null)return Y0(s,c,r);on(),s=s.memoizedState,c=on();var d=c.queue.dispatch;return c.memoizedState=r,[s,d,!1]}function Za(r,s,c,d){return r={tag:r,create:c,deps:d,inst:s,next:null},s=Ze.updateQueue,s===null&&(s=mu(),Ze.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,s.lastEffect=r),r}function Q0(){return on().memoizedState}function vu(r,s,c,d){var m=Pn();Ze.flags|=r,m.memoizedState=Za(1|s,{destroy:void 0},c,d===void 0?null:d)}function bu(r,s,c,d){var m=on();d=d===void 0?null:d;var v=m.memoizedState.inst;Tt!==null&&d!==null&&oh(d,Tt.memoizedState.deps)?m.memoizedState=Za(s,v,c,d):(Ze.flags|=r,m.memoizedState=Za(1|s,v,c,d))}function X0(r,s){vu(8390656,8,r,s)}function vh(r,s){bu(2048,8,r,s)}function Pk(r){Ze.flags|=4;var s=Ze.updateQueue;if(s===null)s=mu(),Ze.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function K0(r){var s=on().memoizedState;return Pk({ref:s,nextImpl:r}),function(){if((wt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function Z0(r,s){return bu(4,2,r,s)}function J0(r,s){return bu(4,4,r,s)}function ev(r,s){if(typeof s=="function"){r=r();var c=s(r);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function tv(r,s,c){c=c!=null?c.concat([r]):null,bu(4,4,ev.bind(null,s,r),c)}function bh(){}function nv(r,s){var c=on();s=s===void 0?null:s;var d=c.memoizedState;return s!==null&&oh(s,d[1])?d[0]:(c.memoizedState=[r,s],r)}function rv(r,s){var c=on();s=s===void 0?null:s;var d=c.memoizedState;if(s!==null&&oh(s,d[1]))return d[0];if(d=r(),ea){vn(!0);try{r()}finally{vn(!1)}}return c.memoizedState=[d,s],d}function yh(r,s,c){return c===void 0||(yi&1073741824)!==0&&(ut&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=i1(),Ze.lanes|=r,fs|=r,c)}function iv(r,s,c,d){return sr(c,s)?c:Qa.current!==null?(r=yh(r,c,d),sr(r,s)||(fn=!0),r):(yi&42)===0||(yi&1073741824)!==0&&(ut&261930)===0?(fn=!0,r.memoizedState=c):(r=i1(),Ze.lanes|=r,fs|=r,s)}function sv(r,s,c,d,m){var v=F.p;F.p=v!==0&&8>v?v:8;var w=$.T,T={};$.T=T,Sh(r,!1,s,c);try{var U=m(),te=$.S;if(te!==null&&te(T,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var oe=Lk(U,d);ho(r,s,oe,dr(r))}else ho(r,s,d,dr(r))}catch(de){ho(r,s,{then:function(){},status:"rejected",reason:de},dr())}finally{F.p=v,w!==null&&T.types!==null&&(w.types=T.types),$.T=w}}function $k(){}function _h(r,s,c,d){if(r.tag!==5)throw Error(i(476));var m=av(r).queue;sv(r,m,s,V,c===null?$k:function(){return lv(r),c(d)})}function av(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_i,lastRenderedState:V},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_i,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function lv(r){var s=av(r);s.next===null&&(s=r.alternate.memoizedState),ho(r,s.next.queue,{},dr())}function wh(){return jn(Ao)}function ov(){return on().memoizedState}function cv(){return on().memoizedState}function Fk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=dr();r=as(c);var d=ls(s,r,c);d!==null&&(Zn(d,s,c),lo(d,s,c)),s={cache:Kf()},r.payload=s;return}s=s.return}}function Uk(r,s,c){var d=dr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},yu(r)?dv(s,c):(c=Ff(r,s,c,d),c!==null&&(Zn(c,r,d),fv(c,s,d)))}function uv(r,s,c){var d=dr();ho(r,s,c,d)}function ho(r,s,c,d){var m={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(yu(r))dv(s,m);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var w=s.lastRenderedState,T=v(w,c);if(m.hasEagerState=!0,m.eagerState=T,sr(T,w))return eu(r,s,m,0),Lt===null&&Jc(),!1}catch{}finally{}if(c=Ff(r,s,m,d),c!==null)return Zn(c,r,d),fv(c,s,d),!0}return!1}function Sh(r,s,c,d){if(d={lane:2,revertLane:tp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},yu(r)){if(s)throw Error(i(479))}else s=Ff(r,c,d,2),s!==null&&Zn(s,r,2)}function yu(r){var s=r.alternate;return r===Ze||s!==null&&s===Ze}function dv(r,s){Xa=hu=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function fv(r,s,c){if((c&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,ja(r,c)}}var po={readContext:jn,use:gu,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useLayoutEffect:nn,useInsertionEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useSyncExternalStore:nn,useId:nn,useHostTransitionStatus:nn,useFormState:nn,useActionState:nn,useOptimistic:nn,useMemoCache:nn,useCacheRefresh:nn};po.useEffectEvent=nn;var hv={readContext:jn,use:gu,useCallback:function(r,s){return Pn().memoizedState=[r,s===void 0?null:s],r},useContext:jn,useEffect:X0,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,vu(4194308,4,ev.bind(null,s,r),c)},useLayoutEffect:function(r,s){return vu(4194308,4,r,s)},useInsertionEffect:function(r,s){vu(4,2,r,s)},useMemo:function(r,s){var c=Pn();s=s===void 0?null:s;var d=r();if(ea){vn(!0);try{r()}finally{vn(!1)}}return c.memoizedState=[d,s],d},useReducer:function(r,s,c){var d=Pn();if(c!==void 0){var m=c(s);if(ea){vn(!0);try{c(s)}finally{vn(!1)}}}else m=s;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=Uk.bind(null,Ze,r),[d.memoizedState,r]},useRef:function(r){var s=Pn();return r={current:r},s.memoizedState=r},useState:function(r){r=gh(r);var s=r.queue,c=uv.bind(null,Ze,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:bh,useDeferredValue:function(r,s){var c=Pn();return yh(c,r,s)},useTransition:function(){var r=gh(!1);return r=sv.bind(null,Ze,r.queue,!0,!1),Pn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var d=Ze,m=Pn();if(ft){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),Lt===null)throw Error(i(349));(ut&127)!==0||D0(d,s,c)}m.memoizedState=c;var v={value:c,getSnapshot:s};return m.queue=v,X0(O0.bind(null,d,v,r),[r]),d.flags|=2048,Za(9,{destroy:void 0},z0.bind(null,d,v,c,s),null),c},useId:function(){var r=Pn(),s=Lt.identifierPrefix;if(ft){var c=ri,d=ni;c=(d&~(1<<32-et(d)-1)).toString(32)+c,s="_"+s+"R_"+c,c=pu++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=Dk++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:wh,useFormState:V0,useActionState:V0,useOptimistic:function(r){var s=Pn();s.memoizedState=s.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=Sh.bind(null,Ze,!0,c),c.dispatch=s,[r,s]},useMemoCache:hh,useCacheRefresh:function(){return Pn().memoizedState=Fk.bind(null,Ze)},useEffectEvent:function(r){var s=Pn(),c={impl:r};return s.memoizedState=c,function(){if((wt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},kh={readContext:jn,use:gu,useCallback:nv,useContext:jn,useEffect:vh,useImperativeHandle:tv,useInsertionEffect:Z0,useLayoutEffect:J0,useMemo:rv,useReducer:xu,useRef:Q0,useState:function(){return xu(_i)},useDebugValue:bh,useDeferredValue:function(r,s){var c=on();return iv(c,Tt.memoizedState,r,s)},useTransition:function(){var r=xu(_i)[0],s=on().memoizedState;return[typeof r=="boolean"?r:fo(r),s]},useSyncExternalStore:L0,useId:ov,useHostTransitionStatus:wh,useFormState:G0,useActionState:G0,useOptimistic:function(r,s){var c=on();return $0(c,Tt,r,s)},useMemoCache:hh,useCacheRefresh:cv};kh.useEffectEvent=K0;var pv={readContext:jn,use:gu,useCallback:nv,useContext:jn,useEffect:vh,useImperativeHandle:tv,useInsertionEffect:Z0,useLayoutEffect:J0,useMemo:rv,useReducer:mh,useRef:Q0,useState:function(){return mh(_i)},useDebugValue:bh,useDeferredValue:function(r,s){var c=on();return Tt===null?yh(c,r,s):iv(c,Tt.memoizedState,r,s)},useTransition:function(){var r=mh(_i)[0],s=on().memoizedState;return[typeof r=="boolean"?r:fo(r),s]},useSyncExternalStore:L0,useId:ov,useHostTransitionStatus:wh,useFormState:W0,useActionState:W0,useOptimistic:function(r,s){var c=on();return Tt!==null?$0(c,Tt,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:hh,useCacheRefresh:cv};pv.useEffectEvent=K0;function jh(r,s,c,d){s=r.memoizedState,c=c(d,s),c=c==null?s:x({},s,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Nh={enqueueSetState:function(r,s,c){r=r._reactInternals;var d=dr(),m=as(d);m.payload=s,c!=null&&(m.callback=c),s=ls(r,m,d),s!==null&&(Zn(s,r,d),lo(s,r,d))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var d=dr(),m=as(d);m.tag=1,m.payload=s,c!=null&&(m.callback=c),s=ls(r,m,d),s!==null&&(Zn(s,r,d),lo(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=dr(),d=as(c);d.tag=2,s!=null&&(d.callback=s),s=ls(r,d,c),s!==null&&(Zn(s,r,c),lo(s,r,c))}};function mv(r,s,c,d,m,v,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,w):s.prototype&&s.prototype.isPureReactComponent?!Jl(c,d)||!Jl(m,v):!0}function gv(r,s,c,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,d),s.state!==r&&Nh.enqueueReplaceState(s,s.state,null)}function ta(r,s){var c=s;if("ref"in s){c={};for(var d in s)d!=="ref"&&(c[d]=s[d])}if(r=r.defaultProps){c===s&&(c=x({},c));for(var m in r)c[m]===void 0&&(c[m]=r[m])}return c}function xv(r){Zc(r)}function vv(r){console.error(r)}function bv(r){Zc(r)}function _u(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function yv(r,s,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Ch(r,s,c){return c=as(c),c.tag=3,c.payload={element:null},c.callback=function(){_u(r,s)},c}function _v(r){return r=as(r),r.tag=3,r}function wv(r,s,c,d){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var v=d.value;r.payload=function(){return m(v)},r.callback=function(){yv(s,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){yv(s,c,d),typeof m!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function Ik(r,s,c,d,m){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=c.alternate,s!==null&&qa(s,c,m,!0),c=lr.current,c!==null){switch(c.tag){case 31:case 13:return Tr===null?Lu():c.alternate===null&&rn===0&&(rn=3),c.flags&=-257,c.flags|=65536,c.lanes=m,d===ou?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([d]):s.add(d),Zh(r,d,m)),!1;case 22:return c.flags|=65536,d===ou?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([d]):c.add(d)),Zh(r,d,m)),!1}throw Error(i(435,c.tag))}return Zh(r,d,m),Lu(),!1}if(ft)return s=lr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==Gf&&(r=Error(i(422),{cause:d}),no(jr(r,c)))):(d!==Gf&&(s=Error(i(423),{cause:d}),no(jr(s,c))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=jr(d,c),m=Ch(r.stateNode,d,m),rh(r,m),rn!==4&&(rn=2)),!1;var v=Error(i(520),{cause:d});if(v=jr(v,c),wo===null?wo=[v]:wo.push(v),rn!==4&&(rn=2),s===null)return!0;d=jr(d,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=m&-m,c.lanes|=r,r=Ch(c.stateNode,d,r),rh(c,r),!1;case 1:if(s=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(hs===null||!hs.has(v))))return c.flags|=65536,m&=-m,c.lanes|=m,m=_v(m),wv(m,r,c,d),rh(c,m),!1}c=c.return}while(c!==null);return!1}var Eh=Error(i(461)),fn=!1;function Nn(r,s,c,d){s.child=r===null?N0(s,null,c,d):Js(s,r.child,c,d)}function Sv(r,s,c,d,m){c=c.render;var v=s.ref;if("ref"in d){var w={};for(var T in d)T!=="ref"&&(w[T]=d[T])}else w=d;return Qs(s),d=ch(r,s,c,w,v,m),T=uh(),r!==null&&!fn?(dh(r,s,m),wi(r,s,m)):(ft&&T&&qf(s),s.flags|=1,Nn(r,s,d,m),s.child)}function kv(r,s,c,d,m){if(r===null){var v=c.type;return typeof v=="function"&&!Uf(v)&&v.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=v,jv(r,s,v,d,m)):(r=nu(c.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(v=r.child,!Oh(r,m)){var w=v.memoizedProps;if(c=c.compare,c=c!==null?c:Jl,c(w,d)&&r.ref===s.ref)return wi(r,s,m)}return s.flags|=1,r=gi(v,d),r.ref=s.ref,r.return=s,s.child=r}function jv(r,s,c,d,m){if(r!==null){var v=r.memoizedProps;if(Jl(v,d)&&r.ref===s.ref)if(fn=!1,s.pendingProps=d=v,Oh(r,m))(r.flags&131072)!==0&&(fn=!0);else return s.lanes=r.lanes,wi(r,s,m)}return Th(r,s,c,d,m)}function Nv(r,s,c,d){var m=d.children,v=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~v}else d=0,s.child=null;return Cv(r,s,v,c,d)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&au(s,v!==null?v.cachePool:null),v!==null?T0(s,v):sh(),A0(s);else return d=s.lanes=536870912,Cv(r,s,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(au(s,v.cachePool),T0(s,v),cs(),s.memoizedState=null):(r!==null&&au(s,null),sh(),cs());return Nn(r,s,m,c),s.child}function mo(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Cv(r,s,c,d,m){var v=Jf();return v=v===null?null:{parent:un._currentValue,pool:v},s.memoizedState={baseLanes:c,cachePool:v},r!==null&&au(s,null),sh(),A0(s),r!==null&&qa(r,s,d,!0),s.childLanes=m,null}function wu(r,s){return s=ku({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function Ev(r,s,c){return Js(s,r.child,null,c),r=wu(s,s.pendingProps),r.flags|=2,or(s),s.memoizedState=null,r}function Hk(r,s,c){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ft){if(d.mode==="hidden")return r=wu(s,d),s.lanes=536870912,mo(null,r);if(lh(s),(r=It)?(r=F1(r,Er),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ts!==null?{id:ni,overflow:ri}:null,retryLane:536870912,hydrationErrors:null},c=d0(r),c.return=s,s.child=c,kn=s,It=null)):r=null,r===null)throw rs(s);return s.lanes=536870912,null}return wu(s,d)}var v=r.memoizedState;if(v!==null){var w=v.dehydrated;if(lh(s),m)if(s.flags&256)s.flags&=-257,s=Ev(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(fn||qa(r,s,c,!1),m=(c&r.childLanes)!==0,fn||m){if(d=Lt,d!==null&&(w=$l(d,c),w!==0&&w!==v.retryLane))throw v.retryLane=w,Vs(r,w),Zn(d,r,w),Eh;Lu(),s=Ev(r,s,c)}else r=v.treeContext,It=Ar(w.nextSibling),kn=s,ft=!0,ns=null,Er=!1,r!==null&&p0(s,r),s=wu(s,d),s.flags|=4096;return s}return r=gi(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function Su(r,s){var c=s.ref;if(c===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(s.flags|=4194816)}}function Th(r,s,c,d,m){return Qs(s),c=ch(r,s,c,d,void 0,m),d=uh(),r!==null&&!fn?(dh(r,s,m),wi(r,s,m)):(ft&&d&&qf(s),s.flags|=1,Nn(r,s,c,m),s.child)}function Tv(r,s,c,d,m,v){return Qs(s),s.updateQueue=null,c=R0(s,d,c,m),M0(r),d=uh(),r!==null&&!fn?(dh(r,s,v),wi(r,s,v)):(ft&&d&&qf(s),s.flags|=1,Nn(r,s,c,v),s.child)}function Av(r,s,c,d,m){if(Qs(s),s.stateNode===null){var v=Fa,w=c.contextType;typeof w=="object"&&w!==null&&(v=jn(w)),v=new c(d,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Nh,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=d,v.state=s.memoizedState,v.refs={},th(s),w=c.contextType,v.context=typeof w=="object"&&w!==null?jn(w):Fa,v.state=s.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(jh(s,c,w,d),v.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(w=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),w!==v.state&&Nh.enqueueReplaceState(v,v.state,null),co(s,d,v,m),oo(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){v=s.stateNode;var T=s.memoizedProps,U=ta(c,T);v.props=U;var te=v.context,oe=c.contextType;w=Fa,typeof oe=="object"&&oe!==null&&(w=jn(oe));var de=c.getDerivedStateFromProps;oe=typeof de=="function"||typeof v.getSnapshotBeforeUpdate=="function",T=s.pendingProps!==T,oe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T||te!==w)&&gv(s,v,d,w),ss=!1;var re=s.memoizedState;v.state=re,co(s,d,v,m),oo(),te=s.memoizedState,T||re!==te||ss?(typeof de=="function"&&(jh(s,c,de,d),te=s.memoizedState),(U=ss||mv(s,c,U,d,re,te,w))?(oe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=te),v.props=d,v.state=te,v.context=w,d=U):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{v=s.stateNode,nh(r,s),w=s.memoizedProps,oe=ta(c,w),v.props=oe,de=s.pendingProps,re=v.context,te=c.contextType,U=Fa,typeof te=="object"&&te!==null&&(U=jn(te)),T=c.getDerivedStateFromProps,(te=typeof T=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(w!==de||re!==U)&&gv(s,v,d,U),ss=!1,re=s.memoizedState,v.state=re,co(s,d,v,m),oo();var se=s.memoizedState;w!==de||re!==se||ss||r!==null&&r.dependencies!==null&&iu(r.dependencies)?(typeof T=="function"&&(jh(s,c,T,d),se=s.memoizedState),(oe=ss||mv(s,c,oe,d,re,se,U)||r!==null&&r.dependencies!==null&&iu(r.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,se,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,se,U)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=se),v.props=d,v.state=se,v.context=U,d=oe):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=1024),d=!1)}return v=d,Su(r,s),d=(s.flags&128)!==0,v||d?(v=s.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,r!==null&&d?(s.child=Js(s,r.child,null,m),s.child=Js(s,null,c,m)):Nn(r,s,c,m),s.memoizedState=v.state,r=s.child):r=wi(r,s,m),r}function Mv(r,s,c,d){return Ys(),s.flags|=256,Nn(r,s,c,d),s.child}var Ah={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mh(r){return{baseLanes:r,cachePool:y0()}}function Rh(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=ur),r}function Rv(r,s,c){var d=s.pendingProps,m=!1,v=(s.flags&128)!==0,w;if((w=v)||(w=r!==null&&r.memoizedState===null?!1:(ln.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ft){if(m?os(s):cs(),(r=It)?(r=F1(r,Er),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ts!==null?{id:ni,overflow:ri}:null,retryLane:536870912,hydrationErrors:null},c=d0(r),c.return=s,s.child=c,kn=s,It=null)):r=null,r===null)throw rs(s);return pp(r)?s.lanes=32:s.lanes=536870912,null}var T=d.children;return d=d.fallback,m?(cs(),m=s.mode,T=ku({mode:"hidden",children:T},m),d=Gs(d,m,c,null),T.return=s,d.return=s,T.sibling=d,s.child=T,d=s.child,d.memoizedState=Mh(c),d.childLanes=Rh(r,w,c),s.memoizedState=Ah,mo(null,d)):(os(s),Lh(s,T))}var U=r.memoizedState;if(U!==null&&(T=U.dehydrated,T!==null)){if(v)s.flags&256?(os(s),s.flags&=-257,s=Dh(r,s,c)):s.memoizedState!==null?(cs(),s.child=r.child,s.flags|=128,s=null):(cs(),T=d.fallback,m=s.mode,d=ku({mode:"visible",children:d.children},m),T=Gs(T,m,c,null),T.flags|=2,d.return=s,T.return=s,d.sibling=T,s.child=d,Js(s,r.child,null,c),d=s.child,d.memoizedState=Mh(c),d.childLanes=Rh(r,w,c),s.memoizedState=Ah,s=mo(null,d));else if(os(s),pp(T)){if(w=T.nextSibling&&T.nextSibling.dataset,w)var te=w.dgst;w=te,d=Error(i(419)),d.stack="",d.digest=w,no({value:d,source:null,stack:null}),s=Dh(r,s,c)}else if(fn||qa(r,s,c,!1),w=(c&r.childLanes)!==0,fn||w){if(w=Lt,w!==null&&(d=$l(w,c),d!==0&&d!==U.retryLane))throw U.retryLane=d,Vs(r,d),Zn(w,r,d),Eh;hp(T)||Lu(),s=Dh(r,s,c)}else hp(T)?(s.flags|=192,s.child=r.child,s=null):(r=U.treeContext,It=Ar(T.nextSibling),kn=s,ft=!0,ns=null,Er=!1,r!==null&&p0(s,r),s=Lh(s,d.children),s.flags|=4096);return s}return m?(cs(),T=d.fallback,m=s.mode,U=r.child,te=U.sibling,d=gi(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,te!==null?T=gi(te,T):(T=Gs(T,m,c,null),T.flags|=2),T.return=s,d.return=s,d.sibling=T,s.child=d,mo(null,d),d=s.child,T=r.child.memoizedState,T===null?T=Mh(c):(m=T.cachePool,m!==null?(U=un._currentValue,m=m.parent!==U?{parent:U,pool:U}:m):m=y0(),T={baseLanes:T.baseLanes|c,cachePool:m}),d.memoizedState=T,d.childLanes=Rh(r,w,c),s.memoizedState=Ah,mo(r.child,d)):(os(s),c=r.child,r=c.sibling,c=gi(c,{mode:"visible",children:d.children}),c.return=s,c.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=c,s.memoizedState=null,c)}function Lh(r,s){return s=ku({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function ku(r,s){return r=ar(22,r,null,s),r.lanes=0,r}function Dh(r,s,c){return Js(s,r.child,null,c),r=Lh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function Lv(r,s,c){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),Qf(r.return,s,c)}function zh(r,s,c,d,m,v){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:m,treeForkCount:v}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=m,w.treeForkCount=v)}function Dv(r,s,c){var d=s.pendingProps,m=d.revealOrder,v=d.tail;d=d.children;var w=ln.current,T=(w&2)!==0;if(T?(w=w&1|2,s.flags|=128):w&=1,A(ln,w),Nn(r,s,d,c),d=ft?to:0,!T&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Lv(r,c,s);else if(r.tag===19)Lv(r,c,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(c=s.child,m=null;c!==null;)r=c.alternate,r!==null&&fu(r)===null&&(m=c),c=c.sibling;c=m,c===null?(m=s.child,s.child=null):(m=c.sibling,c.sibling=null),zh(s,!1,m,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&fu(r)===null){s.child=m;break}r=m.sibling,m.sibling=c,c=m,m=r}zh(s,!0,c,null,v,d);break;case"together":zh(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function wi(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),fs|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(qa(r,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,c=gi(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=gi(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function Oh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&iu(r)))}function qk(r,s,c){switch(s.tag){case 3:Le(s,s.stateNode.containerInfo),is(s,un,r.memoizedState.cache),Ys();break;case 27:case 5:Je(s);break;case 4:Le(s,s.stateNode.containerInfo);break;case 10:is(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,lh(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(os(s),s.flags|=128,null):(c&s.child.childLanes)!==0?Rv(r,s,c):(os(s),r=wi(r,s,c),r!==null?r.sibling:null);os(s);break;case 19:var m=(r.flags&128)!==0;if(d=(c&s.childLanes)!==0,d||(qa(r,s,c,!1),d=(c&s.childLanes)!==0),m){if(d)return Dv(r,s,c);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),A(ln,ln.current),d)break;return null;case 22:return s.lanes=0,Nv(r,s,c,s.pendingProps);case 24:is(s,un,r.memoizedState.cache)}return wi(r,s,c)}function zv(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)fn=!0;else{if(!Oh(r,c)&&(s.flags&128)===0)return fn=!1,qk(r,s,c);fn=(r.flags&131072)!==0}else fn=!1,ft&&(s.flags&1048576)!==0&&h0(s,to,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Ks(s.elementType),s.type=r,typeof r=="function")Uf(r)?(d=ta(r,d),s.tag=1,s=Av(null,s,r,d,c)):(s.tag=0,s=Th(null,s,r,d,c));else{if(r!=null){var m=r.$$typeof;if(m===D){s.tag=11,s=Sv(null,s,r,d,c);break e}else if(m===G){s.tag=14,s=kv(null,s,r,d,c);break e}}throw s=J(r)||r,Error(i(306,s,""))}}return s;case 0:return Th(r,s,s.type,s.pendingProps,c);case 1:return d=s.type,m=ta(d,s.pendingProps),Av(r,s,d,m,c);case 3:e:{if(Le(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var v=s.memoizedState;m=v.element,nh(r,s),co(s,d,null,c);var w=s.memoizedState;if(d=w.cache,is(s,un,d),d!==v.cache&&Xf(s,[un],c,!0),oo(),d=w.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=Mv(r,s,d,c);break e}else if(d!==m){m=jr(Error(i(424)),s),no(m),s=Mv(r,s,d,c);break e}else{switch(r=s.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(It=Ar(r.firstChild),kn=s,ft=!0,ns=null,Er=!0,c=N0(s,null,d,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ys(),d===m){s=wi(r,s,c);break e}Nn(r,s,d,c)}s=s.child}return s;case 26:return Su(r,s),r===null?(c=G1(s.type,null,s.pendingProps,null))?s.memoizedState=c:ft||(c=s.type,r=s.pendingProps,d=Fu(je.current).createElement(c),d[Qt]=s,d[Sn]=r,Cn(d,c,r),en(d),s.stateNode=d):s.memoizedState=G1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return Je(s),r===null&&ft&&(d=s.stateNode=H1(s.type,s.pendingProps,je.current),kn=s,Er=!0,m=It,xs(s.type)?(mp=m,It=Ar(d.firstChild)):It=m),Nn(r,s,s.pendingProps.children,c),Su(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ft&&((m=d=It)&&(d=yj(d,s.type,s.pendingProps,Er),d!==null?(s.stateNode=d,kn=s,It=Ar(d.firstChild),Er=!1,m=!0):m=!1),m||rs(s)),Je(s),m=s.type,v=s.pendingProps,w=r!==null?r.memoizedProps:null,d=v.children,up(m,v)?d=null:w!==null&&up(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=ch(r,s,zk,null,null,c),Ao._currentValue=m),Su(r,s),Nn(r,s,d,c),s.child;case 6:return r===null&&ft&&((r=c=It)&&(c=_j(c,s.pendingProps,Er),c!==null?(s.stateNode=c,kn=s,It=null,r=!0):r=!1),r||rs(s)),null;case 13:return Rv(r,s,c);case 4:return Le(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Js(s,null,d,c):Nn(r,s,d,c),s.child;case 11:return Sv(r,s,s.type,s.pendingProps,c);case 7:return Nn(r,s,s.pendingProps,c),s.child;case 8:return Nn(r,s,s.pendingProps.children,c),s.child;case 12:return Nn(r,s,s.pendingProps.children,c),s.child;case 10:return d=s.pendingProps,is(s,s.type,d.value),Nn(r,s,d.children,c),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Qs(s),m=jn(m),d=d(m),s.flags|=1,Nn(r,s,d,c),s.child;case 14:return kv(r,s,s.type,s.pendingProps,c);case 15:return jv(r,s,s.type,s.pendingProps,c);case 19:return Dv(r,s,c);case 31:return Hk(r,s,c);case 22:return Nv(r,s,c,s.pendingProps);case 24:return Qs(s),d=jn(un),r===null?(m=Jf(),m===null&&(m=Lt,v=Kf(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=c),m=v),s.memoizedState={parent:d,cache:m},th(s),is(s,un,m)):((r.lanes&c)!==0&&(nh(r,s),co(s,null,null,c),oo()),m=r.memoizedState,v=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),is(s,un,d)):(d=v.cache,is(s,un,d),d!==m.cache&&Xf(s,[un],c,!0))),Nn(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function Si(r){r.flags|=4}function Bh(r,s,c,d,m){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(o1())r.flags|=8192;else throw Zs=ou,eh}else r.flags&=-16777217}function Ov(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!K1(s))if(o1())r.flags|=8192;else throw Zs=ou,eh}function ju(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?cn():536870912,r.lanes|=s,nl|=s)}function go(r,s){if(!ft)switch(r.tailMode){case"hidden":s=r.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ht(r){var s=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(s)for(var m=r.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=c,s}function Vk(r,s,c){var d=s.pendingProps;switch(Vf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(s),null;case 1:return Ht(s),null;case 3:return c=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),bi(un),Be(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Ha(s)?Si(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Yf())),Ht(s),null;case 26:var m=s.type,v=s.memoizedState;return r===null?(Si(s),v!==null?(Ht(s),Ov(s,v)):(Ht(s),Bh(s,m,null,d,c))):v?v!==r.memoizedState?(Si(s),Ht(s),Ov(s,v)):(Ht(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&Si(s),Ht(s),Bh(s,m,r,d,c)),null;case 27:if(it(s),c=je.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&Si(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ht(s),null}r=ue.current,Ha(s)?m0(s):(r=H1(m,d,c),s.stateNode=r,Si(s))}return Ht(s),null;case 5:if(it(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&Si(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ht(s),null}if(v=ue.current,Ha(s))m0(s);else{var w=Fu(je.current);switch(v){case 1:v=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=w.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}v[Qt]=s,v[Sn]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)v.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=v;e:switch(Cn(v,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Si(s)}}return Ht(s),Bh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&Si(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=je.current,Ha(s)){if(r=s.stateNode,c=s.memoizedProps,d=null,m=kn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Qt]=s,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||R1(r.nodeValue,c)),r||rs(s,!0)}else r=Fu(r).createTextNode(d),r[Qt]=s,s.stateNode=r}return Ht(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(d=Ha(s),c!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Qt]=s}else Ys(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ht(s),r=!1}else c=Yf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(or(s),s):(or(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Ht(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ha(s),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Qt]=s}else Ys(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ht(s),m=!1}else m=Yf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(or(s),s):(or(s),null)}return or(s),(s.flags&128)!==0?(s.lanes=c,s):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==m&&(d.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),ju(s,s.updateQueue),Ht(s),null);case 4:return Be(),r===null&&sp(s.stateNode.containerInfo),Ht(s),null;case 10:return bi(s.type),Ht(s),null;case 19:if(Z(ln),d=s.memoizedState,d===null)return Ht(s),null;if(m=(s.flags&128)!==0,v=d.rendering,v===null)if(m)go(d,!1);else{if(rn!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(v=fu(r),v!==null){for(s.flags|=128,go(d,!1),r=v.updateQueue,s.updateQueue=r,ju(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)u0(c,r),c=c.sibling;return A(ln,ln.current&1|2),ft&&xi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&Ee()>Au&&(s.flags|=128,m=!0,go(d,!1),s.lanes=4194304)}else{if(!m)if(r=fu(v),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,ju(s,r),go(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ft)return Ht(s),null}else 2*Ee()-d.renderingStartTime>Au&&c!==536870912&&(s.flags|=128,m=!0,go(d,!1),s.lanes=4194304);d.isBackwards?(v.sibling=s.child,s.child=v):(r=d.last,r!==null?r.sibling=v:s.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Ee(),r.sibling=null,c=ln.current,A(ln,m?c&1|2:c&1),ft&&xi(s,d.treeForkCount),r):(Ht(s),null);case 22:case 23:return or(s),ah(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(c&536870912)!==0&&(s.flags&128)===0&&(Ht(s),s.subtreeFlags&6&&(s.flags|=8192)):Ht(s),c=s.updateQueue,c!==null&&ju(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048),r!==null&&Z(Xs),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),bi(un),Ht(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Gk(r,s){switch(Vf(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return bi(un),Be(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return it(s),null;case 31:if(s.memoizedState!==null){if(or(s),s.alternate===null)throw Error(i(340));Ys()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(or(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ys()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Z(ln),null;case 4:return Be(),null;case 10:return bi(s.type),null;case 22:case 23:return or(s),ah(),r!==null&&Z(Xs),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return bi(un),null;case 25:return null;default:return null}}function Bv(r,s){switch(Vf(s),s.tag){case 3:bi(un),Be();break;case 26:case 27:case 5:it(s);break;case 4:Be();break;case 31:s.memoizedState!==null&&or(s);break;case 13:or(s);break;case 19:Z(ln);break;case 10:bi(s.type);break;case 22:case 23:or(s),ah(),r!==null&&Z(Xs);break;case 24:bi(un)}}function xo(r,s){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&r)===r){d=void 0;var v=c.create,w=c.inst;d=v(),w.destroy=d}c=c.next}while(c!==m)}}catch(T){Et(s,s.return,T)}}function us(r,s,c){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var v=m.next;d=v;do{if((d.tag&r)===r){var w=d.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,m=s;var U=c,te=T;try{te()}catch(oe){Et(m,U,oe)}}}d=d.next}while(d!==v)}}catch(oe){Et(s,s.return,oe)}}function Pv(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{E0(s,c)}catch(d){Et(r,r.return,d)}}}function $v(r,s,c){c.props=ta(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){Et(r,s,d)}}function vo(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof c=="function"?r.refCleanup=c(d):c.current=d}}catch(m){Et(r,s,m)}}function ii(r,s){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(m){Et(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Et(r,s,m)}else c.current=null}function Fv(r){var s=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(m){Et(r,r.return,m)}}function Ph(r,s,c){try{var d=r.stateNode;pj(d,r.type,c,s),d[Sn]=s}catch(m){Et(r,r.return,m)}}function Uv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&xs(r.type)||r.tag===4}function $h(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Uv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&xs(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Fh(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(r),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=_r));else if(d!==4&&(d===27&&xs(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(Fh(r,s,c),r=r.sibling;r!==null;)Fh(r,s,c),r=r.sibling}function Nu(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?c.insertBefore(r,s):c.appendChild(r);else if(d!==4&&(d===27&&xs(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Nu(r,s,c),r=r.sibling;r!==null;)Nu(r,s,c),r=r.sibling}function Iv(r){var s=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);Cn(s,d,c),s[Qt]=r,s[Sn]=c}catch(v){Et(r,r.return,v)}}var ki=!1,hn=!1,Uh=!1,Hv=typeof WeakSet=="function"?WeakSet:Set,wn=null;function Yk(r,s){if(r=r.containerInfo,op=Yu,r=t0(r),Df(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var m=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var w=0,T=-1,U=-1,te=0,oe=0,de=r,re=null;t:for(;;){for(var se;de!==c||m!==0&&de.nodeType!==3||(T=w+m),de!==v||d!==0&&de.nodeType!==3||(U=w+d),de.nodeType===3&&(w+=de.nodeValue.length),(se=de.firstChild)!==null;)re=de,de=se;for(;;){if(de===r)break t;if(re===c&&++te===m&&(T=w),re===v&&++oe===d&&(U=w),(se=de.nextSibling)!==null)break;de=re,re=de.parentNode}de=se}c=T===-1||U===-1?null:{start:T,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(cp={focusedElem:r,selectionRange:c},Yu=!1,wn=s;wn!==null;)if(s=wn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,wn=r;else for(;wn!==null;){switch(s=wn,v=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)m=r[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=s,m=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Te=ta(c.type,m);r=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){Et(c,c.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)fp(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":fp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,wn=r;break}wn=s.return}}function qv(r,s,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Ni(r,c),d&4&&xo(5,c);break;case 1:if(Ni(r,c),d&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(w){Et(c,c.return,w)}else{var m=ta(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(c,c.return,w)}}d&64&&Pv(c),d&512&&vo(c,c.return);break;case 3:if(Ni(r,c),d&64&&(r=c.updateQueue,r!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{E0(r,s)}catch(w){Et(c,c.return,w)}}break;case 27:s===null&&d&4&&Iv(c);case 26:case 5:Ni(r,c),s===null&&d&4&&Fv(c),d&512&&vo(c,c.return);break;case 12:Ni(r,c);break;case 31:Ni(r,c),d&4&&Yv(r,c);break;case 13:Ni(r,c),d&4&&Wv(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=nj.bind(null,c),wj(r,c))));break;case 22:if(d=c.memoizedState!==null||ki,!d){s=s!==null&&s.memoizedState!==null||hn,m=ki;var v=hn;ki=d,(hn=s)&&!v?Ci(r,c,(c.subtreeFlags&8772)!==0):Ni(r,c),ki=m,hn=v}break;case 30:break;default:Ni(r,c)}}function Vv(r){var s=r.alternate;s!==null&&(r.alternate=null,Vv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Yi(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Xt=null,Wn=!1;function ji(r,s,c){for(c=c.child;c!==null;)Gv(r,s,c),c=c.sibling}function Gv(r,s,c){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(rt,c)}catch{}switch(c.tag){case 26:hn||ii(c,s),ji(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:hn||ii(c,s);var d=Xt,m=Wn;xs(c.type)&&(Xt=c.stateNode,Wn=!1),ji(r,s,c),Co(c.stateNode),Xt=d,Wn=m;break;case 5:hn||ii(c,s);case 6:if(d=Xt,m=Wn,Xt=null,ji(r,s,c),Xt=d,Wn=m,Xt!==null)if(Wn)try{(Xt.nodeType===9?Xt.body:Xt.nodeName==="HTML"?Xt.ownerDocument.body:Xt).removeChild(c.stateNode)}catch(v){Et(c,s,v)}else try{Xt.removeChild(c.stateNode)}catch(v){Et(c,s,v)}break;case 18:Xt!==null&&(Wn?(r=Xt,P1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),ul(r)):P1(Xt,c.stateNode));break;case 4:d=Xt,m=Wn,Xt=c.stateNode.containerInfo,Wn=!0,ji(r,s,c),Xt=d,Wn=m;break;case 0:case 11:case 14:case 15:us(2,c,s),hn||us(4,c,s),ji(r,s,c);break;case 1:hn||(ii(c,s),d=c.stateNode,typeof d.componentWillUnmount=="function"&&$v(c,s,d)),ji(r,s,c);break;case 21:ji(r,s,c);break;case 22:hn=(d=hn)||c.memoizedState!==null,ji(r,s,c),hn=d;break;default:ji(r,s,c)}}function Yv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ul(r)}catch(c){Et(s,s.return,c)}}}function Wv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ul(r)}catch(c){Et(s,s.return,c)}}function Wk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Hv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Hv),s;default:throw Error(i(435,r.tag))}}function Cu(r,s){var c=Wk(r);s.forEach(function(d){if(!c.has(d)){c.add(d);var m=rj.bind(null,r,d);d.then(m,m)}})}function Qn(r,s){var c=s.deletions;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d],v=r,w=s,T=w;e:for(;T!==null;){switch(T.tag){case 27:if(xs(T.type)){Xt=T.stateNode,Wn=!1;break e}break;case 5:Xt=T.stateNode,Wn=!1;break e;case 3:case 4:Xt=T.stateNode.containerInfo,Wn=!0;break e}T=T.return}if(Xt===null)throw Error(i(160));Gv(v,w,m),Xt=null,Wn=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Qv(s,r),s=s.sibling}var Vr=null;function Qv(r,s){var c=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Qn(s,r),Xn(r),d&4&&(us(3,r,r.return),xo(3,r),us(5,r,r.return));break;case 1:Qn(s,r),Xn(r),d&512&&(hn||c===null||ii(c,c.return)),d&64&&ki&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var m=Vr;if(Qn(s,r),Xn(r),d&512&&(hn||c===null||ii(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=r.memoizedState,c===null)if(d===null)if(r.stateNode===null){e:{d=r.type,c=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":v=m.getElementsByTagName("title")[0],(!v||v[Kr]||v[Qt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(d),m.head.insertBefore(v,m.querySelector("head > title"))),Cn(v,d,c),v[Qt]=r,en(v),d=v;break e;case"link":var w=Q1("link","href",m).get(d+(c.href||""));if(w){for(var T=0;T<w.length;T++)if(v=w[T],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){w.splice(T,1);break t}}v=m.createElement(d),Cn(v,d,c),m.head.appendChild(v);break;case"meta":if(w=Q1("meta","content",m).get(d+(c.content||""))){for(T=0;T<w.length;T++)if(v=w[T],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){w.splice(T,1);break t}}v=m.createElement(d),Cn(v,d,c),m.head.appendChild(v);break;default:throw Error(i(468,d))}v[Qt]=r,en(v),d=v}r.stateNode=d}else X1(m,r.type,r.stateNode);else r.stateNode=W1(m,d,r.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?X1(m,r.type,r.stateNode):W1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Ph(r,r.memoizedProps,c.memoizedProps)}break;case 27:Qn(s,r),Xn(r),d&512&&(hn||c===null||ii(c,c.return)),c!==null&&d&4&&Ph(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Qn(s,r),Xn(r),d&512&&(hn||c===null||ii(c,c.return)),r.flags&32){m=r.stateNode;try{Xi(m,"")}catch(Te){Et(r,r.return,Te)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Ph(r,m,c!==null?c.memoizedProps:m)),d&1024&&(Uh=!0);break;case 6:if(Qn(s,r),Xn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,c=r.stateNode;try{c.nodeValue=d}catch(Te){Et(r,r.return,Te)}}break;case 3:if(Hu=null,m=Vr,Vr=Uu(s.containerInfo),Qn(s,r),Vr=m,Xn(r),d&4&&c!==null&&c.memoizedState.isDehydrated)try{ul(s.containerInfo)}catch(Te){Et(r,r.return,Te)}Uh&&(Uh=!1,Xv(r));break;case 4:d=Vr,Vr=Uu(r.stateNode.containerInfo),Qn(s,r),Xn(r),Vr=d;break;case 12:Qn(s,r),Xn(r);break;case 31:Qn(s,r),Xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Cu(r,d)));break;case 13:Qn(s,r),Xn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Tu=Ee()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Cu(r,d)));break;case 22:m=r.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,te=ki,oe=hn;if(ki=te||m,hn=oe||U,Qn(s,r),hn=oe,ki=te,Xn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(c===null||U||ki||hn||na(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){U=c=s;try{if(v=U.stateNode,m)w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{T=U.stateNode;var de=U.memoizedProps.style,re=de!=null&&de.hasOwnProperty("display")?de.display:null;T.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Te){Et(U,U.return,Te)}}}else if(s.tag===6){if(c===null){U=s;try{U.stateNode.nodeValue=m?"":U.memoizedProps}catch(Te){Et(U,U.return,Te)}}}else if(s.tag===18){if(c===null){U=s;try{var se=U.stateNode;m?$1(se,!0):$1(U.stateNode,!1)}catch(Te){Et(U,U.return,Te)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Cu(r,c))));break;case 19:Qn(s,r),Xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Cu(r,d)));break;case 30:break;case 21:break;default:Qn(s,r),Xn(r)}}function Xn(r){var s=r.flags;if(s&2){try{for(var c,d=r.return;d!==null;){if(Uv(d)){c=d;break}d=d.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,v=$h(r);Nu(r,v,m);break;case 5:var w=c.stateNode;c.flags&32&&(Xi(w,""),c.flags&=-33);var T=$h(r);Nu(r,T,w);break;case 3:case 4:var U=c.stateNode.containerInfo,te=$h(r);Fh(r,te,U);break;default:throw Error(i(161))}}catch(oe){Et(r,r.return,oe)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Xv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Xv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function Ni(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)qv(r,s.alternate,s),s=s.sibling}function na(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:us(4,s,s.return),na(s);break;case 1:ii(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&$v(s,s.return,c),na(s);break;case 27:Co(s.stateNode);case 26:case 5:ii(s,s.return),na(s);break;case 22:s.memoizedState===null&&na(s);break;case 30:na(s);break;default:na(s)}r=r.sibling}}function Ci(r,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,v=s,w=v.flags;switch(v.tag){case 0:case 11:case 15:Ci(m,v,c),xo(4,v);break;case 1:if(Ci(m,v,c),d=v,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){Et(d,d.return,te)}if(d=v,m=d.updateQueue,m!==null){var T=d.stateNode;try{var U=m.shared.hiddenCallbacks;if(U!==null)for(m.shared.hiddenCallbacks=null,m=0;m<U.length;m++)C0(U[m],T)}catch(te){Et(d,d.return,te)}}c&&w&64&&Pv(v),vo(v,v.return);break;case 27:Iv(v);case 26:case 5:Ci(m,v,c),c&&d===null&&w&4&&Fv(v),vo(v,v.return);break;case 12:Ci(m,v,c);break;case 31:Ci(m,v,c),c&&w&4&&Yv(m,v);break;case 13:Ci(m,v,c),c&&w&4&&Wv(m,v);break;case 22:v.memoizedState===null&&Ci(m,v,c),vo(v,v.return);break;case 30:break;default:Ci(m,v,c)}s=s.sibling}}function Ih(r,s){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&ro(c))}function Hh(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ro(r))}function Gr(r,s,c,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Kv(r,s,c,d),s=s.sibling}function Kv(r,s,c,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:Gr(r,s,c,d),m&2048&&xo(9,s);break;case 1:Gr(r,s,c,d);break;case 3:Gr(r,s,c,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ro(r)));break;case 12:if(m&2048){Gr(r,s,c,d),r=s.stateNode;try{var v=s.memoizedProps,w=v.id,T=v.onPostCommit;typeof T=="function"&&T(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(U){Et(s,s.return,U)}}else Gr(r,s,c,d);break;case 31:Gr(r,s,c,d);break;case 13:Gr(r,s,c,d);break;case 23:break;case 22:v=s.stateNode,w=s.alternate,s.memoizedState!==null?v._visibility&2?Gr(r,s,c,d):bo(r,s):v._visibility&2?Gr(r,s,c,d):(v._visibility|=2,Ja(r,s,c,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&Ih(w,s);break;case 24:Gr(r,s,c,d),m&2048&&Hh(s.alternate,s);break;default:Gr(r,s,c,d)}}function Ja(r,s,c,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=r,w=s,T=c,U=d,te=w.flags;switch(w.tag){case 0:case 11:case 15:Ja(v,w,T,U,m),xo(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Ja(v,w,T,U,m):bo(v,w):(oe._visibility|=2,Ja(v,w,T,U,m)),m&&te&2048&&Ih(w.alternate,w);break;case 24:Ja(v,w,T,U,m),m&&te&2048&&Hh(w.alternate,w);break;default:Ja(v,w,T,U,m)}s=s.sibling}}function bo(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=r,d=s,m=d.flags;switch(d.tag){case 22:bo(c,d),m&2048&&Ih(d.alternate,d);break;case 24:bo(c,d),m&2048&&Hh(d.alternate,d);break;default:bo(c,d)}s=s.sibling}}var yo=8192;function el(r,s,c){if(r.subtreeFlags&yo)for(r=r.child;r!==null;)Zv(r,s,c),r=r.sibling}function Zv(r,s,c){switch(r.tag){case 26:el(r,s,c),r.flags&yo&&r.memoizedState!==null&&Dj(c,Vr,r.memoizedState,r.memoizedProps);break;case 5:el(r,s,c);break;case 3:case 4:var d=Vr;Vr=Uu(r.stateNode.containerInfo),el(r,s,c),Vr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=yo,yo=16777216,el(r,s,c),yo=d):el(r,s,c));break;default:el(r,s,c)}}function Jv(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function _o(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];wn=d,t1(d,r)}Jv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)e1(r),r=r.sibling}function e1(r){switch(r.tag){case 0:case 11:case 15:_o(r),r.flags&2048&&us(9,r,r.return);break;case 3:_o(r);break;case 12:_o(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,Eu(r)):_o(r);break;default:_o(r)}}function Eu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];wn=d,t1(d,r)}Jv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:us(8,s,s.return),Eu(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,Eu(s));break;default:Eu(s)}r=r.sibling}}function t1(r,s){for(;wn!==null;){var c=wn;switch(c.tag){case 0:case 11:case 15:us(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ro(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,wn=d;else e:for(c=r;wn!==null;){d=wn;var m=d.sibling,v=d.return;if(Vv(d),d===c){wn=null;break e}if(m!==null){m.return=v,wn=m;break e}wn=v}}}var Qk={getCacheForType:function(r){var s=jn(un),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return jn(un).controller.signal}},Xk=typeof WeakMap=="function"?WeakMap:Map,wt=0,Lt=null,at=null,ut=0,Ct=0,cr=null,ds=!1,tl=!1,qh=!1,Ei=0,rn=0,fs=0,ra=0,Vh=0,ur=0,nl=0,wo=null,Kn=null,Gh=!1,Tu=0,n1=0,Au=1/0,Mu=null,hs=null,_n=0,ps=null,rl=null,Ti=0,Yh=0,Wh=null,r1=null,So=0,Qh=null;function dr(){return(wt&2)!==0&&ut!==0?ut&-ut:$.T!==null?tp():Fl()}function i1(){if(ur===0)if((ut&536870912)===0||ft){var r=Ur;Ur<<=1,(Ur&3932160)===0&&(Ur=262144),ur=r}else ur=536870912;return r=lr.current,r!==null&&(r.flags|=32),ur}function Zn(r,s,c){(r===Lt&&(Ct===2||Ct===9)||r.cancelPendingCommit!==null)&&(il(r,0),ms(r,ut,ur,!1)),Ft(r,c),((wt&2)===0||r!==Lt)&&(r===Lt&&((wt&2)===0&&(ra|=c),rn===4&&ms(r,ut,ur,!1)),si(r))}function s1(r,s,c){if((wt&6)!==0)throw Error(i(327));var d=!c&&(s&127)===0&&(s&r.expiredLanes)===0||Xe(r,s),m=d?Jk(r,s):Kh(r,s,!0),v=d;do{if(m===0){tl&&!d&&ms(r,s,0,!1);break}else{if(c=r.current.alternate,v&&!Kk(c)){m=Kh(r,s,!1),v=!1;continue}if(m===2){if(v=s,r.errorRecoveryDisabledLanes&v)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var T=r;m=wo;var U=T.current.memoizedState.isDehydrated;if(U&&(il(T,w).flags|=256),w=Kh(T,w,!1),w!==2){if(qh&&!U){T.errorRecoveryDisabledLanes|=v,ra|=v,m=4;break e}v=Kn,Kn=m,v!==null&&(Kn===null?Kn=v:Kn.push.apply(Kn,v))}m=w}if(v=!1,m!==2)continue}}if(m===1){il(r,0),ms(r,s,0,!0);break}e:{switch(d=r,v=m,v){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:ms(d,s,ur,!ds);break e;case 2:Kn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=Tu+300-Ee(),10<m)){if(ms(d,s,ur,!ds),be(d,0,!0)!==0)break e;Ti=s,d.timeoutHandle=O1(a1.bind(null,d,c,Kn,Mu,Gh,s,ur,ra,nl,ds,v,"Throttled",-0,0),m);break e}a1(d,c,Kn,Mu,Gh,s,ur,ra,nl,ds,v,null,-0,0)}}break}while(!0);si(r)}function a1(r,s,c,d,m,v,w,T,U,te,oe,de,re,se){if(r.timeoutHandle=-1,de=s.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_r},Zv(s,v,de);var Te=(v&62914560)===v?Tu-Ee():(v&4194048)===v?n1-Ee():0;if(Te=zj(de,Te),Te!==null){Ti=v,r.cancelPendingCommit=Te(p1.bind(null,r,s,v,c,d,m,w,T,U,oe,de,null,re,se)),ms(r,v,w,!te);return}}p1(r,s,v,c,d,m,w,T,U)}function Kk(r){for(var s=r;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var m=c[d],v=m.getSnapshot;m=m.value;try{if(!sr(v(),m))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ms(r,s,c,d){s&=~Vh,s&=~ra,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var v=31-et(m),w=1<<v;d[v]=-1,m&=~w}c!==0&&vr(r,c,s)}function Ru(){return(wt&6)===0?(ko(0),!1):!0}function Xh(){if(at!==null){if(Ct===0)var r=at.return;else r=at,vi=Ws=null,fh(r),Wa=null,so=0,r=at;for(;r!==null;)Bv(r.alternate,r),r=r.return;at=null}}function il(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,xj(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Ti=0,Xh(),Lt=r,at=c=gi(r.current,null),ut=s,Ct=0,cr=null,ds=!1,tl=Xe(r,s),qh=!1,nl=ur=Vh=ra=fs=rn=0,Kn=wo=null,Gh=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var m=31-et(d),v=1<<m;s|=r[m],d&=~v}return Ei=s,Jc(),c}function l1(r,s){Ze=null,$.H=po,s===Ya||s===lu?(s=S0(),Ct=3):s===eh?(s=S0(),Ct=4):Ct=s===Eh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,cr=s,at===null&&(rn=1,_u(r,jr(s,r.current)))}function o1(){var r=lr.current;return r===null?!0:(ut&4194048)===ut?Tr===null:(ut&62914560)===ut||(ut&536870912)!==0?r===Tr:!1}function c1(){var r=$.H;return $.H=po,r===null?po:r}function u1(){var r=$.A;return $.A=Qk,r}function Lu(){rn=4,ds||(ut&4194048)!==ut&&lr.current!==null||(tl=!0),(fs&134217727)===0&&(ra&134217727)===0||Lt===null||ms(Lt,ut,ur,!1)}function Kh(r,s,c){var d=wt;wt|=2;var m=c1(),v=u1();(Lt!==r||ut!==s)&&(Mu=null,il(r,s)),s=!1;var w=rn;e:do try{if(Ct!==0&&at!==null){var T=at,U=cr;switch(Ct){case 8:Xh(),w=6;break e;case 3:case 2:case 9:case 6:lr.current===null&&(s=!0);var te=Ct;if(Ct=0,cr=null,sl(r,T,U,te),c&&tl){w=0;break e}break;default:te=Ct,Ct=0,cr=null,sl(r,T,U,te)}}Zk(),w=rn;break}catch(oe){l1(r,oe)}while(!0);return s&&r.shellSuspendCounter++,vi=Ws=null,wt=d,$.H=m,$.A=v,at===null&&(Lt=null,ut=0,Jc()),w}function Zk(){for(;at!==null;)d1(at)}function Jk(r,s){var c=wt;wt|=2;var d=c1(),m=u1();Lt!==r||ut!==s?(Mu=null,Au=Ee()+500,il(r,s)):tl=Xe(r,s);e:do try{if(Ct!==0&&at!==null){s=at;var v=cr;t:switch(Ct){case 1:Ct=0,cr=null,sl(r,s,v,1);break;case 2:case 9:if(_0(v)){Ct=0,cr=null,f1(s);break}s=function(){Ct!==2&&Ct!==9||Lt!==r||(Ct=7),si(r)},v.then(s,s);break e;case 3:Ct=7;break e;case 4:Ct=5;break e;case 7:_0(v)?(Ct=0,cr=null,f1(s)):(Ct=0,cr=null,sl(r,s,v,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var T=at;if(w?K1(w):T.stateNode.complete){Ct=0,cr=null;var U=T.sibling;if(U!==null)at=U;else{var te=T.return;te!==null?(at=te,Du(te)):at=null}break t}}Ct=0,cr=null,sl(r,s,v,5);break;case 6:Ct=0,cr=null,sl(r,s,v,6);break;case 8:Xh(),rn=6;break e;default:throw Error(i(462))}}ej();break}catch(oe){l1(r,oe)}while(!0);return vi=Ws=null,$.H=d,$.A=m,wt=c,at!==null?0:(Lt=null,ut=0,Jc(),rn)}function ej(){for(;at!==null&&!ze();)d1(at)}function d1(r){var s=zv(r.alternate,r,Ei);r.memoizedProps=r.pendingProps,s===null?Du(r):at=s}function f1(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=Tv(c,s,s.pendingProps,s.type,void 0,ut);break;case 11:s=Tv(c,s,s.pendingProps,s.type.render,s.ref,ut);break;case 5:fh(s);default:Bv(c,s),s=at=u0(s,Ei),s=zv(c,s,Ei)}r.memoizedProps=r.pendingProps,s===null?Du(r):at=s}function sl(r,s,c,d){vi=Ws=null,fh(s),Wa=null,so=0;var m=s.return;try{if(Ik(r,m,s,c,ut)){rn=1,_u(r,jr(c,r.current)),at=null;return}}catch(v){if(m!==null)throw at=m,v;rn=1,_u(r,jr(c,r.current)),at=null;return}s.flags&32768?(ft||d===1?r=!0:tl||(ut&536870912)!==0?r=!1:(ds=r=!0,(d===2||d===9||d===3||d===6)&&(d=lr.current,d!==null&&d.tag===13&&(d.flags|=16384))),h1(s,r)):Du(s)}function Du(r){var s=r;do{if((s.flags&32768)!==0){h1(s,ds);return}r=s.return;var c=Vk(s.alternate,s,Ei);if(c!==null){at=c;return}if(s=s.sibling,s!==null){at=s;return}at=s=r}while(s!==null);rn===0&&(rn=5)}function h1(r,s){do{var c=Gk(r.alternate,r);if(c!==null){c.flags&=32767,at=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){at=r;return}at=r=c}while(r!==null);rn=6,at=null}function p1(r,s,c,d,m,v,w,T,U){r.cancelPendingCommit=null;do zu();while(_n!==0);if((wt&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(v=s.lanes|s.childLanes,v|=$f,zn(r,c,v,w,T,U),r===Lt&&(at=Lt=null,ut=0),rl=s,ps=r,Ti=c,Yh=v,Wh=m,r1=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,ij(W,function(){return b1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=$.T,$.T=null,m=F.p,F.p=2,w=wt,wt|=4;try{Yk(r,s,c)}finally{wt=w,F.p=m,$.T=d}}_n=1,m1(),g1(),x1()}}function m1(){if(_n===1){_n=0;var r=ps,s=rl,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=$.T,$.T=null;var d=F.p;F.p=2;var m=wt;wt|=4;try{Qv(s,r);var v=cp,w=t0(r.containerInfo),T=v.focusedElem,U=v.selectionRange;if(w!==T&&T&&T.ownerDocument&&e0(T.ownerDocument.documentElement,T)){if(U!==null&&Df(T)){var te=U.start,oe=U.end;if(oe===void 0&&(oe=te),"selectionStart"in T)T.selectionStart=te,T.selectionEnd=Math.min(oe,T.value.length);else{var de=T.ownerDocument||document,re=de&&de.defaultView||window;if(re.getSelection){var se=re.getSelection(),Te=T.textContent.length,Ue=Math.min(U.start,Te),Mt=U.end===void 0?Ue:Math.min(U.end,Te);!se.extend&&Ue>Mt&&(w=Mt,Mt=Ue,Ue=w);var K=Jx(T,Ue),q=Jx(T,Mt);if(K&&q&&(se.rangeCount!==1||se.anchorNode!==K.node||se.anchorOffset!==K.offset||se.focusNode!==q.node||se.focusOffset!==q.offset)){var ee=de.createRange();ee.setStart(K.node,K.offset),se.removeAllRanges(),Ue>Mt?(se.addRange(ee),se.extend(q.node,q.offset)):(ee.setEnd(q.node,q.offset),se.addRange(ee))}}}}for(de=[],se=T;se=se.parentNode;)se.nodeType===1&&de.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<de.length;T++){var ce=de[T];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Yu=!!op,cp=op=null}finally{wt=m,F.p=d,$.T=c}}r.current=s,_n=2}}function g1(){if(_n===2){_n=0;var r=ps,s=rl,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=$.T,$.T=null;var d=F.p;F.p=2;var m=wt;wt|=4;try{qv(r,s.alternate,s)}finally{wt=m,F.p=d,$.T=c}}_n=3}}function x1(){if(_n===4||_n===3){_n=0,mt();var r=ps,s=rl,c=Ti,d=r1;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?_n=5:(_n=0,rl=ps=null,v1(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(hs=null),Ds(c),s=s.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(rt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=$.T,m=F.p,F.p=2,$.T=null;try{for(var v=r.onRecoverableError,w=0;w<d.length;w++){var T=d[w];v(T.value,{componentStack:T.stack})}}finally{$.T=s,F.p=m}}(Ti&3)!==0&&zu(),si(r),m=r.pendingLanes,(c&261930)!==0&&(m&42)!==0?r===Qh?So++:(So=0,Qh=r):So=0,ko(0)}}function v1(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,ro(s)))}function zu(){return m1(),g1(),x1(),b1()}function b1(){if(_n!==5)return!1;var r=ps,s=Yh;Yh=0;var c=Ds(Ti),d=$.T,m=F.p;try{F.p=32>c?32:c,$.T=null,c=Wh,Wh=null;var v=ps,w=Ti;if(_n=0,rl=ps=null,Ti=0,(wt&6)!==0)throw Error(i(331));var T=wt;if(wt|=4,e1(v.current),Kv(v,v.current,w,c),wt=T,ko(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(rt,v)}catch{}return!0}finally{F.p=m,$.T=d,v1(r,s)}}function y1(r,s,c){s=jr(c,s),s=Ch(r.stateNode,s,2),r=ls(r,s,2),r!==null&&(Ft(r,2),si(r))}function Et(r,s,c){if(r.tag===3)y1(r,r,c);else for(;s!==null;){if(s.tag===3){y1(s,r,c);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(hs===null||!hs.has(d))){r=jr(c,r),c=_v(2),d=ls(s,c,2),d!==null&&(wv(c,d,s,r),Ft(d,2),si(d));break}}s=s.return}}function Zh(r,s,c){var d=r.pingCache;if(d===null){d=r.pingCache=new Xk;var m=new Set;d.set(s,m)}else m=d.get(s),m===void 0&&(m=new Set,d.set(s,m));m.has(c)||(qh=!0,m.add(c),r=tj.bind(null,r,s,c),s.then(r,r))}function tj(r,s,c){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Lt===r&&(ut&c)===c&&(rn===4||rn===3&&(ut&62914560)===ut&&300>Ee()-Tu?(wt&2)===0&&il(r,0):Vh|=c,nl===ut&&(nl=0)),si(r)}function _1(r,s){s===0&&(s=cn()),r=Vs(r,s),r!==null&&(Ft(r,s),si(r))}function nj(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),_1(r,c)}function rj(r,s){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(c=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),_1(r,c)}function ij(r,s){return xn(r,s)}var Ou=null,al=null,Jh=!1,Bu=!1,ep=!1,gs=0;function si(r){r!==al&&r.next===null&&(al===null?Ou=al=r:al=al.next=r),Bu=!0,Jh||(Jh=!0,aj())}function ko(r,s){if(!ep&&Bu){ep=!0;do for(var c=!1,d=Ou;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var v=0;else{var w=d.suspendedLanes,T=d.pingedLanes;v=(1<<31-et(42|r)+1)-1,v&=m&~(w&~T),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,j1(d,v))}else v=ut,v=be(d,d===Lt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Xe(d,v)||(c=!0,j1(d,v));d=d.next}while(c);ep=!1}}function sj(){w1()}function w1(){Bu=Jh=!1;var r=0;gs!==0&&gj()&&(r=gs);for(var s=Ee(),c=null,d=Ou;d!==null;){var m=d.next,v=S1(d,s);v===0?(d.next=null,c===null?Ou=m:c.next=m,m===null&&(al=c)):(c=d,(r!==0||(v&3)!==0)&&(Bu=!0)),d=m}_n!==0&&_n!==5||ko(r),gs!==0&&(gs=0)}function S1(r,s){for(var c=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var w=31-et(v),T=1<<w,U=m[w];U===-1?((T&c)===0||(T&d)!==0)&&(m[w]=$t(T,s)):U<=s&&(r.expiredLanes|=T),v&=~T}if(s=Lt,c=ut,c=be(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===s&&(Ct===2||Ct===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Ne(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||Xe(r,c)){if(s=c&-c,s===r.callbackPriority)return s;switch(d!==null&&Ne(d),Ds(c)){case 2:case 8:c=_e;break;case 32:c=W;break;case 268435456:c=Me;break;default:c=W}return d=k1.bind(null,r),c=xn(c,d),r.callbackPriority=s,r.callbackNode=c,s}return d!==null&&d!==null&&Ne(d),r.callbackPriority=2,r.callbackNode=null,2}function k1(r,s){if(_n!==0&&_n!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(zu()&&r.callbackNode!==c)return null;var d=ut;return d=be(r,r===Lt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(s1(r,d,s),S1(r,Ee()),r.callbackNode!=null&&r.callbackNode===c?k1.bind(null,r):null)}function j1(r,s){if(zu())return null;s1(r,s,!0)}function aj(){vj(function(){(wt&6)!==0?xn(ae,sj):w1()})}function tp(){if(gs===0){var r=Va;r===0&&(r=Fr,Fr<<=1,(Fr&261888)===0&&(Fr=256)),gs=r}return gs}function N1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ra(""+r)}function C1(r,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,r.id&&c.setAttribute("form",r.id),s.parentNode.insertBefore(c,s),r=new FormData(r),c.parentNode.removeChild(c),r}function lj(r,s,c,d,m){if(s==="submit"&&c&&c.stateNode===m){var v=N1((m[Sn]||null).action),w=d.submitter;w&&(s=(s=w[Sn]||null)?N1(s.formAction):w.getAttribute("formAction"),s!==null&&(v=s,w=null));var T=new mi("action","action",null,d,m);r.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(gs!==0){var U=w?C1(m,w):new FormData(m);_h(c,{pending:!0,data:U,method:m.method,action:v},null,U)}}else typeof v=="function"&&(T.preventDefault(),U=w?C1(m,w):new FormData(m),_h(c,{pending:!0,data:U,method:m.method,action:v},v,U))},currentTarget:m}]})}}for(var np=0;np<Pf.length;np++){var rp=Pf[np],oj=rp.toLowerCase(),cj=rp[0].toUpperCase()+rp.slice(1);qr(oj,"on"+cj)}qr(i0,"onAnimationEnd"),qr(s0,"onAnimationIteration"),qr(a0,"onAnimationStart"),qr("dblclick","onDoubleClick"),qr("focusin","onFocus"),qr("focusout","onBlur"),qr(jk,"onTransitionRun"),qr(Nk,"onTransitionStart"),qr(Ck,"onTransitionCancel"),qr(l0,"onTransitionEnd"),Jr("onMouseEnter",["mouseout","mouseover"]),Jr("onMouseLeave",["mouseout","mouseover"]),Jr("onPointerEnter",["pointerout","pointerover"]),Jr("onPointerLeave",["pointerout","pointerover"]),Ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ir("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var jo="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(" "),uj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(jo));function E1(r,s){s=(s&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],m=d.event;d=d.listeners;e:{var v=void 0;if(s)for(var w=d.length-1;0<=w;w--){var T=d[w],U=T.instance,te=T.currentTarget;if(T=T.listener,U!==v&&m.isPropagationStopped())break e;v=T,m.currentTarget=te;try{v(m)}catch(oe){Zc(oe)}m.currentTarget=null,v=U}else for(w=0;w<d.length;w++){if(T=d[w],U=T.instance,te=T.currentTarget,T=T.listener,U!==v&&m.isPropagationStopped())break e;v=T,m.currentTarget=te;try{v(m)}catch(oe){Zc(oe)}m.currentTarget=null,v=U}}}}function lt(r,s){var c=s[Il];c===void 0&&(c=s[Il]=new Set);var d=r+"__bubble";c.has(d)||(T1(s,r,2,!1),c.add(d))}function ip(r,s,c){var d=0;s&&(d|=4),T1(c,r,d,s)}var Pu="_reactListening"+Math.random().toString(36).slice(2);function sp(r){if(!r[Pu]){r[Pu]=!0,Gn.forEach(function(c){c!=="selectionchange"&&(uj.has(c)||ip(c,!1,r),ip(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Pu]||(s[Pu]=!0,ip("selectionchange",!1,s))}}function T1(r,s,c,d){switch(ib(s)){case 2:var m=Pj;break;case 8:m=$j;break;default:m=yp}c=m.bind(null,s,c,r),m=void 0,!Da||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,c,{capture:!0,passive:m}):r.addEventListener(s,c,!0):m!==void 0?r.addEventListener(s,c,{passive:m}):r.addEventListener(s,c,!1)}function ap(r,s,c,d,m){var v=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var T=d.stateNode.containerInfo;if(T===m)break;if(w===4)for(w=d.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;T!==null;){if(w=pi(T),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){d=v=w;continue e}T=T.parentNode}}d=d.return}qc(function(){var te=v,oe=La(c),de=[];e:{var re=o0.get(r);if(re!==void 0){var se=mi,Te=r;switch(r){case"keypress":if(st(c)===0)break e;case"keydown":case"keyup":se=rk;break;case"focusin":Te="focus",se=ti;break;case"focusout":Te="blur",se=ti;break;case"beforeblur":case"afterblur":se=ti;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=Tf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Yc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=ak;break;case i0:case s0:case a0:se=Xc;break;case l0:se=ok;break;case"scroll":case"scrollend":se=Vc;break;case"wheel":se=uk;break;case"copy":case"cut":case"paste":se=XS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=$x;break;case"toggle":case"beforetoggle":se=fk}var Ue=(s&4)!==0,Mt=!Ue&&(r==="scroll"||r==="scrollend"),K=Ue?re!==null?re+"Capture":null:re;Ue=[];for(var q=te,ee;q!==null;){var ce=q;if(ee=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||ee===null||K===null||(ce=Fs(q,K),ce!=null&&Ue.push(No(q,ce,ee))),Mt)break;q=q.return}0<Ue.length&&(re=new se(re,Te,null,c,oe),de.push({event:re,listeners:Ue}))}}if((s&7)===0){e:{if(re=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",re&&c!==Ki&&(Te=c.relatedTarget||c.fromElement)&&(pi(Te)||Te[ir]))break e;if((se||re)&&(re=oe.window===oe?oe:(re=oe.ownerDocument)?re.defaultView||re.parentWindow:window,se?(Te=c.relatedTarget||c.toElement,se=te,Te=Te?pi(Te):null,Te!==null&&(Mt=o(Te),Ue=Te.tag,Te!==Mt||Ue!==5&&Ue!==27&&Ue!==6)&&(Te=null)):(se=null,Te=te),se!==Te)){if(Ue=Tf,ce="onMouseLeave",K="onMouseEnter",q="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=$x,ce="onPointerLeave",K="onPointerEnter",q="pointer"),Mt=se==null?re:Bs(se),ee=Te==null?re:Bs(Te),re=new Ue(ce,q+"leave",se,c,oe),re.target=Mt,re.relatedTarget=ee,ce=null,pi(oe)===te&&(Ue=new Ue(K,q+"enter",Te,c,oe),Ue.target=ee,Ue.relatedTarget=Mt,ce=Ue),Mt=ce,se&&Te)t:{for(Ue=dj,K=se,q=Te,ee=0,ce=K;ce;ce=Ue(ce))ee++;ce=0;for(var Pe=q;Pe;Pe=Ue(Pe))ce++;for(;0<ee-ce;)K=Ue(K),ee--;for(;0<ce-ee;)q=Ue(q),ce--;for(;ee--;){if(K===q||q!==null&&K===q.alternate){Ue=K;break t}K=Ue(K),q=Ue(q)}Ue=null}else Ue=null;se!==null&&A1(de,re,se,Ue,!1),Te!==null&&Mt!==null&&A1(de,Mt,Te,Ue,!0)}}e:{if(re=te?Bs(te):window,se=re.nodeName&&re.nodeName.toLowerCase(),se==="select"||se==="input"&&re.type==="file")var bt=Yx;else if(Vx(re))if(Wx)bt=wk;else{bt=yk;var De=bk}else se=re.nodeName,!se||se.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&Ma(te.elementType)&&(bt=Yx):bt=_k;if(bt&&(bt=bt(r,te))){Gx(de,bt,c,oe);break e}De&&De(r,re,te),r==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Ta(re,"number",re.value)}switch(De=te?Bs(te):window,r){case"focusin":(Vx(De)||De.contentEditable==="true")&&(Ba=De,zf=te,eo=null);break;case"focusout":eo=zf=Ba=null;break;case"mousedown":Of=!0;break;case"contextmenu":case"mouseup":case"dragend":Of=!1,n0(de,c,oe);break;case"selectionchange":if(kk)break;case"keydown":case"keyup":n0(de,c,oe)}var tt;if(Mf)e:{switch(r){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Oa?Hx(r,c)&&(dt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(dt="onCompositionStart");dt&&(Fx&&c.locale!=="ko"&&(Oa||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Oa&&(tt=gt()):(H=oe,fe="value"in H?H.value:H.textContent,Oa=!0)),De=$u(te,dt),0<De.length&&(dt=new Px(dt,r,null,c,oe),de.push({event:dt,listeners:De}),tt?dt.data=tt:(tt=qx(c),tt!==null&&(dt.data=tt)))),(tt=pk?mk(r,c):gk(r,c))&&(dt=$u(te,"onBeforeInput"),0<dt.length&&(De=new Px("onBeforeInput","beforeinput",null,c,oe),de.push({event:De,listeners:dt}),De.data=tt)),lj(de,r,te,c,oe)}E1(de,s)})}function No(r,s,c){return{instance:r,listener:s,currentTarget:c}}function $u(r,s){for(var c=s+"Capture",d=[];r!==null;){var m=r,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=Fs(r,c),m!=null&&d.unshift(No(r,m,v)),m=Fs(r,s),m!=null&&d.push(No(r,m,v))),r.tag===3)return d;r=r.return}return[]}function dj(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function A1(r,s,c,d,m){for(var v=s._reactName,w=[];c!==null&&c!==d;){var T=c,U=T.alternate,te=T.stateNode;if(T=T.tag,U!==null&&U===d)break;T!==5&&T!==26&&T!==27||te===null||(U=te,m?(te=Fs(c,v),te!=null&&w.unshift(No(c,te,U))):m||(te=Fs(c,v),te!=null&&w.push(No(c,te,U)))),c=c.return}w.length!==0&&r.push({event:s,listeners:w})}var fj=/\r\n?/g,hj=/\u0000|\uFFFD/g;function M1(r){return(typeof r=="string"?r:""+r).replace(fj,`
49
+ `).replace(hj,"")}function R1(r,s){return s=M1(s),M1(r)===s}function At(r,s,c,d,m,v){switch(c){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Xi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Xi(r,""+d);break;case"className":Ca(r,"class",d);break;case"tabIndex":Ca(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ca(r,c,d);break;case"style":Uc(r,d,v);break;case"data":if(s!=="object"){Ca(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=Ra(""+d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"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 v=="function"&&(c==="formAction"?(s!=="input"&&At(r,s,"name",m.name,m,null),At(r,s,"formEncType",m.formEncType,m,null),At(r,s,"formMethod",m.formMethod,m,null),At(r,s,"formTarget",m.formTarget,m,null)):(At(r,s,"encType",m.encType,m,null),At(r,s,"method",m.method,m,null),At(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=Ra(""+d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=_r);break;case"onScroll":d!=null&&lt("scroll",r);break;case"onScrollEnd":d!=null&&lt("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}c=Ra(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""+d):r.removeAttribute(c);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":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),Ps(r,"popover",d);break;case"xlinkActuate":Hr(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Hr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Hr(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Hr(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Hr(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Hr(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Hr(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Hr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Hr(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Ps(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Ic.get(c)||c,Ps(r,c,d))}}function lp(r,s,c,d,m,v){switch(c){case"style":Uc(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"children":typeof d=="string"?Xi(r,d):(typeof d=="number"||typeof d=="bigint")&&Xi(r,""+d);break;case"onScroll":d!=null&&lt("scroll",r);break;case"onScrollEnd":d!=null&&lt("scrollend",r);break;case"onClick":d!=null&&(r.onclick=_r);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Na.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),s=c.slice(2,m?c.length-7:void 0),v=r[Sn]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(s,v,m),typeof d=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(s,d,m);break e}c in r?r[c]=d:d===!0?r.setAttribute(c,""):Ps(r,c,d)}}}function Cn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",r),lt("load",r);var d=!1,m=!1,v;for(v in c)if(c.hasOwnProperty(v)){var w=c[v];if(w!=null)switch(v){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:At(r,s,v,w,c,null)}}m&&At(r,s,"srcSet",c.srcSet,c,null),d&&At(r,s,"src",c.src,c,null);return;case"input":lt("invalid",r);var T=v=w=m=null,U=null,te=null;for(d in c)if(c.hasOwnProperty(d)){var oe=c[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":U=oe;break;case"defaultChecked":te=oe;break;case"value":v=oe;break;case"defaultValue":T=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,s));break;default:At(r,s,d,oe,c,null)}}$c(r,v,T,U,te,w,m,!1);return;case"select":lt("invalid",r),d=w=v=null;for(m in c)if(c.hasOwnProperty(m)&&(T=c[m],T!=null))switch(m){case"value":v=T;break;case"defaultValue":w=T;break;case"multiple":d=T;default:At(r,s,m,T,c,null)}s=v,c=w,r.multiple=!!d,s!=null?Qi(r,!!d,s,!1):c!=null&&Qi(r,!!d,c,!0);return;case"textarea":lt("invalid",r),v=m=d=null;for(w in c)if(c.hasOwnProperty(w)&&(T=c[w],T!=null))switch(w){case"value":d=T;break;case"defaultValue":m=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:At(r,s,w,T,c,null)}Gl(r,d,m,v);return;case"option":for(U in c)if(c.hasOwnProperty(U)&&(d=c[U],d!=null))switch(U){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:At(r,s,U,d,c,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<jo.length;d++)lt(jo[d],r);break;case"image":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"embed":case"source":case"link":lt("error",r),lt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in c)if(c.hasOwnProperty(te)&&(d=c[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:At(r,s,te,d,c,null)}return;default:if(Ma(s)){for(oe in c)c.hasOwnProperty(oe)&&(d=c[oe],d!==void 0&&lp(r,s,oe,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&At(r,s,T,d,c,null))}function pj(r,s,c,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,v=null,w=null,T=null,U=null,te=null,oe=null;for(se in c){var de=c[se];if(c.hasOwnProperty(se)&&de!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":U=de;default:d.hasOwnProperty(se)||At(r,s,se,null,d,de)}}for(var re in d){var se=d[re];if(de=c[re],d.hasOwnProperty(re)&&(se!=null||de!=null))switch(re){case"type":v=se;break;case"name":m=se;break;case"checked":te=se;break;case"defaultChecked":oe=se;break;case"value":w=se;break;case"defaultValue":T=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,s));break;default:se!==de&&At(r,s,re,se,d,de)}}$s(r,w,T,U,te,oe,v,m);return;case"select":se=w=T=re=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":se=U;default:d.hasOwnProperty(v)||At(r,s,v,null,d,U)}for(m in d)if(v=d[m],U=c[m],d.hasOwnProperty(m)&&(v!=null||U!=null))switch(m){case"value":re=v;break;case"defaultValue":T=v;break;case"multiple":w=v;default:v!==U&&At(r,s,m,v,d,U)}s=T,c=w,d=se,re!=null?Qi(r,!!c,re,!1):!!d!=!!c&&(s!=null?Qi(r,!!c,s,!0):Qi(r,!!c,c?[]:"",!1));return;case"textarea":se=re=null;for(T in c)if(m=c[T],c.hasOwnProperty(T)&&m!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:At(r,s,T,null,d,m)}for(w in d)if(m=d[w],v=c[w],d.hasOwnProperty(w)&&(m!=null||v!=null))switch(w){case"value":re=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&At(r,s,w,m,d,v)}Aa(r,re,se);return;case"option":for(var Te in c)if(re=c[Te],c.hasOwnProperty(Te)&&re!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:At(r,s,Te,null,d,re)}for(U in d)if(re=d[U],se=c[U],d.hasOwnProperty(U)&&re!==se&&(re!=null||se!=null))switch(U){case"selected":r.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:At(r,s,U,re,d,se)}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 Ue in c)re=c[Ue],c.hasOwnProperty(Ue)&&re!=null&&!d.hasOwnProperty(Ue)&&At(r,s,Ue,null,d,re);for(te in d)if(re=d[te],se=c[te],d.hasOwnProperty(te)&&re!==se&&(re!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,s));break;default:At(r,s,te,re,d,se)}return;default:if(Ma(s)){for(var Mt in c)re=c[Mt],c.hasOwnProperty(Mt)&&re!==void 0&&!d.hasOwnProperty(Mt)&&lp(r,s,Mt,void 0,d,re);for(oe in d)re=d[oe],se=c[oe],!d.hasOwnProperty(oe)||re===se||re===void 0&&se===void 0||lp(r,s,oe,re,d,se);return}}for(var K in c)re=c[K],c.hasOwnProperty(K)&&re!=null&&!d.hasOwnProperty(K)&&At(r,s,K,null,d,re);for(de in d)re=d[de],se=c[de],!d.hasOwnProperty(de)||re===se||re==null&&se==null||At(r,s,de,re,d,se)}function L1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function mj(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var m=c[d],v=m.transferSize,w=m.initiatorType,T=m.duration;if(v&&T&&L1(w)){for(w=0,T=m.responseEnd,d+=1;d<c.length;d++){var U=c[d],te=U.startTime;if(te>T)break;var oe=U.transferSize,de=U.initiatorType;oe&&L1(de)&&(U=U.responseEnd,w+=oe*(U<T?1:(T-te)/(U-te)))}if(--d,s+=8*(v+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var op=null,cp=null;function Fu(r){return r.nodeType===9?r:r.ownerDocument}function D1(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function z1(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function up(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var dp=null;function gj(){var r=window.event;return r&&r.type==="popstate"?r===dp?!1:(dp=r,!0):(dp=null,!1)}var O1=typeof setTimeout=="function"?setTimeout:void 0,xj=typeof clearTimeout=="function"?clearTimeout:void 0,B1=typeof Promise=="function"?Promise:void 0,vj=typeof queueMicrotask=="function"?queueMicrotask:typeof B1<"u"?function(r){return B1.resolve(null).then(r).catch(bj)}:O1;function bj(r){setTimeout(function(){throw r})}function xs(r){return r==="head"}function P1(r,s){var c=s,d=0;do{var m=c.nextSibling;if(r.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(m),ul(s);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Co(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,Co(c);for(var v=c.firstChild;v;){var w=v.nextSibling,T=v.nodeName;v[Kr]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=w}}else c==="body"&&Co(r.ownerDocument.body);c=m}while(c);ul(s)}function $1(r,s){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function fp(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":fp(c),Yi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function yj(r,s,c,d){for(;r.nodeType===1;){var m=c;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Kr])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Ar(r.nextSibling),r===null)break}return null}function _j(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Ar(r.nextSibling),r===null))return null;return r}function F1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=Ar(r.nextSibling),r===null))return null;return r}function hp(r){return r.data==="$?"||r.data==="$~"}function pp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function wj(r,s){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||c.readyState!=="loading")s();else{var d=function(){s(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Ar(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var mp=null;function U1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return Ar(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function I1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return r;s--}else c!=="/$"&&c!=="/&"||s++}r=r.previousSibling}return null}function H1(r,s,c){switch(s=Fu(c),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function Co(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Yi(r)}var Mr=new Map,q1=new Set;function Uu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ai=F.d;F.d={f:Sj,r:kj,D:jj,C:Nj,L:Cj,m:Ej,X:Aj,S:Tj,M:Mj};function Sj(){var r=Ai.f(),s=Ru();return r||s}function kj(r){var s=Vn(r);s!==null&&s.tag===5&&s.type==="form"?lv(s):Ai.r(r)}var ll=typeof document>"u"?null:document;function V1(r,s,c){var d=ll;if(d&&typeof s=="string"&&s){var m=an(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),q1.has(m)||(q1.add(m),r={rel:r,crossOrigin:c,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),Cn(s,"link",r),en(s),d.head.appendChild(s)))}}function jj(r){Ai.D(r),V1("dns-prefetch",r,null)}function Nj(r,s){Ai.C(r,s),V1("preconnect",r,s)}function Cj(r,s,c){Ai.L(r,s,c);var d=ll;if(d&&r&&s){var m='link[rel="preload"][as="'+an(s)+'"]';s==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+an(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+an(c.imageSizes)+'"]')):m+='[href="'+an(r)+'"]';var v=m;switch(s){case"style":v=ol(r);break;case"script":v=cl(r)}Mr.has(v)||(r=x({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Mr.set(v,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(Eo(v))||s==="script"&&d.querySelector(To(v))||(s=d.createElement("link"),Cn(s,"link",r),en(s),d.head.appendChild(s)))}}function Ej(r,s){Ai.m(r,s);var c=ll;if(c&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+an(d)+'"][href="'+an(r)+'"]',v=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=cl(r)}if(!Mr.has(v)&&(r=x({rel:"modulepreload",href:r},s),Mr.set(v,r),c.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(To(v)))return}d=c.createElement("link"),Cn(d,"link",r),en(d),c.head.appendChild(d)}}}function Tj(r,s,c){Ai.S(r,s,c);var d=ll;if(d&&r){var m=Zr(d).hoistableStyles,v=ol(r);s=s||"default";var w=m.get(v);if(!w){var T={loading:0,preload:null};if(w=d.querySelector(Eo(v)))T.loading=5;else{r=x({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Mr.get(v))&&gp(r,c);var U=w=d.createElement("link");en(U),Cn(U,"link",r),U._p=new Promise(function(te,oe){U.onload=te,U.onerror=oe}),U.addEventListener("load",function(){T.loading|=1}),U.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Iu(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:T},m.set(v,w)}}}function Aj(r,s){Ai.X(r,s);var c=ll;if(c&&r){var d=Zr(c).hoistableScripts,m=cl(r),v=d.get(m);v||(v=c.querySelector(To(m)),v||(r=x({src:r,async:!0},s),(s=Mr.get(m))&&xp(r,s),v=c.createElement("script"),en(v),Cn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function Mj(r,s){Ai.M(r,s);var c=ll;if(c&&r){var d=Zr(c).hoistableScripts,m=cl(r),v=d.get(m);v||(v=c.querySelector(To(m)),v||(r=x({src:r,async:!0,type:"module"},s),(s=Mr.get(m))&&xp(r,s),v=c.createElement("script"),en(v),Cn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function G1(r,s,c,d){var m=(m=je.current)?Uu(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=ol(c.href),c=Zr(m).hoistableStyles,d=c.get(s),d||(d={type:"style",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=ol(c.href);var v=Zr(m).hoistableStyles,w=v.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,w),(v=m.querySelector(Eo(r)))&&!v._p&&(w.instance=v,w.state.loading=5),Mr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Mr.set(r,c),v||Rj(m,r,c,w.state))),s&&d===null)throw Error(i(528,""));return w}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=cl(c),c=Zr(m).hoistableScripts,d=c.get(s),d||(d={type:"script",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function ol(r){return'href="'+an(r)+'"'}function Eo(r){return'link[rel="stylesheet"]['+r+"]"}function Y1(r){return x({},r,{"data-precedence":r.precedence,precedence:null})}function Rj(r,s,c,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),Cn(s,"link",c),en(s),r.head.appendChild(s))}function cl(r){return'[src="'+an(r)+'"]'}function To(r){return"script[async]"+r}function W1(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+an(c.href)+'"]');if(d)return s.instance=d,en(d),d;var m=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),en(d),Cn(d,"style",m),Iu(d,c.precedence,r),s.instance=d;case"stylesheet":m=ol(c.href);var v=r.querySelector(Eo(m));if(v)return s.state.loading|=4,s.instance=v,en(v),v;d=Y1(c),(m=Mr.get(m))&&gp(d,m),v=(r.ownerDocument||r).createElement("link"),en(v);var w=v;return w._p=new Promise(function(T,U){w.onload=T,w.onerror=U}),Cn(v,"link",d),s.state.loading|=4,Iu(v,c.precedence,r),s.instance=v;case"script":return v=cl(c.src),(m=r.querySelector(To(v)))?(s.instance=m,en(m),m):(d=c,(m=Mr.get(v))&&(d=x({},c),xp(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),en(m),Cn(m,"link",d),r.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Iu(d,c.precedence,r));return s.instance}function Iu(r,s,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,v=m,w=0;w<d.length;w++){var T=d[w];if(T.dataset.precedence===s)v=T;else if(v!==m)break}v?v.parentNode.insertBefore(r,v.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(r,s.firstChild))}function gp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function xp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Hu=null;function Q1(r,s,c){if(Hu===null){var d=new Map,m=Hu=new Map;m.set(c,d)}else m=Hu,d=m.get(c),d||(d=new Map,m.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),m=0;m<c.length;m++){var v=c[m];if(!(v[Kr]||v[Qt]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var w=v.getAttribute(s)||"";w=r+w;var T=d.get(w);T?T.push(v):d.set(w,[v])}}return d}function X1(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function Lj(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function K1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Dj(r,s,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=ol(d.href),v=s.querySelector(Eo(m));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=qu.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=v,en(v);return}v=s.ownerDocument||s,d=Y1(d),(m=Mr.get(m))&&gp(d,m),v=v.createElement("link"),en(v);var w=v;w._p=new Promise(function(T,U){w.onload=T,w.onerror=U}),Cn(v,"link",d),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=qu.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var vp=0;function zj(r,s){return r.stylesheets&&r.count===0&&Gu(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&Gu(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+s);0<r.imgBytes&&vp===0&&(vp=62500*mj());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Gu(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>vp?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function qu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Vu=null;function Gu(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Vu=new Map,s.forEach(Oj,r),Vu=null,qu.call(r))}function Oj(r,s){if(!(s.state.loading&4)){var c=Vu.get(r);if(c)var d=c.get(null);else{c=new Map,Vu.set(r,c);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var w=m[v];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),v=c.get(w)||d,v===d&&c.set(null,m),c.set(w,m),this.count++,d=qu.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),v?v.parentNode.insertBefore(m,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var Ao={$$typeof:N,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function Bj(r,s,c,d,m,v,w,T,U){this.tag=1,this.containerInfo=r,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=Tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tn(0),this.hiddenUpdates=Tn(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function Z1(r,s,c,d,m,v,w,T,U,te,oe,de){return r=new Bj(r,s,c,w,U,te,oe,de,T),s=1,v===!0&&(s|=24),v=ar(3,null,null,s),r.current=v,v.stateNode=r,s=Kf(),s.refCount++,r.pooledCache=s,s.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:s},th(v),r}function J1(r){return r?(r=Fa,r):Fa}function eb(r,s,c,d,m,v){m=J1(m),d.context===null?d.context=m:d.pendingContext=m,d=as(s),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=ls(r,d,s),c!==null&&(Zn(c,r,s),lo(c,r,s))}function tb(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function bp(r,s){tb(r,s),(r=r.alternate)&&tb(r,s)}function nb(r){if(r.tag===13||r.tag===31){var s=Vs(r,67108864);s!==null&&Zn(s,r,67108864),bp(r,67108864)}}function rb(r){if(r.tag===13||r.tag===31){var s=dr();s=On(s);var c=Vs(r,s);c!==null&&Zn(c,r,s),bp(r,s)}}var Yu=!0;function Pj(r,s,c,d){var m=$.T;$.T=null;var v=F.p;try{F.p=2,yp(r,s,c,d)}finally{F.p=v,$.T=m}}function $j(r,s,c,d){var m=$.T;$.T=null;var v=F.p;try{F.p=8,yp(r,s,c,d)}finally{F.p=v,$.T=m}}function yp(r,s,c,d){if(Yu){var m=_p(d);if(m===null)ap(r,s,d,Wu,c),sb(r,d);else if(Uj(m,r,s,c,d))d.stopPropagation();else if(sb(r,d),s&4&&-1<Fj.indexOf(r)){for(;m!==null;){var v=Vn(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var w=me(v.pendingLanes);if(w!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var U=1<<31-et(w);T.entanglements[1]|=U,w&=~U}si(v),(wt&6)===0&&(Au=Ee()+500,ko(0))}}break;case 31:case 13:T=Vs(v,2),T!==null&&Zn(T,v,2),Ru(),bp(v,2)}if(v=_p(d),v===null&&ap(r,s,d,Wu,c),v===m)break;m=v}m!==null&&d.stopPropagation()}else ap(r,s,d,null,c)}}function _p(r){return r=La(r),wp(r)}var Wu=null;function wp(r){if(Wu=null,r=pi(r),r!==null){var s=o(r);if(s===null)r=null;else{var c=s.tag;if(c===13){if(r=u(s),r!==null)return r;r=null}else if(c===31){if(r=f(s),r!==null)return r;r=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Wu=r,null}function ib(r){switch(r){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($r()){case ae:return 2;case _e:return 8;case W:case pe:return 32;case Me:return 268435456;default:return 32}default:return 32}}var Sp=!1,vs=null,bs=null,ys=null,Mo=new Map,Ro=new Map,_s=[],Fj="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 sb(r,s){switch(r){case"focusin":case"focusout":vs=null;break;case"dragenter":case"dragleave":bs=null;break;case"mouseover":case"mouseout":ys=null;break;case"pointerover":case"pointerout":Mo.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ro.delete(s.pointerId)}}function Lo(r,s,c,d,m,v){return r===null||r.nativeEvent!==v?(r={blockedOn:s,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[m]},s!==null&&(s=Vn(s),s!==null&&nb(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function Uj(r,s,c,d,m){switch(s){case"focusin":return vs=Lo(vs,r,s,c,d,m),!0;case"dragenter":return bs=Lo(bs,r,s,c,d,m),!0;case"mouseover":return ys=Lo(ys,r,s,c,d,m),!0;case"pointerover":var v=m.pointerId;return Mo.set(v,Lo(Mo.get(v)||null,r,s,c,d,m)),!0;case"gotpointercapture":return v=m.pointerId,Ro.set(v,Lo(Ro.get(v)||null,r,s,c,d,m)),!0}return!1}function ab(r){var s=pi(r.target);if(s!==null){var c=o(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){r.blockedOn=s,Ul(r.priority,function(){rb(c)});return}}else if(s===31){if(s=f(c),s!==null){r.blockedOn=s,Ul(r.priority,function(){rb(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Qu(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=_p(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);Ki=d,c.target.dispatchEvent(d),Ki=null}else return s=Vn(c),s!==null&&nb(s),r.blockedOn=c,!1;s.shift()}return!0}function lb(r,s,c){Qu(r)&&c.delete(s)}function Ij(){Sp=!1,vs!==null&&Qu(vs)&&(vs=null),bs!==null&&Qu(bs)&&(bs=null),ys!==null&&Qu(ys)&&(ys=null),Mo.forEach(lb),Ro.forEach(lb)}function Xu(r,s){r.blockedOn===s&&(r.blockedOn=null,Sp||(Sp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ij)))}var Ku=null;function ob(r){Ku!==r&&(Ku=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ku===r&&(Ku=null);for(var s=0;s<r.length;s+=3){var c=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(wp(d||c)===null)continue;break}var v=Vn(c);v!==null&&(r.splice(s,3),s-=3,_h(v,{pending:!0,data:m,method:c.method,action:d},d,m))}}))}function ul(r){function s(U){return Xu(U,r)}vs!==null&&Xu(vs,r),bs!==null&&Xu(bs,r),ys!==null&&Xu(ys,r),Mo.forEach(s),Ro.forEach(s);for(var c=0;c<_s.length;c++){var d=_s[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<_s.length&&(c=_s[0],c.blockedOn===null);)ab(c),c.blockedOn===null&&_s.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var m=c[d],v=c[d+1],w=m[Sn]||null;if(typeof v=="function")w||ob(c);else if(w){var T=null;if(v&&v.hasAttribute("formAction")){if(m=v,w=v[Sn]||null)T=w.formAction;else if(wp(m)!==null)continue}else T=w.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),ob(c)}}}function cb(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function kp(r){this._internalRoot=r}Zu.prototype.render=kp.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var c=s.current,d=dr();eb(c,d,r,s,null,null)},Zu.prototype.unmount=kp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;eb(r.current,2,null,r,null,null),Ru(),s[ir]=null}};function Zu(r){this._internalRoot=r}Zu.prototype.unstable_scheduleHydration=function(r){if(r){var s=Fl();r={blockedOn:null,target:r,priority:s};for(var c=0;c<_s.length&&s!==0&&s<_s[c].priority;c++);_s.splice(c,0,r),c===0&&ab(r)}};var ub=t.version;if(ub!=="19.2.8")throw Error(i(527,ub,"19.2.8"));F.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(s),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var Hj={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ju=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ju.isDisabled&&Ju.supportsFiber)try{rt=Ju.inject(Hj),St=Ju}catch{}}return zo.createRoot=function(r,s){if(!a(r))throw Error(i(299));var c=!1,d="",m=xv,v=vv,w=bv;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=Z1(r,1,!1,null,null,c,d,null,m,v,w,cb),r[ir]=s.current,sp(r),new kp(s)},zo.hydrateRoot=function(r,s,c){if(!a(r))throw Error(i(299));var d=!1,m="",v=xv,w=vv,T=bv,U=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),s=Z1(r,1,!0,s,c??null,d,m,U,v,w,T,cb),s.context=J1(null),c=s.current,d=dr(),d=On(d),m=as(d),m.callback=null,ls(c,m,d),c=d,s.current.lanes=c,Ft(s,c),si(s),r[ir]=s.current,sp(r),new Zu(s)},zo.version="19.2.8",zo}var wb;function nN(){if(wb)return Cp.exports;wb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Cp.exports=tN(),Cp.exports}var rN=nN();const Sb=e=>{let t;const n=new Set,i=(p,g)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const b=t;t=g??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,f={setState:i,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,a,f);return f},iN=(e=>e?Sb(e):Sb),sN=e=>e;function aN(e,t=sN){const n=ed.useSyncExternalStore(e.subscribe,ed.useCallback(()=>t(e.getState()),[e,t]),ed.useCallback(()=>t(e.getInitialState()),[e,t]));return ed.useDebugValue(n),n}const kb=e=>{const t=iN(e),n=i=>aN(t,i);return Object.assign(n,t),n},lN=(e=>e?kb(e):kb),Dm="companion_auth_token";function jb(){return typeof window>"u"?null:localStorage.getItem(Dm)||null}const oN=e=>({authToken:jb(),isAuthenticated:jb()!==null,setAuthToken:t=>{localStorage.setItem(Dm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(Dm),e({authToken:null,isAuthenticated:!1})}});function qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function cN(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function uN(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function dN(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function fN(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const hN=e=>({sessions:new Map,sdkSessions:[],currentSessionId:dN(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:uN(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:fN(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:qt(n.sessions,t),connectionStatus:qt(n.connectionStatus,t),cliConnected:qt(n.cliConnected,t),cliReconnecting:qt(n.cliReconnecting,t),sessionStatus:qt(n.sessionStatus,t),previousPermissionMode:qt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:cN(n.recentlyRenamed,t),mcpServers:qt(n.mcpServers,t),rateLimit:qt(n.rateLimit,t),prStatus:qt(n.prStatus,t),linkedLinearIssues:qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:qt(n.messages,t),streaming:qt(n.streaming,t),streamingStartedAt:qt(n.streamingStartedAt,t),streamingOutputTokens:qt(n.streamingOutputTokens,t),pendingPermissions:qt(n.pendingPermissions,t),aiResolvedPermissions:qt(n.aiResolvedPermissions,t),sessionTasks:qt(n.sessionTasks,t),changedFilesTick:qt(n.changedFilesTick,t),gitChangedFilesCount:qt(n.gitChangedFilesCount,t),sessionProcesses:qt(n.sessionProcesses,t),toolProgress:qt(n.toolProgress,t),toolActivity:qt(n.toolActivity,t),diffPanelSelectedFile:qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}})}),pN=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),mN=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),gN=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=o[u];o[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:o}})}),Vi=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],xN=Vi.map(e=>e.id),g5="cc-task-panel-config";function zm(){return{order:[...xN],enabled:Object.fromEntries(Vi.map(e=>[e.id,!0]))}}function vN(){if(typeof window>"u")return zm();try{const e=localStorage.getItem(g5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of Vi)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(Vi.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return zm()}function td(e){try{localStorage.setItem(g5,JSON.stringify(e))}catch{}}function bN(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function yN(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function _N(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function x5(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}function wN(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const SN=e=>({darkMode:bN(),notificationSound:yN(),notificationDesktop:_N(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:vN(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:x5(),density:wN(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return td(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const o={...n.taskPanelConfig,order:i};return td(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return td(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=zm();td(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})},setDensity:t=>{typeof window<"u"&&localStorage.setItem("cc-density",t),e({density:t})},toggleDensity:()=>e(t=>{const n=t.density==="compact"?"standard":"compact";return typeof window<"u"&&localStorage.setItem("cc-density",n),{density:n}})});function v5(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const kN=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:v5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,f=i?o+1:o,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function jN(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const NN=e=>({updateInfo:null,updateDismissedVersion:jN(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),X=lN((...e)=>({...oN(...e),...hN(...e),...pN(...e),...mN(...e),...gN(...e),...SN(...e),...kN(...e),...NN(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:x5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:v5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),CN=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),EN="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",TN=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function AN(e){return TN.test(e)}function MN(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:AN(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const Nb=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],Cb=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function Eb(){const e=Nb[Math.floor(Math.random()*Nb.length)],t=Cb[Math.floor(Math.random()*Cb.length)];return`${e} ${t}`}function b5(e){for(let t=0;t<100;t++){const n=Eb();if(!e.has(n))return n}return Eb()}let Mp=null;function RN(){return Mp||(Mp=new AudioContext),Mp}function LN(){try{const e=RN();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class y5{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(o,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=E=>{if(E=this.postProcess(E,i),a){setTimeout(function(){a(E)},0);return}else return E},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const x=(o=i.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,C=1/0;const k=()=>{for(let E=Math.max(j,-p);E<=Math.min(C,p);E+=2){let N;const D=y[E-1],O=y[E+1];D&&(y[E-1]=void 0);let L=!1;if(O){const P=O.oldPos-E;L=O&&0<=P&&P<f}const G=D&&D.oldPos+1<h;if(!L&&!G){y[E]=void 0;continue}if(!G||L&&D.oldPos<O.oldPos?N=this.addToPath(O,!0,!1,0,i):N=this.addToPath(D,!1,!0,1,i),_=this.extractCommon(N,n,t,E,i),N.oldPos+1>=h&&_+1>=f)return u(this.buildValues(N.lastComponent,n,t))||!0;y[E]=N,N.oldPos+1>=h&&(C=Math.min(C,E-1)),_+1>=f&&(j=Math.max(j,E+1))}p++};if(a)(function E(){setTimeout(function(){if(p>g||Date.now()>b)return a(void 0);k()||E()},0)})();else for(;p<=g&&Date.now()<=b;){const E=k();if(E)return E}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,f=i.length;let h=t.oldPos,p=h-a,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],o);)p++,h++,g++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!o.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let f=0,h=0,p=0;for(;f<u;f++){const g=a[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let x=n.slice(h,h+g.count);x=x.map(function(b,y){const _=i[p+y];return _.length>b.length?_:b}),g.value=this.join(x)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return a}}function Tb(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Ab(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Om(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Bm(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Oo(e,t){return Om(e,t,"")}function nd(e,t){return Bm(e,t,"")}function Mb(e,t){return t.slice(0,DN(e,t))}function DN(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function _5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Pm(e,t){if(t)return sc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function xl(e,t){if(t)return sc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function sc(e,t){if(!t)return[xl(e),Pm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=_5(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const Rb="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",zN=new RegExp(`[${Rb}]+|\\s+|[^${Rb}]`,"ug");class ON extends y5{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=_5(t,u)}else i=t.match(zN)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&Lb(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&Lb(i,o,a,null,n.intlSegmenter),t}}const BN=new ON;function PN(e,t,n){return BN.diff(e,t,n)}function Lb(e,t,n,i,a){if(t&&n){const[o,u]=sc(t.value,a),[f,h]=sc(n.value,a);if(e){const p=Tb(o,f);e.value=Bm(e.value,f,p),t.value=Oo(t.value,p),n.value=Oo(n.value,p)}if(i){const p=Ab(u,h);i.value=Om(i.value,h,p),t.value=nd(t.value,p),n.value=nd(n.value,p)}}else if(n){if(e){const o=xl(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=xl(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=xl(i.value,a),[u,f]=sc(t.value,a),h=Tb(o,u);t.value=Oo(t.value,h);const p=Ab(Oo(o,h),f);t.value=nd(t.value,p),i.value=Om(i.value,o,p),e.value=Bm(e.value,o,o.slice(0,o.length-p.length))}else if(i){const o=xl(i.value,a),u=Pm(t.value,a),f=Mb(u,o);t.value=nd(t.value,f)}else if(e){const o=Pm(e.value,a),u=xl(t.value,a),f=Mb(o,u);t.value=Oo(t.value,f)}}class $N extends y5{constructor(){super(...arguments),this.tokenize=UN}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
50
+ `))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
51
+ `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
52
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
53
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const FN=new $N;function Db(e,t,n){return FN.diff(e,t,n)}function UN(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
54
+ `));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let a=0;a<i.length;a++){const o=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function IN(e,t,n,i,a,o,u){let f;u?typeof u=="function"?f={callback:u}:f=u:f={},typeof f.context>"u"&&(f.context=4);const h=f.context;if(f.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(f.callback){const{callback:g}=f;Db(n,i,Object.assign(Object.assign({},f),{callback:x=>{const b=p(x);g(b)}}))}else return p(Db(n,i,f));function p(g){if(!g)return;g.push({value:"",lines:[]});function x(E){return E.map(function(N){return" "+N})}const b=[];let y=0,_=0,j=[],C=1,k=1;for(let E=0;E<g.length;E++){const N=g[E],D=N.lines||HN(N.value);if(N.lines=D,N.added||N.removed){if(!y){const O=g[E-1];y=C,_=k,O&&(j=h>0?x(O.lines.slice(-h)):[],y-=j.length,_-=j.length)}for(const O of D)j.push((N.added?"+":"-")+O);N.added?k+=D.length:C+=D.length}else{if(y)if(D.length<=h*2&&E<g.length-2)for(const O of x(D))j.push(O);else{const O=Math.min(D.length,h);for(const G of x(D.slice(0,O)))j.push(G);const L={oldStart:y,oldLines:C-y+O,newStart:_,newLines:k-_+O,lines:j};b.push(L),y=0,_=0,j=[]}C+=D.length,k+=D.length}}for(const E of b)for(let N=0;N<E.lines.length;N++)E.lines[N].endsWith(`
55
+ `)?E.lines[N]=E.lines[N].slice(0,-1):(E.lines.splice(N+1,0,"\"),N++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:o,hunks:b}}}function HN(e){const t=e.endsWith(`
56
+ `),n=e.split(`
57
+ `).map(i=>i+`
58
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function qN(e,t){return IN("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,o=[];let u=i.oldStart,f=i.newStart;for(const h of i.lines){const p=h[0],g=h.slice(1);p==="-"?o.push({type:"del",content:g,oldLineNo:u++}):p==="+"?o.push({type:"add",content:g,newLineNo:f++}):o.push({type:"context",content:g,oldLineNo:u++,newLineNo:f++})}return w5(o),{header:a,lines:o}})}function VN(e){const t=[],n=e.split(`
59
+ `);let i=null,a=null,o=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){a&&i&&i.hunks.push(a),i&&t.push(i),i={fileName:"",hunks:[]},a=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){i&&(i.fileName=f.slice(6));continue}if(f.startsWith("+++ /dev/null")||f.startsWith("index ")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from")||f.startsWith("rename to")||f.startsWith("similarity index")||f.startsWith("Binary files"))continue;const h=f.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(h){a&&i&&i.hunks.push(a),o=parseInt(h[1],10),u=parseInt(h[2],10),a={header:f,lines:[]};continue}a&&(f.startsWith("+")?a.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?a.lines.push({type:"del",content:f.slice(1),oldLineNo:o++}):f.startsWith(" ")&&a.lines.push({type:"context",content:f.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const f of t)for(const h of f.hunks)w5(h.lines);return t}function w5(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=i-n,f=o-a;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const g=e[n+p],x=e[a+p],b=PN(g.content,x.content);g.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),x.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function GN({line:e}){return e.wordChanges?l.jsx(l.Fragment,{children:e.wordChanges.map((t,n)=>t.added?l.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?l.jsx("span",{className:"diff-word-del",children:t.value},n):l.jsx("span",{children:t.value},n))}):l.jsx(l.Fragment,{children:e.content})}function YN({hunk:e,showLineNumbers:t}){return l.jsxs("div",{className:"diff-hunk",children:[l.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>l.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),l.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),l.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),l.jsxs("span",{className:"diff-content",children:[l.jsx(GN,{line:n}),!n.content&&" "]})]},i))]})}function WN({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return l.jsxs("div",{className:"diff-file-header",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&l.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function Dl({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const o=a==="compact",u=!o,f=S.useMemo(()=>{if(n)return VN(n);const h=e??"",p=t??"";if(!h&&!p)return[];const g=qN(h,p);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return f.length===0||f.every(h=>h.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${o?"diff-compact":"diff-full"}`,children:f.map((h,p)=>l.jsxs("div",{className:"diff-file",children:[(h.fileName||i)&&l.jsx(WN,{fileName:h.fileName||i||""}),h.hunks.map((g,x)=>l.jsx(YN,{hunk:g,showLineNumbers:u},x))]},p))})}const S5=S.createContext(null);function $D({value:e,children:t}){return l.jsx(S5.Provider,{value:e,children:t})}function QN(){const e=S.useContext(S5),t=X(n=>n.density);return e??t}function zl(){return QN()==="compact"}function mf({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:o=""}){return l.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${e?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),n&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-muted/40 select-none shrink-0",children:n}),l.jsx("span",{className:`text-[11px] text-cc-muted/60 group-hover:text-cc-muted truncate min-w-0 ${o}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const XN={Bash:"terminal",Read:"file",Write:"file-plus",Edit:"file-edit",Glob:"search",Grep:"search",WebFetch:"globe",WebSearch:"globe",NotebookEdit:"notebook",Task:"agent",TodoWrite:"checklist",TaskCreate:"list",TaskUpdate:"list",SendMessage:"message",web_search:"globe",mcp_tool_call:"tool"};function Mc(e){return XN[e]||"tool"}function Es(e){return e==="Bash"?"Terminal":e==="Read"?"Read File":e==="Write"?"Write File":e==="Edit"?"Edit File":e==="Glob"?"Find Files":e==="Grep"?"Search Content":e==="WebSearch"?"Web Search":e==="WebFetch"?"Web Fetch":e==="Task"?"Subagent":e==="TodoWrite"?"Tasks":e==="NotebookEdit"?"Notebook":e==="SendMessage"?"Message":e==="web_search"?"Web Search":e==="mcp_tool_call"?"MCP Tool":e.startsWith("mcp:")?e.split(":").slice(1).join(":"):e}function k5({name:e,input:t,toolUseId:n}){const[i,a]=S.useState(e==="Edit"),o=Mc(e),u=Es(e),f=xc(e,t);return e==="Edit"?l.jsx(KN,{input:t,toolUseId:n}):e==="Bash"?l.jsx(ZN,{input:t,toolUseId:n}):l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[l.jsxs("button",{onClick:()=>a(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Nl,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),i&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(JN,{name:e,input:t})})})]})}function KN({input:e,toolUseId:t}){const n=zl(),[i,a]=S.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",f=String(e.old_string||""),h=String(e.new_string||""),p=!!(f||h),g=!!e.replace_all,[x,b]=S.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(E=>({path:typeof E.path=="string"?E.path:"",kind:typeof E.kind=="string"?E.kind:"update"})).filter(E=>E.path),j=(f+h).split(`
60
+ `).length,C=j>15,k=l.jsx(l.Fragment,{children:p?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${C&&!x?"max-h-[240px]":""}`,children:l.jsx(Dl,{oldText:f,newText:h,mode:"compact"})}),C&&!x&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),C&&l.jsx("button",{type:"button",onClick:()=>b(!x),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:x?"Show less":`Show all ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((E,N)=>{const D=E.path.split("/").pop()||E.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${E.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":E.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:E.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:D})]},`${E.path}-${N}`)})}):l.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})});return n?l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(mf,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${g?" (all)":""}`,meta:p?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),i&&l.jsx("div",{className:"mt-0.5",children:k})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),g&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),k]})}function ZN({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=zl(),[o,u]=S.useState(!1);if(a){const f=n.split(`
61
+ `)[0]||"",h=i||f||"Command",p=n?n.split(`
62
+ `).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(mf,{open:o,onToggle:()=>u(!o),marker:"$",label:h,meta:!o&&p>0?`+${p}`:void 0,labelClassName:i?"italic":"font-mono-code"}),o&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function JN({name:e,input:t}){switch(e){case"Bash":return l.jsx(eC,{input:t});case"Edit":return l.jsx(tC,{input:t});case"Write":return l.jsx(nC,{input:t});case"Read":return l.jsx(rC,{input:t});case"Glob":return l.jsx(iC,{input:t});case"Grep":return l.jsx(sC,{input:t});case"WebSearch":case"web_search":return l.jsx(aC,{input:t});case"WebFetch":return l.jsx(lC,{input:t});case"Task":return l.jsx(oC,{input:t});case"TodoWrite":return l.jsx(cC,{input:t});case"NotebookEdit":return l.jsx(uC,{input:t});case"SendMessage":return l.jsx(dC,{input:t});default:return l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function eC({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function tC({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),o=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?l.jsx(Dl,{oldText:n,newText:i,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,f)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function nC({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Dl,{newText:n,fileName:t,mode:"compact"})}function rC({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),i!=null&&l.jsxs("span",{children:["limit: ",i]})]})]})}function iC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function sC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function aC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function lC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function oC({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function cC({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function uC({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),i&&l.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function dC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function xc(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+i;return a.length>60?a.slice(0,60)+"...":a}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function Nl({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const fC=2e3,hC=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),Yr=new Map,qi=new Map,zd=new Map,Sd=new Map,Ns=new Map,ac=new Map,vc=new Map,Od=new Map;function j5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function N5(e){const t=X.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function pC(){const e=X.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let bc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){bc=!0;for(const[e,t]of qi)clearTimeout(t),qi.delete(e)}else{bc=!1;for(const e of pC()){if(!N5(e))continue;const t=Yr.get(e);if(!j5(t)){if(t){try{t.close()}catch{}Yr.delete(e)}Rc(e)}}}});function kd(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const a of n)if(!(!a||a===".")){if(a===".."){i.length>0&&i.pop();continue}i.push(a)}return`${t?"/":""}${i.join("/")}`}function mC(e,t){return e.startsWith("/")||!t?kd(e):kd(`${t}/${e}`)}function gC(e,t){if(!t)return!0;const n=kd(t);return e===n||e.startsWith(`${n}/`)}function xC(e){let t=Od.get(e);return t||(t=new Set,Od.set(e,t)),t}function Rp(e,t){const n=X.getState(),i=xC(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:f}=a;if(f){if(i.has(f))continue;i.add(f)}if(o==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,x)=>({id:String(x+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),Sd.set(e,p.length)}continue}if(o==="TaskCreate"){const h=(Sd.get(e)||0)+1;Sd.set(e,h);const p={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const h=u.taskId;if(h){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,h,p)}}}}function Lp(e,t){var o,u;const n=X.getState(),i=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:p}=f;if((h==="Edit"||h==="Write")&&typeof p.file_path=="string"){const g=mC(p.file_path,i);gC(g,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Zo=new Map,vC=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function Dp(e,t){const n=X.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const a=i.input;if(a.run_in_background===!0){let o=Zo.get(e);o||(o=new Map,Zo.set(e,o)),o.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,o=Zo.get(e),u=o==null?void 0:o.get(a);if(o&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(vC);if(h){const p={taskId:h[1],toolUseId:a,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&Zo.delete(e)}}}}const rd=new Map,Bd=new Map;function zp(e,t){const n=X.getState();let i=Bd.get(e);i||(i=new Set,Bd.set(e,i));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&i.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&i.add(a.id);let u=rd.get(e);u||(u=new Map,rd.set(e,u));const f={toolUseId:a.id,name:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=rd.get(e),f=u==null?void 0:u.get(o);if(u&&f){const h=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(g=>"text"in g?g.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(o),u.size===0&&rd.delete(e)}}}}function zb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function Ob(e){if(e.subtype==="compact_boundary")return`Context compacted (${e.compact_metadata.trigger}, pre-tokens: ${e.compact_metadata.pre_tokens}).`;if(e.subtype==="task_notification"){const t=e.summary?` ${e.summary}`:"";return`Task ${e.status}: ${e.task_id}.${t}`}if(e.subtype==="files_persisted"){const t=e.files.length,n=e.failed.length;return n>0?`Persisted ${t} file(s), ${n} failed.`:`Persisted ${t} file(s).`}if(e.subtype==="hook_started")return`Hook started: ${e.hook_name} (${e.hook_event}).`;if(e.subtype==="hook_response"){const t=typeof e.exit_code=="number"?` (exit ${e.exit_code})`:"";return`Hook ${e.outcome}: ${e.hook_name} (${e.hook_event})${t}.`}return null}let bC=0,yC=0;function oi(){return`msg-${Date.now()}-${++bC}`}function Bb(e){var n;const t=(n=e.errors)!=null&&n.length?e.errors.join(", "):e.result||(e.api_error_status?`API error ${e.api_error_status}`:"The turn ended with an error but no details were provided.");return MN(e)?`${EN}
63
+
64
+ Details: ${t}`:`Error: ${t}`}function _C(e,t){const n=vc.get(e)||[];n.push(t),vc.set(e,n)}function wC(e,t){const n=vc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){vc.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const Di=new Map;function Pb(e,t,n){const i=X.getState(),a=i.messages.get(e)||[],o=ac.get(e);let u=a.filter(h=>!h.isStreaming||h.id===o),f=-1;if(o&&(f=u.findIndex(h=>h.id===o),f===-1&&ac.delete(e)),f===-1){const h=`stream-${e}-${oi()}`;ac.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function Ss(e){ac.delete(e);const t=X.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const $b=new Map,SC=8e3;function dl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=$b.get(e);a&&a.code===t&&i-a.at<SC||($b.set(e,{code:t,at:i}),X.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function C5(){return`cmsg-${Date.now()}-${++yC}`}function $m(){return C5()}const kC=new Set(["user_message","permission_response","interrupt","set_model","set_permission_mode","mcp_get_status","mcp_toggle","mcp_reconnect","mcp_set_servers","set_ai_validation"]);function jC(e){const t=location.protocol==="https:"?"wss:":"ws:",n=localStorage.getItem("companion_auth_token")||"";return`${t}//${location.host}/ws/browser/${e}?token=${encodeURIComponent(n)}`}function E5(e){return`companion:last-seq:${e}`}function Fm(e){const t=zd.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(E5(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return zd.set(e,a),a}catch{return 0}}function Fb(e,t){const n=Math.max(0,Math.floor(t));zd.set(e,n);try{localStorage.setItem(E5(e),String(n))}catch{}}function Ub(e,t){Fn(e,{type:"session_ack",last_seq:t})}function jd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
65
+ `)}function Op(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function NC(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const f of i)a.set(Op(f),f);const o=[],u=new Set;for(const f of n){const h=Op(f);u.has(h)||(u.add(h),o.push(a.get(h)||f))}for(const f of i){const h=Op(f);u.has(h)||(u.add(h),o.push(f))}return o}function Ib(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:xc(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function Um(e,t){const n=NC(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?jd(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function CC(e,t){const n=X.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...i];o[a]=Um(o[a],t),n.setMessages(e,o)}function EC(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=X.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),T5(e,n)}function T5(e,t,n={}){var u,f,h,p,g,x;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=X.getState();if(i&&typeof t.seq=="number"){const b=Fm(e);if(t.seq<=b)return;Fb(e,t.seq),a&&Ub(e,t.seq)}switch(hC.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=b5(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Ss(e),o.setStreaming(e,null),dl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:jd(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=jd(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(Ss(e),CC(e,_),o.setStreaming(e,null),Ns.delete(e),Di.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(f=b.content)!=null&&f.length)for(const j of b.content){if(j.type==="tool_use"){const C=j.input||{};o.addToolActivity(e,Ib(j.id,j.name,C,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=b.content)!=null&&h.length&&(Rp(e,b.content),Lp(e,b.content),Dp(e,b.content),zp(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(Ns.delete(e),Di.delete(e),Ss(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=Di.get(e)||{thinking:"",text:""};Ns.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Di.set(e,_),Ns.set(e,"text"),o.setStreaming(e,_.text),Pb(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Di.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Di.set(e,_),Ns.set(e,"thinking"),o.setStreaming(e,_.thinking),Pb(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Od.delete(e),Bd.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}o.updateSession(e,y),Ss(e),o.setStreaming(e,null),Ns.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&LN(),!document.hasFocus()&&o.notificationDesktop&&zb("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:oi(),role:"system",content:Bb(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;zb("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];Rp(e,y),Lp(e,y),Dp(e,y),zp(e,y)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:oi(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||oi(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=Ob(t.event);if(!b)break;o.appendMessage(e,{id:oi(),role:"system",content:b,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:oi(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:oi(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Ss(e)?dl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):dl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Ss(e)&&dl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Ss(e)?dl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):dl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const C=t.messages[j];if(C.type==="user_message")b.push({id:C.id||oi(),role:"user",content:C.content,timestamp:C.timestamp});else if(C.type==="assistant"){const k=C.message,E=jd(k.content),N={id:k.id,role:"assistant",content:E,contentBlocks:k.content,timestamp:C.timestamp||Date.now(),parentToolUseId:C.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},D=b.findIndex(O=>O.role==="assistant"&&O.id===N.id);if(D===-1?b.push(N):b[D]=Um(b[D],N),(x=k.content)!=null&&x.length){Rp(e,k.content),Lp(e,k.content),Dp(e,k.content),zp(e,k.content);const O=C.timestamp||Date.now();for(const L of k.content){if(L.type==="tool_use"){const G=L.input||{},P=y.get(L.id);y.set(L.id,P??Ib(L.id,L.name,G,O,C.parent_tool_use_id))}if(L.type==="tool_result"){const G=y.get(L.tool_use_id);G&&y.set(L.tool_use_id,{...G,completedAt:O,isError:G.isError||!!L.is_error,elapsedSeconds:Math.max(G.elapsedSeconds,G.completedAt?G.elapsedSeconds:Math.max(0,(O-G.startedAt)/1e3))})}}}}else if(C.type==="result"){const k=C.data;k.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:Bb(k),timestamp:Date.now()});const E={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(E.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(E.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const N of Object.values(k.modelUsage))if(N.contextWindow>0){const D=N,O=Math.round((D.inputTokens+D.outputTokens)/D.contextWindow*100);E.context_used_percent=Math.max(0,Math.min(O,100))}}o.updateSession(e,E)}else if(C.type==="system_event"){const k=Ob(C.event);if(!k)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:C.timestamp||Date.now()})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const C=[...j];for(const k of b){const E=C.findIndex(D=>D.id===k.id);if(E===-1){C.push(k);continue}const N=C[E];N.role==="assistant"&&k.role==="assistant"?C[E]=Um(N,k):C[E]=k}C.sort((k,E)=>(k.timestamp??0)-(E.timestamp??0)),o.setMessages(e,C)}}o.setToolActivity(e,Array.from(y.values()).sort((j,C)=>j.startedAt-C.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(Ss(e),o.setStreaming(e,null),Ns.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=Fm(e);y.seq<=_||(Fb(e,y.seq),b=y.seq,T5(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&Ub(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:oi(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:oi(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Rc(e){const t=Yr.get(e);if(j5(t))return;if(t){try{t.close()}catch{}Yr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(jC(e));Yr.set(e,i),i.onopen=()=>{const a=Fm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),wC(e,i);const o=qi.get(e);o&&(clearTimeout(o),qi.delete(e))},i.onmessage=a=>EC(e,a),i.onclose=()=>{Yr.get(e)===i&&(Yr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),TC(e))},i.onerror=()=>{i.close()}}function TC(e){if(qi.has(e)||bc)return;const t=setTimeout(()=>{qi.delete(e),!bc&&N5(e)&&Rc(e)},fC);qi.set(e,t)}function Im(e){const t=qi.get(e);t&&(clearTimeout(t),qi.delete(e));const n=Yr.get(e);n&&(n.close(),Yr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),Od.delete(e),Bd.delete(e),Zo.delete(e),Sd.delete(e),Ns.delete(e),ac.delete(e),Di.delete(e),zd.delete(e),vc.delete(e)}function AC(e){if(!bc)for(const t of e)t.archived||Rc(t.sessionId)}function MC(e){return new Promise((t,n)=>{const i=setInterval(()=>{const o=Yr.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Fn(e,t){const n=Yr.get(e);let i=t;const a=kC.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":t.client_msg_id||(i={...t,client_msg_id:C5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&_C(e,i)}function Hb(e){Fn(e,{type:"mcp_get_status"})}function RC(e,t,n){Fn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function LC(e,t){Fn(e,{type:"mcp_reconnect",serverName:t})}function DC(e,t){Fn(e,{type:"mcp_set_servers",servers:t})}function zC(e,t){Fn(e,{type:"set_ai_validation",...t})}var ie=typeof window<"u"?window:void 0,Rn=typeof globalThis<"u"?globalThis:ie,In=Rn==null?void 0:Rn.navigator,ke=Rn==null?void 0:Rn.document,Vt=Rn==null?void 0:Rn.location,Vg=Rn==null?void 0:Rn.fetch,Hm=Rn!=null&&Rn.XMLHttpRequest&&"withCredentials"in new Rn.XMLHttpRequest?Rn.XMLHttpRequest:void 0,qb=Rn==null?void 0:Rn.AbortController,OC=Rn==null?void 0:Rn.CompressionStream,er=In==null?void 0:In.userAgent;function A5(){return!(!ie||ie.navigator.onLine===!1)}var Bo=typeof globalThis<"u"?globalThis:ie;Bo&&typeof self>"u"&&(Bo.self=Bo),Bo&&typeof File>"u"&&(Bo.File=function(){});var Oe=ie??{},jt={DEBUG:!1,LIB_VERSION:"0.4.0",LIB_NAME:"browser-common"};function Vb(e,t,n,i,a,o,u){try{var f=e[o](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,a)}function Ut(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function u(h){Vb(o,i,a,u,f,"next",h)}function f(h){Vb(o,i,a,u,f,"throw",h)}u(void 0)}))}}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},he.apply(null,arguments)}function M5(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var Gb=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Yb(e){return typeof e=="string"||e}function Wb(e){return typeof e=="string"?e:void 0}var Po,BC=["$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","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Bi=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Qb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),PC=["$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"],$C=["token"],R5="NativeGzipValidationError",qm=e=>e.length>=2&&e[0]===31&&e[1]===139,Xb=(e,t)=>e===Qb.GZipJS||t===Qb.GZipJS||t==="gzip",Kb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",id=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=R5,t},FC=(function(){var e=Ut((function*(t,n){18>t.size&&id("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());qm(i)&&i[2]===8||id("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Po)return Po;Po=[];for(var g=0;256>g;g++){for(var x=g,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;Po[g]=x>>>0}return Po})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&id("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&id("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Vm(){return Vm=Ut((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(i).then((()=>o.close())).catch((function(){var p=Ut((function*(g){try{yield o.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),h=(yield Promise.all([f,u]))[0];return yield FC(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Vm.apply(this,arguments)}var UC=["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"],Zb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return UC.concat(t).some((i=>{var a=i.toLowerCase();return n.indexOf(a)!==-1}))};function qe(e,t){return e.indexOf(t)!==-1}var gf=function(e){return e.trim()},Gm=function(e){return e.replace(/^\$/,"")};function L5(e){var t,n=[];return(t=JSON.stringify(e,(function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}})))!==null&&t!==void 0?t:"null"}var D5=Object.prototype,z5=D5.hasOwnProperty,xf=D5.toString,Ve=Array.isArray||function(e){return xf.call(e)==="[object Array]"},pr=e=>typeof e=="function",Bt=e=>e===Object(e)&&!Ve(e),Ii=e=>{if(Bt(e)){for(var t in e)if(z5.call(e,t))return!1;return!0}return!1},ye=e=>e===void 0,vt=e=>xf.call(e)=="[object String]",Ym=e=>vt(e)&&e.trim().length===0,Hn=e=>e===null,We=e=>ye(e)||Hn(e),sn=e=>xf.call(e)=="[object Number]"&&e==e,zi=e=>sn(e)&&e>0,Wr=e=>xf.call(e)==="[object Boolean]",IC=e=>e instanceof FormData,HC=e=>qe(PC,e),qC=e=>qe($C,e);function O5(e){return e===null||typeof e!="object"}function Pd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Gg(e){return typeof Event<"u"&&B5(e,Event)}function B5(e,t){try{return e instanceof t}catch{return!1}}var VC=[!0,"true",1,"1","yes"],Bp=e=>qe(VC,e),GC=[!1,"false",0,"0","no"];function ui(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),sn(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),ui(a||n,t,n,i))}class YC{constructor(t){this.tt={},this.et=t.et,this.it=ui(t.bucketSize,0,100,t.rt),this.nt=ui(t.refillRate,0,this.it,t.rt),this.st=ui(t.refillInterval,0,864e5,t.rt)}ot(t,n){var i=Math.floor((n-t.lastAccess)/this.st);i>0&&(t.tokens=Math.min(t.tokens+i*this.nt,this.it),t.lastAccess=t.lastAccess+i*this.st)}consumeRateLimit(t){var n,i=Date.now(),a=String(t),o=this.tt[a];return o?this.ot(o,i):this.tt[a]=o={tokens:this.it,lastAccess:i},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.et)==null||n.call(this,t)),o.tokens===0)}stop(){this.tt={}}}var gr="Mobile",$d="iOS",Hi="Android",Cl="Tablet",P5=Hi+" "+Cl,$5="iPad",F5="Apple",U5=F5+" Watch",lc="Safari",El="BlackBerry",I5="Samsung",H5=I5+"Browser",q5=I5+" Internet",va="Chrome",WC=va+" OS",V5=va+" "+$d,Yg="Internet Explorer",G5=Yg+" "+gr,Wg="Opera",QC=Wg+" Mini",Qg="Edge",Y5="Microsoft "+Qg,kl="Firefox",W5=kl+" "+$d,yc="Nintendo",_c="PlayStation",jl="Xbox",Q5=Hi+" "+gr,X5=gr+" "+lc,Jo="Windows",Wm=Jo+" Phone",Jb="Nokia",Qm="Ouya",K5="Generic",XC=K5+" "+gr.toLowerCase(),Z5=K5+" "+Cl.toLowerCase(),Xm="Konqueror",J5="Oculus Browser",Fd="Vivaldi",ew="Yandex",Ud="Whale",Km="DuckDuckGo",tw="Pale Moon",Id="Waterfox",oc="Brave",nw="Google Search App",Kt="(\\d+(\\.\\d+)?)",Pp=new RegExp("Version/"+Kt),KC=new RegExp(jl,"i"),ZC=new RegExp(_c+" \\w+","i"),JC=new RegExp(yc+" \\w+","i"),Xg=new RegExp(El+"|PlayBook|BB10","i"),e3={"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"},rw=function(e,t,n,i){t=t||"";var a=(function(o){return o!=null&&o.brave?oc:null})(n);return a||(i!=null&&i.detectGoogleSearchApp&&qe(e,"GSA/")?nw:qe(e," OPR/")&&qe(e,"Mini")?QC:qe(e," OPR/")?Wg:Xg.test(e)?El:qe(e,"IE"+gr)||qe(e,"WPDesktop")?G5:qe(e,"OculusBrowser")?J5:qe(e,H5)?q5:qe(e,Qg)||qe(e,"Edg/")?Y5:qe(e,Fd+"/")?Fd:qe(e,"YaBrowser/")?ew:qe(e,Ud+"/")?Ud:qe(e,Km+"/")||qe(e,"Ddg/")?Km:qe(e,"FBIOS")?"Facebook "+gr:qe(e,"UCWEB")||qe(e,"UCBrowser")?"UC Browser":qe(e,"CriOS")?V5:qe(e,"CrMo")||qe(e,va)?va:qe(e,Hi)&&qe(e,lc)?Q5:qe(e,"FxiOS")?W5:qe(e.toLowerCase(),Xm.toLowerCase())?Xm:qe(e,oc+"/")?oc:((o,u)=>u&&qe(u,F5)||(function(f){return qe(f,lc)&&!qe(f,va)&&!qe(f,Hi)})(o))(e,t)?qe(e,gr)?X5:lc:qe(e,"PaleMoon/")?tw:qe(e,Id+"/")?Id:qe(e,kl)?kl:qe(e,"MSIE")||qe(e,"Trident/")?Yg:qe(e,"Gecko")?kl:"")},t3={[G5]:[new RegExp("rv:"+Kt)],[Y5]:[new RegExp(Qg+"?\\/"+Kt)],[va]:[new RegExp("("+va+"|CrMo)\\/"+Kt)],[V5]:[new RegExp("CriOS\\/"+Kt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Kt)],[lc]:[Pp],[X5]:[Pp],[Wg]:[new RegExp("(Opera|OPR)\\/"+Kt)],[kl]:[new RegExp(kl+"\\/"+Kt)],[W5]:[new RegExp("FxiOS\\/"+Kt)],[Xm]:[new RegExp("Konqueror[:/]?"+Kt,"i")],[El]:[new RegExp(El+" "+Kt),Pp],[Q5]:[new RegExp("android\\s"+Kt,"i")],[q5]:[new RegExp(H5+"\\/"+Kt)],[J5]:[new RegExp("OculusBrowser\\/"+Kt)],[Fd]:[new RegExp(Fd+"\\/"+Kt)],[ew]:[new RegExp("YaBrowser\\/"+Kt)],[Ud]:[new RegExp(Ud+"\\/"+Kt)],[oc]:[new RegExp(oc+"\\/"+Kt)],[Km]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Kt)],[tw]:[new RegExp("PaleMoon\\/"+Kt)],[Id]:[new RegExp(Id+"\\/"+Kt)],[nw]:[new RegExp("GSA\\/"+Kt)],[Yg]:[new RegExp("(rv:|MSIE )"+Kt)],Mozilla:[new RegExp("rv:"+Kt)]},n3=function(e,t,n,i){var a=rw(e,t,n,i),o=t3[a];if(ye(o))return null;for(var u=0;o.length>u;u++){var f=e.match(o[u]);if(f)return parseFloat(f[f.length-2])}return null},ey=[[new RegExp(jl+"; "+jl+" (.*?)[);]","i"),e=>[jl,e&&e[1]||""]],[new RegExp(yc,"i"),[yc,""]],[new RegExp(_c,"i"),[_c,""]],[Xg,[El,""]],[new RegExp(Jo,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Wm,""];if(new RegExp(gr).test(t)&&!/IEMobile\b/.test(t))return[Jo+" "+gr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=e3[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Jo,i]}return[Jo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[$d,[e[3],e[4],e[5]||"0"].join(".")]:[$d,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ye(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hi+")","i"),e=>e&&e[2]?[Hi,[e[2],e[3],e[4]||"0"].join(".")]:[Hi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[WC,""]],[/Linux|debian/i,["Linux",""]]],ty=function(e){return JC.test(e)?yc:ZC.test(e)?_c:KC.test(e)?jl:new RegExp(Qm,"i").test(e)?Qm:new RegExp("("+Wm+"|WPDesktop)","i").test(e)?Wm:/iPad/.test(e)?$5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?U5:Xg.test(e)?El:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Jb,"i").test(e)?Jb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(gr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Hi:P5:new RegExp("(pda|"+gr+")","i").test(e)?XC:new RegExp(Cl,"i").test(e)&&!new RegExp(Cl+" pc","i").test(e)?Z5:""},r3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ny(e,t){return typeof(n=e)=="string"&&r3.test(n)?e:t();var n}function Ts(e){return e&&e.split("#")[0]}function Kg(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function ry(e,t,n){return iw.apply(this,arguments)}function iw(){return(iw=Ut((function*(e,t,n){var i;try{return yield Promise.race([e,new Promise(((a,o)=>{i=Kg((()=>{try{n==null||n(),a()}catch(u){o(u)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var i3=e=>e instanceof Error,sw={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}},s3=sw.info;function aw(e){if(Wr(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(Ve(e))return{arrayValue:{values:e.map((t=>aw(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Hd(e){var t=[];for(var n in e){var i=e[n];Hn(i)||ye(i)||t.push({key:n,value:aw(i)})}return t}function a3(e,t){var n=sw[e.level||"info"]||s3,i=n.text,a=n.number,o=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),We(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),We(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=he({},u,e.attributes||{}),h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:e.body},attributes:Hd(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),ye(e.trace_flags)||(h.flags=e.trace_flags),h}function lw(e,t,n){return he({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function ow(e,t,n,i){return{resourceLogs:[{resource:{attributes:Hd(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}let l3=class{constructor(e,t,n,i,a,o,u){var f;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.Ne=t,this.rt=n,this.ut=i,this.ht=a,this.dt=o,this.vt=u,this.ct=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.kt=t.maxBufferSize,this.xt=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.St=t.flushIntervalMs,this.Ct=t.maxBatchRecordsPerPost,this.Mt=t.rateCapWindowMs,this.Tt=t.maxLogsPerInterval}reset(){this.Et(),this.ct=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ne.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.It()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.Pt(e);if(t!==null)if(t.body){if(this.Rt()){var n={record:a3(t,this.ut())};this.ht((()=>this.At(n)))}}else this.rt.info("Log was rejected in beforeSend function")}}Pt(e){var t=this.Ne.beforeSend;if(!t)return e;var n=Ve(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.rt.info("Log was rejected in beforeSend function"),null;i=o}catch(u){return this.rt.error("Error in beforeSend function for log:",u),null}return i}Rt(){if(this.Tt===void 0)return!0;var e=Date.now(),t=e-this.bt;return this.Mt>t&&t>=0||(this.bt=e,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.rt.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var e=this;return Ut((function*(){if(!e._instance.isDisabled)return e.ct||(e.ct=e.Ft().finally((()=>{e.ct=null}))),e.ct}))()}Ft(){var e=this;return Ut((function*(){var t;e.Et();var n=(t=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var i=n.length,a=0;n.length>0&&i>a;){var o,u;e.ft=0;var f=Math.min(n.length,e.Ct),h=n.slice(0,f),p=ow(h.map((x=>x.record)),e.Lt(),(o=e.vt)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.Ot(p);if(g.kind==="too-large"&&h.length>1)e.Ct=Math.max(1,Math.floor(h.length/2)),e.rt.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Ct);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.rt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):g.kind==="ok"&&e.Ne.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Ne.maxBatchRecordsPerPost,e.Ct+1)),yield e.Dt(h.length),n=(u=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,g.kind==="fatal"))throw g.error}}))()}Dt(e){var t=this;return Ut((function*(){var n,i=Math.max(0,e-t.ft),a=(n=t._instance.getPersistedProperty(Bi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Bi.LogsQueue,a.slice(i)),yield t.dt()}))()}Lt(){return lw(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion())}At(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];this.xt>n.length||(n.shift(),this.ft++,this.rt.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Bi.LogsQueue,n),this.kt>n.length?this.$t():this.It()}}$t(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=Kg((()=>{this.Nt=void 0,this.It()}),e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(Bi.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ut((function*(){t.Et();var n=t.flush().catch((()=>{}));e!==void 0?yield ry(n,e):yield n}))()}flushWithTimeout(e){var t=this;return Ut((function*(){var n=t.flush();yield ry(n,e,(()=>{n.catch((()=>{}))}))}))()}It(){this.flush().then((()=>{this.yt=0}),(e=>{this.yt++,this.rt.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.$t(this.qt())}))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var $p=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function iy(e){return String(e)+"000000"}function sy(e,t,n,i){var a="";return i&&(a=Object.keys(i).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(i[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let o3=class{constructor(e,t,n){this._instance=e,this.Ne=t,this.rt=n,this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Wt=0}count(e,t,n){t===void 0&&(t=1),this.Vt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Vt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Vt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.ct,n=(function(){var a=Ut((function*(){t&&(yield t.catch((()=>{}))),yield e.Zt()}));return function(){return a.apply(this,arguments)}})(),i=n().finally((()=>{this.ct===i&&(this.ct=null)}));return this.ct=i,i}drainWindow(){if(this.Bt.size===0)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Wt++,this.Et(),this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Vt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Pt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.rt.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,i;try{n=t.attributes?he({},t.attributes):void 0,i=sy(t.type,t.name,t.unit,n)}catch(u){return void this.rt.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.Bt.get(i);if(!a){if(!this.Qt())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(i,a)}var o=this.Ut.get(t.name);o===void 0?this.Ut.set(t.name,t.type):o===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.rt.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Kt(a,t.value),this.$t()}else this.rt.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.rt.warn("Dropping metric with empty name")}}Qt(){return this.Ne.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.rt.warn("Metric series cap reached ("+this.Ne.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Kt(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array($p.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,$p)]+=1}}Pt(e){var t=this.Ne.beforeSend;if(!t)return e;var n=Ve(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.rt.info("Metric was rejected in beforeSend function"),null;i=o}catch(u){return this.rt.error("Error in beforeSend function for metric:",u),null}return i}$t(){this.Nt||(this.Nt=Kg((()=>{this.Nt=void 0,this.flush().catch((e=>{this.rt.error("Metrics flush failed:",e)}))}),this.Ne.flushIntervalMs))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var e=this;return Ut((function*(){if(e.Bt.size!==0){var t=e.Bt;e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set;var n=e.Wt,i=yield e._instance.Jt(e.Gt(t));if(n===e.Wt)switch(i.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.$t();case"too-large":return void e.rt.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.rt.error("Failed to send metrics batch:",i.error)}}}))()}Gt(e){return t=this.Xt(e),n=(function(o,u,f){return he({},o.resourceAttributes,{"service.name":o.serviceName||"unknown_service"},o.environment&&{"deployment.environment":o.environment},o.serviceVersion&&{"service.version":o.serviceVersion},{"telemetry.sdk.name":u,"telemetry.sdk.version":f})})(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Hd(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}Xt(e){var t=iy(Date.now()),n=new Map;for(var i of e.values()){var a,o=sy(i.type,i.name,i.unit,void 0),u=n.get(o);u||(u=he({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var f=Hd((a=i.attributes)!==null&&a!==void 0?a:{}),h=iy(i.windowStartMs);if(i.type==="count"){var p,g={attributes:f,startTimeUnixNano:h,timeUnixNano:t,asDouble:(p=i.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(g)}else if(i.type==="gauge"){var x,b={attributes:f,timeUnixNano:t,asDouble:(x=i.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else i.hist&&u.histogram.dataPoints.push({attributes:f,startTimeUnixNano:h,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:$p})}return Array.from(n.values())}Yt(e){var t,n;for(var i of e){var a=i[0],o=i[1],u=this.Bt.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.type){case"count":u.total=((t=u.total)!==null&&t!==void 0?t:0)+((n=o.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(var f=0;u.hist.bucketCounts.length>f;f++)u.hist.bucketCounts[f]+=o.hist.bucketCounts[f]}else u.hist=o.hist}else this.Qt()&&this.Bt.set(a,o)}}};var sd,ay,Fp;function c3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Fp&&n.length===ay||(ay=n.length,Fp=n.reduce(((i,a)=>{sd||(sd={});var o=sd[a];if(o)i[o[0]]=o[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[a];if(p&&g){i[p]=g,sd[a]=[p,g];break}}return i}),{})),Fp}}class u3{constructor(t,n,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}buildFromUnknown(t,n){n===void 0&&(n={});var i=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(i,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return Ut((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Ve(i.stacktrace.frames)&&(i.stacktrace.frames=yield n.applyModifiers(i.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 i,a;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),he({},t,{cause:i,stack:a})}applyChunkIds(t,n){return t.map((i=>(i.filename&&n&&(i.chunk_id=n[i.filename]),i)))}applyCoercers(t,n){for(var i of this.coercers)if(i.match(t))return i.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Ut((function*(){var i=t;for(var a of n.modifiers)i=yield a(i);return i}))()}convertToExceptionList(t,n){var i,a,o,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(o=t.synthetic)!==null&&o!==void 0&&o}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,he({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:c3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var a=(o,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,f)}};return he({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,i),next:o=>a(o,i+1)})}}var Tl="?";function Zm(e,t,n,i,a){var o={platform:e,filename:t,function:n==="<anonymous>"?Tl:n,in_app:!0};return ye(i)||(o.lineno=i),ye(a)||(o.colno=a),o}var cw=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:Tl,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},d3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,f3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,h3=/\((\S*)(?::(\d+))(?::(\d+))\)/,p3=(e,t)=>{var n=d3.exec(e);if(n)return Zm(t,n[1],Tl,+n[2],+n[3]);var i=f3.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=h3.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var o=cw(i[1]||Tl,i[2]);return Zm(t,o[1],o[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},m3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,g3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,x3=(e,t)=>{var n=m3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=g3.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var a=n[3],o=n[1]||Tl,u=cw(o,a);return Zm(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ly=/\(error: (.*)\)/;class v3{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=vt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?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 Pd(t,"DOMException")}isDOMError(t){return Pd(t,"DOMError")}}class b3{match(t){return(function(n){switch({}.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return B5(n,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 i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class y3{constructor(){}match(t){return!!Pd(t,"ErrorEvent")&&(t.error!=null||this.fe(t))}coerce(t,n){var i;if(t.error!=null)return n.apply(t.error);var a=n.apply(t.message);return he({},a,{stack:(i=this.pe(t))!==null&&i!==void 0?i:a.stack,synthetic:!0})}fe(t){return vt(t.message)&&t.message.length>0}pe(t){var n=t;if(vt(n.filename)&&n.filename.length>0){var i,a,o=(i=n.lineno)!==null&&i!==void 0?i:0,u=(a=n.colno)!==null&&a!==void 0?a:0;return`Error
66
+ at `+n.filename+":"+o+":"+u}}}var _3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class w3{match(t){return typeof t=="string"}coerce(t,n){var i,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,a=t.match(_3);return a&&(n=a[1],i=a[2]),[n,i]}}var S3=["fatal","error","warning","log","info","debug"];function uw(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class k3{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,a,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(i=this.getStack(t))!==null&&i!==void 0?i:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Gg(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 i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+uw(t)}isSeverityLevel(t){return vt(t)&&!Ym(t)&&S3.indexOf(t)>=0}getStack(t){try{return vt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:vt(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(i3(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class j3{match(t){return Gg(t)}coerce(t,n){var i,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+uw(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class N3{match(t){return O5(t)}coerce(t,n){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class C3{match(t){return Pd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Gg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i,a=this.getUnhandledRejectionReason(t);return O5(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(a)}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 qd="$message",Vd="$timestamp",E3=new Set([qd,Vd]),Up={enabled:!0,max_bytes:32768};function Gd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Up.enabled,max_bytes:A3(e.max_bytes,Up.max_bytes)}:he({},Up)}class T3{constructor(t){this.Ke=[],this.Je=0,this.Ne=Gd(t)}setConfig(t){this.Ne=Gd(t),this.Xe()}add(t){var n=(function(a){var o;try{o=L5(a)}catch{return}try{var u=JSON.parse(o);if(!Bt(u))return;var f=u,h=f[qd],p=f[Vd];return!vt(h)||h.trim().length===0||!vt(p)&&!sn(p)?void 0:{step:f,json:o}}catch{return}})(t);if(n){var i=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,f=0;o.length>f;f++)o[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.Ne.max_bytes||(this.Ke.push({step:n.step,bytes:i}),this.Je+=i,this.Xe())}}getAttachable(){return this.Ke.map((t=>t.step))}clear(){this.Ke=[],this.Je=0}size(){return this.Ke.length}Xe(){for(;this.Je>this.Ne.max_bytes&&this.Ke.length>0;){var t=this.Ke.shift();t&&(this.Je-=t.bytes)}}}function A3(e,t){if(!sn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var dw=function(e,t){var n=(t===void 0?{}:t).debugEnabled,i={k(a){if(ie&&(jt.DEBUG||ie.POSTHOG_DEBUG||n)&&!ye(ie.console)&&ie.console){for(var o=("__rrweb_original__"in ie.console[a])?ie.console[a].__rrweb_original__:ie.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];o(e,...f)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("error",...o)},critical(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];console.error(e,...o)},uninitializedWarning(a){i.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>dw(e+" "+a,o)};return i},we=dw("[PostHog.js]"),Wt=we.createLogger,M3=Wt("[ExternalScriptsLoader]"),Ip=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return M3.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=ke==null?void 0:ke.querySelectorAll("script");if(i){for(var a,o=function(){if(i[u].src===t){var h=i[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;i.length>u;u++)if(a=o())return a.v}var f=()=>{if(!ke)return n("document not found");var h=ke.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=x=>{h.__posthog_loading_callback_fired=!0,n(void 0,x)},h.onerror=x=>n(x),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")ke.head.appendChild(h);else{var p,g=ke.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):ke.body.appendChild(h)}};ke!=null&&ke.body?f():ke==null||ke.addEventListener("DOMContentLoaded",f)};Oe.__PosthogExtensions__=Oe.__PosthogExtensions__||{},Oe.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var i;if(e.config.strict_script_versioning)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var a="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var o=3e5;a=a+"&t="+Math.floor(Date.now()/o)*o}i=e.requestRouter.endpointFor("assets",a)}Ip(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Ip(e,u,n)}},Oe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);Ip(e,i,n)};jt.DEBUG=!1,jt.LIB_VERSION="1.413.3",jt.LIB_NAME="web";var fw="$people_distinct_id",wc="$device_id",Hp="$device_model",ec="__alias",tc="__timers",Jm="$autocapture_disabled_server_side",eg="$heatmaps_enabled_server_side",tg="$exception_capture_enabled_server_side",ng="$error_tracking_suppression_rules",rg="$error_tracking_capture_extension_exceptions",ig="$web_vitals_enabled_server_side",Zg="$dead_clicks_enabled_server_side",Jg="$product_tours_enabled_server_side",sg="$web_vitals_allowed_metrics",xa="$session_recording_remote_config",hw="$replay_sample_rate",pw="$replay_override_sampling",mw="$replay_override_linked_flag",gw="$replay_override_url_trigger",xw="$replay_override_event_trigger",wl="$sesid",ex="$session_is_sampled",ga="$enabled_feature_flags",Nd="$active_feature_flags",nc="$early_access_features",ag="$feature_flag_details",Cd="$feature_flag_payloads",lg="$feature_flag_request_id",Yd="$minimal_flag_called_events",Oi="$override_feature_flags",vl="$override_feature_flag_payloads",fa="$stored_person_properties",ha="$stored_group_properties",og="$surveys",Wd="$surveys_loaded_at",cg="$surveys_activated",Ed="$surveys_activated_session",Td="$surveys_activated_timestamps",rc="ph_product_tours",cc="$flag_call_reported",ug="$flag_call_reported_session_id",dg="$feature_flag_errors",Sc="$feature_flag_evaluated_at",zr="$user_state",fg="$client_session_props",hg="$capture_rate_limit",pg="$initial_campaign_params",mg="$initial_referrer_info",Qd="$initial_person_info",Xd="$epp",ad="$posthog_cookieless",vw="$cookieless_mode",bw="$sdk_debug_extensions_init_method",yw="$sdk_debug_extensions_init_time_ms",_w="$sdk_debug_recording_script_not_loaded",tx="PostHog loadExternalDependency extension not found.",pa="on_reject",$i="always",fl="anonymous",ia="identified",gg="identified_only",Kd="visibilitychange",Zd="beforeunload",bl="$pageview",qp="$pageleave",Vp="$identify",oy="$groupidentify";function ld(e,t){Ve(e)&&e.forEach(t)}function Rt(e,t){if(!We(e))if(Ve(e))e.forEach(t);else if(IC(e))e.forEach(((i,a)=>t(i,a)));else for(var n in e)z5.call(e,n)&&t(e[n],n)}var Ot=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function Ad(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var cy=function(e){try{return e()}catch{return}},R3=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(a){we.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),we.critical(a)}}},nx=function(e){var t={};return Rt(e,(function(n,i){(vt(n)&&n.length>0||sn(n))&&(t[i]=n)})),t},L3=["herokuapp.com","vercel.app","netlify.app"];function D3(e){var t=e==null?void 0:e.hostname;if(!vt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of L3)if(n===i)return!1;return!0}function Gt(e,t,n,i){var a=i??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function ww(e){return e.name==="ph_toolbar_internal"}var Sw=e=>{if(ke){try{for(var t=e+"=",n=ke.cookie.split(";").filter((o=>o.length)),i=0;n.length>i;i++){for(var a=n[i];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return sn(e)&&isFinite(e)&&Math.floor(e)===e});class Jd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new Jd(o)}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 Jd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}}class z3{generate(){var t=this.generateOrAbort();if(!ye(t))return t;this.S=0;var n=this.generateOrAbort();if(ye(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.I++,this.I>4398046511103&&(this.S++,this.C())}return Jd.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.A.nextUint32())}C(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}constructor(){this.S=0,this.I=0,this.A=new O3}}var uy,kw=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ie&&!ye(ie.crypto)&&crypto.getRandomValues&&(kw=e=>crypto.getRandomValues(e));class O3{nextUint32(){return this.R.length>this.O||(kw(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Pi=()=>B3().toString(),B3=()=>(uy||(uy=new z3)).generate(),$o="",P3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fi={N:()=>!!ke,j(e){we.error("cookieStore error: "+e)},P:Sw,H(e){var t;try{t=JSON.parse(Fi.P(e))||{}}catch{}return t},F(e,t,n,i,a){if(!ke)return!1;try{var o="",u="",f=(function(g,x){if(x){var b=(function(_,j){if(j===void 0&&(j=ke),$o)return $o;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var C=_.split("."),k=Math.min(C.length,8),E="dmn_chk_"+Pi();!$o&&k--;){var N=C.slice(k).join("."),D=E+"=1;domain=."+N+";path=/";j.cookie=D+";max-age=3",j.cookie.includes(E)&&(j.cookie=D+";max-age=0",$o=N)}return $o})(g);if(!b){var y=(_=>{var j=_.match(P3);return j?j[0]:""})(g);y!==b&&we.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(ke.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),o="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&we.warn("cookieStore warning: large cookie, len="+p.length),ke.cookie=p,!0}catch{return!1}},q(e,t){if(ke!=null&&ke.cookie)try{Fi.F(e,"",-1,t)}catch{return}}},Gp=null,zt={N(){if(!Hn(Gp))return Gp;var e=!0;if(ye(ie))e=!1;else try{var t="__mplssupport__";zt.F(t,"xyz"),zt.P(t)!=='"xyz"'&&(e=!1),zt.q(t)}catch{e=!1}return e||we.error("localStorage unsupported; falling back to cookie store"),Gp=e,e},j(e){we.error("localStorage error: "+e)},P(e){try{return ie==null?void 0:ie.localStorage.getItem(e)}catch(t){zt.j(t)}return null},H(e){try{return JSON.parse(zt.P(e))||{}}catch{}return null},F(e,t){try{return ie==null||ie.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){zt.j(n)}return!1},q(e){try{ie==null||ie.localStorage.removeItem(e)}catch(t){zt.j(t)}}},$3=[wc,"distinct_id",wl,ex,Xd,Qd,zr],od={},F3={N:()=>!0,j(e){we.error("memoryStorage error: "+e)},P:e=>od[e]||null,H:e=>od[e]||null,F:(e,t)=>(od[e]=t,!0),q(e){delete od[e]}},sa=null,Zt={N(){if(!Hn(sa))return sa;if(sa=!0,ye(ie))sa=!1;else try{var e="__support__";Zt.F(e,"xyz"),Zt.P(e)!=='"xyz"'&&(sa=!1),Zt.q(e)}catch{sa=!1}return sa},j(e){we.error("sessionStorage error: ",e)},P(e){try{return ie==null?void 0:ie.sessionStorage.getItem(e)}catch(t){Zt.j(t)}return null},H(e){try{return JSON.parse(Zt.P(e))||null}catch{}return null},F(e,t){try{return ie==null||ie.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Zt.j(n)}return!1},q(e){try{ie==null||ie.sessionStorage.removeItem(e)}catch(t){Zt.j(t)}}};class U3{constructor(t){this._instance=t}get Ne(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Ne.cookieless_mode===$i||this.isRejected()||this.consent===-1&&this.Ne.cookieless_mode===pa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ne.opt_out_capturing_by_default}optInOut(t){this.ii.F(this.ri,t?1:0,this.Ne.cookie_expiration,this.Ne.cross_subdomain_cookie,this.Ne.secure_cookie)}reset(){this.ii.q(this.ri,this.Ne.cross_subdomain_cookie)}get ri(){var t=this._instance.config,n=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+n:"__ph_opt_in_out_"+n)}get ei(){var t=this.ii.P(this.ri);return Bp(t)?1:qe(GC,t)?0:-1}get ii(){var t=this.Ne.opt_out_capturing_persistence_type,n=t==="localStorage"?zt:Fi;if(!this.ni||this.ni!==n){this.ni=n;var i=t==="localStorage"?Fi:zt;i.P(this.ri)&&(this.ni.P(this.ri)||this.optInOut(Bp(i.P(this.ri))),i.q(this.ri,this.Ne.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Ne.respect_dnt&&[In==null?void 0:In.doNotTrack,In==null?void 0:In.msDoNotTrack,Oe.doNotTrack].some((t=>Bp(t)))}}function jw(e,t){var n,i=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!pr(i))return t;try{var a=i(t);return vt(a)&&a?a:t}catch(o){return we.error("Error in get_current_url, falling back to window.location.href",o),t}}var Nw="__POSTHOG_TOOLBAR__",I3=1,H3=3,q3=11;function dy(e){return e instanceof Element&&(e.id===Nw||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function As(e){return!!e&&e.nodeType===I3}function mr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Cw(e){return!!e&&e.nodeType===H3}function Ew(e){return!!e&&e.nodeType===q3&&As(e.host)}var Tw=1e3;function rx(e){return e?gf(e).split(/\s+/):[]}function fy(e,t){var n=(function(i){var a,o=ie==null||(a=ie.location)==null?void 0:a.href;return ye(o)?void 0:jw(i,o)})(t);return!!(n&&e&&e.some((i=>n.match(i))))}function ef(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return rx(t)}function Aw(e){return We(e)?null:gf(e).split(/(\s+)/).filter((t=>uc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function kc(e){var t="";return vg(e)&&!Dw(e)&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;Cw(n)&&n.textContent&&(t+=(i=Aw(n.textContent))!==null&&i!==void 0?i:"")})),gf(t)}function Yp(e){var t;return ye(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var ix=["a","button","form","input","select","textarea","label"];function xg(e,t){if(ye(t))return!0;var n,i=function(o){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(o,u))))return{v:!0}};for(var a of e)if(n=i(a))return n.v;return!1}function Mw(e){var t=e.parentNode;return!(!t||!As(t))&&t}var V3=[".ph-no-autocapture","[data-ph-no-autocapture]"],Rw=["next","previous","prev",">","<"],G3=[...Rw,"+","-","−","–"],hy=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,py=[".ph-no-rageclick",".ph-no-capture"],Y3=["","text","search","email","password","url","tel","number"];function my(e,t){if(!ie||sx(e))return!1;var n,i,a,o,u;if(Wr(t)?(n=!!t&&py,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:py,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!As(h))&&(!!mr(h,"textarea")||(mr(h,"input")?qe(Y3,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var g=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return g==="true"||g===""})(h)))})(e))return!1;var f=Lw(e,!1).targetElementList;return!(function(h,p){if(h===!1||ye(h))return!1;var g;if(h===!0)g=Rw;else{if(!Ve(h))return!1;if(h.length>10)return we.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return g.some((_=>hy(b,_)||hy(y,_)))}))})(i,f.map((h=>{var p;return{safeText:kc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!xg(f,n)}var sx=e=>!e||mr(e,"html")||!As(e),Lw=(e,t)=>{if(!ie||sx(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],a=e;a.parentNode&&!mr(a,"body");)if(Ew(a.parentNode))i.push(a.parentNode.host),a=a.parentNode.host;else{var o=Mw(a);if(!o)break;if(t||ix.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=ie.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function vg(e){for(var t=new Set,n=0,i=e;i.parentNode&&!mr(i,"body");i=i.parentNode){if(n++>=Tw||t.has(i))return!1;t.add(i);var a=ef(i);if(qe(a,"ph-sensitive")||qe(a,"ph-no-capture"))return!1}if(qe(ef(e),"ph-include"))return!0;var o=e.type||"";if(vt(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!vt(u)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(u.replace(/[^a-zA-Z0-9]/g,""))}function Dw(e){return!!(mr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||mr(e,"select")||mr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var gy=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}))$"),xy=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,W3=[16,15,14,13],Q3=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),vy=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),by=/[0-9A-Za-z_]/;function X3(e){for(var t=0,n=!1,i=e.length-1;i>=0;i--){var a=e.charCodeAt(i)-48;n&&(a*=2)>9&&(a-=9),t+=a,n=!n}return t%10==0}function uc(e,t){if(t===void 0&&(t=!0),We(e))return!1;if(vt(e)){e=gf(e);var n=t?gy.test((e||"").replace(/[- ]/g,"")):(function(a){var o;for(xy.lastIndex=0;o=xy.exec(a);){var u=o[2];if(u)for(var f=u.replace(/[- ]/g,""),h=0;f.length>h;h++)for(var p of W3){var g=h+p;if(f.length>=g){var x=f.slice(h,g);if(gy.test(x)&&X3(x))return!0}}}return!1})(e);if(n)return!1;var i=t?Q3.test(e):(function(a){var o;for(vy.lastIndex=0;o=vy.exec(a);){var u=o[1],f=o[3];if(!(u&&f&&by.test(u)&&by.test(f)))return!0}return!1})(e);if(i)return!1}return!0}function yy(e){var t=kc(e);return uc(t=(t+" "+zw(e)).trim())?t:""}function zw(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;if(n&&((i=n.tagName)==null?void 0:i.toLowerCase())==="span")try{var a=kc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+zw(n)).trim())}catch(o){we.error("[AutoCapture]",o)}})),t}function _y(e){return e.replace(/"|\\"/g,'\\"')}function K3(e){var t=e.attr__class;if(t)return Ve(t)?t:rx(t)}var cd=Wt("[Dead Clicks]"),Z3=()=>!0,J3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Zg)),i=e.instance.config.capture_dead_clicks;return Wr(i)?i:!!Bt(i)||n};class wy{get lazyLoadedDeadClicksAutocapture(){return this.si}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Zg]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.ai((()=>{this.oi()})):this.stop()}ai(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?cd.error("failed to load script",a):t()}))}oi(){var t;if(ke){if(!this.si&&(t=Oe.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Bt(this.instance.config.capture_dead_clicks)?he({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.si=Oe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.si.start(ke),cd.info("starting...")}}else cd.error("`document` not found. Cannot start.")}stop(){this.si&&(this.si.stop(),this.si=void 0,cd.info("stopping..."))}}var Wp=Wt("[SegmentIntegration]"),Ow="posthog-js";function Bw(e,t){var n=t===void 0?{}:t,i=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,f=u===void 0?["error"]:u,h=n.sendExceptionsToPostHog,p=h===void 0||h;return g=>{var x,b,y,_,j;if(f!=="*"&&!f.includes(g.level)||!e.__loaded)return g;g.tags||(g.tags={});var C=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());g.tags["PostHog Person URL"]=C,e.sessionRecordingStarted()&&(g.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var k,E=((x=g.exception)==null?void 0:x.values)||[],N=E.map((O=>he({},O,{stacktrace:O.stacktrace?he({},O.stacktrace,{type:"raw",frames:(O.stacktrace.frames||[]).map((L=>he({},L,{platform:"web:javascript"})))}):void 0}))),D={$exception_message:((b=E[0])==null?void 0:b.value)||g.message,$exception_type:(y=E[0])==null?void 0:y.type,$exception_level:g.level,$exception_list:N,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:((_=E[0])==null?void 0:_.value)||g.message,$sentry_exception_type:(j=E[0])==null?void 0:j.type,$sentry_tags:g.tags};return i&&a&&(D.$sentry_url=(o||"https://sentry.io/organizations/")+i+"/issues/?project="+a+"&query="+g.event_id),p&&((k=e.exceptions)==null||k.sendExceptionEvent(D)),g}}class e4{constructor(t,n,i,a,o,u){this.name=Ow,this.setupOnce=function(f){f(Bw(t,{organization:n,projectId:i,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class Sy{constructor(t){this.li=(n,i,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(we.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hi()}hi(){var t;this.di=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.li)}destroy(){var t;(t=this.di)==null||t.call(this),this.di=void 0}doPageView(t,n){var i,a=this.vi(t,n);return this.ui={pathname:(i=ie==null?void 0:ie.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.vi(t,(n=this.ui)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ui)==null?void 0:t.pageViewId}}vi(t,n){var i=this.ui;if(!i)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:i.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,f=o.lastScrollY,h=o.maxScrollY,p=o.maxContentHeight,g=o.lastContentY,x=o.maxContentY;if(!(ye(u)||ye(f)||ye(h)||ye(p)||ye(g)||ye(x))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),x=Math.ceil(x);var b=u>1?ui(f/u,0,1,we):1,y=u>1?ui(h/u,0,1,we):1,_=p>1?ui(g/p,0,1,we):1,j=p>1?ui(x/p,0,1,we):1;a=Ot(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:x,$prev_pageview_max_content_percentage:j})}}return i.pathname&&(a.$prev_pageview_pathname=i.pathname),i.timestamp&&(a.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),a}}var Qp=["flags","surveys"],t4={[fw]:{exposure:"hidden"},[ec]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[tc]:{exposure:"hidden"},[Jm]:{exposure:"event"},[eg]:{exposure:"hidden"},[tg]:{exposure:"event"},[ng]:{exposure:"hidden"},[rg]:{exposure:"event"},[ig]:{exposure:"event"},[Zg]:{exposure:"event"},[Jg]:{exposure:"hidden"},[sg]:{exposure:"event"},[xa]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[wl]:{exposure:"hidden"},[ex]:{exposure:"event"},[hw]:{exposure:"event",shouldSkipFromEventProperties:e=>Hn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[ga]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Bt(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[Nd]:{exposure:"event",storageGroup:"flags"},[nc]:{exposure:"hidden"},[ag]:{exposure:"hidden",storageGroup:"flags"},[Cd]:{exposure:"event",storageGroup:"flags"},[lg]:{exposure:"event",storageGroup:"flags",volatile:!0},[Yd]:{exposure:"hidden",storageGroup:"flags"},[Oi]:{exposure:"event"},[vl]:{exposure:"hidden"},[fa]:{exposure:"hidden"},[ha]:{exposure:"hidden"},[og]:{exposure:"hidden",storageGroup:"surveys"},[Wd]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[cg]:{exposure:"event"},[Ed]:{exposure:"hidden"},[Td]:{exposure:"hidden"},[rc]:{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"},[cc]:{exposure:"hidden"},[ug]:{exposure:"hidden"},[dg]:{exposure:"hidden"},[Sc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[zr]:{exposure:"hidden"},[fg]:{exposure:"hidden"},[hg]:{exposure:"hidden"},[pg]:{exposure:"hidden"},[mg]:{exposure:"hidden"},[Qd]:{exposure:"hidden"},[Xd]:{exposure:"hidden"},[pw]:{exposure:"event"},[mw]:{exposure:"event"},[gw]:{exposure:"event"},[xw]:{exposure:"event"},[bw]:{exposure:"event"},[yw]:{exposure:"event"},[_w]:{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"}},n4=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],aa=e=>{var t=t4[e];if(t)return t;for(var n of n4){var i=n[1];if(e.indexOf(n[0])===0)return i}},Sl=(e,t)=>{try{return JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t)}catch{return L5(e)}},tf=e=>{var t=ke==null?void 0:ke.createElement("a");return ye(t)?null:(t.href=e,t)},Al=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;i.length>a;a++){var o=i[a].split("=");if(o[0]===t){n=o;break}}if(!Ve(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{we.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},jc=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],f=o[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var x=h[g].split("=");Ve(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(h[g]))}var b=f;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},nf=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Pw=(e,t)=>e>=t&&A5(),$w=(e,t,n,i)=>{if(e===0){if(A5()){var a=t+1;return a===n&&i(),a}return t}return 0},ud="https?://(.*)",Ml=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],r4=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ml],Nc="<masked>",i4=["li_fat_id"];function Fw(e,t,n){if(!ke)return{};var i,a=t?[...Ml,...n||[]]:[],o=Uw(jc(ke.URL,a,Nc),e),u=(i={},Rt(i4,(function(f){var h=Sw(f);i[f]=h||null})),i);return Ot(u,o)}function Uw(e,t){var n=r4.concat(t||[]),i={};return Rt(n,(function(a){var o=Al(e,a);i[a]=o||null})),i}function Iw(e){var t=(function(o){return o?o.search(ud+"google.([^/?]*)")===0?"google":o.search(ud+"bing.com")===0?"bing":o.search(ud+"yahoo.com")===0?"yahoo":o.search(ud+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Hn(t)){i.$search_engine=t;var a=ke?Al(ke.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function ky(){return navigator.language||navigator.userLanguage}var rf="$direct";function Hw(){return(ke==null?void 0:ke.referrer)||rf}function qw(e,t,n){n===void 0&&(n=!1);var i=e?[...Ml,...t||[]]:[],a=n?Ts(Vt==null?void 0:Vt.href):Vt==null?void 0:Vt.href,o=a==null?void 0:a.substring(0,1e3);return{r:Hw().substring(0,1e3),u:o?jc(o,i,Nc):void 0}}function Vw(e,t){var n;t===void 0&&(t=!1);var i=e.r,a=e.u,o=t?Ts(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==rf?rf:(n=tf(i))==null?void 0:n.host};if(o){u.$current_url=o;var f=tf(o);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=Uw(o);Ot(u,h)}if(i){var p=Iw(i);Ot(u,p)}return u}function Gw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function s4(){try{return new Date().getTimezoneOffset()}catch{return}}var a4={flags:Sc,surveys:Wd},l4=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],hl="main";class Xp{constructor(t,n,i){if(i===void 0&&(i=!0),this.ci={},this.fi=!1,this.pi=!1,this.Ne=t,this.gi=i,this.props={},this.mi=void 0,this.yi=(o=>{var u="";return o.token&&(u=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+u+"_posthog"})(t),this.ii=this.bi(t),this.pi=this.wi(t),this.load(),t.debug&&we.info("Persistence loaded",t.persistence,he({},this.props)),this.update_config(t,t,n),this.save(),ie){var a=()=>this.flush();Gt(ie,"beforeunload",a,{capture:!1}),Gt(ie,"pagehide",a,{capture:!1})}}ki(){var t,n=(t=this.Ne)==null?void 0:t.persistence_save_debounce_ms;return sn(n)&&n>0?n:0}isDisabled(){return!!this.xi}bi(t){l4.indexOf(t.persistence.toLowerCase())===-1&&(we.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,i=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...$3,...u];return he({},zt,{H(p){try{var g={};try{g=Fi.H(p)||{}}catch{}var x,b=JSON.parse(zt.P(p)||"{}");if(f){var y={};for(var _ in g){var j=g[_];Hn(j)||j===""||(y[_]=j)}x=Ot(b,y)}else x=Ot(g,b);return zt.F(p,x),x}catch{}return null},F(p,g,x,b,y,_){var j=zt.F(p,g,void 0,void 0,_);try{var C={};h.forEach((k=>{g[k]&&(C[k]=g[k])})),Object.keys(C).length&&Fi.F(p,C,x,b,y,_)}catch(k){zt.j(k)}return j},q(p,g){try{ie==null||ie.localStorage.removeItem(p),Fi.q(p,g)}catch(x){zt.j(x)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),a=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&zt.N()?(n=zt,a=!0):o==="localstorage+cookie"&&i.N()?(n=i,a=!0):o==="sessionstorage"&&Zt.N()?n=Zt:o==="memory"?n=F3:o==="cookie"?n=Fi:i.N()?(n=i,a=!0):n=Fi,this.fi=a,n}Si(t){return this.yi+"__"+t}wi(t){return this.fi&&!!t.split_storage}Ci(t){var n=t??this.Ne.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[Sc];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return Rt(this.props,((n,i)=>{var a=aa(i);if((a==null?void 0:a.exposure)==="derived"){if(a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,i===ga?()=>this.Ci():()=>!1))return;a.transformToEventProperties&&Ot(t,a.transformToEventProperties(n))}else if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,(()=>!1)))return;t[i]=n}})),t}load(){if(!this.xi){var t=this.ii.H(this.yi);t&&(this.props=Ot({},t)),this.pi&&this.Mi()}}Mi(){for(var t of Qp){var n=zt.H(this.Si(t));if(n&&!Ii(n)){var i=this.Ti(t);i.persisted=!0,this.Ei(t)||(i.fingerprint=this.Ii(n,t)),this.Pi(t,n)||Ot(this.props,n)}}}Ei(t){return Object.keys(this.props).some((n=>{var i;return((i=aa(n))==null?void 0:i.storageGroup)===t}))}Pi(t,n){var i=a4[t];if(!i)return!1;var a=n[i],o=this.props[i];return sn(a)&&sn(o)&&o>a}refreshKey(t){var n;if(!this.xi){var i=this.pi?(n=aa(t))==null?void 0:n.storageGroup:void 0,a=i?zt.H(this.Si(i)):this.ii.H(this.yi);if(a&&t in a)this.Ri(t,a[t]);else{if(i){var o=this.ii.H(this.yi);if(o&&t in o)return void this.Ri(t,o[t])}this.Ai(t)}}}save(){if(!this.xi){var t=this.ki();t>0?ye(this.Fi)&&(this.Fi=setTimeout((()=>{this.Fi=void 0,this.Li()}),t)):this.Li()}}flush(){ye(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0,this.Li())}Li(){this.xi||(this.pi?this.Oi():this.Di(this.ii,this.yi,this.props,hl))}Oi(){var t=this.$i(),n=t.main,i=t.groups;for(var a of(this.Di(this.ii,this.yi,n,hl),Qp)){var o,u=i[a];(!Ii(u)||(o=this.ci[a])!=null&&o.persisted)&&this.Di(zt,this.Si(a),u,a)}}$i(){var t={},n={flags:{},surveys:{}};return Rt(this.props,((i,a)=>{var o,u=(o=aa(a))==null?void 0:o.storageGroup;u?n[u][a]=i:t[a]=i})),{main:t,groups:n}}Ii(t,n){if(n===hl)return JSON.stringify(t)+"|"+this.Ni+"|"+this.qi+"|"+this.ji;var i={};return Rt(t,((a,o)=>{var u;i[o]=(u=aa(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(i)}Di(t,n,i,a){var o=this.Ti(a);if(a===hl||o.dirty||ye(o.fingerprint)){var u;try{if((u=this.Ii(i,a))===o.fingerprint)return void(o.dirty=!1)}catch{u=void 0}t.F(n,i,this.Ni,this.qi,this.ji,this.Ne.debug)?(o.dirty=!1,a!==hl&&(o.persisted=!0),ye(u)||(o.fingerprint=u)):this.Ne.debug&&we.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,i=n!==void 0&&n;if(ye(this.Fi)||(clearTimeout(this.Fi),this.Fi=void 0),this.ii.q(this.yi,!1),this.ii.q(this.yi,!0),!i&&this.gi)for(var a of Qp)zt.q(this.Si(a));i?delete this.ci[hl]:this.ci={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if(Bt(t)){ye(n)&&(n="None"),this.Ni=ye(i)?this.Bi:i;var a=!1;if(Rt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Ri(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(Bt(t)){this.Ni=ye(n)?this.Bi:n;var i=!1;if(Rt(t,((a,o)=>{t.hasOwnProperty(o)&&(this.props[o]!==a||Bt(a)||Ve(a))&&(this.Ri(o,a),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Ai(t),this.save())}update_campaign_params(){var t=ke==null?void 0:ke.URL;if(t!==this.mi){var n=Fw(this.Ne.custom_campaign_params,this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties);Ii(nx(n))||this.register(n),this.mi=t}}update_search_keyword(){var t;this.register((t=ke==null?void 0:ke.referrer)?Iw(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Hw(),$referring_domain:ke!=null&&ke.referrer&&((t=tf(ke.referrer))==null?void 0:t.host)||rf},void 0)}set_initial_person_info(){this.props[pg]||this.props[mg]||this.register_once({[Qd]:qw(this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties,this.Ne.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Rt([mg,pg],(a=>{var o=this.props[a];o&&Rt(o,(function(u,f){t["$initial_"+Gm(f)]=u}))}));var n=this.props[Qd];if(n){var i=(function(a,o){o===void 0&&(o=!1);var u=Vw(a,o),f={};return Rt(u,(function(h,p){f["$initial_"+Gm(p)]=h})),f})(n,this.Ne.disable_capture_url_hashes);Ot(t,i)}return t}safe_merge(t){return Rt(this.props,(function(n,i){i in t||(t[i]=n)})),t}update_config(t,n,i){this.Bi=this.Ni=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var a=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),x=[...p].sort();return g.every(((b,y)=>b===x[y]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=a?this.bi(t):this.ii,u=this.wi(t);if(a||u!==this.pi){var f=this.props;this.clear(),this.ii=o,this.pi=u,this.props=f,this.save()}}set_disabled(t){this.xi=t,this.xi?this.remove():this.save()}set_cross_subdomain(t){t!==this.qi&&(this.qi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ji&&(this.ji=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[tc]||{};i[t]=n,this.Ri(tc,i),this.save()}remove_event_timer(t){var n=this.props[tc]||{},i=n[t];return ye(i)||(delete n[t],this.Ri(tc,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.Ri(t,n),this.save()}Ri(t,n){var i;this.props[t]=n,(i=aa(t))!=null&&i.volatile||this.Hi(t)}Ai(t){delete this.props[t],this.Hi(t)}Hi(t){var n,i=(n=aa(t))==null?void 0:n.storageGroup;i&&(this.Ti(i).dirty=!0)}Ti(t){return this.ci[t]||(this.ci[t]={})}}function dd(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&pr(n.then)&&n.then(void 0,(()=>{}))}}}}var $n={GZipJS:"gzip-js",Base64:"base64"},Fo={Activation:"events",Cancellation:"cancelEvents"},Kp={Popover:"popover",API:"api",Widget:"widget"},Ui={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Zp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},bg={Popover:"popover",Inline:"inline"},o4={SHOWN:"product tour shown"},jy={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ny=Wt("[RateLimiter]");class c4{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var i=n.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((a=>{Ny.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void Ny.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:i})}},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,i,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(hg))!==null&&n!==void 0?n:{tokens:o,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>o&&(h.tokens=o);var p=1>h.tokens;if(p||t||(h.tokens=Math.max(0,h.tokens-1)),p&&!t){var g=(sn(h.dropped)?h.dropped:0)+1;h.dropped=g,!this.lastEventRateLimited&&this.Ui(g)&&(h.dropped=0)}return this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(hg,h),{isRateLimited:p,remainingTokens:h.tokens}}zi(t){var n=this.instance.config.property_denylist;return!Ve(n)||!n.includes(t)}Wi(){var t;if(this.zi("$current_url")&&this.zi("$pathname")&&Vt!=null&&Vt.pathname)return""+((t=Vt.origin)!==null&&t!==void 0?t:"")+Vt.pathname}Ui(t){var n,i,a=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,u=this.Wi(),f=this.zi("$session_id")?(n=(i=this.instance).get_session_id)==null?void 0:n.call(i):void 0,h=[t+" event(s) dropped since the last warning",u?"triggered on "+u:void 0,f?"session "+f:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+h+". Config is set to "+o+" events per second and "+a+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ks=Wt("[RemoteConfig]");class Yw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Oe._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}Vi(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Zi(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return ks.info("Using preloaded remote config",this.remoteConfig),this.Gi(this.remoteConfig),void this.Qi();if(this._instance.Ki())return void ks.warn("Remote config is disabled. Falling back to local config.");this.Vi((t=>{if(!t)return ks.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((n=>{this.Gi(n.json,n),this.Qi()}));this.Gi(t),this.Qi()}))}catch(t){ks.error("Error loading remote config",t),this.Gi()}}stop(){this.Ji&&(clearInterval(this.Ji),this.Ji=void 0)}refresh(){!this._instance.Ki()&&ke&&ke.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Qi(){var t;if(!this.Ji){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.Ji=setInterval((()=>{this.refresh()}),n))}}Gi(t,n){!t&&n&&(n.statusCode===0?n.error||ks.warn("Failed to fetch remote config from PostHog."):ks.error("Failed to fetch remote config from PostHog."));try{this._instance.Gi(t?{ok:!0,config:t}:{ok:!1})}catch(a){ks.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 i;(i=this._instance.featureFlags)==null||i.ensureFlagsLoaded()}catch(a){ks.error("Error loading feature flags",a)}}}var Pr=Uint8Array,tr=Uint16Array,Rl=Uint32Array,ax=new Pr([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]),lx=new Pr([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]),Cy=new Pr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ww=function(e,t){for(var n=new tr(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new Rl(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},Qw=Ww(ax,2),yg=Qw[1];Qw[0][28]=258,yg[258]=28;for(var Ey=Ww(lx,0)[1],Xw=new tr(32768),Yt=0;32768>Yt;++Yt){var pl=(43690&Yt)>>>1|(21845&Yt)<<1;Xw[Yt]=((65280&(pl=(61680&(pl=(52428&pl)>>>2|(13107&pl)<<2))>>>4|(3855&pl)<<4))>>>8|(255&pl)<<8)>>>1}var dc=function(e,t,n){for(var i=e.length,a=0,o=new tr(t);i>a;++a)++o[e[a]-1];var u,f=new tr(t);for(a=0;t>a;++a)f[a]=f[a-1]+o[a-1]<<1;for(u=new tr(i),a=0;i>a;++a)u[a]=Xw[f[e[a]-1]++]>>>15-e[a];return u},ya=new Pr(288);for(Yt=0;144>Yt;++Yt)ya[Yt]=8;for(Yt=144;256>Yt;++Yt)ya[Yt]=9;for(Yt=256;280>Yt;++Yt)ya[Yt]=7;for(Yt=280;288>Yt;++Yt)ya[Yt]=8;var sf=new Pr(32);for(Yt=0;32>Yt;++Yt)sf[Yt]=5;var u4=dc(ya,9),d4=dc(sf,5),Kw=function(e){return(e/8>>0)+(7&e&&1)},Zw=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof tr?tr:e instanceof Rl?Rl:Pr)(n-t);return i.set(e.subarray(t,n)),i},Mi=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Uo=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Jp=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,o=n.slice();if(!a)return[new Pr(0),0];if(a==1){var u=new Pr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(O,L){return O.f-L.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,x=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=a-1;)f=n[n[x].f>n[p].f?p++:x++],h=n[p!=g&&n[x].f>n[p].f?p++:x++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var b=o[0].s;for(i=1;a>i;++i)o[i].s>b&&(b=o[i].s);var y=new tr(b+1),_=_g(n[g-1],y,0);if(_>t){i=0;var j=0,C=_-t,k=1<<C;for(o.sort((function(O,L){return y[L.s]-y[O.s]||O.f-L.f}));a>i;++i){var E=o[i].s;if(t>=y[E])break;j+=k-(1<<_-y[E]),y[E]=t}for(j>>>=C;j>0;){var N=o[i].s;t>y[N]?j-=1<<t-y[N]++-1:++i}for(;i>=0&&j;--i){var D=o[i].s;y[D]==t&&(--y[D],++j)}_=t}return[new Pr(y),_]},_g=function(e,t,n){return e.s==-1?Math.max(_g(e.l,t,n+1),_g(e.r,t,n+1)):t[e.s]=n},Ty=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tr(++t),i=0,a=e[0],o=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[f]}return[n.subarray(0,i),t]},Io=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},wg=function(e,t,n){var i=n.length,a=Kw(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},Ay=function(e,t,n,i,a,o,u,f,h,p,g){Mi(t,g++,n),++a[256];for(var x=Jp(a,15),b=x[0],y=x[1],_=Jp(o,15),j=_[0],C=_[1],k=Ty(b),E=k[0],N=k[1],D=Ty(j),O=D[0],L=D[1],G=new tr(19),P=0;E.length>P;++P)G[31&E[P]]++;for(P=0;O.length>P;++P)G[31&O[P]]++;for(var Q=Jp(G,7),B=Q[0],I=Q[1],M=19;M>4&&!B[Cy[M-1]];--M);var le,J,Y,$,F=p+5<<3,V=Io(a,ya)+Io(o,sf)+u,ge=Io(a,b)+Io(o,j)+u+14+3*M+Io(G,B)+(2*G[16]+3*G[17]+7*G[18]);if(V>=F&&ge>=F)return wg(t,g,e.subarray(h,h+p));if(Mi(t,g,1+(V>ge)),g+=2,V>ge){le=dc(b,y),J=b,Y=dc(j,C),$=j;var R=dc(B,I);for(Mi(t,g,N-257),Mi(t,g+5,L-1),Mi(t,g+10,M-4),g+=14,P=0;M>P;++P)Mi(t,g+3*P,B[Cy[P]]);g+=3*M;for(var z=[E,O],Z=0;2>Z;++Z){var A=z[Z];for(P=0;A.length>P;++P)Mi(t,g,R[ue=31&A[P]]),g+=B[ue],ue>15&&(Mi(t,g,A[P]>>>5&127),g+=A[P]>>>12)}}else le=u4,J=ya,Y=d4,$=sf;for(P=0;f>P;++P)if(i[P]>255){var ue;Uo(t,g,le[257+(ue=i[P]>>>18&31)]),g+=J[ue+257],ue>7&&(Mi(t,g,i[P]>>>23&31),g+=ax[ue]);var xe=31&i[P];Uo(t,g,Y[xe]),g+=$[xe],xe>3&&(Uo(t,g,i[P]>>>5&8191),g+=lx[xe])}else Uo(t,g,le[i[P]]),g+=J[i[P]];return Uo(t,g,le[256]),g+J[256]},f4=new Rl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),h4=(function(){for(var e=new Rl(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),em=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function p4(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=h4[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),i=e.length;n.p(e);var a,o,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(x,b,y,_,j,C){var k=x.length,E=new Pr(_+k+5*(1+Math.floor(k/7e3))+j),N=E.subarray(_,E.length-j),D=0;if(!b||8>k)for(var O=0;k>=O;O+=65535){var L=O+65535;k>L?D=wg(N,D,x.subarray(O,L)):(N[O]=!0,D=wg(N,D,x.subarray(O,k)))}else{for(var G=f4[b-1],P=G>>>13,Q=8191&G,B=(1<<y)-1,I=new tr(32768),M=new tr(B+1),le=Math.ceil(y/3),J=2*le,Y=function(mt){return(x[mt]^x[mt+1]<<le^x[mt+2]<<J)&B},$=new Rl(25e3),F=new tr(288),V=new tr(32),ge=0,R=0,z=(O=0,0),Z=0,A=0;k>O;++O){var ue=Y(O),xe=32767&O,je=M[ue];if(I[xe]=je,M[ue]=xe,O>=Z){var Re=k-O;if((ge>7e3||z>24576)&&Re>423){D=Ay(x,N,0,$,F,V,R,z,A,O-A,D),z=ge=R=0,A=O;for(var Le=0;286>Le;++Le)F[Le]=0;for(Le=0;30>Le;++Le)V[Le]=0}var Be=2,Je=0,it=Q,ht=xe-je&32767;if(Re>2&&ue==Y(O-ht))for(var Jt=Math.min(P,Re)-1,pt=Math.min(32767,O),_t=Math.min(258,Re);pt>=ht&&--it&&xe!=je;){if(x[O+Be]==x[O+Be-ht]){for(var Nt=0;_t>Nt&&x[O+Nt]==x[O+Nt-ht];++Nt);if(Nt>Be){if(Be=Nt,Je=ht,Nt>Jt)break;var ve=Math.min(ht,Nt-2),Fe=0;for(Le=0;ve>Le;++Le){var ct=O-ht+Le+32768&32767,xn=ct-I[ct]+32768&32767;xn>Fe&&(Fe=xn,je=ct)}}}ht+=(xe=je)-(je=I[xe])+32768&32767}if(Je){$[z++]=268435456|yg[Be]<<18|Ey[Je];var Ne=31&yg[Be],ze=31&Ey[Je];R+=ax[Ne]+lx[ze],++F[257+Ne],++V[ze],Z=O+Be,++ge}else $[z++]=x[O],++F[x[O]]}}D=Ay(x,N,!0,$,F,V,R,z,A,O-A,D)}return Zw(E,0,_+Kw(D)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,f,h)),g=p.length;return(function(x,b){var y=b.filename;if(x[0]=31,x[1]=139,x[2]=8,x[8]=2>b.level?4:b.level==9?2:0,x[9]=3,b.mtime!=0&&em(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(p,t),em(p,g-8,n.d()),em(p,g-4,i),p}var m4=!!Hm||!!Vg,Jw="text/plain",Md=!1,e2=(e,t)=>{var n=e.split("#"),i=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var f=u.split("&").filter((h=>h.split("=")[0]!==t)).join("&");return o+(f?"?"+f:"")+(i?"#"+i:"")},vf=function(e,t,n){var i;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],f=he({},t),h=(i=u==null?void 0:u.split("&").map((g=>{var x,b=g.split("="),y=b[0],_=n&&(x=f[y])!==null&&x!==void 0?x:b[1];return delete f[y],y+"="+_})))!==null&&i!==void 0?i:[],p=(function(g,x){var b,y;x===void 0&&(x="&");var _=[];return Rt(g,(function(j,C){ye(j)||ye(C)||C==="undefined"||(b=encodeURIComponent((k=>k instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(C),_[_.length]=y+"="+b)})),_.join(x)})(f);return p&&h.push(p),h.length>0?o+"?"+h.join("&"):o},tm=e=>{if(e.Yi)return e.Yi;var t=e.data,n=e.compression;if(t){if(n===$n.GZipJS){var i=p4((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Pr(f.length+(f.length>>>1)),x=0,b=function(C){g[x++]=C},y=0;p>y;++y){if(x+5>g.length){var _=new Pr(x+8+(p-y<<1));_.set(g),g=_}var j=f.charCodeAt(y);128>j?b(j):2048>j?(b(192|j>>>6),b(128|63&j)):j>55295&&57344>j?(b(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++y))>>>18),b(128|j>>>12&63),b(128|j>>>6&63),b(128|63&j)):(b(224|j>>>12),b(128|j>>>6&63),b(128|63&j))}return Zw(g,0,x)})(Sl(t)),{mtime:0});return{contentType:Jw,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===$n.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(Sl(t)),o=(f=>"data="+encodeURIComponent(typeof f=="string"?f:Sl(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=Sl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},t2=e=>{var t,n,i=()=>e.transport==="sendBeacon"?{url:vf(e.url,{compression:$n.Base64}),encodedBody:tm(he({},e,{compression:$n.Base64,Yi:void 0}))}:{url:e2(e.url,"compression"),encodedBody:tm(he({},e,{compression:void 0,Yi:void 0}))};try{t=tm(e)}catch(a){if(Xb(e.compression,Al(e.url,"compression")))return we.error("Failed to gzip request body, sending uncompressed payload",a),i();throw a}return t&&Xb(e.compression,Al(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?qm(new Uint8Array(n)):ArrayBuffer.isView(n)&&qm(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Md=!0,i()):{url:e.url,encodedBody:t}},n2=e=>{try{return t2(e)}catch(t){return we.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},g4=(function(){var e=Ut((function*(t){var n=Sl(t.data),i=yield(function(o,u,f){return Vm.apply(this,arguments)})(n,jt.DEBUG,{rethrow:!0});if(!i)return t;var a=yield i.arrayBuffer();return he({},t,{Yi:{contentType:Jw,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),x4=/Failed to fetch|NetworkError|Load failed/i,r2=e=>(e==null?void 0:e.name)==="TypeError"&&x4.test((e==null?void 0:e.message)||""),i2=e=>{var t=n2(e);if(t){var n=t.url,i=t.encodedBody,a=i??{},o=a.contentType,u=a.body,f=a.estimatedSize,h=new Headers;Rt(e.headers,(function(_,j){h.append(j,_)})),o&&h.append("Content-Type",o);var p=null,g=!1;if(qb){var x=new qb;p={signal:x.signal,timeout:setTimeout((()=>{var _,j;g=!0,x.abort((_=e.timeout,(j=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",j))}),e.timeout)}}var b=_=>{g&&(_==null?void 0:_.name)==="AbortError"||r2(_)?we.warn(_):we.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;Vg(n,he({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&!e.Xi&&52428.8>(f||0),body:u,signal:(y=p)==null?void 0:y.signal},e.fetchOptions)).then((_=>_.text().then((j=>{var C={statusCode:_.status,text:j};if(_.status===200)try{C.json=JSON.parse(j)}catch(k){we.error(k)}e.callback==null||e.callback(C)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},Sg=e=>{try{var t,n=t2(e),i=n.url,a=n.encodedBody,o=a??{},u=o.body,f=o.estimatedSize;if(!u)return;var h=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(In.sendBeacon(i,h))return;var p=Ve(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Ve(p)&&p.length>1&&(f??0)>16384){var g=Math.ceil(p.length/2),x=b=>Ve(e.data)?b:he({},e.data,{batch:b});return Sg(he({},e,{data:x(p.slice(0,g))})),void Sg(he({},e,{data:x(p.slice(g))}))}we.warn("Beacon of ~"+(f??0)+" bytes was rejected by the browser, falling back to fetch"),i2(he({},e,{Xi:!0}))}catch(b){we.warn("Beacon send failed",b)}},My=(e,t,n,i)=>{var a=i==="query"?t==="POST"?"sent_at":"_":void 0;return vf(n===$n.GZipJS?e2(e,"compression"):e,he({},a?{[a]:Date.now().toString()}:{},n===$n.GZipJS?{}:{compression:n}))},Rd=[];Vg&&Rd.push({transport:"fetch",method:i2}),Hm&&Rd.push({transport:"XHR",method(e){var t=n2(e);if(t){var n=new Hm,i=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=i??{},o=a.contentType,u=a.body;Rt(e.headers,(function(f,h){n.setRequestHeader(h,f)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),In!=null&&In.sendBeacon&&Rd.push({transport:"sendBeacon",method:Sg});var kg=3e3;class v4{constructor(t,n){this.tr=!0,this.er=[],this.ir=ui((n==null?void 0:n.flush_interval_ms)||kg,250,5e3,we.createLogger("flush interval"),kg),this.rr=t}enqueue(t){this.er.push(t),this.nr||this.sr()}unload(){this.ar();var t=this.er.length>0?this.lr():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ur(he({},i,{transport:"sendBeacon"}))}))}enable(){this.tr=!1,this.sr()}sr(){var t=this;this.tr||(this.nr=setTimeout((()=>{if(this.ar(),this.er.length>0){var n=this.lr(),i=function(){var o=n[a],u=new Date().getTime();o.data&&Ve(o.data)&&Rt(o.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.ur(o)};for(var a in n)i()}}),this.ir))}ur(t){try{this.rr(t)}catch(n){we.error(n)}}ar(){clearTimeout(this.nr),this.nr=void 0}lr(){var t={};return Rt(this.er,(n=>{var i,a=n,o=(a?a.batchKey:null)||a.url;ye(t[o])&&(t[o]=he({},a,{data:[]})),(i=t[o].data)==null||i.push(a.data)})),this.er=[],t}}var b4=["retriesPerformedSoFar"];class y4{constructor(t){this.hr=!1,this.dr=3e3,this.er=[],this._instance=t,this.er=[],this.vr=!0,!ye(ie)&&"onLine"in ie.navigator&&(this.vr=ie.navigator.onLine,this.cr=()=>{this.vr=!0,this.pr()},this.gr=()=>{this.vr=!1},Gt(ie,"online",this.cr),Gt(ie,"offline",this.gr))}get length(){return this.er.length}retriableRequest(t){var n=t.retriesPerformedSoFar,i=M5(t,b4);zi(n)&&(i.url=vf(i.url,{retry_count:n})),this._instance._send_request(he({},i,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.At(he({retriesPerformedSoFar:n},i));a.statusCode===0&&we.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.")}i.callback==null||i.callback(a)}}))}At(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var i=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),a=Date.now()+i;this.er.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+i;navigator.onLine||(o+=" (Browser is offline)"),we.warn(o),this.hr||(this.hr=!0,this.mr())}mr(){if(this.yr&&clearTimeout(this.yr),this.er.length===0)return this.hr=!1,void(this.yr=void 0);this.yr=setTimeout((()=>{this.vr&&this.er.length>0&&this.pr(),this.mr()}),this.dr)}pr(){var t=Date.now(),n=[],i=this.er.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.er=n,i.length>0)for(var a of i)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.yr&&(clearTimeout(this.yr),this.yr=void 0),this.hr=!1,ye(ie)||(this.cr&&(ie.removeEventListener("online",this.cr),this.cr=void 0),this.gr&&(ie.removeEventListener("offline",this.gr),this.gr=void 0)),this.er)){var n=t.requestOptions;try{this._instance._send_request(he({},n,{transport:"sendBeacon"}))}catch(i){we.error(i)}}this.er=[]}}class _4{constructor(t){this.br=()=>{var n,i,a,o;this._r||(this._r={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this._r.lastScrollY=Math.ceil(f),this._r.maxScrollY=Math.max(f,(n=this._r.maxScrollY)!==null&&n!==void 0?n:0),this._r.maxScrollHeight=Math.max(h,(i=this._r.maxScrollHeight)!==null&&i!==void 0?i:0),this._r.lastContentY=p,this._r.maxContentY=Math.max(p,(a=this._r.maxContentY)!==null&&a!==void 0?a:0),this._r.maxContentHeight=Math.max(g,(o=this._r.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get wr(){return this._instance.config.scroll_root_selector}getContext(){return this._r}resetContext(){var t=this._r;return setTimeout(this.br,0),t}startMeasuringScrollPosition(){Gt(ie,"scroll",this.br,{capture:!0}),Gt(ie,"scrollend",this.br,{capture:!0}),Gt(ie,"resize",this.br)}scrollElement(){if(!this.wr)return ie==null?void 0:ie.document.documentElement;var t=Ve(this.wr)?this.wr:[this.wr];for(var n of t){var i=ie==null?void 0:ie.document.querySelector(n);if(i)return i}}kr(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.wr){var i=this.scrollElement();return i&&i[n]||0}return ie?t==="y"?ie.scrollY||ie.pageYOffset||ie.document.documentElement.scrollTop||0:ie.scrollX||ie.pageXOffset||ie.document.documentElement.scrollLeft||0:0}scrollY(){return this.kr("y")}scrollX(){return this.kr("x")}}var w4=e=>qw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class Ry{constructor(t,n,i,a){this.Sr=o=>{var u=this.Cr();if(!u||u.sessionId!==o){var f={sessionId:o,props:this.Mr(this._instance)};this.Tr.register({[fg]:f})}},this._instance=t,this.Er=n,this.Tr=i,this.Mr=a||w4,this.Er.onSessionId(this.Sr)}Cr(){return this.Tr.props[fg]}getSetOnceProps(){var t,n=(t=this.Cr())==null?void 0:t.props;return n?"r"in n?Vw(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 Rt(nx(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+Gm(i)]=n})),t}}class ox{on(t,n){return this.Ir[t]||(this.Ir[t]=[]),this.Ir[t].push(n),()=>{this.Ir[t]=this.Ir[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.Ir[t]||[])i(n);for(var a of this.Ir["*"]||[])a(t,n)}constructor(){this.Ir={}}}var Ho=Wt("[SessionId]");class Ly{on(t,n){return this.Pr.on(t,n)}constructor(t,n,i){var a;if(this.Rr=null,this.Ar=[],this.Fr=void 0,this.Lr=!1,this.Pr=new ox,this.Or=(p,g)=>!(!zi(p)||!zi(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===$i)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ne=t.config,this.Tr=t.persistence,this.Dr=void 0,this.$r=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Nr=n||Pi,this.qr=i||Pi;var o=this.Ne.persistence_name||this.Ne.token;if(this._sessionTimeoutMs=1e3*ui(this.Ne.session_idle_timeout_seconds||1800,60,36e3,Ho.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+o+"_window_id",this.Hr="ph_"+o+"_primary_window_exists",this.Ur()){var u=Zt.H(this.Br),f=Zt.H(this.Hr);u&&!f?this.Dr=u:Zt.q(this.Br),Zt.F(this.Hr,!0)}if((a=this.Ne.bootstrap)!=null&&a.sessionID)try{var h=(p=>{var g=this.Ne.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.zr(this.Ne.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Ho.error("Invalid sessionID in bootstrap",p)}this.Wr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ye(this.Ar)&&(this.Ar=[]),this.Ar.push(t),this.$r&&t(this.$r,this.Dr),()=>{this.Ar=this.Ar.filter((n=>n!==t))}}Ur(){return this.Ne.persistence!=="memory"&&!this.Tr.xi&&Zt.N()}Vr(t){t!==this.Dr&&(this.Dr=t,this.Ur()&&Zt.F(this.Br,t))}Zr(){return this.Dr?this.Dr:this.Ur()?Zt.H(this.Br):null}Gr(t){var n=this.Rr;return!Hn(n)&&!Hn(t)&&5e3>Math.abs(t-n)}zr(t,n,i){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.$r||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.$r=t,o&&!a||o&&this.Gr(n)||(this.Rr=n,this.Tr.register({[wl]:[n,t,i]}))}Qr(){var t,n=(t=this.Ne)==null?void 0:t.persistence_save_debounce_ms;return zi(n)&&n>0}Kr(){this.Qr()?this.Tr.refreshKey(wl):(this.Tr.flush(),this.Tr.load())}Jr(){var t;if(!Hn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Rr){this.Kr();var n=this.Yr();n[1]===this.$r&&n[2]===this._sessionStartTimestamp&&(this.Rr=this._sessionActivityTimestamp,this.Tr.register({[wl]:[this._sessionActivityTimestamp,(t=this.$r)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Tr.flush())}}Xr(){var t=this.Yr()[0],n=zi(t)?t:0,i=zi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}tn(t){return this.Kr(),this.Or(t,this.Xr())}Yr(){var t=this.Tr.props[wl];return Ve(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Rr=null,clearTimeout(this.en),this.en=void 0,this.zr(null,null,null)}destroy(){this.Lr=!0,this.Jr(),clearTimeout(this.en),this.en=void 0,this.Fr&&ie&&(ie.removeEventListener(Zd,this.Fr,{capture:!1}),this.Fr=void 0),this.Ar=[]}Wr(){this.Fr=()=>{this.Jr(),this.Ur()&&Zt.q(this.Hr)},Gt(ie,Zd,this.Fr,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Ne.cookieless_mode===$i)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),a=this.Yr(),o=a[1],u=a[2],f=this.Xr(),h=this.Zr(),p=zi(u)&&Math.abs(i-u)>864e5,g=!1,x=!1,b=!o,y=o,_=!b&&!t&&this.Or(i,f);if(_){(_=this.tn(i))||Ho.info("cross-tab refresh kept the session alive",{sessionId:o});var j=this.Yr();o=j[1],u=j[2]}b||_||p?(o=this.Nr(),h=this.qr(),Ho.info("new session ID generated",{sessionId:o,windowId:h,changeReason:{noSessionId:b,activityTimeout:_,sessionPastMaximumLength:p}}),u=i,g=!0):(h||(h=this.qr(),g=!0),(x=o!==y)&&(Ho.info("adopted cross-tab session id",{sessionId:o,windowId:h}),g=!0));var C=zi(f)&&t&&!p?f:i,k=zi(u)?u:new Date().getTime();this.Vr(h),this.zr(o,C,k),t||this.jr();var E={noSessionId:b,activityTimeout:_,sessionPastMaximumLength:p,crossTabAdoption:x};return g&&this.Ar.forEach((N=>N(o,h,E))),{sessionId:o,windowId:h,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:f}}jr(){this.Lr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Lr)if(this.tn(new Date().getTime())){var t=this.$r;this.resetSessionId(),this.Pr.emit("forcedIdleReset",{idleSessionId:t})}else this.jr()}),1.1*this.sessionTimeoutMs))}}var s2=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Zb(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((a=>Zb(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function a2(){return(a2=Ut((function*(){var e=In==null?void 0:In.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return vt(n)&&n.length>0?n:void 0}catch(i){return void we.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var af=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function nm(e,t,n){return Sl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var l2={exact:(e,t)=>t.some((n=>e.some((i=>n===i)))),is_not:(e,t)=>t.every((n=>e.every((i=>n!==i)))),regex:(e,t)=>t.some((n=>e.some((i=>af(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!af(n,i))))),icontains:(e,t)=>t.map(fd).some((n=>e.map(fd).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(fd).every((n=>e.map(fd).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i<parseFloat(a)))}))},fd=e=>e.toLowerCase();function o2(e,t){return!e||Object.entries(e).every((n=>{var i=n[1],a=t==null?void 0:t[n[0]];if(ye(a)||Hn(a))return!1;var o=[String(a)],u=l2[i.operator];return!!u&&u(i.values,o)}))}var jg="custom",Dy="i.posthog.com",S4=/^\/static\//;class k4{constructor(t){this.rn={},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("."+Dy,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.rn[this.apiHost]||(this.rn[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":jg),this.rn[this.apiHost]}nn(t){if(S4.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 i=this.nn(n);if(i)return""+i+n}if(this.region===jg)return this.apiHost+n;var a=Dy+n;switch(t){case"assets":return"https://"+this.region+"-assets."+a;case"api":return"https://"+this.region+"."+a}}}function c2(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var kt=Wt("[Surveys]"),u2="seenSurvey_",d2=e=>{try{var t=(n=>((i,a)=>""+u2+(function(o){return o.current_iteration&&o.current_iteration>0?o.id+"_"+o.current_iteration:o.id})(a))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){kt.error("Failed to persist survey seen state",n)}},j4=[Kp.Popover,Kp.Widget,Kp.API],N4={ignoreConditions:!1,ignoreDelay:!1,displayType:bg.Popover},C4=Wt("[PostHog ExternalIntegrations]"),E4={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class T4{constructor(t){this._instance=t}ai(t,n){var i;(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(a=>{if(a)return C4.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,f,h=i[0],p=i[1];!p||(o=Oe.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[h]||t.ai(E4[h],(()=>{var g;(g=Oe.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[h])==null||g.start(t._instance)})),!p&&(u=Oe.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[h]&&((f=Oe.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[h])==null||f.stop())};for(var i of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class A4{constructor(t,n){this.rt=t,this.sn=n,this.an=new Map,this.ln=!1}add(t){var n=this;return Ut((function*(){if(n.ln)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.an.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.an.set(t.name,t);try{var i=t.setup(n.sn);i&&(yield i)}catch(o){var a=n.an.get(t.name)===t;a&&n.an.delete(t.name),n.rt.error('Failed to set up browser extension "'+t.name+'"',o),a&&n.un(t)}}))()}dispose(){if(!this.ln){this.ln=!0;var t=Array.from(this.an.values()).reverse();for(var n of(this.an.clear(),t))this.un(n)}}un(t){try{var n=t.dispose==null?void 0:t.dispose();n&&pr(n.then)&&n.then(void 0,(i=>{this.rt.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.rt.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class M4{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 i;(i=this._instance.persistence)==null||i.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var zy="extensionsRemoteConfig";class R4{constructor(t){this.ln=!1,this.instance=t,this.rt=we.createLogger("[BrowserExtensions]"),this.hn=t.dn,this.kv=new M4(t),this.onEvent=n=>dd(this.instance.on("eventCaptured",(i=>{try{n({event:i.event,properties:i.properties})}catch(a){this.rt.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.ln)return dd((()=>{}));var i=o=>{try{n(o)}catch(u){this.rt.error("Browser extension remote config listener failed",u)}},a=this.instance.vn.on(zy,i);return this.hn&&i(this.hn),dd(a)},this.cn=new A4(this.rt,this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(wc))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,i,a,o=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=o==null?void 0:o.sessionId)!==null&&n!==void 0?n:"",windowId:(i=o==null?void 0:o.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(a=o==null?void 0:o.sessionStartTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.cn.add(t)}capture(t,n,i){var a=this;return Ut((function*(){i?a.instance.capture(t,n,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):a.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return dd(this.instance.fn(t))}handleRemoteConfig(t){this.ln||(this.hn=t,this.instance.vn.emit(zy,t))}sendRequest(t,n){var i=this;return Ut((function*(){var a;n===void 0&&(n={});var o=i.instance.requestRouter.endpointFor((a=n.target)!==null&&a!==void 0?a:"api",t),u={method:n.method,url:n.query?vf(o,n.query):o,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(i.instance._send_request(u),{statusCode:202}):new Promise((f=>{u.callback=f,i.instance._send_request(u)}))}))()}dispose(){this.ln||(this.ln=!0,this.cn.dispose())}}var fc={},rm=0,lf=()=>{},Oy='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',qo="Surveys module not available",By="sanitize_properties is deprecated. Use before_send instead",f2="Invalid value for property_denylist config: ",L4=["token","distinct_id",vw],yl="posthog",h2=!m4&&(er==null?void 0:er.indexOf("MSIE"))===-1&&(er==null?void 0:er.indexOf("Mozilla"))===-1,im=e=>{var t;return he({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:D3(ke==null?void 0:ke.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:lf,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Vt&&vt(Vt==null?void 0:Vt.search)&&Vt.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:(ie==null||(t=ie.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){we.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:gg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:kg},error_tracking:{},_onCapture:lf},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:G3,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},D4=[["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"]],Py=e=>{var t={};for(var n of D4){var i=n[0],a=n[1];ye(e[i])||(t[a]=e[i])}var o=Ot({},t,e),u=e.__preview_external_dependency_versioned_paths;return ye(u)||(ye(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),vt(u)&&ye(e.asset_host)&&(o.asset_host=u)),Ve(e.property_blacklist)&&(ye(e.property_denylist)?o.property_denylist=e.property_blacklist:Ve(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:we.error(f2+e.property_denylist)),o};class z4{constructor(){this.__forceAllowLocalhost=!1}get pn(){return this.__forceAllowLocalhost}set pn(t){we.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Or{gn(t,n){if(t){var i=this.an.indexOf(t);i!==-1&&this.an.splice(i,1)}return this.an.push(n),n.initialize==null||n.initialize(),n}mn(){return this.config.cookieless_mode===$i||this.config.cookieless_mode===pa&&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 z4,this.yn=!1,this.version=jt.LIB_VERSION,this.bn=new Set,this._n="",this.vn=new ox,this.an=[],this.wn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=im(),this.SentryIntegration=e4,this.sentryIntegration=i=>(function(a,o){var u=Bw(a,o);return{name:Ow,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kn=!1,this.xn=null,this.Sn=null,this.Cn=null,this.scrollManager=new _4(this),this.pageViewManager=new Sy(this),this.rateLimiter=new c4(this),this.requestRouter=new k4(this),this.consent=new U3(this),this.externalIntegrations=new T4(this);var n=(t=Or.__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:(i,a,o)=>{var u=vt(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{var u=vt(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(i=>we.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==yl){var a,o=(a=fc[i])!==null&&a!==void 0?a:new Or;return o._init(t,n,i),fc[i]=o,fc[yl][i]=o,o}return this._init(t,n,i)}_init(t,n,i){var a,o;n===void 0&&(n={});var u,f=vt(t)?t.trim():"";if(!f)return we.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 f!==((u=this.config)==null?void 0:u.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+f+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=im(n.defaults),n.debug=this.Mn(n.debug),this.Tn=n,this.En=[],n.person_profiles?this.Sn=n.person_profiles:n.process_person&&(this.Sn=n.process_person);var h=im(n.defaults),p=Py(n),g=Ot({},h,p,{name:i,token:f});Bt(h.rageclick)&&Bt(p.rageclick)&&(g.rageclick=Ot({},h.rageclick,p.rageclick)),Bt(h.session_recording)&&Bt(p.session_recording)&&(g.session_recording=Ot({},h.session_recording,p.session_recording)),this.set_config(g),this.config.on_xhr_error&&we.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:$n.GZipJS;var x=this.In();if(this.persistence=new Xp(this.config,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Xp(he({},this.config,{persistence:"sessionStorage"}),x,!1),this._n="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!x&&Zt.N()){var b=Zt.H(this._n);Ve(b)&&b.forEach((L=>{vt(L)&&this.bn.add(L)}))}else Zt.q(this._n);var y=he({},this.persistence.props),_=he({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Pn=new v4((L=>this.Rn(L)),this.config.request_queue_config),this.An=new y4(this),this.__request_queue=[];var j=this.mn();if(j||(this.sessionManager=new Ly(this),this.sessionPropsManager=new Ry(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((L,G,P)=>{(P!=null&&P.activityTimeout||P!=null&&P.sessionPastMaximumLength||P!=null&&P.crossTabAdoption)&&this.Fn()}))),this.config.__preview_deferred_init_extensions?(we.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ln(j)}),0)):(we.info("Initializing extensions synchronously"),this.Ln(j)),jt.DEBUG=jt.DEBUG||this.config.debug,jt.DEBUG&&we.info("Starting in debug mode",{this:this,config:n,thisC:he({},this.config),p:y,s:_}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=he({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((o=n.bootstrap)==null?void 0:o.distinctID)!==void 0){var C=n.bootstrap.distinctID,k=this.get_distinct_id(),E=this.persistence.get_property(zr);if(n.bootstrap.isIdentifiedID&&k!=null&&k!==C&&E===fl)this.identify(C);else if(n.bootstrap.isIdentifiedID&&k!=null&&k!==C&&E===ia)we.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 N=this.config.get_device_id(Pi()),D=n.bootstrap.isIdentifiedID?N:C;this.persistence.set_property(zr,n.bootstrap.isIdentifiedID?ia:fl),this.register({distinct_id:C,$device_id:D})}}if(j)this.register_once({distinct_id:ad,$device_id:null},"");else if(!this.get_distinct_id()){var O=this.config.get_device_id(Pi());this.register_once({distinct_id:O,$device_id:O},""),this.persistence.set_property(zr,fl)}return Gt(ie,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,G){var P=L.config.segment;if(!P)return G();(function(Q,B){var I=Q.config.segment;if(!I)return B();var M=J=>{var Y=()=>J.anonymousId()||Pi();Q.config.get_device_id=Y,J.id()&&(Q.register({distinct_id:J.id(),$device_id:Y()}),Q.persistence.set_property(zr,ia)),B()},le=I.user();"then"in le&&pr(le.then)?le.then(M):M(le)})(L,(()=>{P.register((Q=>{typeof Promise<"u"&&Promise.resolve||Wp.warn("This browser does not have Promise support, and can not use the segment integration");var B=(I,M)=>{if(!M)return I;I.event.userId||I.event.anonymousId===Q.get_distinct_id()||(Wp.info("No userId set, resetting PostHog"),Q.reset()),I.event.userId&&I.event.userId!==Q.get_distinct_id()&&(Wp.info("UserId set, identifying with PostHog"),Q.identify(I.event.userId));var le=Q.calculateEventProperties(M,I.event.properties);return I.event.properties=Object.assign({},le,I.event.properties),I};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:I=>B(I,I.event.event),page:I=>B(I,bl),identify:I=>B(I,Vp),screen:I=>B(I,"$screen")}})(L)).then((()=>{G()}))}))})(this,(()=>this.On())):this.On(),pr(this.config._onCapture)&&this.config._onCapture!==lf&&(we.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),this.config.ip&&we.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 a2.apply(this,arguments)})().then((L=>{L&&this.register({[Hp]:L})})).catch(lf),this}Ln(t){var n,i,a,o,u,f,h,p,g=performance.now(),x=he({},Or.__defaultExtensionClasses,this.config.__extensionClasses),b=[];x.featureFlags&&this.an.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new x.featureFlags(this)),x.exceptions&&this.an.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new x.exceptions(this)),x.historyAutocapture&&this.an.push(this.historyAutocapture=new x.historyAutocapture(this)),x.tracingHeaders&&this.an.push(this.tracingHeaders=new x.tracingHeaders(this)),x.siteApps&&this.an.push(this.siteApps=new x.siteApps(this)),x.sessionRecording&&!t&&this.an.push(this.sessionRecording=new x.sessionRecording(this)),this.config.disable_scroll_properties||b.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),x.autocapture&&this.an.push(this.autocapture=new x.autocapture(this)),x.surveys&&this.an.push(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new x.surveys(this)),x.logs&&this.an.push(this.logs=(o=this.logs)!==null&&o!==void 0?o:new x.logs(this)),x.metrics&&this.an.push(this.metrics=(u=this.metrics)!==null&&u!==void 0?u:new x.metrics(this)),x.conversations&&this.an.push(this.conversations=(f=this.conversations)!==null&&f!==void 0?f:new x.conversations(this)),x.productTours&&this.an.push(this.productTours=new x.productTours(this)),x.heatmaps&&this.an.push(this.heatmaps=new x.heatmaps(this)),x.webVitalsAutocapture&&this.an.push(this.webVitalsAutocapture=new x.webVitalsAutocapture(this)),x.exceptionObserver&&this.an.push(this.exceptionObserver=new x.exceptionObserver(this)),x.deadClicksAutocapture&&this.an.push(this.deadClicksAutocapture=new x.deadClicksAutocapture(this,J3)),x.toolbar&&this.an.push(this.toolbar=(h=this.toolbar)!==null&&h!==void 0?h:new x.toolbar(this)),x.experiments&&this.an.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new x.experiments(this)),this.an.forEach((y=>{y.initialize&&b.push((()=>{y.initialize==null||y.initialize()}))})),b.push((()=>{if(this.Dn){var y=this.Dn;this.Dn=void 0,this.an.forEach((_=>_.onRemoteConfig==null?void 0:_.onRemoteConfig(y)))}})),this.$n(b,g)}$n(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.$n(t,n)}),0);var i=t.shift();if(i)try{i()}catch(o){we.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[bw]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[yw]:a}),this.config.__preview_deferred_init_extensions&&we.info("PostHog extensions initialized ("+a+"ms)")}Gi(t){var n;if(!ke||!ke.body)return we.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Gi(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Dn=t),this.dn=t,this.compression=void 0,t.ok){var i,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=qe(a.supportedCompression,$n.GZipJS)?$n.GZipJS:qe(a.supportedCompression,$n.Base64)?$n.Base64:void 0),(i=a.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Sn?this.Sn:gg}),(n=this.Nn)==null||n.handleRemoteConfig(t),this.an.forEach((o=>o.onRemoteConfig==null?void 0:o.onRemoteConfig(t)))}On(){try{this.config.loaded(this)}catch(i){we.critical("`loaded` function failed",i)}if(this.qn(),this.config.internal_or_test_user_hostname&&Vt!=null&&Vt.hostname){var t=Vt.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.mn())&&this.jn()}),1),this.Bn=new Yw(this),this.Bn.load()}qn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Pn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&ld(this.__request_queue,(t=>this.Rn(t))),this.__request_queue=[],this.qn()}_handle_unload(){var t,n,i,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Hn()&&this.capture(qp),(i=this.logs)==null||i.flushLogs("sendBeacon"),(a=this.Pn)==null||a.unload(),(o=this.An)==null||o.unload()):this.Hn()&&this.capture(qp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?h2?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=he({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(ye(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 i,a,o,u=he({},n);u.timeout=u.timeout||6e4;var f,h,p,g,x,b=(i=u.transport)!==null&&i!==void 0?i:"fetch";b==="sendBeacon"&&ye(u.compression)&&u.data&&(u.compression=$n.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data={api_key:(h=(x=(g=Ve(f=u.data)?f:[f])[0])==null||(p=x.properties)==null?void 0:p.token)!==null&&h!==void 0?h:x==null?void 0:x.token,batch:g,sent_at:new Date().toISOString()}:u.timestampMode==="body"&&(u.data=(function(C,k){return k===void 0&&(k=new Date().toISOString()),Ve(C)?C.map((E=>he({},E,{sent_at:k}))):he({},C,{sent_at:k})})(u.data))),u.url=My(u.url,u.method,u.compression,u.timestampMode);var y=Rd.filter((C=>!u.disableTransport||!C.transport||!u.disableTransport.includes(C.transport))),_=(a=(o=(function(C,k){for(var E=0;C.length>E;E++)if(C[E].transport===b)return C[E]})(y))==null?void 0:o.method)!==null&&a!==void 0?a:y[0].method;if(!_)throw new Error("No available transport method");var j=C=>{try{_(C)}catch(k){r2(k)?we.warn(k):we.error(k),u.callback==null||u.callback({statusCode:0,error:k})}};b!=="sendBeacon"&&u.data&&u.compression===$n.GZipJS&&OC&&typeof Promise<"u"&&!Md?g4(u).then((C=>{j(C)})).catch((C=>{if(Kb(C))return Md=!0,void j(he({},u,{compression:void 0,url:My(n.url,n.method,void 0,n.timestampMode)}));(k=>{if(!k||typeof k!="object")return!1;var E="name"in k?String(k.name):"";return Kb(k)||E===R5})(C)&&(Md=!0),j(u)})):_(u)})(he({},t,{callback:n=>{var i,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(a=this.config).on_request_error)==null||i.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Rn(t){this.An?this.An.retriableRequest(t):this._send_request(t)}_execute_array(t){rm++;try{var n,i=[],a=[],o=[];ld(t,(f=>{if(f)if(Ve(n=f[0]))o.push(f);else if(pr(f))try{f.call(this)}catch(h){we.error("Error executing queued PostHog call",f,h)}else Ve(f)&&n==="alias"?i.push(f):Ve(f)&&n.indexOf("capture")!==-1&&pr(this[n])?o.push(f):a.push(f)}));var u=function(f,h){ld(f,(function(p){try{if(Ve(p[0])){var g=h;Rt(p,(function(x){g=g[x[0]].apply(g,x.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(x){we.error("Error executing queued PostHog call",p,x)}}))};u(i,this),u(a,this),u(o,this)}finally{rm--}}push(t){if(rm>0&&Ve(t)&&vt(t[0])){var n=Or.prototype[t[0]];pr(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var a,o,u,f,h,p,g;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pn){if(this.is_capturing())if(!ye(t)&&vt(t)){var x=!this.config.opt_out_useragent_filter&&this._is_bot();if(!x||this.config.__preview_capture_bot_pageviews){var b=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(b==null||!b.isRateLimited){if(this.wn.length>0){var y={};for(var _ of this.wn.slice())try{Ot(y,_())}catch(R){we.error("Failed to produce browser extension event properties",R)}n=he({},y,n??{})}var j;(a=n)!=null&&a.$current_url&&!vt((o=n)==null?void 0:o.$current_url)&&(we.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(j=n)==null||delete j.$current_url),t!=="$exception"||i!=null&&i.Un||we.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 C=new Date,k=(i==null?void 0:i.timestamp)||C,E=ny(i==null?void 0:i.uuid,Pi),N={uuid:E,event:t,properties:this.calculateEventProperties(t,n||{},k,E)};t===bl&&this.config.__preview_capture_bot_pageviews&&x&&(N.event="$bot_pageview",N.properties.$browser_type="bot"),b&&(N.properties.$lib_rate_limit_remaining_tokens=b.remainingTokens);var D=t==="$feature_flag_called"&&N.properties.$feature_flag_has_experiment===!1&&this.get_property(Yd)===!0;i!=null&&i.$set&&!D&&(N.$set=i==null?void 0:i.$set);var O=i==null?void 0:i.$unset;O&&(N.$unset=O);var L,G,P,Q=D?void 0:this.zn(i==null?void 0:i.$set_once,t!==oy,t===Vp);if(Q&&(N.$set_once=Q),i!=null&&i._noTruncate||(f=this.config.properties_string_max_length,h=N,p=R=>vt(R)?R.slice(0,f):R,g=new Set,N=(function R(z,Z){if(z!==Object(z))return p?p(z):z;if(!g.has(z)){var A;if(g.add(z),Ve(z))A=[],ld(z,(xe=>{A.push(R(xe))}));else{var ue={};Rt(z,((xe,je)=>{g.has(xe)||(ue[je]=R(xe))})),A=ue}return A}})(h)),N.timestamp=k,ye(i==null?void 0:i.timestamp)||(N.properties.$event_time_override_provided=!0,N.properties.$event_time_override_system_time=C),D&&(N.properties=(function(R,z){z===void 0&&(z=[]);var Z={},A=ue=>{R[ue]!==void 0&&(Z[ue]=R[ue])};return BC.forEach(A),z.forEach(A),Z})(N.properties,L4)),t===Ui.DISMISSED||t===Ui.SENT){var B,I,M=(B=n)==null?void 0:B[Zp.SURVEY_ID],le=(I=n)==null?void 0:I[Zp.SURVEY_ITERATION];d2({id:M,current_iteration:le}),N.$set=he({},N.$set,{[(L={id:M,current_iteration:le},G=t===Ui.SENT?"responded":"dismissed",P="$survey_"+G+"/"+L.id,L.current_iteration&&L.current_iteration>0&&(P="$survey_"+G+"/"+L.id+"/"+L.current_iteration),P)]:!0})}else t===Ui.SHOWN&&(N.$set=he({},N.$set,{[Zp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===o4.SHOWN){var J,Y=(J=n)==null?void 0:J[jy.TOUR_TYPE];Y&&(N.$set=he({},N.$set,{[jy.TOUR_LAST_SEEN_DATE+"/"+Y]:new Date().toISOString()}))}var $=he({},N.properties.$set,N.$set);if(Ii($)||this.setPersonPropertiesForFlags($),!We(this.config.before_send)){var F=this.Pt(N);if(!F)return;(N=F).uuid=ny(N.uuid,Pi)}this.vn.emit("eventCaptured",N);var V=(u=i==null?void 0:i._url)!==null&&u!==void 0?u:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),ge={method:"POST",url:V,data:N,compression:"best-available",timestampMode:(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(V)?"body":"capture-body",batchKey:i==null?void 0:i._batchKey,transport:i==null?void 0:i.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Rn(ge):this.Pn.enqueue(ge),N}we.critical("This capture call is ignored due to client rate limiting.")}}else we.error("No event name provided to posthog.capture")}else we.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}Wn(){var t;return(t=this.Nn)!==null&&t!==void 0?t:this.Nn=new R4(this)}fn(t){this.wn.push(t);var n=!0;return()=>{if(n){n=!1;var i=this.wn.indexOf(t);i!==-1&&this.wn.splice(i,1)}}}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=o?void 0:this.persistence.remove_event_timer(t),f=he({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.mn()&&(f[vw]=!0),t==="$snapshot"){var h=he({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!vt(f.distinct_id)&&!sn(f.distinct_id)||Ym(f.distinct_id))&&we.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(N,D,O,L){var G,P,Q,B;if(L===void 0&&(L=!1),!er)return{};var I,M=N?[...Ml,...D||[]]:[],le=(function(Jt){for(var pt=0;ey.length>pt;pt++){var _t=ey[pt],Nt=_t[1],ve=_t[0].exec(Jt),Fe=ve&&(pr(Nt)?Nt(ve,Jt):Nt);if(Fe)return Fe}return["",""]})(er),J=le[0],Y=le[1],$=(I=typeof navigator<"u"?navigator:void 0)!=null&&I.brave?{brave:!0}:{},F={};ye(O)||(F.detectGoogleSearchApp=O);var V={},ge=(G=navigator)==null||(G=G.userAgentData)==null?void 0:G.platform,R=(P=navigator)==null?void 0:P.maxTouchPoints,z=ie==null||(Q=ie.screen)==null?void 0:Q.width,Z=ie==null||(B=ie.screen)==null?void 0:B.height,A=ie==null?void 0:ie.devicePixelRatio;ye(ge)||(V.userAgentDataPlatform=ge),ye(R)||(V.maxTouchPoints=R),ye(z)||(V.screenWidth=z),ye(Z)||(V.screenHeight=Z),ye(A)||(V.devicePixelRatio=A);var ue,xe,je,Re,Le,Be,Je,it,ht=Ot(nx({$os:J,$os_version:Y,$browser:rw(er,navigator.vendor,$,F),$device:ty(er),$device_type:(xe=er,je=V,it=ty(xe),it===$5||it===P5||it==="Kobo"||it==="Kindle Fire"||it===Z5?Cl:it===yc||it===jl||it===_c||it===Qm?"Console":it===U5?"Wearable":it?gr:(je==null?void 0:je.userAgentDataPlatform)==="Android"&&((Re=je==null?void 0:je.maxTouchPoints)!==null&&Re!==void 0?Re:0)>0?600>Math.min((Le=je==null?void 0:je.screenWidth)!==null&&Le!==void 0?Le:0,(Be=je==null?void 0:je.screenHeight)!==null&&Be!==void 0?Be:0)/((Je=je==null?void 0:je.devicePixelRatio)!==null&&Je!==void 0?Je:1)?gr:Cl:"Desktop"),$timezone:Gw(),$timezone_offset:s4()}),{$current_url:jc(L?Ts(Vt==null?void 0:Vt.href):Vt==null?void 0:Vt.href,M,Nc),$host:Vt==null?void 0:Vt.host,$pathname:Vt==null?void 0:Vt.pathname,$raw_user_agent:er.length>1e3?er.substring(0,997)+"...":er,$browser_version:n3(er,navigator.vendor,$,F),$browser_language:ky(),$browser_language_prefix:(ue=ky(),typeof ue=="string"?ue.split("-")[0]:void 0),$screen_height:ie==null?void 0:ie.screen.height,$screen_width:ie==null?void 0:ie.screen.width,$viewport_height:ie==null?void 0:ie.innerHeight,$viewport_width:ie==null?void 0:ie.innerWidth,$lib:jt.LIB_NAME,$lib_version:jt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return jt.SDK_DIST_CHANNEL&&(ht.$sdk_dist_channel=jt.SDK_DIST_CHANNEL),ht})(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 x=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime()),b=x.windowId;f.$session_id=x.sessionId,f.$window_id=b}this.sessionPropsManager&&Ot(f,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&Ot(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(y=this.An)==null?void 0:y.length}catch(N){f.$sdk_debug_error_capturing_properties=String(N)}if(this.requestRouter.region===jg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==bl||o?t!==qp||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),f=Ot(f,p),t===bl&&ke&&(f.title=ke.title),!ye(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}er&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),C=this.sessionPersistence.properties();Rt(["$referrer","$referring_domain"],(N=>{N in j&&delete C[N]})),(f=Ot({},g,j,C,f)).$is_identified=this._isIdentified(),Ve(this.config.property_denylist)?Rt(this.config.property_denylist,(function(N){delete f[N]})):we.error(f2+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(we.error(By),f=k(f,t));var E=this.Vn();return f.$process_person_profile=E,E&&!o&&this.Zn("_calculate_event_properties"),f}zn(t,n,i){var a;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.Vn()||this.yn&&!i)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=Ot({},o,u||{},t||{}),h=this.config.sanitize_properties;return h&&(we.error(By),f=h(f,"$set_once")),n&&(this.yn=!0),Ii(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)==null||a.register_once(t,n,i)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t),Object.keys(t).forEach((i=>this.bn.add(i))),this.Gn()}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t),this.bn.delete(t),this.Gn()}Qn(t,n){this.register({[t]:n})}Fn(){this.bn.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.bn.clear(),this.Gn()}Gn(){var t;if(this._n)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.xi||!Zt.N())Zt.q(this._n);else{var n=[];this.bn.forEach((i=>n.push(i))),n.length>0?Zt.F(this._n,n):Zt.q(this._n)}}getFeatureFlag(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)==null?void 0:i.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 i,a;return(i=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.vn.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:qo}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)==null?void 0:i.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:qo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:qo})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=N4),(i=this.surveys)==null||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:qo}}canRenderSurveyAsync(t,n){var i,a;return n===void 0&&(n=!1),(i=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:qo})}Kn(t){return!t||Ym(t)?(we.critical("Unique user id has not been set in posthog.identify"),!1):t===ad?(we.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())||(we.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,i){if(!this.__loaded||!this.persistence)return we.uninitializedWarning("posthog.identify");if(sn(t)&&(t=t.toString(),we.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Kn(t)&&this.Zn("posthog.identify")){var a=this.get_distinct_id();this.register({$user_id:t}),this.get_property(wc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:a},""),t!==a&&t!==this.get_property(ec)&&(this.unregister(ec),this.register({distinct_id:t}));var o,u=(this.persistence.get_property(zr)||fl)===fl,f=t!==a,h=!f&&u;if(f&&u)this.persistence.set_property(zr,ia),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Vp,{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:i||{}}),this.Cn=nm(t,n,i),(o=this.featureFlags)==null||o.setAnonymousDistinctId(a);else if(h){this.persistence.set_property(zr,ia);var p=n||{},g=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.capture("$set",{$set:p,$set_once:g}),this.Cn=nm(t,n,i)}else(n||i)&&this.setPersonProperties(n,i);f?(this.reloadFeatureFlags(),this.unregister(cc)):h&&(n||i)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.Zn("posthog.setPersonProperties")){var i=nm(this.get_distinct_id(),t,n);this.Cn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Cn=i):we.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,i=(Ve(t)?t:[t]).filter((a=>vt(a)&&a.length>0));i.length!==0&&this.Zn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Cn=null)}group(t,n,i){if(t&&n){var a=this.getGroups(),o=a[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:he({},a,{[t]:n})}),o||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(oy,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),o&&!i&&this.reloadFeatureFlags()}else we.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),this.Zn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){this.Jn(t)}Jn(t,n){var i,a,o,u,f,h,p,g,x,b;if(n===void 0&&(n=!1),we.info("reset"),!this.__loaded)return we.uninitializedWarning("posthog.reset");var y,_=this.get_property(wc),j=this.get_property(Hp),C=this.get_property(xa),k=this.is_capturing();if(this.consent.reset(),n||!k||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after."),(i=this.persistence)==null||i.clear(),(a=this.sessionPersistence)==null||a.clear(),this.bn.clear(),this.Gn(),ye(C)||(y=this.persistence)==null||y.register({[xa]:C}),(o=this.surveys)==null||o.reset(),(u=this.Bn)==null||u.stop(),(f=this.featureFlags)==null||f.reset(),(h=this.conversations)==null||h.reset(),(p=this.logs)==null||p.reset(),(g=this.metrics)==null||g.reset(),(x=this.persistence)==null||x.set_property(zr,fl),(b=this.sessionManager)==null||b.resetSessionId(),this.Cn=null,this.config.cookieless_mode===$i)this.register_once({distinct_id:ad,$device_id:null},"");else{var E=this.config.get_device_id(Pi());this.register_once({distinct_id:E,$device_id:t?E:_},""),t||ye(j)||this.register({[Hp]:j})}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 Ut((function*(){var i,a,o,u,f,h,p,g;n.__loaded?((i=n.Bn)==null||i.stop(),(a=n.Nn)==null||a.dispose(),(o=n.sessionRecording)==null||o.dispose(),(u=n.logs)==null||u.flushLogs("sendBeacon"),(f=n.metrics)==null||f.flush("sendBeacon"),(h=n.Pn)==null||h.unload(),(p=n.An)==null||p.unload(),(g=n.featureFlags)==null||g.destroy()):we.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.Yn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.Xn()}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),i=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&i){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(fw)?(we.critical("Attempting to create alias for existing People user - aborting."),-2):this.Zn("posthog.alias")?(ye(n)&&(n=this.get_distinct_id()),t!==n?(this.Qn(ec,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(we.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=he({},this.config);if(Bt(t)){var i,a,o,u,f,h,p,g,x,b,y;Ot(this.config,Py(t));var _=this.In();(i=this.persistence)==null||i.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Xp(he({},this.config,{persistence:"sessionStorage"}),_,!1);var j=this.Mn(this.config.debug);Wr(j)&&(this.config.debug=j),Wr(this.config.debug)&&(this.config.debug?(jt.DEBUG=!0,zt.N()&&zt.F("ph_debug",!0),we.info("set_config",{config:t,oldConfig:n,newConfig:he({},this.config)})):(jt.DEBUG=!1,zt.N()&&zt.q("ph_debug"))),(a=this.exceptionObserver)==null||a.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(u=this.sessionRecording)==null||u.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(x=this.deadClicksAutocapture)==null||x.startIfEnabledOrStop(),(b=this.surveys)==null||b.loadIfEnabled(),this.ts(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){jt.LIB_NAME=t,jt.LIB_VERSION=n}startSessionRecording(t){var n,i,a,o,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),h.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.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 i=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(he({},a,n))}}addExceptionStep(t,n){var i;(i=this.exceptions)==null||i.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:Or.es}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)==null?void 0:i.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:yl;return n!==yl&&(n=yl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(zr))===ia||((n=this.sessionPersistence)==null?void 0:n.get_property(zr))===ia}Vn(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===gg&&!this._isIdentified()&&Ii(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[ec])&&((n=this.persistence)==null||(n=n.props)==null||!n[Xd]))}Hn(){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.Vn()||this.Zn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Zn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Zn(t){return this.config.person_profiles==="never"?(we.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Qn(Xd,!0),!0)}In(){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!==pa)}ts(){var t,n,i,a,o=this.In();return((t=this.persistence)==null?void 0:t.xi)!==o&&((i=this.persistence)==null||i.set_disabled(o)),((n=this.sessionPersistence)==null?void 0:n.xi)!==o&&((a=this.sessionPersistence)==null||a.set_disabled(o)),o&&(this.bn.clear(),this.Gn()),o}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==$i){if(this.mn()){var i,a,o,u,f;this.Jn(!0,!0),(i=this.sessionManager)==null||i.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new Ly(this),this.pageViewManager=new Sy(this),this.persistence&&(this.sessionPropsManager=new Ry(this,this.sessionManager,this.persistence));var h,p=(o=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&o!==void 0?o:(f=Or.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.gn(this.sessionRecording,new p(this)),this.dn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.dn)))}var g,x;this.consent.optInOut(!0),this.ts(),this.qn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==pa&&((g=this.surveys)==null||g.loadIfEnabled()),(ye(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((x=t==null?void 0:t.captureEventName)!==null&&x!==void 0?x:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.jn()}else we.warn(Oy)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==$i?(this.config.cookieless_mode===pa&&this.consent.isOptedIn()&&this.Jn(!0,!0),this.consent.optInOut(!1),this.ts(),this.config.cookieless_mode===pa&&(this.register({distinct_id:ad,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.jn(),this.qn())):we.warn(Oy)}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===$i||(this.config.cookieless_mode===pa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ts()}_is_bot(){return In?s2(In,this.config.custom_blocked_useragents):void 0}jn(){ke&&(ke.visibilityState==="visible"?this.kn||(this.kn=!0,this.capture(bl,{title:ke.title},{send_instantly:!0}),this.xn&&(ke.removeEventListener(Kd,this.xn),this.xn=null)):this.xn||(this.xn=this.jn.bind(this),Gt(ke,Kd,this.xn)))}debug(t){t===!1?(ie==null||ie.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ie==null||ie.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}))}Ki(){var t=this.Tn||{};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?(we.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,i,a,o,u){var f=i in n&&!We(n[i]),h=a in n&&!We(n[a]);return f?n[i]:!!h&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,we)}Pt(t){var n;if(We(this.config.before_send))return t;var i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(qC),a=Ve(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a){if(o=u(o),We(o)){var f="Event '"+t.event+"' was rejected in beforeSend function";return HC(t.event)?we.warn(f+". This can cause unexpected behavior."):we.info(f),null}o.properties&&!Ii(o.properties)||we.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of i)if(o.properties&&We(o.properties[h]))return we.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return o}getPageViewId(){var t;return(t=this.pageViewManager.ui)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}Mn(t){var n=Wr(t)&&!t,i=zt.N()&&zt.P("ph_debug")==="true";return!n&&(!!i||t)}}Or.__defaultExtensionClasses={},Or.es=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=R3(e.prototype[t[n]])})(Or,["identify"]);class $y{constructor(t){this.disabled=t===!1;var n=Bt(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,i){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>i-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:i}];return!1}}var sm="$copy_autocapture",am=Wt("[AutoCapture]");function lm(e,t){return t.length>e?t.slice(0,e)+"...":t}function O4(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!As(t));return t}function B4(e,t){var n,i,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,f=t.elementAttributeIgnoreList,h=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!As(e))return{props:{}};for(var g=[e],x=new Set([e]),b=e;b.parentNode&&!mr(b,"body")&&Tw>g.length;)if(Ew(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),g.push(y),b=y}else{if(!As(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),g.push(b.parentNode),b=b.parentNode}var _,j,C=[],k={},E=!1,N=!1;if(Rt(g,(P=>{var Q=vg(P);if(mr(P,"a")){var B=P.getAttribute("href");E=!!(Q&&B&&uc(B))&&(p?Ts(B):B)}qe(ef(P),"ph-no-capture")&&(N=!0),C.push((function(M,le,J,Y,$){$===void 0&&($=!1);var F=M.tagName.toLowerCase(),V={tag_name:F};ix.indexOf(F)>-1&&!J&&(V.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?lm(1024,yy(M)):lm(1024,kc(M)));var ge=ef(M);ge.length>0&&(V.classes=ge.filter((function(A){return A!==""}))),Rt(M.attributes,(function(A){var ue;if((!Dw(M)||["name","id","class","aria-label"].indexOf(A.name)!==-1)&&(Y==null||!Y.includes(A.name))&&!le&&uc(A.value)&&(!vt(ue=A.name)||ue.substring(0,10)!=="_ngcontent"&&ue.substring(0,7)!=="_nghost")){var xe=A.value;A.name==="class"&&(xe=rx(xe).join(" ")),V["attr__"+A.name]=lm(1024,A.name==="href"&&$?Ts(xe):xe)}}));for(var R=1,z=1,Z=M;Z=O4(Z);)R++,Z.tagName===M.tagName&&z++;return V.nth_child=R,V.nth_of_type=z,V})(P,o,u,f,p));var I=(function(M){if(!vg(M))return{};var le={};return Rt(M.attributes,(function(J){if(J.name&&J.name.indexOf("data-ph-capture-attribute")===0){var Y=J.name.replace("data-ph-capture-attribute-",""),$=J.value;Y&&$&&uc($)&&(le[Y]=$)}})),le})(P);Ot(k,I)})),N)return{props:{},explicitNoCapture:N};if(u||(C[0].$el_text=mr(e,"a")||mr(e,"button")?yy(e):kc(e)),E){var D,O;C[0].attr__href=E;var L=(D=tf(E))==null?void 0:D.host,G=ie==null||(O=ie.location)==null?void 0:O.host;L&&G&&L!==G&&(_=E)}return{props:Ot({$event_type:a.type,$ce_version:1},h?{}:{$elements:C},{$elements_chain:(j=C,(function(P){return P.map((Q=>{var B,I,M="";if(Q.tag_name&&(M+=Q.tag_name),Q.attr_class)for(var le of(Q.attr_class.sort(),Q.attr_class))M+="."+le.replace(/"/g,"");var J=he({},Q.text?{text:Q.text}:{},{"nth-child":(B=Q.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(I=Q.nth_of_type)!==null&&I!==void 0?I:0},Q.href?{href:Q.href}:{},Q.attr_id?{attr_id:Q.attr_id}:{},Q.attributes),Y={};return Ad(J).sort((($,F)=>$[0].localeCompare(F[0]))).forEach(($=>{var F=$[1];return Y[_y($[0].toString())]=_y(F.toString())})),(M+=":")+Ad(Y).map(($=>$[0]+'="'+$[1]+'"')).join("")})).join(";")})((function(P){return P.map((Q=>{var B,I,M={text:(B=Q.$el_text)==null?void 0:B.slice(0,400),tag_name:Q.tag_name,href:(I=Q.attr__href)==null?void 0:I.slice(0,2048),attr_class:K3(Q),attr_id:Q.attr__id,nth_child:Q.nth_child,nth_of_type:Q.nth_of_type,attributes:{}};return Ad(Q).filter((le=>le[0].indexOf("attr__")===0)).forEach((le=>M.attributes[le[0]]=le[1])),M}))})(j)))},(n=C[0])!=null&&n.$el_text?{$el_text:(i=C[0])==null?void 0:i.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},k)}}var Vo=Wt("[ExceptionAutocapture]"),Fy=()=>{},P4=Wt("[TracingHeaders]"),la=Wt("[Web Vitals]"),Uy=9e5,Iy="disabled",Hy="lazy_loading",Go="awaiting_config",hd="missing_config";Wt("[SessionRecording]"),Wt("[SessionRecording]");var Ng="[SessionRecording]",Ri=Wt(Ng),$4=Wt("[Heatmaps]");function om(e){return Bt(e)&&"clientX"in e&&"clientY"in e&&sn(e.clientX)&&sn(e.clientY)}var pd=Wt("[Product Tours]"),cm=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Jg))},F4=["$set_once","$set"],ai=Wt("[SiteApps]"),qy="Error while initializing PostHog app with config id ";function ml(e,t,n){if(We(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class U4{constructor(t){this.rs=new ox,this.ns=(n,i)=>this.ss(n,i)&&this.os(n,i)&&this.ls(n,i)&&this.us(n,i),this.ss=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this.hs=new Set,this.ds=new Set}init(){var t,n;ye((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,a)=>{this.on(i,a)}))}register(t){var n,i;if(!ye((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.ds)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.hs)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var a,o=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&o.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(o)}}on(t,n){var i;n!=null&&t.length!=0&&(this.hs.has(t)||this.hs.has(n.event))&&this.ds&&((i=this.ds)==null?void 0:i.size)>0&&this.ds.forEach((a=>{this.vs(n,a)&&this.rs.emit("actionCaptured",a.name)}))}cs(t){this.onAction("actionCaptured",(n=>t(n)))}vs(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.ns(t,i))return!0;return!1}onAction(t,n){return this.rs.on(t,n)}os(t,n){if(n!=null&&n.url){var i,a=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!a||typeof a!="string"||!ml(a,n.url,n.url_matching||"contains"))return!1}return!0}ls(t,n){return!!this.fs(t,n)&&!!this.ps(t,n)&&!!this.gs(t,n)}fs(t,n){var i;if(n==null||!n.href)return!0;var a=this.ys(t);if(a.length>0)return a.some((f=>ml(f.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&ml((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}ps(t,n){var i;if(n==null||!n.text)return!0;var a=this.ys(t);if(a.length>0)return a.some((p=>ml(p.text,n.text,n.text_matching||"exact")||ml(p.$el_text,n.text,n.text_matching||"exact")));var o,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(o=(function(p){for(var g,x=[],b=/(?::|")text="(.*?)"/g;!We(g=b.exec(p));)x.includes(g[1])||x.push(g[1]);return x})(h),u=n.text,f=n.text_matching||"exact",o.some((p=>ml(p,u,f))))}gs(t,n){var i,a;if(n==null||!n.selector)return!0;var o=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(o!=null&&o.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}ys(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}us(t,n){return n==null||!n.properties||n.properties.length===0||o2(n.properties.reduce(((i,a)=>{var o=Ve(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return i[a.key]={values:o,operator:a.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class I4{constructor(t){var n;this.bs=[],this._instance=t,this._s=new Map,this.ws=new Map,this.ks=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((i=>this.xs(i)))}Ss(t){return!1}Cs(){return null}Ms(t){}Ts(){}Es(t,n){return!!t&&o2(t.propertyFilters,n==null?void 0:n.properties)}Is(t,n){var i=new Map;return t.forEach((a=>{var o;(o=a.conditions)==null||(o=o[n])==null||(o=o.values)==null||o.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(a.id),i.set(u.name,f)}}))})),i}Ps(t,n,i){var a=(i===Fo.Activation?this._s:this.ws).get(t),o=[];return this.Rs((u=>{o=u.filter((f=>a==null?void 0:a.includes(f.id)))})),o.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[i])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Es(h,n)}))}register(t){var n;ye((n=this._instance)==null?void 0:n._addCaptureHook)||(this.As(t),this.Fs(t))}Fs(t){var n=t.filter((i=>{var a,o;return((a=i.conditions)==null?void 0:a.actions)&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));n.length!==0&&(this.Ls==null&&(this.Ls=new U4(this._instance),this.Ls.init(),this.Ls.cs((i=>{this.onAction(i)}))),n.forEach((i=>{var a,o,u,f,h;i.conditions&&(a=i.conditions)!=null&&a.actions&&(o=i.conditions)!=null&&(o=o.actions)!=null&&o.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.Ls)==null||f.register(i.conditions.actions.values),(h=i.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.ks.get(p.name);g&&g.push(i.id),this.ks.set(p.name,g||[i.id])}})))})))}As(t){var n,i=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.events)&&((f=o.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.cancelEvents)&&((f=o.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((o,u)=>{this.onEvent(o,u)})),this._s=this.Is(t,Fo.Activation),this.ws=this.Is(t,Fo.Cancellation))}onEvent(t,n){var i,a,o=this.Os(),u=(n==null||(i=n.properties)==null?void 0:i.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.Ds(t,u);if(f==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.$s([u]);if(f==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),this.Ns(u),void this.qs([u])}if(this.ws.has(t)){var h=this.Ps(t,n,Fo.Cancellation);h.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.$s(h.map((g=>g.id))),h.forEach((g=>this.js(g.id))))}if(this._s.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this._s.get(t)});var p=this.Ps(t,n,Fo.Activation);this.Bs(p.map((g=>g.id)))}}onAction(t){this.ks.has(t)&&this.Bs(this.ks.get(t)||[])}Bs(t){var n;if(t.length!==0){var i=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),a=[];for(var o of t)i&&this.Ss(o)?this.Ns(o)&&this.Hs(o):a.push(o);a.length>0&&(this.bs=[...new Set([...this.bs,...a])]),this.Os().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Ns(t){this.bs=this.bs.filter((i=>i!==t));var n=this.Us();return!n.includes(t)&&(this.zs([...n,t]),this.Ws(),!0)}$s(t){var n=new Set(t);this.bs=this.bs.filter((o=>!n.has(o)));var i=this.Vs(),a=i.filter((o=>!n.has(o)));a.length!==i.length&&(this.zs(a),a.length===0&&this.Zs()),this.qs(t)}Gs(){var t,n=this.Cs();if(!n)return{};var i=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return i&&typeof i=="object"?i:{}}Hs(t){if(this.Cs()){var n=this.Gs();this.Ms(he({},n,{[t]:Date.now()}))}}qs(t){if(this.Cs()){var n=this.Gs(),i={},a=!1;for(var o of Object.entries(n)){var u=o[0],f=o[1];t.includes(u)?a=!0:i[u]=f}a&&(Ii(i)?this.Ts():this.Ms(i))}}Qs(){this.Cs()&&this.Ts()}getActivationTimestamp(t){if(this.Us().includes(t)){var n=this.Gs()[t];return sn(n)?n:void 0}}Vs(){var t,n=this.Ks();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Us(){var t,n,i=this.Vs();if(i.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Js()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?i:[]}Ws(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Ys(n)}Zs(){this.Xs()}xs(t){var n,i=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Js()];if(i&&i!==t){var a=this.Vs(),o=this.Gs();a.length>0&&(this.zs([]),a.filter((u=>sn(o[u]))).forEach((u=>this.js(u)))),this.Zs(),this.Qs()}}getActivatedIds(){return[...new Set([...this.Us(),...this.bs])].filter((t=>!this.ta(t)))}reset(){this.bs=[],this.Vs().length>0&&this.zs([]),this.Zs(),this.Qs()}getEventToItemsMap(){return this._s}ea(){return this.Ls}}class H4 extends I4{constructor(t){super(t)}Ks(){return cg}Js(){return Ed}Cs(){return Td}Ms(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Td]:t})}Ts(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Td)}Ss(t){var n,i;this.Rs((o=>{i=o.find((u=>u.id===t))}));var a=(n=i)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return sn(a)&&a>0}ia(){return Ui.SHOWN}Rs(t){var n;(n=this._instance)==null||n.getSurveys(t)}js(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Os(){return kt}zs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[cg]:t})}Ys(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Ed]:t})}Xs(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Ed)}ta(){return!1}Ds(t,n){var i;this.Rs((o=>{i=o.find((u=>u.id===n))}));var a=!i||(function(o){var u;return c2(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(i);return a?t===Ui.SHOWN?"consume":"ignore":t===Ui.SHOWN?"persist":t===Ui.DISMISSED||t===Ui.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var md="SDK is not enabled or survey functionality is not yet loaded",Vy="Disabled. Not loading surveys.",q4=ie!=null&&ie.location?nf(ie.location.hash,"__posthog")||nf(location.hash,"state"):null,Gy="_postHogToolbarParams",Yy=Wt("[Toolbar]"),pn=Wt("[FeatureFlags]"),oa=Wt("[FeatureFlags]",{debugEnabled:!0}),um=`" failed. Feature flags didn't load in time.`,Wy=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Qy=e=>{var t={};for(var n of Ad(e||{})){var i=n[1];i&&(t[n[0]]=i)}return t},li=Wt("[Error tracking]"),Xy="Refusing to render web experiment since the viewer is a likely bot",V4={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>af(t,e),not_regex:(e,t)=>!af(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Mn{get Ne(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((a=>{Mn.ra("retrieved web experiments from the server"),n.na=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.na&&(Mn.ra("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.na)==null||u.set(o.feature_flag_key,o));var f=n._instance.getFeatureFlag(o.feature_flag_key);vt(f)&&o.variants[f]&&n.sa(o.name,f,o.variants[f].transforms)}else if(o.variants)for(var h in o.variants){var p=o.variants[h];Mn.aa(p,n._instance)&&n.sa(o.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.ra(Xy);else if(!this.Ne.disable_web_experiments){if(We(this.na))return this.na=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.ra("applying feature flags",t),t.forEach((n=>{var i;if(this.na&&(i=this.na)!=null&&i.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.na)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.sa(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=Al(t==null?void 0:t.search,"__experiment_id"),i=Al(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Mn.ra("previewing web experiments "+n+" && "+i),this.getWebExperiments((a=>{this.oa(parseInt(n),i,a)}),!1,!0))}}loadIfEnabled(){this.Ne.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Ne.disable_web_experiments&&!i)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Ne.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}oa(t,n,i){var a=i.filter((o=>o.id===t));a&&a.length>0&&(Mn.ra("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.sa(a[0].name,n,a[0].variants[n].transforms))}static aa(t,n){return!We(t.conditions)&&Mn.la(t,n)&&Mn.ua(t)}static la(t,n){var i;if(We(t.conditions)||We((i=t.conditions)==null?void 0:i.url))return!0;var a=Mn.getWindowLocation();if(a){var o,u,f,h=jw(n,a.href);return(o=t.conditions)==null||!o.url||V4[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return ie==null?void 0:ie.location}static ua(t){var n;if(We(t.conditions)||We((n=t.conditions)==null?void 0:n.utm))return!0;var i=Fw();if(i.utm_source){var a,o,u,f,h,p,g,x,b=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==i.utm_campaign,y=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==i.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==i.utm_medium,j=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((x=t.conditions)==null||(x=x.utm)==null?void 0:x.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static ra(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;n>a;a++)i[a-1]=arguments[a];we.info("[WebExperiments] "+t,i)}sa(t,n,i){this._is_bot()?Mn.ra(Xy):n!=="control"?i.forEach((a=>{if(a.selector){var o;Mn.ra("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Mn.ra("Control variants leave the page unmodified.")}_is_bot(){return In&&this._instance?s2(In,this.Ne.custom_blocked_useragents):void 0}}var Rr=Wt("[Conversations]"),ca="Conversations not available yet.",Ky="console",p2="__posthogHandledLogsRequestError",dm=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[p2]=!0,n},Zy=e=>!!e&&typeof e=="object"&&e[p2]===!0,bf={featureFlags:class{constructor(e){this.ha=!1,this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.ga=!1,this.ma=!1,this.ya=0,this.ba=()=>{var t=this._a();this.ya=0,t&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],ie&&Gt(ie,"online",this.ba)}destroy(){ie==null||ie.removeEventListener("online",this.ba)}get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}wa(e){return this._instance.get_property(e)}ka(){var e,t;return(e=(t=this.Tr)==null?void 0:t.Ci(this.Ne.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}xa(){return!!this.ka()&&(this.ma||this.va||(this.ma=!0,pn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Sa(){var e,t=(e=this.Ne.evaluation_contexts)!==null&&e!==void 0?e:this.Ne.evaluation_environments;return!this.Ne.evaluation_environments||this.Ne.evaluation_contexts||this.ga||(pn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ga=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||pn.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}Ca(){return this.Sa().length>0}Ma(){var e=this.Ne.flag_keys;if(!ye(e)){if(Ve(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||pn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));pn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,n=this._instance.config,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},f=Object.keys(i).filter((p=>!!i[p])).reduce(((p,g)=>(p[g]=i[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var i,a,o=n!=null&&n.merge&&(i=this.wa(ga))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.wa(Cd))!==null&&a!==void 0?a:{},f=he({},o,e),h=he({},u,t),p={};for(var g of Object.entries(f)){var x=g[0],b=g[1];p[x]={key:x,enabled:Yb(b),variant:Wb(b),reason:void 0,metadata:ye(h==null?void 0:h[x])?void 0:{id:0,version:void 0,description:void 0,payload:h[x]}}}this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.da}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.wa(ag),t=this.wa(Oi),n=this.wa(vl);if(!n&&!t)return e||{};var i=Ot({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,f,h=i[o],p=t==null?void 0:t[o],g=ye(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,x=ye(p)?h.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=he({},h,{enabled:g,variant:g?x??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=he({},h==null?void 0:h.metadata,{payload:b,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[o]=y}return this.ha||(pn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ha=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var i=e[n];return{key:n,enabled:Yb(i),variant:Wb(i),payload:Gb(t[n])}}))}getFlagVariants(){var e=this.wa(ga),t=this.wa(Oi);if(!t)return e||{};for(var n=Ot({},e),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ha||(pn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ha=!0),n}getFlagPayloads(){var e=this.wa(Cd),t=this.wa(vl);if(!t)return e||{};for(var n=Ot({},e||{}),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ha||(pn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ha=!0),n}reloadFeatureFlags(){this.ca||this.Ne.advanced_disable_feature_flags||this._a()||this.Ta||(this._instance.vn.emit("featureFlagsReloading",!0),this.Ta=setTimeout((()=>{this.Ea()}),5))}Ia(){clearTimeout(this.Ta),this.Ta=void 0}ensureFlagsLoaded(){this.da||this.va||this.Ta||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ca=e}Ea(e){var t;if(this.Ia(),!this._instance.Ki()&&!this._a())if(this.va)this.fa=!0;else{var n=this.Ne.token,i=this.wa(wc),a={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:he({},((t=this.Tr)==null?void 0:t.get_initial_props())||{},this.wa(fa)||{},{$lib:jt.LIB_NAME,$lib_version:jt.LIB_VERSION}),group_properties:this.wa(ha),timezone:Gw()};Hn(i)||ye(i)||(a.$device_id=i),(e!=null&&e.disableFlags||this.Ne.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.Ca()&&(a.evaluation_contexts=this.Sa());var o=this.Ma();ye(o)||(a.flag_keys=o);var u=!!this.Ne.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Ne.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.va=!0,this._instance._send_request({method:"POST",url:f,data:a,compression:this.Ne.disable_compression?void 0:$n.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback:h=>{var p,g,x,b=!0;if(this.Pa(h.statusCode),h.statusCode===200&&(this.fa||(this.$anon_distinct_id=void 0),b=!1),this.va=!1,!a.disable_flags||this.fa){this.pa=!b;var y=[];h.error?h.error instanceof Error?y.push(h.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):h.statusCode!==200&&y.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var _,j=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));j&&y.push("quota_limited"),(x=this.Tr)==null||x.register({[dg]:y}),j?pn.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."):(a.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},b,{partialResponse:u}),this.fa&&(this.fa=!1,this.Ea()))}}})}}_a(){return Pw(this.ya,3)}Pa(e){this.ya=$w(e,this.ya,3,(()=>pn.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}}else pn.warn('getFeatureFlag for key "'+e+um)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.pa)if(this.da||this.getFlags()&&this.getFlags().length>0){if(!this.xa()){var n=this.getFlagVariants(),i=e in n,a=n[e],o=this.getFlagPayloads()[e],u=String(a),f=this.wa(lg)||void 0,h=this.wa(Sc)||void 0,p=this.wa(cc)||{};if(this.Ne.advanced_feature_flags_dedup_per_session){var g,x=this._instance.get_session_id(),b=this.wa(ug);x&&x!==b&&(p={},(g=this.Tr)==null||g.register({[cc]:p,[ug]:x}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var y,_,j,C,k,E,N,D,O,L,G;Ve(p[e])?p[e].push(u):p[e]=[u],(y=this.Tr)==null||y.register({[cc]:p});var P=this.getFeatureFlagDetails(e),Q=[...(_=this.wa(dg))!==null&&_!==void 0?_:[]];ye(a)&&Q.push("flag_missing");var B={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((j=this.Ne.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[e])||null,$feature_flag_bootstrapped_payload:((C=this.Ne.bootstrap)==null||(C=C.featureFlagPayloads)==null?void 0:C[e])||null,$used_bootstrap_value:!this.pa};ye(P==null||(k=P.metadata)==null?void 0:k.has_experiment)||(B.$feature_flag_has_experiment=P.metadata.has_experiment),ye(P==null||(E=P.metadata)==null?void 0:E.version)||(B.$feature_flag_version=P.metadata.version);var I,M=(N=P==null||(D=P.reason)==null?void 0:D.description)!==null&&N!==void 0?N:P==null||(O=P.reason)==null?void 0:O.code;M&&(B.$feature_flag_reason=M),P!=null&&(L=P.metadata)!=null&&L.id&&(B.$feature_flag_id=P.metadata.id),ye(P==null?void 0:P.original_variant)&&ye(P==null?void 0:P.original_enabled)||(B.$feature_flag_original_response=ye(P.original_variant)?P.original_enabled:P.original_variant),P!=null&&(G=P.metadata)!=null&&G.original_payload&&(B.$feature_flag_original_payload=P==null||(I=P.metadata)==null?void 0:I.original_payload),Q.length&&(B.$feature_flag_error=Q.join(",")),this._instance.capture("$feature_flag_called",B)}if(i)return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:Gb(o)}}}else pn.warn('getFeatureFlagResult for key "'+e+um)}getRemoteConfigPayload(e,t){var n=this.Ne.token,i={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:jt.LIB_NAME,$lib_version:jt.LIB_VERSION}};this.Ca()&&(i.evaluation_contexts=this.Sa());var a=this.Ma();ye(a)||(i.flag_keys=a),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Ne.disable_compression?void 0:$n.Base64,timestampMode:"body",timeout:this.Ne.feature_flag_request_timeout_ms,callback(o){var u,f=(u=o.json)==null?void 0:u.featureFlagPayloads;t((f==null?void 0:f[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.pa)return t.defaultValue;if(!(this.da||this.getFlags()&&this.getFlags().length>0))return pn.warn('isFeatureEnabled for key "'+e+um),t.defaultValue;var n=this.getFeatureFlag(e,t);return ye(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.Tr){this.da=!0;var i=this.getFlagVariants(),a=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(u,f,h,p,g,x){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var b=(P=>{var Q=P.flags;return Q?(P.featureFlags=Object.fromEntries(Object.keys(Q).map((B=>{var I;return[B,(I=Q[B].variant)!==null&&I!==void 0?I:Q[B].enabled]}))),P.featureFlagPayloads=Object.fromEntries(Object.keys(Q).filter((B=>Q[B].enabled)).filter((B=>{var I;return(I=Q[B].metadata)==null?void 0:I.payload})).map((B=>{var I;return[B,(I=Q[B].metadata)==null?void 0:I.payload]})))):P.featureFlags&&pn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),P})(u),y=b.flags,_=b.featureFlags,j=b.featureFlagPayloads;if(_){var C=u.requestId,k=u.evaluatedAt;if(Ve(_)){pn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var E={};if(_)for(var N=0;_.length>N;N++)E[_[N]]=!0;f&&f.register({[Nd]:_,[ga]:E,[Yd]:!1})}else{var D=_,O=j,L=y;if(x!=null&&x.partialResponse)D=he({},h,D),O=he({},p,O),L=he({},g,L);else if(u.errorsWhileComputingFlags)if(y){var G=new Set(Object.keys(y).filter((P=>{var Q;return!((Q=y[P])!=null&&Q.failed)})));D=he({},h,Object.fromEntries(Object.entries(D).filter((P=>G.has(P[0]))))),O=he({},p,Object.fromEntries(Object.entries(O||{}).filter((P=>G.has(P[0]))))),L=he({},g,Object.fromEntries(Object.entries(L||{}).filter((P=>G.has(P[0])))))}else D=he({},h,D),O=he({},p,O),L=he({},g,L);f&&f.register(he({[Nd]:Object.keys(Qy(D)),[ga]:D||{},[Cd]:O||{},[ag]:L||{},[Yd]:u.minimalFlagCalledEvents===!0},C?{[lg]:C}:{},k?{[Sc]:k}:{}))}}})(e,this.Tr,i,a,o,n),t||(this.ma=!1),this.Ra(t)}}override(e,t){t===void 0&&(t=!1),pn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Tr)return pn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.Tr.unregister(Oi),this.Tr.unregister(vl),this.Ra(),oa.info("All overrides cleared");if(Ve(e)){var t=Wy(e);return this.Tr.register({[Oi]:t}),this.Ra(),oa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.ha=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.Tr.unregister(Oi),oa.info("Flag overrides cleared");else if(i.flags){if(Ve(i.flags)){var a=Wy(i.flags);this.Tr.register({[Oi]:a})}else this.Tr.register({[Oi]:i.flags});oa.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.Tr.unregister(vl),oa.info("Payload overrides cleared")):i.payloads&&(this.Tr.register({[vl]:i.payloads}),oa.info("Payload overrides set",{payloads:i.payloads}))),void this.Ra()}if(e&&typeof e=="object")return this.Tr.register({[Oi]:e}),this.Ra(),oa.info("Flag overrides set",{flags:e});pn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.da){var t=this.Aa(),n=t.flags,i=t.flagVariants;try{e(n,i)}catch(a){pn.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,a=(this.wa(nc)||[]).find((h=>h.flagKey===e)),o={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(o,!1);var f=he({},this.getFlagVariants(),{[e]:t});(i=this.Tr)==null||i.register({[Nd]:Object.keys(Qy(f)),[ga]:f}),this.Ra()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.wa(nc),a=n?"&"+n.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Ne.token+a),method:"GET",timestampMode:"query",callback:o=>{var u,f;if(o.json){var h=o.json.earlyAccessFeatures;return(u=this.Tr)==null||u.unregister(nc),(f=this.Tr)==null||f.register({[nc]:h}),e(h)}}})}Aa(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}Ra(e){var t=this.Aa(),n=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,i,{errorsLoading:e})}catch(o){pn.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.wa(fa)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this._instance.register({[fa]:he({},n,o,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=he({},this.wa(fa)||{});e.forEach((i=>{delete n[i]})),this._instance.register({[fa]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(fa),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.wa(ha)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=he({},n[i],e[i]),delete e[i]})),this._instance.register({[ha]:he({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.wa(ha)||{};this._instance.register({[ha]:he({},t,{[e]:{}})})}else this._instance.unregister(ha)}reset(){this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.$anon_distinct_id=void 0,this.Ia(),this.ha=!1,this.ya=0}}},G4={sessionRecording:class{get Ne(){return this._instance.config}get Tr(){return this._instance.persistence}get started(){var e;return!((e=this.Fa)==null||!e.isStarted)}get status(){var e,t;return this.La===Go||this.La===hd?this.La:(e=(t=this.Fa)==null?void 0:t.status)!==null&&e!==void 0?e:this.La}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.La=Iy,this.Oa=void 0,this.Da=!1,this.$a=(()=>{var t;if(ke==null||!ke.visibilityState||ke.visibilityState==="visible")return!0;var n=ie==null||(t=ie.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((i=>i.name==="visible"))})(),this.Ie=()=>{var t;(ke==null?void 0:ke.visibilityState)==="visible"&&(this.$a=!0,(t=this.Fa)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Ri.error("started without valid sessionManager"),new Error(Ng+" started without valid sessionManager. This is a bug.");if(this.Ne.cookieless_mode===$i)throw new Error(Ng+' cannot be used with cookieless_mode="always"');ke!=null&&ke.addEventListener&&Gt(ke,"visibilitychange",this.Ie)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Da=!0,ke==null||ke.removeEventListener==null||ke.removeEventListener("visibilitychange",this.Ie),this.stopRecording()}get Na(){var e,t=!((e=this._instance.get_property(xa))==null||!e.enabled),n=!this.Ne.disable_session_recording,i=this.Ne.disable_session_recording||this._instance.consent.isOptedOut();return ie&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!(this.Da||this.Na&&(t=this.Fa)!=null&&t.isStarted)){var n=!ye(Object.assign)&&!ye(Array.from);this.Na&&n?(this.qa(e),Ri.info("starting")):(this.La=Iy,this.stopRecording())}}qa(e){var t,n,i;this.Na&&(this.La!==Go&&this.La!==hd&&(this.La=Hy),Oe!=null&&(t=Oe.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Oe.__PosthogExtensions__)!=null&&n.initSessionRecording?this.ja(e):(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ba,(a=>{if(a)return Ri.error("could not load recorder",a);this.ja(e)})))}stopRecording(){var e,t;(e=this.Oa)==null||e.call(this),this.Oa=void 0,(t=this.Fa)==null||t.stop()}Ha(){var e,t;(e=this.Oa)==null||e.call(this),this.Oa=void 0,(t=this.Fa)==null||t.discard()}Ua(){var e,t;(e=this.Tr)==null||e.unregister(ex),(t=this.Tr)==null||t.unregister(hw)}za(e,t){if(We(e))return null;var n,i=sn(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(Ri.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Wa(e){if(this.Tr){var t,n,i=this.Tr,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.za((o=this.Ne.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),h=this.za(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;We(p)&&this.Ua();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[xa]:he({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:he({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:ye(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this.Oa)==null||t.call(this),this.Oa=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Wa(t),void this.Ha()):(this.Wa(t),void this.startIfEnabledOrStop()):(this.La===Go&&(this.La=hd,Ri.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.Fa)!=null&&n.log?this.Fa.log(e,t):Ri.warn("log called before recorder was ready")}get Ba(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(xa);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Va(){var e,t,n=this._instance.get_property(xa);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(a){return Ri.warn("persisted remote config for session recording is invalid and will be ignored",a),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}ja(e){var t,n,i;if(!this.Da){if((t=Oe.__PosthogExtensions__)==null||!t.initSessionRecording)return Ri.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[_w]:!0});var a;if(this.Fa||(this.Fa=(a=Oe.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.$a),this.Fa._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Va())return this.La===hd||this.La===Go?void 0:(this.La=Go,Ri.info("persisted remote config is stale, requesting fresh config before starting"),void new Yw(this._instance).load());this.La=Hy,(n=(i=this.Fa).setDocumentWasEverVisible)==null||n.call(i,this.$a),this.Fa.start(e)}}onRRwebEmit(e){var t;(t=this.Fa)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Fa||(t=this.Tr)==null||t.register({[mw]:!0}),(e=this.Fa)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Fa||(t=this.Tr)==null||t.register({[pw]:!0}),(e=this.Fa)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Fa||(n=this.Tr)==null||n.register({[e==="url"?gw:xw]:!0}),(t=this.Fa)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Fa)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Fa)==null||!n.tryAddCustomEvent(e,t))}}},Y4={autocapture:class{constructor(e){this.Za=!1,this.Ga=null,this.Qa=!1,this.Ka=!1,this.instance=e,this.rageclicks=new $y(e.config.rageclick),this.Ja=null}initialize(){this.startIfEnabled()}get Ne(){var e,t,n=Bt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}Ya(){if(this.isBrowserSupported()){if(ie&&ke){var e=n=>{n=n||(ie==null?void 0:ie.event);try{this.Xa(n)}catch(i){am.error("Failed to capture event",i)}};if(Gt(ke,"submit",e,{capture:!0}),Gt(ke,"change",e,{capture:!0}),Gt(ke,"click",e,{capture:!0}),this.Ne.capture_copied_text){var t=n=>{n=n||(ie==null?void 0:ie.event);try{this.Xa(n,sm)}catch(i){am.error("Failed to capture copy/cut event",i)}};Gt(ke,"copy",t,{capture:!0}),Gt(ke,"cut",t,{capture:!0})}}}else am.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Za&&(this.Ya(),this.Za=!0)}onRemoteConfig(e){if(this.Qa=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Ka=t.elementsChainAsString);var n=t.autocapture_opt_out;Wr(n)&&(this.instance.persistence&&this.instance.persistence.register({[Jm]:n}),this.Ga=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Ja=e}getElementSelectors(e){var t,n=[];return(t=this.Ja)==null||t.forEach((i=>{var a=ke==null?void 0:ke.querySelectorAll(i);a==null||a.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Jm],i=this.Ga,a=this.instance.Ki()&&!this.Qa;if(Hn(i)&&!Wr(n)&&!a)return!1;var o=(t=this.Ga)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!o}Xa(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Yp(e);Cw(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&my(i,this.instance.config.rageclick)&&this.Xa(e,"$rageclick");var a=t===sm;if(i&&(function(x,b,y,_,j,C){var k;if(!ie||sx(x)||y!=null&&y.url_allowlist&&!fy(y.url_allowlist,C)||y!=null&&y.url_ignorelist&&fy(y.url_ignorelist,C))return!1;if(y!=null&&y.dom_event_allowlist){var E=y.dom_event_allowlist;if(E&&!E.some((P=>b.type===P)))return!1}var N=Lw(x,_),D=N.parentIsUsefulElement,O=N.targetElementList;if(!(function(P,Q){var B=Q==null?void 0:Q.element_allowlist;if(ye(B))return!0;var I,M=function(J){if(B.some((Y=>J.tagName.toLowerCase()===Y)))return{v:!0}};for(var le of P)if(I=M(le))return I.v;return!1})(O,y)||!xg(O,y==null?void 0:y.css_selector_allowlist)||xg(O,(k=y==null?void 0:y.css_selector_ignorelist)!==null&&k!==void 0?k:V3))return!1;try{var L=ie.getComputedStyle(x);if(L&&L.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}var G=x.tagName.toLowerCase();switch(G){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return D?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(ix.indexOf(G)>-1||x.getAttribute("contenteditable")==="true")}})(i,e,this.Ne,a,a?["copy","cut"]:void 0,this.instance)){var o=B4(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ne.element_attribute_ignorelist,elementsChainAsString:this.Ka,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),u=o.props;if(o.explicitNoCapture)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(u.$element_selectors=f),t===sm){var h,p=Aw(ie==null||(h=ie.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;u.$selected_content=p,u.$copy_type=g}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return pr(ke==null?void 0:ke.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.eo=(ie==null||(t=ie.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(we.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.io&&this.io(),this.io=void 0,we.info("History API monitoring stopped")}monitorHistoryChanges(){ie&&ie.history&&(this.ro("pushState"),this.ro("replaceState"),this.no())}ro(e){var t;if(ie&&((t=ie.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,a,o){try{if(!(a in i))return Fy;var u={next:i[a]},f=o((function(){for(var h=arguments.length,p=new Array(h),g=0;h>g;g++)p[g]=arguments[g];return u.next.apply(this,p)}));return pr(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:u}})),i[a]=f,()=>{if(i[a]!==f)for(var h=i[a];pr(h)&&h.__posthog_layer__;){var p=h.__posthog_layer__;if(p.next===f)return void(p.next=u.next);h=p.next}else i[a]=u.next}}catch{return Fy}})(ie.history,e,(i=>function(a,o,u){i.call(this,a,o,u),n.so(e)}))}}so(e){try{var t,n=ie==null||(t=ie.location)==null?void 0:t.pathname;if(!n)return;n!==this.eo&&this.isEnabled&&this._instance.capture(bl,{navigation_type:e}),this.eo=n}catch(i){we.error("Error capturing "+e+" pageview",i)}}no(){if(!this.io){var e=()=>{this.so("popstate")};Gt(ie,"popstate",e),this.io=()=>{ie&&ie.removeEventListener("popstate",e)}}}},heatmaps:class{get Ne(){return this.instance.config}constructor(e){var t;this.ao=!1,this.Za=!1,this.oo=null,this.instance=e,this.ao=!((t=this.instance.persistence)==null||!t.props[eg]),this.rageclicks=new $y(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Bt(this.Ne.capture_heatmaps)&&this.Ne.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ne.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return We(this.Ne.capture_heatmaps)?We(this.Ne.enable_heatmaps)?this.ao:this.Ne.enable_heatmaps:this.Ne.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Za)return;$4.info("starting..."),this.lo(),this.Ie()}else{var e;clearInterval((e=this.oo)!==null&&e!==void 0?e:void 0),this.uo(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[eg]:n}),this.ao=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}ho(e){om(e.originalEvent)&&this.ke(e.originalEvent,"deadclick")}Ie(){this.oo&&clearInterval(this.oo),this.oo=(ke==null?void 0:ke.visibilityState)==="visible"?setInterval(this.pr.bind(this),this.flushIntervalMilliseconds):null}lo(){ie&&ke&&(this.do=this.pr.bind(this),Gt(ie,Zd,this.do),this.vo=e=>this.ke(e||(ie==null?void 0:ie.event)),Gt(ke,"click",this.vo,{capture:!0}),this.co=e=>this.fo(e||(ie==null?void 0:ie.event)),Gt(ke,"mousemove",this.co,{capture:!0}),this.po=new wy(this.instance,Z3,this.ho.bind(this)),this.po.startIfEnabledOrStop(),this.mo=this.Ie.bind(this),Gt(ke,Kd,this.mo),this.Za=!0)}uo(){var e;ie&&ke&&(this.do&&ie.removeEventListener(Zd,this.do),this.vo&&ke.removeEventListener("click",this.vo,{capture:!0}),this.co&&ke.removeEventListener("mousemove",this.co,{capture:!0}),this.mo&&ke.removeEventListener(Kd,this.mo),clearTimeout(this.yo),(e=this.po)==null||e.stop(),this.Za=!1)}bo(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,f,h){for(var p=u;p&&As(p)&&!mr(p,"body");){if(p===h)return!1;var g=void 0;try{var x,b,y;g=(x=(b=(y=p.ownerDocument)==null?void 0:y.defaultView)!==null&&b!==void 0?b:ie)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(qe(f,g))return!0;p=Mw(p)}return!1})(Yp(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}ke(e,t){var n;if(t===void 0&&(t="click"),!dy(e.target)&&om(e)){var i=this.bo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&my(Yp(e),this.instance.config.rageclick)&&this.Vt(he({},i,{type:"rageclick"})),this.Vt(i)}}fo(e){!dy(e.target)&&om(e)&&(clearTimeout(this.yo),this.yo=setTimeout((()=>{this.Vt(this.bo(e,"mousemove"))}),500))}Vt(e){if(ie){var t=this.Ne.disable_capture_url_hashes?Ts(ie.location.href):ie.location.href,n=this.Ne.custom_personal_data_properties,i=this.Ne.mask_personal_data_properties?[...Ml,...n||[]]:[],a=jc(t,i,Nc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}pr(){this.R&&!Ii(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:wy,webVitalsAutocapture:class{constructor(e){var t;this.ao=!1,this.Za=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._o=()=>{clearTimeout(this.wo),this.wo=void 0,this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",he({$current_url:this.R.url},this.R.metrics.reduce(((n,i)=>he({},n,{["$web_vitals_"+i.name+"_event"]:he({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ko=n=>{var i;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},We(n==null?void 0:n.name)||We(n==null?void 0:n.value))la.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.xo(a);if(!ye(o)){var u=sn(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+o;if(!this.So||this.So>n.value){this.R.navigationKey!==u&&(this._o(),this.wo=setTimeout(this._o,this.flushToCaptureTimeoutMs)),ye(this.R.navigationKey)&&(this.R.navigationKey=u,this.R.url=o),this.R.firstMetricTimestamp=ye(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var f=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),h=he({},n,a?{navigationURL:o}:{},{$current_url:o,timestamp:Date.now()});ye(f)||(h.$session_id=f.sessionId,h.$window_id=f.windowId),this.R.metrics.push(h),this.R.metrics.length===this.allowedMetrics.length&&this._o()}else la.error("Ignoring metric with value >= "+this.So,n)}}},this.Co=()=>{if(!this.Za){var n,i,a,o,u=Oe.__PosthogExtensions__,f=u==null?void 0:u.postHogWebVitalsCallbacksByFlavor,h=(f==null?void 0:f[this.Mo])||(this.Mo==="web-vitals"&&ye(f)?u==null?void 0:u.postHogWebVitalsCallbacks:void 0);if(ye(h)||(n=h.onLCP,i=h.onCLS,a=h.onFCP,o=h.onINP),n&&i&&a&&o){var p={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&n(this.ko.bind(this),p),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ko.bind(this),p),this.allowedMetrics.indexOf("FCP")>-1&&a(this.ko.bind(this),p),this.allowedMetrics.indexOf("INP")>-1&&o(this.ko.bind(this),p),this.Za=!0}else la.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.ao=!((t=this._instance.persistence)==null||!t.props[ig]),this.startIfEnabled()}get To(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Bt(this.To)?(e=this.To)==null?void 0:e.web_vitals_allowed_metrics:void 0;return We(n)?((t=this._instance.persistence)==null?void 0:t.props[sg])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Bt(this.To)?this.To.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Bt(this.To)?this.To.web_vitals_attribution:void 0;return e!=null&&e}get useSoftNavs(){var e=Bt(this.To)?this.To.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get So(){var e=Bt(this.To)&&sn(this.To.__web_vitals_max_value)?this.To.__web_vitals_max_value:Uy;return e>0&&6e4>=e?Uy:e}get isEnabled(){var e=Vt==null?void 0:Vt.protocol;if(e!=="http:"&&e!=="https:")return la.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Bt(this.To)?this.To.web_vitals:Wr(this.To)?this.To:void 0;return Wr(t)?t:this.ao}startIfEnabled(){this.isEnabled&&!this.Za&&(la.info("enabled, starting..."),this.ai(this.Co))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=Bt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Bt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ig]:n}),this._instance.persistence.register({[sg]:i})),this.ao=n,this.startIfEnabled()}}}get Mo(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}ai(e){var t=Oe.__PosthogExtensions__,n=this.Mo,i=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;i!=null&&i[n]||n==="web-vitals"&&ye(i)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?la.error("failed to load script",a):e()}))}xo(e){var t=e||(ie==null?void 0:ie.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?Ts(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...Ml,...i||[]]:[];return jc(n,a,Nc)}la.error("Could not determine current URL")}}},W4={exceptionObserver:class{constructor(e){var t;this.Co=()=>{var n;if(ie&&this.isEnabled&&(n=Oe.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var i=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Eo&&this.Ne.capture_unhandled_errors&&(this.Eo=i(this.captureException.bind(this))),!this.Io&&this.Ne.capture_unhandled_rejections&&(this.Io=a(this.captureException.bind(this))),!this.Po&&this.Ne.capture_console_errors&&(this.Po=o(this.captureException.bind(this)))}catch(u){Vo.error("failed to start",u),this.Ro()}}},this._instance=e,this.Ao=!((t=this._instance.persistence)==null||!t.props[tg]),this.Fo=new YC(he({},(function(n){var i,a,o,u;return n===void 0&&(n={}),{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking),{refillInterval:1e4,rt:Vo})),this.Ne=this.Lo(),this.startIfEnabledOrStop()}Lo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Bt(e)?t=he({},t,e):(ye(e)?this.Ao:e)&&(t=he({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ne.capture_console_errors||this.Ne.capture_unhandled_errors||this.Ne.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Vo.info("enabled"),this.Ro(),this.ai(this.Co)):this.Ro()}ai(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Vo.error("failed to load script",i);e()}))}Ro(){var e,t,n;(e=this.Eo)==null||e.call(this),this.Eo=void 0,(t=this.Io)==null||t.call(this),this.Io=void 0,(n=this.Po)==null||n.call(this),this.Po=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Ao=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[tg]:this.Ao}),this.Ne=this.Lo(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ne=this.Lo()}captureException(e){var t,n,i,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.Fo.consumeRateLimit(a)?Vo.info("Skipping exception capture because of client rate limiting.",{exception:a}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.Oo=[],this.Do=new u3([new v3,new C3,new y3,new b3,new j3,new k3,new w3,new N3],(function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
67
+ `),x=h;g.length>x;x++){var b=g[x];if(1024>=b.length){var y=ly.test(b)?b.replace(ly,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,i);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(C){if(!C.length)return[];var k=Array.from(C);return k.reverse(),k.slice(0,50).map((E=>{return he({},E,{filename:E.filename||(N=k,N[N.length-1]||{}).filename,function:E.function||Tl});var N}))})(p)}})("web:javascript",p3,x3)),this._instance=e,this.Oo=(t=(n=this._instance.persistence)==null?void 0:n.get_property(ng))!==null&&t!==void 0?t:[],this.$o=Gd(this.No()),this.qo=new T3(this.$o)}onConfigChange(){this.$o=Gd(this.No()),this.qo.setConfig(this.$o)}onRemoteConfig(e){var t,n,i;if(e.ok){var a=e.config;if("errorTracking"in a){var o=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)==null?void 0:i.captureExtensionExceptions;this.Oo=o,this._instance.persistence&&this._instance.persistence.register({[ng]:this.Oo,[rg]:u})}}}get jo(){var e,t=!!this._instance.get_property(rg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Do.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.$o.enabled)try{if(!vt(e)||e.trim().length===0)return void li.warn("Ignoring exception step because message must be a non-empty string");var n=(function(o){if(!o)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(o).reduce(((f,h)=>E3.has(h)?(u.push(h),f):(f[h]=o[h],f)),{}),droppedKeys:u}})(this.Bo(t)),i=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&li.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.qo.add(he({[qd]:e,[Vd]:new Date().toISOString()},i))}catch(o){li.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Ho(t)){if(this.Uo(t))return this.zo("Exception dropped: matched a suppression rule"),void li.info("Skipping exception capture because a suppression rule matched");if(!this.jo&&this.Wo(t))return this.zo("Exception dropped: thrown by a browser extension"),void li.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Vo(t))return this.zo("Exception dropped: thrown by the PostHog SDK"),void li.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.$o.enabled&&We(e.$exception_steps)?this.Zo(e):e,i=typeof(o=globalThis._posthogReleaseId)=="string"&&o.length>0?o:void 0;i&&(n.$release_id=i);try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Un:!0});return a&&this.qo.clear(),a}catch(u){return li.error("Failed to capture exception event. Dropping this exception.",u),void this.qo.clear()}}catch(u){return void li.error("Failed to process exception event. Ignoring this exception.",u)}var o}Zo(e){try{var t=this.qo.getAttachable();return t.length===0?e:he({},e,{$exception_steps:t})}catch(n){return li.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}zo(e){this.$o.enabled&&this.qo.add({[qd]:e,[Vd]:new Date().toISOString()})}Bo(e){return Bt(e)?he({},e):{}}No(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Uo(e){if(e.length===0)return!1;try{var t=e.reduce(((n,i)=>{var a=i.type,o=i.value;return vt(a)&&a.length>0&&n.$exception_types.push(a),vt(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Oo.some((n=>{var i=n.values.map((a=>{var o=l2[a.operator],u=t[a.key];if(!o||!u)return!1;var f=Ve(a.value)?a.value:[a.value];return f.length>0&&o(f,u)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}catch(n){return li.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}Wo(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Vo(e){if(e.length>0){var t,n,i,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Ho(e){return!We(e)&&Ve(e)}}},Q4=he({productTours:class{get Tr(){return this._instance.persistence}constructor(e){this.Go=null,this.Qo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,i;if(this.Tr&&this.Tr.register({[Jg]:!!t.productTours}),!cm(this._instance))return!this.Go&&We((n=this.Tr)==null?void 0:n.props[rc])||pd.info("product tours disabled; stopping and clearing cached tours"),(i=this.Go)==null||i.stop(),this.Go=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Go&&cm(this._instance)&&this.ai((()=>this.Ko()))}ai(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?pd.error("Could not load product tours script",i):e()}))}Ko(){var e;!this.Go&&(e=Oe.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Go=Oe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ve(this.Qo)||t){var n=this.Tr;if(n){var i=n.props[rc];if(Ve(i)&&!t)return this.Qo=i,void e(i,{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:a=>{if(cm(this._instance)){var o=a.statusCode;if(o!==200||!a.json){var u="Product Tours API could not be loaded, status: "+o;return o===0?a.error||pd.warn(u):pd.error(u),void e([],{isLoaded:!1,error:u})}var f=Ve(a.json.product_tours)?a.json.product_tours:[];this.Qo=f,n&&n.register({[rc]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Qo,{isLoaded:!0})}getActiveProductTours(e){We(this.Go)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Go.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Go)==null||t.showTourById(e)}previewTour(e){this.Go?this.Go.previewTour(e):this.ai((()=>{var t;this.Ko(),(t=this.Go)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Go)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Go)==null||e.nextStep()}previousStep(){var e;(e=this.Go)==null||e.previousStep()}clearCache(){var e;this.Qo=null,(e=this.Tr)==null||e.unregister(rc)}resetTour(e){var t;(t=this.Go)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Go)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Go)==null||t.cancelPendingTour(e)}}},bf),X4={siteApps:class{constructor(e){this.Jo=0,this._instance=e,this.Yo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Xo(e,t){if(t){var n=this.globalsForEvent(t);this.Yo.push(n),this.Yo.length>1e3&&(this.Yo=this.Yo.slice(10))}}get siteAppLoaders(){var e;return(e=Oe._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Xo.bind(this));this.tl=()=>{e(),this.Yo=[],this.tl=void 0}}}globalsForEvent(e){var t,n,i,a,o,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var x of Object.entries(g)){var b=x[0];h[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:he({},M5(e,F4),{properties:he({},e.properties,_?{$set:he({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:he({},(i=(a=e.properties)==null?void 0:a.$set_once)!==null&&i!==void 0?i:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}el(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(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(e)||(ai.error("prepare_external_dependency_script returned null"),null):e}il(){var e,t,n,i,a,o,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=ke==null?void 0:ke.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Jo++,this.rl)return this.nl();var g=[],x=this,b=new WeakSet,y=(C,k,E)=>{if(C!=null&&C[k]){var N=C[k];C[k]=E(N),g.push((()=>{C[k]=N}))}},_=C=>{if(b.has(C))return C;var k=x.el(C);return k&&b.add(k),k},j=C=>C.map((k=>typeof k=="string"?k:_(k))).filter((k=>!Hn(k)));return y(p,"appendChild",(C=>function(k){var E=_(k);return E?C.call(this,E):k})),y(p,"insertBefore",(C=>function(k,E){var N=_(k);return N?C.call(this,N,E):k})),y(p,"replaceChild",(C=>function(k,E){var N=_(k);return N?C.call(this,N,E):E})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(i=h.DocumentFragment)==null?void 0:i.prototype].forEach((C=>{y(C,"append",(k=>function(){for(var E=arguments.length,N=new Array(E),D=0;E>D;D++)N[D]=arguments[D];return k.apply(this,j(N))})),y(C,"prepend",(k=>function(){for(var E=arguments.length,N=new Array(E),D=0;E>D;D++)N[D]=arguments[D];return k.apply(this,j(N))}))})),[(a=h.Element)==null?void 0:a.prototype,(o=h.CharacterData)==null?void 0:o.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((C=>{y(C,"before",(k=>function(){for(var E=arguments.length,N=new Array(E),D=0;E>D;D++)N[D]=arguments[D];return k.apply(this,j(N))})),y(C,"after",(k=>function(){for(var E=arguments.length,N=new Array(E),D=0;E>D;D++)N[D]=arguments[D];return k.apply(this,j(N))})),y(C,"replaceWith",(k=>function(){for(var E=arguments.length,N=new Array(E),D=0;E>D;D++)N[D]=arguments[D];var O=j(N);return N.length&&!O.length?void 0:k.apply(this,O)}))})),y((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(C=>function(k,E){var N=_(E);return N?C.call(this,k,N):null})),this.rl=()=>{g.forEach((C=>C())),this.rl=void 0},this.nl()}nl(){var e=!1;return()=>{var t;e||(e=!0,this.Jo--,this.Jo===0&&((t=this.rl)==null||t.call(this)))}}sl(e,t){t===void 0&&(t=!0);var n=this.il();try{var i=e(n);return t&&n(),i}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.Yo.length&&(ai.info("Processing "+this.Yo.length+" events for site app with id "+e.id),this.Yo.forEach((f=>this.sl((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.tl)==null||u.call(this))},i=!1,a=u=>{t.errored=!u,t.loaded=!0,ai.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var o=this.sl((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1).processEvent;o&&(t.processEvent=o),i=!0}catch(u){ai.error(qy+e.id,u),a(!1)}if(i&&t.loaded)try{n()}catch(u){ai.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}al(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ol(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),i=function(o){try{t.sl((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){ai.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))i(a)}}onRemoteConfig(e){var t,n,i,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.al(),void this._instance.on("eventCaptured",(h=>this.ol(h)))):void ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.tl)==null||n.call(this),e.ok){var o=e.config;if((i=o.siteApps)!=null&&i.length)if(this.isEnabled){var u=function(){var h,p=f.id,g=f.url;Oe["__$$ph_site_app_"+p]=a._instance,(h=Oe.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(a._instance,g,(x=>{if(x)return ai.error(qy+p,x)}))};for(var f of o.siteApps)u()}else ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},K4={tracingHeaders:class{constructor(e){this.ll=void 0,this.ul=void 0,this.hl=void 0,this.Co=()=>{var t,n,i=this.dl();i?(ye(this.ll)&&(this.ll=(t=Oe.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ye(this.ul)&&(this.ul=(n=Oe.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ro()},this._instance=e}initialize(){this.startIfEnabledOrStop()}ai(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return P4.error("failed to load script",i);e()}))}vl(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}dl(){var e=this.vl();return Ve(e)?(Ve(this.hl)?this.hl.splice(0,this.hl.length,...e):this.hl=[...e],e.length>0?this.hl:void 0):(Ve(this.hl)&&this.hl.splice(0),this.hl=e||void 0,this.hl)}Ro(){var e,t;(e=this.ll)==null||e.call(this),(t=this.ul)==null||t.call(this),this.ll=void 0,this.ul=void 0}startIfEnabledOrStop(){this.dl()?this.ai(this.Co):this.Ro()}}},Z4=he({surveys:class{get Ne(){return this._instance.config}constructor(e){this.cl=void 0,this._surveyManager=null,this.fl=!1,this.pl=[],this.gl=null,this.ml=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Ne.disable_surveys){if(!e.ok)return kt.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(We(t))return kt.warn("Flags not loaded yet. Not loading surveys.");var n=Ve(t);this.cl=n?t.length>0:t,kt.info("flags response received, isSurveysEnabled: "+this.cl),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var i=localStorage.key(n);(i!=null&&i.startsWith(u2)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.fl)kt.info("Already initializing surveys, skipping...");else if(this.Ne.disable_surveys)kt.info(Vy);else if(this.Ne.cookieless_mode&&this._instance.consent.isOptedOut())kt.info("Not loading surveys in cookieless mode without consent.");else{var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){if(!ye(this.cl)||this.Ne.advanced_enable_surveys){var t=this.cl||this.Ne.advanced_enable_surveys;this.fl=!0;try{var n=e.generateSurveys;if(n)return void this.yl(n,t);var i=e.loadExternalDependency;if(!i)return void this.bl(tx);i(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.bl("Could not load surveys script",a):this.yl(e.generateSurveys,t)}))}catch(a){throw this.bl("Error initializing surveys",a),a}finally{this.fl=!1}}}else kt.error("PostHog Extensions not found.")}}yl(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new H4(this._instance),kt.info("Surveys loaded successfully"),this._l({isLoaded:!0})}bl(e,t){kt.error(e,t),this._l({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.pl.push(e),this._surveyManager&&this._l({isLoaded:!0}),()=>{this.pl=this.pl.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Ne.disable_surveys)return kt.info(Vy),e([]);var n,i=this._instance.get_property(og);if(i&&!t)return e(i,{isLoaded:!0}),void(this.wl()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.gl?this.gl.then((a=>e(a.surveys,a.context))):(typeof Promise<"u"&&(this.gl=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ne.token),method:"GET",timestampMode:"query",timeout:this.Ne.surveys_request_timeout_ms,callback:a=>{var o;this.gl=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;u!==0?kt.error(f):a.error||kt.warn(f),this.ml=Date.now();var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}this.ml=null;var p,g=a.json.surveys||[],x=g.filter((y=>(function(_){return!(!_.start_date||_.end_date)})(y)&&(c2(y)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(y))));x.length>0&&((p=this._surveyEventReceiver)==null||p.register(x)),(o=this._instance.persistence)==null||o.register({[og]:g,[Wd]:Date.now()});var b={isLoaded:!0};e(g,b),n==null||n({surveys:g,context:b})}}))}wl(){return this.kl()&&!this.gl&&!this.xl()}kl(){var e=this._instance.get_property(Wd);return sn(e)&&Date.now()-e>3e5}xl(){return sn(this.ml)&&3e5>Date.now()-this.ml}markSurveyAsSeen(e,t){var n,i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};d2(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}_l(e){for(var t of this.pl)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){kt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!We(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);kt.warn("init was not called")}Sl(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((a=>a.id===e)))!==null&&i!==void 0?i:null})),t}Cl(e){if(We(this._surveyManager))return{eligible:!1,reason:md};var t=typeof e=="string"?this.Sl(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Ml(e){if(We(this._surveyManager))return{eligible:!1,reason:md};var t=typeof e=="string"?this.Sl(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(We(this._surveyManager))return kt.warn("init was not called"),{visible:!1,disabledReason:md};var t=this.Ml(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return We(this._surveyManager)?(kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:md})):new Promise((n=>{this.getSurveys((i=>{var a,o=(a=i.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(o){var u=this.Ml(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(We(this._surveyManager))kt.warn("init was not called");else{var a=typeof e=="string"?this.Sl(e):e;if(a!=null&&a.id)if(j4.includes(a.type)){var o=ke==null?void 0:ke.querySelector(t);if(o)return(i=a.appearance)!=null&&i.surveyPopupDelaySeconds?(kt.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;kt.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,o,n),kt.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,o,n);kt.warn("Survey element not found")}else kt.warn("Surveys of type "+a.type+" cannot be rendered in the app");else kt.warn("Survey not found")}}displaySurvey(e,t){var n;if(We(this._surveyManager))kt.warn("init was not called");else{var i=this.Sl(e);if(i){var a=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=he({},i,{appearance:he({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==bg.Popover&&t.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.Cl(i);if(!o.eligible)return void kt.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==bg.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else kt.warn("Survey not found")}}cancelPendingSurvey(e){We(this._surveyManager)?kt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},bf),J4={toolbar:class{constructor(e){this.instance=e}Tl(e){Oe.ph_toolbar_state=e}El(){var e;return(e=Oe.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),ww(this.instance.config)||!ie||!ke)return!1;e=e??ie.location,n=n??ie.history;try{if(!t){try{ie.localStorage.setItem("test","test"),ie.localStorage.removeItem("test")}catch{return!1}t=ie==null?void 0:ie.localStorage}var i,a=q4||nf(e.hash,"__posthog")||nf(e.hash,"state"),o=a?cy((()=>JSON.parse(atob(decodeURIComponent(a)))))||cy((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Gy)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Il(e){var t=Oe.ph_load_toolbar||Oe.ph_load_editor;!We(t)&&pr(t)?t(e,this.instance):Yy.warn("No toolbar load function found")}loadToolbar(e){var t=!(ke==null||!ke.getElementById(Nw));if(!ie||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=he({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ie.localStorage.setItem(Gy,JSON.stringify(he({},i,{source:void 0}))),this.El()===2)this.Il(i);else if(this.El()===0){var a;this.Tl(1),(a=Oe.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return Yy.error("[Toolbar] Failed to load",o),void this.Tl(0);this.Tl(2),this.Il(i)})),Gt(ie,"turbolinks:load",(()=>{this.Tl(0),this.loadToolbar(i)}))}return!0}Pl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},eE=he({experiments:Mn},bf),tE={conversations:class{constructor(e){this.Rl=void 0,this._conversationsManager=null,this.Al=!1,this.Fl=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;We(t)||(Wr(t)?this.Rl=t:(this.Rl=t.enabled,this.Fl=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Rl=void 0,this.Fl=null}loadIfEnabled(){if(!(this._conversationsManager||this.Al||this._instance.config.disable_conversations||ww(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e&&!ye(this.Rl)&&this.Rl)if(this.Fl&&this.Fl.token){this.Al=!0;try{var t=e.initConversations;if(t)return this.Ll(t),void(this.Al=!1);var n=e.loadExternalDependency;if(!n)return void this.Ol(tx);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.Ol("Could not load conversations script",i):this.Ll(e.initConversations),this.Al=!1}))}catch(i){this.Ol("Error initializing conversations",i),this.Al=!1}}else Rr.error("Conversations enabled but missing token in remote config.")}}Ll(e){if(this.Fl)try{this._conversationsManager=e(this.Fl,this._instance),Rr.info("Conversations loaded successfully")}catch(t){this.Ol("Error completing conversations initialization",t)}else Rr.error("Cannot complete initialization: remote config is null")}Ol(e,t){Rr.error(e,t),this._conversationsManager=null,this.Al=!1}show(){this._conversationsManager?this._conversationsManager.show():Rr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rl===!0&&!Hn(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Ut((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Rr.warn(ca),null)}))()}getMessages(e,t){var n=this;return Ut((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Rr.warn(ca),null)}))()}markAsRead(e){var t=this;return Ut((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Rr.warn(ca),null)}))()}getTickets(e){var t=this;return Ut((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Rr.warn(ca),null)}))()}requestRestoreLink(e){var t=this;return Ut((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Rr.warn(ca),null)}))()}restoreFromToken(e){var t=this;return Ut((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Rr.warn(ca),null)}))()}restoreFromUrlToken(){var e=this;return Ut((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Rr.warn(ca),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Yn(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Xn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},nE={logs:class{constructor(e){var t,n=this;this.Dl=!1,this.$l=!1,this.rt=Wt("[logs]"),this.Nl=he({},this.rt,{error(){for(var i=arguments.length,a=new Array(i),o=0;i>o;o++)a[o]=arguments[o];a.some(Zy)||n.rt.error(...a)}}),this.er=[],this.ql=[],this.ya=0,this.jl=()=>{var i,a;this.ya=0,(i=this.Bl)==null||i.onReconnect(),(a=this.Hl)==null||a.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Dl=!0),ie&&Gt(ie,"online",this.jl)}Ul(e,t,n,i){var a,o=(function(u,f){var h,p,g,x,b,y,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,C=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,k=f!=null&&f.consoleCapture?void 0:(g=u==null?void 0:u.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,E=ye(k)?Math.max(C,2048):Math.max(C,k),N=u==null?void 0:u.resourceAttributes;return{serviceName:(x=(b=N==null?void 0:N["service.name"])!==null&&b!==void 0?b:u==null?void 0:u.serviceName)!==null&&x!==void 0?x:f==null?void 0:f.serviceNameDefault,serviceVersion:(y=N==null?void 0:N["service.version"])!==null&&y!==void 0?y:u==null?void 0:u.serviceVersion,environment:(_=N==null?void 0:N["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:N,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:C,maxQueueSize:E,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new l3(this.zl(e,t),o,this.Nl,(()=>this.Wl()),(u=>u()),void 0,i),o]}Vl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Bl||this.Zl!==t){var n;(n=this.Bl)==null||n.reset(),this.Zl=t;var i=this.Ul((()=>this.er),(a=>{this.er=a}));this.Bl=i[0],this.Gl=i[1]}return this.Bl}Ql(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Hl||this.Kl!==t){var n;(n=this.Hl)==null||n.reset(),this.Kl=t;var i=this.Ul((()=>this.ql),(a=>{this.ql=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ky);this.Hl=i[0],this.Jl=i[1]}return this.Hl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!We(n)&&n&&(this.Dl=!0,this.loadIfEnabled())}}reset(){var e,t;this.er=[],(e=this.Bl)==null||e.reset(),this.ql=[],(t=this.Hl)==null||t.reset(),this.ya=0}captureLog(e){this.Vl().captureLog(e)}he(e){this.Ql().captureLog(e)}get logger(){return this.Yl||(this.Yl={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Yl}flushLogs(e){e?this.Xl(e):(this.Bl&&this.Bl.flush().catch((t=>this.tu(t))),this.Hl&&this.Hl.flush().catch((t=>this.tu(t))))}tu(e){Zy(e)||this.rt.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Dl&&!this.$l){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.rt.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.$l=!0)})):this.rt.error(tx)}else this.rt.error("PostHog Extensions not found.")}}zl(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Bi.LogsQueue?e():void 0,setPersistedProperty(i,a){var o;i===Bi.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},Ot:i=>this.Ot(i),getLibraryId:()=>jt.LIB_NAME,getLibraryVersion:()=>jt.LIB_VERSION}}Ot(e){return new Promise((t=>{if(Pw(this.ya,3))t({kind:"fatal",error:dm(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,i=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>{this.rt.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:dm(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.eu(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this.iu(u),u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==429&&500>u)i({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;u===0?(o.error||this.rt.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:dm(o.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(f=o.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}}))}iu(e){(e!==0||this._instance.__loaded)&&(this.ya=$w(e,this.ya,3,(()=>this.rt.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."))))}Xl(e){this.er.length>0&&this.ru(e,this.er,this.Gl,jt.LIB_NAME,(t=>{this.er=t})),this.ql.length>0&&this.ru(e,this.ql,this.Jl,Ky,(t=>{this.ql=t}))}ru(e,t,n,i,a){if(t.length!==0){var o=t.map((f=>f.record));a([]);var u=ow(o,lw(n,jt.LIB_NAME,jt.LIB_VERSION),i,jt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.eu(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}eu(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Wl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=i,We(a)||(t.sessionStartTimestamp=a),We(o)||(t.lastActivityTimestamp=o)}if(Oe!=null&&(e=Oe.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ts(Oe.location.href):Oe.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},rE={metrics:class{constructor(e){this.rt=Wt("[metrics]"),this._instance=e}initialize(){}Vl(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.Bl&&this.Zl===n||((t=this.Bl)==null||t.reset(),this.Zl=n,this.Bl=new o3(this.zl(),(function(i){var a,o,u,f,h,p=i==null?void 0:i.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:i==null?void 0:i.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:p,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(f=i==null?void 0:i.flushIntervalMs)!==null&&f!==void 0?f:1e4,maxSeriesPerFlush:(h=i==null?void 0:i.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(n),this.rt)),this.Bl}count(e,t,n){t===void 0&&(t=1),this.Vl().count(e,t,n)}gauge(e,t,n){this.Vl().gauge(e,t,n)}histogram(e,t,n){this.Vl().histogram(e,t,n)}flush(e){if(!this.Bl)return Promise.resolve();if(e){var t=this.Bl.drainWindow();return t&&this.Jt(t,e),Promise.resolve()}return this.Bl.flush().catch((n=>this.rt.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.Bl)==null||e.reset()}zl(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Jt:n=>t.Jt(n),getLibraryId:()=>jt.LIB_NAME,getLibraryVersion:()=>jt.LIB_VERSION}}Jt(e,t){return new Promise((n=>{var i=!1,a=u=>{i||(i=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(he({method:"POST",url:this.nu(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var f=u.statusCode;if(f>=200&&300>f)a({kind:"ok"});else if(f===413)a({kind:"too-large"});else if(f!==0&&f!==429&&500>f)a({kind:"fatal",error:new Error("metrics request failed with status "+f)});else{var h;a({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error("metrics request failed with status "+f)})}}}))}))}nu(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},iE=he({},bf,G4,Y4,W4,Q4,X4,Z4,K4,J4,eE,tE,nE,rE);Or.__defaultExtensionClasses=he({},iE);var Cc=(function(){jt.SDK_DIST_CHANNEL="npm";var e=fc[yl]=new Or;return(function(){function t(){t.done||(t.done=!0,h2=!1,Rt(fc,(function(n){n._dom_loaded()})))}ke!=null&&ke.addEventListener?ke.readyState==="complete"?t():Gt(ke,"DOMContentLoaded",t,{capture:!1}):ie&&we.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const sE="https://us.i.posthog.com",m2="cc-telemetry-enabled";let Cg=!1,Ec=!1;function aE(){return sE}function lE(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(m2);return e===null?!0:e==="true"}function g2(e){Cg&&(e?(Cc.opt_in_capturing({captureEventName:null}),Ec=!0):(Cc.opt_out_capturing(),Ec=!1))}function FD(e){typeof localStorage<"u"&&localStorage.setItem(m2,String(e)),g2(e)}function oE(){const e=void 0;return e?(Cc.init(e,{api_host:aE(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),Cg=!0,g2(lE()),!0):(Cg=!1,Ec=!1,!1)}function cx(e,t){Ec&&Cc.capture(e,t)}function Ms(e,t){Ec&&Cc.captureException(e,t)}function cE(e){cx("$pageview",{$current_url:e})}const di="/api",x2="companion_auth_token";function Rs(){if(typeof window>"u")return{};const e=localStorage.getItem(x2);return e?{Authorization:`Bearer ${e}`}:{}}function _a(e){e===401&&typeof window<"u"&&(localStorage.removeItem(x2),qn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>CN);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function gn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Lc(e,t,n,i){cx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function fi(e,t,n,i,a){cx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),Ms(i,{method:e,path:t,status:a})}async function Ie(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Rs()},body:t?JSON.stringify(t):void 0});if(!a.ok){_a(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("POST",e,gn()-n,u,a.status),i=!0,u}return Lc("POST",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("POST",e,gn()-n,a),a}}async function Ae(e){const t=gn();let n=!1;try{const i=await fetch(`${di}${e}`,{headers:{...Rs()}});if(!i.ok){_a(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw fi("GET",e,gn()-t,o,i.status),n=!0,o}return Lc("GET",e,gn()-t,i.status),i.json()}catch(i){throw n||fi("GET",e,gn()-t,i),i}}async function Lr(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Rs()},body:t?JSON.stringify(t):void 0});if(!a.ok){_a(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("PUT",e,gn()-n,u,a.status),i=!0,u}return Lc("PUT",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("PUT",e,gn()-n,a),a}}async function uE(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Rs()},body:t?JSON.stringify(t):void 0});if(!a.ok){_a(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("PATCH",e,gn()-n,u,a.status),i=!0,u}return Lc("PATCH",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("PATCH",e,gn()-n,a),a}}async function Dr(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Rs()},body:t?JSON.stringify(t):void 0});if(!a.ok){_a(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("DELETE",e,gn()-n,u,a.status),i=!0,u}return Lc("DELETE",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("DELETE",e,gn()-n,a),a}}async function dE(e,t){const n=await fetch(`${di}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Rs()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const i=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;o+=a.decode(h,{stream:!0});const p=o.split(`
68
+
69
+ `);o=p.pop()||"";for(const g of p){if(!g.trim())continue;let x="",b="";for(const _ of g.split(`
70
+ `))_.startsWith("event:")?x=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(x==="progress")t(y);else if(x==="done")u=y;else if(x==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function fE(){try{const e=await fetch(`${di}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function Jy(e){try{const t=await fetch(`${di}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const Ce={getAuthQr:()=>Ae("/auth/qr"),getAuthToken:()=>Ae("/auth/token"),regenerateAuthToken:()=>Ie("/auth/regenerate"),createSession:e=>Ie("/sessions/create",e),listSessions:()=>Ae("/sessions"),discoverClaudeSessions:(e=200)=>Ae(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Ae(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Dr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${di}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Rs()}});if(!n.ok)throw _a(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Ae(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>uE(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Ae(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Ae("/fs/home"),listEnvs:()=>Ae("/envs"),getEnv:e=>Ae(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Ie("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Lr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Dr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Ae("/sandboxes"),getSandbox:e=>Ae(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Ie("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Lr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Dr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Ie(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Ie("/docker/build-base"),getBaseImageStatus:()=>Ae("/docker/base-image"),getSettings:()=>Ae("/settings"),updateSettings:e=>Lr("/settings",e),verifyAnthropicKey:e=>Ie("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>Ae("/dashboard"),runDashboardUpdate:()=>Ie("/dashboard/run"),getDashboardRunStatus:()=>Ae("/dashboard/run/status"),getTailscaleStatus:()=>Ae("/tailscale/status"),startTailscaleFunnel:()=>Ie("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Ie("/tailscale/funnel/stop"),listLinearConnections:()=>Ae("/linear/connections"),createLinearConnection:e=>Ie("/linear/connections",e),updateLinearConnection:(e,t)=>Lr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Dr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Ie(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Ae(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Ae(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Ae(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Ie(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Ae(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Ae(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Ae(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Lr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Dr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Lr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Dr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Ae(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Ie("/linear/issues",e),addLinearComment:(e,t,n)=>Ie(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Ae(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Ae(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Ie("/git/fetch",{repoRoot:e}),gitPull:e=>Ie("/git/pull",{cwd:e}),listWorktrees:e=>Ae(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Ie("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Dr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Ae(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Ae("/backends"),getBackendModels:e=>Ae(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Ae("/containers/status"),getContainerImages:()=>Ae("/containers/images"),getImageStatus:e=>Ae(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Ie(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Ae(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Ie(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Ae(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Ae(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${di}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Rs()}});if(!t.ok){_a(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Lr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Ae(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Ae(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Ae(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Lr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Ae(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Ae("/usage-limits"),getSessionUsageLimits:e=>Ae(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Ae("/system/memory"),spawnTerminal:(e,t,n,i)=>Ie("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Ie("/terminal/kill",{terminalId:e}),getTerminal:e=>Ae(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Ae("/update-check"),forceCheckForUpdate:()=>Ie("/update-check"),triggerUpdate:()=>Ie("/update"),getClaudeCompat:()=>Ae("/claude-compat"),refreshClaudeCompat:()=>Ie("/claude-compat/refresh"),pinClaudeVersion:e=>Ie("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Ie("/claude-compat/patch"),unpatchClaudeBinary:()=>Ie("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Ie("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Ae("/cron/jobs"),getCronJob:e=>Ae(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Ie("/cron/jobs",e),updateCronJob:(e,t)=>Lr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Dr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Ie(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Ie(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Ae(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Ae(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Ae("/agents"),getAgent:e=>Ae(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Ie("/agents",e),updateAgent:(e,t)=>Lr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Dr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Ie(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Ie(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Ae(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Ie("/agents/import",e),exportAgent:e=>Ae(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Ie(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Ae(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Ae(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return Ae(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Ie("/linear/oauth/disconnect"),createLinearStaging:e=>Ie("/linear/oauth/staging",e),getLinearStagingStatus:e=>Ae(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Dr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Ae("/linear/oauth-connections"),createLinearOAuthConnection:e=>Ie("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Lr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Dr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Ae(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Ae("/skills"),sendSessionMessage:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return Ae(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Ie("/prompts",e),updatePrompt:(e,t)=>Lr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Dr(`/prompts/${encodeURIComponent(e)}`)};let e_=!1;function t_(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function n_(){return new Promise(()=>{})}function hE(){if(e_||typeof window>"u")return;e_=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await t_(i)}catch{return n_()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await t_(n)}catch{return n_()}}}})}catch{}}const r_="#/session/",i_="#/agents/";let s_=!1;function ux(){s_||(hE(),s_=!0)}function dx(e){if(ux(),e==="#/dashboard")return{page:"dashboard"};if(e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(i_)){const n=e.slice(i_.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(r_)){const n=e.slice(r_.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function pE(e){return`#/session/${e}`}function fx(e,t=!1){ux();const n=pE(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function fm(e=!1){ux(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function mE(){const[e,t]=S.useState(""),[n,i]=S.useState(null),[a,o]=S.useState(!1),u=X(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const x=e.trim();if(!x){i("Please enter a token");return}o(!0),i(null),await Jy(x)?u(x):i("Invalid token"),o(!1)},[e,u]);S.useEffect(()=>{fE().then(g=>{if(g){u(g);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),Jy(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),o(!1)}))})},[u]);const[h,p]=S.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var Ol=m5();function gE({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Ol.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function xE(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function vE({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function bE({type:e}){return e==="codex"?l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function Ld({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:C,editInputRef:k}){const E=e.id.slice(0,8),N=i||e.model||E,D=b===e.id,[O,L]=S.useState(!1),G=S.useRef(null),P=S.useRef(null),Q=n?"exited":xE(e,a),B=e.cwd||"";S.useEffect(()=>{if(!O)return;function M(J){var Y;G.current&&!G.current.contains(J.target)&&P.current&&!P.current.contains(J.target)&&(L(!1),(Y=P.current)==null||Y.focus())}function le(J){var Y,$,F;if(J.key==="Escape"){L(!1),(Y=P.current)==null||Y.focus();return}if(J.key==="Tab"){L(!1);return}if((J.key==="ArrowDown"||J.key==="ArrowUp")&&(($=G.current)!=null&&$.contains(document.activeElement)||P.current===document.activeElement)){J.preventDefault();const V=(F=G.current)==null?void 0:F.querySelectorAll("[role='menuitem']");if(!V||V.length===0)return;const ge=document.activeElement,R=Array.from(V).indexOf(ge);J.key==="ArrowDown"?V[R<V.length-1?R+1:0].focus():V[R>0?R-1:V.length-1].focus()}}return document.addEventListener("mousedown",M),document.addEventListener("touchstart",M),document.addEventListener("keydown",le),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("touchstart",M),document.removeEventListener("keydown",le)}},[O]),S.useEffect(()=>{O&&requestAnimationFrame(()=>{var M,le;(le=(M=G.current)==null?void 0:M.querySelector("[role='menuitem']"))==null||le.focus()})},[O]);const I=S.useCallback(M=>{L(!1),M()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:M=>{M.preventDefault(),f(e.id,N)},onKeyDown:M=>{M.key==="F2"&&!D&&(M.preventDefault(),f(e.id,N))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!D&&l.jsx(vE,{status:Q}),D?l.jsx("input",{ref:k,value:y,onChange:M=>_(M.target.value),onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),j()):M.key==="Escape"&&(M.preventDefault(),C()),M.stopPropagation()},onBlur:j,onClick:M=>M.stopPropagation(),onDoubleClick:M=>M.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:N}),B&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:B})]}),!D&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(bE,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!D&&!O&&l.jsx("button",{onClick:M=>{M.stopPropagation(),h(M,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:P,onClick:M=>{M.stopPropagation(),L(!O)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":O,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),O&&l.jsxs("div",{ref:G,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,N)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>I(()=>p(M,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>I(()=>g(M,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>I(()=>h(M,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function yE({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:C,onCancelRename:k,editInputRef:E,isFirst:N}){const D=t?e.sessions.slice(0,2).map(O=>a.get(O.id)||O.model||O.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:N?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&D&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:D}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(O=>{var G;const L=((G=o.get(O.id))==null?void 0:G.size)??0;return l.jsx(Ld,{session:O,isActive:i===O.id,sessionName:a.get(O.id),permCount:L,isRecentlyRenamed:u.has(O.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:C,onCancelRename:k,editInputRef:E},O.id)})})]})}function _E(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function wE(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function SE(e){const t=new Map;for(const i of e){const a=_E(i.cwd,i.repoRoot||void 0,i.isContainerized),o=wE(a);t.has(a)||t.set(a,{key:a,label:o,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,a)=>i.label.localeCompare(a.label));for(const i of n)i.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const kE=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],jE=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],NE=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],CE=new Map(jE.map(e=>[e.id,e]));function EE(){var Fr,Ur;const[e,t]=S.useState(null),[n,i]=S.useState(""),[a,o]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,x]=S.useState(null),[b,y]=S.useState(!1),[_,j]=S.useState(null),[C,k]=S.useState(!1),[E,N]=S.useState(()=>typeof window<"u"?window.location.hash:""),D=S.useRef(null),O=S.useRef(null),L=X(ne=>ne.sessions),G=X(ne=>ne.sdkSessions),P=X(ne=>ne.currentSessionId),Q=X(ne=>ne.cliConnected),B=X(ne=>ne.cliReconnecting),I=X(ne=>ne.sessionStatus),M=X(ne=>ne.removeSession),le=X(ne=>ne.sessionNames),J=X(ne=>ne.recentlyRenamed),Y=X(ne=>ne.clearRecentlyRenamed),$=X(ne=>ne.pendingPermissions),F=X(ne=>ne.linkedLinearIssues),V=X(ne=>ne.collapsedProjects),ge=X(ne=>ne.toggleProjectCollapse),R=dx(E);S.useEffect(()=>{let ne=!0;async function me(){try{const Xe=await Ce.listSessions();if(ne){const $t=X.getState();$t.setSdkSessions(Xe);const cn=X.getState(),Tn=new Set(Xe.map(Ft=>Ft.sessionId));for(const Ft of cn.sessions.keys())!Tn.has(Ft)&&cn.connectionStatus.get(Ft)!=="connected"&&cn.removeSession(Ft);AC(Xe);for(const Ft of Xe)if(Ft.name&&(!$t.sessionNames.has(Ft.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test($t.sessionNames.get(Ft.sessionId)))){const zn=$t.sessionNames.get(Ft.sessionId),vr=!!zn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(zn);zn!==Ft.name&&($t.setSessionName(Ft.sessionId,Ft.name),vr&&$t.markRecentlyRenamed(Ft.sessionId))}}}catch{}}me();const be=setInterval(me,5e3);return()=>{ne=!1,clearInterval(be)}},[]),S.useEffect(()=>{const ne=()=>N(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function z(ne){fx(ne),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){fm(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&D.current&&(D.current.focus(),D.current.select())},[e]);function A(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),Ce.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function ue(){t(null),i("")}function xe(ne,me){t(ne),i(me)}const je=S.useCallback((ne,me)=>{ne.stopPropagation(),j(me)},[]),Re=S.useCallback(async ne=>{try{Im(ne),await Ce.deleteSession(ne)}catch{}X.getState().currentSessionId===ne&&fm(),M(ne)},[M]),Le=S.useCallback(()=>{_&&(Re(_),j(null))},[_,Re]),Be=S.useCallback(()=>{j(null)},[]),Je=S.useCallback(()=>{k(!0)},[]),it=S.useCallback(async()=>{k(!1);const ne=X.getState(),me=new Set;for(const Xe of ne.sessions.keys())me.add(Xe);for(const Xe of ne.sdkSessions)me.add(Xe.sessionId);const be=Array.from(me).filter(Xe=>{const $t=ne.sdkSessions.find(cn=>cn.sessionId===Xe);return($t==null?void 0:$t.archived)??!1});for(const Xe of be)await Re(Xe)},[Re]),ht=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!C)return;requestAnimationFrame(()=>{var me,be;(be=(me=O.current)==null?void 0:me.querySelector("button"))==null||be.focus()});function ne(me){var cn;if(me.key==="Escape"){C?ht():Be();return}if(me.key!=="Tab")return;const be=(cn=O.current)==null?void 0:cn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!be||be.length===0)return;const Xe=be[0],$t=be[be.length-1];me.shiftKey&&document.activeElement===Xe?(me.preventDefault(),$t.focus()):!me.shiftKey&&document.activeElement===$t&&(me.preventDefault(),Xe.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,C,Be,ht]);const Jt=S.useCallback(async(ne,me)=>{ne.stopPropagation();const be=G.find(zn=>zn.sessionId===me),Xe=L.get(me),$t=(Xe==null?void 0:Xe.is_containerized)||!!(be!=null&&be.containerId)||!1,cn=F.get(me),Tn=((cn==null?void 0:cn.stateType)||"").toLowerCase();if(cn&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const zn=await Ce.getArchiveInfo(me);if(zn.issueNotDone){p(me),x(zn),y($t);return}}catch{}if($t){f(me);return}pt(me)},[G,L,F]),pt=S.useCallback(async(ne,me,be)=>{try{Im(ne);const Xe={};me&&(Xe.force=!0),be&&be!=="none"&&(Xe.linearTransition=be),await Ce.archiveSession(ne,Object.keys(Xe).length>0?Xe:void 0)}catch{}X.getState().currentSessionId===ne&&(fm(),X.getState().newSession());try{const Xe=await Ce.listSessions();X.getState().setSdkSessions(Xe)}catch{}},[]),_t=S.useCallback(()=>{u&&(pt(u,!0),f(null))},[u,pt]),Nt=S.useCallback(()=>{f(null)},[]),ve=S.useCallback((ne,me)=>{h&&(pt(h,me,ne),p(null),x(null))},[h,pt]),Fe=S.useCallback(()=>{p(null),x(null)},[]),ct=S.useCallback(async(ne,me)=>{ne.stopPropagation();try{await Ce.unarchiveSession(me)}catch{}try{const be=await Ce.listSessions();X.getState().setSdkSessions(be)}catch{}},[]),xn=new Set;for(const ne of L.keys())xn.add(ne);for(const ne of G)xn.add(ne.sessionId);const Ne=Array.from(xn).map(ne=>{var Xe;const me=L.get(ne),be=G.find($t=>$t.sessionId===ne);return{id:ne,model:(me==null?void 0:me.model)||(be==null?void 0:be.model)||"",cwd:(me==null?void 0:me.cwd)||(be==null?void 0:be.cwd)||"",gitBranch:(me==null?void 0:me.git_branch)||(be==null?void 0:be.gitBranch)||"",isContainerized:(me==null?void 0:me.is_containerized)||!!(be!=null&&be.containerId)||!1,gitAhead:(me==null?void 0:me.git_ahead)||(be==null?void 0:be.gitAhead)||0,gitBehind:(me==null?void 0:me.git_behind)||(be==null?void 0:be.gitBehind)||0,linesAdded:(me==null?void 0:me.total_lines_added)||(be==null?void 0:be.totalLinesAdded)||0,linesRemoved:(me==null?void 0:me.total_lines_removed)||(be==null?void 0:be.totalLinesRemoved)||0,isConnected:Q.get(ne)??!1,isReconnecting:B.get(ne)??!1,status:I.get(ne)??null,sdkState:(be==null?void 0:be.state)??null,createdAt:(be==null?void 0:be.createdAt)??0,archived:(be==null?void 0:be.archived)??!1,backendType:(me==null?void 0:me.backend_type)||(be==null?void 0:be.backendType)||"claude",repoRoot:(me==null?void 0:me.repo_root)||"",permCount:((Xe=$.get(ne))==null?void 0:Xe.size)??0,cronJobId:(me==null?void 0:me.cronJobId)||(be==null?void 0:be.cronJobId),cronJobName:(me==null?void 0:me.cronJobName)||(be==null?void 0:be.cronJobName),agentId:(me==null?void 0:me.agentId)||(be==null?void 0:be.agentId),agentName:(me==null?void 0:me.agentName)||(be==null?void 0:be.agentName),userName:be==null?void 0:be.userName}}).sort((ne,me)=>me.createdAt-ne.createdAt),ze=S.useMemo(()=>Array.from(new Set(Ne.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[Ne]),[mt,Ee]=S.useState("__all__"),$r=ne=>mt==="__all__"?!0:mt==="__none__"?!ne.userName:ne.userName===mt,ae=Ne.some(ne=>!ne.userName),_e=Ne.filter($r),W=_e.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),pe=_e.filter(ne=>!ne.archived&&!!ne.cronJobId),Me=_e.filter(ne=>!ne.archived&&!!ne.agentId),Qe=_e.filter(ne=>ne.archived),nt=P?Ne.find(ne=>ne.id===P):null,rt=(nt==null?void 0:nt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[St,vn]=S.useState(!0),[et,rr]=S.useState(!0),En=S.useMemo(()=>SE(W),[W]),Xr={onSelect:z,onStartRename:xe,onArchive:Jt,onUnarchive:ct,onDelete:je,onClearRecentlyRenamed:Y,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:A,onCancelRename:ue,editInputRef:D};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:rt,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),l.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>X.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),ze.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:mt,onChange:ne=>Ee(ne.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),ze.map(ne=>l.jsx("option",{value:ne,children:ne},ne)),ae&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:Nt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:_t,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:W.length===0&&pe.length===0&&Qe.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[En.map((ne,me)=>l.jsx(yE,{group:ne,isCollapsed:V.has(ne.key),onToggleCollapse:ge,currentSessionId:P,sessionNames:le,pendingPermissions:$,recentlyRenamed:J,isFirst:me===0,...Xr},ne.key)),pe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>vn(!St),"aria-expanded":St,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${St?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",pe.length,")"]}),St&&l.jsx("div",{className:"mt-0.5",children:pe.map(ne=>{var me;return l.jsx(Ld,{session:ne,isActive:P===ne.id,sessionName:le.get(ne.id),permCount:((me=$.get(ne.id))==null?void 0:me.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]}),Me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>rr(!et),"aria-expanded":et,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${et?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Me.length,")"]}),et&&l.jsx("div",{className:"mt-0.5",children:Me.map(ne=>{var me;return l.jsx(Ld,{session:ne,isActive:P===ne.id,sessionName:le.get(ne.id),permCount:((me=$.get(ne.id))==null?void 0:me.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]}),Qe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Qe.length,")"]}),a&&Qe.length>1&&l.jsx("button",{onClick:Je,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:Qe.map(ne=>{var me;return l.jsx(Ld,{session:ne,isActive:P===ne.id,isArchived:!0,sessionName:le.get(ne.id),permCount:((me=$.get(ne.id))==null?void 0:me.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:NE.map(ne=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:ne.label}),l.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(me=>{const be=CE.get(me);if(!be)return null;const Xe=be.activePages?be.activePages.some($t=>R.page===$t):R.page===be.id;return l.jsxs("button",{onClick:()=>{window.location.hash=be.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:be.label,"aria-current":Xe?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Xe?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Xe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:be.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:be.iconPath,fillRule:be.fillRule,clipRule:be.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:be.label})]},be.id)})})]},ne.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:kE.map(ne=>l.jsx("a",{href:ne.url,target:"_blank",rel:"noopener noreferrer",title:ne.label,"aria-label":`Open ${ne.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:ne.iconPath})})},ne.label))})]})})]}),(_||C)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:C?ht:Be,children:l.jsxs("div",{ref:O,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:ne=>ne.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:C?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:C?`This will permanently delete ${Qe.length} archived session${Qe.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:C?ht:Be,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:C?it:Le,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:C?"Delete all":"Delete"})]})]})}),h&&g&&l.jsx(gE,{issueIdentifier:((Fr=g.issue)==null?void 0:Fr.identifier)||"",issueStateName:((Ur=g.issue)==null?void 0:Ur.stateName)||"",isContainerized:b,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:ve,onCancel:Fe})]})}function TE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const AE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ME=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,RE={};function a_(e,t){return(RE.jsx?ME:AE).test(e)}const LE=/[ \t\n\f\r]/g;function DE(e){return typeof e=="object"?e.type==="text"?l_(e.value):!1:l_(e)}function l_(e){return e.replace(LE,"")===""}class Dc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Dc.prototype.normal={};Dc.prototype.property={};Dc.prototype.space=void 0;function v2(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Dc(n,i,t)}function Eg(e){return e.toLowerCase()}class nr{constructor(t,n){this.attribute=n,this.property=t}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let zE=0;const Ge=ka(),mn=ka(),Tg=ka(),Se=ka(),Dt=ka(),ba=ka(),hr=ka();function ka(){return 2**++zE}const Ag=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:mn,commaOrSpaceSeparated:hr,commaSeparated:ba,number:Se,overloadedBoolean:Tg,spaceSeparated:Dt},Symbol.toStringTag,{value:"Module"})),hm=Object.keys(Ag);class hx extends nr{constructor(t,n,i,a){let o=-1;if(super(t,n),o_(this,"space",a),typeof i=="number")for(;++o<hm.length;){const u=hm[o];o_(this,hm[o],(i&Ag[u])===Ag[u])}}}hx.prototype.defined=!0;function o_(e,t,n){n&&(e[t]=n)}function Bl(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new hx(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[Eg(i)]=i,n[Eg(o.attribute)]=i}return new Dc(t,n,e.space)}const b2=Bl({properties:{ariaActiveDescendant:null,ariaAtomic:mn,ariaAutoComplete:null,ariaBusy:mn,ariaChecked:mn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:mn,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:mn,ariaFlowTo:Dt,ariaGrabbed:mn,ariaHasPopup:null,ariaHidden:mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:Se,ariaLive:null,ariaModal:mn,ariaMultiLine:mn,ariaMultiSelectable:mn,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:mn,ariaReadOnly:mn,ariaRelevant:null,ariaRequired:mn,ariaRoleDescription:Dt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:mn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function y2(e,t){return t in e?e[t]:t}function _2(e,t){return y2(e,t.toLowerCase())}const OE=Bl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ba,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alpha:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:Dt,autoFocus:Ge,autoPlay:Ge,blocking:Dt,capture:null,charSet:null,checked:Ge,cite:null,className:Dt,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:mn,controls:Ge,controlsList:Dt,coords:Se|ba,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:Tg,draggable:mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:Dt,height:Se,hidden:Tg,high:Se,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:Ge,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:Se,pattern:null,ping:Dt,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:Dt,required:Ge,reversed:Ge,rows:Se,rowSpan:Se,sandbox:Dt,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootCustomElementRegistry:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shadowRootSerializable:Ge,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:mn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:mn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ge,disablePictureInPicture:Ge,disableRemotePlayback:Ge,exportParts:ba,part:Dt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:_2}),BE=Bl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:hr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Dt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ba,g2:ba,glyphName:ba,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:hr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hr,rev:hr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hr,requiredFeatures:hr,requiredFonts:hr,requiredFormats:hr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:hr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:y2}),w2=Bl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),S2=Bl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_2}),k2=Bl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),PE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$E=/[A-Z]/g,c_=/-[a-z]/g,FE=/^data[-\w.:]+$/i;function UE(e,t){const n=Eg(t);let i=t,a=nr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&FE.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(c_,HE);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!c_.test(o)){let u=o.replace($E,IE);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=hx}return new a(i,t)}function IE(e){return"-"+e.toLowerCase()}function HE(e){return e.charAt(1).toUpperCase()}const qE=v2([b2,OE,w2,S2,k2],"html"),px=v2([b2,BE,w2,S2,k2],"svg");function VE(e){return e.join(" ").trim()}var gl={},pm,u_;function GE(){if(u_)return pm;u_=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
71
+ `,p="/",g="*",x="",b="comment",y="declaration";function _(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var E=1,N=1;function D(J){var Y=J.match(t);Y&&(E+=Y.length);var $=J.lastIndexOf(h);N=~$?J.length-$:N+J.length}function O(){var J={line:E,column:N};return function(Y){return Y.position=new L(J),Q(),Y}}function L(J){this.start=J,this.end={line:E,column:N},this.source=k.source}L.prototype.content=C;function G(J){var Y=new Error(k.source+":"+E+":"+N+": "+J);if(Y.reason=J,Y.filename=k.source,Y.line=E,Y.column=N,Y.source=C,!k.silent)throw Y}function P(J){var Y=J.exec(C);if(Y){var $=Y[0];return D($),C=C.slice($.length),Y}}function Q(){P(n)}function B(J){var Y;for(J=J||[];Y=I();)Y!==!1&&J.push(Y);return J}function I(){var J=O();if(!(p!=C.charAt(0)||g!=C.charAt(1))){for(var Y=2;x!=C.charAt(Y)&&(g!=C.charAt(Y)||p!=C.charAt(Y+1));)++Y;if(Y+=2,x===C.charAt(Y-1))return G("End of comment missing");var $=C.slice(2,Y-2);return N+=2,D($),C=C.slice(Y),N+=2,J({type:b,comment:$})}}function M(){var J=O(),Y=P(i);if(Y){if(I(),!P(a))return G("property missing ':'");var $=P(o),F=J({type:y,property:j(Y[0].replace(e,x)),value:$?j($[0].replace(e,x)):x});return P(u),F}}function le(){var J=[];B(J);for(var Y;Y=M();)Y!==!1&&(J.push(Y),B(J));return J}return Q(),le()}function j(C){return C?C.replace(f,x):x}return pm=_,pm}var d_;function YE(){if(d_)return gl;d_=1;var e=gl&&gl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(gl,"__esModule",{value:!0}),gl.default=n;const t=e(GE());function n(i,a){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),f=typeof a=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?a(p,g,h):g&&(o=o||{},o[p]=g)}),o}return gl}var Yo={},f_;function WE(){if(f_)return Yo;f_=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},f=function(p,g){return"".concat(g,"-")},h=function(p,g){return g===void 0&&(g={}),o(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,f):p=p.replace(i,f),p.replace(t,u))};return Yo.camelCase=h,Yo}var Wo,h_;function QE(){if(h_)return Wo;h_=1;var e=Wo&&Wo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(YE()),n=WE();function i(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(f,h){f&&h&&(u[(0,n.camelCase)(f,o)]=h)}),u}return i.default=i,Wo=i,Wo}var XE=QE();const KE=Hg(XE),j2=N2("end"),mx=N2("start");function N2(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function ZE(e){const t=mx(e),n=j2(e);if(t&&n)return{start:t,end:n}}function hc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?p_(e.position):"start"in e||"end"in e?p_(e):"line"in e||"column"in e?Mg(e):""}function Mg(e){return m_(e&&e.line)+":"+m_(e&&e.column)}function p_(e){return Mg(e&&e.start)+"-"+Mg(e&&e.end)}function m_(e){return e&&typeof e=="number"?e:1}class Dn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?o.ruleId=i:(o.source=i.slice(0,h),o.ruleId=i.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=hc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Dn.prototype.file="";Dn.prototype.name="";Dn.prototype.reason="";Dn.prototype.message="";Dn.prototype.stack="";Dn.prototype.column=void 0;Dn.prototype.line=void 0;Dn.prototype.ancestors=void 0;Dn.prototype.cause=void 0;Dn.prototype.fatal=void 0;Dn.prototype.place=void 0;Dn.prototype.ruleId=void 0;Dn.prototype.source=void 0;const gx={}.hasOwnProperty,JE=new Map,e6=/[A-Z]/g,t6=new Set(["table","tbody","thead","tfoot","tr"]),n6=new Set(["td","th"]),C2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function r6(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=d6(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=u6(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?px:qE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=E2(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function E2(e,t,n){if(t.type==="element")return i6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return s6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return l6(e,t,n);if(t.type==="mdxjsEsm")return a6(e,t);if(t.type==="root")return o6(e,t,n);if(t.type==="text")return c6(e,t)}function i6(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=px,e.schema=a),e.ancestors.push(t);const o=A2(e,t.tagName,!1),u=f6(e,t);let f=vx(e,t);return t6.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!DE(h):!0})),T2(e,u,o,t),xx(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function s6(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Tc(e,t.position)}function a6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tc(e,t.position)}function l6(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=px,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:A2(e,t.name,!0),u=h6(e,t),f=vx(e,t);return T2(e,u,o,t),xx(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function o6(e,t,n){const i={};return xx(i,vx(e,t)),e.create(t,e.Fragment,i,n)}function c6(e,t){return t.value}function T2(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function xx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function u6(e,t,n){return i;function i(a,o,u,f){const p=Array.isArray(u.children)?n:t;return f?p(o,u,f):p(o,u)}}function d6(e,t){return n;function n(i,a,o,u){const f=Array.isArray(o.children),h=mx(i);return t(a,o,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function f6(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&gx.call(t.properties,a)){const o=p6(e,a,t.properties[a]);if(o){const[u,f]=o;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&n6.has(t.tagName)?i=f:n[u]=f}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function h6(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Tc(e,t.position);else{const a=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else Tc(e,t.position);else o=i.value===null?!0:i.value;n[a]=o}return n}function vx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:JE;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const p=a.get(h)||0;u=h+"-"+p,a.set(h,p+1)}}const f=E2(e,o,u);f!==void 0&&n.push(f)}return n}function p6(e,t,n){const i=UE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?TE(n):VE(n)),i.property==="style"){let a=typeof n=="object"?n:m6(e,String(n));return e.stylePropertyNameCase==="css"&&(a=g6(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?PE[i.property]||i.property:i.attribute,n]}}function m6(e,t){try{return KE(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Dn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=C2+"#cannot-parse-style-attribute",a}}function A2(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const f=a_(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}i=u}else i=a_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return gx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Tc(e)}function Tc(e,t){const n=new Dn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=C2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function g6(e){const t={};let n;for(n in e)gx.call(e,n)&&(t[x6(n)]=e[n]);return t}function x6(e){let t=e.replace(e6,v6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function v6(e){return"-"+e.toLowerCase()}const mm={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},b6={};function bx(e,t){const n=b6,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return M2(e,i,a)}function M2(e,t,n){if(y6(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return g_(e.children,t,n)}return Array.isArray(e)?g_(e,t,n):""}function g_(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=M2(e[a],t,n);return i.join("")}function y6(e){return!!(e&&typeof e=="object")}const x_=document.createElement("i");function yx(e){const t="&"+e+";";x_.innerHTML=t;const n=x_.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xr(e,t,n,i){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Br(e,t){return e.length>0?(xr(e,e.length,0,t),e):t}const v_={}.hasOwnProperty;function R2(e){const t={};let n=-1;for(;++n<e.length;)_6(t,e[n]);return t}function _6(e,t){let n;for(n in t){const a=(v_.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){v_.call(a,u)||(a[u]=[]);const f=o[u];w6(a[u],Array.isArray(f)?f:f?[f]:[])}}}function w6(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);xr(e,0,0,i)}function L2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Un=Ls(/[A-Za-z]/),Ln=Ls(/[\dA-Za-z]/),S6=Ls(/[#-'*+\--9=?A-Z^-~]/);function of(e){return e!==null&&(e<32||e===127)}const Rg=Ls(/\d/),k6=Ls(/[\dA-Fa-f]/),j6=Ls(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const yf=Ls(new RegExp("\\p{P}|\\p{S}","u")),wa=Ls(/\s/);function Ls(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Pl(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Ln(e.charCodeAt(n+1))&&Ln(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(u=String.fromCharCode(o,f),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function xt(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(h){return ot(h)?(e.enter(n),f(h)):t(h)}function f(h){return ot(h)&&o++<a?(e.consume(h),f):(e.exit(n),t(h))}}const N6={tokenize:C6};function C6(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),xt(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return $e(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),u)}}const E6={tokenize:T6},b_={tokenize:A6};function T6(e){const t=this,n=[];let i=0,a,o,u;return f;function f(N){if(i<n.length){const D=n[i];return t.containerState=D[1],e.attempt(D[0].continuation,h,p)(N)}return p(N)}function h(N){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const D=t.events.length;let O=D,L;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){L=t.events[O][1].end;break}k(i);let G=D;for(;G<t.events.length;)t.events[G][1].end={...L},G++;return xr(t.events,O+1,0,t.events.slice(D)),t.events.length=G,p(N)}return f(N)}function p(N){if(i===n.length){if(!a)return b(N);if(a.currentConstruct&&a.currentConstruct.concrete)return _(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(b_,g,x)(N)}function g(N){return a&&E(),k(i),b(N)}function x(N){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(N)}function b(N){return t.containerState={},e.attempt(b_,y,_)(N)}function y(N){return i++,n.push([t.currentConstruct,t.containerState]),b(N)}function _(N){if(N===null){a&&E(),k(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(N)}function j(N){if(N===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return $e(N)?(e.consume(N),C(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(N),j)}function C(N,D){const O=t.sliceStream(N);if(D&&O.push(null),N.previous=o,o&&(o.next=N),o=N,a.defineSkip(N.start),a.write(O),t.parser.lazy[N.start.line]){let L=a.events.length;for(;L--;)if(a.events[L][1].start.offset<u&&(!a.events[L][1].end||a.events[L][1].end.offset>u))return;const G=t.events.length;let P=G,Q,B;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(Q){B=t.events[P][1].end;break}Q=!0}for(k(i),L=G;L<t.events.length;)t.events[L][1].end={...B},L++;xr(t.events,P+1,0,t.events.slice(G)),t.events.length=L}}function k(N){let D=n.length;for(;D-- >N;){const O=n[D];t.containerState=O[1],O[0].exit.call(t,e)}n.length=N}function E(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function A6(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ll(e){if(e===null||Pt(e)||wa(e))return 1;if(yf(e))return 2}function _f(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const Lg={name:"attention",resolveAll:M6,tokenize:R6};function M6(e,t){let n=-1,i,a,o,u,f,h,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[i][1].end},b={...e[n][1].start};y_(x,-h),y_(b,h),u={type:h>1?"strongSequence":"emphasisSequence",start:x,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Br(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Br(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=Br(p,_f(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Br(p,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Br(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,xr(e,i-1,n-i+3,p),n=i+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function R6(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Ll(i);let o;return u;function u(h){return o=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===o)return e.consume(h),f;const p=e.exit("attentionSequence"),g=Ll(h),x=!g||g===2&&a||n.includes(h),b=!a||a===2&&g||n.includes(i);return p._open=!!(o===42?x:x&&(a||!b)),p._close=!!(o===42?b:b&&(g||!x)),t(h)}}function y_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const L6={name:"autolink",tokenize:D6};function D6(e,t,n){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Un(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Ln(y)?(i=1,f(y)):p(y)}function f(y){return y===58?(e.consume(y),i=0,h):(y===43||y===45||y===46||Ln(y))&&i++<32?(e.consume(y),f):(i=0,p(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||of(y)?n(y):(e.consume(y),h)}function p(y){return y===64?(e.consume(y),g):S6(y)?(e.consume(y),p):n(y)}function g(y){return Ln(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),i=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Ln(y))&&i++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const zc={partial:!0,tokenize:z6};function z6(e,t,n){return i;function i(o){return ot(o)?xt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||$e(o)?t(o):n(o)}}const D2={continuation:{tokenize:B6},exit:P6,name:"blockQuote",tokenize:O6};function O6(e,t,n){const i=this;return a;function a(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function B6(e,t,n){const i=this;return a;function a(u){return ot(u)?xt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(D2,t,n)(u)}}function P6(e){e.exit("blockQuote")}const z2={name:"characterEscape",tokenize:$6};function $6(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return j6(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const O2={name:"characterReference",tokenize:F6};function F6(e,t,n){const i=this;let a=0,o,u;return f;function f(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),h}function h(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Ln,g(x))}function p(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=k6,g):(e.enter("characterReferenceValue"),o=7,u=Rg,g(x))}function g(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Ln&&!yx(i.sliceSerialize(b))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(x)&&a++<o?(e.consume(x),g):n(x)}}const __={partial:!0,tokenize:I6},w_={concrete:!0,name:"codeFenced",tokenize:U6};function U6(e,t,n){const i=this,a={partial:!0,tokenize:O};let o=0,u=0,f;return h;function h(L){return p(L)}function p(L){const G=i.events[i.events.length-1];return o=G&&G[1].type==="linePrefix"?G[2].sliceSerialize(G[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(L)}function g(L){return L===f?(u++,e.consume(L),g):u<3?n(L):(e.exit("codeFencedFenceSequence"),ot(L)?xt(e,x,"whitespace")(L):x(L))}function x(L){return L===null||$e(L)?(e.exit("codeFencedFence"),i.interrupt?t(L):e.check(__,j,D)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(L)):ot(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xt(e,y,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),b)}function y(L){return L===null||$e(L)?x(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(L))}function _(L){return L===null||$e(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(L)):L===96&&L===f?n(L):(e.consume(L),_)}function j(L){return e.attempt(a,D,C)(L)}function C(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),k}function k(L){return o>0&&ot(L)?xt(e,E,"linePrefix",o+1)(L):E(L)}function E(L){return L===null||$e(L)?e.check(__,j,D)(L):(e.enter("codeFlowValue"),N(L))}function N(L){return L===null||$e(L)?(e.exit("codeFlowValue"),E(L)):(e.consume(L),N)}function D(L){return e.exit("codeFenced"),t(L)}function O(L,G,P){let Q=0;return B;function B(Y){return L.enter("lineEnding"),L.consume(Y),L.exit("lineEnding"),I}function I(Y){return L.enter("codeFencedFence"),ot(Y)?xt(L,M,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):M(Y)}function M(Y){return Y===f?(L.enter("codeFencedFenceSequence"),le(Y)):P(Y)}function le(Y){return Y===f?(Q++,L.consume(Y),le):Q>=u?(L.exit("codeFencedFenceSequence"),ot(Y)?xt(L,J,"whitespace")(Y):J(Y)):P(Y)}function J(Y){return Y===null||$e(Y)?(L.exit("codeFencedFence"),G(Y)):P(Y)}}}function I6(e,t,n){const i=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const gm={name:"codeIndented",tokenize:q6},H6={partial:!0,tokenize:V6};function q6(e,t,n){const i=this;return a;function a(p){return e.enter("codeIndented"),xt(e,o,"linePrefix",5)(p)}function o(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?h(p):$e(p)?e.attempt(H6,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||$e(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function V6(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):$e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):xt(e,o,"linePrefix",5)(u)}function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):$e(u)?a(u):n(u)}}const G6={name:"codeText",previous:W6,resolve:Y6,tokenize:Q6};function Y6(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function W6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Q6(e,t,n){let i=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),f(x)}function f(x){return x===96?(e.consume(x),i++,f):(e.exit("codeTextSequence"),h(x))}function h(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),h):x===96?(o=e.enter("codeTextSequence"),a=0,g(x)):$e(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||$e(x)?(e.exit("codeTextData"),h(x)):(e.consume(x),p)}function g(x){return x===96?(e.consume(x),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(o.type="codeTextData",p(x))}}class X6{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Qo(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qo(this.left,n.reverse())}}}function Qo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function B2(e){const t={};let n=-1,i,a,o,u,f,h,p;const g=new X6(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,K6(g,n)),n=t[n],p=!0);else if(i[1]._container){for(o=n,a=void 0;o--;)if(u=g.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(i),g.splice(a,n-a+1,f))}}return xr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function K6(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let g,x,b=-1,y=n,_=0,j=0;const C=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=i.sliceStream(y),y.next||g.push(null),x&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),x=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,C.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):C.pop(),b=C.length;b--;){const k=f.slice(C[b],C[b+1]),E=o.pop();h.push([E,E+k.length-1]),e.splice(E,2,k)}for(h.reverse(),b=-1;++b<h.length;)p[_+h[b][0]]=_+h[b][1],_+=h[b][1]-h[b][0]-1;return p}const Z6={resolve:eT,tokenize:tT},J6={partial:!0,tokenize:nT};function eT(e){return B2(e),e}function tT(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):$e(f)?e.check(J6,u,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function nT(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),xt(e,o,"linePrefix")}function o(u){if(u===null||$e(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function P2(e,t,n,i,a,o,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return x;function x(k){return k===60?(e.enter(i),e.enter(a),e.enter(o),e.consume(k),e.exit(o),b):k===null||k===32||k===41||of(k)?n(k):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(k))}function b(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(a),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(f),b(k)):k===null||k===60||$e(k)?n(k):(e.consume(k),k===92?_:y)}function _(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function j(k){return!g&&(k===null||k===41||Pt(k))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(k)):g<p&&k===40?(e.consume(k),g++,j):k===41?(e.consume(k),g--,j):k===null||k===32||k===40||of(k)?n(k):(e.consume(k),k===92?C:j)}function C(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function $2(e,t,n,i,a,o){const u=this;let f=0,h;return p;function p(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(o),g}function g(y){return f>999||y===null||y===91||y===93&&!h||y===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):$e(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||$e(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),h||(h=!ot(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,x):x(y)}}function F2(e,t,n,i,a,o){let u;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,h):n(b)}function h(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),h(u)):b===null?n(b):$e(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),xt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===u||b===null||$e(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?x:g)}function x(b){return b===u||b===92?(e.consume(b),g):g(b)}}function pc(e,t){let n;return i;function i(a){return $e(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):ot(a)?xt(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const rT={name:"definition",tokenize:sT},iT={partial:!0,tokenize:aT};function sT(e,t,n){const i=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return $2.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=Qr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return Pt(y)?pc(e,p)(y):p(y)}function p(y){return P2(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(iT,x,x)(y)}function x(y){return ot(y)?xt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||$e(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function aT(e,t,n){return i;function i(f){return Pt(f)?pc(e,a)(f):n(f)}function a(f){return F2(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ot(f)?xt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||$e(f)?t(f):n(f)}}const lT={name:"hardBreakEscape",tokenize:oT};function oT(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return $e(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const cT={name:"headingAtx",resolve:uT,tokenize:dT};function uT(e,t){let n=e.length-2,i=3,a,o;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},xr(e,i,n-i+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function dT(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Pt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||$e(g)?(e.exit("atxHeading"),t(g)):ot(g)?xt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),f(g))}function p(g){return g===null||g===35||Pt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const fT=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],S_=["pre","script","style","textarea"],hT={concrete:!0,name:"htmlFlow",resolveTo:gT,tokenize:xT},pT={partial:!0,tokenize:bT},mT={partial:!0,tokenize:vT};function gT(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function xT(e,t,n){const i=this;let a,o,u,f,h;return p;function p(A){return g(A)}function g(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),x}function x(A){return A===33?(e.consume(A),b):A===47?(e.consume(A),o=!0,j):A===63?(e.consume(A),a=3,i.interrupt?t:R):Un(A)?(e.consume(A),u=String.fromCharCode(A),C):n(A)}function b(A){return A===45?(e.consume(A),a=2,y):A===91?(e.consume(A),a=5,f=0,_):Un(A)?(e.consume(A),a=4,i.interrupt?t:R):n(A)}function y(A){return A===45?(e.consume(A),i.interrupt?t:R):n(A)}function _(A){const ue="CDATA[";return A===ue.charCodeAt(f++)?(e.consume(A),f===ue.length?i.interrupt?t:M:_):n(A)}function j(A){return Un(A)?(e.consume(A),u=String.fromCharCode(A),C):n(A)}function C(A){if(A===null||A===47||A===62||Pt(A)){const ue=A===47,xe=u.toLowerCase();return!ue&&!o&&S_.includes(xe)?(a=1,i.interrupt?t(A):M(A)):fT.includes(u.toLowerCase())?(a=6,ue?(e.consume(A),k):i.interrupt?t(A):M(A)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(A):o?E(A):N(A))}return A===45||Ln(A)?(e.consume(A),u+=String.fromCharCode(A),C):n(A)}function k(A){return A===62?(e.consume(A),i.interrupt?t:M):n(A)}function E(A){return ot(A)?(e.consume(A),E):B(A)}function N(A){return A===47?(e.consume(A),B):A===58||A===95||Un(A)?(e.consume(A),D):ot(A)?(e.consume(A),N):B(A)}function D(A){return A===45||A===46||A===58||A===95||Ln(A)?(e.consume(A),D):O(A)}function O(A){return A===61?(e.consume(A),L):ot(A)?(e.consume(A),O):N(A)}function L(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,G):ot(A)?(e.consume(A),L):P(A)}function G(A){return A===h?(e.consume(A),h=null,Q):A===null||$e(A)?n(A):(e.consume(A),G)}function P(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Pt(A)?O(A):(e.consume(A),P)}function Q(A){return A===47||A===62||ot(A)?N(A):n(A)}function B(A){return A===62?(e.consume(A),I):n(A)}function I(A){return A===null||$e(A)?M(A):ot(A)?(e.consume(A),I):n(A)}function M(A){return A===45&&a===2?(e.consume(A),$):A===60&&a===1?(e.consume(A),F):A===62&&a===4?(e.consume(A),z):A===63&&a===3?(e.consume(A),R):A===93&&a===5?(e.consume(A),ge):$e(A)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(pT,Z,le)(A)):A===null||$e(A)?(e.exit("htmlFlowData"),le(A)):(e.consume(A),M)}function le(A){return e.check(mT,J,Z)(A)}function J(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),Y}function Y(A){return A===null||$e(A)?le(A):(e.enter("htmlFlowData"),M(A))}function $(A){return A===45?(e.consume(A),R):M(A)}function F(A){return A===47?(e.consume(A),u="",V):M(A)}function V(A){if(A===62){const ue=u.toLowerCase();return S_.includes(ue)?(e.consume(A),z):M(A)}return Un(A)&&u.length<8?(e.consume(A),u+=String.fromCharCode(A),V):M(A)}function ge(A){return A===93?(e.consume(A),R):M(A)}function R(A){return A===62?(e.consume(A),z):A===45&&a===2?(e.consume(A),R):M(A)}function z(A){return A===null||$e(A)?(e.exit("htmlFlowData"),Z(A)):(e.consume(A),z)}function Z(A){return e.exit("htmlFlow"),t(A)}}function vT(e,t,n){const i=this;return a;function a(u){return $e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function bT(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(zc,t,n)}}const yT={name:"htmlText",tokenize:_T};function _T(e,t,n){const i=this;let a,o,u;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),O):R===63?(e.consume(R),N):Un(R)?(e.consume(R),P):n(R)}function p(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),o=0,_):Un(R)?(e.consume(R),E):n(R)}function g(R){return R===45?(e.consume(R),y):n(R)}function x(R){return R===null?n(R):R===45?(e.consume(R),b):$e(R)?(u=x,F(R)):(e.consume(R),x)}function b(R){return R===45?(e.consume(R),y):x(R)}function y(R){return R===62?$(R):R===45?b(R):x(R)}function _(R){const z="CDATA[";return R===z.charCodeAt(o++)?(e.consume(R),o===z.length?j:_):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),C):$e(R)?(u=j,F(R)):(e.consume(R),j)}function C(R){return R===93?(e.consume(R),k):j(R)}function k(R){return R===62?$(R):R===93?(e.consume(R),k):j(R)}function E(R){return R===null||R===62?$(R):$e(R)?(u=E,F(R)):(e.consume(R),E)}function N(R){return R===null?n(R):R===63?(e.consume(R),D):$e(R)?(u=N,F(R)):(e.consume(R),N)}function D(R){return R===62?$(R):N(R)}function O(R){return Un(R)?(e.consume(R),L):n(R)}function L(R){return R===45||Ln(R)?(e.consume(R),L):G(R)}function G(R){return $e(R)?(u=G,F(R)):ot(R)?(e.consume(R),G):$(R)}function P(R){return R===45||Ln(R)?(e.consume(R),P):R===47||R===62||Pt(R)?Q(R):n(R)}function Q(R){return R===47?(e.consume(R),$):R===58||R===95||Un(R)?(e.consume(R),B):$e(R)?(u=Q,F(R)):ot(R)?(e.consume(R),Q):$(R)}function B(R){return R===45||R===46||R===58||R===95||Ln(R)?(e.consume(R),B):I(R)}function I(R){return R===61?(e.consume(R),M):$e(R)?(u=I,F(R)):ot(R)?(e.consume(R),I):Q(R)}function M(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,le):$e(R)?(u=M,F(R)):ot(R)?(e.consume(R),M):(e.consume(R),J)}function le(R){return R===a?(e.consume(R),a=void 0,Y):R===null?n(R):$e(R)?(u=le,F(R)):(e.consume(R),le)}function J(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Pt(R)?Q(R):(e.consume(R),J)}function Y(R){return R===47||R===62||Pt(R)?Q(R):n(R)}function $(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function F(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),V}function V(R){return ot(R)?xt(e,ge,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ge(R)}function ge(R){return e.enter("htmlTextData"),u(R)}}const _x={name:"labelEnd",resolveAll:jT,resolveTo:NT,tokenize:CT},wT={tokenize:ET},ST={tokenize:TT},kT={tokenize:AT};function jT(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&xr(e,0,e.length,n),e}function NT(e,t){let n=e.length,i=0,a,o,u,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[o+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=Br(f,e.slice(o+1,o+i+3)),f=Br(f,[["enter",g,t]]),f=Br(f,_f(t.parser.constructs.insideSpan.null,e.slice(o+i+4,u-3),t)),f=Br(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=Br(f,e.slice(u+1)),f=Br(f,[["exit",h,t]]),xr(e,o,e.length,f),e}function CT(e,t,n){const i=this;let a=i.events.length,o,u;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){o=i.events[a][1];break}return f;function f(b){return o?o._inactive?x(b):(u=i.parser.defined.includes(Qr(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):n(b)}function h(b){return b===40?e.attempt(wT,g,u?g:x)(b):b===91?e.attempt(ST,g,u?p:x)(b):u?g(b):x(b)}function p(b){return e.attempt(kT,g,x)(b)}function g(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function ET(e,t,n){return i;function i(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return Pt(x)?pc(e,o)(x):o(x)}function o(x){return x===41?g(x):P2(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return Pt(x)?pc(e,h)(x):g(x)}function f(x){return n(x)}function h(x){return x===34||x===39||x===40?F2(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):g(x)}function p(x){return Pt(x)?pc(e,g)(x):g(x)}function g(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function TT(e,t,n){const i=this;return a;function a(f){return $2.call(i,e,o,u,"reference","referenceMarker","referenceString")(f)}function o(f){return i.parser.defined.includes(Qr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function AT(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const MT={name:"labelStartImage",resolveAll:_x.resolveAll,tokenize:RT};function RT(e,t,n){const i=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):t(f)}}const LT={name:"labelStartLink",resolveAll:_x.resolveAll,tokenize:DT};function DT(e,t,n){const i=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const xm={name:"lineEnding",tokenize:zT};function zT(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),xt(e,t,"linePrefix")}}const Dd={name:"thematicBreak",tokenize:OT};function OT(e,t,n){let i=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,f(p)}function f(p){return p===a?(e.enter("thematicBreakSequence"),h(p)):i>=3&&(p===null||$e(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===a?(e.consume(p),i++,h):(e.exit("thematicBreakSequence"),ot(p)?xt(e,f,"whitespace")(p):f(p))}}const Jn={continuation:{tokenize:FT},exit:IT,name:"list",tokenize:$T},BT={partial:!0,tokenize:HT},PT={partial:!0,tokenize:UT};function $T(e,t,n){const i=this,a=i.events[i.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return f;function f(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:Rg(y)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Dd,n,p)(y):p(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Rg(y)&&++u<10?(e.consume(y),h):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(zc,i.interrupt?n:g,e.attempt(BT,b,x))}function g(y){return i.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function FT(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(zc,a,o);function a(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,xt(e,t,"listItemIndent",i.containerState.size+1)(f)}function o(f){return i.containerState.furtherBlankLines||!ot(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(PT,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,xt(e,e.attempt(Jn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function UT(e,t,n){const i=this;return xt(e,a,"listItemIndent",i.containerState.size+1);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(o):n(o)}}function IT(e){e.exit(this.containerState.type)}function HT(e,t,n){const i=this;return xt(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=i.events[i.events.length-1];return!ot(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const k_={name:"setextUnderline",resolveTo:qT,tokenize:VT};function qT(e,t){let n=e.length,i,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",u,t]),e.splice(o+1,0,["exit",e[i][1],t]),e[i][1].end={...e[o][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function VT(e,t,n){const i=this;let a;return o;function o(p){let g=i.events.length,x;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){x=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||x)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===a?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ot(p)?xt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||$e(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const GT={tokenize:YT};function YT(e){const t=this,n=e.attempt(zc,i,e.attempt(this.parser.constructs.flowInitial,a,xt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Z6,a)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const WT={resolveAll:I2()},QT=U2("string"),XT=U2("text");function U2(e){return{resolveAll:I2(e==="text"?KT:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],o=n.attempt(a,u,f);return u;function u(g){return p(g)?o(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return p(g)?(n.exit("data"),o(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const x=a[g];let b=-1;if(x)for(;++b<x.length;){const y=x[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function I2(e){return t;function t(n,i){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,i):n}}function KT(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let o=a.length,u=-1,f=0,h;for(;o--;){const p=a[o];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(p===-2)h=!0,f++;else if(p!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:i.start._bufferIndex+u,_index:i.start._index+o,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const ZT={42:Jn,43:Jn,45:Jn,48:Jn,49:Jn,50:Jn,51:Jn,52:Jn,53:Jn,54:Jn,55:Jn,56:Jn,57:Jn,62:D2},JT={91:rT},eA={[-2]:gm,[-1]:gm,32:gm},tA={35:cT,42:Dd,45:[k_,Dd],60:hT,61:k_,95:Dd,96:w_,126:w_},nA={38:O2,92:z2},rA={[-5]:xm,[-4]:xm,[-3]:xm,33:MT,38:O2,42:Lg,60:[L6,yT],91:LT,92:[lT,z2],93:_x,95:Lg,96:G6},iA={null:[Lg,WT]},sA={null:[42,95]},aA={null:[]},lA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:sA,contentInitial:JT,disable:aA,document:ZT,flow:tA,flowInitial:eA,insideSpan:iA,string:nA,text:rA},Symbol.toStringTag,{value:"Module"}));function oA(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],f=[];const h={attempt:G(O),check:G(L),consume:E,enter:N,exit:D,interrupt:G(L,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:x};let g=t.tokenize.call(p,h);return t.resolveAll&&o.push(t),p;function x(I){return u=Br(u,I),C(),u[u.length-1]!==null?[]:(P(t,0),p.events=_f(o,p.events,p),p.events)}function b(I,M){return uA(y(I),M)}function y(I){return cA(u,I)}function _(){const{_bufferIndex:I,_index:M,line:le,column:J,offset:Y}=i;return{_bufferIndex:I,_index:M,line:le,column:J,offset:Y}}function j(I){a[I.line]=I.column,B()}function C(){let I;for(;i._index<u.length;){const M=u[i._index];if(typeof M=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<M.length;)k(M.charCodeAt(i._bufferIndex));else k(M)}}function k(I){g=g(I)}function E(I){$e(I)?(i.line++,i.column=1,i.offset+=I===-3?2:1,B()):I!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=I}function N(I,M){const le=M||{};return le.type=I,le.start=_(),p.events.push(["enter",le,p]),f.push(le),le}function D(I){const M=f.pop();return M.end=_(),p.events.push(["exit",M,p]),M}function O(I,M){P(I,M.from)}function L(I,M){M.restore()}function G(I,M){return le;function le(J,Y,$){let F,V,ge,R;return Array.isArray(J)?Z(J):"tokenize"in J?Z([J]):z(J);function z(je){return Re;function Re(Le){const Be=Le!==null&&je[Le],Je=Le!==null&&je.null,it=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Je)?Je:Je?[Je]:[]];return Z(it)(Le)}}function Z(je){return F=je,V=0,je.length===0?$:A(je[V])}function A(je){return Re;function Re(Le){return R=Q(),ge=je,je.partial||(p.currentConstruct=je),je.name&&p.parser.constructs.disable.null.includes(je.name)?xe():je.tokenize.call(M?Object.assign(Object.create(p),M):p,h,ue,xe)(Le)}}function ue(je){return I(ge,R),Y}function xe(je){return R.restore(),++V<F.length?A(F[V]):$}}}function P(I,M){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&xr(p.events,M,p.events.length-M,I.resolve(p.events.slice(M),p)),I.resolveTo&&(p.events=I.resolveTo(p.events,p))}function Q(){const I=_(),M=p.previous,le=p.currentConstruct,J=p.events.length,Y=Array.from(f);return{from:J,restore:$};function $(){i=I,p.previous=M,p.currentConstruct=le,p.events.length=J,f=Y,B()}}function B(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function cA(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,o)];else{if(u=e.slice(n,a),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function uA(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
72
+ `;break}case-3:{u=`\r
73
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,i.push(u)}return i.join("")}function dA(e){const i={constructs:R2([lA,...(e||{}).extensions||[]]),content:a(N6),defined:[],document:a(E6),flow:a(GT),lazy:{},string:a(QT),text:a(XT)};return i;function a(o){return u;function u(f){return oA(i,o,f)}}}function fA(e){for(;!B2(e););return e}const j_=/[\0\t\n\r]/g;function hA(){let e=1,t="",n=!0,i;return a;function a(o,u,f){const h=[];let p,g,x,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),x=0,t="",n&&(o.charCodeAt(0)===65279&&x++,n=void 0);x<o.length;){if(j_.lastIndex=x,p=j_.exec(o),b=p&&p.index!==void 0?p.index:o.length,y=o.charCodeAt(b),!p){t=o.slice(x);break}if(y===10&&x===b&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),x<b&&(h.push(o.slice(x,b)),e+=b-x),y){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}x=b+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const pA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mA(e){return e.replace(pA,gA)}function gA(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return L2(n.slice(o?2:1),o?16:10)}return yx(n)||e}const H2={}.hasOwnProperty;function xA(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),vA(n)(fA(dA(n).document().write(hA()(e,t,!0))))}function vA(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ct),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:o(_t),blockQuote:o(Je),characterEscape:Q,characterReference:Q,codeFenced:o(it),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(it,u),codeText:o(ht,u),codeTextData:Q,data:Q,codeFlowValue:Q,definition:o(Jt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(pt),hardBreakEscape:o(Nt),hardBreakTrailing:o(Nt),htmlFlow:o(ve,u),htmlFlowData:Q,htmlText:o(ve,u),htmlTextData:Q,image:o(Fe),label:u,link:o(ct),listItem:o(Ne),listItemValue:b,listOrdered:o(xn,x),listUnordered:o(xn),paragraph:o(ze),reference:A,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(_t),strong:o(mt),thematicBreak:o($r)},exit:{atxHeading:h(),atxHeadingSequence:O,autolink:h(),autolinkEmail:Be,autolinkProtocol:Le,blockQuote:h(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:je,characterReference:Re,codeFenced:h(C),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:B,codeIndented:h(k),codeText:h(Y),codeTextData:B,data:B,definition:h(),definitionDestinationString:D,definitionLabelString:E,definitionTitleString:N,emphasis:h(),hardBreakEscape:h(M),hardBreakTrailing:h(M),htmlFlow:h(le),htmlFlowData:B,htmlText:h(J),htmlTextData:B,image:h(F),label:ge,labelText:V,lineEnding:I,link:h($),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ue,resourceDestinationString:R,resourceTitleString:z,resource:Z,setextHeading:h(P),setextHeadingLineSequence:G,setextHeadingText:L,strong:h(),thematicBreak:h()}};q2(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ae){let _e={type:"root",children:[]};const W={stack:[_e],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},pe=[];let Me=-1;for(;++Me<ae.length;)if(ae[Me][1].type==="listOrdered"||ae[Me][1].type==="listUnordered")if(ae[Me][0]==="enter")pe.push(Me);else{const Qe=pe.pop();Me=a(ae,Qe,Me)}for(Me=-1;++Me<ae.length;){const Qe=t[ae[Me][0]];H2.call(Qe,ae[Me][1].type)&&Qe[ae[Me][1].type].call(Object.assign({sliceSerialize:ae[Me][2].sliceSerialize},W),ae[Me][1])}if(W.tokenStack.length>0){const Qe=W.tokenStack[W.tokenStack.length-1];(Qe[1]||N_).call(W,void 0,Qe[0])}for(_e.position={start:js(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:js(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me<t.transforms.length;)_e=t.transforms[Me](_e)||_e;return _e}function a(ae,_e,W){let pe=_e-1,Me=-1,Qe=!1,nt,rt,St,vn;for(;++pe<=W;){const et=ae[pe];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?Me++:Me--,vn=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(nt&&!vn&&!Me&&!St&&(St=pe),vn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vn=void 0}if(!Me&&et[0]==="enter"&&et[1].type==="listItemPrefix"||Me===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(nt){let rr=pe;for(rt=void 0;rr--;){const En=ae[rr];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;rt&&(ae[rt][1].type="lineEndingBlank",Qe=!0),En[1].type="lineEnding",rt=rr}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}St&&(!rt||St<rt)&&(nt._spread=!0),nt.end=Object.assign({},rt?ae[rt][1].start:et[1].end),ae.splice(rt||pe,0,["exit",nt,et[2]]),pe++,W++}if(et[1].type==="listItemPrefix"){const rr={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};nt=rr,ae.splice(pe,0,["enter",rr,et[2]]),pe++,W++,St=void 0,vn=!0}}}return ae[_e][1]._spread=Qe,W}function o(ae,_e){return W;function W(pe){f.call(this,ae(pe),pe),_e&&_e.call(this,pe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ae,_e,W){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([_e,W||void 0]),ae.position={start:js(_e.start),end:void 0}}function h(ae){return _e;function _e(W){ae&&ae.call(this,W),p.call(this,W)}}function p(ae,_e){const W=this.stack.pop(),pe=this.tokenStack.pop();if(pe)pe[0].type!==ae.type&&(_e?_e.call(this,ae,pe[0]):(pe[1]||N_).call(this,ae,pe[0]));else throw new Error("Cannot close `"+ae.type+"` ("+hc({start:ae.start,end:ae.end})+"): it’s not open");W.position.end=js(ae.end)}function g(){return bx(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(ae){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ae}function _(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae.replace(/(\r?\n|\r)$/g,"")}function E(ae){const _e=this.resume(),W=this.stack[this.stack.length-1];W.label=_e,W.identifier=Qr(this.sliceSerialize(ae)).toLowerCase()}function N(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ae}function D(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ae}function O(ae){const _e=this.stack[this.stack.length-1];if(!_e.depth){const W=this.sliceSerialize(ae).length;_e.depth=W}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function G(ae){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(ae){const W=this.stack[this.stack.length-1].children;let pe=W[W.length-1];(!pe||pe.type!=="text")&&(pe=Ee(),pe.position={start:js(ae.start),end:void 0},W.push(pe)),this.stack.push(pe)}function B(ae){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ae),_e.position.end=js(ae.end)}function I(ae){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=_e.children[_e.children.length-1];W.position.end=js(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(Q.call(this,ae),B.call(this,ae))}function M(){this.data.atHardBreak=!0}function le(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function J(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function Y(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function $(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=_e,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function F(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=_e,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function V(ae){const _e=this.sliceSerialize(ae),W=this.stack[this.stack.length-2];W.label=mA(_e),W.identifier=Qr(_e).toLowerCase()}function ge(){const ae=this.stack[this.stack.length-1],_e=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const pe=ae.children;W.children=pe}else W.alt=_e}function R(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ae}function z(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ae}function Z(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ue(ae){const _e=this.resume(),W=this.stack[this.stack.length-1];W.label=_e,W.identifier=Qr(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function xe(ae){this.data.characterReferenceType=ae.type}function je(ae){const _e=this.sliceSerialize(ae),W=this.data.characterReferenceType;let pe;W?(pe=L2(_e,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=yx(_e);const Me=this.stack[this.stack.length-1];Me.value+=pe}function Re(ae){const _e=this.stack.pop();_e.position.end=js(ae.end)}function Le(ae){B.call(this,ae);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ae)}function Be(ae){B.call(this,ae);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ae)}function Je(){return{type:"blockquote",children:[]}}function it(){return{type:"code",lang:null,meta:null,value:""}}function ht(){return{type:"inlineCode",value:""}}function Jt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pt(){return{type:"emphasis",children:[]}}function _t(){return{type:"heading",depth:0,children:[]}}function Nt(){return{type:"break"}}function ve(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function ct(){return{type:"link",title:null,url:"",children:[]}}function xn(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function Ne(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function Ee(){return{type:"text",value:""}}function $r(){return{type:"thematicBreak"}}}function js(e){return{line:e.line,column:e.column,offset:e.offset}}function q2(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?q2(e,i):bA(e,i)}}function bA(e,t){let n;for(n in t)if(H2.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function N_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hc({start:t.start,end:t.end})+") is still open")}function yA(e){const t=this;t.parser=n;function n(i){return xA(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _A(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function wA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
74
+ `}]}function SA(e,t){const n=t.value?t.value+`
75
+ `:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function kA(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jA(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function NA(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Pl(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let u,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=o+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const p={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,p),e.applyData(t,p)}function CA(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EA(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function V2(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function TA(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return V2(e,t);const a={src:Pl(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function AA(e,t){const n={src:Pl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function MA(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function RA(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return V2(e,t);const a={href:Pl(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function LA(e,t){const n={href:Pl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function DA(e,t,n){const i=e.all(t),a=n?zA(n):G2(t),o={},u=[];if(typeof t.checked=="boolean"){const g=i[0];let x;g&&g.type==="element"&&g.tagName==="p"?x=g:(x={type:"element",tagName:"p",properties:{},children:[]},i.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(a||f!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
76
+ `}),g.type==="element"&&g.tagName==="p"&&!a?u.push(...g.children):u.push(g)}const h=i[i.length-1];h&&(a||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
77
+ `});const p={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,p),e.applyData(t,p)}function zA(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=G2(n[i])}return t}function G2(e){const t=e.spread;return t??e.children.length>1}function OA(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const u=i[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function BA(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PA(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function $A(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FA(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=mx(t.children[1]),h=j2(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function UA(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,f=u?u.length:t.children.length;let h=-1;const p=[];for(;++h<f;){const x=t.children[h],b={},y=u?u[h]:void 0;y&&(b.align=y);let _={type:"element",tagName:o,properties:b,children:[]};x&&(_.children=e.all(x),e.patch(x,_),_=e.applyData(x,_)),p.push(_)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,g),e.applyData(t,g)}function IA(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const C_=9,E_=32;function HA(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const o=[];for(;i;)o.push(T_(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return o.push(T_(t.slice(a),a>0,!1)),o.join("")}function T_(e,t,n){let i=0,a=e.length;if(t){let o=e.codePointAt(i);for(;o===C_||o===E_;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(a-1);for(;o===C_||o===E_;)a--,o=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function qA(e,t){const n={type:"text",value:HA(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function VA(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const GA={blockquote:_A,break:wA,code:SA,delete:kA,emphasis:jA,footnoteReference:NA,heading:CA,html:EA,imageReference:TA,image:AA,inlineCode:MA,linkReference:RA,link:LA,listItem:DA,list:OA,paragraph:BA,root:PA,strong:$A,table:FA,tableCell:IA,tableRow:UA,text:qA,thematicBreak:VA,toml:gd,yaml:gd,definition:gd,footnoteDefinition:gd};function gd(){}const Y2=-1,wf=0,mc=1,cf=2,wx=3,Sx=4,kx=5,jx=6,W2=7,Q2=8,X2=typeof self=="object"?self:globalThis,A_=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new X2[e](t)},YA=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),i=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case wf:case Y2:return n(u,a);case mc:{const f=n([],a);for(const h of u)f.push(i(h));return f}case cf:{const f=n({},a);for(const[h,p]of u)f[i(h)]=i(p);return f}case wx:return n(new Date(u),a);case Sx:{const{source:f,flags:h}=u;return n(new RegExp(f,h),a)}case kx:{const f=n(new Map,a);for(const[h,p]of u)f.set(i(h),i(p));return f}case jx:{const f=n(new Set,a);for(const h of u)f.add(i(h));return f}case W2:{const{name:f,message:h}=u;return n(typeof X2[f]=="function"?A_(f,h):new Error(h),a)}case Q2:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return n(new DataView(f),u)}}return n(A_(o,u),a)};return i},M_=e=>YA(new Map,e)(0),ma="",{toString:WA}={},{keys:QA}=Object,Xo=e=>{const t=typeof e;if(t!=="object"||!e)return[wf,t];const n=WA.call(e).slice(8,-1);switch(n){case"Array":return[mc,ma];case"Object":return[cf,ma];case"Date":return[wx,ma];case"RegExp":return[Sx,ma];case"Map":return[kx,ma];case"Set":return[jx,ma];case"DataView":return[mc,n]}return n.includes("Array")?[mc,n]:e instanceof Error?[W2,e.name||"Error"]:[cf,n]},xd=([e,t])=>e===wf&&(t==="function"||t==="symbol"),XA=(e,t,n,i)=>{const a=(u,f)=>{const h=i.push(u)-1;return n.set(f,h),h},o=u=>{if(n.has(u))return n.get(u);let[f,h]=Xo(u);switch(f){case wf:{let g=u;switch(h){case"bigint":f=Q2,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return a([Y2],u)}return a([f,g],u)}case mc:{if(h){let b=u;return h==="DataView"?b=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(u)),a([h,[...b]],u)}const g=[],x=a([f,g],u);for(const b of u)g.push(o(b));return x}case cf:{if(h)switch(h){case"BigInt":return a([h,u.toString()],u);case"Boolean":case"Number":case"String":return a([h,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const g=[],x=a([f,g],u);for(const b of QA(u))(e||!xd(Xo(u[b])))&&g.push([o(b),o(u[b])]);return x}case wx:return a([f,isNaN(u.getTime())?ma:u.toISOString()],u);case Sx:{const{source:g,flags:x}=u;return a([f,{source:g,flags:x}],u)}case kx:{const g=[],x=a([f,g],u);for(const[b,y]of u)(e||!(xd(Xo(b))||xd(Xo(y))))&&g.push([o(b),o(y)]);return x}case jx:{const g=[],x=a([f,g],u);for(const b of u)(e||!xd(Xo(b)))&&g.push(o(b));return x}}const{message:p}=u;return a([f,{name:h,message:p}],u)};return o},R_=(e,{json:t,lossy:n}={})=>{const i=[];return XA(!(t||n),!!t,new Map,i)(e),i},uf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?M_(R_(e,t)):structuredClone(e):(e,t)=>M_(R_(e,t));function KA(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function ZA(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function JA(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||KA,i=e.options.footnoteBackLabel||ZA,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let h=-1;for(;++h<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[h]);if(!p)continue;const g=e.all(p),x=String(p.identifier).toUpperCase(),b=Pl(x.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let E=typeof n=="string"?n:n(h,y);typeof E=="string"&&(E={type:"text",value:E}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(h,y),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const E=C.children[C.children.length-1];E&&E.type==="text"?E.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(..._)}else g.push(..._);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(p,k),f.push(k)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...uf(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
78
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
79
+ `}]}}const Sf=(function(e){if(e==null)return rM;if(typeof e=="function")return kf(e);if(typeof e=="object")return Array.isArray(e)?eM(e):tM(e);if(typeof e=="string")return nM(e);throw new Error("Expected function, string, or object as test")});function eM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Sf(e[n]);return kf(i);function i(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function tM(e){const t=e;return kf(n);function n(i){const a=i;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function nM(e){return kf(t);function t(n){return n&&n.type===e}}function kf(e){return t;function t(n,i,a){return!!(iM(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function rM(){return!0}function iM(e){return e!==null&&typeof e=="object"&&"type"in e}const K2=[],sM=!0,Dg=!1,aM="skip";function Z2(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const o=Sf(a),u=i?-1:1;f(e,void 0,[])();function f(h,p,g){const x=h&&typeof h=="object"?h:{};if(typeof x.type=="string"){const y=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=K2,_,j,C;if((!t||o(h,p,g[g.length-1]||void 0))&&(y=lM(n(h,g)),y[0]===Dg))return y;if("children"in h&&h.children){const k=h;if(k.children&&y[0]!==aM)for(j=(i?k.children.length:-1)+u,C=g.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(_=f(E,j,C)(),_[0]===Dg)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function lM(e){return Array.isArray(e)?e:typeof e=="number"?[sM,e]:e==null?K2:[e]}function Nx(e,t,n,i){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=i),Z2(e,o,f,a);function f(h,p){const g=p[p.length-1],x=g?g.children.indexOf(h):void 0;return u(h,x,g)}}const zg={}.hasOwnProperty,oM={};function cM(e,t){const n=t||oM,i=new Map,a=new Map,o=new Map,u={...GA,...n.handlers},f={all:p,applyData:dM,definitionById:i,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:h,options:n,patch:uM,wrap:hM};return Nx(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const x=g.type==="definition"?i:a,b=String(g.identifier).toUpperCase();x.has(b)||x.set(b,g)}}),f;function h(g,x){const b=g.type,y=f.handlers[b];if(zg.call(f.handlers,b)&&y)return y(f,g,x);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:j,...C}=g,k=uf(C);return k.children=f.all(g),k}return uf(g)}return(f.options.unknownHandler||fM)(f,g,x)}function p(g){const x=[];if("children"in g){const b=g.children;let y=-1;for(;++y<b.length;){const _=f.one(b[y],g);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=L_(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=L_(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function uM(e,t){e.position&&(t.position=ZE(e))}function dM(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,uf(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function fM(e,t){const n=t.data||{},i="value"in t&&!(zg.call(n,"hProperties")||zg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function hM(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
80
+ `});++i<e.length;)i&&n.push({type:"text",value:`
81
+ `}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
82
+ `}),n}function L_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function D_(e,t){const n=cM(e,t),i=n.one(e,void 0),a=JA(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
83
+ `},a),o}function pM(e,t){return e&&"run"in e?async function(n,i){const a=D_(n,{file:i,...t});await e.run(a,i)}:function(n,i){return D_(n,{file:i,...e||t})}}function z_(e){if(e)throw e}var vm,O_;function mM(){if(O_)return vm;O_=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},o=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),x=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!x)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},u=function(p,g){n&&g.name==="__proto__"?n(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},f=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return vm=function h(){var p,g,x,b,y,_,j=arguments[0],C=1,k=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<k;++C)if(p=arguments[C],p!=null)for(g in p)x=f(j,g),b=f(p,g),j!==b&&(E&&b&&(o(b)||(y=a(b)))?(y?(y=!1,_=x&&a(x)?x:[]):_=x&&o(x)?x:{},u(j,{name:g,newValue:h(E,_,b)})):typeof b<"u"&&u(j,{name:g,newValue:b}));return j},vm}var gM=mM();const bm=Hg(gM);function Og(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function xM(){const e=[],t={run:n,use:i};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...a);function f(h,...p){const g=e[++o];let x=-1;if(h){u(h);return}for(;++x<a.length;)(p[x]===null||p[x]===void 0)&&(p[x]=a[x]);a=p,g?vM(g,f)(...p):u(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function vM(e,t){let n;return i;function i(...u){const f=e.length>u.length;let h;f&&u.push(a);try{h=e.apply(this,u)}catch(p){const g=p;if(f&&n)throw g;return a(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(o,a):h instanceof Error?a(h):o(h))}function a(u,...f){n||(n=!0,t(u,...f))}function o(u){a(null,u)}}const ci={basename:bM,dirname:yM,extname:_M,join:wM,sep:"/"};function bM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Oc(e);let n=0,i=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else i<0&&(o=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(i=a):(f=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function yM(e){if(Oc(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function _M(e){Oc(e);let t=e.length,n=-1,i=0,a=-1,o=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function wM(...e){let t=-1,n;for(;++t<e.length;)Oc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":SM(n)}function SM(e){Oc(e);const t=e.codePointAt(0)===47;let n=kM(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function kM(e,t){let n="",i=0,a=-1,o=0,u=-1,f,h;for(;++u<=e.length;){if(u<e.length)f=e.codePointAt(u);else{if(f===47)break;f=47}if(f===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",i=0):(n=n.slice(0,h),i=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",i=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),i=u-a-1;a=u,o=0}else f===46&&o>-1?o++:o=-1}return n}function Oc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jM={cwd:NM};function NM(){return"/"}function Bg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function CM(e){if(typeof e=="string")e=new URL(e);else if(!Bg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return EM(e)}function EM(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const ym=["history","path","basename","stem","extname","dirname"];class J2{constructor(t){let n;t?Bg(t)?n={path:t}:typeof t=="string"||TM(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":jM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<ym.length;){const o=ym[i];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)ym.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ci.basename(this.path):void 0}set basename(t){wm(t,"basename"),_m(t,"basename"),this.path=ci.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ci.dirname(this.path):void 0}set dirname(t){B_(this.basename,"dirname"),this.path=ci.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ci.extname(this.path):void 0}set extname(t){if(_m(t,"extname"),B_(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ci.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bg(t)&&(t=CM(t)),wm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ci.basename(this.path,this.extname):void 0}set stem(t){wm(t,"stem"),_m(t,"stem"),this.path=ci.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new Dn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _m(e,t){if(e&&e.includes(ci.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ci.sep+"`")}function wm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function B_(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function TM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const AM=(function(e){const i=this.constructor.prototype,a=i[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,i),o}),MM={}.hasOwnProperty;class Cx extends AM{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=xM()}copy(){const t=new Cx;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(bm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jm("data",this.frozen),this.namespace[t]=n,this):MM.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=vd(t),i=this.parser||this.Parser;return Sm("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Sm("process",this.parser||this.Parser),km("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const f=vd(t),h=i.parse(f);i.run(h,f,function(g,x,b){if(g||!x||!b)return p(g);const y=x,_=i.stringify(y,b);DM(_)?b.value=_:b.result=_,p(g,b)});function p(g,x){g||!x?u(g):o?o(x):n(void 0,x)}}}processSync(t){let n=!1,i;return this.freeze(),Sm("processSync",this.parser||this.Parser),km("processSync",this.compiler||this.Compiler),this.process(t,a),$_("processSync","process",n),i;function a(o,u){n=!0,z_(o),i=u}}run(t,n,i){P_(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?o(void 0,i):new Promise(o);function o(u,f){const h=vd(n);a.run(t,h,p);function p(g,x,b){const y=x||t;g?f(g):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,o),$_("runSync","run",i),a;function o(u,f){z_(u),a=f,i=!0}}stringify(t,n){this.freeze();const i=vd(n),a=this.compiler||this.Compiler;return km("stringify",a),P_(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(jm("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...x]=p;h(g,x)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(p.plugins),p.settings&&(a.settings=bm(!0,a.settings,p.settings))}function f(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const x=p[g];o(x)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,g){let x=-1,b=-1;for(;++x<i.length;)if(i[x][0]===p){b=x;break}if(b===-1)i.push([p,...g]);else if(g.length>0){let[y,..._]=g;const j=i[b][1];Og(j)&&Og(y)&&(y=bm(!0,j,y)),i[b]=[p,y,..._]}}}}const RM=new Cx().freeze();function Sm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function km(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function P_(e){if(!Og(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $_(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vd(e){return LM(e)?e:new J2(e)}function LM(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function DM(e){return typeof e=="string"||zM(e)}function zM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",F_=[],U_={allowDangerousHtml:!0},BM=/^(https?|ircs?|mailto|xmpp)$/i,PM=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ex(e){const t=$M(e),n=FM(e);return UM(t.runSync(t.parse(n),n),e)}function $M(e){const t=e.rehypePlugins||F_,n=e.remarkPlugins||F_,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...U_}:U_;return RM().use(yA).use(n).use(pM,i).use(t)}function FM(e){const t=e.children||"",n=new J2;return typeof t=="string"&&(n.value=t),n}function UM(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||IM;for(const g of PM)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+OM+g.id,void 0);return Nx(e,p),r6(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function p(g,x,b){if(g.type==="raw"&&b&&typeof x=="number")return u?b.children.splice(x,1):b.children[x]={type:"text",value:g.value},x;if(g.type==="element"){let y;for(y in mm)if(Object.hasOwn(mm,y)&&Object.hasOwn(g.properties,y)){const _=g.properties[y],j=mm[y];(j===null||j.includes(g.tagName))&&(g.properties[y]=h(String(_||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&i&&typeof x=="number"&&(y=!i(g,x,b)),y&&b&&typeof x=="number")return f&&g.children?b.children.splice(x,1,...g.children):b.children.splice(x,1),x}}}function IM(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||BM.test(e.slice(0,t))?e:""}function I_(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function HM(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function qM(e,t,n){const a=Sf((n||{}).ignore||[]),o=VM(t);let u=-1;for(;++u<o.length;)Z2(e,"text",f);function f(p,g){let x=-1,b;for(;++x<g.length;){const y=g[x],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return h(p,g)}function h(p,g){const x=g[g.length-1],b=o[u][0],y=o[u][1];let _=0;const C=x.children.indexOf(p);let k=!1,E=[];b.lastIndex=0;let N=b.exec(p.value);for(;N;){const D=N.index,O={index:N.index,input:N.input,stack:[...g,p]};let L=y(...N,O);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?b.lastIndex=D+1:(_!==D&&E.push({type:"text",value:p.value.slice(_,D)}),Array.isArray(L)?E.push(...L):L&&E.push(L),_=D+N[0].length,k=!0),!b.global)break;N=b.exec(p.value)}return k?(_<p.value.length&&E.push({type:"text",value:p.value.slice(_)}),x.children.splice(C,1,...E)):E=[p],C+E.length}}function VM(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([GM(a[0]),YM(a[1])])}return t}function GM(e){return typeof e=="string"?new RegExp(HM(e),"g"):e}function YM(e){return typeof e=="function"?e:function(){return e}}const Nm="phrasing",Cm=["autolink","link","image","label"];function WM(){return{transforms:[t8],enter:{literalAutolink:XM,literalAutolinkEmail:Em,literalAutolinkHttp:Em,literalAutolinkWww:Em},exit:{literalAutolink:e8,literalAutolinkEmail:JM,literalAutolinkHttp:KM,literalAutolinkWww:ZM}}}function QM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Nm,notInConstruct:Cm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Nm,notInConstruct:Cm},{character:":",before:"[ps]",after:"\\/",inConstruct:Nm,notInConstruct:Cm}]}}function XM(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Em(e){this.config.enter.autolinkProtocol.call(this,e)}function KM(e){this.config.exit.autolinkProtocol.call(this,e)}function ZM(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function JM(e){this.config.exit.autolinkEmail.call(this,e)}function e8(e){this.exit(e)}function t8(e){qM(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,n8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),r8]],{ignore:["link","linkReference"]})}function n8(e,t,n,i,a){let o="";if(!eS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!i8(n)))return!1;const u=s8(n+i);if(!u[0])return!1;const f={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function r8(e,t,n,i){return!eS(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function i8(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function s8(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=I_(e,"(");let o=I_(e,")");for(;i!==-1&&a>o;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),o++;return[e,n]}function eS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||wa(n)||yf(n))&&(!t||n!==47)}tS.peek=p8;function a8(){this.buffer()}function l8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function o8(){this.buffer()}function c8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function u8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function d8(e){this.exit(e)}function f8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function h8(e){this.exit(e)}function p8(){return"["}function tS(e,t,n,i){const a=n.createTracker(i);let o=a.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),u(),o+=a.move("]"),o}function m8(){return{enter:{gfmFootnoteCallString:a8,gfmFootnoteCall:l8,gfmFootnoteDefinitionLabelString:o8,gfmFootnoteDefinition:c8},exit:{gfmFootnoteCallString:u8,gfmFootnoteCall:d8,gfmFootnoteDefinitionLabelString:f8,gfmFootnoteDefinition:h8}}}function g8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:tS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,o,u){const f=o.createTracker(u);let h=f.move("[^");const p=o.enter("footnoteDefinition"),g=o.enter("label");return h+=f.move(o.safe(o.associationId(i),{before:h,after:"]"})),g(),h+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),h+=f.move((t?`
84
+ `:" ")+o.indentLines(o.containerFlow(i,f.current()),t?nS:x8))),p(),h}}function x8(e,t,n){return t===0?e:nS(e,t,n)}function nS(e,t,n){return(n?"":" ")+e}const v8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];rS.peek=S8;function b8(){return{canContainEols:["delete"],enter:{strikethrough:_8},exit:{strikethrough:w8}}}function y8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:v8}],handlers:{delete:rS}}}function _8(e){this.enter({type:"delete",children:[]},e)}function w8(e){this.exit(e)}function rS(e,t,n,i){const a=n.createTracker(i),o=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),o(),u}function S8(){return"~"}function k8(e){return e.length}function j8(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||k8,o=[],u=[],f=[],h=[];let p=0,g=-1;for(;++g<e.length;){const j=[],C=[];let k=-1;for(e[g].length>p&&(p=e[g].length);++k<e[g].length;){const E=N8(e[g][k]);if(n.alignDelimiters!==!1){const N=a(E);C[k]=N,(h[k]===void 0||N>h[k])&&(h[k]=N)}j.push(E)}u[g]=j,f[g]=C}let x=-1;if(typeof i=="object"&&"length"in i)for(;++x<p;)o[x]=H_(i[x]);else{const j=H_(i);for(;++x<p;)o[x]=j}x=-1;const b=[],y=[];for(;++x<p;){const j=o[x];let C="",k="";j===99?(C=":",k=":"):j===108?C=":":j===114&&(k=":");let E=n.alignDelimiters===!1?1:Math.max(1,h[x]-C.length-k.length);const N=C+"-".repeat(E)+k;n.alignDelimiters!==!1&&(E=C.length+E+k.length,E>h[x]&&(h[x]=E),y[x]=E),b[x]=N}u.splice(1,0,b),f.splice(1,0,y),g=-1;const _=[];for(;++g<u.length;){const j=u[g],C=f[g];x=-1;const k=[];for(;++x<p;){const E=j[x]||"";let N="",D="";if(n.alignDelimiters!==!1){const O=h[x]-(C[x]||0),L=o[x];L===114?N=" ".repeat(O):L===99?O%2?(N=" ".repeat(O/2+.5),D=" ".repeat(O/2-.5)):(N=" ".repeat(O/2),D=N):D=" ".repeat(O)}n.delimiterStart!==!1&&!x&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||x)&&k.push(" "),n.alignDelimiters!==!1&&k.push(N),k.push(E),n.alignDelimiters!==!1&&k.push(D),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||x!==p-1)&&k.push("|")}_.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return _.join(`
85
+ `)}function N8(e){return e==null?"":String(e)}function H_(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function C8(e,t,n,i){const a=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),E8);return a(),u}function E8(e,t,n){return">"+(n?"":" ")+e}function T8(e,t){return q_(e,t.inConstruct,!0)&&!q_(e,t.notInConstruct,!1)}function q_(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function V_(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
86
+ `&&T8(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
87
+ `}function A8(e,t){const n=String(e);let i=n.indexOf(t),a=i,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++o>u&&(u=o):o=1,a=i+t.length,i=n.indexOf(t,a);return u}function M8(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function R8(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function L8(e,t,n,i){const a=R8(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(M8(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(o,D8);return x(),b}const f=n.createTracker(i),h=a.repeat(Math.max(A8(o,a)+1,3)),p=n.enter("codeFenced");let g=f.move(h);if(e.lang){const x=n.enter(`codeFencedLang${u}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
88
+ `,encode:["`"],...f.current()})),x()}return g+=f.move(`
89
+ `),o&&(g+=f.move(o+`
90
+ `)),g+=f.move(h),p(),g}function D8(e,t,n){return(n?"":" ")+e}function Tx(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function z8(e,t,n,i){const a=Tx(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(i);let p=h.move("[");return p+=h.move(n.safe(n.associationId(e),{before:p,after:"]",...h.current()})),p+=h.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":`
91
+ `,...h.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=h.move(" "+a),p+=h.move(n.safe(e.title,{before:p,after:a,...h.current()})),p+=h.move(a),f()),u(),p}function O8(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ac(e){return"&#x"+e.toString(16).toUpperCase()+";"}function df(e,t,n){const i=Ll(e),a=Ll(t);return i===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}iS.peek=B8;function iS(e,t,n,i){const a=O8(n),o=n.enter("emphasis"),u=n.createTracker(i),f=u.move(a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const p=h.charCodeAt(0),g=df(i.before.charCodeAt(i.before.length-1),p,a);g.inside&&(h=Ac(p)+h.slice(1));const x=h.charCodeAt(h.length-1),b=df(i.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+Ac(x));const y=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+h+y}function B8(e,t,n){return n.options.emphasis||"*"}function P8(e,t){let n=!1;return Nx(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,Dg}),!!((!e.depth||e.depth<3)&&bx(e)&&(t.options.setext||n))}function $8(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(P8(e,n)){const g=n.enter("headingSetext"),x=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
92
+ `,after:`
93
+ `});return x(),g(),b+`
94
+ `+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
95
+ `))+1))}const u="#".repeat(a),f=n.enter("headingAtx"),h=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
96
+ `,...o.current()});return/^[\t ]/.test(p)&&(p=Ac(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),h(),f(),p}sS.peek=F8;function sS(e){return e.value||""}function F8(){return"<"}aS.peek=U8;function aS(e,t,n,i){const a=Tx(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(i);let p=h.move("![");return p+=h.move(n.safe(e.alt,{before:p,after:"]",...h.current()})),p+=h.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":")",...h.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=h.move(" "+a),p+=h.move(n.safe(e.title,{before:p,after:a,...h.current()})),p+=h.move(a),f()),p+=h.move(")"),u(),p}function U8(){return"!"}lS.peek=I8;function lS(e,t,n,i){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("![");const p=n.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,o(),a==="full"||!p||p!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function I8(){return"!"}oS.peek=H8;function oS(e,t,n){let i=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const u=n.unsafe[o],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(i);){let p=h.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(h.index+1)}}return a+i+a}function H8(){return"`"}function cS(e,t){const n=bx(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}uS.peek=q8;function uS(e,t,n,i){const a=Tx(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let f,h;if(cS(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),f(),n.stack=g,x}f=n.enter("link"),h=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(h=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),h()),p+=u.move(")"),f(),p}function q8(e,t,n){return cS(e,n)?"<":"["}dS.peek=V8;function dS(e,t,n,i){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("[");const p=n.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,o(),a==="full"||!p||p!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function V8(){return"["}function Ax(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function G8(e){const t=Ax(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Y8(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function fS(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function W8(e,t,n,i){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?Y8(n):Ax(n);const f=e.ordered?u==="."?")":".":G8(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),fS(n)===u&&g){let x=-1;for(;++x<e.children.length;){const b=e.children[x];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const p=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function Q8(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function X8(e,t,n,i){const a=Q8(n);let o=n.bulletCurrent||Ax(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(i);f.move(o+" ".repeat(u-o.length)),f.shift(u);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,f.current()),g);return h(),p;function g(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?o:o+" ".repeat(u-o.length))+x}}function K8(e,t,n,i){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),a(),u}const Z8=Sf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function J8(e,t,n,i){return(e.children.some(function(u){return Z8(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function e7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}hS.peek=t7;function hS(e,t,n,i){const a=e7(n),o=n.enter("strong"),u=n.createTracker(i),f=u.move(a+a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const p=h.charCodeAt(0),g=df(i.before.charCodeAt(i.before.length-1),p,a);g.inside&&(h=Ac(p)+h.slice(1));const x=h.charCodeAt(h.length-1),b=df(i.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+Ac(x));const y=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+h+y}function t7(e,t,n){return n.options.strong||"*"}function n7(e,t,n,i){return n.safe(e.value,i)}function r7(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function i7(e,t,n){const i=(fS(n)+(n.options.ruleSpaces?" ":"")).repeat(r7(n));return n.options.ruleSpaces?i.slice(0,-1):i}const pS={blockquote:C8,break:V_,code:L8,definition:z8,emphasis:iS,hardBreak:V_,heading:$8,html:sS,image:aS,imageReference:lS,inlineCode:oS,link:uS,linkReference:dS,list:W8,listItem:X8,paragraph:K8,root:J8,strong:hS,text:n7,thematicBreak:i7};function s7(){return{enter:{table:a7,tableData:G_,tableHeader:G_,tableRow:o7},exit:{codeText:c7,table:l7,tableData:Tm,tableHeader:Tm,tableRow:Tm}}}function a7(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function l7(e){this.exit(e),this.data.inTable=void 0}function o7(e){this.enter({type:"tableRow",children:[]},e)}function Tm(e){this.exit(e)}function G_(e){this.enter({type:"tableCell",children:[]},e)}function c7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,u7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function u7(e,t){return t==="|"?t:e}function d7(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
97
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:u,tableCell:h,tableRow:f}};function u(y,_,j,C){return p(g(y,j,C),y.align)}function f(y,_,j,C){const k=x(y,j,C),E=p([k]);return E.slice(0,E.indexOf(`
98
+ `))}function h(y,_,j,C){const k=j.enter("tableCell"),E=j.enter("phrasing"),N=j.containerPhrasing(y,{...C,before:o,after:o});return E(),k(),N}function p(y,_){return j8(y,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function g(y,_,j){const C=y.children;let k=-1;const E=[],N=_.enter("table");for(;++k<C.length;)E[k]=x(C[k],_,j);return N(),E}function x(y,_,j){const C=y.children;let k=-1;const E=[],N=_.enter("tableRow");for(;++k<C.length;)E[k]=h(C[k],y,_,j);return N(),E}function b(y,_,j){let C=pS.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function f7(){return{exit:{taskListCheckValueChecked:Y_,taskListCheckValueUnchecked:Y_,paragraph:p7}}}function h7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:m7}}}function Y_(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function p7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){u=f;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function m7(e,t,n,i){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(i);o&&f.move(u);let h=pS.listItem(e,t,n,{...i,...f.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(g){return g+u}}function g7(){return[WM(),m8(),b8(),s7(),f7()]}function x7(e){return{extensions:[QM(),g8(e),y8(),d7(e),h7()]}}const v7={tokenize:k7,partial:!0},mS={tokenize:j7,partial:!0},gS={tokenize:N7,partial:!0},xS={tokenize:C7,partial:!0},b7={tokenize:E7,partial:!0},vS={name:"wwwAutolink",tokenize:w7,previous:yS},bS={name:"protocolAutolink",tokenize:S7,previous:_S},Gi={name:"emailAutolink",tokenize:_7,previous:wS},hi={};function y7(){return{text:hi}}let ua=48;for(;ua<123;)hi[ua]=Gi,ua++,ua===58?ua=65:ua===91&&(ua=97);hi[43]=Gi;hi[45]=Gi;hi[46]=Gi;hi[95]=Gi;hi[72]=[Gi,bS];hi[104]=[Gi,bS];hi[87]=[Gi,vS];hi[119]=[Gi,vS];function _7(e,t,n){const i=this;let a,o;return u;function u(x){return!Pg(x)||!wS.call(i,i.previous)||Mx(i.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(x))}function f(x){return Pg(x)?(e.consume(x),f):x===64?(e.consume(x),h):n(x)}function h(x){return x===46?e.check(b7,g,p)(x):x===45||x===95||Ln(x)?(o=!0,e.consume(x),h):g(x)}function p(x){return e.consume(x),a=!0,h}function g(x){return o&&a&&Un(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function w7(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!yS.call(i,i.previous)||Mx(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(v7,e.attempt(mS,e.attempt(gS,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function S7(e,t,n){const i=this;let a="",o=!1;return u;function u(x){return(x===72||x===104)&&_S.call(i,i.previous)&&!Mx(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),f):n(x)}function f(x){if(Un(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),f;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),h}return n(x)}function h(x){return x===47?(e.consume(x),o?p:(o=!0,h)):n(x)}function p(x){return x===null||of(x)||Pt(x)||wa(x)||yf(x)?n(x):e.attempt(mS,e.attempt(gS,g),n)(x)}function g(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function k7(e,t,n){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function j7(e,t,n){let i,a,o;return u;function u(p){return p===46||p===95?e.check(xS,h,f)(p):p===null||Pt(p)||wa(p)||p!==45&&yf(p)?h(p):(o=!0,e.consume(p),u)}function f(p){return p===95?i=!0:(a=i,i=void 0),e.consume(p),u}function h(p){return a||i||!o?n(p):t(p)}}function N7(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(xS,t,o)(u):u===null||Pt(u)||wa(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&i++,e.consume(u),a}}function C7(e,t,n){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||Pt(f)||wa(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Pt(f)||wa(f)?t(f):i(f)}function o(f){return Un(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),i):Un(f)?(e.consume(f),u):n(f)}}function E7(e,t,n){return i;function i(o){return e.consume(o),a}function a(o){return Ln(o)?n(o):t(o)}}function yS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function _S(e){return!Un(e)}function wS(e){return!(e===47||Pg(e))}function Pg(e){return e===43||e===45||e===46||e===95||Ln(e)}function Mx(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const T7={tokenize:B7,partial:!0};function A7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:D7,continuation:{tokenize:z7},exit:O7}},text:{91:{name:"gfmFootnoteCall",tokenize:L7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:M7,resolveTo:R7}}}}function M7(e,t,n){const i=this;let a=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const h=i.events[a][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return f;function f(h){if(!u||!u._balanced)return n(h);const p=Qr(i.sliceSerialize({start:u.end,end:i.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function R7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...f),e}function L7(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,u;return f;function f(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),h}function h(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(x){if(o>999||x===93&&!u||x===null||x===91||Pt(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(Qr(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return Pt(x)||(u=!0),o++,e.consume(x),x===92?g:p}function g(x){return x===91||x===92||x===93?(e.consume(x),o++,p):p(x)}}function D7(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,u=0,f;return h;function h(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(_)}function g(_){if(u>999||_===93&&!f||_===null||_===91||Pt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=Qr(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Pt(_)||(f=!0),u++,e.consume(_),_===92?x:g}function x(_){return _===91||_===92||_===93?(e.consume(_),u++,g):g(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(o)||a.push(o),xt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function z7(e,t,n){return e.check(zc,t,e.attempt(T7,t,n))}function O7(e){e.exit("gfmFootnoteDefinition")}function B7(e,t,n){const i=this;return xt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function P7(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,f){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let p=h;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[h][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[h][1].end)},x={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[h][1].start)},b=[["enter",g,f],["enter",u[p][1],f],["exit",u[p][1],f],["enter",x,f]],y=f.parser.constructs.insideSpan.null;y&&xr(b,b.length,0,_f(y,u.slice(p+1,h),f)),xr(b,b.length,0,[["exit",x,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",g,f]]),xr(u,p-1,h-p+3,b),h=p+b.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function o(u,f,h){const p=this.previous,g=this.events;let x=0;return b;function b(_){return p===126&&g[g.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=Ll(p);if(_===126)return x>1?h(_):(u.consume(_),x++,y);if(x<2&&!n)return h(_);const C=u.exit("strikethroughSequenceTemporary"),k=Ll(_);return C._open=!k||k===2&&!!j,C._close=!j||j===2&&!!k,f(_)}}}class $7{constructor(){this.map=[]}add(t,n,i){F7(this,t,n,i)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0}}function F7(e,t,n,i){let a=0;if(!(n===0&&i.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...i);return}a+=1}e.map.push([t,n,i])}}function U7(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=i.length-1;i[o]=i[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function I7(){return{flow:{null:{name:"table",tokenize:H7,resolveAll:q7}}}}function H7(e,t,n){const i=this;let a=0,o=0,u;return f;function f(B){let I=i.events.length-1;for(;I>-1;){const J=i.events[I][1].type;if(J==="lineEnding"||J==="linePrefix")I--;else break}const M=I>-1?i.events[I][1].type:null,le=M==="tableHead"||M==="tableRow"?L:h;return le===L&&i.parser.lazy[i.now().line]?n(B):le(B)}function h(B){return e.enter("tableHead"),e.enter("tableRow"),p(B)}function p(B){return B===124||(u=!0,o+=1),g(B)}function g(B){return B===null?n(B):$e(B)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),y):n(B):ot(B)?xt(e,g,"whitespace")(B):(o+=1,u&&(u=!1,a+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),x(B)))}function x(B){return B===null||B===124||Pt(B)?(e.exit("data"),g(B)):(e.consume(B),B===92?b:x)}function b(B){return B===92||B===124?(e.consume(B),x):x(B)}function y(B){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(B):(e.enter("tableDelimiterRow"),u=!1,ot(B)?xt(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):_(B))}function _(B){return B===45||B===58?C(B):B===124?(u=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),j):O(B)}function j(B){return ot(B)?xt(e,C,"whitespace")(B):C(B)}function C(B){return B===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),k):B===45?(o+=1,k(B)):B===null||$e(B)?D(B):O(B)}function k(B){return B===45?(e.enter("tableDelimiterFiller"),E(B)):O(B)}function E(B){return B===45?(e.consume(B),E):B===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(B))}function N(B){return ot(B)?xt(e,D,"whitespace")(B):D(B)}function D(B){return B===124?_(B):B===null||$e(B)?!u||a!==o?O(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):O(B)}function O(B){return n(B)}function L(B){return e.enter("tableRow"),G(B)}function G(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),G):B===null||$e(B)?(e.exit("tableRow"),t(B)):ot(B)?xt(e,G,"whitespace")(B):(e.enter("data"),P(B))}function P(B){return B===null||B===124||Pt(B)?(e.exit("data"),G(B)):(e.consume(B),B===92?Q:P)}function Q(B){return B===92||B===124?(e.consume(B),P):P(B)}}function q7(e,t){let n=-1,i=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,p,g,x;const b=new $7;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(W_(b,t,h,p,g),g=void 0,h=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,x=void 0,o=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",g,t]])),a=_.type==="tableDelimiterRow"?2:g?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],x=bd(b,t,o,a,void 0,x),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(o[1]!==0&&(u[0]=u[1],x=bd(b,t,o,a,void 0,x)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,o[1]!==0?(u[0]=u[1],x=bd(b,t,o,a,n,x)):u[1]!==0&&(x=bd(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&W_(b,t,h,p,g),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=U7(t.events,n))}return e}function bd(e,t,n,i,a,o){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},_l(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=_l(t.events,n[1]);if(o={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=_l(t.events,n[2]),g=_l(t.events,n[3]),x={type:f,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",x,t]]),i!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return a!==void 0&&(o.end=Object.assign({},_l(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function W_(e,t,n,i,a){const o=[],u=_l(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),i.end=Object.assign({},u),o.push(["exit",i,t]),e.add(n+1,0,o)}function _l(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const V7={name:"tasklistCheck",tokenize:Y7};function G7(){return{text:{91:V7}}}function Y7(e,t,n){const i=this;return a;function a(h){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),o)}function o(h){return Pt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(h)}function f(h){return $e(h)?t(h):ot(h)?e.check({tokenize:W7},t,n)(h):n(h)}}function W7(e,t,n){return xt(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function Q7(e){return R2([y7(),A7(),P7(e),I7(),G7()])}const X7={};function Rx(e){const t=this,n=e||X7,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(Q7(n)),o.push(g7()),u.push(x7(n))}const K7=1500;async function Z7(e){var i;try{if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function Lx({text:e,label:t="Copy",className:n=""}){const[i,a]=S.useState(!1),o=S.useRef(null);S.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await Z7(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),K7))},f=i?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":f,title:f,className:`inline-flex items-center justify-center w-6 h-6 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors ${n}`,children:i?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":"true",children:[l.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),l.jsx("path",{d:"M10.5 5V3.75A.75.75 0 009.75 3H3.75A.75.75 0 003 3.75v6a.75.75 0 00.75.75H5"})]})})}const ff=25*1024*1024,hf=100*1024*1024;function SS(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const o=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function Cs(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function kS(e){return e.startsWith("image/")}function jS({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let i="FILE";return t==="application/pdf"||n==="pdf"?i="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?i="ZIP":["csv","tsv"].includes(n)?i="CSV":["json","yaml","yml","toml","xml"].includes(n)?i="DATA":["md","txt","log"].includes(n)?i="TXT":["doc","docx","rtf","odt"].includes(n)?i="DOC":["xls","xlsx","ods"].includes(n)?i="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?i="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?i="VID":n&&(i=n.slice(0,4).toUpperCase()),l.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[l.jsx("path",{d:"M3 1.75h6.5L13 5.25v9A1.25 1.25 0 0 1 11.75 15.5h-7.5A1.25 1.25 0 0 1 3 14.25V1.75z"}),l.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),l.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:i})]})}function NS({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:o="w-12 h-12"}){const u=kS(t);return l.jsxs("div",{className:"relative group",title:`${e} (${Cs(i)})`,children:[l.jsx("div",{className:`${o} rounded-lg overflow-hidden border border-cc-border`,children:u?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):l.jsx(jS,{name:e,mediaType:t})}),a&&l.jsx("button",{onClick:a,"aria-label":`Remove ${e}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-cc-error text-white flex items-center justify-center text-[10px] opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function J7({name:e,mediaType:t,data:n,size:i}){return kS(t)?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e||"attachment",className:"max-w-[150px] sm:max-w-[200px] max-h-[120px] sm:max-h-[150px] rounded-xl object-cover border border-cc-border/30"}):l.jsxs("a",{href:`data:${t};base64,${n}`,download:e||"attachment",className:"inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-cc-border/40 bg-cc-hover/40 hover:bg-cc-hover transition-colors max-w-[260px] no-underline",children:[l.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:l.jsx(jS,{name:e,mediaType:t})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:Cs(i)})]})]})}function $g(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map($g).join(""):typeof e=="object"&&e!==null&&"props"in e?$g((t=e.props)==null?void 0:t.children):""}function eR({message:e}){return e.role==="system"?l.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-0",children:[l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),l.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):e.role==="user"?l.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] px-3.5 sm:px-4 py-2.5 rounded-[16px] rounded-br-[6px] user-bubble-gradient text-cc-fg shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:[e.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>l.jsx(J7,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),l.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:l.jsx(Dx,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(sR,{message:e})})}function tR(e){const t=[];for(const n of e)if(n.type==="tool_use"){const i=t[t.length-1];(i==null?void 0:i.kind)==="tool_group"&&i.name===n.name?i.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function nR(e){const t=new Map;for(const n of e)n.type==="tool_use"&&t.set(n.id,{name:n.name,input:n.input});return t}function rR(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function iR({streaming:e}){return l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 py-0.5 text-[11px] text-cc-muted/50 italic",children:[l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full bg-cc-muted/40 shrink-0 ${e?"animate-pulse":""}`}),l.jsx("span",{children:e?"Thinking…":"Thought"})]})}function sR({message:e}){var u;const t=e.contentBlocks||[],n=zl(),i=S.useMemo(()=>tR(t),[t]),a=S.useMemo(()=>nR(t),[t]),o=S.useMemo(()=>n?i.filter(f=>!rR(f)):i,[i,n]);if(n&&o.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Am,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(iR,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const f=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Am,{}),l.jsx("div",{className:"flex-1 min-w-0",children:f?l.jsx(ES,{text:e.content}):l.jsx(Dx,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Am,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((f,h)=>{if(f.kind==="content")return l.jsx(aR,{block:f.block,toolUseById:a},h);if(f.items.length===1){const p=f.items[0];return l.jsx(k5,{name:p.name,input:p.input,toolUseId:p.id},h)}return l.jsx(cR,{name:f.name,items:f.items},h)})})]})}function Am(){return l.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function Dx({text:e,showCursor:t=!1}){return l.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[l.jsx(Ex,{remarkPlugins:[Rx],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof i=="string"&&i.includes(`
99
+ `)){const f=(o==null?void 0:o[1])||"",h=$g(i);return l.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),f&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),l.jsx(Lx,{text:h,label:"Copy code",className:"ml-auto -mr-1"})]}),l.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:l.jsx("code",{children:i})})]})}return l.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-[12.5px] font-mono-code text-cc-fg/80 border border-cc-border/40",children:i})},pre:({children:n})=>l.jsx(l.Fragment,{children:n}),table:({children:n})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>l.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>l.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>l.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&l.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function aR({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(Dx,{text:e.text});if(e.type==="thinking")return l.jsx(ES,{text:e.thinking});if(e.type==="tool_use")return l.jsx(k5,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),a=i==null?void 0:i.name,o=e.is_error??!1;return a==="Bash"?l.jsx(lR,{text:n,isError:o}):l.jsx(oR,{content:n,isError:o})}return null}function CS(e){return`${e} ${e===1?"line":"lines"}`}function lR({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,o]=S.useState(!1),u=zl(),[f,h]=S.useState(!1),p=a||!i?e:n.slice(-20).join(`
100
+ `),g=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Lx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:p}),i&&l.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[l.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:a?`${n.length} lines`:`last 20 of ${n.length}`}),l.jsx("button",{onClick:()=>o(!a),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:a?"Show tail":"Show all"})]})]});return u?l.jsxs("div",{children:[l.jsx(mf,{open:f,onToggle:()=>h(!f),marker:"›",label:t?"Error output":"Output",meta:CS(n.length),labelClassName:t?"text-cc-error/70":""}),f&&l.jsx("div",{className:"mt-1",children:g})]}):g}function oR({content:e,isError:t}){const n=zl(),[i,a]=S.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Lx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:e})]});return n?l.jsxs("div",{children:[l.jsx(mf,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:CS(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:o})]}):o}function cR({name:e,items:t}){const[n,i]=S.useState(!1),a=Mc(e),o=Es(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Nl,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:o}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=xc(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function ES({text:e}){const t=e.trim(),n=zl(),[i,a]=S.useState(!1),o=t.split(`
101
+ `),u=n?2:8,f=n?200:600,h=o.length>u||t.length>f,p=h&&!i?o.slice(0,u).join(`
102
+ `):t;return n&&!t?null:l.jsxs("div",{children:[l.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:l.jsx(Ex,{remarkPlugins:[Rx],components:{p:({children:g})=>l.jsx("p",{className:"mb-2 last:mb-0",children:g}),ul:({children:g})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:g}),ol:({children:g})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:g}),li:({children:g})=>l.jsx("li",{children:g}),code:({children:g})=>l.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:g})},children:p||"No thinking text captured."})}),h&&!i&&l.jsx("button",{onClick:()=>a(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function ic(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Ko(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Q_(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":uR(t):"N/A"}catch{return"N/A"}}function Fg(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function X_(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function uR(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function dR({tools:e}){return e.length===0?null:l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[l.jsx(Nl,{type:Mc(t.toolName)}),l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),l.jsx("span",{className:"text-cc-fg/70",children:Es(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function fR({entries:e}){const[t,n]=S.useState(!1),i=S.useMemo(()=>{const a=e.reduce((h,p)=>h+p.elapsedSeconds,0),o=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:f}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${Es(a.toolName)} ${a.elapsedSeconds}s`},a.toolUseId))})]}),t&&l.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(a=>l.jsx(hR,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function hR({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[l.jsx(Nl,{type:Mc(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Es(e.toolName)})]}),l.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:l.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const yd=100,pR=40,mR=120,K_=1e4,gR=15*6e4,Mm=new Map,xR=[],vR=[];function bR(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function yR(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function Z_(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function _R(e){return e.kind==="message"?(e.msg.contentBlocks||[]).filter(n=>n.type==="tool_use").filter(n=>n.name==="Task").map(n=>n.id):e.kind==="tool_msg_group"&&e.toolName==="Task"?e.items.map(t=>t.id):[]}function TS(e){const t=[];for(const n of e){const i=yR(n);if(i){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===i){a.items.push(...Z_(n));continue}t.push({kind:"tool_msg_group",toolName:i,items:Z_(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function AS(e,t,n){const i=TS(e),a=[];for(const o of i){a.push(o);const u=_R(o);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},g=AS(h,t,n);a.push({kind:"subagent",taskToolUseId:f,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:g})}}}return a}function wR(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const o of a.contentBlocks)if(o.type==="tool_use"&&o.name==="Task"){const{input:u,id:f}=o,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,p=h&&h.length>0?h.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,x=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||p!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:x?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:g,receiverThreadIds:h})}}if(t.size===0)return TS(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let o=n.get(a.parentToolUseId);o||(o=[],n.set(a.parentToolUseId,o)),o.push(a)}else i.push(a);return AS(i,t,n)}function SR({group:e}){const[t,n]=S.useState(!1),i=Mc(e.toolName),a=Es(e.toolName),o=e.items.length;if(o===1){const u=e.items[0];return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(J_,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Nl,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:xc(u.name,u.input)})]}),t&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:l.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(J_,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Nl,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:o})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=xc(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function MS({entries:e,toolActivity:t}){return l.jsx(l.Fragment,{children:e.map((n,i)=>{if(n.kind==="tool_msg_group")return l.jsx(SR,{group:n},n.firstId||i);if(n.kind==="subagent")return l.jsx(NR,{group:n},n.taskToolUseId);const a=n.msg,o=kR(a),u=t&&o.length>0?t.filter(h=>o.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return l.jsxs("div",{children:[l.jsx(eR,{message:a}),f&&l.jsx(fR,{entries:u})]},a.id)})})}function kR(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function jR(e){if(!e)return null;const t=e.trim().toLowerCase();return t?t==="completed"?{label:"completed",summaryLabel:"completed",className:"text-green-600 bg-green-500/15"}:t==="failed"||t==="error"||t==="errored"?{label:"failed",summaryLabel:"failed",className:"text-cc-error bg-cc-error/10"}:t==="pending"||t==="pendinginit"||t==="pending_init"?{label:"pending",summaryLabel:"pending",className:"text-amber-700 bg-amber-500/15"}:t==="running"||t==="inprogress"||t==="in_progress"||t==="started"?{label:"running",summaryLabel:"running",className:"text-blue-600 bg-blue-500/15"}:{label:e,summaryLabel:"running",className:"text-amber-700 bg-amber-500/15"}:null}function NR({group:e}){const[t,n]=S.useState(!1),i=e.description||"Subagent",a=e.agentType,o=e.children.length,u=jR(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",x=e.children[e.children.length-1],b=S.useMemo(()=>{var y,_;if(!x)return"";if(x.kind==="tool_msg_group")return`${Es(x.toolName)}${x.items.length>1?` ×${x.items.length}`:""}`;if(x.kind==="message"&&x.msg.role==="assistant"){const j=(y=x.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const C=(_=x.msg.contentBlocks)==null?void 0:_.find(k=>k.type==="tool_use");if(C)return Es(C.name)}return""},[x]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&b&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:b}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:o})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&l.jsxs("span",{children:["receivers: ",p.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(MS,{entries:e.children})]})]})})}function J_(){return l.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function CR({sessionId:e}){var Nt;const t=X(ve=>ve.messages.get(e)??xR),n=X(ve=>(ve.sdkSessions||vR).find(Fe=>Fe.sessionId===e)),i=X(ve=>ve.streamingStartedAt.get(e)),a=X(ve=>ve.streamingOutputTokens.get(e)),o=X(ve=>ve.sessionStatus.get(e)),u=X(ve=>ve.lastActivityAt.get(e)),f=X(ve=>ve.sessionProcesses.get(e)),h=X(ve=>ve.toolProgress.get(e)),p=X(ve=>ve.toolActivity.get(e)),g=S.useRef(null),x=S.useRef(null),b=S.useRef(!0),[y,_]=S.useState(0),[j,C]=S.useState(yd),[k,E]=S.useState([]),[N,D]=S.useState(0),[O,L]=S.useState(!1),[G,P]=S.useState(!1),[Q,B]=S.useState(!1),[I,M]=S.useState(""),le=S.useRef(new Set),J=X(ve=>ve.chatTabReentryTickBySession.get(e)??0),Y=S.useMemo(()=>t.some(ve=>ve.role==="assistant"&&ve.isStreaming),[t]),$=S.useMemo(()=>(f??[]).filter(ve=>ve.status==="running"),[f]),F=$.length>0,V=S.useMemo(()=>{const ve=p??[];for(let Fe=ve.length-1;Fe>=0;Fe--)if(!ve[Fe].completedAt)return ve[Fe]},[p]),ge=S.useMemo(()=>$.length>0?Math.min(...$.map(ve=>ve.startedAt)):null,[$]),R=S.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),z=R.length>0,Z=n!=null&&n.forkSession?"Forked from":"Continuing from",A=S.useMemo(()=>{if(k.length===0)return t;const ve=[],Fe=new Set;for(const ct of k)Fe.has(ct.id)||(Fe.add(ct.id),ve.push(ct));for(const ct of t)Fe.has(ct.id)||(Fe.add(ct.id),ve.push(ct));return ve},[k,t]),ue=S.useMemo(()=>wR(A),[A]);S.useEffect(()=>{C(yd),E([]),D(0),L(!1),P(!1),B(!1),M(""),le.current=new Set},[e,R]);const xe=ue.length,je=xe>j,Re=je?ue.slice(xe-j):ue,Le=xe-Re.length,Be=S.useCallback(()=>{const ve=x.current,Fe=(ve==null?void 0:ve.scrollHeight)??0;C(ct=>ct+yd),requestAnimationFrame(()=>{if(ve){const ct=ve.scrollHeight;ve.scrollTop+=ct-Fe}})},[]),Je=S.useCallback(async(ve={})=>{if(!z||!R||Q)return;const Fe=x.current,ct=(Fe==null?void 0:Fe.scrollHeight)??0,xn=G?N:0;B(!0),M("");try{const Ne=await Ce.getClaudeSessionHistory(R,{cursor:xn,limit:pR}),ze=Ne.messages.map(Ee=>({id:Ee.id,role:Ee.role,content:Ee.content,contentBlocks:Ee.role==="assistant"?Ee.contentBlocks:void 0,timestamp:Ee.timestamp||Date.now(),model:Ee.role==="assistant"?Ee.model:void 0,stopReason:Ee.role==="assistant"?Ee.stopReason:void 0})),mt=[];for(const Ee of ze)le.current.has(Ee.id)||(le.current.add(Ee.id),mt.push(Ee));E(Ee=>[...mt,...Ee]),D(Ne.nextCursor),L(Ne.hasMore),P(!0),mt.length>0&&C(Ee=>Ee+mt.length),ve.preserveScroll!==!1&&Fe&&requestAnimationFrame(()=>{const Ee=Fe.scrollHeight;Fe.scrollTop+=Ee-ct})}catch(Ne){const ze=Ne instanceof Error?Ne.message:String(Ne);M(ze||"Failed to load previous history"),G||(E([]),D(0),L(!1))}finally{B(!1)}},[z,R,Q,G,N]);S.useEffect(()=>{if(!i&&o!=="running"&&!F){_(0);return}const ve=i||Date.now();_(Date.now()-ve);const Fe=setInterval(()=>_(Date.now()-ve),1e3);return()=>clearInterval(Fe)},[i,o,F]);function it(){const ve=x.current;if(!ve)return;b.current=ve.scrollHeight-ve.scrollTop-ve.clientHeight<120;const Fe=Math.max(0,ve.scrollHeight-ve.clientHeight-ve.scrollTop);Mm.set(e,Fe),z&&G&&O&&!Q&&ve.scrollTop<=mR&&Je({preserveScroll:!0})}const ht=S.useCallback(()=>{const ve=x.current;if(!ve)return;const Fe=ve.style.scrollBehavior;ve.style.scrollBehavior="auto",ve.scrollTop=ve.scrollHeight,ve.style.scrollBehavior=Fe},[]),Jt=S.useCallback(()=>{const ve=x.current;if(!ve)return;const Fe=ve.style.scrollBehavior;ve.style.scrollBehavior="auto";const ct=Mm.get(e);typeof ct=="number"?ve.scrollTop=Math.max(0,ve.scrollHeight-ve.clientHeight-ct):ve.scrollTop=ve.scrollHeight,ve.style.scrollBehavior=Fe},[e]);if(S.useEffect(()=>{requestAnimationFrame(()=>Jt())},[e,Jt]),S.useEffect(()=>()=>{const ve=x.current;if(!ve)return;const Fe=Math.max(0,ve.scrollHeight-ve.clientHeight-ve.scrollTop);Mm.set(e,Fe)},[e]),S.useEffect(()=>{J&&requestAnimationFrame(()=>ht())},[J,ht]),S.useEffect(()=>{var ve;b.current&&((ve=g.current)==null||ve.scrollIntoView({behavior:"smooth"}))},[t]),A.length===0)return l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[l.jsx("polyline",{points:"4 17 10 11 4 5"}),l.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),l.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),l.jsx("div",{className:"text-center max-w-xs",children:z?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),l.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[Z," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:R.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void Je({preserveScroll:!1}),disabled:Q,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),Q?"Loading...":"Load previous history"]}),I&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const pt=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,_t=F&&(o!=="running"||pt>=K_)?"background":pt>=gR&&!V?"stalled":pt>=K_?"quiet":"active";return l.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[l.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),l.jsx("div",{ref:x,onScroll:it,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:l.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[z&&!G&&l.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[Z," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[R," ",n!=null&&n.cwd?`· ${bR(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Je({preserveScroll:!0}),disabled:Q,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:Q?"Loading...":"Load previous history"})]}),I&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}),z&&G&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:O?Q?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),je&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Be,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(yd,Le)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Le," hidden)"]})]})}),l.jsx(MS,{entries:Re,toolActivity:p}),h&&h.size>0&&!Y&&l.jsx(dR,{tools:Array.from(h.values())}),o==="compacting"&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),l.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),l.jsx("span",{children:"Compacting context..."})]}),(o==="running"||F)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":_t,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${_t==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${_t==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),_t==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:$.length===1?"Background process running":`${$.length} background processes running`}),ge!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:Ko(Math.max(0,Date.now()-ge))})]}),((Nt=$[0])==null?void 0:Nt.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:$[0].description})]})]}):_t==="stalled"?l.jsxs("span",{children:["No activity for ",Ko(pt)," — the agent may be stuck"]}):_t==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:V?`Running ${V.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:V?Ko(Math.max(0,Date.now()-V.startedAt)):`no update for ${Ko(pt)}`}),(V==null?void 0:V.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:V.preview})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:Ko(y)}),(a??0)>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsxs("span",{className:"tabular-nums",children:[ic(a)," tokens"]})]})]})]}),l.jsx("div",{ref:g})]})})]})}const ER={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function TR(e,t){for(const[i,a]of Object.entries(ER))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function AR(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:TR(t.value,n)}))}const RS=[{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],LS=[{value:"gpt-5.5",label:"GPT-5.5",icon:"■"},{value:"gpt-5.4",label:"GPT-5.4",icon:"✳"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini",icon:"⚡"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],zx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],Ox=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],MR=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],DS=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],zS=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function OS(e){return e==="codex"?LS:RS}function e5(e){return e==="codex"?Ox:zx}function UD(e){return e==="codex"?zS:DS}function t5(e){return e==="codex"?LS[0].value:RS[0].value}function n5(e){return e==="codex"?Ox[0].value:zx[0].value}function ID(e){return e==="codex"?zS[0].value:DS[0].value}function RR(e){return e==="codex"?[]:MR}function r5({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=X(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=X(b=>b.sessions.get(e)),u=X(b=>b.cliConnected.get(e)??!1),f=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",h=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=OS(f),g=p.find(b=>b.value===h)||(h?{label:h,icon:"?"}:null),x=S.useCallback(b=>{if(n(!1),b===h)return;Fn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=X.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,h]);return S.useEffect(()=>{if(!t)return;const b=y=>{i.current&&!i.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),S.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),f==="codex"||!u||!g?null:l.jsxs("div",{ref:i,className:"relative shrink-0",children:[l.jsxs("button",{onClick:()=>n(b=>!b),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),l.jsx("span",{children:g.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(b=>l.jsxs("button",{onClick:()=>x(b.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${b.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":b.value===h,children:[b.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:b.icon}),l.jsx("span",{className:"flex-1 text-left",children:b.label}),b.value===h&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},b.value))})]})}function BS({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:o,className:u=""}){return e?l.jsx("div",{ref:o,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>l.jsxs("button",{"data-prompt-index":h,onClick:()=>a(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function PS({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,o]=S.useState(!1),[u,f]=S.useState(0),[h,p]=S.useState([]),[g,x]=S.useState(!1),b=S.useRef(null),y=S.useCallback(async()=>{x(!0);try{const k=await Ce.listPrompts(n);p(k.filter(E=>!!E.name.trim()))}catch{p([])}finally{x(!1)}},[n]);S.useEffect(()=>{y()},[y]);const _=S.useMemo(()=>{const k=e.slice(0,t),E=k.match(/(^|\s)@([^\s@]*)$/);if(!E||E.index===void 0)return null;const N=k.length-E[0].length+E[1].length;return{query:E[2]||"",start:N,end:t}},[e,t]),j=S.useMemo(()=>{if(!a||!_)return[];const k=_.query.toLowerCase();if(!k)return h;const E=h.filter(D=>D.name.toLowerCase().startsWith(k)),N=h.filter(D=>!D.name.toLowerCase().startsWith(k)&&D.name.toLowerCase().includes(k));return[...E,...N]},[a,_,h]);S.useEffect(()=>{const k=i&&!!_;k&&!a?(o(!0),f(0)):!k&&a&&o(!1)},[i,_,a]),S.useEffect(()=>{u>=j.length&&f(Math.max(0,j.length-1))},[j.length,u]),S.useEffect(()=>{if(!b.current||!a)return;const E=b.current.querySelectorAll("[data-prompt-index]")[u];E&&E.scrollIntoView({block:"nearest"})},[u,a]);const C=S.useCallback(k=>{if(!_)return{nextText:e,nextCursor:t};const E=`${k.content} `,N=`${e.slice(0,_.start)}${E}${e.slice(_.end)}`,D=_.start+E.length;return{nextText:N,nextCursor:D}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:j,promptsLoading:g,savedPrompts:h,selectPrompt:C,refreshPrompts:y,mentionMenuRef:b}}const LR=[];function i5({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",f=o?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",h=o?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?f:h:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:i})]})}function _d({onClick:e,disabled:t,active:n,title:i,children:a}){return l.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:a})}function s5(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}function a5({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",f=o?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?f:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function DR({sessionId:e}){var ae,_e;const[t,n]=S.useState(""),[i,a]=S.useState([]),[o,u]=S.useState(null),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[x,b]=S.useState(0),[y,_]=S.useState(!1),[j,C]=S.useState(""),[k,E]=S.useState("global"),[N,D]=S.useState(null),[O,L]=S.useState(0),G=S.useRef(null),P=S.useRef(null),Q=S.useRef(null),B=S.useRef(null),I=X(W=>W.cliConnected),M=X(W=>W.sessions.get(e)),le=X(W=>W.previousPermissionMode.get(e)||"acceptEdits"),J=I.get(e)??!1,Y=(M==null?void 0:M.permissionMode)||"acceptEdits",$=Y==="plan",F=(M==null?void 0:M.backend_type)==="codex",ge=((_e=(ae=(F?Ox:zx).find(W=>W.value===Y))==null?void 0:ae.label)==null?void 0:_e.toLowerCase())||Y,R=PS({text:t,caretPos:O,cwd:M==null?void 0:M.cwd,enabled:!p}),z=S.useMemo(()=>{const W=[];if(M!=null&&M.slash_commands)for(const pe of M.slash_commands)W.push({name:pe,type:"command"});if(M!=null&&M.skills)for(const pe of M.skills)W.push({name:pe,type:"skill"});return W},[M==null?void 0:M.slash_commands,M==null?void 0:M.skills]),Z=S.useMemo(()=>{if(!p)return[];const W=t.match(/^\/(\S*)$/);if(!W)return[];const pe=W[1].toLowerCase();return pe===""?z:z.filter(Me=>Me.name.toLowerCase().includes(pe))},[t,p,z]);S.useEffect(()=>{const W=t.startsWith("/")&&/^\/\S*$/.test(t)&&z.length>0;W&&!p?(g(!0),b(0)):!W&&p&&g(!1)},[t,z.length,p]),S.useEffect(()=>{x>=Z.length&&b(Math.max(0,Z.length-1))},[Z.length,x]),S.useEffect(()=>{if(!Q.current||!p)return;const pe=Q.current.querySelectorAll("[data-cmd-index]")[x];pe&&pe.scrollIntoView({block:"nearest"})},[x,p]),S.useEffect(()=>{if(B.current===null||!G.current)return;const W=B.current;G.current.setSelectionRange(W,W),B.current=null},[t]);const A=S.useCallback(W=>{var pe;n(`/${W.name} `),g(!1),(pe=G.current)==null||pe.focus()},[]),ue=S.useCallback(W=>{var Me;const pe=R.selectPrompt(W);B.current=pe.nextCursor,n(pe.nextText),R.setMentionMenuOpen(!1),L(pe.nextCursor),(Me=G.current)==null||Me.focus(),G.current&&(G.current.style.height="auto",G.current.style.height=Math.min(G.current.scrollHeight,200)+"px")},[R]);function xe(){var nt;const W=t.trim();if(!W||!J)return;const pe=$m(),Me=i.length>0?i.map(rt=>({name:rt.name,media_type:rt.mediaType,data:rt.base64,size:rt.size})):void 0;Fn(e,{type:"user_message",content:W,session_id:e,attachments:Me,client_msg_id:pe});const Qe=X.getState();Qe.appendMessage(e,{id:pe,role:"user",content:W,attachments:Me,timestamp:Date.now()}),Qe.setSessionStatus(e,"running"),Qe.setLastActivity(e,Date.now()),Qe.streamingStartedAt.has(e)||Qe.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),g(!1),R.setMentionMenuOpen(!1),G.current&&(G.current.style.height="auto"),(nt=G.current)==null||nt.focus()}function je(W){if(p&&Z.length>0){if(W.key==="ArrowDown"){W.preventDefault(),b(pe=>(pe+1)%Z.length);return}if(W.key==="ArrowUp"){W.preventDefault(),b(pe=>(pe-1+Z.length)%Z.length);return}if(W.key==="Tab"&&!W.shiftKey){W.preventDefault(),A(Z[x]);return}if(W.key==="Enter"&&!W.shiftKey){W.preventDefault(),A(Z[x]);return}if(W.key==="Escape"){W.preventDefault(),g(!1);return}}if(R.mentionMenuOpen&&W.key==="Escape"){W.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(W.key==="ArrowDown"){W.preventDefault(),R.setMentionMenuIndex(pe=>(pe+1)%R.filteredPrompts.length);return}if(W.key==="ArrowUp"){W.preventDefault(),R.setMentionMenuIndex(pe=>(pe-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(W.key==="Tab"&&!W.shiftKey||W.key==="Enter"&&!W.shiftKey){W.preventDefault(),ue(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(W.key==="Enter"&&!W.shiftKey||W.key==="Tab"&&!W.shiftKey)){W.preventDefault();return}if(W.key==="Tab"&&W.shiftKey){W.preventDefault(),Fe();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),xe())}function Re(W){n(W.target.value),L(W.target.selectionStart??W.target.value.length);const pe=W.target;pe.style.height="auto",pe.style.height=Math.min(pe.scrollHeight,200)+"px"}function Le(){G.current&&L(G.current.selectionStart??0)}function Be(){Fn(e,{type:"interrupt"})}async function Je(W){if(W.length===0)return;const pe=[],Me=[];let Qe=i.reduce((nt,rt)=>nt+rt.size,0);for(const nt of W){if(nt.size>ff){Me.push(`${nt.name} is too large (${Cs(nt.size)}, max ${Cs(ff)})`);continue}if(Qe+nt.size>hf){Me.push(`${nt.name} would exceed the per-message limit (${Cs(hf)})`);continue}const{base64:rt,mediaType:St}=await SS(nt);pe.push({name:nt.name,base64:rt,mediaType:St,size:nt.size}),Qe+=nt.size}pe.length>0&&a(nt=>[...nt,...pe]),u(Me.length>0?Me.join("; "):null)}async function it(W){const pe=W.target.files;pe&&(await Je(Array.from(pe)),W.target.value="")}function ht(W){a(pe=>pe.filter((Me,Qe)=>Qe!==W))}async function Jt(W){var Qe;const pe=(Qe=W.clipboardData)==null?void 0:Qe.items;if(!pe)return;const Me=[];for(const nt of Array.from(pe)){if(nt.kind!=="file")continue;const rt=nt.getAsFile();if(!rt)continue;const St=rt.name&&rt.name.length>0?rt.name:`pasted-${Date.now()}.${(rt.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Me.push(new File([rt],St,{type:rt.type,lastModified:rt.lastModified}))}Me.length>0&&(W.preventDefault(),await Je(Me))}function pt(W){W.dataTransfer.types.includes("Files")&&(W.preventDefault(),W.stopPropagation(),h(!0))}function _t(W){W.currentTarget===W.target&&h(!1)}async function Nt(W){if(!W.dataTransfer.types.includes("Files"))return;W.preventDefault(),W.stopPropagation(),h(!1);const pe=Array.from(W.dataTransfer.files);pe.length>0&&await Je(pe)}function ve(){const W=t.trim().slice(0,32);C(W||""),D(null),_(pe=>!pe)}function Fe(){if(!J)return;const W=X.getState();if(!$)W.setPreviousPermissionMode(e,Y),Fn(e,{type:"set_permission_mode",mode:"plan"}),W.updateSession(e,{permissionMode:"plan"});else{const pe=le||(F?"bypassPermissions":"acceptEdits");Fn(e,{type:"set_permission_mode",mode:pe}),W.updateSession(e,{permissionMode:pe})}}async function ct(){const W=t.trim(),pe=j.trim();if(!W||!pe)return;if(k==="project"&&!(M!=null&&M.cwd)){D("No project folder available for this session");return}const Me={name:pe,content:W,scope:k};k==="project"&&(Me.projectPaths=[M.cwd]);try{await Ce.createPrompt(Me),await R.refreshPrompts(),_(!1),C(""),E("global"),D(null)}catch(Qe){const nt=Qe instanceof Error&&Qe.message?Qe.message:"Could not save prompt.";D(nt)}}const Ne=X(W=>W.promptSuggestions.get(e))??LR,ze=X(W=>W.clearPromptSuggestions),Ee=X(W=>W.sessionStatus).get(e)==="running",$r=t.trim().length>0&&J;return l.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${f?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:pt,onDragLeave:_t,onDrop:Nt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((W,pe)=>l.jsx(NS,{name:W.name,mediaType:W.mediaType,base64:W.base64,size:W.size,onRemove:()=>ht(pe)},pe))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:P,type:"file",multiple:!0,onChange:it,className:"hidden","aria-label":"Attach files"}),Ne.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:Ne.map((W,pe)=>l.jsx("button",{onClick:()=>{if(!J||Ee)return;const Me=$m();Fn(e,{type:"user_message",content:W,session_id:e,client_msg_id:Me}),X.getState().appendMessage(e,{id:Me,role:"user",content:W,timestamp:Date.now()}),ze(e)},disabled:!J||Ee,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:W,children:W},pe))}),l.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${$?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[p&&Z.length>0&&l.jsx("div",{ref:Q,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:Z.map((W,pe)=>l.jsxs("button",{"data-cmd-index":pe,onClick:()=>A(W),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${pe===x?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:W.type==="skill"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",W.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:W.type})]})]},`${W.type}-${W.name}`))}),l.jsx(BS,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:ue,menuRef:R.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),y&&l.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[l.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),l.jsx("input",{value:j,onChange:W=>{C(W.target.value),N&&D(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button","aria-pressed":k==="global",onClick:()=>E("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${k==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),l.jsx("button",{type:"button","aria-pressed":k==="project",onClick:()=>E("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${k==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),k==="project"&&(M==null?void 0:M.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:M.cwd,children:M.cwd}),N?l.jsx("div",{className:"text-[11px] text-cc-error",children:N}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),E("global"),D(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:ct,disabled:!j.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${j.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[l.jsx(i5,{isPlan:$,isConnected:J,onToggle:Fe,modeLabel:ge,size:"mobile"}),l.jsx(r5,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(_d,{onClick:ve,disabled:!J||!t.trim(),active:J&&!!t.trim(),title:"Save as prompt",children:l.jsx(s5,{})}),l.jsx(_d,{onClick:()=>{var W;return(W=P.current)==null?void 0:W.click()},disabled:!J,active:J,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:G,value:t,onChange:Re,onKeyDown:je,onClick:Le,onKeyUp:Le,onPaste:Jt,"aria-label":"Message input",placeholder:J?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!J,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),l.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:l.jsx(a5,{isRunning:Ee,canSend:$r,onSend:xe,onInterrupt:Be,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(_d,{onClick:()=>{var W;return(W=P.current)==null?void 0:W.click()},disabled:!J,active:J,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx(_d,{onClick:ve,disabled:!J||!t.trim(),active:J&&!!t.trim(),title:"Save as prompt",children:l.jsx(s5,{})}),l.jsx(i5,{isPlan:$,isConnected:J,onToggle:Fe,modeLabel:ge,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(r5,{sessionId:e}),l.jsx(a5,{isRunning:Ee,canSend:$r,onSend:xe,onInterrupt:Be,size:"desktop"})]})]})]})})}function zR(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function OR({permission:e,sessionId:t}){const[n,i]=S.useState(!1),a=X(p=>p.removePermission);function o(p,g){i(!0),Fn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),a(t,e.request_id)}function u(){i(!0),Fn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return l.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:l.jsx("div",{className:"max-w-3xl mx-auto",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:l.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&l.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&l.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?l.jsx(UR,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx($R,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&l.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&l.jsx(PR,{validation:e.ai_validation}),!f&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,g)=>l.jsxs("button",{onClick:()=>o(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),zR(p)]},g)),l.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function BR(e){return[/^Invalid Anthropic/i,/^Anthropic .*(rate limit|overloaded|unavailable|error|lacks permission)/i,/^AI service/i,/^AI evaluation timed out/i,/^Model not found/i,/^No Anthropic API key/i].some(n=>n.test(e))}function PR({validation:e}){const t=e.verdict==="uncertain"&&BR(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return l.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),l.jsx("span",{className:"font-medium",children:i}),l.jsx("span",{children:e.reason})]})}function $R({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(FR,{input:t}):e==="Edit"?l.jsx(IR,{input:t}):e==="Write"?l.jsx(HR,{input:t}):e==="Read"?l.jsx(qR,{input:t}):e==="Glob"?l.jsx(VR,{input:t}):e==="Grep"?l.jsx(GR,{input:t}):e==="ExitPlanMode"?l.jsx(YR,{input:t}):l.jsx($S,{input:t,description:n})}function FR({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsx("div",{className:"text-xs text-cc-muted",children:n}),l.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function UR({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,o]=S.useState({}),[u,f]=S.useState({}),[h,p]=S.useState({});function g(C){const k={};for(const[E,N]of Object.entries(C)){const D=i[Number(E)],O=typeof(D==null?void 0:D.question)=="string"&&D.question?D.question:E;k[O]=N}return k}function x(C,k){const E=String(C);o(N=>({...N,[E]:k})),p(N=>({...N,[E]:!1})),i.length<=1&&t(g({[E]:k}))}function b(C){var N;const k=String(C),E=(N=u[k])==null?void 0:N.trim();E&&(o(D=>({...D,[k]:E})),i.length<=1&&t(g({[k]:E})))}function y(C,k){const E=String(C);f(D=>({...D,[E]:k}));const N=k.trim();o(D=>{if(!N){const O={...D};return delete O[E],O}return{...D,[E]:N}})}function _(C){const k=String(C);p(E=>{const N=!!E[k],D={...E,[k]:!N};return N&&(o(O=>{const L={...O};return delete L[k],L}),f(O=>{const L={...O};return delete L[k],L})),D})}function j(){t(g(a))}if(i.length===0){const C=typeof e.question=="string"?e.question:"";return C?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:C}):l.jsx($S,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((C,k)=>{const E=typeof C.header=="string"?C.header:"",N=typeof C.question=="string"?C.question:"",D=Array.isArray(C.options)?C.options:[],O=String(k),L=a[O],G=h[O];return l.jsxs("div",{className:"space-y-2",children:[E&&l.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:E}),N&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:N}),D.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[D.map((P,Q)=>{const B=typeof P.label=="string"?P.label:String(P),I=typeof P.description=="string"?P.description:"",M=L===B;return l.jsx("button",{onClick:()=>x(k,B),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${M?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${M?"border-cc-primary":"border-cc-muted/40"}`,children:M&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:B}),I&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:I})]})]})},Q)}),l.jsx("button",{onClick:()=>_(k),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${G?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${G?"border-cc-primary":"border-cc-muted/40"}`,children:G&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),G&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[O]||"",onChange:P=>y(k,P.target.value),onKeyDown:P=>{P.key==="Enter"&&b(k)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},k)}),i.length>1&&Object.keys(a).length>0&&l.jsx("button",{onClick:j,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function IR({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(Dl,{oldText:n,newText:i,fileName:t,mode:"compact"})}function HR({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Dl,{newText:n,fileName:t,mode:"compact"})}function qR({input:e}){const t=String(e.file_path||"");return l.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function VR({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n})]})}function GR({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n}),i&&l.jsx("div",{className:"text-cc-muted",children:i})]})}function YR({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return l.jsxs("div",{className:"space-y-2",children:[t&&l.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[l.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),l.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),l.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:l.jsx(Ex,{remarkPlugins:[Rx],components:{h1:({children:i})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>l.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>l.jsx("li",{children:i}),strong:({children:i})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:a})=>l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:i=>{const{children:a,className:o}=i;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
103
+ `)?l.jsx("pre",{className:"my-2 px-2.5 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto border border-cc-border",children:l.jsx("code",{children:a})}):l.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-cc-code-fg font-mono-code text-[12px]",children:a})},pre:({children:i})=>l.jsx(l.Fragment,{children:i}),blockquote:({children:i})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),l.jsx("div",{className:"space-y-1",children:n.map((i,a)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[l.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function $S({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,a])=>{const o=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},i)})})]})}function WR({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,o=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const f=n.input.command;u=f.length>60?f.slice(0,60)+"...":f}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${o?"text-cc-success":"text-cc-error"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),l.jsxs("span",{className:"flex-1",children:["AI auto-",o?"approved":"denied",":"," ",l.jsx("span",{className:"font-mono-code opacity-80",children:u}),a&&l.jsxs("span",{className:"text-cc-muted ml-1",children:["(",a,")"]})]}),t&&l.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const QR=[],XR=[],l5="activity-tray-panel";function KR(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),a=n%60;return`${i}m${a>0?` ${a}s`:""}`}function ZR(e,t,n=4e3){const[i,a]=S.useState(!1),o=S.useRef(void 0),u=e.length+t.length,f=u>0&&e.every(h=>h.status==="completed")&&t.every(h=>h.status!=="running");return S.useEffect(()=>(clearTimeout(o.current),f?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[f,n]),S.useEffect(()=>{a(!1)},[u]),i}function JR(e){const[t,n]=S.useState(0);return S.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(i)},[e]),t}function eL({status:e}){return e==="running"||e==="in_progress"?l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function tL({agent:e,tick:t}){const[n,i]=S.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(eL,{status:e.status}),l.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&l.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:KR(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function nL({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[l.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug flex-1 truncate ${t?"text-cc-muted line-through":"text-cc-fg/80"}`,children:e.subject}),n&&e.activeForm&&l.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function rL({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=S.useRef(null),o=X(N=>N.sessionTasks.get(e)??QR),u=X(N=>N.sessionBackgroundAgents.get(e)??XR),f=ZR(o,u),h=u.some(N=>N.status==="running"),p=JR(h),g=u.filter(N=>N.status==="running").length,x=o.length,b=o.filter(N=>N.status==="completed").length,y=o.filter(N=>N.status==="in_progress").length,_=o.length>0||u.length>0,j=g>0||y>0,C=S.useCallback(()=>n(!1),[]);S.useEffect(()=>{if(!t)return;const N=D=>{D.key==="Escape"&&(D.stopPropagation(),C())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[t,C]),S.useEffect(()=>{if(!t)return;const N=D=>{i.current&&!i.current.contains(D.target)&&C()};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[t,C]),S.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[k,E]=S.useState(!1);return S.useEffect(()=>{_&&E(!1)},[_,o.length,u.length]),!_||k?null:l.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,style:f?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{f&&E(!0)},children:[t&&l.jsxs("div",{ref:a,id:l5,role:"dialog","aria-label":"Activity panel",tabIndex:-1,className:"mb-1.5 w-72 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto rounded-xl border border-cc-border/60 bg-cc-surface/95 backdrop-blur-xl shadow-lg shadow-black/20 outline-none",style:{animation:"fadeSlideIn 0.2s ease-out"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),l.jsx("button",{type:"button",onClick:C,className:"flex items-center justify-center w-7 h-7 -mr-1 rounded-md text-cc-muted/40 hover:text-cc-muted/70 hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-label":"Close activity tray",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),u.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(N=>l.jsx(tL,{agent:N,tick:p},N.toolUseId))]}),u.length>0&&o.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),o.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),o.map(N=>l.jsx(nL,{task:N},N.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":l5,className:`
104
+ flex items-center gap-2 px-3 min-h-[36px] rounded-full
105
+ border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
106
+ shadow-md shadow-black/15
107
+ hover:bg-cc-hover/80 hover:border-cc-border/70
108
+ transition-all duration-200 cursor-pointer
109
+ ${t?"ring-1 ring-cc-primary/30":""}
110
+ `,"aria-label":`Activity: ${g} agents running, ${b}/${x} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",x]}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function iL({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),i=X(_=>_.clearAiResolvedPermissions),a=X(_=>_.connectionStatus.get(e)??"disconnected"),o=X(_=>_.cliConnected.get(e)??!1),u=X(_=>_.cliReconnecting.get(e)??!1),f=X(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,o]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const x=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await Ce.relaunchSession(e)}catch(_){Ms(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),b=S.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(CR,{sessionId:e}),l.jsx(rL,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(WR,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(OR,{permission:_,sessionId:e},_.request_id))}),l.jsx(DR,{sessionId:e})]})}function sL({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=X(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const x=!g,b={[p]:x};X.getState().setSessionAiValidation(e,b),zC(e,b)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",o),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function aL({sessionId:e}){const[t,n]=S.useState(!1),[i,a]=S.useState(null),[o,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=x=>{f.current&&!f.current.contains(x.target)&&n(!1)},g=x=>{x.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const h=S.useCallback(async p=>{a(p),u(!1);try{const{blob:g,filename:x}=await Ce.exportSession(e,p),b=URL.createObjectURL(g),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(g){Ms(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function lL(){var G;const e=S.useSyncExternalStore(P=>(window.addEventListener("hashchange",P),()=>window.removeEventListener("hashchange",P)),()=>window.location.hash),t=S.useMemo(()=>dx(e),[e]),n=t.page==="session"||t.page==="home",i=X(P=>P.currentSessionId),a=X(P=>P.cliConnected),o=X(P=>P.sessionStatus),u=X(P=>P.sessionNames),f=X(P=>P.sdkSessions),h=X(P=>P.sidebarOpen),p=X(P=>P.setSidebarOpen),g=X(P=>P.taskPanelOpen),x=X(P=>P.setTaskPanelOpen),b=X(P=>P.activeTab),y=X(P=>P.setActiveTab),_=X(P=>P.markChatTabReentry),j=X(P=>i?P.gitChangedFilesCount.get(i)??0:0),C=i?o.get(i)??null:null,k=i?a.get(i)??!1:!1,E=i?(u==null?void 0:u.get(i))||((G=f.find(P=>P.sessionId===i))==null?void 0:G.name)||`Session ${i.slice(0,8)}`:null,N=!!(i&&n),D=t.page==="session"&&!!i,O=["chat","diff"],L=P=>{P==="chat"&&b!=="chat"&&i&&_(i),y(P)};return S.useEffect(()=>{const P=Q=>{if(!(Q.metaKey||Q.ctrlKey)||Q.key.toLowerCase()!=="j"||!N)return;const B=Q.target;if(B&&(B.tagName==="TEXTAREA"||B.tagName==="INPUT"||B.isContentEditable))return;Q.preventDefault();const I=Math.max(0,O.indexOf(b)),M=Q.shiftKey?-1:1,le=(I+M+O.length)%O.length;L(O[le])};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[N,O,b,y,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),N&&l.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[l.jsxs("button",{onClick:()=>L("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:E||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?C==="running"?"bg-cc-primary":C==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>L("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[N&&i&&l.jsx(sL,{sessionId:i}),N&&i&&l.jsx(aL,{sessionId:i}),l.jsx(oL,{}),D&&l.jsx("button",{onClick:()=>x(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function oL(){const e=X(n=>n.darkMode),t=S.useCallback(()=>X.getState().toggleDarkMode(),[]);return l.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const FS="cc-recent-dirs";function pf(){try{return JSON.parse(localStorage.getItem(FS)||"[]")}catch{return[]}}function US(e){const t=pf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(FS,JSON.stringify(t.slice(0,5)))}function cL(){return!1}function IS({onClose:e,embedded:t=!1}){const[n,i]=S.useState([]),[a,o]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,x]=S.useState([]),[b,y]=S.useState(""),[_,j]=S.useState(!1),[C,k]=S.useState(""),[E,N]=S.useState([{key:"",value:""}]),[D,O]=S.useState(!1),L=S.useCallback(()=>{Ce.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);S.useEffect(()=>{L()},[L]);function G(Y){f(Y.slug),p(Y.name);const $=Object.entries(Y.variables).map(([F,V])=>({key:F,value:V}));$.length===0&&$.push({key:"",value:""}),x($),y("")}function P(){f(null),y("")}async function Q(){if(!u)return;const Y={};for(const $ of g){const F=$.key.trim();F&&(Y[F]=$.value)}try{await Ce.updateEnv(u,{name:h.trim()||void 0,variables:Y}),f(null),y(""),L()}catch($){y($ instanceof Error?$.message:String($))}}async function B(Y){try{await Ce.deleteEnv(Y),u===Y&&f(null),L()}catch($){y($ instanceof Error?$.message:String($))}}async function I(){const Y=C.trim();if(!Y)return;O(!0);const $={};for(const F of E){const V=F.key.trim();V&&($[V]=F.value)}try{await Ce.createEnv(Y,$),k(""),N([{key:"",value:""}]),j(!1),y(""),L()}catch(F){y(F instanceof Error?F.message:String(F))}finally{O(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:C,onChange:Y=>k(Y.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:Y=>{Y.key==="Enter"&&C.trim()&&I()}}),l.jsx(wd,{rows:E,onChange:N}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!C.trim()||D,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${C.trim()&&!D?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:D?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(Y=>{const $=u===Y.slug,F=Object.keys(Y.variables).length;return $?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:V=>p(V.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(wd,{rows:g,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:P,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:()=>void Q(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},Y.slug):l.jsx(uL,{env:Y,varCount:F,onStartEdit:()=>G(Y),onDelete:()=>void B(Y.slug)},Y.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const M=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:C,onChange:Y=>k(Y.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:Y=>{Y.key==="Enter"&&C.trim()&&I()}}),l.jsx(wd,{rows:E,onChange:N}),l.jsx("button",{onClick:I,disabled:!C.trim()||D,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${C.trim()&&!D?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:D?"Creating...":"Create"})]}),le=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(Y=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:Y.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]}),u===Y.slug?l.jsx("button",{onClick:P,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>G(Y),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>B(Y.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===Y.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:$=>p($.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(wd,{rows:g,onChange:x})]})}),l.jsx("button",{onClick:Q,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==Y.slug&&Object.keys(Y.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(Y.variables).map(([$,F])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:$}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:F})]},$))})]},Y.slug))}),J=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:Y=>Y.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),le,M]})]});return Ol.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:J}),document.body)}function uL({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function wd({rows:e,onChange:t}){function n(o,u,f){const h=[...e];h[o]={...h[o],[u]:f},t(h)}function i(o){const u=e.filter((f,h)=>h!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const dL=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:IS},Symbol.toStringTag,{value:"Module"}));function fL(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function hL({initialPath:e,onSelect:t,onClose:n}){const[i,a]=S.useState(""),[o,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[x,b]=S.useState(""),[y,_]=S.useState(!1),[j,C]=S.useState(""),[k,E]=S.useState(-1),[N,D]=S.useState(!1),[O,L]=S.useState(()=>pf()),G=S.useRef(null),P=S.useRef(null),Q=S.useRef(null),B=S.useRef(new Map),I=S.useMemo(()=>{if(!j)return o;const F=j.toLowerCase();return o.filter(V=>V.name.toLowerCase().includes(F))},[o,j]),M=S.useCallback(async F=>{h(!0),g(""),C(""),E(-1);try{const V=await Ce.listDirs(F);a(V.path),u(V.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{M(e||void 0)},[]),S.useEffect(()=>{const F=G.current;if(!F)return;function V(R){if(R.key!=="Tab")return;const z=F.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(z.length===0)return;const Z=z[0],A=z[z.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),A.focus()):!R.shiftKey&&document.activeElement===A&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",V);const ge=setTimeout(()=>{var R;(R=Q.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",V),clearTimeout(ge)}},[]);const le=S.useCallback(()=>{N||(D(!0),setTimeout(n,150))},[n,N]);S.useEffect(()=>{function F(V){if(V.key==="Escape"){if(y)return;le()}}return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[y,le]),S.useEffect(()=>{function F(V){var R,z;if(y)return;if(V.key==="Backspace"&&document.activeElement!==Q.current){if(i&&i!=="/"){V.preventDefault();const Z=i.split("/").slice(0,-1).join("/")||"/";M(Z)}return}const ge=I.length;if(ge!==0){if(V.key==="ArrowDown"){V.preventDefault();const Z=k<ge-1?k+1:0;E(Z),(R=B.current.get(Z))==null||R.focus()}else if(V.key==="ArrowUp"){V.preventDefault();const Z=k>0?k-1:ge-1;E(Z),(z=B.current.get(Z))==null||z.focus()}}}return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[y,I.length,k,i,M]),S.useEffect(()=>{var F;k>=0&&((F=B.current.get(k))==null||F.scrollIntoView({block:"nearest"}))},[k]);function J(F){US(F),L(pf()),t(F),n()}const Y=fL(i),$=i.split("/").pop()||"/";return Ol.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${N?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:le,children:l.jsxs("div",{ref:G,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${N?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:F=>F.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:le,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),O.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:O.map(F=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>J(F),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[l.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:F.split("/").pop()||F}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:F})]})},F))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:x,onChange:F=>b(F.target.value),onKeyDown:F=>{F.key==="Enter"&&x.trim()&&J(x.trim()),F.key==="Escape"&&(F.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:Y.map((F,V)=>{const ge=V===Y.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[V>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{ge||M(F.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ge?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ge?"location":void 0,tabIndex:ge?-1:0,children:F.label})]},F.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:Q,type:"text","aria-label":"Filter directories",value:j,onChange:F=>{C(F.target.value),E(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>J(i),"aria-label":`Select ${$}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:$})]})]}),l.jsx("div",{ref:P,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((F,V)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+V*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${V*.1}s infinite`}})]},V))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>M(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>C(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map((F,V)=>l.jsxs("li",{className:`flex items-center transition-colors ${k===V?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ge=>{ge?B.current.set(V,ge):B.current.delete(V)},onClick:()=>M(F.path),onKeyDown:ge=>{ge.key==="Enter"&&(ge.preventDefault(),J(F.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:F.path,"aria-label":`Navigate into ${F.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"truncate",children:F.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>J(F.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${F.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},F.path))})}),l.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function pL(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function mL(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():pL(e.identifier,e.title)}function gc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),l.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),l.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),l.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function gL({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,x]=S.useState(0),[b,y]=S.useState(!0),[_,j]=S.useState([]),[C,k]=S.useState(""),[E,N]=S.useState(""),[D,O]=S.useState(!0),[L,G]=S.useState(!1),[P,Q]=S.useState("");S.useEffect(()=>{let I=!0;return Promise.all([Ce.getLinearStates(t),Ce.getLinearConnection(t)]).then(([M,le])=>{var Y;if(!I)return;j(M.teams),k(le.viewerId);const J=((Y=M.teams[0])==null?void 0:Y.id)||"";p(J)}).catch(M=>{I&&Q(M instanceof Error?M.message:"Failed to load teams")}).finally(()=>{I&&O(!1)}),()=>{I=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){N("");return}const I=_.find(le=>le.id===h),M=I==null?void 0:I.states.find(le=>le.type==="backlog");N((M==null?void 0:M.id)||"")},[h,_]);async function B(){if(!(!a.trim()||!h)){G(!0),Q("");try{const I=await Ce.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:b&&C?C:void 0,stateId:E||void 0,connectionId:t});n(I.issue)}catch(I){Q(I instanceof Error?I.message:"Failed to create issue")}finally{G(!1)}}}return Ol.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),P&&l.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:P}),D?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>o(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&h&&!L&&B()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:I=>x(Number(I.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:I=>y(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:B,disabled:!a.trim()||!h||L,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:L?"Creating...":"Create Issue"})]})]})]})}),document.body)}function xL({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[x,b]=S.useState(!1),[y,_]=S.useState(""),[j,C]=S.useState([]),[k,E]=S.useState(!1),[N,D]=S.useState(!1),[O,L]=S.useState(""),[G,P]=S.useState(!1),[Q,B]=S.useState(null),[I,M]=S.useState([]),[le,J]=S.useState(!1),[Y,$]=S.useState(""),[F,V]=S.useState(!1),[ge,R]=S.useState([]),[z,Z]=S.useState(!1),[A,ue]=S.useState(""),[xe,je]=S.useState(!1),[Re,Le]=S.useState([]),[Be,Je]=S.useState(!1),[it,ht]=S.useState(!1),Jt=S.useRef(null);S.useEffect(()=>{function Ne(ze){Jt.current&&!Jt.current.contains(ze.target)&&(E(!1),V(!1))}return document.addEventListener("pointerdown",Ne),()=>document.removeEventListener("pointerdown",Ne)},[]),S.useEffect(()=>{if(!n){h([]),g(null),b(!1),u(null);return}let Ne=!0;return Ce.listLinearConnections().then(({connections:ze})=>{Ne&&(h(ze),b(!0),ze.length>0?(g(ze[0].id),u(ze[0].id)):(g(null),u(null)))}).catch(()=>{Ne&&b(!0)}),()=>{Ne=!1}},[n]);const pt=S.useCallback(Ne=>{g(Ne),u(Ne),a(null),C([]),_(""),L(""),Le([]),ue(""),R([]),Q&&(J(!0),$(""),Ce.getLinearProjectIssues(Q.projectId,10,Ne).then(({issues:ze})=>{M(ze)}).catch(ze=>{$(ze instanceof Error?ze.message:String(ze))}).finally(()=>{J(!1)}))},[Q,u,a]);S.useEffect(()=>{if(!t||!n){B(null),M([]);return}let Ne=!0;return J(!0),$(""),(async()=>{try{const{mapping:ze}=await Ce.getLinearProjectMapping(t.repoRoot);if(!Ne)return;if(B(ze),ze){const{issues:mt}=await Ce.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!Ne)return;M(mt)}else M([])}catch(ze){if(!Ne)return;$(ze instanceof Error?ze.message:String(ze))}finally{Ne&&J(!1)}})(),()=>{Ne=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const Ne=y.trim();if(Ne.length<2){C([]),L(""),D(!1);return}let ze=!0;D(!0),L("");const mt=setTimeout(()=>{Ce.searchLinearIssues(Ne,8,p??void 0).then(Ee=>{ze&&C(Ee.issues)}).catch(Ee=>{ze&&(C([]),L(Ee instanceof Error?Ee.message:String(Ee)))}).finally(()=>{ze&&D(!1)})},400);return()=>{ze=!1,clearTimeout(mt)}},[n,y,p]),S.useEffect(()=>{if(!n||!xe){Le([]),Je(!1);return}const Ne=A.trim();if(Ne.length<2){Le([]),Je(!1);return}let ze=!0;Je(!0);const mt=setTimeout(()=>{Ce.searchLinearIssues(Ne,10,p??void 0).then(Ee=>{ze&&Le(Ee.issues)}).catch(()=>{ze&&Le([])}).finally(()=>{ze&&Je(!1)})},400);return()=>{ze=!1,clearTimeout(mt)}},[n,xe,A,p]);function _t(Ne,ze=!1){a(Ne),_(`${Ne.identifier} - ${Ne.title}`);const mt=mL(Ne);o(mt,!0),ze&&E(!1)}function Nt(){a(null),_(""),C([]),L("")}async function ve(Ne){if(t)try{const{mapping:ze}=await Ce.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:Ne.id,projectName:Ne.name});B(ze),V(!1),J(!0),$("");const{issues:mt}=await Ce.getLinearProjectIssues(Ne.id,10,p??void 0);M(mt)}catch(ze){$(ze instanceof Error?ze.message:String(ze))}finally{J(!1)}}async function Fe(){if(t){try{await Ce.removeLinearProjectMapping(t.repoRoot)}catch{}B(null),M([]),a(null),_("")}}function ct(){if(!n){window.location.hash="#/integrations/linear";return}V(!0),ge.length===0&&(Z(!0),Ce.listLinearProjects(p??void 0).then(({projects:Ne})=>R(Ne)).catch(()=>{}).finally(()=>Z(!1)))}function xn(Ne){ht(!1),_t(Ne),Q&&(J(!0),Ce.getLinearProjectIssues(Q.projectId,10,p??void 0).then(({issues:ze})=>M(ze)).catch(()=>{}).finally(()=>J(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Jt,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),x&&f.length>1&&l.jsx("select",{value:p??"",onChange:Ne=>pt(Ne.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(Ne=>l.jsx("option",{value:Ne.id,children:Ne.workspaceName||Ne.name},Ne.id))}),Q?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[l.jsx(gc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Q.projectName}),l.jsx("button",{type:"button",onClick:Fe,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsxs("button",{type:"button",onClick:()=>ht(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}E(!k)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(gc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:ct,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>ht(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),Q&&(()=>{const Ne=A.trim().toLowerCase(),ze=!xe&&Ne?I.filter(Ee=>Ee.identifier.toLowerCase().includes(Ne)||Ee.title.toLowerCase().includes(Ne)):xe?[]:I,mt=xe?Re:ze;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:Nt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:A,onChange:Ee=>ue(Ee.target.value),placeholder:xe?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),le?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):Y?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:Y}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):xe&&Ne.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):mt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:Ne?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:mt.map(Ee=>l.jsxs("button",{type:"button",onClick:()=>_t(Ee),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Ee.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:Ee.identifier})," ",Ee.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Ee.stateName,Ee.priorityLabel].filter(Boolean).join(" - ")})]},Ee.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:xe,onChange:Ee=>{je(Ee.target.checked),Ee.target.checked||Le([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),F&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>V(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),z?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ge.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:ge.map(Ne=>l.jsx("button",{type:"button",onClick:()=>ve(Ne),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:Ne.name})},Ne.id))})]}),k&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:Ne=>{_(Ne.target.value)},onFocus:()=>E(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),l.jsx("button",{type:"button",onClick:()=>{E(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&N&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!N&&O&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:O}),y.trim().length>=2&&!N&&!O&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!N&&!O&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(Ne=>l.jsxs("button",{type:"button",onClick:()=>_t(Ne,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:Ne.identifier})," - ",Ne.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Ne.stateName,Ne.teamName].filter(Boolean).join(" • ")})]},Ne.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),G&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{P(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),it&&l.jsx(gL,{defaultProjectId:Q==null?void 0:Q.projectId,connectionId:p??void 0,onCreated:xn,onClose:()=>ht(!1)})]}):null}function vL({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,x]=S.useState(!1),[b,y]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(C){_.current&&!_.current.contains(C.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?Ce.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&Ce.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{Ce.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),x(!g),y("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),C=h.filter(D=>!D.isRemote&&(!j||D.name.toLowerCase().includes(j))),k=h.filter(D=>D.isRemote&&(!j||D.name.toLowerCase().includes(j))),E=h.some(D=>D.name.toLowerCase()===j),N=C.length>0||k.length>0;return l.jsxs(l.Fragment,{children:[C.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),C.map(D=>l.jsxs("button",{onClick:()=>{o(D.name,!1),x(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${D.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:D.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[D.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[D.ahead,"↑"]}),D.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[D.behind,"↓"]}),D.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),D.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},D.name))]}),k.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(D=>l.jsxs("button",{onClick:()=>{o(D.name,!1),x(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${D.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:D.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${D.name}`))]}),!N&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!E&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),x(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:b.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const bL=336*60*60*1e3,da=12,yL=24;function Ug(e){return e.split("/").filter(Boolean).pop()||e}function o5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Ug(e.cwd)}function _L(e){return e.length>8?e.slice(0,8):e}function wL(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function SL(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function kL(){var es;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=S.useState([]),[y,_]=S.useState(()=>t5(localStorage.getItem("cc-backend")||"claude")),[j,C]=S.useState(()=>n5(localStorage.getItem("cc-backend")||"claude")),[k,E]=S.useState(()=>localStorage.getItem("cc-effort")||""),[N,D]=S.useState(()=>pf()[0]||""),[O,L]=S.useState([]),[G,P]=S.useState(null),[Q,B]=S.useState(!1),[I,M]=S.useState(""),[le,J]=S.useState(null),[Y,$]=S.useState(!1),[F,V]=S.useState(null),[ge,R]=S.useState(null),[z,Z]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),A=le||OS(p),ue=e5(p),xe=RR(p),[je,Re]=S.useState([]),[Le,Be]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Je,it]=S.useState(!1),[ht,Jt]=S.useState(!1),pt=cL(),[_t,Nt]=S.useState(()=>pt),[ve,Fe]=S.useState([]),[ct,xn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[Ne,ze]=S.useState(!1),mt=S.useRef(null),[Ee,$r]=S.useState(null),ae=S.useRef(null),_e=S.useRef(null),[W,pe]=S.useState(!1),[Me,Qe]=S.useState(!1),[nt,rt]=S.useState(!1),[St,vn]=S.useState(!1),[et,rr]=S.useState(!1),[En,Xr]=S.useState(""),[Fr,Ur]=S.useState(!0),[ne,me]=S.useState([]),[be,Xe]=S.useState(!1),[$t,cn]=S.useState(""),[Tn,Ft]=S.useState(!1),[zn,vr]=S.useState(da),[ja,$l]=S.useState(""),[On,Ds]=S.useState(null),[Fl,Ul]=S.useState(!1),[br,Qt]=S.useState(""),[Sn,ir]=S.useState(!1),[Il,jf]=S.useState([]),[zs,Os]=S.useState(null),[Kr,Yi]=S.useState(!1),[pi,Vn]=S.useState(""),[Bs,Zr]=S.useState(0),en=S.useRef(null),Gn=S.useRef(null),Na=S.useRef(null),Ir=S.useRef(null),Jr=S.useRef(null),Hl=S.useRef(null),ql=X(H=>H.currentSessionId),tn=PS({text:e,caretPos:Bs,cwd:N||void 0});S.useEffect(()=>{if(en.current===null||!Gn.current)return;const H=en.current;Gn.current.setSelectionRange(H,H),en.current=null},[e]),S.useEffect(()=>{var fe;window.matchMedia("(min-width: 640px)").matches&&((fe=Gn.current)==null||fe.focus())},[]),S.useEffect(()=>{Ce.getHome().then(({home:H,cwd:fe})=>{N||D(fe||H)}).catch(()=>{}),Ce.listEnvs().then(Re).catch(()=>{}),Ce.listSandboxes().then(Fe).catch(()=>{}),Ce.getBackends().then(b).catch(()=>{}),Ce.getSettings().then(H=>{$(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function Nf(H){g(H),localStorage.setItem("cc-backend",H),J(null),_(t5(H)),C(n5(H)),H!=="claude"&&(rr(!1),me([]),cn(""),Xe(!1),Ft(!1),vr(da),$l(""))}S.useEffect(()=>{if(p!=="codex"){J(null);return}Ce.getBackendModels(p).then(H=>{if(H.length>0){const fe=AR(H);J(fe),fe.some(Ke=>Ke.value===y)||_(fe[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(ae.current&&(clearInterval(ae.current),ae.current=null),$r(null),!_t)return;const H="the-companion:latest",fe=()=>{Ce.getImageStatus(H).then(Ke=>{$r(Ke),Ke.status==="idle"&&Ce.pullImage(H).catch(()=>{}),(Ke.status==="ready"||Ke.status==="error")&&ae.current&&(clearInterval(ae.current),ae.current=null)}).catch(()=>{})};return fe(),ae.current=setInterval(fe,2e3),()=>{ae.current&&(clearInterval(ae.current),ae.current=null)}},[_t]),S.useEffect(()=>{function H(fe){Na.current&&!Na.current.contains(fe.target)&&pe(!1),Ir.current&&!Ir.current.contains(fe.target)&&Qe(!1),Jr.current&&!Jr.current.contains(fe.target)&&rt(!1),Hl.current&&!Hl.current.contains(fe.target)&&it(!1),mt.current&&!mt.current.contains(fe.target)&&ze(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),S.useEffect(()=>{if(!N){Ds(null);return}Ce.getRepoInfo(N).then(H=>{Ds(H),Qt(H.currentBranch),ir(!1)}).catch(()=>{Ds(null),Qt(""),ir(!1)})},[N]);const Ps=A.find(H=>H.value===y)||A[0],Ca=ue.find(H=>H.value===j)||ue[0],Hr=xe.find(H=>H.value===k)||xe[0],Yn=p==="codex"?"/logo-codex.svg":"/logo.svg",Pc=N?N.split("/").pop()||N:"Select folder",Vl=S.useMemo(()=>En.trim(),[En]),Ea=p==="claude"&&et&&Vl.length>0,ei=S.useMemo(()=>{const H=Date.now()-bL;return ne.filter(fe=>fe.createdAt>=H)},[ne]),Wi=S.useMemo(()=>Tn?ne:ei.length>0?ei:ne,[Tn,ei,ne]),yr=S.useMemo(()=>ja.trim().toLowerCase(),[ja]),an=S.useMemo(()=>yr?Wi.filter(H=>{const fe=o5(H).toLowerCase(),Ke=Ug(H.cwd).toLowerCase(),gt=(H.gitBranch||"").toLowerCase(),st=H.cwd.toLowerCase(),He=H.resumeSessionId.toLowerCase();return fe.includes(yr)||Ke.includes(yr)||gt.includes(yr)||st.includes(yr)||He.includes(yr)}):Wi,[Wi,yr]),$s=S.useMemo(()=>an.slice(0,zn),[an,zn]),$c=zn<an.length,Ta=Math.max(0,ne.length-ei.length),Qi=!Tn&&ei.length>0,Aa=S.useCallback(async()=>{if(p==="claude"){Xe(!0),cn("");try{const[H,fe]=await Promise.all([Ce.listSessions(),Ce.discoverClaudeSessions(400).then(He=>He.sessions)]),Ke=new Map,gt=He=>{const Bn=Ke.get(He.resumeSessionId);(!Bn||He.createdAt>Bn.createdAt)&&Ke.set(He.resumeSessionId,He)};for(const He of H)He.backendType!=="codex"&&He.cliSessionId&&gt({resumeSessionId:He.cliSessionId,sessionId:He.sessionId,name:He.name,model:He.model,createdAt:He.createdAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"companion"});for(const He of fe)gt({resumeSessionId:He.sessionId,sessionId:He.sessionId,slug:He.slug,createdAt:He.lastActivityAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"claude_disk"});const st=Array.from(Ke.values()).sort((He,Bn)=>{const bn=N&&He.cwd===N?0:1,Sr=N&&Bn.cwd===N?0:1;return bn!==Sr?bn-Sr:Bn.createdAt-He.createdAt});me(st),Ft(!1),vr(da)}catch(H){const fe=H instanceof Error?H.message:String(H);cn(fe||"Failed to load existing sessions"),me([]),vr(da)}finally{Xe(!1)}}},[p,N]);S.useEffect(()=>{p==="claude"&&et&&Aa()},[p,et,Aa]),S.useEffect(()=>{vr(da)},[yr,Tn]);async function Gl(H){if(H.length===0)return;const fe=[],Ke=[];let gt=O.reduce((st,He)=>st+He.size,0);for(const st of H){if(st.size>ff){Ke.push(`${st.name} is too large (${Cs(st.size)}, max ${Cs(ff)})`);continue}if(gt+st.size>hf){Ke.push(`${st.name} would exceed the per-message limit (${Cs(hf)})`);continue}const{base64:He,mediaType:Bn}=await SS(st);fe.push({name:st.name,base64:He,mediaType:Bn,size:st.size}),gt+=st.size}fe.length>0&&L(st=>[...st,...fe]),P(Ke.length>0?Ke.join("; "):null)}async function Xi(H){const fe=H.target.files;fe&&(await Gl(Array.from(fe)),H.target.value="")}function Cf(H){L(fe=>fe.filter((Ke,gt)=>gt!==H))}async function Fc(H){var gt;const fe=(gt=H.clipboardData)==null?void 0:gt.items;if(!fe)return;const Ke=[];for(const st of Array.from(fe)){if(st.kind!=="file")continue;const He=st.getAsFile();if(!He)continue;const Bn=He.name&&He.name.length>0?He.name:`pasted-${Date.now()}.${(He.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ke.push(new File([He],Bn,{type:He.type,lastModified:He.lastModified}))}Ke.length>0&&(H.preventDefault(),await Gl(Ke))}function Uc(H){t(H.target.value),Zr(H.target.selectionStart??H.target.value.length);const fe=H.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Ma(){Gn.current&&Zr(Gn.current.selectionStart??0)}function Ic(H){var Ke;const fe=tn.selectPrompt(H);en.current=fe.nextCursor,t(fe.nextText),tn.setMentionMenuOpen(!1),Zr(fe.nextCursor),(Ke=Gn.current)==null||Ke.focus(),Gn.current&&(Gn.current.style.height="auto",Gn.current.style.height=Math.min(Gn.current.scrollHeight,200)+"px")}function Ef(H){if(tn.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),tn.setMentionMenuOpen(!1);return}if(tn.mentionMenuOpen&&tn.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),tn.setMentionMenuIndex(fe=>(fe+1)%tn.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),tn.setMentionMenuIndex(fe=>(fe-1+tn.filteredPrompts.length)%tn.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),Ic(tn.filteredPrompts[tn.mentionMenuIndex]);return}}if(tn.mentionMenuOpen&&tn.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault();const fe=e5(p),gt=(fe.findIndex(st=>st.value===j)+1)%fe.length;C(fe[gt].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),_r())}function Ra(H){const fe=i.trim(),Ke=fe?`[${fe}]: ${H}`:H;if(!F)return Ke;const gt=(F.description??"").trim();return`${["Linear issue context:",`- Identifier: ${F.identifier}`,`- Title: ${F.title}`,F.stateName?`- State: ${F.stateName}`:"",F.priorityLabel?`- Priority: ${F.priorityLabel}`:"",F.teamName?`- Team: ${F.teamName}`:"",`- URL: ${F.url}`,gt?`- Description:
111
+ ${gt}`:""].filter(Boolean).join(`
112
+ `)}
113
+
114
+ User request:
115
+ ${Ke}`}async function _r(){const H=e.trim();if(!(!H||Q)){if(n&&!i.trim()){M("Please enter your name before starting a session.");return}if(B(!0),M(""),Vn(""),On){const fe=br||On.currentBranch;if(fe&&fe===On.currentBranch){const Ke=Il.find(gt=>gt.name===fe&&!gt.isRemote);if(Ke&&Ke.behind>0){Os({behind:Ke.behind,branchName:fe});return}}}await Ki(H)}}async function Ki(H,fe){const Ke=X.getState();Ke.clearCreation(),Ke.setSessionCreating(!0,p);try{ql&&Im(ql);const gt=(fe==null?void 0:fe.resumeSessionAt)||(Ea?Vl:void 0),st=gt?(fe==null?void 0:fe.forkSession)??(Ea?Fr:void 0):void 0,He=(fe==null?void 0:fe.cwd)||N,Bn=(fe==null?void 0:fe.branch)!==void 0?fe.branch.trim()||void 0:br.trim()||void 0,bn=(fe==null?void 0:fe.useWorktree)!==void 0?fe.useWorktree:Fl,Sr=(fe==null?void 0:fe.createBranch)!==void 0?fe.createBranch:!!(Bn&&Sn),mi=await dE({model:y,permissionMode:j,effort:p==="claude"&&k?k:void 0,cwd:He||void 0,envSlug:Le||void 0,sandboxEnabled:_t?!0:void 0,sandboxSlug:_t&&ct?ct:void 0,branch:Bn,createBranch:Sr?!0:void 0,useWorktree:bn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:gt,forkSession:st,userName:i.trim()||void 0,linearConnectionId:F&&ge||void 0,linearIssue:F?{identifier:F.identifier,title:F.title,stateName:F.stateName,teamName:F.teamName,url:F.url}:void 0},ti=>{X.getState().addCreationProgress(ti)}),yn=mi.sessionId,Vc=X.getState(),Wl=Vc.sdkSessions.filter(ti=>ti.sessionId!==yn);Vc.setSdkSessions([...Wl,{sessionId:yn,state:mi.state,cwd:mi.cwd,createdAt:Date.now(),backendType:mi.backendType||p,model:y,permissionMode:j,userName:i.trim()||void 0,resumeSessionAt:gt,forkSession:gt?st===!0:void 0}]);const Ql=new Set(X.getState().sessionNames.values()),Us=b5(Ql),Is=o.trim()||i.trim(),Gc=f.trim()||Us,Yc=Is?`${Is}_${Gc}`:Gc;X.getState().setSessionName(yn,Yc),Ce.renameSession(yn,Yc).catch(()=>{}),h(""),He&&US(He),X.getState().setPreviousPermissionMode(yn,j),fx(yn,!0),Rc(yn),await MC(yn);const Wc=H.trim();if(Wc.length>0){const ti=Ra(Wc),Qc=$m(),Xc=O.length>0?O.map(za=>({name:za.name,media_type:za.mediaType,data:za.base64,size:za.size})):void 0;Fn(yn,{type:"user_message",content:ti,session_id:yn,attachments:Xc,client_msg_id:Qc}),X.getState().appendMessage(yn,{id:Qc,role:"user",content:ti,attachments:Xc,timestamp:Date.now()})}F&&(Ce.linkLinearIssue(yn,F,ge||void 0).then(()=>X.getState().setLinkedLinearIssue(yn,F)).catch(()=>{}),Ce.transitionLinearIssue(F.id,ge||void 0).catch(()=>{})),X.getState().clearCreation()}catch(gt){const st=gt instanceof Error?gt.message:String(gt);M(st),X.getState().setCreationError(st),B(!1)}}async function La(H,fe){Q||(B(!0),M(""),Vn(""),D(H.cwd),Ul(!1),ir(!1),Qt(H.gitBranch||""),Xr(H.resumeSessionId),Ur(fe),await Ki("",{resumeSessionAt:H.resumeSessionId,forkSession:fe,cwd:H.cwd,branch:H.gitBranch,useWorktree:!1,createBranch:!1}))}async function Zi(){if(zs){Yi(!0),Vn("");try{const H=N||(On==null?void 0:On.repoRoot);if(!H)throw new Error("No working directory");const fe=await Ce.gitPull(H);if(!fe.success){Vn(fe.output||"Pull failed"),Yi(!1),B(!1);return}Os(null),Yi(!1),await Ki(e.trim())}catch(H){Vn(H instanceof Error?H.message:String(H)),Yi(!1)}}}function Ji(){const H=e.trim();Os(null),Vn(""),Ki(H)}function Hc(){Os(null),Vn(""),B(!1)}const Yl=S.useCallback((H,fe)=>{Qt(H),ir(fe)},[]),qc=S.useCallback((H,fe)=>{Qt(H),ir(fe)},[]),Fs=S.useCallback(H=>{jf(H)},[]),wr=S.useCallback(H=>{V(H),!H&&On&&(Qt(On.currentBranch),ir(!1))},[On]),Da=e.trim().length>0&&!Q&&(!n||i.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:Yn,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:i,onChange:H=>{const fe=H.target.value;a(fe),localStorage.setItem("cc-user-name",fe)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:o,onChange:H=>{const fe=H.target.value;u(fe),localStorage.setItem("cc-session-prefix",fe)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:f,onChange:H=>h(H.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[o.trim()||i.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:_e,type:"file",multiple:!0,onChange:Xi,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(BS,{open:tn.mentionMenuOpen,loading:tn.promptsLoading,prompts:tn.filteredPrompts,selectedIndex:tn.mentionMenuIndex,onSelect:Ic,menuRef:tn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(F||O.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[F&&l.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:F.identifier}),l.jsx("span",{className:"truncate",children:F.title}),l.jsx("button",{type:"button",onClick:()=>wr(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),O.map((H,fe)=>l.jsx(NS,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>Cf(fe),className:"w-10 h-10"},fe))]}),G&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:G}),l.jsx("textarea",{ref:Gn,value:e,onChange:Uc,onKeyDown:Ef,onClick:Ma,onKeyUp:Ma,onPaste:Fc,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:Na,children:[l.jsxs("button",{onClick:()=>pe(!W),"aria-expanded":W,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:Ps.icon}),l.jsx("span",{children:Ps.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),W&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:A.map(H=>l.jsxs("button",{onClick:()=>{_(H.value),pe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${H.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:H.icon}),H.label]},H.value))})]}),xe.length>0&&l.jsxs("div",{className:"relative",ref:Jr,children:[l.jsxs("button",{onClick:()=>rt(!nt),"aria-expanded":nt,"aria-label":"Reasoning effort",title:"Reasoning effort",className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:Hr.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),nt&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:xe.map(H=>l.jsx("button",{onClick:()=>{E(H.value),localStorage.setItem("cc-effort",H.value),rt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:Ir,children:[l.jsxs("button",{onClick:()=>Qe(!Me),"aria-expanded":Me,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Ca.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Me&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:ue.map(H=>l.jsx("button",{onClick:()=>{C(H.value),Qe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>vn(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Pc})]}),St&&l.jsx(hL,{initialPath:N||"",onSelect:H=>{D(H)},onClose:()=>vn(!1)})]}),l.jsx(vL,{cwd:N,gitRepoInfo:On,selectedBranch:br,isNewBranch:Sn,useWorktree:Fl,onBranchChange:Yl,onWorktreeChange:Ul,onBranchesLoaded:Fs}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:Hl,children:[l.jsxs("button",{onClick:()=>{Je||Ce.listEnvs().then(Re).catch(()=>{}),it(!Je)},"aria-expanded":Je,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Le?((es=je.find(H=>H.slug===Le))==null?void 0:es.name)||"Env":"No env"})]}),Je&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{Be(""),localStorage.setItem("cc-selected-env",""),it(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Le?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),je.map(H=>l.jsxs("button",{onClick:()=>{Be(H.slug),localStorage.setItem("cc-selected-env",H.slug),it(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${H.slug===Le?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:H.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(H.variables).length," var",Object.keys(H.variables).length!==1?"s":""]})]},H.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{Jt(!0),it(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),pt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var H;return(H=_e.current)==null?void 0:H.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:_r,disabled:!Da,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Da?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[x.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:x.map(H=>l.jsxs("button",{onClick:()=>H.available&&Nf(H.id),disabled:!H.available,title:H.available?H.name:`${H.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${H.available?p===H.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[H.name,!H.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},H.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>rr(H=>!H),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${et?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":et,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${et?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":et?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!et||void 0,children:l.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void Aa(),disabled:be,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:be?"Refreshing...":"Refresh detected sessions"}),ne.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",$s.length," of ",an.length," ",yr?"matching":Qi?"recent":"detected"," Claude session",an.length!==1?"s":"","."]}),!Tn&&Ta>0&&ei.length>0&&l.jsxs("button",{type:"button",onClick:()=>{Ft(!0),vr(da)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",Ta,")"]}),Tn&&ei.length>0&&l.jsx("button",{type:"button",onClick:()=>{Ft(!1),vr(da)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:ja,onChange:H=>$l(H.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),$t&&l.jsx("p",{className:"text-[11px] text-cc-error",children:$t}),!be&&!$t&&an.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:yr?"No sessions match this search.":"No Claude sessions detected yet."}),$s.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:$s.map(H=>{const fe=o5(H),Ke=Ug(H.cwd),gt=H.source==="companion"?"Companion":"Claude",st=Vl===H.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${st?"text-cc-primary font-medium":"text-cc-fg"}`,children:fe}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:_L(H.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:gt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:H.cwd,children:[l.jsx("div",{className:"truncate",children:Ke}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:H.cwd,children:wL(H.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:H.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:SL(H.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{Xr(H.resumeSessionId),Ur(!0),La(H,!0)},"aria-label":`Fork and open ${fe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${st&&Fr?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
116
+ ${H.cwd}${H.gitBranch?` (${H.gitBranch})`:""}
117
+ ${H.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{Xr(H.resumeSessionId),Ur(!1),La(H,!1)},"aria-label":`Continue and open ${fe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${st&&!Fr?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
118
+ ${H.resumeSessionId}`,children:"Continue"})]})]},`${H.resumeSessionId}-row-${H.sessionId}`)})}),$c&&l.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:l.jsxs("button",{type:"button",onClick:()=>vr(H=>Math.min(H+yL,an.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",an.length-zn," remaining)"]})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),z&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{Z(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx(xL,{cwd:N,gitRepoInfo:On,linearConfigured:Y,selectedLinearIssue:F,onIssueSelect:wr,onBranchFromIssue:qc,onConnectionSelect:R})]}),zs&&l.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[l.jsx("span",{className:"font-mono-code font-medium",children:zs.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[zs.behind," commit",zs.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),pi&&l.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:pi}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Hc,disabled:Kr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:Ji,disabled:Kr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),l.jsx("button",{onClick:Zi,disabled:Kr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 transition-colors cursor-pointer flex items-center gap-1.5",children:Kr?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),I&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:I})]})]}),ht&&l.jsx(IS,{onClose:()=>{Jt(!1),Ce.listEnvs().then(Re).catch(()=>{})}})]})}const jL=[],NL=[],CL={connected:{label:"Connected",badge:"text-cc-success bg-cc-success/10",dot:"bg-cc-success"},connecting:{label:"Connecting",badge:"text-cc-warning bg-cc-warning/10",dot:"bg-cc-warning animate-pulse"},failed:{label:"Failed",badge:"text-cc-error bg-cc-error/10",dot:"bg-cc-error"},disabled:{label:"Disabled",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"}},EL={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function TL({server:e,sessionId:t}){var f,h;const[n,i]=S.useState(!1),a=CL[e.status]||EL,o=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>RC(t,e.name,!o),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${o?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:o?"Disable server":"Enable server",children:o?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>LC(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function AL({sessionId:e,onDone:t}){const[n,i]=S.useState(""),[a,o]=S.useState("stdio"),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,x]=S.useState(""),b=n.trim()&&(a==="stdio"?u.trim():g.trim());function y(_){if(_.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=g.trim(),DC(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:y,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>o(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.jsx("input",{type:"text",value:g,onChange:_=>x(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.jsx("button",{type:"submit",disabled:!b,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${b?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),l.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function ML({sessionId:e}){const t=X(f=>f.mcpServers.get(e)||jL),n=X(f=>f.cliConnected.get(e)??!1),[i,a]=S.useState(!1),o=X(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??NL});S.useEffect(()=>{n&&Hb(e)},[e,n]);const u=t.length>0?t:o.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>Hb(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(AL,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>l.jsx(TL,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function RL({cwd:e,open:t,onClose:n}){var I;const[i,a]=S.useState([]),[o,u]=S.useState(!0),[f,h]=S.useState(0),[p,g]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(!1),[j,C]=S.useState(null),[k,E]=S.useState(null),N=S.useCallback(()=>{u(!0),C(null),Ce.getClaudeMdFiles(e).then(M=>{a(M.files),M.files.length>0&&(h(0),g(M.files[0].content)),E(null),b(!1),u(!1)}).catch(M=>{C(M.message),u(!1)})},[e]);S.useEffect(()=>{t&&N()},[t,N]);const D=M=>{x&&!confirm("Discard unsaved changes?")||(h(M),g(i[M].content),b(!1),E(null))},O=async()=>{var le;const M=k||((le=i[f])==null?void 0:le.path);if(M){_(!0),C(null);try{await Ce.saveClaudeMd(M,p),b(!1),k?N():a(J=>J.map((Y,$)=>$===f?{...Y,content:p}:Y))}catch(J){C(J instanceof Error?J.message:"Failed to save")}finally{_(!1)}}},L=M=>{const le=M==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;E(le),g(`# CLAUDE.md
119
+
120
+ `),b(!0)},G=()=>{x&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const P=M=>M.startsWith(e+"/")?M.slice(e.length+1):M,Q=i.some(M=>M.path===`${e}/CLAUDE.md`),B=i.some(M=>M.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:G}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),l.jsx("button",{onClick:G,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 flex min-h-0",children:o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((M,le)=>l.jsxs("button",{onClick:()=>D(le),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!k&&f===le?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})}),l.jsx("span",{className:"truncate font-mono-code",children:P(M.path)})]},M.path)),k&&l.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"truncate font-mono-code",children:P(k)})]})]}),(!Q||!B)&&!k&&l.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!Q&&l.jsxs("button",{onClick:()=>L("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!B&&l.jsxs("button",{onClick:()=>L("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!k?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>L("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),l.jsx("button",{onClick:()=>L("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:P(k||(((I=i[f])==null?void 0:I.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[x&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:O,disabled:!x||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${x&&!y?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:y?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:p,onChange:M=>{g(M.target.value),b(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),j&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:j})]})]})})]})]})}function c5({icon:e,title:t,expanded:n,onToggle:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function Li({label:e,sublabel:t,count:n,onClick:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&l.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function LL({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:l.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function DL({path:e,label:t,onClose:n}){const[i,a]=S.useState(""),[o,u]=S.useState(!0),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[x,b]=S.useState(null);S.useEffect(()=>{Ce.readFile(e).then(j=>{a(j.content),u(!1)}).catch(j=>{b(j instanceof Error?j.message:"Failed to read file"),u(!1)})},[e]);const y=async()=>{g(!0),b(null);try{await Ce.writeFile(e,i),h(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{g(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[f&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!f||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${f&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:i,onChange:j=>{a(j.target.value),h(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),x&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:x})]})]})}function zL({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=S.useState(null),[o,u]=S.useState(!0);return S.useEffect(()=>{Ce.readFile(e.path).then(f=>{a(f.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(LL,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx(RL,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(DL,{path:e.path,label:e.label,onClose:n})}function OL({sessionId:e}){const t=X(k=>k.sessions.get(e)),n=X(k=>k.sdkSessions.find(E=>E.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=S.useState(null),[u,f]=S.useState(!0),[h,p]=S.useState(!1),[g,x]=S.useState(!1),[b,y]=S.useState(null),_=S.useCallback(async()=>{if(i)try{const k=await Ce.getClaudeConfig(i);o(k)}catch{}finally{f(!1)}},[i]);if(S.useEffect(()=>{_()},[_]),!i)return null;if(u)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!a)return null;const j=a.project.claudeMd.length+(a.project.settings?1:0)+(a.project.settingsLocal?1:0)+a.project.commands.length,C=(a.user.claudeMd?1:0)+a.user.skills.length+a.user.agents.length+(a.user.settings?1:0)+a.user.commands.length;return l.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[l.jsx(c5,{icon:"project",title:`Project (${j})`,expanded:h,onToggle:()=>p(k=>!k)}),h&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(k=>l.jsx(Li,{label:k.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:k.path,kind:"claude-md"})},k.path)),a.project.settings&&l.jsx(Li,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(Li,{label:"settings.local.json",onClick:()=>y({label:"settings.local.json",path:a.project.settingsLocal.path,kind:"json"})}),a.project.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.project.commands.length,")"]}),a.project.commands.map(k=>l.jsx(Li,{label:`/${k.name}`,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),j===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(c5,{icon:"user",title:`User (${C})`,expanded:g,onToggle:()=>x(k=>!k)}),g&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(Li,{label:"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:a.user.claudeMd.path,kind:"claude-md",editorCwd:a.user.root})}),a.user.skills.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",a.user.skills.length,")"]}),a.user.skills.map(k=>l.jsx(Li,{label:k.name,sublabel:k.description?k.description.slice(0,40):void 0,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),a.user.agents.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",a.user.agents.length,")"]}),a.user.agents.map(k=>l.jsx(Li,{label:k.name,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),a.user.settings&&l.jsx(Li,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.user.settings.path,kind:"json"})}),a.user.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.user.commands.length,")"]}),a.user.commands.map(k=>l.jsx(Li,{label:`/${k.name}`,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),C===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),b&&Ol.createPortal(l.jsx(zL,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function BL(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class PL extends S.Component{constructor(){super(...arguments);db(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Ms(n,{section:this.props.label})}render(){return this.state.hasError?l.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),l.jsx("button",{className:"text-[10px] text-cc-muted hover:text-cc-fg px-2 py-0.5 rounded bg-cc-hover cursor-pointer",onClick:()=>this.setState({hasError:!1}),children:"Retry"})]})}):this.props.children}}const HS=[],Bx=3e4,$L=6e4;let u5=null,d5=new Map;function FL(e){return e!==u5&&(u5=e,d5=new Map(e.map(t=>[t.sessionId,t]))),d5}function Bc(e){return X(S.useCallback(t=>FL(t.sdkSessions).get(e),[e]))}const qS="cc-panel-collapsed";function f5(){try{const e=localStorage.getItem(qS);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function UL(e){try{localStorage.setItem(qS,JSON.stringify([...e]))}catch{}}function VS({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[o,u]=S.useState(()=>f5().has(e)?!0:!i),f=S.useRef(!0);S.useEffect(()=>{if(f.current){f.current=!1;return}const p=f5();o?p.add(e):p.delete(e),UL(p)},[o,e]);const h=S.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:h,"aria-expanded":!o,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function IL(){const[e,t]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=S.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(VS,{id:"identity",label:"Identity",children:l.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),l.jsx("input",{type:"text",value:e,onChange:a=>{const o=a.target.value;t(o),localStorage.setItem("cc-user-name",o)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),l.jsx("input",{type:"text",value:n,onChange:a=>{const o=a.target.value;i(o),localStorage.setItem("cc-session-prefix",o)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",l.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",l.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function GS(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function YS(e){return e>80?"critical":e>50?"elevated":"normal"}function Sa({label:e,pct:t,detail:n}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&l.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),l.jsx("div",{role:"meter","aria-label":`${e} usage — ${YS(t)}`,"aria-valuenow":Math.round(t),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${GS(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function HL({sessionId:e}){var h;const[t,n]=S.useState(null),i=S.useCallback(async()=>{try{const p=await Ce.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=S.useRef(0);if(S.useEffect(()=>{i();const p=setInterval(()=>{a.current+=1,a.current%2===0?i():n(g=>g?{...g}:null)},Bx);return()=>clearInterval(p)},[i]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,f=!o&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!o&&!u&&!f?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(Sa,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?Q_(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(Sa,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?Q_(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&l.jsx("div",{role:"meter","aria-label":`Extra usage — ${YS(t.extra_usage.utilization)}`,"aria-valuenow":Math.round(t.extra_usage.utilization),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${GS(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function h5(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function qL(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await Ce.getSystemMemory();i||n(u)}catch{}};a();const o=setInterval(a,$L);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(Sa,{label:"Memory",pct:t.used_percent,detail:`${h5(t.used_bytes)} / ${h5(t.total_bytes)}`})}):null}function VL({sessionId:e}){const t=X(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=S.useState(0);if(S.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),Bx);return()=>clearInterval(o)},[t]),!t)return null;const{primary:i,secondary:a}=t;return!i&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&l.jsx(Sa,{label:`${X_(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?Fg(i.resetsAt):void 0}),a&&l.jsx(Sa,{label:`${X_(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?Fg(a.resetsAt):void 0})]})}function GL({sessionId:e}){const t=X(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=X(i=>{var a;return((a=i.sessions.get(e))==null?void 0:a.context_used_percent)??0});return t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ic(t.inputTokens)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ic(t.outputTokens)})]}),t.cachedInputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ic(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ic(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(Sa,{label:"Context",pct:n})]}):null}function YL(e,t){if(t)return{label:"Draft",cls:"text-cc-muted bg-cc-hover"};switch(e){case"OPEN":return{label:"Open",cls:"text-cc-success bg-cc-success/10"};case"MERGED":return{label:"Merged",cls:"text-cc-merged bg-cc-merged/10"};case"CLOSED":return{label:"Closed",cls:"text-cc-error bg-cc-error/10"}}}function WL({pr:e}){const t=YL(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&l.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),l.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&l.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[l.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),l.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),l.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function QL({sessionId:e}){const t=X(u=>u.sessions.get(e)),n=Bc(e),i=X(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),o=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return S.useEffect(()=>{i||!a||!o||Ce.getPRStatus(a,o).then(u=>{X.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(WL,{pr:i.pr})}const XL=6e4;function Rm(e,t){switch(e){case"completed":return{label:t||"Done",cls:"text-cc-success bg-cc-success/10"};case"cancelled":return{label:t||"Cancelled",cls:"text-cc-muted bg-cc-hover"};case"started":return{label:t||"In Progress",cls:"text-cc-info bg-cc-info/10"};case"unstarted":return{label:t||"Todo",cls:"text-cc-muted bg-cc-hover"};case"backlog":return{label:t||"Backlog",cls:"text-cc-muted bg-cc-hover"};default:return{label:t||e||"Unknown",cls:"text-cc-muted bg-cc-hover"}}}function KL({sessionId:e}){const t=X(M=>M.linkedLinearIssues.get(e)),[n,i]=S.useState([]),[a,o]=S.useState(null),[u,f]=S.useState([]),[h,p]=S.useState(""),[g,x]=S.useState(!1),[b,y]=S.useState(!1),[_,j]=S.useState(!1),[C,k]=S.useState(""),[E,N]=S.useState([]),[D,O]=S.useState(!1),L=S.useRef(null);S.useEffect(()=>{Ce.getLinkedLinearIssue(e).then(M=>{M.issue&&X.getState().setLinkedLinearIssue(e,M.issue)}).catch(()=>{})},[e]);const G=S.useCallback(async()=>{if(t)try{const M=await Ce.getLinkedLinearIssue(e,!0);M.issue&&(X.getState().setLinkedLinearIssue(e,M.issue),M.issue.stateType==="completed"&&y(!0)),M.comments&&i(M.comments),M.assignee!==void 0&&o(M.assignee??null),M.labels&&f(M.labels)}catch{}},[e,t]);S.useEffect(()=>{if(!t)return;G();const M=setInterval(G,XL);return()=>clearInterval(M)},[G,t]),S.useEffect(()=>{if(!_)return;const M=C.trim();if(M.length<2){N([]);return}let le=!0;O(!0);const J=setTimeout(()=>{Ce.searchLinearIssues(M,6).then(Y=>{le&&N(Y.issues)}).catch(()=>{le&&N([])}).finally(()=>{le&&O(!1)})},400);return()=>{le=!1,clearTimeout(J)}},[C,_]),S.useEffect(()=>{_&&setTimeout(()=>{var M;return(M=L.current)==null?void 0:M.focus()},50)},[_]);async function P(){if(!(!t||!h.trim()||g)){x(!0);try{const M=await Ce.addLinearComment(t.id,h.trim());i(le=>[...le,M.comment]),p("")}catch{}finally{x(!1)}}}async function Q(){try{await Ce.unlinkLinearIssue(e),X.getState().setLinkedLinearIssue(e,null),i([]),o(null),f([]),y(!1)}catch{}}async function B(M){try{await Ce.linkLinearIssue(e,M),X.getState().setLinkedLinearIssue(e,M),j(!1),k(""),N([])}catch{}}if(!t)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(gc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:L,type:"text",value:C,onChange:M=>k(M.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),k(""),N([])},"aria-label":"Close search",className:"w-7 h-7 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),D&&l.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),E.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:E.map(M=>l.jsxs("button",{onClick:()=>B(M),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:M.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${Rm(M.stateType,M.stateName).cls}`,children:Rm(M.stateType,M.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:M.title})]},M.id))}),C.trim().length>=2&&!D&&E.length===0&&l.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):l.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[l.jsx(gc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const I=Rm(t.stateType,t.stateName);return l.jsxs("div",{className:"shrink-0",children:[l.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(gc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${I.cls}`,children:I.label}),l.jsx("button",{onClick:Q,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(M=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${M.color}20`,color:M.color},children:M.name},M.id))})]}),b&&t.stateType==="completed"&&l.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:()=>y(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),l.jsx("button",{onClick:async()=>{try{await Ce.archiveSession(e),X.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(M=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:M.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:BL(new Date(M.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:M.body})]},M.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:h,onChange:M=>p(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),P())},placeholder:"Add a comment...","aria-label":"Add a comment",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:P,disabled:!h.trim()||g,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function ZL({sessionId:e}){const t=X(u=>u.rateLimit.get(e)),[,n]=S.useState(0);if(S.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(f=>f+1),Bx);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const i=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?Fg(t.resetsAt):void 0;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2","data-testid":"claude-rate-limit",children:[a!==void 0?l.jsx(Sa,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:o}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${i?"text-cc-error":"text-cc-warning"}`,children:[i?"rate limited":t.status,o&&` · resets ${o}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function JL({sessionId:e}){const t=X(a=>a.sessions.get(e)),n=Bc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(VL,{sessionId:e}),l.jsx(GL,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(ZL,{sessionId:e}),l.jsx(HL,{sessionId:e})]})}function eD({sessionId:e}){const t=X(p=>p.sessions.get(e)),n=Bc(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,o=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,f=(t==null?void 0:t.total_lines_removed)||0,h=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(a>0||o>0||u>0||f>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),o>0&&l.jsxs("span",{className:"text-cc-warning",children:[o,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&l.jsxs("span",{className:"text-cc-error",children:["-",f,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&h&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{Ce.gitPull(h).then(p=>{X.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Ms(new Error(`git pull failed: ${p.output}`))}).catch(p=>Ms(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function tD({sessionId:e}){const t=X(o=>o.sessionTasks.get(e)||HS),n=X(o=>o.sessions.get(e)),i=Bc(e),a=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||a?null:l.jsx("div",{className:"px-3 py-2",children:t.length===0?l.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):l.jsx("div",{className:"space-y-0.5",children:t.map(o=>l.jsx(lD,{task:o},o.id))})})}const nD={"usage-limits":JL,"server-memory":qL,"git-branch":eD,"github-pr":QL,"linear-issue":KL,"mcp-servers":ML,tasks:tD};function rD(e,t){const n=X(i=>i.sessionTasks.get(t)||HS);if(e==="tasks"&&n.length>0){const i=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function iD({isCodex:e}){const t=X(p=>p.taskPanelConfig),n=X(p=>p.toggleSectionEnabled),i=X(p=>p.moveSectionUp),a=X(p=>p.moveSectionDown),o=X(p=>p.resetTaskPanelConfig),u=X(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const g=Vi.find(x=>x.id===p);return!(!g||g.backends&&!g.backends.includes(f))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((p,g)=>{const x=Vi.find(j=>j.id===p),b=t.enabled[p]??!0,y=g===0,_=g===h.length-1;return l.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${b?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[l.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>i(p),disabled:y,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),l.jsx("button",{onClick:()=>a(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:x.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:x.description})]}),l.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${b?"bg-cc-primary":"bg-cc-hover"}`,title:b?"Hide section":"Show section",role:"switch","aria-checked":b,"data-testid":`toggle-${p}`,children:l.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${b?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),l.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[l.jsx("button",{onClick:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function sD({sectionId:e,sessionId:t,children:n}){var o;const i=((o=Vi.find(u=>u.id===e))==null?void 0:o.label)??e,a=rD(e,t);return l.jsx(VS,{id:e,label:i,badge:a,children:n})}function aD({sessionId:e}){const t=X(g=>g.sessions.get(e)),n=Bc(e),i=X(g=>g.taskPanelOpen),a=X(g=>g.setTaskPanelOpen),o=X(g=>g.taskPanelConfigMode),u=X(g=>g.taskPanelConfig);if(!i)return null;const f=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",h=f?"codex":"claude",p=u.order.filter(g=>{const x=Vi.find(b=>b.id===g);return!(!x||x.backends&&!x.backends.includes(h))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:o?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{o?X.getState().setTaskPanelConfigMode(!1):a(!1)},"aria-label":"Close panel",className:"flex items-center justify-center w-8 h-8 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),o?l.jsx(iD,{isCodex:f}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[l.jsx(IL,{}),l.jsx(OL,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var b;const x=nD[g];return x?l.jsx(sD,{sectionId:g,sessionId:e,children:l.jsx(PL,{label:(b=Vi.find(y=>y.id===g))==null?void 0:b.label,children:l.jsx(x,{sessionId:e})})},g):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>X.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M7.429 1.525a6.593 6.593 0 011.142 0c.036.003.108.036.137.146l.289 1.105c.147.56.55.967.997 1.189.174.086.341.183.501.29.417.278.97.423 1.53.27l1.102-.303c.11-.03.175.016.195.046.219.31.41.641.573.989.014.031.022.11-.059.19l-.815.806c-.411.406-.562.957-.53 1.456a4.588 4.588 0 010 .582c-.032.499.119 1.05.53 1.456l.815.806c.08.08.073.159.059.19a6.494 6.494 0 01-.573.99c-.02.029-.086.074-.195.045l-1.103-.303c-.559-.153-1.112-.008-1.529.27-.16.107-.327.204-.5.29-.449.222-.851.628-.998 1.189l-.289 1.105c-.029.11-.101.143-.137.146a6.613 6.613 0 01-1.142 0c-.036-.003-.108-.037-.137-.146l-.289-1.105c-.147-.56-.55-.967-.997-1.189a4.502 4.502 0 01-.501-.29c-.417-.278-.97-.423-1.53-.27l-1.102.303c-.11.03-.175-.016-.195-.046a6.492 6.492 0 01-.573-.989c-.014-.031-.022-.11.059-.19l.815-.806c.411-.406.562-.957.53-1.456a4.587 4.587 0 010-.582c.032-.499-.119-1.05-.53-1.456l-.815-.806c-.08-.08-.073-.159-.059-.19a6.44 6.44 0 01.573-.99c.02-.029.086-.074.195-.045l1.103.303c.559.153 1.112.008 1.529-.27.16-.107.327-.204.5-.29.449-.222.851-.628.998-1.189l.289-1.105c.029-.11.101-.143.137-.146zM8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",clipRule:"evenodd"})}),"Customize panel"]})})]})]})}function lD({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?l.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),l.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),l.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&l.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&l.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),l.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function oD({status:e}){return e==="created"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-green-500/20 text-green-400",children:"A"}):e==="deleted"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-red-500/20 text-red-400",children:"D"}):l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-cc-warning/20 text-cc-warning",children:"M"})}function cD({sessionId:e}){const t=X(O=>O.sessions.get(e)),n=X(O=>O.sdkSessions.find(L=>L.sessionId===e)),i=X(O=>O.diffPanelSelectedFile.get(e)??null),a=X(O=>O.setDiffPanelSelectedFile),o=X(O=>O.diffBase),u=X(O=>O.setDiffBase),f=X(O=>O.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,g]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,C]=S.useState([]),k=X(O=>O.setGitChangedFilesCount);S.useEffect(()=>{if(!h)return;let O=!1;return Ce.getChangedFiles(h,o).then(({files:L})=>{if(O)return;const G=`${h}/`,P=L.filter(Q=>Q.path===h||Q.path.startsWith(G)).map(Q=>({abs:Q.path,rel:Q.path.startsWith(G)?Q.path.slice(G.length):Q.path,status:Q.status==="A"||Q.status==="?"?"created":Q.status==="D"?"deleted":"updated"})).sort((Q,B)=>Q.rel.localeCompare(B.rel));C(P),k(e,P.length)}).catch(()=>{O||(C([]),k(e,0))}),()=>{O=!0}},[h,o,f,e,k]);const E=j;S.useEffect(()=>{!i&&E.length>0&&a(e,E[0].abs)},[i,E,e,a]),S.useEffect(()=>{var O;i&&(E.some(L=>L.abs===i)||a(e,((O=E[0])==null?void 0:O.abs)??null))},[i,E,e,a]),S.useEffect(()=>{if(!i){g("");return}let O=!1;return b(!0),Ce.getFileDiff(i,o).then(L=>{O||(g(L.diff),b(!1))}).catch(()=>{O||(g(""),b(!1))}),()=>{O=!0}},[i,o]);const N=S.useCallback(O=>{a(e,O),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),D=S.useMemo(()=>!i||!h?i:i.startsWith(h+"/")?i.slice(h.length+1):i,[i,h]);return h?E.length===0?l.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:l.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"File changes compared to the base will appear here once the agent edits files."})]})]}):l.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[y&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),l.jsxs("div",{className:`
121
+ ${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
122
+ fixed sm:relative z-30 sm:z-auto
123
+ ${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
124
+ shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
125
+ `,children:[l.jsxs("div",{className:"w-[220px] px-4 py-3 text-[11px] font-semibold text-cc-fg uppercase tracking-wider border-b border-cc-border shrink-0 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),l.jsxs("span",{children:["Changed (",E.length,")"]})]}),l.jsx("button",{onClick:()=>_(!1),className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer sm:hidden",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:E.map(({abs:O,rel:L,status:G})=>l.jsxs("button",{onClick:()=>N(O),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${O===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(oD,{status:G}),l.jsx("span",{className:"truncate leading-snug",children:L})]},O))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&l.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!y&&l.jsx("button",{onClick:()=>_(!0),className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",title:"Show file list",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:D==null?void 0:D.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:D})]}),l.jsx("button",{onClick:()=>u(o==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${o==="last-commit"?"default branch":"last commit"} comparison`,children:o==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:x?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?l.jsx("div",{className:"p-4",children:l.jsx(Dl,{unifiedDiff:p,fileName:D||void 0,mode:"full"})}):l.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!y&&l.jsxs("button",{onClick:()=>_(!0),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),"Show file list"]}),l.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:l.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function uD(){const e=X(h=>h.updateInfo),t=X(h=>h.updateDismissedVersion),n=X(h=>h.dismissUpdate),[i,a]=S.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const o=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await Ce.triggerUpdate(),X.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),Ms(h),a(!1)}},u=()=>{n(e.latestVersion)},f=i||e.updateInProgress;return l.jsxs("div",{className:"px-4 py-1.5 bg-cc-primary/10 border-b border-cc-primary/20 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.2s_ease-out]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 2a.75.75 0 0 0-.75.75v3.69L5.78 6.15a.75.75 0 0 0-.96 1.15l2.5 2.08a.75.75 0 0 0 1.08-.12l2-2.5a.75.75 0 1 0-1.17-.94L8.75 6.5V3.75A.75.75 0 0 0 8 3z"})}),l.jsxs("span",{className:"text-xs text-cc-fg",children:[l.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",l.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?l.jsx("button",{onClick:o,disabled:f,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Updating...":"Update & Restart"}):l.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",l.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," ","for auto-updates"]}),l.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function dD({steps:e,error:t,backend:n,onCancel:i}){const a=n==="codex"?"/logo-codex.svg":"/logo.svg",o=e.some(x=>x.status==="in_progress"),u=e.length>0&&e.every(x=>x.status==="done"),f=e.some(x=>x.status==="error")||!!t,h=[...e].reverse().find(x=>x.status==="in_progress"),p=[...e].reverse().find(x=>x.status==="done"),g=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.label)||(p==null?void 0:p.label)||"Preparing...";return l.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-cc-bg/95 backdrop-blur-sm animate-fade-in",children:[l.jsxs("div",{className:"relative mb-8",children:[o&&!f&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:a,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${o&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),o&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:g}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((x,b)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${b*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[x.status==="in_progress"&&l.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),x.status==="done"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:l.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),x.status==="error"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.jsx("span",{className:`text-xs transition-colors duration-200 ${x.status==="in_progress"?"text-cc-fg font-medium":x.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:x.label}),x.detail&&x.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:x.detail})]},x.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(f||o)&&i&&l.jsx("button",{onClick:i,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:f?"Dismiss":"Cancel"}),!f&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(x=>x.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function fD(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const hD={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function pD(e){const[t,n]=S.useState("installing"),i=S.useRef(null),a=S.useRef(!0);return S.useEffect(()=>(a.current=!0,()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[]),S.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),f()},5e3);function f(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:fD()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(f,1500)})}return()=>{clearTimeout(o),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function WS({phase:e,className:t}){const n=e==="ready";return l.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[l.jsxs("div",{className:"relative mb-8",children:[!n&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),n&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),l.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:hD[e]}),l.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&l.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>l.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${i*.2}s`}},i))}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-1000 ease-out",style:{width:n?"100%":e==="waiting"?"75%":e==="restarting"?"40%":"15%"}})})]})}function mD({active:e}){const t=pD(e);return e?l.jsx(WS,{phase:t,className:"fixed inset-0 z-[100]"}):null}function HD({phase:e}){return l.jsx(WS,{phase:e,className:"absolute inset-0"})}function gD(){const e=X(j=>j.dockerUpdateDialogOpen),t=X(j=>j.setDockerUpdateDialogOpen),[n,i]=S.useState("prompt"),[a,o]=S.useState(!1),[u,f]=S.useState(null),h=S.useRef(null);if(S.useEffect(()=>{e&&Ce.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),S.useEffect(()=>{if(n!=="pulling"){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{Ce.getImageStatus("the-companion:latest").then(j=>{f(j),j.status==="ready"?i("done"):j.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function p(){i("pulling"),Ce.pullImage("the-companion:latest").then(j=>{j.state&&f(j.state)}).catch(()=>{i(j=>j==="pulling"?"error":j)})}function g(){p()}function x(){y()}function b(){y()}function y(){i("prompt"),f(null),t(!1)}async function _(){const j=!a;o(j);try{await Ce.updateSettings({dockerAutoUpdate:j})}catch{o(!j)}}return l.jsx("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-black/50 animate-fade-in","data-testid":"docker-update-dialog",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-md mx-4 overflow-hidden",children:[n==="prompt"&&l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("button",{type:"button",onClick:_,className:"w-full flex items-center justify-between px-3 py-3 rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer mb-5",children:[l.jsx("span",{children:"Always update Docker image automatically"}),l.jsx("span",{role:"switch","aria-checked":a,"aria-label":"Always update Docker image automatically",className:`relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ${a?"bg-cc-primary":"bg-cc-border"}`,children:l.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${a?"translate-x-4":"translate-x-0"}`})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:x,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),l.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-3",children:"Pulling the-companion:latest"}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[160px] overflow-auto whitespace-pre-wrap","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
126
+ `)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
127
+ `)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function qD({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
128
+ Layer 1/5: abc123 downloading
129
+ Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const Lm=["welcome","claude","codex","done"],p5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Ig(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function xD({onComplete:e}){const[t,n]=S.useState("welcome"),[i,a]=S.useState(""),[o,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(!1),[j,C]=S.useState(Ig),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>C(!0))},[j]),S.useEffect(()=>{const I=k.current;if(!I)return;function M(J){if(J.key==="Escape"){J.preventDefault();return}if(J.key!=="Tab")return;const Y=I.querySelectorAll(p5);if(Y.length===0)return;const $=Y[0],F=Y[Y.length-1];J.shiftKey?document.activeElement===$&&(J.preventDefault(),F.focus()):document.activeElement===F&&(J.preventDefault(),$.focus())}document.addEventListener("keydown",M);const le=I.querySelector(p5);return le==null||le.focus(),()=>document.removeEventListener("keydown",M)},[t]);const E=S.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await Ce.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(I){g(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[i]),N=S.useCallback(async()=>{h(!0),g("");try{(await Ce.getSettings()).codexDeviceAuthConfigured?(_(!0),await O()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(I){g(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),D=S.useCallback(async()=>{h(!0),g("");try{await Ce.updateSettings({openaiApiKey:o.trim()}),_(!0),await O()}catch(I){g(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[o]),O=S.useCallback(async()=>{try{await Ce.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=S.useCallback(()=>{e()},[e]),G=S.useCallback(async()=>{await O(),e()},[O,e]),P=S.useCallback(I=>{g(""),n(I)},[]),Q=Lm.indexOf(t),B=Ig();return Ol.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:j?1:0,transition:B?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:B?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${Q+1} of ${Lm.length-1}`,children:Lm.slice(0,3).map((I,M)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:M===Q?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:M<=Q?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:M<=Q?1:.5}},I))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(vD,{onSetupClaude:()=>P("claude"),onSetupCodex:()=>P("codex")}),t==="claude"&&l.jsx(bD,{token:i,onTokenChange:a,onSave:E,onSkip:()=>P("codex"),saving:f,error:p}),t==="codex"&&l.jsx(yD,{apiKey:o,onApiKeyChange:u,onCheckAuth:N,onSaveApiKey:D,onSkip:()=>O(),onBack:()=>P("claude"),saving:f,error:p}),t==="done"&&l.jsx(_D,{claudeConfigured:x,codexConfigured:y,onDone:L})]}),t==="welcome"&&l.jsx("button",{onClick:G,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function vD({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function bD({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(QS,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?f:void 0,"aria-invalid":o?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),o&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function yD({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(QS,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"sk-...","aria-describedby":f?g:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function _D({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=Ig(),[o,u]=S.useState(a);return S.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function QS({text:e}){const[t,n]=S.useState(!1),i=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const wD=S.lazy(()=>qn(()=>import("./Playground-Bqem71ld.js"),[]).then(e=>({default:e.Playground}))),SD=S.lazy(()=>qn(()=>import("./SettingsPage-DUB7VAB0.js"),[]).then(e=>({default:e.SettingsPage}))),kD=S.lazy(()=>qn(()=>import("./IntegrationsPage-Bqv42W3i.js"),[]).then(e=>({default:e.IntegrationsPage}))),jD=S.lazy(()=>qn(()=>import("./LinearSettingsPage-WeCjhb6F.js"),[]).then(e=>({default:e.LinearSettingsPage}))),ND=S.lazy(()=>qn(()=>import("./LinearOAuthSettingsPage-DAML8DmR.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),CD=S.lazy(()=>qn(()=>import("./TailscalePage-LvoL8jEr.js"),[]).then(e=>({default:e.TailscalePage}))),ED=S.lazy(()=>qn(()=>import("./PromptsPage-DEd1pXYT.js"),[]).then(e=>({default:e.PromptsPage}))),TD=S.lazy(()=>qn(()=>Promise.resolve().then(()=>dL),void 0).then(e=>({default:e.EnvManager}))),AD=S.lazy(()=>qn(()=>import("./SandboxManager-D0scOW6K.js"),[]).then(e=>({default:e.SandboxManager}))),MD=S.lazy(()=>qn(()=>import("./CronManager-gAJuzdBX.js"),[]).then(e=>({default:e.CronManager}))),RD=S.lazy(()=>qn(()=>import("./AgentsPage-D0oX-gzR.js"),[]).then(e=>({default:e.AgentsPage}))),LD=S.lazy(()=>qn(()=>import("./RunsPage-BEXPCpuv.js"),[]).then(e=>({default:e.RunsPage}))),DD=S.lazy(()=>qn(()=>import("./DashboardPage-D_mMLeUh.js"),[]).then(e=>({default:e.DashboardPage})));function fr(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function zD(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function OD(){const e=X(V=>V.isAuthenticated),t=X(V=>V.darkMode),n=X(V=>V.currentSessionId),i=X(V=>V.sidebarOpen),a=X(V=>V.taskPanelOpen),o=X(V=>V.homeResetKey),u=X(V=>V.activeTab),f=X(V=>V.sessionCreating),h=X(V=>V.sessionCreatingBackend),p=X(V=>V.creationProgress),g=X(V=>V.creationError),x=X(V=>V.updateOverlayActive),b=zD(),y=S.useMemo(()=>dx(b),[b]),_=y.page==="settings",j=y.page==="prompts",C=y.page==="integrations",k=y.page==="integration-linear",E=y.page==="integration-linear-oauth",N=y.page==="integration-tailscale",D=y.page==="environments",O=y.page==="sandboxes",L=y.page==="scheduled",G=y.page==="agents"||y.page==="agent-detail",P=y.page==="runs",Q=y.page==="dashboard",B=y.page==="session"||y.page==="home";S.useEffect(()=>{cE(b||"#/")},[b]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const I=S.useRef(X.getState().currentSessionId);S.useEffect(()=>{if(I.current!==null&&y.page==="home"){fx(I.current,!0),I.current=null;return}if(I.current=null,y.page==="session"){const V=X.getState();V.currentSessionId!==y.sessionId&&V.setCurrentSession(y.sessionId),Rc(y.sessionId)}else if(y.page==="home"){const V=X.getState();V.currentSessionId!==null&&V.setCurrentSession(null)}},[y]);const M=X(V=>n?V.changedFilesTick.get(n)??0:0),le=X(V=>V.diffBase),J=X(V=>V.setGitChangedFilesCount),Y=X(V=>{var ge,R;return n&&(((ge=V.sessions.get(n))==null?void 0:ge.cwd)||((R=V.sdkSessions.find(z=>z.sessionId===n))==null?void 0:R.cwd))||null});S.useEffect(()=>{if(!n||!Y)return;let V=!1;return Ce.getChangedFiles(Y,le).then(({files:ge})=>{if(V)return;const R=`${Y}/`,z=ge.filter(Z=>Z.path===Y||Z.path.startsWith(R)).length;J(n,z)}).catch(()=>{}),()=>{V=!0}},[n,Y,le,M,J]),S.useEffect(()=>{const V=()=>{Ce.checkForUpdate().then(R=>{X.getState().setUpdateInfo(R)}).catch(()=>{})};V();const ge=setInterval(V,300*1e3);return()=>clearInterval(ge)},[]),S.useEffect(()=>{const V=()=>{Ce.getClaudeCompat().then(R=>{X.getState().setClaudeCompatInfo(R)}).catch(()=>{})};V();const ge=setInterval(V,300*1e3);return()=>clearInterval(ge)},[]);const[$,F]=S.useState(!1);return S.useEffect(()=>{e&&Ce.getSettings().then(V=>{V.publicUrl&&X.getState().setPublicUrl(V.publicUrl),V.onboardingCompleted||F(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?y.page==="playground"?l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(wD,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
130
+ fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
131
+ h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
132
+ ${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
133
+ overflow-hidden
134
+ `,children:l.jsx(EE,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(lL,{}),l.jsx(uD,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[_&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(SD,{embedded:!0})})}),j&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(ED,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(kD,{embedded:!0})})}),k&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(jD,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(ND,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(CD,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(TD,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(AD,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(MD,{embedded:!0})})}),G&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(RD,{route:y})})}),P&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(LD,{})})}),Q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(DD,{})})}),B&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(cD,{sessionId:n}):l.jsx(iL,{sessionId:n}):l.jsx(kL,{},o)}),f&&p&&p.length>0&&l.jsx(dD,{steps:p,error:g,backend:h??void 0,onCancel:()=>X.getState().clearCreation()})]})]})]}),n&&B&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>X.getState().setTaskPanelOpen(!0),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 z-30 items-center gap-1 rounded-l-lg border border-r-0 border-cc-border bg-cc-card/95 backdrop-blur px-2 py-2 text-[11px] text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Open context panel",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v11a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 13.5v-11zm2 .5v10h6V3H5z"})}),l.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),a&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>X.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
135
+ fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
136
+ h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
137
+ ${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
138
+ overflow-hidden
139
+ `,children:l.jsx(aD,{sessionId:n})})]}),l.jsx(mD,{active:x}),l.jsx(gD,{}),$&&l.jsx(xD,{onComplete:()=>F(!1)})]}):l.jsx(mE,{})}class BD extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Ms(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}oE();rN.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(BD,{children:l.jsx(OD,{})})}));qn(()=>import("./sw-register-wPB-1Nly.js"),[]).catch(()=>{});export{WR as A,t5 as B,iL as C,$D as D,OS as E,hL as F,WL as G,AR as H,ID as I,UD as J,gc as L,eR as M,OR as P,dD as S,k5 as T,uD as U,qn as _,Ce as a,fm as b,Dl as c,HD as d,wE as e,qD as f,lE as g,dR as h,cL as i,l as j,fR as k,sL as l,VL as m,fx as n,GL as o,Es as p,Nl as q,S as r,FD as s,BL as t,X as u,xc as v,RL as w,Ld as x,Mc as y,Ol as z};