@hellcoder/companion 0.104.4-preview.20260622030455.280fa4c → 0.105.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.
- package/dist/assets/{AgentsPage-C_uaskvu.js → AgentsPage-BeDMkE2_.js} +1 -1
- package/dist/assets/{CronManager-_ScZYZUL.js → CronManager-B_DSvQtN.js} +1 -1
- package/dist/assets/{IntegrationsPage-j39LFDWj.js → IntegrationsPage-ClbDqoEP.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-B437XSi7.js → LinearOAuthSettingsPage-BEeYBnSb.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CrHvZJ2l.js → LinearSettingsPage-DN2raNtR.js} +1 -1
- package/dist/assets/{Playground-Vo-LT0XD.js → Playground-Dlv72b_8.js} +1 -1
- package/dist/assets/{PromptsPage-CBFfssun.js → PromptsPage-BOxtGtfT.js} +1 -1
- package/dist/assets/{RunsPage-CzkUlLNh.js → RunsPage-CYUUHysG.js} +1 -1
- package/dist/assets/{SandboxManager-F4OKDTsR.js → SandboxManager-B90xK3cu.js} +1 -1
- package/dist/assets/{SettingsPage-BMOYx-nn.js → SettingsPage-SvStjnbd.js} +1 -1
- package/dist/assets/{TailscalePage-Cs98ENqe.js → TailscalePage-C5J3VAqt.js} +1 -1
- package/dist/assets/index-CDV255Wl.js +136 -0
- package/dist/assets/{sw-register-CNrT7Vew.js → sw-register-BPlfMfHI.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/index-BkJgPfVV.js +0 -136
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var tj=Object.defineProperty;var nj=(e,t,n)=>t in e?tj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Y1=(e,t,n)=>nj(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function n(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=n(l);fetch(l.href,c)}})();const rj="modulepreload",sj=function(e){return"/"+e},Q1={},Jn=function(t,n,s){let l=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};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"));l=u(n.map(p=>{if(p=sj(p),p in Q1)return;Q1[p]=!0;const g=p.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":rj,g||(y.as="script"),y.crossOrigin="",y.href=p,h&&y.setAttribute("nonce",h),document.head.appendChild(y),g)return new Promise((b,_)=>{y.addEventListener("load",b),y.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return l.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})};function Eg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fp={exports:{}},Mo={};/**
|
|
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 X1;function ij(){if(X1)return Mo;X1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:s,key:u,ref:l!==void 0?l:null,props:c}}return Mo.Fragment=t,Mo.jsx=n,Mo.jsxs=n,Mo}var W1;function aj(){return W1||(W1=1,fp.exports=ij()),fp.exports}var a=aj(),hp={exports:{}},Ge={};/**
|
|
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 K1;function lj(){if(K1)return Ge;K1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=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"),v=Symbol.for("react.activity"),y=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function k(P,Z,M){this.props=P,this.context=Z,this.refs=E,this.updater=M||_}k.prototype.isReactComponent={},k.prototype.setState=function(P,Z){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,Z,"setState")},k.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function A(){}A.prototype=k.prototype;function C(P,Z,M){this.props=P,this.context=Z,this.refs=E,this.updater=M||_}var D=C.prototype=new A;D.constructor=C,j(D,k.prototype),D.isPureReactComponent=!0;var O=Array.isArray;function L(){}var I={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function G(P,Z,M){var he=M.ref;return{$$typeof:e,type:P,key:Z,ref:he!==void 0?he:null,props:M}}function B(P,Z){return G(P.type,Z,P.props)}function F(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function T(P){var Z={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(M){return Z[M]})}var le=/\/+/g;function W(P,Z){return typeof P=="object"&&P!==null&&P.key!=null?T(""+P.key):Z.toString(36)}function Y(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(L,L):(P.status="pending",P.then(function(Z){P.status==="pending"&&(P.status="fulfilled",P.value=Z)},function(Z){P.status==="pending"&&(P.status="rejected",P.reason=Z)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function U(P,Z,M,he,_e){var Ce=typeof P;(Ce==="undefined"||Ce==="boolean")&&(P=null);var Re=!1;if(P===null)Re=!0;else switch(Ce){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(P.$$typeof){case e:case t:Re=!0;break;case g:return Re=P._init,U(Re(P._payload),Z,M,he,_e)}}if(Re)return _e=_e(P),Re=he===""?"."+W(P,0):he,O(_e)?(M="",Re!=null&&(M=Re.replace(le,"$&/")+"/"),U(_e,Z,M,"",function(Je){return Je})):_e!=null&&(F(_e)&&(_e=B(_e,M+(_e.key==null||P&&P.key===_e.key?"":(""+_e.key).replace(le,"$&/")+"/")+Re)),Z.push(_e)),1;Re=0;var Le=he===""?".":he+":";if(O(P))for(var Be=0;Be<P.length;Be++)he=P[Be],Ce=Le+W(he,Be),Re+=U(he,Z,M,Ce,_e);else if(Be=b(P),typeof Be=="function")for(P=Be.call(P),Be=0;!(he=P.next()).done;)he=he.value,Ce=Le+W(he,Be++),Re+=U(he,Z,M,Ce,_e);else if(Ce==="object"){if(typeof P.then=="function")return U(Y(P),Z,M,he,_e);throw Z=String(P),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Re}function z(P,Z,M){if(P==null)return P;var he=[],_e=0;return U(P,he,"","",function(Ce){return Z.call(M,Ce,_e++)}),he}function se(P){if(P._status===-1){var Z=P._result;Z=Z(),Z.then(function(M){(P._status===0||P._status===-1)&&(P._status=1,P._result=M)},function(M){(P._status===0||P._status===-1)&&(P._status=2,P._result=M)}),P._status===-1&&(P._status=0,P._result=Z)}if(P._status===1)return P._result.default;throw P._result}var me=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},R={map:z,forEach:function(P,Z,M){z(P,function(){Z.apply(this,arguments)},M)},count:function(P){var Z=0;return z(P,function(){Z++}),Z},toArray:function(P){return z(P,function(Z){return Z})||[]},only:function(P){if(!F(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Ge.Activity=v,Ge.Children=R,Ge.Component=k,Ge.Fragment=n,Ge.Profiler=l,Ge.PureComponent=C,Ge.StrictMode=s,Ge.Suspense=h,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(P){return I.H.useMemoCache(P)}},Ge.cache=function(P){return function(){return P.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(P,Z,M){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var he=j({},P.props),_e=P.key;if(Z!=null)for(Ce in Z.key!==void 0&&(_e=""+Z.key),Z)!$.call(Z,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&Z.ref===void 0||(he[Ce]=Z[Ce]);var Ce=arguments.length-2;if(Ce===1)he.children=M;else if(1<Ce){for(var Re=Array(Ce),Le=0;Le<Ce;Le++)Re[Le]=arguments[Le+2];he.children=Re}return G(P.type,_e,he)},Ge.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},Ge.createElement=function(P,Z,M){var he,_e={},Ce=null;if(Z!=null)for(he in Z.key!==void 0&&(Ce=""+Z.key),Z)$.call(Z,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(_e[he]=Z[he]);var Re=arguments.length-2;if(Re===1)_e.children=M;else if(1<Re){for(var Le=Array(Re),Be=0;Be<Re;Be++)Le[Be]=arguments[Be+2];_e.children=Le}if(P&&P.defaultProps)for(he in Re=P.defaultProps,Re)_e[he]===void 0&&(_e[he]=Re[he]);return G(P,Ce,_e)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(P){return{$$typeof:f,render:P}},Ge.isValidElement=F,Ge.lazy=function(P){return{$$typeof:g,_payload:{_status:-1,_result:P},_init:se}},Ge.memo=function(P,Z){return{$$typeof:p,type:P,compare:Z===void 0?null:Z}},Ge.startTransition=function(P){var Z=I.T,M={};I.T=M;try{var he=P(),_e=I.S;_e!==null&&_e(M,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(L,me)}catch(Ce){me(Ce)}finally{Z!==null&&M.types!==null&&(Z.types=M.types),I.T=Z}},Ge.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ge.use=function(P){return I.H.use(P)},Ge.useActionState=function(P,Z,M){return I.H.useActionState(P,Z,M)},Ge.useCallback=function(P,Z){return I.H.useCallback(P,Z)},Ge.useContext=function(P){return I.H.useContext(P)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(P,Z){return I.H.useDeferredValue(P,Z)},Ge.useEffect=function(P,Z){return I.H.useEffect(P,Z)},Ge.useEffectEvent=function(P){return I.H.useEffectEvent(P)},Ge.useId=function(){return I.H.useId()},Ge.useImperativeHandle=function(P,Z,M){return I.H.useImperativeHandle(P,Z,M)},Ge.useInsertionEffect=function(P,Z){return I.H.useInsertionEffect(P,Z)},Ge.useLayoutEffect=function(P,Z){return I.H.useLayoutEffect(P,Z)},Ge.useMemo=function(P,Z){return I.H.useMemo(P,Z)},Ge.useOptimistic=function(P,Z){return I.H.useOptimistic(P,Z)},Ge.useReducer=function(P,Z,M){return I.H.useReducer(P,Z,M)},Ge.useRef=function(P){return I.H.useRef(P)},Ge.useState=function(P){return I.H.useState(P)},Ge.useSyncExternalStore=function(P,Z,M){return I.H.useSyncExternalStore(P,Z,M)},Ge.useTransition=function(){return I.H.useTransition()},Ge.version="19.2.7",Ge}var Z1;function Tg(){return Z1||(Z1=1,hp.exports=lj()),hp.exports}var S=Tg();const Wu=Eg(S);var pp={exports:{}},Ro={},mp={exports:{}},gp={};/**
|
|
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 J1;function oj(){return J1||(J1=1,(function(e){function t(U,z){var se=U.length;U.push(z);e:for(;0<se;){var me=se-1>>>1,R=U[me];if(0<l(R,z))U[me]=z,U[se]=R,se=me;else break e}}function n(U){return U.length===0?null:U[0]}function s(U){if(U.length===0)return null;var z=U[0],se=U.pop();if(se!==z){U[0]=se;e:for(var me=0,R=U.length,P=R>>>1;me<P;){var Z=2*(me+1)-1,M=U[Z],he=Z+1,_e=U[he];if(0>l(M,se))he<R&&0>l(_e,M)?(U[me]=_e,U[he]=se,me=he):(U[me]=M,U[Z]=se,me=Z);else if(he<R&&0>l(_e,se))U[me]=_e,U[he]=se,me=he;else break e}}return z}function l(U,z){var se=U.sortIndex-z.sortIndex;return se!==0?se:U.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],g=1,v=null,y=3,b=!1,_=!1,j=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function D(U){for(var z=n(p);z!==null;){if(z.callback===null)s(p);else if(z.startTime<=U)s(p),z.sortIndex=z.expirationTime,t(h,z);else break;z=n(p)}}function O(U){if(j=!1,D(U),!_)if(n(h)!==null)_=!0,L||(L=!0,T());else{var z=n(p);z!==null&&Y(O,z.startTime-U)}}var L=!1,I=-1,$=5,G=-1;function B(){return E?!0:!(e.unstable_now()-G<$)}function F(){if(E=!1,L){var U=e.unstable_now();G=U;var z=!0;try{e:{_=!1,j&&(j=!1,A(I),I=-1),b=!0;var se=y;try{t:{for(D(U),v=n(h);v!==null&&!(v.expirationTime>U&&B());){var me=v.callback;if(typeof me=="function"){v.callback=null,y=v.priorityLevel;var R=me(v.expirationTime<=U);if(U=e.unstable_now(),typeof R=="function"){v.callback=R,D(U),z=!0;break t}v===n(h)&&s(h),D(U)}else s(h);v=n(h)}if(v!==null)z=!0;else{var P=n(p);P!==null&&Y(O,P.startTime-U),z=!1}}break e}finally{v=null,y=se,b=!1}z=void 0}}finally{z?T():L=!1}}}var T;if(typeof C=="function")T=function(){C(F)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,W=le.port2;le.port1.onmessage=F,T=function(){W.postMessage(null)}}else T=function(){k(F,0)};function Y(U,z){I=k(function(){U(e.unstable_now())},z)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(U){switch(y){case 1:case 2:case 3:var z=3;break;default:z=y}var se=y;y=z;try{return U()}finally{y=se}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(U,z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var se=y;y=U;try{return z()}finally{y=se}},e.unstable_scheduleCallback=function(U,z,se){var me=e.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?me+se:me):se=me,U){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=se+R,U={id:g++,callback:z,priorityLevel:U,startTime:se,expirationTime:R,sortIndex:-1},se>me?(U.sortIndex=se,t(p,U),n(h)===null&&U===n(p)&&(j?(A(I),I=-1):j=!0,Y(O,se-me))):(U.sortIndex=R,t(h,U),_||b||(_=!0,L||(L=!0,T()))),U},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(U){var z=y;return function(){var se=y;y=z;try{return U.apply(this,arguments)}finally{y=se}}}})(gp)),gp}var eb;function cj(){return eb||(eb=1,mp.exports=oj()),mp.exports}var xp={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 tb;function uj(){if(tb)return An;tb=1;var e=Tg();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 s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(h,p,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,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=s,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 c(h,p,null,g)},An.flushSync=function(h){var p=u.T,g=s.p;try{if(u.T=null,s.p=2,h)return h()}finally{u.T=p,s.p=g,s.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,s.d.C(h,p))},An.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},An.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var g=p.as,v=f(g,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,b=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?s.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:b}):g==="script"&&s.d.X(h,{crossOrigin:v,integrity:y,fetchPriority:b,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);s.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&&s.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,v=f(g,p.crossOrigin);s.d.L(h,g,{crossOrigin:v,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);s.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 s.d.m(h)},An.requestFormReset=function(h){s.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.7",An}var nb;function I5(){if(nb)return xp.exports;nb=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(),xp.exports=uj(),xp.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 rb;function dj(){if(rb)return Ro;rb=1;var e=cj(),t=Tg(),n=I5();function s(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)i+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var i=r,o=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(o=i.return),r=i.return;while(r)}return i.tag===3?o:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function h(r){if(c(r)!==r)throw Error(s(188))}function p(r){var i=r.alternate;if(!i){if(i=c(r),i===null)throw Error(s(188));return i!==r?null:r}for(var o=r,d=i;;){var m=o.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===o)return h(m),r;if(x===d)return h(m),i;x=x.sibling}throw Error(s(188))}if(o.return!==d.return)o=m,d=x;else{for(var w=!1,N=m.child;N;){if(N===o){w=!0,o=m,d=x;break}if(N===d){w=!0,d=m,o=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===o){w=!0,o=x,d=m;break}if(N===d){w=!0,d=x,o=m;break}N=N.sibling}if(!w)throw Error(s(189))}}if(o.alternate!==d)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),C=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function T(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var le=Symbol.for("react.client.reference");function W(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 E:return"StrictMode";case O:return"Suspense";case L:return"SuspenseList";case G:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case C:return r.displayName||"Context";case A:return(r._context.displayName||"Context")+".Consumer";case D:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case I:return i=r.displayName||null,i!==null?i:W(r.type)||"Memo";case $:i=r._payload,r=r._init;try{return W(r(i))}catch{}}return null}var Y=Array.isArray,U=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},me=[],R=-1;function P(r){return{current:r}}function Z(r){0>R||(r.current=me[R],me[R]=null,R--)}function M(r,i){R++,me[R]=r.current,r.current=i}var he=P(null),_e=P(null),Ce=P(null),Re=P(null);function Le(r,i){switch(M(Ce,i),M(_e,r),M(he,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?g1(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=g1(i),r=x1(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(he),M(he,r)}function Be(){Z(he),Z(_e),Z(Ce)}function Je(r){r.memoizedState!==null&&M(Re,r);var i=he.current,o=x1(i,r.type);i!==o&&(M(_e,r),M(he,o))}function xe(r){_e.current===r&&(Z(he),Z(_e)),Re.current===r&&(Z(Re),Co._currentValue=se)}var Pe,ft;function Rt(r){if(Pe===void 0)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);Pe=i&&i[1]||"",ft=-1<o.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Pe+r+ft}var bt=!1;function Lt(r,i){if(!r||bt)return"";bt=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ie){var ne=ie}Reflect.construct(r,[],ue)}else{try{ue.call()}catch(ie){ne=ie}r.call(ue.prototype)}}else{try{throw Error()}catch(ie){ne=ie}(ue=r())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ie){if(ie&&ne&&typeof ie.stack=="string")return[ie.stack,ne.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 x=d.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var H=w.split(`
|
|
44
|
+
`),ee=N.split(`
|
|
45
|
+
`);for(m=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;m<ee.length&&!ee[m].includes("DetermineComponentFrameRoot");)m++;if(d===H.length||m===ee.length)for(d=H.length-1,m=ee.length-1;1<=d&&0<=m&&H[d]!==ee[m];)m--;for(;1<=d&&0<=m;d--,m--)if(H[d]!==ee[m]){if(d!==1||m!==1)do if(d--,m--,0>m||H[d]!==ee[m]){var oe=`
|
|
46
|
+
`+H[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{bt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?Rt(o):""}function un(r,i){switch(r.tag){case 26:case 27:case 5:return Rt(r.type);case 16:return Rt("Lazy");case 13:return r.child!==i&&i!==null?Rt("Suspense Fallback"):Rt("Suspense");case 19:return Rt("SuspenseList");case 0:case 15:return Lt(r.type,!1);case 11:return Lt(r.type.render,!1);case 1:return Lt(r.type,!0);case 31:return Rt("Activity");default:return""}}function st(r){try{var i="",o=null;do i+=un(r,o),o=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
|
+
Error generating stack: `+d.message+`
|
|
48
|
+
`+d.stack}}var dn=Object.prototype.hasOwnProperty,bn=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,ze=e.unstable_shouldYield,yt=e.unstable_requestPaint,qe=e.unstable_now,Or=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,fe=e.unstable_LowPriority,Te=e.unstable_IdlePriority,Ye=e.log,et=e.unstable_setDisableYieldValue,tt=null,vt=null;function fn(r){if(typeof Ye=="function"&&et(r),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(tt,r)}catch{}}var Ke=Math.clz32?Math.clz32:Yr,tr=Math.log,En=Math.LN2;function Yr(r){return r>>>=0,r===0?32:31-(tr(r)/En|0)|0}var Br=256,Pr=262144,te=4194304;function pe(r){var i=r&42;if(i!==0)return i;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 ge(r,i,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=d&134217727;return N!==0?(d=N&~x,d!==0?m=pe(d):(w&=N,w!==0?m=pe(w):o||(o=N&~r,o!==0&&(m=pe(o))))):(N=d&~x,N!==0?m=pe(N):w!==0?m=pe(w):o||(o=d&~r,o!==0&&(m=pe(o)))),m===0?0:i!==0&&i!==m&&(i&x)===0&&(x=m&-m,o=i&-i,x>=o||x===32&&(o&4194048)!==0)?i:m}function Qe(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Dt(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nn(){var r=te;return te<<=1,(te&62914560)===0&&(te=4194304),r}function Tn(r){for(var i=[],o=0;31>o;o++)i.push(r);return i}function zt(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Dn(r,i,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var N=r.entanglements,H=r.expirationTimes,ee=r.hiddenUpdates;for(o=w&~o;0<o;){var oe=31-Ke(o),ue=1<<oe;N[oe]=0,H[oe]=-1;var ne=ee[oe];if(ne!==null)for(ee[oe]=null,oe=0;oe<ne.length;oe++){var ie=ne[oe];ie!==null&&(ie.lane&=-536870913)}o&=~ue}d!==0&&mr(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~i))}function mr(r,i,o){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-Ke(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function _a(r,i){var o=r.entangledLanes|=i;for(r=r.entanglements;o;){var d=31-Ke(o),m=1<<d;m&i|r[d]&i&&(r[d]|=i),o&=~m}}function Ol(r,i){var o=i&-i;return o=(o&42)!==0?1:zn(o),(o&(r.suspendedLanes|i))!==0?0:o}function zn(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 Ri(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Bl(){var r=z.p;return r!==0?r:(r=window.event,r===void 0?32:$1(r.type))}function Pl(r,i){var o=z.p;try{return z.p=r,i()}finally{z.p=o}}var gr=Math.random().toString(36).slice(2),Ht="__reactFiber$"+gr,yn="__reactProps$"+gr,nr="__reactContainer$"+gr,Ul="__reactEvents$"+gr,ff="__reactListeners$"+gr,Li="__reactHandles$"+gr,Di="__reactResources$"+gr,Qr="__reactMarker$"+gr;function Gs(r){delete r[Ht],delete r[yn],delete r[Ul],delete r[ff],delete r[Li]}function hs(r){var i=r[Ht];if(i)return i;for(var o=r.parentNode;o;){if(i=o[nr]||o[Ht]){if(o=i.alternate,i.child!==null||o!==null&&o.child!==null)for(r=k1(r);r!==null;){if(o=r[Ht])return o;r=k1(r)}return i}r=o,o=r.parentNode}return null}function Hn(r){if(r=r[Ht]||r[nr]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function zi(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(s(33))}function Xr(r){var i=r[Di];return i||(i=r[Di]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Yt(r){r[Qr]=!0}var In=new Set,wa={};function Ur(r,i){Wr(r,i),Wr(r+"Capture",i)}function Wr(r,i){for(wa[r]=i,r=0;r<i.length;r++)In.add(i[r])}var $l=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]*$"),Fl={},Qt={};function hf(r){return dn.call(Qt,r)?!0:dn.call(Fl,r)?!1:$l.test(r)?Qt[r]=!0:(Fl[r]=!0,!1)}function Oi(r,i,o){if(hf(i))if(o===null)r.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+o)}}function Sa(r,i,o){if(o===null)r.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+o)}}function $r(r,i,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(i,o,""+d)}}function qn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Dc(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Hl(r,i,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function ka(r){if(!r._valueTracker){var i=Dc(r)?"checked":"value";r._valueTracker=Hl(r,i,""+r[i])}}function Kr(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var o=i.getValue(),d="";return r&&(d=Dc(r)?r.checked?"true":"false":r.value),r=d,r!==o?(i.setValue(r),!0):!1}function Ys(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 xr=/[\n"\\]/g;function Jt(r){return r.replace(xr,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Bi(r,i,o,d,m,x,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),i!=null?w==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+qn(i)):r.value!==""+qn(i)&&(r.value=""+qn(i)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),i!=null?ja(r,w,qn(i)):o!=null?ja(r,w,qn(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+qn(N):r.removeAttribute("name")}function zc(r,i,o,d,m,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),i!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){ka(r);return}o=o!=null?""+qn(o):"",i=i!=null?""+qn(i):o,N||i===r.value||(r.value=i),r.defaultValue=i}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=N?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),ka(r)}function ja(r,i,o){i==="number"&&Ys(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Qs(r,i,o,d){if(r=r.options,i){i={};for(var m=0;m<o.length;m++)i["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=i.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+qn(o),i=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}i!==null||r[m].disabled||(i=r[m])}i!==null&&(i.selected=!0)}}function Na(r,i,o){if(i!=null&&(i=""+qn(i),i!==r.value&&(r.value=i),o==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=o!=null?""+qn(o):""}function Il(r,i,o,d){if(i==null){if(d!=null){if(o!=null)throw Error(s(92));if(Y(d)){if(1<d.length)throw Error(s(93));d=d[0]}o=d}o==null&&(o=""),i=o}o=qn(i),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),ka(r)}function Xs(r,i){if(i){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=i;return}}r.textContent=i}var pf=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 Oc(r,i,o){var d=i.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,o):typeof o!="number"||o===0||pf.has(i)?i==="float"?r.cssFloat=o:r[i]=(""+o).trim():r[i]=o+"px"}function Bc(r,i,o){if(i!=null&&typeof i!="object")throw Error(s(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in i)d=i[m],i.hasOwnProperty(m)&&o[m]!==d&&Oc(r,m,d)}else for(var x in i)i.hasOwnProperty(x)&&Oc(r,x,i[x])}function Ca(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 Pc=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"]]),mf=/^[\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 Ea(r){return mf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function vr(){}var Ws=null;function Ta(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ks=null,Zs=null;function Uc(r){var i=Hn(r);if(i&&(r=i.stateNode)){var o=r[yn]||null;e:switch(r=i.stateNode,i.type){case"input":if(Bi(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),i=o.name,o.type==="radio"&&i!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Jt(""+i)+'"][type="radio"]'),i=0;i<o.length;i++){var d=o[i];if(d!==r&&d.form===r.form){var m=d[yn]||null;if(!m)throw Error(s(90));Bi(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(i=0;i<o.length;i++)d=o[i],d.form===r.form&&Kr(d)}break e;case"textarea":Na(r,o.value,o.defaultValue);break e;case"select":i=o.value,i!=null&&Qs(r,!!o.multiple,i,!1)}}}var ql=!1;function $c(r,i,o){if(ql)return r(i,o);ql=!0;try{var d=r(i);return d}finally{if(ql=!1,(Ks!==null||Zs!==null)&&(Eu(),Ks&&(i=Ks,r=Zs,Zs=Ks=null,Uc(i),r)))for(i=0;i<r.length;i++)Uc(r[i])}}function Pi(r,i){var o=r.stateNode;if(o===null)return null;var d=o[yn]||null;if(d===null)return null;o=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(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(o&&typeof o!="function")throw Error(s(231,i,typeof o));return o}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Aa=!1;if(br)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){Aa=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Aa=!1}var q=null,de=null,Xe=null;function ht(){if(Xe)return Xe;var r,i=de,o=i.length,d,m="value"in q?q.value:q.textContent,x=m.length;for(r=0;r<o&&i[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&i[o-d]===m[x-d];d++);return Xe=m.slice(r,1<d?1-d:void 0)}function it(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function Fe(){return!0}function On(){return!1}function hn(r){function i(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in r)r.hasOwnProperty(N)&&(o=r[N],this[N]=o?o(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Fe:On,this.isPropagationStopped=On,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Fe)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Fe)},persist:function(){},isPersistent:Fe}),i}var yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ps=hn(yr),pn=v({},yr,{view:0,detail:0}),Fc=hn(pn),Vl,Gl,Ui,$i=v({},pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xf,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!==Ui&&(Ui&&r.type==="mousemove"?(Vl=r.screenX-Ui.screenX,Gl=r.screenY-Ui.screenY):Gl=Vl=0,Ui=r),Vl)},movementY:function(r){return"movementY"in r?r.movementY:Gl}}),gf=hn($i),Hc=v({},$i,{dataTransfer:0}),Ic=hn(Hc),qc=v({},pn,{relatedTarget:0}),Zr=hn(qc),Vc=v({},yr,{animationName:0,elapsedTime:0,pseudoElement:0}),Gc=hn(Vc),Ma=v({},yr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),aS=hn(Ma),lS=v({},yr,{data:0}),yx=hn(lS),oS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cS={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"},uS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dS(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=uS[r])?!!i[r]:!1}function xf(){return dS}var fS=v({},pn,{key:function(r){if(r.key){var i=oS[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=it(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?cS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xf,charCode:function(r){return r.type==="keypress"?it(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?it(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),hS=hn(fS),pS=v({},$i,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_x=hn(pS),mS=v({},pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xf}),gS=hn(mS),xS=v({},yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),vS=hn(xS),bS=v({},$i,{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}),yS=hn(bS),_S=v({},yr,{newState:0,oldState:0}),wS=hn(_S),SS=[9,13,27,32],vf=br&&"CompositionEvent"in window,Yl=null;br&&"documentMode"in document&&(Yl=document.documentMode);var kS=br&&"TextEvent"in window&&!Yl,wx=br&&(!vf||Yl&&8<Yl&&11>=Yl),Sx=" ",kx=!1;function jx(r,i){switch(r){case"keyup":return SS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ra=!1;function jS(r,i){switch(r){case"compositionend":return Nx(i);case"keypress":return i.which!==32?null:(kx=!0,Sx);case"textInput":return r=i.data,r===Sx&&kx?null:r;default:return null}}function NS(r,i){if(Ra)return r==="compositionend"||!vf&&jx(r,i)?(r=ht(),Xe=de=q=null,Ra=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return wx&&i.locale!=="ko"?null:i.data;default:return null}}var CS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Cx(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!CS[r.type]:i==="textarea"}function Ex(r,i,o,d){Ks?Zs?Zs.push(d):Zs=[d]:Ks=d,i=zu(i,"onChange"),0<i.length&&(o=new ps("onChange","change",null,o,d),r.push({event:o,listeners:i}))}var Ql=null,Xl=null;function ES(r){u1(r,0)}function Yc(r){var i=zi(r);if(Kr(i))return r}function Tx(r,i){if(r==="change")return i}var Ax=!1;if(br){var bf;if(br){var yf="oninput"in document;if(!yf){var Mx=document.createElement("div");Mx.setAttribute("oninput","return;"),yf=typeof Mx.oninput=="function"}bf=yf}else bf=!1;Ax=bf&&(!document.documentMode||9<document.documentMode)}function Rx(){Ql&&(Ql.detachEvent("onpropertychange",Lx),Xl=Ql=null)}function Lx(r){if(r.propertyName==="value"&&Yc(Xl)){var i=[];Ex(i,Xl,r,Ta(r)),$c(ES,i)}}function TS(r,i,o){r==="focusin"?(Rx(),Ql=i,Xl=o,Ql.attachEvent("onpropertychange",Lx)):r==="focusout"&&Rx()}function AS(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Yc(Xl)}function MS(r,i){if(r==="click")return Yc(i)}function RS(r,i){if(r==="input"||r==="change")return Yc(i)}function LS(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var rr=typeof Object.is=="function"?Object.is:LS;function Wl(r,i){if(rr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var o=Object.keys(r),d=Object.keys(i);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!dn.call(i,m)||!rr(r[m],i[m]))return!1}return!0}function Dx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function zx(r,i){var o=Dx(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=i&&d>=i)return{node:o,offset:i-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Dx(o)}}function Ox(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?Ox(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function Bx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Ys(r.document);i instanceof r.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)r=i.contentWindow;else break;i=Ys(r.document)}return i}function _f(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var DS=br&&"documentMode"in document&&11>=document.documentMode,La=null,wf=null,Kl=null,Sf=!1;function Px(r,i,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Sf||La==null||La!==Ys(d)||(d=La,"selectionStart"in d&&_f(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}),Kl&&Wl(Kl,d)||(Kl=d,d=zu(wf,"onSelect"),0<d.length&&(i=new ps("onSelect","select",null,i,o),r.push({event:i,listeners:d}),i.target=La)))}function Fi(r,i){var o={};return o[r.toLowerCase()]=i.toLowerCase(),o["Webkit"+r]="webkit"+i,o["Moz"+r]="moz"+i,o}var Da={animationend:Fi("Animation","AnimationEnd"),animationiteration:Fi("Animation","AnimationIteration"),animationstart:Fi("Animation","AnimationStart"),transitionrun:Fi("Transition","TransitionRun"),transitionstart:Fi("Transition","TransitionStart"),transitioncancel:Fi("Transition","TransitionCancel"),transitionend:Fi("Transition","TransitionEnd")},kf={},Ux={};br&&(Ux=document.createElement("div").style,"AnimationEvent"in window||(delete Da.animationend.animation,delete Da.animationiteration.animation,delete Da.animationstart.animation),"TransitionEvent"in window||delete Da.transitionend.transition);function Hi(r){if(kf[r])return kf[r];if(!Da[r])return r;var i=Da[r],o;for(o in i)if(i.hasOwnProperty(o)&&o in Ux)return kf[r]=i[o];return r}var $x=Hi("animationend"),Fx=Hi("animationiteration"),Hx=Hi("animationstart"),zS=Hi("transitionrun"),OS=Hi("transitionstart"),BS=Hi("transitioncancel"),Ix=Hi("transitionend"),qx=new Map,jf="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(" ");jf.push("scrollEnd");function Fr(r,i){qx.set(r,i),Ur(i,[r])}var Qc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=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(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},_r=[],za=0,Nf=0;function Xc(){for(var r=za,i=Nf=za=0;i<r;){var o=_r[i];_r[i++]=null;var d=_r[i];_r[i++]=null;var m=_r[i];_r[i++]=null;var x=_r[i];if(_r[i++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Vx(o,m,x)}}function Wc(r,i,o,d){_r[za++]=r,_r[za++]=i,_r[za++]=o,_r[za++]=d,Nf|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Cf(r,i,o,d){return Wc(r,i,o,d),Kc(r)}function Ii(r,i){return Wc(r,null,null,i),Kc(r)}function Vx(r,i,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&i!==null&&(m=31-Ke(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[i]:d.push(i),i.lane=o|536870912),x):null}function Kc(r){if(50<yo)throw yo=0,Oh=null,Error(s(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Oa={};function PS(r,i,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,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 sr(r,i,o,d){return new PS(r,i,o,d)}function Ef(r){return r=r.prototype,!(!r||!r.isReactComponent)}function ms(r,i){var o=r.alternate;return o===null?(o=sr(r.tag,i,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=i,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,i=r.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Gx(r,i){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,i=o.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Zc(r,i,o,d,m,x){var w=0;if(d=r,typeof r=="function")Ef(r)&&(w=1);else if(typeof r=="string")w=Ik(r,o,he.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case G:return r=sr(31,o,i,m),r.elementType=G,r.lanes=x,r;case j:return qi(o.children,m,x,i);case E:w=8,m|=24;break;case k:return r=sr(12,o,i,m|2),r.elementType=k,r.lanes=x,r;case O:return r=sr(13,o,i,m),r.elementType=O,r.lanes=x,r;case L:return r=sr(19,o,i,m),r.elementType=L,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case A:w=9;break e;case D:w=11;break e;case I:w=14;break e;case $:w=16,d=null;break e}w=29,o=Error(s(130,r===null?"null":typeof r,"")),d=null}return i=sr(w,o,i,m),i.elementType=r,i.type=d,i.lanes=x,i}function qi(r,i,o,d){return r=sr(7,r,d,i),r.lanes=o,r}function Tf(r,i,o){return r=sr(6,r,null,i),r.lanes=o,r}function Yx(r){var i=sr(18,null,null,0);return i.stateNode=r,i}function Af(r,i,o){return i=sr(4,r.children!==null?r.children:[],r.key,i),i.lanes=o,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Qx=new WeakMap;function wr(r,i){if(typeof r=="object"&&r!==null){var o=Qx.get(r);return o!==void 0?o:(i={value:r,source:i,stack:st(i)},Qx.set(r,i),i)}return{value:r,source:i,stack:st(i)}}var Ba=[],Pa=0,Jc=null,Zl=0,Sr=[],kr=0,ei=null,Jr=1,es="";function gs(r,i){Ba[Pa++]=Zl,Ba[Pa++]=Jc,Jc=r,Zl=i}function Xx(r,i,o){Sr[kr++]=Jr,Sr[kr++]=es,Sr[kr++]=ei,ei=r;var d=Jr;r=es;var m=32-Ke(d)-1;d&=~(1<<m),o+=1;var x=32-Ke(i)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Jr=1<<32-Ke(i)+m|o<<m|d,es=x+r}else Jr=1<<x|o<<m|d,es=r}function Mf(r){r.return!==null&&(gs(r,1),Xx(r,1,0))}function Rf(r){for(;r===Jc;)Jc=Ba[--Pa],Ba[Pa]=null,Zl=Ba[--Pa],Ba[Pa]=null;for(;r===ei;)ei=Sr[--kr],Sr[kr]=null,es=Sr[--kr],Sr[kr]=null,Jr=Sr[--kr],Sr[kr]=null}function Wx(r,i){Sr[kr++]=Jr,Sr[kr++]=es,Sr[kr++]=ei,Jr=i.id,es=i.overflow,ei=r}var _n=null,Pt=null,dt=!1,ti=null,jr=!1,Lf=Error(s(519));function ni(r){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(wr(i,r)),Lf}function Kx(r){var i=r.stateNode,o=r.type,d=r.memoizedProps;switch(i[Ht]=r,i[yn]=d,o){case"dialog":lt("cancel",i),lt("close",i);break;case"iframe":case"object":case"embed":lt("load",i);break;case"video":case"audio":for(o=0;o<wo.length;o++)lt(wo[o],i);break;case"source":lt("error",i);break;case"img":case"image":case"link":lt("error",i),lt("load",i);break;case"details":lt("toggle",i);break;case"input":lt("invalid",i),zc(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",i);break;case"textarea":lt("invalid",i),Il(i,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||i.textContent===""+o||d.suppressHydrationWarning===!0||p1(i.textContent,o)?(d.popover!=null&&(lt("beforetoggle",i),lt("toggle",i)),d.onScroll!=null&<("scroll",i),d.onScrollEnd!=null&<("scrollend",i),d.onClick!=null&&(i.onclick=vr),i=!0):i=!1,i||ni(r,!0)}function Zx(r){for(_n=r.return;_n;)switch(_n.tag){case 5:case 31:case 13:jr=!1;return;case 27:case 3:jr=!0;return;default:_n=_n.return}}function Ua(r){if(r!==_n)return!1;if(!dt)return Zx(r),dt=!0,!1;var i=r.tag,o;if((o=i!==3&&i!==27)&&((o=i===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Kh(r.type,r.memoizedProps)),o=!o),o&&Pt&&ni(r),Zx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Pt=S1(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Pt=S1(r)}else i===27?(i=Pt,gi(r.type)?(r=np,np=null,Pt=r):Pt=i):Pt=_n?Cr(r.stateNode.nextSibling):null;return!0}function Vi(){Pt=_n=null,dt=!1}function Df(){var r=ti;return r!==null&&(Qn===null?Qn=r:Qn.push.apply(Qn,r),ti=null),r}function Jl(r){ti===null?ti=[r]:ti.push(r)}var zf=P(null),Gi=null,xs=null;function ri(r,i,o){M(zf,i._currentValue),i._currentValue=o}function vs(r){r._currentValue=zf.current,Z(zf)}function Of(r,i,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===o)break;r=r.return}}function Bf(r,i,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=m;for(var H=0;H<i.length;H++)if(N.context===i[H]){x.lanes|=o,N=x.alternate,N!==null&&(N.lanes|=o),Of(x.return,o,r),d||(w=null);break e}x=N.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(s(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),Of(w,o,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 $a(r,i,o,d){r=null;for(var m=i,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var N=m.type;rr(m.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}else if(m===Re.current){if(w=m.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(Co):r=[Co])}m=m.return}r!==null&&Bf(i,r,o,d),i.flags|=262144}function eu(r){for(r=r.firstContext;r!==null;){if(!rr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Yi(r){Gi=r,xs=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function wn(r){return Jx(Gi,r)}function tu(r,i){return Gi===null&&Yi(r),Jx(r,i)}function Jx(r,i){var o=i._currentValue;if(i={context:i,memoizedValue:o,next:null},xs===null){if(r===null)throw Error(s(308));xs=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else xs=xs.next=i;return o}var US=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(o){return o()})}},$S=e.unstable_scheduleCallback,FS=e.unstable_NormalPriority,rn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pf(){return{controller:new US,data:new Map,refCount:0}}function eo(r){r.refCount--,r.refCount===0&&$S(FS,function(){r.controller.abort()})}var to=null,Uf=0,Fa=0,Ha=null;function HS(r,i){if(to===null){var o=to=[];Uf=0,Fa=Hh(),Ha={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Uf++,i.then(e0,e0),i}function e0(){if(--Uf===0&&to!==null){Ha!==null&&(Ha.status="fulfilled");var r=to;to=null,Fa=0,Ha=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function IS(r,i){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var m=0;m<o.length;m++)(0,o[m])(i)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var t0=U.S;U.S=function(r,i){Pv=qe(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&HS(r,i),t0!==null&&t0(r,i)};var Qi=P(null);function $f(){var r=Qi.current;return r!==null?r:Ct.pooledCache}function nu(r,i){i===null?M(Qi,Qi.current):M(Qi,i.pool)}function n0(){var r=$f();return r===null?null:{parent:rn._currentValue,pool:r}}var Ia=Error(s(460)),Ff=Error(s(474)),ru=Error(s(542)),su={then:function(){}};function r0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function s0(r,i,o){switch(o=r[o],o===void 0?r.push(i):o!==i&&(i.then(vr,vr),i=o),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,a0(r),r;default:if(typeof i.status=="string")i.then(vr,vr);else{if(r=Ct,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var m=i;m.status="fulfilled",m.value=d}},function(d){if(i.status==="pending"){var m=i;m.status="rejected",m.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,a0(r),r}throw Wi=i,Ia}}function Xi(r){try{var i=r._init;return i(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Wi=o,Ia):o}}var Wi=null;function i0(){if(Wi===null)throw Error(s(459));var r=Wi;return Wi=null,r}function a0(r){if(r===Ia||r===ru)throw Error(s(483))}var qa=null,no=0;function iu(r){var i=no;return no+=1,qa===null&&(qa=[]),s0(qa,r,i)}function ro(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function au(r,i){throw i.$$typeof===y?Error(s(525)):(r=Object.prototype.toString.call(i),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function l0(r){function i(K,V){if(r){var J=K.deletions;J===null?(K.deletions=[V],K.flags|=16):J.push(V)}}function o(K,V){if(!r)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function m(K,V){return K=ms(K,V),K.index=0,K.sibling=null,K}function x(K,V,J){return K.index=J,r?(J=K.alternate,J!==null?(J=J.index,J<V?(K.flags|=67108866,V):J):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function w(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function N(K,V,J,ce){return V===null||V.tag!==6?(V=Tf(J,K.mode,ce),V.return=K,V):(V=m(V,J),V.return=K,V)}function H(K,V,J,ce){var Oe=J.type;return Oe===j?oe(K,V,J.props.children,ce,J.key):V!==null&&(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===$&&Xi(Oe)===V.type)?(V=m(V,J.props),ro(V,J),V.return=K,V):(V=Zc(J.type,J.key,J.props,null,K.mode,ce),ro(V,J),V.return=K,V)}function ee(K,V,J,ce){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=Af(J,K.mode,ce),V.return=K,V):(V=m(V,J.children||[]),V.return=K,V)}function oe(K,V,J,ce,Oe){return V===null||V.tag!==7?(V=qi(J,K.mode,ce,Oe),V.return=K,V):(V=m(V,J),V.return=K,V)}function ue(K,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Tf(""+V,K.mode,J),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return J=Zc(V.type,V.key,V.props,null,K.mode,J),ro(J,V),J.return=K,J;case _:return V=Af(V,K.mode,J),V.return=K,V;case $:return V=Xi(V),ue(K,V,J)}if(Y(V)||T(V))return V=qi(V,K.mode,J,null),V.return=K,V;if(typeof V.then=="function")return ue(K,iu(V),J);if(V.$$typeof===C)return ue(K,tu(K,V),J);au(K,V)}return null}function ne(K,V,J,ce){var Oe=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Oe!==null?null:N(K,V,""+J,ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return J.key===Oe?H(K,V,J,ce):null;case _:return J.key===Oe?ee(K,V,J,ce):null;case $:return J=Xi(J),ne(K,V,J,ce)}if(Y(J)||T(J))return Oe!==null?null:oe(K,V,J,ce,null);if(typeof J.then=="function")return ne(K,V,iu(J),ce);if(J.$$typeof===C)return ne(K,V,tu(K,J),ce);au(K,J)}return null}function ie(K,V,J,ce,Oe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(J)||null,N(V,K,""+ce,Oe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return K=K.get(ce.key===null?J:ce.key)||null,H(V,K,ce,Oe);case _:return K=K.get(ce.key===null?J:ce.key)||null,ee(V,K,ce,Oe);case $:return ce=Xi(ce),ie(K,V,J,ce,Oe)}if(Y(ce)||T(ce))return K=K.get(J)||null,oe(V,K,ce,Oe,null);if(typeof ce.then=="function")return ie(K,V,J,iu(ce),Oe);if(ce.$$typeof===C)return ie(K,V,J,tu(V,ce),Oe);au(V,ce)}return null}function Ee(K,V,J,ce){for(var Oe=null,mt=null,Ae=V,Ze=V=0,ut=null;Ae!==null&&Ze<J.length;Ze++){Ae.index>Ze?(ut=Ae,Ae=null):ut=Ae.sibling;var gt=ne(K,Ae,J[Ze],ce);if(gt===null){Ae===null&&(Ae=ut);break}r&&Ae&>.alternate===null&&i(K,Ae),V=x(gt,V,Ze),mt===null?Oe=gt:mt.sibling=gt,mt=gt,Ae=ut}if(Ze===J.length)return o(K,Ae),dt&&gs(K,Ze),Oe;if(Ae===null){for(;Ze<J.length;Ze++)Ae=ue(K,J[Ze],ce),Ae!==null&&(V=x(Ae,V,Ze),mt===null?Oe=Ae:mt.sibling=Ae,mt=Ae);return dt&&gs(K,Ze),Oe}for(Ae=d(Ae);Ze<J.length;Ze++)ut=ie(Ae,K,Ze,J[Ze],ce),ut!==null&&(r&&ut.alternate!==null&&Ae.delete(ut.key===null?Ze:ut.key),V=x(ut,V,Ze),mt===null?Oe=ut:mt.sibling=ut,mt=ut);return r&&Ae.forEach(function(_i){return i(K,_i)}),dt&&gs(K,Ze),Oe}function $e(K,V,J,ce){if(J==null)throw Error(s(151));for(var Oe=null,mt=null,Ae=V,Ze=V=0,ut=null,gt=J.next();Ae!==null&&!gt.done;Ze++,gt=J.next()){Ae.index>Ze?(ut=Ae,Ae=null):ut=Ae.sibling;var _i=ne(K,Ae,gt.value,ce);if(_i===null){Ae===null&&(Ae=ut);break}r&&Ae&&_i.alternate===null&&i(K,Ae),V=x(_i,V,Ze),mt===null?Oe=_i:mt.sibling=_i,mt=_i,Ae=ut}if(gt.done)return o(K,Ae),dt&&gs(K,Ze),Oe;if(Ae===null){for(;!gt.done;Ze++,gt=J.next())gt=ue(K,gt.value,ce),gt!==null&&(V=x(gt,V,Ze),mt===null?Oe=gt:mt.sibling=gt,mt=gt);return dt&&gs(K,Ze),Oe}for(Ae=d(Ae);!gt.done;Ze++,gt=J.next())gt=ie(Ae,K,Ze,gt.value,ce),gt!==null&&(r&>.alternate!==null&&Ae.delete(gt.key===null?Ze:gt.key),V=x(gt,V,Ze),mt===null?Oe=gt:mt.sibling=gt,mt=gt);return r&&Ae.forEach(function(ej){return i(K,ej)}),dt&&gs(K,Ze),Oe}function jt(K,V,J,ce){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case b:e:{for(var Oe=J.key;V!==null;){if(V.key===Oe){if(Oe=J.type,Oe===j){if(V.tag===7){o(K,V.sibling),ce=m(V,J.props.children),ce.return=K,K=ce;break e}}else if(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===$&&Xi(Oe)===V.type){o(K,V.sibling),ce=m(V,J.props),ro(ce,J),ce.return=K,K=ce;break e}o(K,V);break}else i(K,V);V=V.sibling}J.type===j?(ce=qi(J.props.children,K.mode,ce,J.key),ce.return=K,K=ce):(ce=Zc(J.type,J.key,J.props,null,K.mode,ce),ro(ce,J),ce.return=K,K=ce)}return w(K);case _:e:{for(Oe=J.key;V!==null;){if(V.key===Oe)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){o(K,V.sibling),ce=m(V,J.children||[]),ce.return=K,K=ce;break e}else{o(K,V);break}else i(K,V);V=V.sibling}ce=Af(J,K.mode,ce),ce.return=K,K=ce}return w(K);case $:return J=Xi(J),jt(K,V,J,ce)}if(Y(J))return Ee(K,V,J,ce);if(T(J)){if(Oe=T(J),typeof Oe!="function")throw Error(s(150));return J=Oe.call(J),$e(K,V,J,ce)}if(typeof J.then=="function")return jt(K,V,iu(J),ce);if(J.$$typeof===C)return jt(K,V,tu(K,J),ce);au(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(o(K,V.sibling),ce=m(V,J),ce.return=K,K=ce):(o(K,V),ce=Tf(J,K.mode,ce),ce.return=K,K=ce),w(K)):o(K,V)}return function(K,V,J,ce){try{no=0;var Oe=jt(K,V,J,ce);return qa=null,Oe}catch(Ae){if(Ae===Ia||Ae===ru)throw Ae;var mt=sr(29,Ae,null,K.mode);return mt.lanes=ce,mt.return=K,mt}finally{}}}var Ki=l0(!0),o0=l0(!1),si=!1;function Hf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function If(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ii(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ai(r,i,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(xt&2)!==0){var m=d.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),d.pending=i,i=Kc(r),Vx(r,null,o),i}return Wc(r,d,i,o),Kc(r)}function so(r,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,o|=d,i.lanes=o,_a(r,o)}}function qf(r,i){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=i:x=x.next=i}else m=x=i;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=i:r.next=i,o.lastBaseUpdate=i}var Vf=!1;function io(){if(Vf){var r=Ha;if(r!==null)throw r}}function ao(r,i,o,d){Vf=!1;var m=r.updateQueue;si=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var H=N,ee=H.next;H.next=null,w===null?x=ee:w.next=ee,w=H;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,N=oe.lastBaseUpdate,N!==w&&(N===null?oe.firstBaseUpdate=ee:N.next=ee,oe.lastBaseUpdate=H))}if(x!==null){var ue=m.baseState;w=0,oe=ee=H=null,N=x;do{var ne=N.lane&-536870913,ie=ne!==N.lane;if(ie?(ct&ne)===ne:(d&ne)===ne){ne!==0&&ne===Fa&&(Vf=!0),oe!==null&&(oe=oe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ee=r,$e=N;ne=i;var jt=o;switch($e.tag){case 1:if(Ee=$e.payload,typeof Ee=="function"){ue=Ee.call(jt,ue,ne);break e}ue=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=$e.payload,ne=typeof Ee=="function"?Ee.call(jt,ue,ne):Ee,ne==null)break e;ue=v({},ue,ne);break e;case 2:si=!0}}ne=N.callback,ne!==null&&(r.flags|=64,ie&&(r.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:N.tag,payload:N.payload,callback:N.callback,next:null},oe===null?(ee=oe=ie,H=ue):oe=oe.next=ie,w|=ne;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;ie=N,N=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);oe===null&&(H=ue),m.baseState=H,m.firstBaseUpdate=ee,m.lastBaseUpdate=oe,x===null&&(m.shared.lanes=0),di|=w,r.lanes=w,r.memoizedState=ue}}function c0(r,i){if(typeof r!="function")throw Error(s(191,r));r.call(i)}function u0(r,i){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)c0(o[r],i)}var Va=P(null),lu=P(0);function d0(r,i){r=Cs,M(lu,r),M(Va,i),Cs=r|i.baseLanes}function Gf(){M(lu,Cs),M(Va,Va.current)}function Yf(){Cs=lu.current,Z(Va),Z(lu)}var ir=P(null),Nr=null;function li(r){var i=r.alternate;M(en,en.current&1),M(ir,r),Nr===null&&(i===null||Va.current!==null||i.memoizedState!==null)&&(Nr=r)}function Qf(r){M(en,en.current),M(ir,r),Nr===null&&(Nr=r)}function f0(r){r.tag===22?(M(en,en.current),M(ir,r),Nr===null&&(Nr=r)):oi()}function oi(){M(en,en.current),M(ir,ir.current)}function ar(r){Z(ir),Nr===r&&(Nr=null),Z(en)}var en=P(0);function ou(r){for(var i=r;i!==null;){if(i.tag===13){var o=i.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||ep(o)||tp(o)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var bs=0,We=null,St=null,sn=null,cu=!1,Ga=!1,Zi=!1,uu=0,lo=0,Ya=null,qS=0;function Wt(){throw Error(s(321))}function Xf(r,i){if(i===null)return!1;for(var o=0;o<i.length&&o<r.length;o++)if(!rr(r[o],i[o]))return!1;return!0}function Wf(r,i,o,d,m,x){return bs=x,We=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,U.H=r===null||r.memoizedState===null?X0:dh,Zi=!1,x=o(d,m),Zi=!1,Ga&&(x=p0(i,o,d,m)),h0(r),x}function h0(r){U.H=uo;var i=St!==null&&St.next!==null;if(bs=0,sn=St=We=null,cu=!1,lo=0,Ya=null,i)throw Error(s(300));r===null||an||(r=r.dependencies,r!==null&&eu(r)&&(an=!0))}function p0(r,i,o,d){We=r;var m=0;do{if(Ga&&(Ya=null),lo=0,Ga=!1,25<=m)throw Error(s(301));if(m+=1,sn=St=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}U.H=W0,x=i(o,d)}while(Ga);return x}function VS(){var r=U.H,i=r.useState()[0];return i=typeof i.then=="function"?oo(i):i,r=r.useState()[0],(St!==null?St.memoizedState:null)!==r&&(We.flags|=1024),i}function Kf(){var r=uu!==0;return uu=0,r}function Zf(r,i,o){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~o}function Jf(r){if(cu){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}cu=!1}bs=0,sn=St=We=null,Ga=!1,lo=uu=0,Ya=null}function Bn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?We.memoizedState=sn=r:sn=sn.next=r,sn}function tn(){if(St===null){var r=We.alternate;r=r!==null?r.memoizedState:null}else r=St.next;var i=sn===null?We.memoizedState:sn.next;if(i!==null)sn=i,St=r;else{if(r===null)throw We.alternate===null?Error(s(467)):Error(s(310));St=r,r={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},sn===null?We.memoizedState=sn=r:sn=sn.next=r}return sn}function du(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function oo(r){var i=lo;return lo+=1,Ya===null&&(Ya=[]),r=s0(Ya,r,i),i=We,(sn===null?i.memoizedState:sn.next)===null&&(i=i.alternate,U.H=i===null||i.memoizedState===null?X0:dh),r}function fu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return oo(r);if(r.$$typeof===C)return wn(r)}throw Error(s(438,String(r)))}function eh(r){var i=null,o=We.updateQueue;if(o!==null&&(i=o.memoCache),i==null){var d=We.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(m){return m.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),o===null&&(o=du(),We.updateQueue=o),o.memoCache=i,o=i.data[i.index],o===void 0)for(o=i.data[i.index]=Array(r),d=0;d<r;d++)o[d]=B;return i.index++,o}function ys(r,i){return typeof i=="function"?i(r):i}function hu(r){var i=tn();return th(i,St,r)}function th(r,i,o){var d=r.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}i.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{i=m.next;var N=w=null,H=null,ee=i,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(ct&ue)===ue:(bs&ue)===ue){var ne=ee.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===Fa&&(oe=!0);else if((bs&ne)===ne){ee=ee.next,ne===Fa&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=ue,w=x):H=H.next=ue,We.lanes|=ne,di|=ne;ue=ee.action,Zi&&o(x,ue),x=ee.hasEagerState?ee.eagerState:o(x,ue)}else ne={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=ne,w=x):H=H.next=ne,We.lanes|=ue,di|=ue;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?w=x:H.next=N,!rr(x,r.memoizedState)&&(an=!0,oe&&(o=Ha,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=H,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function nh(r){var i=tn(),o=i.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=i.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);rr(x,i.memoizedState)||(an=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),o.lastRenderedState=x}return[x,d]}function m0(r,i,o){var d=We,m=tn(),x=dt;if(x){if(o===void 0)throw Error(s(407));o=o()}else o=i();var w=!rr((St||m).memoizedState,o);if(w&&(m.memoizedState=o,an=!0),m=m.queue,ih(v0.bind(null,d,m,r),[r]),m.getSnapshot!==i||w||sn!==null&&sn.memoizedState.tag&1){if(d.flags|=2048,Qa(9,{destroy:void 0},x0.bind(null,d,m,o,i),null),Ct===null)throw Error(s(349));x||(bs&127)!==0||g0(d,i,o)}return o}function g0(r,i,o){r.flags|=16384,r={getSnapshot:i,value:o},i=We.updateQueue,i===null?(i=du(),We.updateQueue=i,i.stores=[r]):(o=i.stores,o===null?i.stores=[r]:o.push(r))}function x0(r,i,o,d){i.value=o,i.getSnapshot=d,b0(i)&&y0(r)}function v0(r,i,o){return o(function(){b0(i)&&y0(r)})}function b0(r){var i=r.getSnapshot;r=r.value;try{var o=i();return!rr(r,o)}catch{return!0}}function y0(r){var i=Ii(r,2);i!==null&&Xn(i,r,2)}function rh(r){var i=Bn();if(typeof r=="function"){var o=r;if(r=o(),Zi){fn(!0);try{o()}finally{fn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:r},i}function _0(r,i,o,d){return r.baseState=o,th(r,St,typeof d=="function"?d:ys)}function GS(r,i,o,d,m){if(gu(r))throw Error(s(485));if(r=i.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};U.T!==null?o(!0):x.isTransition=!1,d(x),o=i.pending,o===null?(x.next=i.pending=x,w0(i,x)):(x.next=o.next,i.pending=o.next=x)}}function w0(r,i){var o=i.action,d=i.payload,m=r.state;if(i.isTransition){var x=U.T,w={};U.T=w;try{var N=o(m,d),H=U.S;H!==null&&H(w,N),S0(r,i,N)}catch(ee){sh(r,i,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),U.T=x}}else try{x=o(m,d),S0(r,i,x)}catch(ee){sh(r,i,ee)}}function S0(r,i,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){k0(r,i,d)},function(d){return sh(r,i,d)}):k0(r,i,o)}function k0(r,i,o){i.status="fulfilled",i.value=o,j0(i),r.state=o,i=r.pending,i!==null&&(o=i.next,o===i?r.pending=null:(o=o.next,i.next=o,w0(r,o)))}function sh(r,i,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=o,j0(i),i=i.next;while(i!==d)}r.action=null}function j0(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function N0(r,i){return i}function C0(r,i){if(dt){var o=Ct.formState;if(o!==null){e:{var d=We;if(dt){if(Pt){t:{for(var m=Pt,x=jr;m.nodeType!==8;){if(!x){m=null;break t}if(m=Cr(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Pt=Cr(m.nextSibling),d=m.data==="F!";break e}}ni(d)}d=!1}d&&(i=o[0])}}return o=Bn(),o.memoizedState=o.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:N0,lastRenderedState:i},o.queue=d,o=G0.bind(null,We,d),d.dispatch=o,d=rh(!1),x=uh.bind(null,We,!1,d.queue),d=Bn(),m={state:i,dispatch:null,action:r,pending:null},d.queue=m,o=GS.bind(null,We,m,x,o),m.dispatch=o,d.memoizedState=r,[i,o,!1]}function E0(r){var i=tn();return T0(i,St,r)}function T0(r,i,o){if(i=th(r,i,N0)[0],r=hu(ys)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=oo(i)}catch(w){throw w===Ia?ru:w}else d=i;i=tn();var m=i.queue,x=m.dispatch;return o!==i.memoizedState&&(We.flags|=2048,Qa(9,{destroy:void 0},YS.bind(null,m,o),null)),[d,x,r]}function YS(r,i){r.action=i}function A0(r){var i=tn(),o=St;if(o!==null)return T0(i,o,r);tn(),i=i.memoizedState,o=tn();var d=o.queue.dispatch;return o.memoizedState=r,[i,d,!1]}function Qa(r,i,o,d){return r={tag:r,create:o,deps:d,inst:i,next:null},i=We.updateQueue,i===null&&(i=du(),We.updateQueue=i),o=i.lastEffect,o===null?i.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,i.lastEffect=r),r}function M0(){return tn().memoizedState}function pu(r,i,o,d){var m=Bn();We.flags|=r,m.memoizedState=Qa(1|i,{destroy:void 0},o,d===void 0?null:d)}function mu(r,i,o,d){var m=tn();d=d===void 0?null:d;var x=m.memoizedState.inst;St!==null&&d!==null&&Xf(d,St.memoizedState.deps)?m.memoizedState=Qa(i,x,o,d):(We.flags|=r,m.memoizedState=Qa(1|i,x,o,d))}function R0(r,i){pu(8390656,8,r,i)}function ih(r,i){mu(2048,8,r,i)}function QS(r){We.flags|=4;var i=We.updateQueue;if(i===null)i=du(),We.updateQueue=i,i.events=[r];else{var o=i.events;o===null?i.events=[r]:o.push(r)}}function L0(r){var i=tn().memoizedState;return QS({ref:i,nextImpl:r}),function(){if((xt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function D0(r,i){return mu(4,2,r,i)}function z0(r,i){return mu(4,4,r,i)}function O0(r,i){if(typeof i=="function"){r=r();var o=i(r);return function(){typeof o=="function"?o():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function B0(r,i,o){o=o!=null?o.concat([r]):null,mu(4,4,O0.bind(null,i,r),o)}function ah(){}function P0(r,i){var o=tn();i=i===void 0?null:i;var d=o.memoizedState;return i!==null&&Xf(i,d[1])?d[0]:(o.memoizedState=[r,i],r)}function U0(r,i){var o=tn();i=i===void 0?null:i;var d=o.memoizedState;if(i!==null&&Xf(i,d[1]))return d[0];if(d=r(),Zi){fn(!0);try{r()}finally{fn(!1)}}return o.memoizedState=[d,i],d}function lh(r,i,o){return o===void 0||(bs&1073741824)!==0&&(ct&261930)===0?r.memoizedState=i:(r.memoizedState=o,r=$v(),We.lanes|=r,di|=r,o)}function $0(r,i,o,d){return rr(o,i)?o:Va.current!==null?(r=lh(r,o,d),rr(r,i)||(an=!0),r):(bs&42)===0||(bs&1073741824)!==0&&(ct&261930)===0?(an=!0,r.memoizedState=o):(r=$v(),We.lanes|=r,di|=r,i)}function F0(r,i,o,d,m){var x=z.p;z.p=x!==0&&8>x?x:8;var w=U.T,N={};U.T=N,uh(r,!1,i,o);try{var H=m(),ee=U.S;if(ee!==null&&ee(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=IS(H,d);co(r,i,oe,cr(r))}else co(r,i,d,cr(r))}catch(ue){co(r,i,{then:function(){},status:"rejected",reason:ue},cr())}finally{z.p=x,w!==null&&N.types!==null&&(w.types=N.types),U.T=w}}function XS(){}function oh(r,i,o,d){if(r.tag!==5)throw Error(s(476));var m=H0(r).queue;F0(r,m,i,se,o===null?XS:function(){return I0(r),o(d)})}function H0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:se},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:o},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function I0(r){var i=H0(r);i.next===null&&(i=r.alternate.memoizedState),co(r,i.next.queue,{},cr())}function ch(){return wn(Co)}function q0(){return tn().memoizedState}function V0(){return tn().memoizedState}function WS(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var o=cr();r=ii(o);var d=ai(i,r,o);d!==null&&(Xn(d,i,o),so(d,i,o)),i={cache:Pf()},r.payload=i;return}i=i.return}}function KS(r,i,o){var d=cr();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},gu(r)?Y0(i,o):(o=Cf(r,i,o,d),o!==null&&(Xn(o,r,d),Q0(o,i,d)))}function G0(r,i,o){var d=cr();co(r,i,o,d)}function co(r,i,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(gu(r))Y0(i,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var w=i.lastRenderedState,N=x(w,o);if(m.hasEagerState=!0,m.eagerState=N,rr(N,w))return Wc(r,i,m,0),Ct===null&&Xc(),!1}catch{}finally{}if(o=Cf(r,i,m,d),o!==null)return Xn(o,r,d),Q0(o,i,d),!0}return!1}function uh(r,i,o,d){if(d={lane:2,revertLane:Hh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},gu(r)){if(i)throw Error(s(479))}else i=Cf(r,o,d,2),i!==null&&Xn(i,r,2)}function gu(r){var i=r.alternate;return r===We||i!==null&&i===We}function Y0(r,i){Ga=cu=!0;var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}function Q0(r,i,o){if((o&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,o|=d,i.lanes=o,_a(r,o)}}var uo={readContext:wn,use:fu,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};uo.useEffectEvent=Wt;var X0={readContext:wn,use:fu,useCallback:function(r,i){return Bn().memoizedState=[r,i===void 0?null:i],r},useContext:wn,useEffect:R0,useImperativeHandle:function(r,i,o){o=o!=null?o.concat([r]):null,pu(4194308,4,O0.bind(null,i,r),o)},useLayoutEffect:function(r,i){return pu(4194308,4,r,i)},useInsertionEffect:function(r,i){pu(4,2,r,i)},useMemo:function(r,i){var o=Bn();i=i===void 0?null:i;var d=r();if(Zi){fn(!0);try{r()}finally{fn(!1)}}return o.memoizedState=[d,i],d},useReducer:function(r,i,o){var d=Bn();if(o!==void 0){var m=o(i);if(Zi){fn(!0);try{o(i)}finally{fn(!1)}}}else m=i;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=KS.bind(null,We,r),[d.memoizedState,r]},useRef:function(r){var i=Bn();return r={current:r},i.memoizedState=r},useState:function(r){r=rh(r);var i=r.queue,o=G0.bind(null,We,i);return i.dispatch=o,[r.memoizedState,o]},useDebugValue:ah,useDeferredValue:function(r,i){var o=Bn();return lh(o,r,i)},useTransition:function(){var r=rh(!1);return r=F0.bind(null,We,r.queue,!0,!1),Bn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,o){var d=We,m=Bn();if(dt){if(o===void 0)throw Error(s(407));o=o()}else{if(o=i(),Ct===null)throw Error(s(349));(ct&127)!==0||g0(d,i,o)}m.memoizedState=o;var x={value:o,getSnapshot:i};return m.queue=x,R0(v0.bind(null,d,x,r),[r]),d.flags|=2048,Qa(9,{destroy:void 0},x0.bind(null,d,x,o,i),null),o},useId:function(){var r=Bn(),i=Ct.identifierPrefix;if(dt){var o=es,d=Jr;o=(d&~(1<<32-Ke(d)-1)).toString(32)+o,i="_"+i+"R_"+o,o=uu++,0<o&&(i+="H"+o.toString(32)),i+="_"}else o=qS++,i="_"+i+"r_"+o.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:ch,useFormState:C0,useActionState:C0,useOptimistic:function(r){var i=Bn();i.memoizedState=i.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=o,i=uh.bind(null,We,!0,o),o.dispatch=i,[r,i]},useMemoCache:eh,useCacheRefresh:function(){return Bn().memoizedState=WS.bind(null,We)},useEffectEvent:function(r){var i=Bn(),o={impl:r};return i.memoizedState=o,function(){if((xt&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},dh={readContext:wn,use:fu,useCallback:P0,useContext:wn,useEffect:ih,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:z0,useMemo:U0,useReducer:hu,useRef:M0,useState:function(){return hu(ys)},useDebugValue:ah,useDeferredValue:function(r,i){var o=tn();return $0(o,St.memoizedState,r,i)},useTransition:function(){var r=hu(ys)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:oo(r),i]},useSyncExternalStore:m0,useId:q0,useHostTransitionStatus:ch,useFormState:E0,useActionState:E0,useOptimistic:function(r,i){var o=tn();return _0(o,St,r,i)},useMemoCache:eh,useCacheRefresh:V0};dh.useEffectEvent=L0;var W0={readContext:wn,use:fu,useCallback:P0,useContext:wn,useEffect:ih,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:z0,useMemo:U0,useReducer:nh,useRef:M0,useState:function(){return nh(ys)},useDebugValue:ah,useDeferredValue:function(r,i){var o=tn();return St===null?lh(o,r,i):$0(o,St.memoizedState,r,i)},useTransition:function(){var r=nh(ys)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:oo(r),i]},useSyncExternalStore:m0,useId:q0,useHostTransitionStatus:ch,useFormState:A0,useActionState:A0,useOptimistic:function(r,i){var o=tn();return St!==null?_0(o,St,r,i):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:eh,useCacheRefresh:V0};W0.useEffectEvent=L0;function fh(r,i,o,d){i=r.memoizedState,o=o(d,i),o=o==null?i:v({},i,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var hh={enqueueSetState:function(r,i,o){r=r._reactInternals;var d=cr(),m=ii(d);m.payload=i,o!=null&&(m.callback=o),i=ai(r,m,d),i!==null&&(Xn(i,r,d),so(i,r,d))},enqueueReplaceState:function(r,i,o){r=r._reactInternals;var d=cr(),m=ii(d);m.tag=1,m.payload=i,o!=null&&(m.callback=o),i=ai(r,m,d),i!==null&&(Xn(i,r,d),so(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var o=cr(),d=ii(o);d.tag=2,i!=null&&(d.callback=i),i=ai(r,d,o),i!==null&&(Xn(i,r,o),so(i,r,o))}};function K0(r,i,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):i.prototype&&i.prototype.isPureReactComponent?!Wl(o,d)||!Wl(m,x):!0}function Z0(r,i,o,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(o,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(o,d),i.state!==r&&hh.enqueueReplaceState(i,i.state,null)}function Ji(r,i){var o=i;if("ref"in i){o={};for(var d in i)d!=="ref"&&(o[d]=i[d])}if(r=r.defaultProps){o===i&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function J0(r){Qc(r)}function ev(r){console.error(r)}function tv(r){Qc(r)}function xu(r,i){try{var o=r.onUncaughtError;o(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function nv(r,i,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function ph(r,i,o){return o=ii(o),o.tag=3,o.payload={element:null},o.callback=function(){xu(r,i)},o}function rv(r){return r=ii(r),r.tag=3,r}function sv(r,i,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){nv(i,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){nv(i,o,d),typeof m!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function ZS(r,i,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=o.alternate,i!==null&&$a(i,o,m,!0),o=ir.current,o!==null){switch(o.tag){case 31:case 13:return Nr===null?Tu():o.alternate===null&&Kt===0&&(Kt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===su?o.flags|=16384:(i=o.updateQueue,i===null?o.updateQueue=new Set([d]):i.add(d),Uh(r,d,m)),!1;case 22:return o.flags|=65536,d===su?o.flags|=16384:(i=o.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=i):(o=i.retryQueue,o===null?i.retryQueue=new Set([d]):o.add(d)),Uh(r,d,m)),!1}throw Error(s(435,o.tag))}return Uh(r,d,m),Tu(),!1}if(dt)return i=ir.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=m,d!==Lf&&(r=Error(s(422),{cause:d}),Jl(wr(r,o)))):(d!==Lf&&(i=Error(s(423),{cause:d}),Jl(wr(i,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=wr(d,o),m=ph(r.stateNode,d,m),qf(r,m),Kt!==4&&(Kt=2)),!1;var x=Error(s(520),{cause:d});if(x=wr(x,o),bo===null?bo=[x]:bo.push(x),Kt!==4&&(Kt=2),i===null)return!0;d=wr(d,o),o=i;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=ph(o.stateNode,d,r),qf(o,r),!1;case 1:if(i=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(fi===null||!fi.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=rv(m),sv(m,r,o,d),qf(o,m),!1}o=o.return}while(o!==null);return!1}var mh=Error(s(461)),an=!1;function Sn(r,i,o,d){i.child=r===null?o0(i,null,o,d):Ki(i,r.child,o,d)}function iv(r,i,o,d,m){o=o.render;var x=i.ref;if("ref"in d){var w={};for(var N in d)N!=="ref"&&(w[N]=d[N])}else w=d;return Yi(i),d=Wf(r,i,o,w,x,m),N=Kf(),r!==null&&!an?(Zf(r,i,m),_s(r,i,m)):(dt&&N&&Mf(i),i.flags|=1,Sn(r,i,d,m),i.child)}function av(r,i,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!Ef(x)&&x.defaultProps===void 0&&o.compare===null?(i.tag=15,i.type=x,lv(r,i,x,d,m)):(r=Zc(o.type,null,d,i,i.mode,m),r.ref=i.ref,r.return=i,i.child=r)}if(x=r.child,!Sh(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Wl,o(w,d)&&r.ref===i.ref)return _s(r,i,m)}return i.flags|=1,r=ms(x,d),r.ref=i.ref,r.return=i,i.child=r}function lv(r,i,o,d,m){if(r!==null){var x=r.memoizedProps;if(Wl(x,d)&&r.ref===i.ref)if(an=!1,i.pendingProps=d=x,Sh(r,m))(r.flags&131072)!==0&&(an=!0);else return i.lanes=r.lanes,_s(r,i,m)}return gh(r,i,o,d,m)}function ov(r,i,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=i.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,i.child=null;return cv(r,i,x,o,d)}if((o&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&nu(i,x!==null?x.cachePool:null),x!==null?d0(i,x):Gf(),f0(i);else return d=i.lanes=536870912,cv(r,i,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(nu(i,x.cachePool),d0(i,x),oi(),i.memoizedState=null):(r!==null&&nu(i,null),Gf(),oi());return Sn(r,i,m,o),i.child}function fo(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function cv(r,i,o,d,m){var x=$f();return x=x===null?null:{parent:rn._currentValue,pool:x},i.memoizedState={baseLanes:o,cachePool:x},r!==null&&nu(i,null),Gf(),f0(i),r!==null&&$a(r,i,d,!0),i.childLanes=m,null}function vu(r,i){return i=yu({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function uv(r,i,o){return Ki(i,r.child,null,o),r=vu(i,i.pendingProps),r.flags|=2,ar(i),i.memoizedState=null,r}function JS(r,i,o){var d=i.pendingProps,m=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(dt){if(d.mode==="hidden")return r=vu(i,d),i.lanes=536870912,fo(null,r);if(Qf(i),(r=Pt)?(r=w1(r,jr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ei!==null?{id:Jr,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=Yx(r),o.return=i,i.child=o,_n=i,Pt=null)):r=null,r===null)throw ni(i);return i.lanes=536870912,null}return vu(i,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(Qf(i),m)if(i.flags&256)i.flags&=-257,i=uv(r,i,o);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(s(558));else if(an||$a(r,i,o,!1),m=(o&r.childLanes)!==0,an||m){if(d=Ct,d!==null&&(w=Ol(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,Ii(r,w),Xn(d,r,w),mh;Tu(),i=uv(r,i,o)}else r=x.treeContext,Pt=Cr(w.nextSibling),_n=i,dt=!0,ti=null,jr=!1,r!==null&&Wx(i,r),i=vu(i,d),i.flags|=4096;return i}return r=ms(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function bu(r,i){var o=i.ref;if(o===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(r===null||r.ref!==o)&&(i.flags|=4194816)}}function gh(r,i,o,d,m){return Yi(i),o=Wf(r,i,o,d,void 0,m),d=Kf(),r!==null&&!an?(Zf(r,i,m),_s(r,i,m)):(dt&&d&&Mf(i),i.flags|=1,Sn(r,i,o,m),i.child)}function dv(r,i,o,d,m,x){return Yi(i),i.updateQueue=null,o=p0(i,d,o,m),h0(r),d=Kf(),r!==null&&!an?(Zf(r,i,x),_s(r,i,x)):(dt&&d&&Mf(i),i.flags|=1,Sn(r,i,o,x),i.child)}function fv(r,i,o,d,m){if(Yi(i),i.stateNode===null){var x=Oa,w=o.contextType;typeof w=="object"&&w!==null&&(x=wn(w)),x=new o(d,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=hh,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=d,x.state=i.memoizedState,x.refs={},Hf(i),w=o.contextType,x.context=typeof w=="object"&&w!==null?wn(w):Oa,x.state=i.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(fh(i,o,w,d),x.state=i.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&hh.enqueueReplaceState(x,x.state,null),ao(i,d,x,m),io(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){x=i.stateNode;var N=i.memoizedProps,H=Ji(o,N);x.props=H;var ee=x.context,oe=o.contextType;w=Oa,typeof oe=="object"&&oe!==null&&(w=wn(oe));var ue=o.getDerivedStateFromProps;oe=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=i.pendingProps!==N,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||ee!==w)&&Z0(i,x,d,w),si=!1;var ne=i.memoizedState;x.state=ne,ao(i,d,x,m),io(),ee=i.memoizedState,N||ne!==ee||si?(typeof ue=="function"&&(fh(i,o,ue,d),ee=i.memoizedState),(H=si||K0(i,o,H,d,ne,ee,w))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=H):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{x=i.stateNode,If(r,i),w=i.memoizedProps,oe=Ji(o,w),x.props=oe,ue=i.pendingProps,ne=x.context,ee=o.contextType,H=Oa,typeof ee=="object"&&ee!==null&&(H=wn(ee)),N=o.getDerivedStateFromProps,(ee=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ue||ne!==H)&&Z0(i,x,d,H),si=!1,ne=i.memoizedState,x.state=ne,ao(i,d,x,m),io();var ie=i.memoizedState;w!==ue||ne!==ie||si||r!==null&&r.dependencies!==null&&eu(r.dependencies)?(typeof N=="function"&&(fh(i,o,N,d),ie=i.memoizedState),(oe=si||K0(i,o,oe,d,ne,ie,H)||r!==null&&r.dependencies!==null&&eu(r.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,ie,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,ie,H)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ie),x.props=d,x.state=ie,x.context=H,d=oe):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),d=!1)}return x=d,bu(r,i),d=(i.flags&128)!==0,x||d?(x=i.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,r!==null&&d?(i.child=Ki(i,r.child,null,m),i.child=Ki(i,null,o,m)):Sn(r,i,o,m),i.memoizedState=x.state,r=i.child):r=_s(r,i,m),r}function hv(r,i,o,d){return Vi(),i.flags|=256,Sn(r,i,o,d),i.child}var xh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vh(r){return{baseLanes:r,cachePool:n0()}}function bh(r,i,o){return r=r!==null?r.childLanes&~o:0,i&&(r|=or),r}function pv(r,i,o){var d=i.pendingProps,m=!1,x=(i.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),w&&(m=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,r===null){if(dt){if(m?li(i):oi(),(r=Pt)?(r=w1(r,jr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ei!==null?{id:Jr,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=Yx(r),o.return=i,i.child=o,_n=i,Pt=null)):r=null,r===null)throw ni(i);return tp(r)?i.lanes=32:i.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(oi(),m=i.mode,N=yu({mode:"hidden",children:N},m),d=qi(d,m,o,null),N.return=i,d.return=i,N.sibling=d,i.child=N,d=i.child,d.memoizedState=vh(o),d.childLanes=bh(r,w,o),i.memoizedState=xh,fo(null,d)):(li(i),yh(i,N))}var H=r.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(x)i.flags&256?(li(i),i.flags&=-257,i=_h(r,i,o)):i.memoizedState!==null?(oi(),i.child=r.child,i.flags|=128,i=null):(oi(),N=d.fallback,m=i.mode,d=yu({mode:"visible",children:d.children},m),N=qi(N,m,o,null),N.flags|=2,d.return=i,N.return=i,d.sibling=N,i.child=d,Ki(i,r.child,null,o),d=i.child,d.memoizedState=vh(o),d.childLanes=bh(r,w,o),i.memoizedState=xh,i=fo(null,d));else if(li(i),tp(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(s(419)),d.stack="",d.digest=w,Jl({value:d,source:null,stack:null}),i=_h(r,i,o)}else if(an||$a(r,i,o,!1),w=(o&r.childLanes)!==0,an||w){if(w=Ct,w!==null&&(d=Ol(w,o),d!==0&&d!==H.retryLane))throw H.retryLane=d,Ii(r,d),Xn(w,r,d),mh;ep(N)||Tu(),i=_h(r,i,o)}else ep(N)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,Pt=Cr(N.nextSibling),_n=i,dt=!0,ti=null,jr=!1,r!==null&&Wx(i,r),i=yh(i,d.children),i.flags|=4096);return i}return m?(oi(),N=d.fallback,m=i.mode,H=r.child,ee=H.sibling,d=ms(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,ee!==null?N=ms(ee,N):(N=qi(N,m,o,null),N.flags|=2),N.return=i,d.return=i,d.sibling=N,i.child=d,fo(null,d),d=i.child,N=r.child.memoizedState,N===null?N=vh(o):(m=N.cachePool,m!==null?(H=rn._currentValue,m=m.parent!==H?{parent:H,pool:H}:m):m=n0(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=bh(r,w,o),i.memoizedState=xh,fo(r.child,d)):(li(i),o=r.child,r=o.sibling,o=ms(o,{mode:"visible",children:d.children}),o.return=i,o.sibling=null,r!==null&&(w=i.deletions,w===null?(i.deletions=[r],i.flags|=16):w.push(r)),i.child=o,i.memoizedState=null,o)}function yh(r,i){return i=yu({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function yu(r,i){return r=sr(22,r,null,i),r.lanes=0,r}function _h(r,i,o){return Ki(i,r.child,null,o),r=yh(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function mv(r,i,o){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),Of(r.return,i,o)}function wh(r,i,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function gv(r,i,o){var d=i.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=en.current,N=(w&2)!==0;if(N?(w=w&1|2,i.flags|=128):w&=1,M(en,w),Sn(r,i,d,o),d=dt?Zl:0,!N&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&mv(r,o,i);else if(r.tag===19)mv(r,o,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=i.child,m=null;o!==null;)r=o.alternate,r!==null&&ou(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=i.child,i.child=null):(m=o.sibling,o.sibling=null),wh(i,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=i.child,i.child=null;m!==null;){if(r=m.alternate,r!==null&&ou(r)===null){i.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}wh(i,!0,o,null,x,d);break;case"together":wh(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function _s(r,i,o){if(r!==null&&(i.dependencies=r.dependencies),di|=i.lanes,(o&i.childLanes)===0)if(r!==null){if($a(r,i,o,!1),(o&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(s(153));if(i.child!==null){for(r=i.child,o=ms(r,r.pendingProps),i.child=o,o.return=i;r.sibling!==null;)r=r.sibling,o=o.sibling=ms(r,r.pendingProps),o.return=i;o.sibling=null}return i.child}function Sh(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&eu(r)))}function ek(r,i,o){switch(i.tag){case 3:Le(i,i.stateNode.containerInfo),ri(i,rn,r.memoizedState.cache),Vi();break;case 27:case 5:Je(i);break;case 4:Le(i,i.stateNode.containerInfo);break;case 10:ri(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Qf(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(li(i),i.flags|=128,null):(o&i.child.childLanes)!==0?pv(r,i,o):(li(i),r=_s(r,i,o),r!==null?r.sibling:null);li(i);break;case 19:var m=(r.flags&128)!==0;if(d=(o&i.childLanes)!==0,d||($a(r,i,o,!1),d=(o&i.childLanes)!==0),m){if(d)return gv(r,i,o);i.flags|=128}if(m=i.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(en,en.current),d)break;return null;case 22:return i.lanes=0,ov(r,i,o,i.pendingProps);case 24:ri(i,rn,r.memoizedState.cache)}return _s(r,i,o)}function xv(r,i,o){if(r!==null)if(r.memoizedProps!==i.pendingProps)an=!0;else{if(!Sh(r,o)&&(i.flags&128)===0)return an=!1,ek(r,i,o);an=(r.flags&131072)!==0}else an=!1,dt&&(i.flags&1048576)!==0&&Xx(i,Zl,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Xi(i.elementType),i.type=r,typeof r=="function")Ef(r)?(d=Ji(r,d),i.tag=1,i=fv(null,i,r,d,o)):(i.tag=0,i=gh(null,i,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===D){i.tag=11,i=iv(null,i,r,d,o);break e}else if(m===I){i.tag=14,i=av(null,i,r,d,o);break e}}throw i=W(r)||r,Error(s(306,i,""))}}return i;case 0:return gh(r,i,i.type,i.pendingProps,o);case 1:return d=i.type,m=Ji(d,i.pendingProps),fv(r,i,d,m,o);case 3:e:{if(Le(i,i.stateNode.containerInfo),r===null)throw Error(s(387));d=i.pendingProps;var x=i.memoizedState;m=x.element,If(r,i),ao(i,d,null,o);var w=i.memoizedState;if(d=w.cache,ri(i,rn,d),d!==x.cache&&Bf(i,[rn],o,!0),io(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=hv(r,i,d,o);break e}else if(d!==m){m=wr(Error(s(424)),i),Jl(m),i=hv(r,i,d,o);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Pt=Cr(r.firstChild),_n=i,dt=!0,ti=null,jr=!0,o=o0(i,null,d,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Vi(),d===m){i=_s(r,i,o);break e}Sn(r,i,d,o)}i=i.child}return i;case 26:return bu(r,i),r===null?(o=E1(i.type,null,i.pendingProps,null))?i.memoizedState=o:dt||(o=i.type,r=i.pendingProps,d=Ou(Ce.current).createElement(o),d[Ht]=i,d[yn]=r,kn(d,o,r),Yt(d),i.stateNode=d):i.memoizedState=E1(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Je(i),r===null&&dt&&(d=i.stateNode=j1(i.type,i.pendingProps,Ce.current),_n=i,jr=!0,m=Pt,gi(i.type)?(np=m,Pt=Cr(d.firstChild)):Pt=m),Sn(r,i,i.pendingProps.children,o),bu(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&dt&&((m=d=Pt)&&(d=Ak(d,i.type,i.pendingProps,jr),d!==null?(i.stateNode=d,_n=i,Pt=Cr(d.firstChild),jr=!1,m=!0):m=!1),m||ni(i)),Je(i),m=i.type,x=i.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,Kh(m,x)?d=null:w!==null&&Kh(m,w)&&(i.flags|=32),i.memoizedState!==null&&(m=Wf(r,i,VS,null,null,o),Co._currentValue=m),bu(r,i),Sn(r,i,d,o),i.child;case 6:return r===null&&dt&&((r=o=Pt)&&(o=Mk(o,i.pendingProps,jr),o!==null?(i.stateNode=o,_n=i,Pt=null,r=!0):r=!1),r||ni(i)),null;case 13:return pv(r,i,o);case 4:return Le(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ki(i,null,d,o):Sn(r,i,d,o),i.child;case 11:return iv(r,i,i.type,i.pendingProps,o);case 7:return Sn(r,i,i.pendingProps,o),i.child;case 8:return Sn(r,i,i.pendingProps.children,o),i.child;case 12:return Sn(r,i,i.pendingProps.children,o),i.child;case 10:return d=i.pendingProps,ri(i,i.type,d.value),Sn(r,i,d.children,o),i.child;case 9:return m=i.type._context,d=i.pendingProps.children,Yi(i),m=wn(m),d=d(m),i.flags|=1,Sn(r,i,d,o),i.child;case 14:return av(r,i,i.type,i.pendingProps,o);case 15:return lv(r,i,i.type,i.pendingProps,o);case 19:return gv(r,i,o);case 31:return JS(r,i,o);case 22:return ov(r,i,o,i.pendingProps);case 24:return Yi(i),d=wn(rn),r===null?(m=$f(),m===null&&(m=Ct,x=Pf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),i.memoizedState={parent:d,cache:m},Hf(i),ri(i,rn,m)):((r.lanes&o)!==0&&(If(r,i),ao(i,null,null,o),io()),m=r.memoizedState,x=i.memoizedState,m.parent!==d?(m={parent:d,cache:d},i.memoizedState=m,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=m),ri(i,rn,d)):(d=x.cache,ri(i,rn,d),d!==m.cache&&Bf(i,[rn],o,!0))),Sn(r,i,i.pendingProps.children,o),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function ws(r){r.flags|=4}function kh(r,i,o,d,m){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(qv())r.flags|=8192;else throw Wi=su,Ff}else r.flags&=-16777217}function vv(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!L1(i))if(qv())r.flags|=8192;else throw Wi=su,Ff}function _u(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?nn():536870912,r.lanes|=i,Za|=i)}function ho(r,i){if(!dt)switch(r.tailMode){case"hidden":i=r.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ut(r){var i=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(i)for(var m=r.child;m!==null;)o|=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;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,i}function tk(r,i,o){var d=i.pendingProps;switch(Rf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(i),null;case 1:return Ut(i),null;case 3:return o=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),vs(rn),Be(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(Ua(i)?ws(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Df())),Ut(i),null;case 26:var m=i.type,x=i.memoizedState;return r===null?(ws(i),x!==null?(Ut(i),vv(i,x)):(Ut(i),kh(i,m,null,d,o))):x?x!==r.memoizedState?(ws(i),Ut(i),vv(i,x)):(Ut(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&ws(i),Ut(i),kh(i,m,r,d,o)),null;case 27:if(xe(i),o=Ce.current,m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&ws(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return Ut(i),null}r=he.current,Ua(i)?Kx(i):(r=j1(m,d,o),i.stateNode=r,ws(i))}return Ut(i),null;case 5:if(xe(i),m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&ws(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return Ut(i),null}if(x=he.current,Ua(i))Kx(i);else{var w=Ou(Ce.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Ht]=i,x[yn]=d;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=x;e:switch(kn(x,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&&ws(i)}}return Ut(i),kh(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,o),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&ws(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(s(166));if(r=Ce.current,Ua(i)){if(r=i.stateNode,o=i.memoizedProps,d=null,m=_n,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Ht]=i,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||p1(r.nodeValue,o)),r||ni(i,!0)}else r=Ou(r).createTextNode(d),r[Ht]=i,i.stateNode=r}return Ut(i),null;case 31:if(o=i.memoizedState,r===null||r.memoizedState!==null){if(d=Ua(i),o!==null){if(r===null){if(!d)throw Error(s(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[Ht]=i}else Vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ut(i),r=!1}else o=Df(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return i.flags&256?(ar(i),i):(ar(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Ut(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ua(i),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(s(318));if(m=i.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));m[Ht]=i}else Vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ut(i),m=!1}else m=Df(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return i.flags&256?(ar(i),i):(ar(i),null)}return ar(i),(i.flags&128)!==0?(i.lanes=o,i):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=i.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(i.child.flags|=8192),_u(i,i.updateQueue),Ut(i),null);case 4:return Be(),r===null&&Gh(i.stateNode.containerInfo),Ut(i),null;case 10:return vs(i.type),Ut(i),null;case 19:if(Z(en),d=i.memoizedState,d===null)return Ut(i),null;if(m=(i.flags&128)!==0,x=d.rendering,x===null)if(m)ho(d,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(x=ou(r),x!==null){for(i.flags|=128,ho(d,!1),r=x.updateQueue,i.updateQueue=r,_u(i,r),i.subtreeFlags=0,r=o,o=i.child;o!==null;)Gx(o,r),o=o.sibling;return M(en,en.current&1|2),dt&&gs(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&qe()>Nu&&(i.flags|=128,m=!0,ho(d,!1),i.lanes=4194304)}else{if(!m)if(r=ou(x),r!==null){if(i.flags|=128,m=!0,r=r.updateQueue,i.updateQueue=r,_u(i,r),ho(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!dt)return Ut(i),null}else 2*qe()-d.renderingStartTime>Nu&&o!==536870912&&(i.flags|=128,m=!0,ho(d,!1),i.lanes=4194304);d.isBackwards?(x.sibling=i.child,i.child=x):(r=d.last,r!==null?r.sibling=x:i.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=qe(),r.sibling=null,o=en.current,M(en,m?o&1|2:o&1),dt&&gs(i,d.treeForkCount),r):(Ut(i),null);case 22:case 23:return ar(i),Yf(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(o&536870912)!==0&&(i.flags&128)===0&&(Ut(i),i.subtreeFlags&6&&(i.flags|=8192)):Ut(i),o=i.updateQueue,o!==null&&_u(i,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==o&&(i.flags|=2048),r!==null&&Z(Qi),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),vs(rn),Ut(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function nk(r,i){switch(Rf(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return vs(rn),Be(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return xe(i),null;case 31:if(i.memoizedState!==null){if(ar(i),i.alternate===null)throw Error(s(340));Vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(ar(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return Z(en),null;case 4:return Be(),null;case 10:return vs(i.type),null;case 22:case 23:return ar(i),Yf(),r!==null&&Z(Qi),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return vs(rn),null;case 25:return null;default:return null}}function bv(r,i){switch(Rf(i),i.tag){case 3:vs(rn),Be();break;case 26:case 27:case 5:xe(i);break;case 4:Be();break;case 31:i.memoizedState!==null&&ar(i);break;case 13:ar(i);break;case 19:Z(en);break;case 10:vs(i.type);break;case 22:case 23:ar(i),Yf(),r!==null&&Z(Qi);break;case 24:vs(rn)}}function po(r,i){try{var o=i.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(N){wt(i,i.return,N)}}function ci(r,i,o){try{var d=i.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,m=i;var H=o,ee=N;try{ee()}catch(oe){wt(m,H,oe)}}}d=d.next}while(d!==x)}}catch(oe){wt(i,i.return,oe)}}function yv(r){var i=r.updateQueue;if(i!==null){var o=r.stateNode;try{u0(i,o)}catch(d){wt(r,r.return,d)}}}function _v(r,i,o){o.props=Ji(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){wt(r,i,d)}}function mo(r,i){try{var o=r.ref;if(o!==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 o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){wt(r,i,m)}}function ts(r,i){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){wt(r,i,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){wt(r,i,m)}else o.current=null}function wv(r){var i=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){wt(r,r.return,m)}}function jh(r,i,o){try{var d=r.stateNode;kk(d,r.type,o,i),d[yn]=i}catch(m){wt(r,r.return,m)}}function Sv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&gi(r.type)||r.tag===4}function Nh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Sv(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&&gi(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 Ch(r,i,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(r),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=vr));else if(d!==4&&(d===27&&gi(r.type)&&(o=r.stateNode,i=null),r=r.child,r!==null))for(Ch(r,i,o),r=r.sibling;r!==null;)Ch(r,i,o),r=r.sibling}function wu(r,i,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?o.insertBefore(r,i):o.appendChild(r);else if(d!==4&&(d===27&&gi(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(wu(r,i,o),r=r.sibling;r!==null;)wu(r,i,o),r=r.sibling}function kv(r){var i=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=i.attributes;m.length;)i.removeAttributeNode(m[0]);kn(i,d,o),i[Ht]=r,i[yn]=o}catch(x){wt(r,r.return,x)}}var Ss=!1,ln=!1,Eh=!1,jv=typeof WeakSet=="function"?WeakSet:Set,xn=null;function rk(r,i){if(r=r.containerInfo,Xh=Iu,r=Bx(r),_f(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,N=-1,H=-1,ee=0,oe=0,ue=r,ne=null;t:for(;;){for(var ie;ue!==o||m!==0&&ue.nodeType!==3||(N=w+m),ue!==x||d!==0&&ue.nodeType!==3||(H=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(ie=ue.firstChild)!==null;)ne=ue,ue=ie;for(;;){if(ue===r)break t;if(ne===o&&++ee===m&&(N=w),ne===x&&++oe===d&&(H=w),(ie=ue.nextSibling)!==null)break;ue=ne,ne=ue.parentNode}ue=ie}o=N===-1||H===-1?null:{start:N,end:H}}else o=null}o=o||{start:0,end:0}}else o=null;for(Wh={focusedElem:r,selectionRange:o},Iu=!1,xn=i;xn!==null;)if(i=xn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,xn=r;else for(;xn!==null;){switch(i=xn,x=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=i,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Ee=Ji(o.type,m);r=d.getSnapshotBeforeUpdate(Ee,x),d.__reactInternalSnapshotBeforeUpdate=r}catch($e){wt(o,o.return,$e)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,o=r.nodeType,o===9)Jh(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Jh(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(s(163))}if(r=i.sibling,r!==null){r.return=i.return,xn=r;break}xn=i.return}}function Nv(r,i,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:js(r,o),d&4&&po(5,o);break;case 1:if(js(r,o),d&4)if(r=o.stateNode,i===null)try{r.componentDidMount()}catch(w){wt(o,o.return,w)}else{var m=Ji(o.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(m,i,r.__reactInternalSnapshotBeforeUpdate)}catch(w){wt(o,o.return,w)}}d&64&&yv(o),d&512&&mo(o,o.return);break;case 3:if(js(r,o),d&64&&(r=o.updateQueue,r!==null)){if(i=null,o.child!==null)switch(o.child.tag){case 27:case 5:i=o.child.stateNode;break;case 1:i=o.child.stateNode}try{u0(r,i)}catch(w){wt(o,o.return,w)}}break;case 27:i===null&&d&4&&kv(o);case 26:case 5:js(r,o),i===null&&d&4&&wv(o),d&512&&mo(o,o.return);break;case 12:js(r,o);break;case 31:js(r,o),d&4&&Tv(r,o);break;case 13:js(r,o),d&4&&Av(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=fk.bind(null,o),Rk(r,o))));break;case 22:if(d=o.memoizedState!==null||Ss,!d){i=i!==null&&i.memoizedState!==null||ln,m=Ss;var x=ln;Ss=d,(ln=i)&&!x?Ns(r,o,(o.subtreeFlags&8772)!==0):js(r,o),Ss=m,ln=x}break;case 30:break;default:js(r,o)}}function Cv(r){var i=r.alternate;i!==null&&(r.alternate=null,Cv(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Gs(i)),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 It=null,Vn=!1;function ks(r,i,o){for(o=o.child;o!==null;)Ev(r,i,o),o=o.sibling}function Ev(r,i,o){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(tt,o)}catch{}switch(o.tag){case 26:ln||ts(o,i),ks(r,i,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:ln||ts(o,i);var d=It,m=Vn;gi(o.type)&&(It=o.stateNode,Vn=!1),ks(r,i,o),ko(o.stateNode),It=d,Vn=m;break;case 5:ln||ts(o,i);case 6:if(d=It,m=Vn,It=null,ks(r,i,o),It=d,Vn=m,It!==null)if(Vn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(o.stateNode)}catch(x){wt(o,i,x)}else try{It.removeChild(o.stateNode)}catch(x){wt(o,i,x)}break;case 18:It!==null&&(Vn?(r=It,y1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),al(r)):y1(It,o.stateNode));break;case 4:d=It,m=Vn,It=o.stateNode.containerInfo,Vn=!0,ks(r,i,o),It=d,Vn=m;break;case 0:case 11:case 14:case 15:ci(2,o,i),ln||ci(4,o,i),ks(r,i,o);break;case 1:ln||(ts(o,i),d=o.stateNode,typeof d.componentWillUnmount=="function"&&_v(o,i,d)),ks(r,i,o);break;case 21:ks(r,i,o);break;case 22:ln=(d=ln)||o.memoizedState!==null,ks(r,i,o),ln=d;break;default:ks(r,i,o)}}function Tv(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{al(r)}catch(o){wt(i,i.return,o)}}}function Av(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{al(r)}catch(o){wt(i,i.return,o)}}function sk(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new jv),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new jv),i;default:throw Error(s(435,r.tag))}}function Su(r,i){var o=sk(r);i.forEach(function(d){if(!o.has(d)){o.add(d);var m=hk.bind(null,r,d);d.then(m,m)}})}function Gn(r,i){var o=i.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=i,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(gi(N.type)){It=N.stateNode,Vn=!1;break e}break;case 5:It=N.stateNode,Vn=!1;break e;case 3:case 4:It=N.stateNode.containerInfo,Vn=!0;break e}N=N.return}if(It===null)throw Error(s(160));Ev(x,w,m),It=null,Vn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Mv(i,r),i=i.sibling}var Hr=null;function Mv(r,i){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Gn(i,r),Yn(r),d&4&&(ci(3,r,r.return),po(3,r),ci(5,r,r.return));break;case 1:Gn(i,r),Yn(r),d&512&&(ln||o===null||ts(o,o.return)),d&64&&Ss&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Hr;if(Gn(i,r),Yn(r),d&512&&(ln||o===null||ts(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[Qr]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),kn(x,d,o),x[Ht]=r,Yt(x),d=x;break e;case"link":var w=M1("link","href",m).get(d+(o.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(N,1);break t}}x=m.createElement(d),kn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=M1("meta","content",m).get(d+(o.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(N,1);break t}}x=m.createElement(d),kn(x,d,o),m.head.appendChild(x);break;default:throw Error(s(468,d))}x[Ht]=r,Yt(x),d=x}r.stateNode=d}else R1(m,r.type,r.stateNode);else r.stateNode=A1(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?R1(m,r.type,r.stateNode):A1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&jh(r,r.memoizedProps,o.memoizedProps)}break;case 27:Gn(i,r),Yn(r),d&512&&(ln||o===null||ts(o,o.return)),o!==null&&d&4&&jh(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Gn(i,r),Yn(r),d&512&&(ln||o===null||ts(o,o.return)),r.flags&32){m=r.stateNode;try{Xs(m,"")}catch(Ee){wt(r,r.return,Ee)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,jh(r,m,o!==null?o.memoizedProps:m)),d&1024&&(Eh=!0);break;case 6:if(Gn(i,r),Yn(r),d&4){if(r.stateNode===null)throw Error(s(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ee){wt(r,r.return,Ee)}}break;case 3:if(Uu=null,m=Hr,Hr=Bu(i.containerInfo),Gn(i,r),Hr=m,Yn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{al(i.containerInfo)}catch(Ee){wt(r,r.return,Ee)}Eh&&(Eh=!1,Rv(r));break;case 4:d=Hr,Hr=Bu(r.stateNode.containerInfo),Gn(i,r),Yn(r),Hr=d;break;case 12:Gn(i,r),Yn(r);break;case 31:Gn(i,r),Yn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Su(r,d)));break;case 13:Gn(i,r),Yn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(ju=qe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Su(r,d)));break;case 22:m=r.memoizedState!==null;var H=o!==null&&o.memoizedState!==null,ee=Ss,oe=ln;if(Ss=ee||m,ln=oe||H,Gn(i,r),ln=oe,Ss=ee,Yn(r),d&8192)e:for(i=r.stateNode,i._visibility=m?i._visibility&-2:i._visibility|1,m&&(o===null||H||Ss||ln||ea(r)),o=null,i=r;;){if(i.tag===5||i.tag===26){if(o===null){H=o=i;try{if(x=H.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var ue=H.memoizedProps.style,ne=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;N.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ee){wt(H,H.return,Ee)}}}else if(i.tag===6){if(o===null){H=i;try{H.stateNode.nodeValue=m?"":H.memoizedProps}catch(Ee){wt(H,H.return,Ee)}}}else if(i.tag===18){if(o===null){H=i;try{var ie=H.stateNode;m?_1(ie,!0):_1(H.stateNode,!1)}catch(Ee){wt(H,H.return,Ee)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;o===i&&(o=null),i=i.return}o===i&&(o=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,Su(r,o))));break;case 19:Gn(i,r),Yn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Su(r,d)));break;case 30:break;case 21:break;default:Gn(i,r),Yn(r)}}function Yn(r){var i=r.flags;if(i&2){try{for(var o,d=r.return;d!==null;){if(Sv(d)){o=d;break}d=d.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var m=o.stateNode,x=Nh(r);wu(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(Xs(w,""),o.flags&=-33);var N=Nh(r);wu(r,N,w);break;case 3:case 4:var H=o.stateNode.containerInfo,ee=Nh(r);Ch(r,ee,H);break;default:throw Error(s(161))}}catch(oe){wt(r,r.return,oe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function Rv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;Rv(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function js(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Nv(r,i.alternate,i),i=i.sibling}function ea(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:ci(4,i,i.return),ea(i);break;case 1:ts(i,i.return);var o=i.stateNode;typeof o.componentWillUnmount=="function"&&_v(i,i.return,o),ea(i);break;case 27:ko(i.stateNode);case 26:case 5:ts(i,i.return),ea(i);break;case 22:i.memoizedState===null&&ea(i);break;case 30:ea(i);break;default:ea(i)}r=r.sibling}}function Ns(r,i,o){for(o=o&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,m=r,x=i,w=x.flags;switch(x.tag){case 0:case 11:case 15:Ns(m,x,o),po(4,x);break;case 1:if(Ns(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ee){wt(d,d.return,ee)}if(d=x,m=d.updateQueue,m!==null){var N=d.stateNode;try{var H=m.shared.hiddenCallbacks;if(H!==null)for(m.shared.hiddenCallbacks=null,m=0;m<H.length;m++)c0(H[m],N)}catch(ee){wt(d,d.return,ee)}}o&&w&64&&yv(x),mo(x,x.return);break;case 27:kv(x);case 26:case 5:Ns(m,x,o),o&&d===null&&w&4&&wv(x),mo(x,x.return);break;case 12:Ns(m,x,o);break;case 31:Ns(m,x,o),o&&w&4&&Tv(m,x);break;case 13:Ns(m,x,o),o&&w&4&&Av(m,x);break;case 22:x.memoizedState===null&&Ns(m,x,o),mo(x,x.return);break;case 30:break;default:Ns(m,x,o)}i=i.sibling}}function Th(r,i){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&eo(o))}function Ah(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&eo(r))}function Ir(r,i,o,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Lv(r,i,o,d),i=i.sibling}function Lv(r,i,o,d){var m=i.flags;switch(i.tag){case 0:case 11:case 15:Ir(r,i,o,d),m&2048&&po(9,i);break;case 1:Ir(r,i,o,d);break;case 3:Ir(r,i,o,d),m&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&eo(r)));break;case 12:if(m&2048){Ir(r,i,o,d),r=i.stateNode;try{var x=i.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){wt(i,i.return,H)}}else Ir(r,i,o,d);break;case 31:Ir(r,i,o,d);break;case 13:Ir(r,i,o,d);break;case 23:break;case 22:x=i.stateNode,w=i.alternate,i.memoizedState!==null?x._visibility&2?Ir(r,i,o,d):go(r,i):x._visibility&2?Ir(r,i,o,d):(x._visibility|=2,Xa(r,i,o,d,(i.subtreeFlags&10256)!==0||!1)),m&2048&&Th(w,i);break;case 24:Ir(r,i,o,d),m&2048&&Ah(i.alternate,i);break;default:Ir(r,i,o,d)}}function Xa(r,i,o,d,m){for(m=m&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=r,w=i,N=o,H=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Xa(x,w,N,H,m),po(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Xa(x,w,N,H,m):go(x,w):(oe._visibility|=2,Xa(x,w,N,H,m)),m&&ee&2048&&Th(w.alternate,w);break;case 24:Xa(x,w,N,H,m),m&&ee&2048&&Ah(w.alternate,w);break;default:Xa(x,w,N,H,m)}i=i.sibling}}function go(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var o=r,d=i,m=d.flags;switch(d.tag){case 22:go(o,d),m&2048&&Th(d.alternate,d);break;case 24:go(o,d),m&2048&&Ah(d.alternate,d);break;default:go(o,d)}i=i.sibling}}var xo=8192;function Wa(r,i,o){if(r.subtreeFlags&xo)for(r=r.child;r!==null;)Dv(r,i,o),r=r.sibling}function Dv(r,i,o){switch(r.tag){case 26:Wa(r,i,o),r.flags&xo&&r.memoizedState!==null&&qk(o,Hr,r.memoizedState,r.memoizedProps);break;case 5:Wa(r,i,o);break;case 3:case 4:var d=Hr;Hr=Bu(r.stateNode.containerInfo),Wa(r,i,o),Hr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=xo,xo=16777216,Wa(r,i,o),xo=d):Wa(r,i,o));break;default:Wa(r,i,o)}}function zv(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function vo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var o=0;o<i.length;o++){var d=i[o];xn=d,Bv(d,r)}zv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Ov(r),r=r.sibling}function Ov(r){switch(r.tag){case 0:case 11:case 15:vo(r),r.flags&2048&&ci(9,r,r.return);break;case 3:vo(r);break;case 12:vo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,ku(r)):vo(r);break;default:vo(r)}}function ku(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var o=0;o<i.length;o++){var d=i[o];xn=d,Bv(d,r)}zv(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:ci(8,i,i.return),ku(i);break;case 22:o=i.stateNode,o._visibility&2&&(o._visibility&=-3,ku(i));break;default:ku(i)}r=r.sibling}}function Bv(r,i){for(;xn!==null;){var o=xn;switch(o.tag){case 0:case 11:case 15:ci(8,o,i);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:eo(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,xn=d;else e:for(o=r;xn!==null;){d=xn;var m=d.sibling,x=d.return;if(Cv(d),d===o){xn=null;break e}if(m!==null){m.return=x,xn=m;break e}xn=x}}}var ik={getCacheForType:function(r){var i=wn(rn),o=i.data.get(r);return o===void 0&&(o=r(),i.data.set(r,o)),o},cacheSignal:function(){return wn(rn).controller.signal}},ak=typeof WeakMap=="function"?WeakMap:Map,xt=0,Ct=null,at=null,ct=0,_t=0,lr=null,ui=!1,Ka=!1,Mh=!1,Cs=0,Kt=0,di=0,ta=0,Rh=0,or=0,Za=0,bo=null,Qn=null,Lh=!1,ju=0,Pv=0,Nu=1/0,Cu=null,fi=null,mn=0,hi=null,Ja=null,Es=0,Dh=0,zh=null,Uv=null,yo=0,Oh=null;function cr(){return(xt&2)!==0&&ct!==0?ct&-ct:U.T!==null?Hh():Bl()}function $v(){if(or===0)if((ct&536870912)===0||dt){var r=Pr;Pr<<=1,(Pr&3932160)===0&&(Pr=262144),or=r}else or=536870912;return r=ir.current,r!==null&&(r.flags|=32),or}function Xn(r,i,o){(r===Ct&&(_t===2||_t===9)||r.cancelPendingCommit!==null)&&(el(r,0),pi(r,ct,or,!1)),zt(r,o),((xt&2)===0||r!==Ct)&&(r===Ct&&((xt&2)===0&&(ta|=o),Kt===4&&pi(r,ct,or,!1)),ns(r))}function Fv(r,i,o){if((xt&6)!==0)throw Error(s(327));var d=!o&&(i&127)===0&&(i&r.expiredLanes)===0||Qe(r,i),m=d?ck(r,i):Ph(r,i,!0),x=d;do{if(m===0){Ka&&!d&&pi(r,i,0,!1);break}else{if(o=r.current.alternate,x&&!lk(o)){m=Ph(r,i,!1),x=!1;continue}if(m===2){if(x=i,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var N=r;m=bo;var H=N.current.memoizedState.isDehydrated;if(H&&(el(N,w).flags|=256),w=Ph(N,w,!1),w!==2){if(Mh&&!H){N.errorRecoveryDisabledLanes|=x,ta|=x,m=4;break e}x=Qn,Qn=m,x!==null&&(Qn===null?Qn=x:Qn.push.apply(Qn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){el(r,0),pi(r,i,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:pi(d,i,or,!ui);break e;case 2:Qn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(m=ju+300-qe(),10<m)){if(pi(d,i,or,!ui),ge(d,0,!0)!==0)break e;Es=i,d.timeoutHandle=v1(Hv.bind(null,d,o,Qn,Cu,Lh,i,or,ta,Za,ui,x,"Throttled",-0,0),m);break e}Hv(d,o,Qn,Cu,Lh,i,or,ta,Za,ui,x,null,-0,0)}}break}while(!0);ns(r)}function Hv(r,i,o,d,m,x,w,N,H,ee,oe,ue,ne,ie){if(r.timeoutHandle=-1,ue=i.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vr},Dv(i,x,ue);var Ee=(x&62914560)===x?ju-qe():(x&4194048)===x?Pv-qe():0;if(Ee=Vk(ue,Ee),Ee!==null){Es=x,r.cancelPendingCommit=Ee(Wv.bind(null,r,i,x,o,d,m,w,N,H,oe,ue,null,ne,ie)),pi(r,x,w,!ee);return}}Wv(r,i,x,o,d,m,w,N,H)}function lk(r){for(var i=r;;){var o=i.tag;if((o===0||o===11||o===15)&&i.flags&16384&&(o=i.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!rr(x(),m))return!1}catch{return!1}}if(o=i.child,i.subtreeFlags&16384&&o!==null)o.return=i,i=o;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function pi(r,i,o,d){i&=~Rh,i&=~ta,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var m=i;0<m;){var x=31-Ke(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&mr(r,o,i)}function Eu(){return(xt&6)===0?(_o(0),!1):!0}function Bh(){if(at!==null){if(_t===0)var r=at.return;else r=at,xs=Gi=null,Jf(r),qa=null,no=0,r=at;for(;r!==null;)bv(r.alternate,r),r=r.return;at=null}}function el(r,i){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,Ck(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),Es=0,Bh(),Ct=r,at=o=ms(r.current,null),ct=i,_t=0,lr=null,ui=!1,Ka=Qe(r,i),Mh=!1,Za=or=Rh=ta=di=Kt=0,Qn=bo=null,Lh=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var m=31-Ke(d),x=1<<m;i|=r[m],d&=~x}return Cs=i,Xc(),o}function Iv(r,i){We=null,U.H=uo,i===Ia||i===ru?(i=i0(),_t=3):i===Ff?(i=i0(),_t=4):_t=i===mh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,lr=i,at===null&&(Kt=1,xu(r,wr(i,r.current)))}function qv(){var r=ir.current;return r===null?!0:(ct&4194048)===ct?Nr===null:(ct&62914560)===ct||(ct&536870912)!==0?r===Nr:!1}function Vv(){var r=U.H;return U.H=uo,r===null?uo:r}function Gv(){var r=U.A;return U.A=ik,r}function Tu(){Kt=4,ui||(ct&4194048)!==ct&&ir.current!==null||(Ka=!0),(di&134217727)===0&&(ta&134217727)===0||Ct===null||pi(Ct,ct,or,!1)}function Ph(r,i,o){var d=xt;xt|=2;var m=Vv(),x=Gv();(Ct!==r||ct!==i)&&(Cu=null,el(r,i)),i=!1;var w=Kt;e:do try{if(_t!==0&&at!==null){var N=at,H=lr;switch(_t){case 8:Bh(),w=6;break e;case 3:case 2:case 9:case 6:ir.current===null&&(i=!0);var ee=_t;if(_t=0,lr=null,tl(r,N,H,ee),o&&Ka){w=0;break e}break;default:ee=_t,_t=0,lr=null,tl(r,N,H,ee)}}ok(),w=Kt;break}catch(oe){Iv(r,oe)}while(!0);return i&&r.shellSuspendCounter++,xs=Gi=null,xt=d,U.H=m,U.A=x,at===null&&(Ct=null,ct=0,Xc()),w}function ok(){for(;at!==null;)Yv(at)}function ck(r,i){var o=xt;xt|=2;var d=Vv(),m=Gv();Ct!==r||ct!==i?(Cu=null,Nu=qe()+500,el(r,i)):Ka=Qe(r,i);e:do try{if(_t!==0&&at!==null){i=at;var x=lr;t:switch(_t){case 1:_t=0,lr=null,tl(r,i,x,1);break;case 2:case 9:if(r0(x)){_t=0,lr=null,Qv(i);break}i=function(){_t!==2&&_t!==9||Ct!==r||(_t=7),ns(r)},x.then(i,i);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:r0(x)?(_t=0,lr=null,Qv(i)):(_t=0,lr=null,tl(r,i,x,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var N=at;if(w?L1(w):N.stateNode.complete){_t=0,lr=null;var H=N.sibling;if(H!==null)at=H;else{var ee=N.return;ee!==null?(at=ee,Au(ee)):at=null}break t}}_t=0,lr=null,tl(r,i,x,5);break;case 6:_t=0,lr=null,tl(r,i,x,6);break;case 8:Bh(),Kt=6;break e;default:throw Error(s(462))}}uk();break}catch(oe){Iv(r,oe)}while(!0);return xs=Gi=null,U.H=d,U.A=m,xt=o,at!==null?0:(Ct=null,ct=0,Xc(),Kt)}function uk(){for(;at!==null&&!ze();)Yv(at)}function Yv(r){var i=xv(r.alternate,r,Cs);r.memoizedProps=r.pendingProps,i===null?Au(r):at=i}function Qv(r){var i=r,o=i.alternate;switch(i.tag){case 15:case 0:i=dv(o,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=dv(o,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Jf(i);default:bv(o,i),i=at=Gx(i,Cs),i=xv(o,i,Cs)}r.memoizedProps=r.pendingProps,i===null?Au(r):at=i}function tl(r,i,o,d){xs=Gi=null,Jf(i),qa=null,no=0;var m=i.return;try{if(ZS(r,m,i,o,ct)){Kt=1,xu(r,wr(o,r.current)),at=null;return}}catch(x){if(m!==null)throw at=m,x;Kt=1,xu(r,wr(o,r.current)),at=null;return}i.flags&32768?(dt||d===1?r=!0:Ka||(ct&536870912)!==0?r=!1:(ui=r=!0,(d===2||d===9||d===3||d===6)&&(d=ir.current,d!==null&&d.tag===13&&(d.flags|=16384))),Xv(i,r)):Au(i)}function Au(r){var i=r;do{if((i.flags&32768)!==0){Xv(i,ui);return}r=i.return;var o=tk(i.alternate,i,Cs);if(o!==null){at=o;return}if(i=i.sibling,i!==null){at=i;return}at=i=r}while(i!==null);Kt===0&&(Kt=5)}function Xv(r,i){do{var o=nk(r.alternate,r);if(o!==null){o.flags&=32767,at=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!i&&(r=r.sibling,r!==null)){at=r;return}at=r=o}while(r!==null);Kt=6,at=null}function Wv(r,i,o,d,m,x,w,N,H){r.cancelPendingCommit=null;do Mu();while(mn!==0);if((xt&6)!==0)throw Error(s(327));if(i!==null){if(i===r.current)throw Error(s(177));if(x=i.lanes|i.childLanes,x|=Nf,Dn(r,o,x,w,N,H),r===Ct&&(at=Ct=null,ct=0),Ja=i,hi=r,Es=o,Dh=x,zh=m,Uv=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,pk(Q,function(){return t1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=U.T,U.T=null,m=z.p,z.p=2,w=xt,xt|=4;try{rk(r,i,o)}finally{xt=w,z.p=m,U.T=d}}mn=1,Kv(),Zv(),Jv()}}function Kv(){if(mn===1){mn=0;var r=hi,i=Ja,o=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||o){o=U.T,U.T=null;var d=z.p;z.p=2;var m=xt;xt|=4;try{Mv(i,r);var x=Wh,w=Bx(r.containerInfo),N=x.focusedElem,H=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&Ox(N.ownerDocument.documentElement,N)){if(H!==null&&_f(N)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in N)N.selectionStart=ee,N.selectionEnd=Math.min(oe,N.value.length);else{var ue=N.ownerDocument||document,ne=ue&&ue.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),Ee=N.textContent.length,$e=Math.min(H.start,Ee),jt=H.end===void 0?$e:Math.min(H.end,Ee);!ie.extend&&$e>jt&&(w=jt,jt=$e,$e=w);var K=zx(N,$e),V=zx(N,jt);if(K&&V&&(ie.rangeCount!==1||ie.anchorNode!==K.node||ie.anchorOffset!==K.offset||ie.focusNode!==V.node||ie.focusOffset!==V.offset)){var J=ue.createRange();J.setStart(K.node,K.offset),ie.removeAllRanges(),$e>jt?(ie.addRange(J),ie.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),ie.addRange(J))}}}}for(ue=[],ie=N;ie=ie.parentNode;)ie.nodeType===1&&ue.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ue.length;N++){var ce=ue[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Iu=!!Xh,Wh=Xh=null}finally{xt=m,z.p=d,U.T=o}}r.current=i,mn=2}}function Zv(){if(mn===2){mn=0;var r=hi,i=Ja,o=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||o){o=U.T,U.T=null;var d=z.p;z.p=2;var m=xt;xt|=4;try{Nv(r,i.alternate,i)}finally{xt=m,z.p=d,U.T=o}}mn=3}}function Jv(){if(mn===4||mn===3){mn=0,yt();var r=hi,i=Ja,o=Es,d=Uv;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?mn=5:(mn=0,Ja=hi=null,e1(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(fi=null),Ri(o),i=i.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(tt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=U.T,m=z.p,z.p=2,U.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var N=d[w];x(N.value,{componentStack:N.stack})}}finally{U.T=i,z.p=m}}(Es&3)!==0&&Mu(),ns(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===Oh?yo++:(yo=0,Oh=r):yo=0,_o(0)}}function e1(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,eo(i)))}function Mu(){return Kv(),Zv(),Jv(),t1()}function t1(){if(mn!==5)return!1;var r=hi,i=Dh;Dh=0;var o=Ri(Es),d=U.T,m=z.p;try{z.p=32>o?32:o,U.T=null,o=zh,zh=null;var x=hi,w=Es;if(mn=0,Ja=hi=null,Es=0,(xt&6)!==0)throw Error(s(331));var N=xt;if(xt|=4,Ov(x.current),Lv(x,x.current,w,o),xt=N,_o(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(tt,x)}catch{}return!0}finally{z.p=m,U.T=d,e1(r,i)}}function n1(r,i,o){i=wr(o,i),i=ph(r.stateNode,i,2),r=ai(r,i,2),r!==null&&(zt(r,2),ns(r))}function wt(r,i,o){if(r.tag===3)n1(r,r,o);else for(;i!==null;){if(i.tag===3){n1(i,r,o);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(fi===null||!fi.has(d))){r=wr(o,r),o=rv(2),d=ai(i,o,2),d!==null&&(sv(o,d,i,r),zt(d,2),ns(d));break}}i=i.return}}function Uh(r,i,o){var d=r.pingCache;if(d===null){d=r.pingCache=new ak;var m=new Set;d.set(i,m)}else m=d.get(i),m===void 0&&(m=new Set,d.set(i,m));m.has(o)||(Mh=!0,m.add(o),r=dk.bind(null,r,i,o),i.then(r,r))}function dk(r,i,o){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Ct===r&&(ct&o)===o&&(Kt===4||Kt===3&&(ct&62914560)===ct&&300>qe()-ju?(xt&2)===0&&el(r,0):Rh|=o,Za===ct&&(Za=0)),ns(r)}function r1(r,i){i===0&&(i=nn()),r=Ii(r,i),r!==null&&(zt(r,i),ns(r))}function fk(r){var i=r.memoizedState,o=0;i!==null&&(o=i.retryLane),r1(r,o)}function hk(r,i){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(s(314))}d!==null&&d.delete(i),r1(r,o)}function pk(r,i){return bn(r,i)}var Ru=null,nl=null,$h=!1,Lu=!1,Fh=!1,mi=0;function ns(r){r!==nl&&r.next===null&&(nl===null?Ru=nl=r:nl=nl.next=r),Lu=!0,$h||($h=!0,gk())}function _o(r,i){if(!Fh&&Lu){Fh=!0;do for(var o=!1,d=Ru;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,N=d.pingedLanes;x=(1<<31-Ke(42|r)+1)-1,x&=m&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,l1(d,x))}else x=ct,x=ge(d,d===Ct?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||Qe(d,x)||(o=!0,l1(d,x));d=d.next}while(o);Fh=!1}}function mk(){s1()}function s1(){Lu=$h=!1;var r=0;mi!==0&&Nk()&&(r=mi);for(var i=qe(),o=null,d=Ru;d!==null;){var m=d.next,x=i1(d,i);x===0?(d.next=null,o===null?Ru=m:o.next=m,m===null&&(nl=o)):(o=d,(r!==0||(x&3)!==0)&&(Lu=!0)),d=m}mn!==0&&mn!==5||_o(r),mi!==0&&(mi=0)}function i1(r,i){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-Ke(x),N=1<<w,H=m[w];H===-1?((N&o)===0||(N&d)!==0)&&(m[w]=Dt(N,i)):H<=i&&(r.expiredLanes|=N),x&=~N}if(i=Ct,o=ct,o=ge(r,r===i?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===i&&(_t===2||_t===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||Qe(r,o)){if(i=o&-o,i===r.callbackPriority)return i;switch(d!==null&&je(d),Ri(o)){case 2:case 8:o=ve;break;case 32:o=Q;break;case 268435456:o=Te;break;default:o=Q}return d=a1.bind(null,r),o=bn(o,d),r.callbackPriority=i,r.callbackNode=o,i}return d!==null&&d!==null&&je(d),r.callbackPriority=2,r.callbackNode=null,2}function a1(r,i){if(mn!==0&&mn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(Mu()&&r.callbackNode!==o)return null;var d=ct;return d=ge(r,r===Ct?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Fv(r,d,i),i1(r,qe()),r.callbackNode!=null&&r.callbackNode===o?a1.bind(null,r):null)}function l1(r,i){if(Mu())return null;Fv(r,i,!0)}function gk(){Ek(function(){(xt&6)!==0?bn(ae,mk):s1()})}function Hh(){if(mi===0){var r=Fa;r===0&&(r=Br,Br<<=1,(Br&261888)===0&&(Br=256)),mi=r}return mi}function o1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ea(""+r)}function c1(r,i){var o=i.ownerDocument.createElement("input");return o.name=i.name,o.value=i.value,r.id&&o.setAttribute("form",r.id),i.parentNode.insertBefore(o,i),r=new FormData(r),o.parentNode.removeChild(o),r}function xk(r,i,o,d,m){if(i==="submit"&&o&&o.stateNode===m){var x=o1((m[yn]||null).action),w=d.submitter;w&&(i=(i=w[yn]||null)?o1(i.formAction):w.getAttribute("formAction"),i!==null&&(x=i,w=null));var N=new ps("action","action",null,d,m);r.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(mi!==0){var H=w?c1(m,w):new FormData(m);oh(o,{pending:!0,data:H,method:m.method,action:x},null,H)}}else typeof x=="function"&&(N.preventDefault(),H=w?c1(m,w):new FormData(m),oh(o,{pending:!0,data:H,method:m.method,action:x},x,H))},currentTarget:m}]})}}for(var Ih=0;Ih<jf.length;Ih++){var qh=jf[Ih],vk=qh.toLowerCase(),bk=qh[0].toUpperCase()+qh.slice(1);Fr(vk,"on"+bk)}Fr($x,"onAnimationEnd"),Fr(Fx,"onAnimationIteration"),Fr(Hx,"onAnimationStart"),Fr("dblclick","onDoubleClick"),Fr("focusin","onFocus"),Fr("focusout","onBlur"),Fr(zS,"onTransitionRun"),Fr(OS,"onTransitionStart"),Fr(BS,"onTransitionCancel"),Fr(Ix,"onTransitionEnd"),Wr("onMouseEnter",["mouseout","mouseover"]),Wr("onMouseLeave",["mouseout","mouseover"]),Wr("onPointerEnter",["pointerout","pointerover"]),Wr("onPointerLeave",["pointerout","pointerover"]),Ur("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ur("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ur("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ur("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ur("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ur("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wo="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(" "),yk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wo));function u1(r,i){i=(i&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(i)for(var w=d.length-1;0<=w;w--){var N=d[w],H=N.instance,ee=N.currentTarget;if(N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=ee;try{x(m)}catch(oe){Qc(oe)}m.currentTarget=null,x=H}else for(w=0;w<d.length;w++){if(N=d[w],H=N.instance,ee=N.currentTarget,N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=ee;try{x(m)}catch(oe){Qc(oe)}m.currentTarget=null,x=H}}}}function lt(r,i){var o=i[Ul];o===void 0&&(o=i[Ul]=new Set);var d=r+"__bubble";o.has(d)||(d1(i,r,2,!1),o.add(d))}function Vh(r,i,o){var d=0;i&&(d|=4),d1(o,r,d,i)}var Du="_reactListening"+Math.random().toString(36).slice(2);function Gh(r){if(!r[Du]){r[Du]=!0,In.forEach(function(o){o!=="selectionchange"&&(yk.has(o)||Vh(o,!1,r),Vh(o,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Du]||(i[Du]=!0,Vh("selectionchange",!1,i))}}function d1(r,i,o,d){switch($1(i)){case 2:var m=Qk;break;case 8:m=Xk;break;default:m=lp}o=m.bind(null,i,o,r),m=void 0,!Aa||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(i,o,{capture:!0,passive:m}):r.addEventListener(i,o,!0):m!==void 0?r.addEventListener(i,o,{passive:m}):r.addEventListener(i,o,!1)}function Yh(r,i,o,d,m){var x=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var N=d.stateNode.containerInfo;if(N===m)break;if(w===4)for(w=d.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;N!==null;){if(w=hs(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){d=x=w;continue e}N=N.parentNode}}d=d.return}$c(function(){var ee=x,oe=Ta(o),ue=[];e:{var ne=qx.get(r);if(ne!==void 0){var ie=ps,Ee=r;switch(r){case"keypress":if(it(o)===0)break e;case"keydown":case"keyup":ie=hS;break;case"focusin":Ee="focus",ie=Zr;break;case"focusout":Ee="blur",ie=Zr;break;case"beforeblur":case"afterblur":ie=Zr;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=gf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=Ic;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=gS;break;case $x:case Fx:case Hx:ie=Gc;break;case Ix:ie=vS;break;case"scroll":case"scrollend":ie=Fc;break;case"wheel":ie=yS;break;case"copy":case"cut":case"paste":ie=aS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=_x;break;case"toggle":case"beforetoggle":ie=wS}var $e=(i&4)!==0,jt=!$e&&(r==="scroll"||r==="scrollend"),K=$e?ne!==null?ne+"Capture":null:ne;$e=[];for(var V=ee,J;V!==null;){var ce=V;if(J=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||J===null||K===null||(ce=Pi(V,K),ce!=null&&$e.push(So(V,ce,J))),jt)break;V=V.return}0<$e.length&&(ne=new ie(ne,Ee,null,o,oe),ue.push({event:ne,listeners:$e}))}}if((i&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",ie=r==="mouseout"||r==="pointerout",ne&&o!==Ws&&(Ee=o.relatedTarget||o.fromElement)&&(hs(Ee)||Ee[nr]))break e;if((ie||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(Ee=o.relatedTarget||o.toElement,ie=ee,Ee=Ee?hs(Ee):null,Ee!==null&&(jt=c(Ee),$e=Ee.tag,Ee!==jt||$e!==5&&$e!==27&&$e!==6)&&(Ee=null)):(ie=null,Ee=ee),ie!==Ee)){if($e=gf,ce="onMouseLeave",K="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&($e=_x,ce="onPointerLeave",K="onPointerEnter",V="pointer"),jt=ie==null?ne:zi(ie),J=Ee==null?ne:zi(Ee),ne=new $e(ce,V+"leave",ie,o,oe),ne.target=jt,ne.relatedTarget=J,ce=null,hs(oe)===ee&&($e=new $e(K,V+"enter",Ee,o,oe),$e.target=J,$e.relatedTarget=jt,ce=$e),jt=ce,ie&&Ee)t:{for($e=_k,K=ie,V=Ee,J=0,ce=K;ce;ce=$e(ce))J++;ce=0;for(var Oe=V;Oe;Oe=$e(Oe))ce++;for(;0<J-ce;)K=$e(K),J--;for(;0<ce-J;)V=$e(V),ce--;for(;J--;){if(K===V||V!==null&&K===V.alternate){$e=K;break t}K=$e(K),V=$e(V)}$e=null}else $e=null;ie!==null&&f1(ue,ne,ie,$e,!1),Ee!==null&&jt!==null&&f1(ue,jt,Ee,$e,!0)}}e:{if(ne=ee?zi(ee):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var mt=Tx;else if(Cx(ne))if(Ax)mt=RS;else{mt=AS;var Ae=TS}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Ca(ee.elementType)&&(mt=Tx):mt=MS;if(mt&&(mt=mt(r,ee))){Ex(ue,mt,o,oe);break e}Ae&&Ae(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&ja(ne,"number",ne.value)}switch(Ae=ee?zi(ee):window,r){case"focusin":(Cx(Ae)||Ae.contentEditable==="true")&&(La=Ae,wf=ee,Kl=null);break;case"focusout":Kl=wf=La=null;break;case"mousedown":Sf=!0;break;case"contextmenu":case"mouseup":case"dragend":Sf=!1,Px(ue,o,oe);break;case"selectionchange":if(DS)break;case"keydown":case"keyup":Px(ue,o,oe)}var Ze;if(vf)e:{switch(r){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else Ra?jx(r,o)&&(ut="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(ut="onCompositionStart");ut&&(wx&&o.locale!=="ko"&&(Ra||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&Ra&&(Ze=ht()):(q=oe,de="value"in q?q.value:q.textContent,Ra=!0)),Ae=zu(ee,ut),0<Ae.length&&(ut=new yx(ut,r,null,o,oe),ue.push({event:ut,listeners:Ae}),Ze?ut.data=Ze:(Ze=Nx(o),Ze!==null&&(ut.data=Ze)))),(Ze=kS?jS(r,o):NS(r,o))&&(ut=zu(ee,"onBeforeInput"),0<ut.length&&(Ae=new yx("onBeforeInput","beforeinput",null,o,oe),ue.push({event:Ae,listeners:ut}),Ae.data=Ze)),xk(ue,r,ee,o,oe)}u1(ue,i)})}function So(r,i,o){return{instance:r,listener:i,currentTarget:o}}function zu(r,i){for(var o=i+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=Pi(r,o),m!=null&&d.unshift(So(r,m,x)),m=Pi(r,i),m!=null&&d.push(So(r,m,x))),r.tag===3)return d;r=r.return}return[]}function _k(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function f1(r,i,o,d,m){for(var x=i._reactName,w=[];o!==null&&o!==d;){var N=o,H=N.alternate,ee=N.stateNode;if(N=N.tag,H!==null&&H===d)break;N!==5&&N!==26&&N!==27||ee===null||(H=ee,m?(ee=Pi(o,x),ee!=null&&w.unshift(So(o,ee,H))):m||(ee=Pi(o,x),ee!=null&&w.push(So(o,ee,H)))),o=o.return}w.length!==0&&r.push({event:i,listeners:w})}var wk=/\r\n?/g,Sk=/\u0000|\uFFFD/g;function h1(r){return(typeof r=="string"?r:""+r).replace(wk,`
|
|
49
|
+
`).replace(Sk,"")}function p1(r,i){return i=h1(i),h1(r)===i}function kt(r,i,o,d,m,x){switch(o){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||Xs(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&Xs(r,""+d);break;case"className":Sa(r,"class",d);break;case"tabIndex":Sa(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Sa(r,o,d);break;case"style":Bc(r,d,x);break;case"data":if(i!=="object"){Sa(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Ea(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(o==="formAction"?(i!=="input"&&kt(r,i,"name",m.name,m,null),kt(r,i,"formEncType",m.formEncType,m,null),kt(r,i,"formMethod",m.formMethod,m,null),kt(r,i,"formTarget",m.formTarget,m,null)):(kt(r,i,"encType",m.encType,m,null),kt(r,i,"method",m.method,m,null),kt(r,i,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Ea(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=vr);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(s(60));r.innerHTML=o}}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}o=Ea(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),Oi(r,"popover",d);break;case"xlinkActuate":$r(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":$r(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":$r(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":$r(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":$r(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":$r(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":$r(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":$r(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":$r(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Oi(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Pc.get(o)||o,Oi(r,o,d))}}function Qh(r,i,o,d,m,x){switch(o){case"style":Bc(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(s(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Xs(r,d):(typeof d=="number"||typeof d=="bigint")&&Xs(r,""+d);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"onClick":d!=null&&(r.onclick=vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wa.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),i=o.slice(2,m?o.length-7:void 0),x=r[yn]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(i,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(i,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):Oi(r,o,d)}}}function kn(r,i,o){switch(i){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,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:kt(r,i,x,w,o,null)}}m&&kt(r,i,"srcSet",o.srcSet,o,null),d&&kt(r,i,"src",o.src,o,null);return;case"input":lt("invalid",r);var N=x=w=m=null,H=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var oe=o[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":x=oe;break;case"defaultValue":N=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,i));break;default:kt(r,i,d,oe,o,null)}}zc(r,x,N,H,ee,w,m,!1);return;case"select":lt("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":d=N;default:kt(r,i,m,N,o,null)}i=x,o=w,r.multiple=!!d,i!=null?Qs(r,!!d,i,!1):o!=null&&Qs(r,!!d,o,!0);return;case"textarea":lt("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(N=o[w],N!=null))switch(w){case"value":d=N;break;case"defaultValue":m=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:kt(r,i,w,N,o,null)}Il(r,d,m,x);return;case"option":for(H in o)if(o.hasOwnProperty(H)&&(d=o[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:kt(r,i,H,d,o,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<wo.length;d++)lt(wo[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(ee in o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:kt(r,i,ee,d,o,null)}return;default:if(Ca(i)){for(oe in o)o.hasOwnProperty(oe)&&(d=o[oe],d!==void 0&&Qh(r,i,oe,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&kt(r,i,N,d,o,null))}function kk(r,i,o,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,N=null,H=null,ee=null,oe=null;for(ie in o){var ue=o[ie];if(o.hasOwnProperty(ie)&&ue!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":H=ue;default:d.hasOwnProperty(ie)||kt(r,i,ie,null,d,ue)}}for(var ne in d){var ie=d[ne];if(ue=o[ne],d.hasOwnProperty(ne)&&(ie!=null||ue!=null))switch(ne){case"type":x=ie;break;case"name":m=ie;break;case"checked":ee=ie;break;case"defaultChecked":oe=ie;break;case"value":w=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:ie!==ue&&kt(r,i,ne,ie,d,ue)}}Bi(r,w,N,H,ee,oe,x,m);return;case"select":ie=w=N=ne=null;for(x in o)if(H=o[x],o.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":ie=H;default:d.hasOwnProperty(x)||kt(r,i,x,null,d,H)}for(m in d)if(x=d[m],H=o[m],d.hasOwnProperty(m)&&(x!=null||H!=null))switch(m){case"value":ne=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==H&&kt(r,i,m,x,d,H)}i=N,o=w,d=ie,ne!=null?Qs(r,!!o,ne,!1):!!d!=!!o&&(i!=null?Qs(r,!!o,i,!0):Qs(r,!!o,o?[]:"",!1));return;case"textarea":ie=ne=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:kt(r,i,N,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":ne=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(s(91));break;default:m!==x&&kt(r,i,w,m,d,x)}Na(r,ne,ie);return;case"option":for(var Ee in o)if(ne=o[Ee],o.hasOwnProperty(Ee)&&ne!=null&&!d.hasOwnProperty(Ee))switch(Ee){case"selected":r.selected=!1;break;default:kt(r,i,Ee,null,d,ne)}for(H in d)if(ne=d[H],ie=o[H],d.hasOwnProperty(H)&&ne!==ie&&(ne!=null||ie!=null))switch(H){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:kt(r,i,H,ne,d,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var $e in o)ne=o[$e],o.hasOwnProperty($e)&&ne!=null&&!d.hasOwnProperty($e)&&kt(r,i,$e,null,d,ne);for(ee in d)if(ne=d[ee],ie=o[ee],d.hasOwnProperty(ee)&&ne!==ie&&(ne!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,i));break;default:kt(r,i,ee,ne,d,ie)}return;default:if(Ca(i)){for(var jt in o)ne=o[jt],o.hasOwnProperty(jt)&&ne!==void 0&&!d.hasOwnProperty(jt)&&Qh(r,i,jt,void 0,d,ne);for(oe in d)ne=d[oe],ie=o[oe],!d.hasOwnProperty(oe)||ne===ie||ne===void 0&&ie===void 0||Qh(r,i,oe,ne,d,ie);return}}for(var K in o)ne=o[K],o.hasOwnProperty(K)&&ne!=null&&!d.hasOwnProperty(K)&&kt(r,i,K,null,d,ne);for(ue in d)ne=d[ue],ie=o[ue],!d.hasOwnProperty(ue)||ne===ie||ne==null&&ie==null||kt(r,i,ue,ne,d,ie)}function m1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,N=m.duration;if(x&&N&&m1(w)){for(w=0,N=m.responseEnd,d+=1;d<o.length;d++){var H=o[d],ee=H.startTime;if(ee>N)break;var oe=H.transferSize,ue=H.initiatorType;oe&&m1(ue)&&(H=H.responseEnd,w+=oe*(H<N?1:(N-ee)/(H-ee)))}if(--d,i+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Xh=null,Wh=null;function Ou(r){return r.nodeType===9?r:r.ownerDocument}function g1(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 x1(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Kh(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Zh=null;function Nk(){var r=window.event;return r&&r.type==="popstate"?r===Zh?!1:(Zh=r,!0):(Zh=null,!1)}var v1=typeof setTimeout=="function"?setTimeout:void 0,Ck=typeof clearTimeout=="function"?clearTimeout:void 0,b1=typeof Promise=="function"?Promise:void 0,Ek=typeof queueMicrotask=="function"?queueMicrotask:typeof b1<"u"?function(r){return b1.resolve(null).then(r).catch(Tk)}:v1;function Tk(r){setTimeout(function(){throw r})}function gi(r){return r==="head"}function y1(r,i){var o=i,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),al(i);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")ko(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,ko(o);for(var x=o.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[Qr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&ko(r.ownerDocument.body);o=m}while(o);al(i)}function _1(r,i){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?i?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(i?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function Jh(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var o=i;switch(i=i.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Jh(o),Gs(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function Ak(r,i,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Qr])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==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(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=Cr(r.nextSibling),r===null)break}return null}function Mk(r,i,o){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=Cr(r.nextSibling),r===null))return null;return r}function w1(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Cr(r.nextSibling),r===null))return null;return r}function ep(r){return r.data==="$?"||r.data==="$~"}function tp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Rk(r,i){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||o.readyState!=="loading")i();else{var d=function(){i(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Cr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var np=null;function S1(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(i===0)return Cr(r.nextSibling);i--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||i++}r=r.nextSibling}return null}function k1(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(i===0)return r;i--}else o!=="/$"&&o!=="/&"||i++}r=r.previousSibling}return null}function j1(r,i,o){switch(i=Ou(o),r){case"html":if(r=i.documentElement,!r)throw Error(s(452));return r;case"head":if(r=i.head,!r)throw Error(s(453));return r;case"body":if(r=i.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function ko(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Gs(r)}var Er=new Map,N1=new Set;function Bu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ts=z.d;z.d={f:Lk,r:Dk,D:zk,C:Ok,L:Bk,m:Pk,X:$k,S:Uk,M:Fk};function Lk(){var r=Ts.f(),i=Eu();return r||i}function Dk(r){var i=Hn(r);i!==null&&i.tag===5&&i.type==="form"?I0(i):Ts.r(r)}var rl=typeof document>"u"?null:document;function C1(r,i,o){var d=rl;if(d&&typeof i=="string"&&i){var m=Jt(i);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),N1.has(m)||(N1.add(m),r={rel:r,crossOrigin:o,href:i},d.querySelector(m)===null&&(i=d.createElement("link"),kn(i,"link",r),Yt(i),d.head.appendChild(i)))}}function zk(r){Ts.D(r),C1("dns-prefetch",r,null)}function Ok(r,i){Ts.C(r,i),C1("preconnect",r,i)}function Bk(r,i,o){Ts.L(r,i,o);var d=rl;if(d&&r&&i){var m='link[rel="preload"][as="'+Jt(i)+'"]';i==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Jt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Jt(o.imageSizes)+'"]')):m+='[href="'+Jt(r)+'"]';var x=m;switch(i){case"style":x=sl(r);break;case"script":x=il(r)}Er.has(x)||(r=v({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:r,as:i},o),Er.set(x,r),d.querySelector(m)!==null||i==="style"&&d.querySelector(jo(x))||i==="script"&&d.querySelector(No(x))||(i=d.createElement("link"),kn(i,"link",r),Yt(i),d.head.appendChild(i)))}}function Pk(r,i){Ts.m(r,i);var o=rl;if(o&&r){var d=i&&typeof i.as=="string"?i.as:"script",m='link[rel="modulepreload"][as="'+Jt(d)+'"][href="'+Jt(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=il(r)}if(!Er.has(x)&&(r=v({rel:"modulepreload",href:r},i),Er.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(No(x)))return}d=o.createElement("link"),kn(d,"link",r),Yt(d),o.head.appendChild(d)}}}function Uk(r,i,o){Ts.S(r,i,o);var d=rl;if(d&&r){var m=Xr(d).hoistableStyles,x=sl(r);i=i||"default";var w=m.get(x);if(!w){var N={loading:0,preload:null};if(w=d.querySelector(jo(x)))N.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":i},o),(o=Er.get(x))&&rp(r,o);var H=w=d.createElement("link");Yt(H),kn(H,"link",r),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Pu(w,i,d)}w={type:"stylesheet",instance:w,count:1,state:N},m.set(x,w)}}}function $k(r,i){Ts.X(r,i);var o=rl;if(o&&r){var d=Xr(o).hoistableScripts,m=il(r),x=d.get(m);x||(x=o.querySelector(No(m)),x||(r=v({src:r,async:!0},i),(i=Er.get(m))&&sp(r,i),x=o.createElement("script"),Yt(x),kn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Fk(r,i){Ts.M(r,i);var o=rl;if(o&&r){var d=Xr(o).hoistableScripts,m=il(r),x=d.get(m);x||(x=o.querySelector(No(m)),x||(r=v({src:r,async:!0,type:"module"},i),(i=Er.get(m))&&sp(r,i),x=o.createElement("script"),Yt(x),kn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function E1(r,i,o,d){var m=(m=Ce.current)?Bu(m):null;if(!m)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=sl(o.href),o=Xr(m).hoistableStyles,d=o.get(i),d||(d={type:"style",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=sl(o.href);var x=Xr(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(jo(r)))&&!x._p&&(w.instance=x,w.state.loading=5),Er.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Er.set(r,o),x||Hk(m,r,o,w.state))),i&&d===null)throw Error(s(528,""));return w}if(i&&d!==null)throw Error(s(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=il(o),o=Xr(m).hoistableScripts,d=o.get(i),d||(d={type:"script",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,r))}}function sl(r){return'href="'+Jt(r)+'"'}function jo(r){return'link[rel="stylesheet"]['+r+"]"}function T1(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function Hk(r,i,o,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),kn(i,"link",o),Yt(i),r.head.appendChild(i))}function il(r){return'[src="'+Jt(r)+'"]'}function No(r){return"script[async]"+r}function A1(r,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Jt(o.href)+'"]');if(d)return i.instance=d,Yt(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Yt(d),kn(d,"style",m),Pu(d,o.precedence,r),i.instance=d;case"stylesheet":m=sl(o.href);var x=r.querySelector(jo(m));if(x)return i.state.loading|=4,i.instance=x,Yt(x),x;d=T1(o),(m=Er.get(m))&&rp(d,m),x=(r.ownerDocument||r).createElement("link"),Yt(x);var w=x;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),kn(x,"link",d),i.state.loading|=4,Pu(x,o.precedence,r),i.instance=x;case"script":return x=il(o.src),(m=r.querySelector(No(x)))?(i.instance=m,Yt(m),m):(d=o,(m=Er.get(x))&&(d=v({},o),sp(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Yt(m),kn(m,"link",d),r.head.appendChild(m),i.instance=m);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Pu(d,o.precedence,r));return i.instance}function Pu(r,i,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var N=d[w];if(N.dataset.precedence===i)x=N;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(i=o.nodeType===9?o.head:o,i.insertBefore(r,i.firstChild))}function rp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function sp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Uu=null;function M1(r,i,o){if(Uu===null){var d=new Map,m=Uu=new Map;m.set(o,d)}else m=Uu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[Qr]||x[Ht]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(i)||"";w=r+w;var N=d.get(w);N?N.push(x):d.set(w,[x])}}return d}function R1(r,i,o){r=r.ownerDocument||r,r.head.insertBefore(o,i==="title"?r.querySelector("head > title"):null)}function Ik(r,i,o){if(o===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function L1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function qk(r,i,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=sl(d.href),x=i.querySelector(jo(m));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=$u.bind(r),i.then(r,r)),o.state.loading|=4,o.instance=x,Yt(x);return}x=i.ownerDocument||i,d=T1(d),(m=Er.get(m))&&rp(d,m),x=x.createElement("link"),Yt(x);var w=x;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),kn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=$u.bind(r),i.addEventListener("load",o),i.addEventListener("error",o))}}var ip=0;function Vk(r,i){return r.stylesheets&&r.count===0&&Hu(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Hu(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+i);0<r.imgBytes&&ip===0&&(ip=62500*jk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Hu(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>ip?50:800)+i);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function $u(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Fu=null;function Hu(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Fu=new Map,i.forEach(Gk,r),Fu=null,$u.call(r))}function Gk(r,i){if(!(i.state.loading&4)){var o=Fu.get(r);if(o)var d=o.get(null);else{o=new Map,Fu.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=i.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=$u.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),i.state.loading|=4}}var Co={$$typeof:C,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function Yk(r,i,o,d,m,x,w,N,H){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=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function D1(r,i,o,d,m,x,w,N,H,ee,oe,ue){return r=new Yk(r,i,o,w,H,ee,oe,ue,N),i=1,x===!0&&(i|=24),x=sr(3,null,null,i),r.current=x,x.stateNode=r,i=Pf(),i.refCount++,r.pooledCache=i,i.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:i},Hf(x),r}function z1(r){return r?(r=Oa,r):Oa}function O1(r,i,o,d,m,x){m=z1(m),d.context===null?d.context=m:d.pendingContext=m,d=ii(i),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=ai(r,d,i),o!==null&&(Xn(o,r,i),so(o,r,i))}function B1(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<i?o:i}}function ap(r,i){B1(r,i),(r=r.alternate)&&B1(r,i)}function P1(r){if(r.tag===13||r.tag===31){var i=Ii(r,67108864);i!==null&&Xn(i,r,67108864),ap(r,67108864)}}function U1(r){if(r.tag===13||r.tag===31){var i=cr();i=zn(i);var o=Ii(r,i);o!==null&&Xn(o,r,i),ap(r,i)}}var Iu=!0;function Qk(r,i,o,d){var m=U.T;U.T=null;var x=z.p;try{z.p=2,lp(r,i,o,d)}finally{z.p=x,U.T=m}}function Xk(r,i,o,d){var m=U.T;U.T=null;var x=z.p;try{z.p=8,lp(r,i,o,d)}finally{z.p=x,U.T=m}}function lp(r,i,o,d){if(Iu){var m=op(d);if(m===null)Yh(r,i,d,qu,o),F1(r,d);else if(Kk(m,r,i,o,d))d.stopPropagation();else if(F1(r,d),i&4&&-1<Wk.indexOf(r)){for(;m!==null;){var x=Hn(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=pe(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-Ke(w);N.entanglements[1]|=H,w&=~H}ns(x),(xt&6)===0&&(Nu=qe()+500,_o(0))}}break;case 31:case 13:N=Ii(x,2),N!==null&&Xn(N,x,2),Eu(),ap(x,2)}if(x=op(d),x===null&&Yh(r,i,d,qu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else Yh(r,i,d,null,o)}}function op(r){return r=Ta(r),cp(r)}var qu=null;function cp(r){if(qu=null,r=hs(r),r!==null){var i=c(r);if(i===null)r=null;else{var o=i.tag;if(o===13){if(r=u(i),r!==null)return r;r=null}else if(o===31){if(r=f(i),r!==null)return r;r=null}else if(o===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return qu=r,null}function $1(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(Or()){case ae:return 2;case ve:return 8;case Q:case fe:return 32;case Te:return 268435456;default:return 32}default:return 32}}var up=!1,xi=null,vi=null,bi=null,Eo=new Map,To=new Map,yi=[],Wk="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 F1(r,i){switch(r){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":vi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Eo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":To.delete(i.pointerId)}}function Ao(r,i,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:i,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},i!==null&&(i=Hn(i),i!==null&&P1(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,m!==null&&i.indexOf(m)===-1&&i.push(m),r)}function Kk(r,i,o,d,m){switch(i){case"focusin":return xi=Ao(xi,r,i,o,d,m),!0;case"dragenter":return vi=Ao(vi,r,i,o,d,m),!0;case"mouseover":return bi=Ao(bi,r,i,o,d,m),!0;case"pointerover":var x=m.pointerId;return Eo.set(x,Ao(Eo.get(x)||null,r,i,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,To.set(x,Ao(To.get(x)||null,r,i,o,d,m)),!0}return!1}function H1(r){var i=hs(r.target);if(i!==null){var o=c(i);if(o!==null){if(i=o.tag,i===13){if(i=u(o),i!==null){r.blockedOn=i,Pl(r.priority,function(){U1(o)});return}}else if(i===31){if(i=f(o),i!==null){r.blockedOn=i,Pl(r.priority,function(){U1(o)});return}}else if(i===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Vu(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var o=op(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Ws=d,o.target.dispatchEvent(d),Ws=null}else return i=Hn(o),i!==null&&P1(i),r.blockedOn=o,!1;i.shift()}return!0}function I1(r,i,o){Vu(r)&&o.delete(i)}function Zk(){up=!1,xi!==null&&Vu(xi)&&(xi=null),vi!==null&&Vu(vi)&&(vi=null),bi!==null&&Vu(bi)&&(bi=null),Eo.forEach(I1),To.forEach(I1)}function Gu(r,i){r.blockedOn===i&&(r.blockedOn=null,up||(up=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Zk)))}var Yu=null;function q1(r){Yu!==r&&(Yu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Yu===r&&(Yu=null);for(var i=0;i<r.length;i+=3){var o=r[i],d=r[i+1],m=r[i+2];if(typeof d!="function"){if(cp(d||o)===null)continue;break}var x=Hn(o);x!==null&&(r.splice(i,3),i-=3,oh(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function al(r){function i(H){return Gu(H,r)}xi!==null&&Gu(xi,r),vi!==null&&Gu(vi,r),bi!==null&&Gu(bi,r),Eo.forEach(i),To.forEach(i);for(var o=0;o<yi.length;o++){var d=yi[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<yi.length&&(o=yi[0],o.blockedOn===null);)H1(o),o.blockedOn===null&&yi.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[yn]||null;if(typeof x=="function")w||q1(o);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[yn]||null)N=w.formAction;else if(cp(m)!==null)continue}else N=w.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),q1(o)}}}function V1(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function i(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),m!==null&&(m(),m=null)}}}function dp(r){this._internalRoot=r}Qu.prototype.render=dp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(s(409));var o=i.current,d=cr();O1(o,d,r,i,null,null)},Qu.prototype.unmount=dp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;O1(r.current,2,null,r,null,null),Eu(),i[nr]=null}};function Qu(r){this._internalRoot=r}Qu.prototype.unstable_scheduleHydration=function(r){if(r){var i=Bl();r={blockedOn:null,target:r,priority:i};for(var o=0;o<yi.length&&i!==0&&i<yi[o].priority;o++);yi.splice(o,0,r),o===0&&H1(r)}};var G1=t.version;if(G1!=="19.2.7")throw Error(s(527,G1,"19.2.7"));z.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=p(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var Jk={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xu.isDisabled&&Xu.supportsFiber)try{tt=Xu.inject(Jk),vt=Xu}catch{}}return Ro.createRoot=function(r,i){if(!l(r))throw Error(s(299));var o=!1,d="",m=J0,x=ev,w=tv;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=D1(r,1,!1,null,null,o,d,null,m,x,w,V1),r[nr]=i.current,Gh(r),new dp(i)},Ro.hydrateRoot=function(r,i,o){if(!l(r))throw Error(s(299));var d=!1,m="",x=J0,w=ev,N=tv,H=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&(H=o.formState)),i=D1(r,1,!0,i,o??null,d,m,H,x,w,N,V1),i.context=z1(null),o=i.current,d=cr(),d=zn(d),m=ii(d),m.callback=null,ai(o,m,d),o=d,i.current.lanes=o,zt(i,o),ns(i),r[nr]=i.current,Gh(r),new Qu(i)},Ro.version="19.2.7",Ro}var sb;function fj(){if(sb)return pp.exports;sb=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(),pp.exports=dj(),pp.exports}var hj=fj();const ib=e=>{let t;const n=new Set,s=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},l=()=>t,f={setState:s,getState:l,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(s,l,f);return f},pj=(e=>e?ib(e):ib),mj=e=>e;function gj(e,t=mj){const n=Wu.useSyncExternalStore(e.subscribe,Wu.useCallback(()=>t(e.getState()),[e,t]),Wu.useCallback(()=>t(e.getInitialState()),[e,t]));return Wu.useDebugValue(n),n}const ab=e=>{const t=pj(e),n=s=>gj(t,s);return Object.assign(n,t),n},xj=(e=>e?ab(e):ab),xm="companion_auth_token";function lb(){return typeof window>"u"?null:localStorage.getItem(xm)||null}const vj=e=>({authToken:lb(),isAuthenticated:lb()!==null,setAuthToken:t=>{localStorage.setItem(xm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(xm),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 bj(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function yj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function _j(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function wj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const Sj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:_j(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:yj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:wj(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const s=new Map(n.sessions);s.set(t.session_id,t);const l=new Map(n.messages);return l.has(t.session_id)||l.set(t.session_id,[]),{sessions:s,messages:l}}),updateSession:(t,n)=>e(s=>{const l=new Map(s.sessions),c=l.get(t);return c&&l.set(t,{...c,...n}),{sessions:l}}),removeSession:t=>e(n=>{const s=qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(s.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:s,recentlyRenamed:bj(n.recentlyRenamed,t),mcpServers:qt(n.mcpServers,t),prStatus:qt(n.prStatus,t),linkedLinearIssues:qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(l=>l.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(s=>{const l=new Map(s.connectionStatus);return l.set(t,n),{connectionStatus:l}}),setCliConnected:(t,n)=>e(s=>{const l=new Map(s.cliConnected);return l.set(t,n),{cliConnected:l}}),setCliReconnecting:(t,n)=>e(s=>{const l=new Map(s.cliReconnecting);return n?l.set(t,!0):l.delete(t),{cliReconnecting:l}}),setSessionStatus:(t,n)=>e(s=>{const l=new Map(s.sessionStatus);return l.set(t,n),{sessionStatus:l}}),setPreviousPermissionMode:(t,n)=>e(s=>{const l=new Map(s.previousPermissionMode);return l.set(t,n),{previousPermissionMode:l}}),setSessionName:(t,n)=>e(s=>{const l=new Map(s.sessionNames);return l.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(l.entries()))),{sessionNames:l}}),markRecentlyRenamed:t=>e(n=>{const s=new Set(n.recentlyRenamed);return s.add(t),{recentlyRenamed:s}}),clearRecentlyRenamed:t=>e(n=>{const s=new Set(n.recentlyRenamed);return s.delete(t),{recentlyRenamed:s}}),setPRStatus:(t,n)=>e(s=>{const l=new Map(s.prStatus);return l.set(t,n),{prStatus:l}}),setLinkedLinearIssue:(t,n)=>e(s=>{const l=new Map(s.linkedLinearIssues);return n?l.set(t,n):l.delete(t),{linkedLinearIssues:l}}),setMcpServers:(t,n)=>e(s=>{const l=new Map(s.mcpServers);return l.set(t,n),{mcpServers:l}}),toggleProjectCollapse:t=>e(n=>{const s=new Set(n.collapsedProjects);return s.has(t)?s.delete(t):s.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(s))),{collapsedProjects:s}}),setSessionAiValidation:(t,n)=>e(s=>{const l=new Map(s.sessions),c=l.get(t);return c?(l.set(t,{...c,...n}),{sessions:l}):{}})}),kj=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(s=>{const l=s.messages.get(t)||[];if(n.id&&l.some(u=>u.id===n.id))return s;const c=new Map(s.messages);return c.set(t,[...l,n]),{messages:c}}),setMessages:(t,n)=>e(s=>{const l=new Map(s.messages);return l.set(t,n),{messages:l}}),updateLastAssistantMessage:(t,n)=>e(s=>{const l=new Map(s.messages),c=[...l.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return l.set(t,c),{messages:l}}),setStreaming:(t,n)=>e(s=>{const l=new Map(s.streaming);return n===null?l.delete(t):l.set(t,n),{streaming:l}}),setStreamingStats:(t,n)=>e(s=>{const l=new Map(s.streamingStartedAt),c=new Map(s.streamingOutputTokens);return n===null?(l.delete(t),c.delete(t)):(n.startedAt!==void 0&&l.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:l,streamingOutputTokens:c}}),setLastActivity:(t,n)=>e(s=>{const l=new Map(s.lastActivityAt);return l.set(t,n),{lastActivityAt:l}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(s=>{const l=new Map(s.promptSuggestions);return l.set(t,n),{promptSuggestions:l}}),clearPromptSuggestions:t=>e(n=>{const s=new Map(n.promptSuggestions);return s.delete(t),{promptSuggestions:s}})}),jj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(s=>{const l=new Map(s.pendingPermissions),c=new Map(l.get(t)||[]);return c.set(n.request_id,n),l.set(t,c),{pendingPermissions:l}}),removePermission:(t,n)=>e(s=>{const l=new Map(s.pendingPermissions),c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}return{pendingPermissions:l}}),addAiResolvedPermission:(t,n)=>e(s=>{const l=new Map(s.aiResolvedPermissions),c=[...l.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),l.set(t,c),{aiResolvedPermissions:l}}),clearAiResolvedPermissions:t=>e(n=>{const s=new Map(n.aiResolvedPermissions);return s.delete(t),{aiResolvedPermissions:s}})}),Nj=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(s=>{const l=new Map(s.sessionTasks),c=[...l.get(t)||[],n];return l.set(t,c),{sessionTasks:l}}),setTasks:(t,n)=>e(s=>{const l=new Map(s.sessionTasks);return l.set(t,n),{sessionTasks:l}}),updateTask:(t,n,s)=>e(l=>{const c=new Map(l.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...s}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(s=>{const l=new Map(s.sessionProcesses),c=[...l.get(t)||[],n];return l.set(t,c),{sessionProcesses:l}}),updateProcess:(t,n,s)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...s}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,s)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(s=>{const l=new Map(s.sessionBackgroundAgents),c=[...l.get(t)||[],n];return l.set(t,c),{sessionBackgroundAgents:l}}),updateBackgroundAgent:(t,n,s)=>e(l=>{const c=new Map(l.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const s=new Map(n.changedFilesTick);return s.set(t,(s.get(t)??0)+1),{changedFilesTick:s}}),setGitChangedFilesCount:(t,n)=>e(s=>{const l=new Map(s.gitChangedFilesCount);return l.set(t,n),{gitChangedFilesCount:l}}),setToolProgress:(t,n,s)=>e(l=>{const c=new Map(l.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,s),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(s=>{const l=new Map(s.toolProgress);if(n){const c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}}else l.delete(t);return{toolProgress:l}}),setToolActivity:(t,n)=>e(s=>{const l=new Map(s.toolActivity);return n.length===0?l.delete(t):l.set(t,n),{toolActivity:l}}),addToolActivity:(t,n)=>e(s=>{const l=new Map(s.toolActivity),c=[...l.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return l.set(t,c),{toolActivity:l}}),updateToolActivity:(t,n,s)=>e(l=>{const c=new Map(l.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{toolActivity:c}})}),qs=[{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"]}],Cj=qs.map(e=>e.id),q5="cc-task-panel-config";function vm(){return{order:[...Cj],enabled:Object.fromEntries(qs.map(e=>[e.id,!0]))}}function Ej(){if(typeof window>"u")return vm();try{const e=localStorage.getItem(q5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const l of qs)n.has(l.id)||(t.order.push(l.id),t.enabled[l.id]=!0);const s=new Set(qs.map(l=>l.id));return t.order=t.order.filter(l=>s.has(l)),t}}catch{}return vm()}function Ku(e){try{localStorage.setItem(q5,JSON.stringify(e))}catch{}}function Tj(){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 Aj(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function Mj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function V5(){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"}const Rj=e=>({darkMode:Tj(),notificationSound:Aj(),notificationDesktop:Mj(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:Ej(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:V5(),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 s={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Ku(s),{taskPanelConfig:s}}),moveSectionUp:t=>e(n=>{const s=[...n.taskPanelConfig.order],l=s.indexOf(t);if(l<=0)return n;[s[l-1],s[l]]=[s[l],s[l-1]];const c={...n.taskPanelConfig,order:s};return Ku(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const s=[...n.taskPanelConfig.order],l=s.indexOf(t);if(l<0||l>=s.length-1)return n;[s[l],s[l+1]]=[s[l+1],s[l]];const c={...n.taskPanelConfig,order:s};return Ku(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=vm();Ku(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 s=new Map(n.chatTabReentryTickBySession),l=(s.get(t)??0)+1;return s.set(t,l),{chatTabReentryTickBySession:s}}),setDiffPanelSelectedFile:(t,n)=>e(s=>{const l=new Map(s.diffPanelSelectedFile);return n?l.set(t,n):l.delete(t),{diffPanelSelectedFile:l}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function G5(){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 Lj=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:G5(),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 s=t.target==="docker",l=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=s?l:l+1,f=s?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:s?`Docker ${c}`:l===1?"Terminal":`Terminal ${l}`,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 c;const s=n.quickTerminalTabs.filter(u=>u.id!==t),l=n.activeQuickTerminalTabId===t?((c=s[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:s,activeQuickTerminalTabId:l,quickTerminalOpen:s.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 Dj(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const zj=e=>({updateInfo:null,updateDismissedVersion:Dj(),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 s=n.creationProgress||[],l=s.findIndex(c=>c.step===t.step);if(l>=0){const c=[...s];return c[l]=t,{creationProgress:c}}return{creationProgress:[...s,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=xj((...e)=>({...vj(...e),...Sj(...e),...kj(...e),...jj(...e),...Nj(...e),...Rj(...e),...Lj(...e),...zj(...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:V5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:G5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),Oj=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),Bj="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",Pj=/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 Uj(e){return Pj.test(e)}function $j(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:Uj(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const ob=["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 ub(){const e=ob[Math.floor(Math.random()*ob.length)],t=cb[Math.floor(Math.random()*cb.length)];return`${e} ${t}`}function Y5(e){for(let t=0;t<100;t++){const n=ub();if(!e.has(n))return n}return ub()}let vp=null;function Fj(){return vp||(vp=new AudioContext),vp}function Hj(){try{const e=Fj();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),s=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),s.gain.setValueAtTime(.3,t),s.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(s),s.connect(e.destination),n.start(t),n.stop(t+.3);const l=e.createOscillator(),c=e.createGain();l.type="sine",l.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),l.connect(c),c.connect(e.destination),l.start(t+.15),l.stop(t+.5)}catch{}}class Q5{diff(t,n,s={}){let l;typeof s=="function"?(l=s,s={}):"callback"in s&&(l=s.callback);const c=this.castInput(t,s),u=this.castInput(n,s),f=this.removeEmpty(this.tokenize(c,s)),h=this.removeEmpty(this.tokenize(u,s));return this.diffWithOptionsObj(f,h,s,l)}diffWithOptionsObj(t,n,s,l){var c;const u=A=>{if(A=this.postProcess(A,s),l){setTimeout(function(){l(A)},0);return}else return A},f=n.length,h=t.length;let p=1,g=f+h;s.maxEditLength!=null&&(g=Math.min(g,s.maxEditLength));const v=(c=s.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,s);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let j=-1/0,E=1/0;const k=()=>{for(let A=Math.max(j,-p);A<=Math.min(E,p);A+=2){let C;const D=b[A-1],O=b[A+1];D&&(b[A-1]=void 0);let L=!1;if(O){const $=O.oldPos-A;L=O&&0<=$&&$<f}const I=D&&D.oldPos+1<h;if(!L&&!I){b[A]=void 0;continue}if(!I||L&&D.oldPos<O.oldPos?C=this.addToPath(O,!0,!1,0,s):C=this.addToPath(D,!1,!0,1,s),_=this.extractCommon(C,n,t,A,s),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;b[A]=C,C.oldPos+1>=h&&(E=Math.min(E,A-1)),_+1>=f&&(j=Math.max(j,A+1))}p++};if(l)(function A(){setTimeout(function(){if(p>g||Date.now()>y)return l(void 0);k()||A()},0)})();else for(;p<=g&&Date.now()<=y;){const A=k();if(A)return A}}addToPath(t,n,s,l,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===s?{oldPos:t.oldPos+l,lastComponent:{count:u.count+1,added:n,removed:s,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:s,previousComponent:u}}}extractCommon(t,n,s,l,c){const u=n.length,f=s.length;let h=t.oldPos,p=h-l,g=0;for(;p+1<u&&h+1<f&&this.equals(s[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,s){return s.comparator?s.comparator(t,n):t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(t[s]);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,s){const l=[];let c;for(;t;)l.push(t),c=t.previousComponent,delete t.previousComponent,t=c;l.reverse();const u=l.length;let f=0,h=0,p=0;for(;f<u;f++){const g=l[f];if(g.removed)g.value=this.join(s.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=s[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return l}}function db(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 fb(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 bm(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 ym(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 Lo(e,t){return bm(e,t,"")}function Zu(e,t){return ym(e,t,"")}function hb(e,t){return t.slice(0,Ij(e,t))}function Ij(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let s=t.length;e.length<t.length&&(s=e.length);const l=Array(s);let c=0;l[0]=0;for(let u=1;u<s;u++){for(t[u]==t[c]?l[u]=l[c]:l[u]=c;c>0&&t[u]!=t[c];)c=l[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=l[c];e[u]==t[c]&&c++}return c}function X5(e,t){const n=[];for(const s of Array.from(t.segment(e))){const l=s.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(l)?n[n.length-1]+=l:n.push(l)}return n}function _m(e,t){if(t)return tc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ml(e,t){if(t)return tc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function tc(e,t){if(!t)return[ml(e),_m(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=X5(e,t),s=n[0],l=n[n.length-1],c=/\s/.test(s)?s:"",u=/\s/.test(l)?l:"";return[c,u]}const pb="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}",qj=new RegExp(`[${pb}]+|\\s+|[^${pb}]`,"ug");class Vj extends Q5{equals(t,n,s){return s.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let s;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');s=X5(t,u)}else s=t.match(qj)||[];const l=[];let c=null;return s.forEach(u=>{/\s/.test(u)?c==null?l.push(u):l.push(l.pop()+u):c!=null&&/\s/.test(c)?l[l.length-1]==c?l.push(l.pop()+u):l.push(c+u):l.push(u),c=u}),l}join(t){return t.map((n,s)=>s==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let s=null,l=null,c=null;return t.forEach(u=>{u.added?l=u:u.removed?c=u:((l||c)&&mb(s,c,l,u,n.intlSegmenter),s=u,l=null,c=null)}),(l||c)&&mb(s,c,l,null,n.intlSegmenter),t}}const Gj=new Vj;function Yj(e,t,n){return Gj.diff(e,t,n)}function mb(e,t,n,s,l){if(t&&n){const[c,u]=tc(t.value,l),[f,h]=tc(n.value,l);if(e){const p=db(c,f);e.value=ym(e.value,f,p),t.value=Lo(t.value,p),n.value=Lo(n.value,p)}if(s){const p=fb(u,h);s.value=bm(s.value,h,p),t.value=Zu(t.value,p),n.value=Zu(n.value,p)}}else if(n){if(e){const c=ml(n.value,l);n.value=n.value.substring(c.length)}if(s){const c=ml(s.value,l);s.value=s.value.substring(c.length)}}else if(e&&s){const c=ml(s.value,l),[u,f]=tc(t.value,l),h=db(c,u);t.value=Lo(t.value,h);const p=fb(Lo(c,h),f);t.value=Zu(t.value,p),s.value=bm(s.value,c,p),e.value=ym(e.value,c,c.slice(0,c.length-p.length))}else if(s){const c=ml(s.value,l),u=_m(t.value,l),f=hb(u,c);t.value=Zu(t.value,f)}else if(e){const c=_m(e.value,l),u=ml(t.value,l),f=hb(c,u);t.value=Lo(t.value,f)}}class Qj extends Q5{constructor(){super(...arguments),this.tokenize=Wj}equals(t,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!t.includes(`
|
|
50
|
+
`))&&(t=t.trim()),(!s.newlineIsToken||!n.includes(`
|
|
51
|
+
`))&&(n=n.trim())):s.ignoreNewlineAtEof&&!s.newlineIsToken&&(t.endsWith(`
|
|
52
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
53
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,s)}}const Xj=new Qj;function gb(e,t,n){return Xj.diff(e,t,n)}function Wj(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
54
|
+
`));const n=[],s=e.split(/(\n|\r\n)/);s[s.length-1]||s.pop();for(let l=0;l<s.length;l++){const c=s[l];l%2&&!t.newlineIsToken?n[n.length-1]+=c:n.push(c)}return n}function Kj(e,t,n,s,l,c,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;gb(n,s,Object.assign(Object.assign({},f),{callback:v=>{const y=p(v);g(y)}}))}else return p(gb(n,s,f));function p(g){if(!g)return;g.push({value:"",lines:[]});function v(A){return A.map(function(C){return" "+C})}const y=[];let b=0,_=0,j=[],E=1,k=1;for(let A=0;A<g.length;A++){const C=g[A],D=C.lines||Zj(C.value);if(C.lines=D,C.added||C.removed){if(!b){const O=g[A-1];b=E,_=k,O&&(j=h>0?v(O.lines.slice(-h)):[],b-=j.length,_-=j.length)}for(const O of D)j.push((C.added?"+":"-")+O);C.added?k+=D.length:E+=D.length}else{if(b)if(D.length<=h*2&&A<g.length-2)for(const O of v(D))j.push(O);else{const O=Math.min(D.length,h);for(const I of v(D.slice(0,O)))j.push(I);const L={oldStart:b,oldLines:E-b+O,newStart:_,newLines:k-_+O,lines:j};y.push(L),b=0,_=0,j=[]}E+=D.length,k+=D.length}}for(const A of y)for(let C=0;C<A.lines.length;C++)A.lines[C].endsWith(`
|
|
55
|
+
`)?A.lines[C]=A.lines[C].slice(0,-1):(A.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:l,newHeader:c,hunks:y}}}function Zj(e){const t=e.endsWith(`
|
|
56
|
+
`),n=e.split(`
|
|
57
|
+
`).map(s=>s+`
|
|
58
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Jj(e,t){return Kj("","",e,t,"","",{context:3}).hunks.map(s=>{const l=`@@ -${s.oldStart},${s.oldLines} +${s.newStart},${s.newLines} @@`,c=[];let u=s.oldStart,f=s.newStart;for(const h of s.lines){const p=h[0],g=h.slice(1);p==="-"?c.push({type:"del",content:g,oldLineNo:u++}):p==="+"?c.push({type:"add",content:g,newLineNo:f++}):c.push({type:"context",content:g,oldLineNo:u++,newLineNo:f++})}return W5(c),{header:l,lines:c}})}function eN(e){const t=[],n=e.split(`
|
|
59
|
+
`);let s=null,l=null,c=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){l&&s&&s.hunks.push(l),s&&t.push(s),s={fileName:"",hunks:[]},l=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){s&&(s.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){l&&s&&s.hunks.push(l),c=parseInt(h[1],10),u=parseInt(h[2],10),l={header:f,lines:[]};continue}l&&(f.startsWith("+")?l.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?l.lines.push({type:"del",content:f.slice(1),oldLineNo:c++}):f.startsWith(" ")&&l.lines.push({type:"context",content:f.slice(1),oldLineNo:c++,newLineNo:u++}))}l&&s&&s.hunks.push(l),s&&t.push(s);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 s=t,l=t;for(;t<e.length&&e[t].type==="add";)t++;const c=t,u=s-n,f=c-l;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const g=e[n+p],v=e[l+p],y=Yj(g.content,v.content);g.wordChanges=y.filter(b=>!b.added).map(b=>({value:b.value,removed:b.removed})),v.wordChanges=y.filter(b=>!b.removed).map(b=>({value:b.value,added:b.added}))}}t===n&&t++}}function tN({line:e}){return e.wordChanges?a.jsx(a.Fragment,{children:e.wordChanges.map((t,n)=>t.added?a.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?a.jsx("span",{className:"diff-word-del",children:t.value},n):a.jsx("span",{children:t.value},n))}):a.jsx(a.Fragment,{children:e.content})}function nN({hunk:e,showLineNumbers:t}){return a.jsxs("div",{className:"diff-hunk",children:[a.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,s)=>a.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),a.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),a.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),a.jsxs("span",{className:"diff-content",children:[a.jsx(tN,{line:n}),!n.content&&" "]})]},s))]})}function rN({fileName:e}){const t=e.split("/"),n=t.pop()||e,s=t.join("/");return a.jsxs("div",{className:"diff-file-header",children:[a.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:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}),s&&a.jsxs("span",{className:"text-cc-muted",children:[s,"/"]}),a.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function Rl({oldText:e,newText:t,unifiedDiff:n,fileName:s,mode:l="compact"}){const c=l==="compact",u=!c,f=S.useMemo(()=>{if(n)return eN(n);const h=e??"",p=t??"";if(!h&&!p)return[];const g=Jj(h,p);return[{fileName:s||"",hunks:g}]},[e,t,n,s]);return f.length===0||f.every(h=>h.hunks.length===0)?a.jsx("div",{className:"diff-viewer diff-empty",children:a.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):a.jsx("div",{className:`diff-viewer ${c?"diff-compact":"diff-full"}`,children:f.map((h,p)=>a.jsxs("div",{className:"diff-file",children:[(h.fileName||s)&&a.jsx(rN,{fileName:h.fileName||s||""}),h.hunks.map((g,v)=>a.jsx(nN,{hunk:g,showLineNumbers:u},v))]},p))})}const sN={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 Cc(e){return sN[e]||"tool"}function Ci(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[s,l]=S.useState(e==="Edit"),c=Cc(e),u=Ci(e),f=hc(e,t);return e==="Edit"?a.jsx(iN,{input:t,toolUseId:n}):e==="Bash"?a.jsx(aN,{input:t,toolUseId:n}):a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[a.jsxs("button",{onClick:()=>l(!s),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${s?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(kl,{type:c}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),s&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:a.jsx("div",{className:"mt-2",children:a.jsx(lN,{name:e,input:t})})})]})}function iN({input:e,toolUseId:t}){const n=String(e.file_path||""),s=n?n.split("/").pop()||n:"",l=String(e.old_string||""),c=String(e.new_string||""),u=!!(l||c),f=!!e.replace_all,[h,p]=S.useState(!1),v=(Array.isArray(e.changes)?e.changes:[]).map(_=>({path:typeof _.path=="string"?_.path:"",kind:typeof _.kind=="string"?_.kind:"update"})).filter(_=>_.path),y=(l+c).split(`
|
|
60
|
+
`).length,b=y>15;return a.jsxs("div",{"data-tool-use-id":t,children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[a.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),s&&a.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:s}),f&&a.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),u?a.jsxs("div",{className:"relative mt-1",children:[a.jsx("div",{className:`overflow-hidden ${b&&!h?"max-h-[240px]":""}`,children:a.jsx(Rl,{oldText:l,newText:c,mode:"compact"})}),b&&!h&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),b&&a.jsx("button",{type:"button",onClick:()=>p(!h),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:h?"Show less":`Show all ${y} lines`})]}):v.length>0?a.jsx("div",{className:"mt-1 space-y-1",children:v.map((_,j)=>{const E=_.path.split("/").pop()||_.path;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:`text-[9px] font-semibold uppercase ${_.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":_.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:_.kind}),a.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:E})]},`${_.path}-${j}`)})}):a.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})]})}function aN({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",s=typeof e.description=="string"?e.description:"";return a.jsxs("div",{"data-tool-use-id":t,children:[s&&a.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:s}),a.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:a.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function lN({name:e,input:t}){switch(e){case"Bash":return a.jsx(oN,{input:t});case"Edit":return a.jsx(cN,{input:t});case"Write":return a.jsx(uN,{input:t});case"Read":return a.jsx(dN,{input:t});case"Glob":return a.jsx(fN,{input:t});case"Grep":return a.jsx(hN,{input:t});case"WebSearch":case"web_search":return a.jsx(pN,{input:t});case"WebFetch":return a.jsx(mN,{input:t});case"Task":return a.jsx(gN,{input:t});case"TodoWrite":return a.jsx(xN,{input:t});case"NotebookEdit":return a.jsx(vN,{input:t});case"SendMessage":return a.jsx(bN,{input:t});default:return a.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 oN({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),a.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:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function cN({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),s=String(e.new_string||""),c=(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 a.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&a.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||s?a.jsx(Rl,{oldText:n,newText:s,fileName:t,mode:"compact"}):c.length>0?a.jsxs("div",{className:"space-y-1.5",children:[!!t&&a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),c.map((u,f)=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[a.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}),a.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):a.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 uN({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(Rl,{newText:n,fileName:t,mode:"compact"})}function dN({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,s=e.limit;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||s!=null)&&a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&a.jsxs("span",{children:["offset: ",n]}),s!=null&&a.jsxs("span",{children:["limit: ",s]})]})]})}function fN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function hN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.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||"")}),a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&a.jsxs("span",{children:["path: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&a.jsxs("span",{children:["glob: ",a.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&a.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&a.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&a.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function pN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function mN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.url&&a.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&a.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function gN({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&a.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&&a.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 xN({input:e}){const t=e.todos;return Array.isArray(t)?a.jsx("div",{className:"space-y-0.5",children:t.map((n,s)=>{const l=n.status||"pending";return a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("span",{className:"shrink-0 mt-0.5",children:l==="completed"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.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==="in_progress"?a.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.jsx("span",{className:`text-[11px] leading-snug ${l==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},s)})}):a.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 vN({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,s=e.edit_mode;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&a.jsxs("span",{children:["type: ",n]}),s&&a.jsxs("span",{children:["mode: ",s]}),e.cell_number!=null&&a.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&a.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 bN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&a.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",a.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&a.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function hc(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),s=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",l=n+s;return l.length>60?l.slice(0,60)+"...":l}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 kl({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("polyline",{points:"3 11 6 8 3 5"}),a.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.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"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"5",r:"3"}),a.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),a.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const yN=2e3,_N=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"]),Vr=new Map,Is=new Map,Cd=new Map,xd=new Map,ki=new Map,nc=new Map,pc=new Map,Ed=new Map;function Z5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function J5(e){const t=X.getState(),n=t.sdkSessions.find(s=>s.sessionId===e);return n?!n.archived:t.currentSessionId===e}function wN(){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 mc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){mc=!0;for(const[e,t]of Is)clearTimeout(t),Is.delete(e)}else{mc=!1;for(const e of wN()){if(!J5(e))continue;const t=Vr.get(e);if(!Z5(t)){if(t){try{t.close()}catch{}Vr.delete(e)}Ec(e)}}}});function vd(e){const t=e.startsWith("/"),n=e.split("/"),s=[];for(const l of n)if(!(!l||l===".")){if(l===".."){s.length>0&&s.pop();continue}s.push(l)}return`${t?"/":""}${s.join("/")}`}function SN(e,t){return e.startsWith("/")||!t?vd(e):vd(`${t}/${e}`)}function kN(e,t){if(!t)return!0;const n=vd(t);return e===n||e.startsWith(`${n}/`)}function jN(e){let t=Ed.get(e);return t||(t=new Set,Ed.set(e,t)),t}function bp(e,t){const n=X.getState(),s=jN(e);for(const l of t){if(l.type!=="tool_use")continue;const{name:c,input:u,id:f}=l;if(f){if(s.has(f))continue;s.add(f)}if(c==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),xd.set(e,p.length)}continue}if(c==="TaskCreate"){const h=(xd.get(e)||0)+1;xd.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(c==="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 yp(e,t){var c,u;const n=X.getState(),s=((c=n.sessions.get(e))==null?void 0:c.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let l=!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=SN(p.file_path,s);kN(g,s)&&(l=!0)}}l&&n.bumpChangedFilesTick(e)}const Qo=new Map,NN=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function _p(e,t){const n=X.getState();for(const s of t){if(s.type==="tool_use"&&s.name==="Bash"){const l=s.input;if(l.run_in_background===!0){let c=Qo.get(e);c||(c=new Map,Qo.set(e,c)),c.set(s.id,{command:l.command||"",description:l.description||"",startedAt:Date.now()})}}if(s.type==="tool_result"){const l=s.tool_use_id,c=Qo.get(e),u=c==null?void 0:c.get(l);if(c&&u){const h=(typeof s.content=="string"?s.content:Array.isArray(s.content)?s.content.map(p=>"text"in p?p.text:"").join(""):"").match(NN);if(h){const p={taskId:h[1],toolUseId:l,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}c.delete(l),c.size===0&&Qo.delete(e)}}}}const Ju=new Map,Td=new Map;function wp(e,t){const n=X.getState();let s=Td.get(e);s||(s=new Set,Td.set(e,s));for(const l of t){if(l.type==="tool_use"&&l.name==="Agent"){if(l.id&&s.has(l.id))continue;const c=l.input;if(c.run_in_background===!0){l.id&&s.add(l.id);let u=Ju.get(e);u||(u=new Map,Ju.set(e,u));const f={toolUseId:l.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(l.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(l.type==="tool_result"){const c=l.tool_use_id,u=Ju.get(e),f=u==null?void 0:u.get(c);if(u&&f){const h=typeof l.content=="string"?l.content:Array.isArray(l.content)?l.content.map(g=>"text"in g?g.text:"").join(""):"",p=l.is_error===!0;n.updateBackgroundAgent(e,c,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(c),u.size===0&&Ju.delete(e)}}}}function xb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function vb(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 CN=0,EN=0;function ss(){return`msg-${Date.now()}-${++CN}`}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 $j(e)?`${Bj}
|
|
61
|
+
|
|
62
|
+
Details: ${t}`:`Error: ${t}`}function TN(e,t){const n=pc.get(e)||[];n.push(t),pc.set(e,n)}function AN(e,t){const n=pc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){pc.delete(e);for(const s of n)t.send(JSON.stringify(s))}}const Ds=new Map;function yb(e,t,n){const s=X.getState(),l=s.messages.get(e)||[],c=nc.get(e);let u=l.filter(h=>!h.isStreaming||h.id===c),f=-1;if(c&&(f=u.findIndex(h=>h.id===c),f===-1&&nc.delete(e)),f===-1){const h=`stream-${e}-${ss()}`;nc.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}}s.setMessages(e,u)}function wi(e){nc.delete(e);const t=X.getState(),n=t.messages.get(e)||[],s=n.filter(l=>!l.isStreaming);return s.length!==n.length?(t.setMessages(e,s),!0):!1}const _b=new Map,MN=8e3;function ll(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const s=Date.now(),l=_b.get(e);l&&l.code===t&&s-l.at<MN||(_b.set(e,{code:t,at:s}),X.getState().appendMessage(e,{id:`companion-notice-${t}-${s}`,role:"system",content:n.userText,timestamp:s,meta:!0,metaCode:t}))}function e_(){return`cmsg-${Date.now()}-${++EN}`}function wm(){return e_()}const RN=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 LN(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 t_(e){return`companion:last-seq:${e}`}function Sm(e){const t=Cd.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(t_(e)),s=n?Number(n):0,l=Number.isFinite(s)?Math.max(0,Math.floor(s)):0;return Cd.set(e,l),l}catch{return 0}}function wb(e,t){const n=Math.max(0,Math.floor(t));Cd.set(e,n);try{localStorage.setItem(t_(e),String(n))}catch{}}function Sb(e,t){Pn(e,{type:"session_ack",last_seq:t})}function bd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
63
|
+
`)}function Sp(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 DN(e,t){const n=e||[],s=t||[];if(n.length===0&&s.length===0)return;const l=new Map;for(const f of s)l.set(Sp(f),f);const c=[],u=new Set;for(const f of n){const h=Sp(f);u.has(h)||(u.add(h),c.push(l.get(h)||f))}for(const f of s){const h=Sp(f);u.has(h)||(u.add(h),c.push(f))}return c}function kb(e,t,n,s,l){return{toolUseId:e,toolName:t,preview:hc(t,n),startedAt:s,elapsedSeconds:0,isError:!1,parentToolUseId:l||void 0}}function km(e,t){const n=DN(e.contentBlocks,t.contentBlocks),s=n&&n.length>0?bd(n):t.content||e.content;return{...e,...t,content:s,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function zN(e,t){const n=X.getState(),s=n.messages.get(e)||[],l=s.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(l===-1){n.appendMessage(e,t);return}const c=[...s];c[l]=km(c[l],t),n.setMessages(e,c)}function ON(e,t){var l,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(l=t.data)==null?void 0:l.substring)==null?void 0:c.call(l,0,120));return}const s=X.getState();s.connectionStatus.get(e)==="connecting"&&s.setConnectionStatus(e,"connected"),n_(e,n)}function n_(e,t,n={}){var u,f,h,p,g,v;const{processSeq:s=!0,ackSeqMessage:l=!0}=n,c=X.getState();if(s&&typeof t.seq=="number"){const y=Sm(e);if(t.seq<=y)return;wb(e,t.seq),l&&Sb(e,t.seq)}switch(_N.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const y=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),y||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const b=new Set(c.sessionNames.values()),_=Y5(b);c.setSessionName(e,_)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const y=t.message;if(y.model==="<synthetic>"){wi(e),c.setStreaming(e,null),ll(e,"synthetic_noop",{detail:{stopReason:y.stop_reason,text:bd(y.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const b=bd(y.content),_={id:y.id,role:"assistant",content:b,contentBlocks:y.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:y.model,stopReason:y.stop_reason};if(wi(e),zN(e,_),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),(u=y.content)!=null&&u.length)for(const j of y.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=y.content)!=null&&f.length)for(const j of y.content){if(j.type==="tool_use"){const E=j.input||{};c.addToolActivity(e,kb(j.id,j.name,E,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=y.content)!=null&&h.length&&(bp(e,y.content),yp(e,y.content),_p(e,y.content),wp(e,y.content));break}case"stream_event":{const y=t.event;if(y&&typeof y=="object"){if(y.type==="message_start"&&(ki.delete(e),Ds.delete(e),wi(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),y.type==="content_block_delta"){const b=y.delta;if((b==null?void 0:b.type)==="text_delta"&&typeof b.text=="string"){const _=Ds.get(e)||{thinking:"",text:""};ki.get(e)==="thinking"&&(_.thinking=""),_.text+=b.text,Ds.set(e,_),ki.set(e,"text"),c.setStreaming(e,_.text),yb(e,_.text,"text")}if((b==null?void 0:b.type)==="thinking_delta"&&typeof b.thinking=="string"){const _=Ds.get(e)||{thinking:"",text:""};_.thinking+=b.thinking,Ds.set(e,_),ki.set(e,"thinking"),c.setStreaming(e,_.thinking),yb(e,_.thinking,"thinking")}}if(y.type==="message_delta"){const b=y.usage;b!=null&&b.output_tokens&&c.setStreamingStats(e,{outputTokens:b.output_tokens})}}break}case"result":{Ed.delete(e),Td.delete(e);const y=t.data,b={total_cost_usd:y.total_cost_usd,num_turns:y.num_turns};if(typeof y.total_lines_added=="number"&&(b.total_lines_added=y.total_lines_added),typeof y.total_lines_removed=="number"&&(b.total_lines_removed=y.total_lines_removed),y.modelUsage){for(const _ of Object.values(y.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);b.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,b),wi(e),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&Hj(),!document.hasFocus()&&c.notificationDesktop&&xb("Session completed","Claude finished the task",e),y.is_error&&c.appendMessage(e,{id:ss(),role:"system",content:bb(y),timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const b=t.request;xb("Permission needed",`${b.tool_name}: approve or deny`,b.request_id)}const y=t.request;if(y.tool_name&&y.input){const b=[{type:"tool_use",id:y.tool_use_id,name:y.tool_name,input:y.input}];bp(e,b),yp(e,b),_p(e,b),wp(e,b)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=c.sdkSessions.find(b=>b.sessionId===e))==null?void 0:p.backendType)==="codex"&&c.appendMessage(e,{id:ss(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||ss(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:b,status:_,summary:j}=t.event;b&&_&&c.updateProcess(e,b,{status:_,completedAt:Date.now(),summary:j||void 0})}const y=vb(t.event);if(!y)break;c.appendMessage(e,{id:ss(),role:"system",content:y,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:ss(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:ss(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const y=t.phase;y==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)?ll(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."}):ll(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):y==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)&&ll(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):y==="starting"||y==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),y==="ready"?c.setSessionStatus(e,"idle"):y==="streaming"?c.setSessionStatus(e,"running"):y==="compacting"?c.setSessionStatus(e,"compacting"):y==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)?ll(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):ll(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const y=c.sessionNames.get(e),b=y&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(y);(!y||b)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const y=[],b=new Map;for(let j=0;j<t.messages.length;j++){const E=t.messages[j];if(E.type==="user_message")y.push({id:E.id||ss(),role:"user",content:E.content,timestamp:E.timestamp});else if(E.type==="assistant"){const k=E.message,A=bd(k.content),C={id:k.id,role:"assistant",content:A,contentBlocks:k.content,timestamp:E.timestamp||Date.now(),parentToolUseId:E.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},D=y.findIndex(O=>O.role==="assistant"&&O.id===C.id);if(D===-1?y.push(C):y[D]=km(y[D],C),(v=k.content)!=null&&v.length){bp(e,k.content),yp(e,k.content),_p(e,k.content),wp(e,k.content);const O=E.timestamp||Date.now();for(const L of k.content){if(L.type==="tool_use"){const I=L.input||{},$=b.get(L.id);b.set(L.id,$??kb(L.id,L.name,I,O,E.parent_tool_use_id))}if(L.type==="tool_result"){const I=b.get(L.tool_use_id);I&&b.set(L.tool_use_id,{...I,completedAt:O,isError:I.isError||!!L.is_error,elapsedSeconds:Math.max(I.elapsedSeconds,I.completedAt?I.elapsedSeconds:Math.max(0,(O-I.startedAt)/1e3))})}}}}else if(E.type==="result"){const k=E.data;k.is_error&&y.push({id:`hist-error-${j}`,role:"system",content:bb(k),timestamp:Date.now()});const A={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(A.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(A.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const C of Object.values(k.modelUsage))if(C.contextWindow>0){const D=C,O=Math.round((D.inputTokens+D.outputTokens)/D.contextWindow*100);A.context_used_percent=Math.max(0,Math.min(O,100))}}c.updateSession(e,A)}else if(E.type==="system_event"){const k=vb(E.event);if(!k)continue;y.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:E.timestamp||Date.now()})}}if(y.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,y);else{const E=[...j];for(const k of y){const A=E.findIndex(D=>D.id===k.id);if(A===-1){E.push(k);continue}const C=E[A];C.role==="assistant"&&k.role==="assistant"?E[A]=km(C,k):E[A]=k}E.sort((k,A)=>(k.timestamp??0)-(A.timestamp??0)),c.setMessages(e,E)}}c.setToolActivity(e,Array.from(b.values()).sort((j,E)=>j.startedAt-E.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(wi(e),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let y;for(const b of t.events){const _=Sm(e);b.seq<=_||(wb(e,b.seq),y=b.seq,n_(e,b.message,{processSeq:!1,ackSeqMessage:!1}))}typeof y=="number"&&Sb(e,y);break}case"prompt_suggestion":{const y=t.suggestions;c.setPromptSuggestions(e,y);break}case"streamlined_text":{c.appendMessage(e,{id:ss(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:ss(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Ec(e){const t=Vr.get(e);if(Z5(t))return;if(t){try{t.close()}catch{}Vr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const s=new WebSocket(LN(e));Vr.set(e,s),s.onopen=()=>{const l=Sm(e);s.send(JSON.stringify({type:"session_subscribe",last_seq:l})),AN(e,s);const c=Is.get(e);c&&(clearTimeout(c),Is.delete(e))},s.onmessage=l=>ON(e,l),s.onclose=()=>{Vr.get(e)===s&&(Vr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),BN(e))},s.onerror=()=>{s.close()}}function BN(e){if(Is.has(e)||mc)return;const t=setTimeout(()=>{Is.delete(e),!mc&&J5(e)&&Ec(e)},yN);Is.set(e,t)}function jm(e){const t=Is.get(e);t&&(clearTimeout(t),Is.delete(e));const n=Vr.get(e);n&&(n.close(),Vr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),Ed.delete(e),Td.delete(e),Qo.delete(e),xd.delete(e),ki.delete(e),nc.delete(e),Ds.delete(e),Cd.delete(e),pc.delete(e)}function PN(e){if(!mc)for(const t of e)t.archived||Ec(t.sessionId)}function UN(e){return new Promise((t,n)=>{const s=setInterval(()=>{const c=Vr.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(s),clearTimeout(l),t())},50),l=setTimeout(()=>{clearInterval(s),n(new Error("Connection timeout"))},1e4)})}function Pn(e,t){const n=Vr.get(e);let s=t;const l=RN.has(t.type);if(l)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||(s={...t,client_msg_id:e_()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(s));return}l&&TN(e,s)}function jb(e){Pn(e,{type:"mcp_get_status"})}function $N(e,t,n){Pn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function FN(e,t){Pn(e,{type:"mcp_reconnect",serverName:t})}function HN(e,t){Pn(e,{type:"mcp_set_servers",servers:t})}function IN(e,t){Pn(e,{type:"set_ai_validation",...t})}var re=typeof window<"u"?window:void 0,gn=typeof globalThis<"u"?globalThis:re;typeof self>"u"&&(gn.self=gn),typeof File>"u"&&(gn.File=function(){});var dr=gn==null?void 0:gn.navigator,Ne=gn==null?void 0:gn.document,Nn=gn==null?void 0:gn.location,Nm=gn==null?void 0:gn.fetch,Cm=gn!=null&&gn.XMLHttpRequest&&"withCredentials"in new gn.XMLHttpRequest?gn.XMLHttpRequest:void 0,Nb=gn==null?void 0:gn.AbortController,qN=gn==null?void 0:gn.CompressionStream,Kn=dr==null?void 0:dr.userAgent,De=re??{},Cb="1.392.0",Zt={DEBUG:!1,LIB_VERSION:Cb,LIB_NAME:"web",JS_SDK_VERSION:Cb};function Eb(e,t,n,s,l,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(s,l)}function vn(e){return function(){var t=this,n=arguments;return new Promise((function(s,l){var c=e.apply(t,n);function u(h){Eb(c,s,l,u,f,"next",h)}function f(h){Eb(c,s,l,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ye.apply(null,arguments)}function r_(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.indexOf(s)!==-1)continue;n[s]=e[s]}return n}var VN=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function GN(e){return typeof e=="string"||e}function YN(e){return typeof e=="string"?e:void 0}var Do,Bs=(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.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.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})({}),Tb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),QN=["$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"],XN=["token"],s_="NativeGzipValidationError",Em=e=>e.length>=2&&e[0]===31&&e[1]===139,Ab=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",ed=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=s_,t},WN=(function(){var e=vn((function*(t,n){18>t.size&&ed("too-short");var s=new Uint8Array(yield t.slice(0,10).arrayBuffer());Em(s)&&s[2]===8||ed("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Do)return Do;Do=[];for(var g=0;256>g;g++){for(var v=g,y=0;8>y;y++)v=1&v?3988292384^v>>>1:v>>>1;Do[g]=v>>>0}return Do})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&ed("invalid-crc");var c=n.length>>>0;l.getUint32(4,!0)!==c&&ed("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Tm(){return Tm=vn((function*(e,t,n){t===void 0&&(t=!0);try{var s=new TextEncoder().encode(e),l=new CompressionStream("gzip"),c=l.writable.getWriter(),u=c.write(s).then((()=>c.close())).catch((function(){var p=vn((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(l.readable).blob(),[h]=yield Promise.all([f,u]);return yield WN(h,s),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Tm.apply(this,arguments)}var KN=["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"],Mb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return KN.concat(t).some((s=>{var l=s.toLowerCase();return n.indexOf(l)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var rf=function(e){return e.trim()},Am=function(e){return e.replace(/^\$/,"")},i_=Object.prototype,a_=i_.hasOwnProperty,sf=i_.toString,nt=Array.isArray||function(e){return sf.call(e)==="[object Array]"},Ps=e=>typeof e=="function",$t=e=>e===Object(e)&&!nt(e),ji=e=>{if($t(e)){for(var t in e)if(a_.call(e,t))return!1;return!0}return!1},Se=e=>e===void 0,Bt=e=>sf.call(e)=="[object String]",Mm=e=>Bt(e)&&e.trim().length===0,$n=e=>e===null,rt=e=>Se(e)||$n(e),Fn=e=>sf.call(e)=="[object Number]"&&e==e,zs=e=>Fn(e)&&e>0,cs=e=>sf.call(e)==="[object Boolean]",ZN=e=>e instanceof FormData,JN=e=>Ie(QN,e),e3=e=>Ie(XN,e);function l_(e){return e===null||typeof e!="object"}function Ad(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ag(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var t3=[!0,"true",1,"1","yes"],kp=e=>Ie(t3,e),n3=[!1,"false",0,"0","no"];function os(e,t,n,s,l){return t>n&&(s.warn("min cannot be greater than max."),t=n),Fn(e)?e>n?(s.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),os(l||n,t,n,s))}class r3{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=os(t.bucketSize,0,100,t.Ae),this.$e=os(t.refillRate,0,this.Fe,t.Ae),this.De=os(t.refillInterval,0,864e5,t.Ae)}Ne(t,n){var s=Math.floor((n-t.lastAccess)/this.De);s>0&&(t.tokens=Math.min(t.tokens+s*this.$e,this.Fe),t.lastAccess=t.lastAccess+s*this.De)}consumeRateLimit(t){var n,s=Date.now(),l=String(t),c=this.Ee[l];return c?this.Ne(c,s):this.Ee[l]=c={tokens:this.Fe,lastAccess:s},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.Pe)==null||n.call(this,t)),c.tokens===0)}stop(){this.Ee={}}}var hr="Mobile",Md="iOS",Hs="Android",jl="Tablet",o_=Hs+" "+jl,c_="iPad",u_="Apple",d_=u_+" Watch",rc="Safari",Nl="BlackBerry",f_="Samsung",h_=f_+"Browser",p_=f_+" Internet",ma="Chrome",s3=ma+" OS",m_=ma+" "+Md,Mg="Internet Explorer",g_=Mg+" "+hr,Rg="Opera",i3=Rg+" Mini",Lg="Edge",x_="Microsoft "+Lg,wl="Firefox",v_=wl+" "+Md,gc="Nintendo",xc="PlayStation",Sl="Xbox",b_=Hs+" "+hr,y_=hr+" "+rc,Xo="Windows",Rm=Xo+" Phone",Rb="Nokia",Lm="Ouya",__="Generic",a3=__+" "+hr.toLowerCase(),w_=__+" "+jl.toLowerCase(),Dm="Konqueror",S_="Oculus Browser",Rd="Vivaldi",k_="Yandex",Ld="Whale",zm="DuckDuckGo",j_="Pale Moon",Dd="Waterfox",sc="Brave",N_="Google Search App",Vt="(\\d+(\\.\\d+)?)",jp=new RegExp("Version/"+Vt),l3=new RegExp(Sl,"i"),o3=new RegExp(xc+" \\w+","i"),c3=new RegExp(gc+" \\w+","i"),Dg=new RegExp(Nl+"|PlayBook|BB10","i"),u3={"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"},C_=function(e,t,n,s){t=t||"";var l=(function(c){return c!=null&&c.brave?sc:null})(n);return l||(s!=null&&s.detectGoogleSearchApp&&Ie(e,"GSA/")?N_:Ie(e," OPR/")&&Ie(e,"Mini")?i3:Ie(e," OPR/")?Rg:Dg.test(e)?Nl:Ie(e,"IE"+hr)||Ie(e,"WPDesktop")?g_:Ie(e,"OculusBrowser")?S_:Ie(e,h_)?p_:Ie(e,Lg)||Ie(e,"Edg/")?x_:Ie(e,Rd+"/")?Rd:Ie(e,"YaBrowser/")?k_:Ie(e,Ld+"/")?Ld:Ie(e,zm+"/")||Ie(e,"Ddg/")?zm:Ie(e,"FBIOS")?"Facebook "+hr:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?m_:Ie(e,"CrMo")||Ie(e,ma)?ma:Ie(e,Hs)&&Ie(e,rc)?b_:Ie(e,"FxiOS")?v_:Ie(e.toLowerCase(),Dm.toLowerCase())?Dm:Ie(e,sc+"/")?sc:((c,u)=>u&&Ie(u,u_)||(function(f){return Ie(f,rc)&&!Ie(f,ma)&&!Ie(f,Hs)})(c))(e,t)?Ie(e,hr)?y_:rc:Ie(e,"PaleMoon/")?j_:Ie(e,Dd+"/")?Dd:Ie(e,wl)?wl:Ie(e,"MSIE")||Ie(e,"Trident/")?Mg:Ie(e,"Gecko")?wl:"")},d3={[g_]:[new RegExp("rv:"+Vt)],[x_]:[new RegExp(Lg+"?\\/"+Vt)],[ma]:[new RegExp("("+ma+"|CrMo)\\/"+Vt)],[m_]:[new RegExp("CriOS\\/"+Vt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Vt)],[rc]:[jp],[y_]:[jp],[Rg]:[new RegExp("(Opera|OPR)\\/"+Vt)],[wl]:[new RegExp(wl+"\\/"+Vt)],[v_]:[new RegExp("FxiOS\\/"+Vt)],[Dm]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[Nl]:[new RegExp(Nl+" "+Vt),jp],[b_]:[new RegExp("android\\s"+Vt,"i")],[p_]:[new RegExp(h_+"\\/"+Vt)],[S_]:[new RegExp("OculusBrowser\\/"+Vt)],[Rd]:[new RegExp(Rd+"\\/"+Vt)],[k_]:[new RegExp("YaBrowser\\/"+Vt)],[Ld]:[new RegExp(Ld+"\\/"+Vt)],[sc]:[new RegExp(sc+"\\/"+Vt)],[zm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Vt)],[j_]:[new RegExp("PaleMoon\\/"+Vt)],[Dd]:[new RegExp(Dd+"\\/"+Vt)],[N_]:[new RegExp("GSA\\/"+Vt)],[Mg]:[new RegExp("(rv:|MSIE )"+Vt)],Mozilla:[new RegExp("rv:"+Vt)]},f3=function(e,t,n,s){var l=C_(e,t,n,s),c=d3[l];if(Se(c))return null;for(var u=0;c.length>u;u++){var f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},Lb=[[new RegExp(Sl+"; "+Sl+" (.*?)[);]","i"),e=>[Sl,e&&e[1]||""]],[new RegExp(gc,"i"),[gc,""]],[new RegExp(xc,"i"),[xc,""]],[Dg,[Nl,""]],[new RegExp(Xo,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Rm,""];if(new RegExp(hr).test(t)&&!/IEMobile\b/.test(t))return[Xo+" "+hr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=u3[n[1]]||"";return/arm/i.test(t)&&(s="RT"),[Xo,s]}return[Xo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Md,[e[3],e[4],e[5]||"0"].join(".")]:[Md,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hs+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hs+")","i"),e=>e&&e[2]?[Hs,[e[2],e[3],e[4]||"0"].join(".")]:[Hs,""]],[/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/,[s3,""]],[/Linux|debian/i,["Linux",""]]],Db=function(e){return c3.test(e)?gc:o3.test(e)?xc:l3.test(e)?Sl:new RegExp(Lm,"i").test(e)?Lm:new RegExp("("+Rm+"|WPDesktop)","i").test(e)?Rm:/iPad/.test(e)?c_:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?d_:Dg.test(e)?Nl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Rb,"i").test(e)?Rb:/(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(hr).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)?Hs:o_:new RegExp("(pda|"+hr+")","i").test(e)?a3:new RegExp(jl,"i").test(e)&&!new RegExp(jl+" pc","i").test(e)?w_:""},h3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function zb(e,t){return typeof(n=e)=="string"&&h3.test(n)?e:t();var n}function Np(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var p3=e=>e instanceof Error,E_={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}},m3=E_.info;function T_(e){if(cs(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(nt(e))return{arrayValue:{values:e.map((t=>T_(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function A_(e){var t=[];for(var n in e){var s=e[n];$n(s)||Se(s)||t.push({key:n,value:T_(s)})}return t}function g3(e,t){var n=e.level||"info",{text:s,number:l}=E_[n]||m3,c=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),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=ye({},u,e.attributes||{}),h={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:l,severityText:s,body:{stringValue:e.body},attributes:A_(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),Se(e.trace_flags)||(h.flags=e.trace_flags),h}function M_(e,t,n){return ye({},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 R_(e,t,n,s){return{resourceLogs:[{resource:{attributes:A_(t)},scopeLogs:[{scope:{name:n,version:s},logRecords:e}]}]}}let x3=class{constructor(e,t,n,s,l,c,u){var f;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Se=t,this.Ae=n,this.qe=s,this.je=l,this.Be=c,this.He=u,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=t.maxBufferSize,this.Je=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.Ye=t.flushIntervalMs,this.Ke=t.maxBatchRecordsPerPost,this.Xe=t.rateCapWindowMs,this.et=t.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.it(e);if(t!==null)if(t.body){if(this.nt()){var n={record:g3(t,this.qe())};this.je((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(e){var t=this.Se.beforeSend;if(!t)return e;var n=nt(t)?t:[t],s=e;for(var l of n)try{var c=l(s);if(!c)return this.Ae.info("Log was rejected in beforeSend function"),null;s=c}catch(u){return this.Ae.error("Error in beforeSend function for log:",u),null}return s}nt(){if(this.et===void 0)return!0;var e=Date.now(),t=e-this.We;return this.Xe>t&&t>=0||(this.We=e,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var e=this;return vn((function*(){if(!e._instance.isDisabled)return e.Ue||(e.Ue=e.ot().finally((()=>{e.Ue=null}))),e.Ue}))()}ot(){var e=this;return vn((function*(){var t;e.tt();var n=(t=e._instance.getPersistedProperty(Bs.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var s=n.length,l=0;n.length>0&&s>l;){var c,u;e.ze=0;var f=Math.min(n.length,e.Ke),h=n.slice(0,f),p=R_(h.map((v=>v.record)),e.ut(),(c=e.He)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.ht(p);if(g.kind==="too-large"&&h.length>1)e.Ke=Math.max(1,Math.floor(h.length/2)),e.Ae.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Ke);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.Ae.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.Se.maxBatchRecordsPerPost>e.Ke&&(e.Ke=Math.min(e.Se.maxBatchRecordsPerPost,e.Ke+1)),yield e.dt(h.length),n=(u=e._instance.getPersistedProperty(Bs.LogsQueue))!==null&&u!==void 0?u:[],l+=h.length,g.kind==="fatal"))throw g.error}}))()}dt(e){var t=this;return vn((function*(){var n,s=Math.max(0,e-t.ze),l=(n=t._instance.getPersistedProperty(Bs.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Bs.LogsQueue,l.slice(s)),yield t.Be()}))()}ut(){return M_(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Bs.LogsQueue))!==null&&t!==void 0?t:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Bs.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(e){e===void 0&&(e=this.Ye),this.vt||(this.vt=Np((()=>{this.vt=void 0,this.rt()}),e))}ft(){var e=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,e)}yt(){var e=this._instance.getPersistedProperty(Bs.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return vn((function*(){t.tt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((s=>Np(s,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return vn((function*(){var n=!1,s=t.flush(),l=new Promise((c=>Np((()=>{n=!0,c()}),e)));try{yield Promise.race([s,l])}finally{n&&s.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(e=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var td,Ob,Cp;function v3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Cp&&n.length===Ob||(Ob=n.length,Cp=n.reduce(((s,l)=>{td||(td={});var c=td[l];if(c)s[c[0]]=c[1];else for(var u=e(l),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[l];if(p&&g){s[p]=g,td[l]=[p,g];break}}return s}),{})),Cp}}class b3{constructor(t,n,s){s===void 0&&(s=[]),this.coercers=t,this.stackParser=n,this.modifiers=s}buildFromUnknown(t,n){n===void 0&&(n={});var s=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(s,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(l,c);return{$exception_list:this.convertToExceptionList(u,s),$exception_level:"error"}}modifyFrames(t){var n=this;return vn((function*(){for(var s of t)s.stacktrace&&s.stacktrace.frames&&nt(s.stacktrace.frames)&&(s.stacktrace.frames=yield n.applyModifiers(s.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 s,l;return t.cause!=null&&(s=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:s,stack:l})}applyChunkIds(t,n){return t.map((s=>(s.filename&&n&&(s.chunk_id=n[s.filename]),s)))}applyCoercers(t,n){for(var s of this.coercers)if(s.match(t))return s.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return vn((function*(){var s=t;for(var l of n.modifiers)s=yield l(s);return s}))()}convertToExceptionList(t,n){var s,l,c,u={type:t.type,value:t.value,mechanism:{type:(s=n.type)!==null&&s!==void 0?s:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:v3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,s){s===void 0&&(s=0);var l=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:s==0?n.syntheticException:void 0,mechanism:t,apply:c=>l(c,s),next:c=>l(c,s+1)})}}var Cl="?";function Om(e,t,n,s,l){var c={platform:e,filename:t,function:n==="<anonymous>"?Cl:n,in_app:!0};return Se(s)||(c.lineno=s),Se(l)||(c.colno=l),c}var L_=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:Cl,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},y3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,w3=/\((\S*)(?::(\d+))(?::(\d+))\)/,S3=(e,t)=>{var n=y3.exec(e);if(n){var[,s,l,c]=n;return Om(t,s,Cl,+l,+c)}var u=_3.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=w3.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=L_(u[1]||Cl,u[2]);return Om(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},k3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,j3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,N3=(e,t)=>{var n=k3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var s=j3.exec(n[3]);s&&(n[1]=n[1]||"eval",n[3]=s[1],n[4]=s[2],n[5]="")}var l=n[3],c=n[1]||Cl;return[c,l]=L_(c,l),Om(t,l,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Bb=/\(error: (.*)\)/;class C3{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var s=Bt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:s?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 Ad(t,"DOMException")}isDOMError(t){return Ad(t,"DOMError")}}class E3{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var s=t.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(t){return t.stacktrace||t.stack||void 0}}class T3{constructor(){}match(t){return Ad(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var s;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var A3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class M3{match(t){return typeof t=="string"}coerce(t,n){var s,[l,c]=this.getInfos(t);return{type:l??"Error",value:c??t,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(t){var n="Error",s=t,l=t.match(A3);return l&&(n=l[1],s=l[2]),[n,s]}}var R3=["fatal","error","warning","log","info","debug"];function D_(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var s=n.length;s>0;s--){var l=n.slice(0,s).join(", ");if(t>=l.length)return s===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class L3{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var s,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(s=n.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Ag(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 s=this.getObjectClassName(t);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+D_(t)}isSeverityLevel(t){return Bt(t)&&!Mm(t)&&R3.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var s=t[n];if(p3(s))return s}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class D3{match(t){return Ag(t)}coerce(t,n){var s,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+D_(t),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class z3{match(t){return l_(t)}coerce(t,n){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class O3{match(t){return Ad(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ag(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var s,l=this.getUnhandledRejectionReason(t);return l_(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}:n.apply(l)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var zd="$message",Od="$timestamp",B3=new Set([zd,Od]),Ep={enabled:!0,max_bytes:32768};function Bd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Ep.enabled,max_bytes:U3(e.max_bytes,Ep.max_bytes)}:ye({},Ep)}class P3{constructor(t){this.bt=[],this._t=0,this.Se=Bd(t)}setConfig(t){this.Se=Bd(t),this.wt()}add(t){var n=(function(l){var c=(function(g){var v=new WeakSet;try{return JSON.stringify(g,((y,b)=>{if(typeof b=="bigint")return b.toString();if(typeof b!="function"&&typeof b!="symbol"){if(b instanceof Date)return b.toISOString();if(b instanceof Error)return{name:b.name,message:b.message,stack:b.stack};if(b&&typeof b=="object"){if(v.has(b))return"[Circular]";v.add(b)}return b}}))}catch{return}})(l);if(c)try{var u=JSON.parse(c);if(!$t(u))return;var f=u,h=f[zd],p=f[Od];return!Bt(h)||h.trim().length===0||!Bt(p)&&!Fn(p)?void 0:{step:f,json:c}}catch{return}})(t);if(n){var s=(function(l){if(typeof TextEncoder<"u")return new TextEncoder().encode(l).length;for(var c=encodeURIComponent(l),u=0,f=0;c.length>f;f++)c[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);s>this.Se.max_bytes||(this.bt.push({step:n.step,bytes:s}),this._t+=s,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function U3(e,t){if(!Fn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var z_=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,s={k(l){if(re&&(Zt.DEBUG||De.POSTHOG_DEBUG||n)&&!Se(re.console)&&re.console){for(var c=("__rrweb_original__"in re.console[l])?re.console[l].__rrweb_original__:re.console[l],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},debug(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];s.k("debug",...c)},info(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];s.k("log",...c)},warn(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];s.k("warn",...c)},error(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];s.k("error",...c)},critical(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(l){s.error("You must initialize PostHog before calling "+l)},createLogger:(l,c)=>z_(e+" "+l,c)};return s},ke=z_("[PostHog.js]"),Gt=ke.createLogger,$3=Gt("[ExternalScriptsLoader]"),Tp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return $3.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var s=Ne==null?void 0:Ne.querySelectorAll("script");if(s){for(var l,c=function(){if(s[u].src===t){var h=s[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;s.length>u;u++)if(l=c())return l.v}var f=()=>{if(!Ne)return n("document not found");var h=Ne.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),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")Ne.head.appendChild(h);else{var p,g=Ne.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ne.body.appendChild(h)}};Ne!=null&&Ne.body?f():Ne==null||Ne.addEventListener("DOMContentLoaded",f)};De.__PosthogExtensions__=De.__PosthogExtensions__||{},De.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var s;if(e.config.strict_script_versioning)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;l=l+"&t="+Math.floor(Date.now()/c)*c}s=e.requestRouter.endpointFor("assets",l)}Tp(e,s,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Tp(e,u,n)}},De.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);Tp(e,s,n)};var O_="$people_distinct_id",Pd="$device_id",Wo="__alias",Ko="__timers",Bm="$autocapture_disabled_server_side",Pm="$heatmaps_enabled_server_side",Um="$exception_capture_enabled_server_side",$m="$error_tracking_suppression_rules",Fm="$error_tracking_capture_extension_exceptions",Hm="$web_vitals_enabled_server_side",zg="$dead_clicks_enabled_server_side",Og="$product_tours_enabled_server_side",Im="$web_vitals_allowed_metrics",pa="$session_recording_remote_config",B_="$replay_sample_rate",P_="$replay_override_sampling",U_="$replay_override_linked_flag",$_="$replay_override_url_trigger",F_="$replay_override_event_trigger",yl="$sesid",Bg="$session_is_sampled",ha="$enabled_feature_flags",yd="$active_feature_flags",Zo="$early_access_features",qm="$feature_flag_details",_d="$feature_flag_payloads",Vm="$feature_flag_request_id",Os="$override_feature_flags",gl="$override_feature_flag_payloads",ca="$stored_person_properties",ua="$stored_group_properties",Gm="$surveys",Pg="$surveys_loaded_at",Ym="$surveys_activated",Jo="ph_product_tours",ic="$flag_call_reported",Qm="$flag_call_reported_session_id",Xm="$feature_flag_errors",vc="$feature_flag_evaluated_at",qr="$user_state",Wm="$client_session_props",Km="$capture_rate_limit",Zm="$initial_campaign_params",Jm="$initial_referrer_info",Ud="$initial_person_info",$d="$epp",H_="__POSTHOG_TOOLBAR__",nd="$posthog_cookieless",I_="$sdk_debug_extensions_init_method",q_="$sdk_debug_extensions_init_time_ms",V_="$sdk_debug_recording_script_not_loaded",eg="PostHog loadExternalDependency extension not found.",da="on_reject",$s="always",ol="anonymous",cl="identified",tg="identified_only",Fd="visibilitychange",Hd="beforeunload",xl="$pageview",Ap="$pageleave",Mp="$identify",Pb="$groupidentify";function rd(e,t){nt(e)&&e.forEach(t)}function At(e,t){if(!rt(e))if(nt(e))e.forEach(t);else if(ZN(e))e.forEach(((s,l)=>t(s,l)));else for(var n in e)a_.call(e,n)&&t(e[n],n)}var Ot=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;t>s;s++)n[s-1]=arguments[s];for(var l of n)for(var c in l)l[c]!==void 0&&(e[c]=l[c]);return e};function wd(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var Ub=function(e){try{return e()}catch{return}},F3=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;t>s;s++)n[s]=arguments[s];return e.apply(this,n)}catch(l){ke.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ke.critical(l)}}},Ug=function(e){var t={};return At(e,(function(n,s){(Bt(n)&&n.length>0||Fn(n))&&(t[s]=n)})),t},H3=["herokuapp.com","vercel.app","netlify.app"];function I3(e){var t=e==null?void 0:e.hostname;if(!Bt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of H3)if(n===s)return!1;return!0}function Xt(e,t,n,s){var{capture:l=!1,passive:c=!0}=s??{};e==null||e.addEventListener(t,n,{capture:l,passive:c})}function G_(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Fn(e)&&isFinite(e)&&Math.floor(e)===e});class Id{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(l)||0>t||0>n||0>s||0>l||t>0xffffffffffff||n>4095||s>1073741823||l>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|s>>>24,c[9]=s>>>16,c[10]=s>>>8,c[11]=s,c[12]=l>>>24,c[13]=l>>>16,c[14]=l>>>8,c[15]=l,new Id(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Id(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}}class q3{constructor(){this.S=0,this.C=0,this.I=new V3}generate(){var t=this.generateOrAbort();if(Se(t)){this.S=0;var n=this.generateOrAbort();if(Se(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Id.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var $b,Y_=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};re&&!Se(re.crypto)&&crypto.getRandomValues&&(Y_=e=>crypto.getRandomValues(e));class V3{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Y_(this.R),this.O=0),this.R[this.O++]}}var Us=()=>G3().toString(),G3=()=>($b||($b=new q3)).generate(),zo="",Y3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ls={N:()=>!!Ne,D(e){ke.error("cookieStore error: "+e)},A(e){if(Ne){try{for(var t=e+"=",n=Ne.cookie.split(";").filter((c=>c.length)),s=0;n.length>s;s++){for(var l=n[s];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(ls.A(e))||{}}catch{}return t},q(e,t,n,s,l){if(!Ne)return!1;try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,j){if(j===void 0&&(j=Ne),zo)return zo;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var E=_.split("."),k=Math.min(E.length,8),A="dmn_chk_"+Us();!zo&&k--;){var C=E.slice(k).join("."),D=A+"=1;domain=."+C+";path=/";j.cookie=D+";max-age=3",j.cookie.includes(A)&&(j.cookie=D+";max-age=0",zo=C)}return zo})(g);if(!y){var b=(_=>{var j=_.match(Y3);return j?j[0]:""})(g);b!==y&&ke.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ne.location.hostname,s);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}l&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&ke.warn("cookieStore warning: large cookie, len="+p.length),Ne.cookie=p,!0}catch{return!1}},P(e,t){if(Ne!=null&&Ne.cookie)try{ls.q(e,"",-1,t)}catch{return}}},Rp=null,Tt={N(){if(!$n(Rp))return Rp;var e=!0;if(Se(re))e=!1;else try{var t="__mplssupport__";Tt.q(t,"xyz"),Tt.A(t)!=='"xyz"'&&(e=!1),Tt.P(t)}catch{e=!1}return e||ke.error("localStorage unsupported; falling back to cookie store"),Rp=e,e},D(e){ke.error("localStorage error: "+e)},A(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){Tt.D(t)}return null},F(e){try{return JSON.parse(Tt.A(e))||{}}catch{}return null},q(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Tt.D(n)}return!1},P(e){try{re==null||re.localStorage.removeItem(e)}catch(t){Tt.D(t)}}},Q3=[Pd,"distinct_id",yl,Bg,$d,Ud,qr],sd={},X3={N:()=>!0,D(e){ke.error("memoryStorage error: "+e)},A:e=>sd[e]||null,F:e=>sd[e]||null,q:(e,t)=>(sd[e]=t,!0),P(e){delete sd[e]}},na=null,Cn={N(){if(!$n(na))return na;if(na=!0,Se(re))na=!1;else try{var e="__support__";Cn.q(e,"xyz"),Cn.A(e)!=='"xyz"'&&(na=!1),Cn.P(e)}catch{na=!1}return na},D(e){ke.error("sessionStorage error: ",e)},A(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){Cn.D(t)}return null},F(e){try{return JSON.parse(Cn.A(e))||null}catch{}return null},q(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Cn.D(n)}return!1},P(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){Cn.D(t)}}};class W3{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===$s||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===da}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.P(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:s}=this._instance.config;return s||(n?n+t:"__ph_opt_in_out_"+t)}get St(){var t=this.Ct.A(this.It);return kp(t)?1:Ie(n3,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,n=t==="localStorage"?Tt:ls;if(!this.Tt||this.Tt!==n){this.Tt=n;var s=t==="localStorage"?ls:Tt;s.A(this.It)&&(this.Tt.A(this.It)||this.optInOut(kp(s.A(this.It))),s.P(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[dr==null?void 0:dr.doNotTrack,dr==null?void 0:dr.msDoNotTrack,De.doNotTrack].some((t=>kp(t)))}}var K3=1,Z3=3,J3=11;function Fb(e){return e instanceof Element&&(e.id===H_||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ei(e){return!!e&&e.nodeType===K3}function fr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Q_(e){return!!e&&e.nodeType===Z3}function X_(e){return!!e&&e.nodeType===J3&&Ei(e.host)}function $g(e){return e?rf(e).split(/\s+/):[]}function Hb(e){var t=re==null?void 0:re.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function qd(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 $g(t)}function W_(e){return rt(e)?null:rf(e).split(/(\s+)/).filter((t=>ac(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function bc(e){var t="";return rg(e)&&!ew(e)&&e.childNodes&&e.childNodes.length&&At(e.childNodes,(function(n){var s;Q_(n)&&n.textContent&&(t+=(s=W_(n.textContent))!==null&&s!==void 0?s:"")})),rf(t)}function Lp(e){return Se(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Fg=["a","button","form","input","select","textarea","label"];function ng(e,t){if(Se(t))return!0;var n,s=function(c){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}})(c,u))))return{v:!0}};for(var l of e)if(n=s(l))return n.v;return!1}function K_(e){var t=e.parentNode;return!(!t||!Ei(t))&&t}var eC=[".ph-no-autocapture","[data-ph-no-autocapture]"],Z_=["next","previous","prev",">","<"],tC=[...Z_,"+","-","−","–"],Ib=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,qb=[".ph-no-rageclick",".ph-no-capture"],nC=["","text","search","email","password","url","tel","number"];function Vb(e,t){if(!re||Hg(e))return!1;var n,s,l,c,u;if(cs(t)?(n=!!t&&qb,s=void 0,l=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:qb,s=t==null?void 0:t.content_ignorelist,l=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||l&&(function(h){return!(!h||!Ei(h))&&(!!fr(h,"textarea")||(fr(h,"input")?Ie(nC,(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{targetElementList:f}=J_(e,!1);return!(function(h,p){if(h===!1||Se(h))return!1;var g;if(h===!0)g=Z_;else{if(!nt(h))return!1;if(h.length>10)return ke.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((v=>v.toLowerCase()))}return p.some((v=>{var{safeText:y,ariaLabel:b}=v;return g.some((_=>Ib(y,_)||Ib(b,_)))}))})(s,f.map((h=>{var p;return{safeText:bc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!ng(f,n)}var Hg=e=>!e||fr(e,"html")||!Ei(e),J_=(e,t)=>{if(!re||Hg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,s=[e],l=e;l.parentNode&&!fr(l,"body");)if(X_(l.parentNode))s.push(l.parentNode.host),l=l.parentNode.host;else{var c=K_(l);if(!c)break;if(t||Fg.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=re.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}s.push(c),l=c}return{parentIsUsefulElement:n,targetElementList:s}};function rg(e){for(var t=e;t.parentNode&&!fr(t,"body");t=t.parentNode){var n=qd(t);if(Ie(n,"ph-sensitive")||Ie(n,"ph-no-capture"))return!1}if(Ie(qd(e),"ph-include"))return!0;var s=e.type||"";if(Bt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var l=e.name||e.id||"";return!Bt(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function ew(e){return!!(fr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fr(e,"select")||fr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var tw="(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})",rC=new RegExp("^(?:"+tw+")$"),sC=new RegExp(tw),nw="\\d{3}-?\\d{2}-?\\d{4}",iC=new RegExp("^("+nw+")$"),aC=new RegExp("("+nw+")");function ac(e,t){return t===void 0&&(t=!0),!(rt(e)||Bt(e)&&(e=rf(e),(t?rC:sC).test((e||"").replace(/[- ]/g,""))||(t?iC:aC).test(e)))}function Gb(e){var t=bc(e);return ac(t=(t+" "+rw(e)).trim())?t:""}function rw(e){var t="";return e&&e.childNodes&&e.childNodes.length&&At(e.childNodes,(function(n){var s;if(n&&((s=n.tagName)==null?void 0:s.toLowerCase())==="span")try{var l=bc(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+rw(n)).trim())}catch(c){ke.error("[AutoCapture]",c)}})),t}function Yb(e){return e.replace(/"|\\"/g,'\\"')}function lC(e){var t=e.attr__class;return t?nt(t)?t:$g(t):void 0}var id=Gt("[Dead Clicks]"),oC=()=>!0,cC=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(zg)),s=e.instance.config.capture_dead_clicks;return cs(s)?s:!!$t(s)||n};class Qb{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[zg]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var n,s;(n=De.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(s=De.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?id.error("failed to load script",l):t()}))}Pt(){var t;if(Ne){if(!this.Et&&(t=De.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=$t(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.Et=De.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Et.start(Ne),id.info("starting...")}}else id.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,id.info("stopping..."))}}var Dp=Gt("[SegmentIntegration]"),sw="posthog-js";function iw(e,t){var{organization:n,projectId:s,prefix:l,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,j=((h=f.exception)==null?void 0:h.values)||[],E=j.map((A=>ye({},A,{stacktrace:A.stacktrace?ye({},A.stacktrace,{type:"raw",frames:(A.stacktrace.frames||[]).map((C=>ye({},C,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((p=j[0])==null?void 0:p.value)||f.message,$exception_type:(g=j[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:E,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=j[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=j[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&s&&(k.$sentry_url=(l||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(k)),f}}class uC{constructor(t,n,s,l,c,u){this.name=sw,this.setupOnce=function(f){f(iw(t,{organization:n,projectId:s,prefix:l,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class Xb{constructor(t){this.Rt=(n,s,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength||l.crossTabAdoption)&&(ke.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.Rt)}destroy(){var t;(t=this.Ft)==null||t.call(this),this.Ft=void 0}doPageView(t,n){var s,l=this.At(t,n);return this.Ot={pathname:(s=re==null?void 0:re.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}doPageLeave(t){var n;return this.At(t,(n=this.Ot)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Ot)==null?void 0:t.pageViewId}}At(t,n){var s=this.Ot;if(!s)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:s.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Se(u)||Se(f)||Se(h)||Se(p)||Se(g)||Se(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?os(f/u,0,1,ke):1,b=u>1?os(h/u,0,1,ke):1,_=p>1?os(g/p,0,1,ke):1,j=p>1?os(v/p,0,1,ke):1;l=Ot(l,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:j})}}return s.pathname&&(l.$prev_pageview_pathname=s.pathname),s.timestamp&&(l.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),l}}var ad=["flags","surveys"],dC={[O_]:{exposure:"hidden"},[Wo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ko]:{exposure:"hidden"},[Bm]:{exposure:"event"},[Pm]:{exposure:"hidden"},[Um]:{exposure:"event"},[$m]:{exposure:"hidden"},[Fm]:{exposure:"event"},[Hm]:{exposure:"event"},[zg]:{exposure:"event"},[Og]:{exposure:"hidden"},[Im]:{exposure:"event"},[pa]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[yl]:{exposure:"hidden"},[Bg]:{exposure:"event"},[B_]:{exposure:"event",shouldSkipFromEventProperties:e=>$n(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"},[ha]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!$t(e))return{};for(var t={},n=Object.keys(e),s=0;n.length>s;s++)t["$feature/"+n[s]]=e[n[s]];return t}},[yd]:{exposure:"event",storageGroup:"flags"},[Zo]:{exposure:"hidden"},[qm]:{exposure:"hidden",storageGroup:"flags"},[_d]:{exposure:"event",storageGroup:"flags"},[Vm]:{exposure:"event",storageGroup:"flags",volatile:!0},[Os]:{exposure:"event"},[gl]:{exposure:"hidden"},[ca]:{exposure:"hidden"},[ua]:{exposure:"hidden"},[Gm]:{exposure:"hidden",storageGroup:"surveys"},[Pg]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ym]:{exposure:"event"},[Jo]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[ic]:{exposure:"hidden"},[Qm]:{exposure:"hidden"},[Xm]:{exposure:"hidden"},[vc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[qr]:{exposure:"hidden"},[Wm]:{exposure:"hidden"},[Km]:{exposure:"hidden"},[Zm]:{exposure:"hidden"},[Jm]:{exposure:"hidden"},[Ud]:{exposure:"hidden"},[$d]:{exposure:"hidden"},[P_]:{exposure:"event"},[U_]:{exposure:"event"},[$_]:{exposure:"event"},[F_]:{exposure:"event"},[I_]:{exposure:"event"},[q_]:{exposure:"event"},[V_]:{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"}},fC=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ra=e=>{var t=dC[e];if(t)return t;for(var[n,s]of fC)if(e.indexOf(n)===0)return s},Vd=e=>{var t=Ne==null?void 0:Ne.createElement("a");return Se(t)?null:(t.href=e,t)},yc=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;s.length>l;l++){var c=s[l].split("=");if(c[0]===t){n=c;break}}if(!nt(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{ke.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},_c=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),l=s[1],c=(s[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");nt(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),l!=null&&(y+="#"+l),y},Gd=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ld="https?://(.*)",El=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],hC=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...El],wc="<masked>",pC=["li_fat_id"];function aw(e,t,n){if(!Ne)return{};var s,l=t?[...El,...n||[]]:[],c=lw(_c(Ne.URL,l,wc),e),u=(s={},At(pC,(function(f){var h=ls.A(f);s[f]=h||null})),s);return Ot(u,c)}function lw(e,t){var n=hC.concat(t||[]),s={};return At(n,(function(l){var c=yc(e,l);s[l]=c||null})),s}function ow(e){var t=(function(c){return c?c.search(ld+"google.([^/?]*)")===0?"google":c.search(ld+"bing.com")===0?"bing":c.search(ld+"yahoo.com")===0?"yahoo":c.search(ld+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",s={};if(!$n(t)){s.$search_engine=t;var l=Ne?yc(Ne.referrer,n):"";l.length&&(s.ph_keyword=l)}return s}function Wb(){return navigator.language||navigator.userLanguage}var Yd="$direct";function cw(){return(Ne==null?void 0:Ne.referrer)||Yd}function uw(e,t){var n=e?[...El,...t||[]]:[],s=Nn==null?void 0:Nn.href.substring(0,1e3);return{r:cw().substring(0,1e3),u:s?_c(s,n,wc):void 0}}function dw(e){var t,{r:n,u:s}=e,l={$referrer:n,$referring_domain:n==null?void 0:n==Yd?Yd:(t=Vd(n))==null?void 0:t.host};if(s){l.$current_url=s;var c=Vd(s);l.$host=c==null?void 0:c.host,l.$pathname=c==null?void 0:c.pathname;var u=lw(s);Ot(l,u)}if(n){var f=ow(n);Ot(l,f)}return l}function fw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function mC(){try{return new Date().getTimezoneOffset()}catch{return}}var gC={flags:vc,surveys:Pg},xC=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ul="main";class zp{constructor(t,n,s){if(s===void 0&&(s=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=t,this.qt=s,this.props={},this.jt=!1,this.Bt=(c=>{var u="";return c.token&&(u=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+u+"_posthog"})(t),this.Ct=this.Ht(t),this.Nt=this.Ut(t),this.load(),t.debug&&ke.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save(),re){var l=()=>this.flush();Xt(re,"beforeunload",l,{capture:!1}),Xt(re,"pagehide",l,{capture:!1})}}zt(){var t,n=(t=this.Se)==null?void 0:t.persistence_save_debounce_ms;return Fn(n)&&n>0?n:0}isDisabled(){return!!this.Vt}Ht(t){xC.indexOf(t.persistence.toLowerCase())===-1&&(ke.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,s=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...Q3,...u];return ye({},Tt,{F(p){try{var g={};try{g=ls.F(p)||{}}catch{}var v,y=JSON.parse(Tt.A(p)||"{}");if(f){var b={};for(var _ in g){var j=g[_];$n(j)||j===""||(b[_]=j)}v=Ot(y,b)}else v=Ot(g,y);return Tt.q(p,v),v}catch{}return null},q(p,g,v,y,b,_){var j=Tt.q(p,g,void 0,void 0,_);try{var E={};h.forEach((k=>{g[k]&&(E[k]=g[k])})),Object.keys(E).length&&ls.q(p,E,v,y,b,_)}catch(k){Tt.D(k)}return j},P(p,g){try{re==null||re.localStorage.removeItem(p),ls.P(p,g)}catch(v){Tt.D(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&Tt.N()?(n=Tt,l=!0):c==="localstorage+cookie"&&s.N()?(n=s,l=!0):c==="sessionstorage"&&Cn.N()?n=Cn:c==="memory"?n=X3:c==="cookie"?n=ls:s.N()?(n=s,l=!0):n=ls,this.Dt=l,n}Wt(t){return this.Bt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var n=t??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var s=this.props[vc];return!s||typeof s!="number"||Date.now()-s>n}properties(){var t={};return At(this.props,((n,s)=>{var l=ra(s);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,s===ha?()=>this.Gt():()=>!1))return;l.transformToEventProperties&&Ot(t,l.transformToEventProperties(n))}else if(!l||l.exposure==="event"){if(l!=null&&l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,(()=>!1)))return;t[s]=n}})),t}load(){if(!this.Vt){var t=this.Ct.F(this.Bt);t&&(this.props=Ot({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of ad){var n=Tt.F(this.Wt(t));if(n&&!ji(n)){var s=this.Qt(t);s.persisted=!0,this.Jt(t)||(s.fingerprint=this.Yt(n,t)),this.Kt(t,n)||Ot(this.props,n)}}}Jt(t){return Object.keys(this.props).some((n=>{var s;return((s=ra(n))==null?void 0:s.storageGroup)===t}))}Kt(t,n){var s=gC[t];if(!s)return!1;var l=n[s],c=this.props[s];return Fn(l)&&Fn(c)&&c>l}refreshKey(t){var n;if(!this.Vt){var s=this.Nt?(n=ra(t))==null?void 0:n.storageGroup:void 0,l=s?Tt.F(this.Wt(s)):this.Ct.F(this.Bt);if(l&&t in l)this.Xt(t,l[t]);else{if(s){var c=this.Ct.F(this.Bt);if(c&&t in c)return void this.Xt(t,c[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?Se(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){Se(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.Bt,this.props,ul))}ir(){var{main:t,groups:n}=this.sr();for(var s of(this.nr(this.Ct,this.Bt,t,ul),ad)){var l,c=n[s];(!ji(c)||(l=this.$t[s])!=null&&l.persisted)&&this.nr(Tt,this.Wt(s),c,s)}}sr(){var t={},n={};for(var s of ad)n[s]={};return At(this.props,((l,c)=>{var u,f=(u=ra(c))==null?void 0:u.storageGroup;f?n[f][c]=l:t[c]=l})),{main:t,groups:n}}Yt(t,n){if(n===ul)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var s={};return At(t,((l,c)=>{var u;s[c]=(u=ra(c))!=null&&u.volatile?"__volatile__":l})),JSON.stringify(s)}nr(t,n,s,l){var c=this.Qt(l);if(l===ul||c.dirty||Se(c.fingerprint)){var u;try{if((u=this.Yt(s,l))===c.fingerprint)return void(c.dirty=!1)}catch{u=void 0}t.q(n,s,this.ar,this.lr,this.ur,this.Se.debug)?(c.dirty=!1,l!==ul&&(c.persisted=!0),Se(u)||(c.fingerprint=u)):this.Se.debug&&ke.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var{keepGroupEntries:n=!1}=t===void 0?{}:t;if(Se(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.P(this.Bt,!1),this.Ct.P(this.Bt,!0),!n&&this.qt)for(var s of ad)Tt.P(this.Wt(s));n?delete this.$t[ul]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,n,s){if($t(t)){Se(n)&&(n="None"),this.ar=Se(s)?this.hr:s;var l=!1;if(At(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Xt(u,c),l=!0)})),l)return this.save(),!0}return!1}register(t,n){if($t(t)){this.ar=Se(n)?this.hr:n;var s=!1;if(At(t,((l,c)=>{t.hasOwnProperty(c)&&this.props[c]!==l&&(this.Xt(c,l),s=!0)})),s)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.jt){var t=aw(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);ji(Ug(t))||this.register(t),this.jt=!0}}update_search_keyword(){var t;this.register((t=Ne==null?void 0:Ne.referrer)?ow(t):{})}update_referrer_info(){var t;this.register_once({$referrer:cw(),$referring_domain:Ne!=null&&Ne.referrer&&((t=Vd(Ne.referrer))==null?void 0:t.host)||Yd},void 0)}set_initial_person_info(){this.props[Zm]||this.props[Jm]||this.register_once({[Ud]:uw(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};At([Jm,Zm],(u=>{var f=this.props[u];f&&At(f,(function(h,p){t["$initial_"+Am(p)]=h}))}));var n,s,l=this.props[Ud];if(l){var c=(n=dw(l),s={},At(n,(function(u,f){s["$initial_"+Am(f)]=u})),s);Ot(t,c)}return t}safe_merge(t){return At(this.props,(function(n,s){s in t||(t[s]=n)})),t}update_config(t,n,s){this.hr=this.ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!s),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var l=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),v=[...p].sort();return g.every(((y,b)=>y===v[b]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=l?this.Ht(t):this.Ct,u=this.Ut(t);if(l||u!==this.Nt){var f=this.props;this.clear(),this.Ct=c,this.Nt=u,this.props=f,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var s=this.props[Ko]||{};s[t]=n,this.Xt(Ko,s),this.save()}remove_event_timer(t){var n=this.props[Ko]||{},s=n[t];return Se(s)||(delete n[t],this.Xt(Ko,n),this.save()),s}get_property(t){return this.props[t]}set_property(t,n){this.Xt(t,n),this.save()}Xt(t,n){var s;this.props[t]=n,(s=ra(t))!=null&&s.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var n,s=(n=ra(t))==null?void 0:n.storageGroup;s&&(this.Qt(s).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var Oo={Activation:"events",Cancellation:"cancelEvents"},Op={Popover:"popover",API:"api",Widget:"widget"},vC={Always:"always"},Fs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Bp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},sg={Popover:"popover",Inline:"inline"},bC={SHOWN:"product tour shown"},Kb={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Zb=Gt("[RateLimiter]");class yC{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((l=>{Zb.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void Zb.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:s})}},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,s,l;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(s=this.instance.persistence)==null?void 0:s.get_property(Km))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(l=this.instance.persistence)==null||l.set_property(Km,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Bo=Gt("[RemoteConfig]");class hw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=De._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}cr(t){var n,s;(n=De.__PosthogExtensions__)!=null&&n.loadExternalDependency?(s=De.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return Bo.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void Bo.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return Bo.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((n=>{this.pr(n),this.gr()}));this.pr(t),this.gr()}))}catch(t){Bo.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&Ne&&Ne.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.yr=setInterval((()=>{this.refresh()}),n))}}pr(t){var n;t||Bo.error("Failed to fetch remote config from PostHog."),this._instance.pr(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var as={GZipJS:"gzip-js",Base64:"base64"},zr=Uint8Array,Zn=Uint16Array,Tl=Uint32Array,Ig=new zr([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]),qg=new zr([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]),Jb=new zr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pw=function(e,t){for(var n=new Zn(31),s=0;31>s;++s)n[s]=t+=1<<e[s-1];var l=new Tl(n[30]);for(s=1;30>s;++s)for(var c=n[s];n[s+1]>c;++c)l[c]=c-n[s]<<5|s;return[n,l]},mw=pw(Ig,2),ig=mw[1];mw[0][28]=258,ig[258]=28;for(var ey=pw(qg,0)[1],gw=new Zn(32768),Ft=0;32768>Ft;++Ft){var dl=(43690&Ft)>>>1|(21845&Ft)<<1;gw[Ft]=((65280&(dl=(61680&(dl=(52428&dl)>>>2|(13107&dl)<<2))>>>4|(3855&dl)<<4))>>>8|(255&dl)<<8)>>>1}var lc=function(e,t,n){for(var s=e.length,l=0,c=new Zn(t);s>l;++l)++c[e[l]-1];var u,f=new Zn(t);for(l=0;t>l;++l)f[l]=f[l-1]+c[l-1]<<1;for(u=new Zn(s),l=0;s>l;++l)u[l]=gw[f[e[l]-1]++]>>>15-e[l];return u},xa=new zr(288);for(Ft=0;144>Ft;++Ft)xa[Ft]=8;for(Ft=144;256>Ft;++Ft)xa[Ft]=9;for(Ft=256;280>Ft;++Ft)xa[Ft]=7;for(Ft=280;288>Ft;++Ft)xa[Ft]=8;var Qd=new zr(32);for(Ft=0;32>Ft;++Ft)Qd[Ft]=5;var _C=lc(xa,9),wC=lc(Qd,5),xw=function(e){return(e/8>>0)+(7&e&&1)},vw=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof Zn?Zn:e instanceof Tl?Tl:zr)(n-t);return s.set(e.subarray(t,n)),s},As=function(e,t,n){var s=t/8>>0;e[s]|=n<<=7&t,e[s+1]|=n>>>8},Po=function(e,t,n){var s=t/8>>0;e[s]|=n<<=7&t,e[s+1]|=n>>>8,e[s+2]|=n>>>16},Pp=function(e,t){for(var n=[],s=0;e.length>s;++s)e[s]&&n.push({s,f:e[s]});var l=n.length,c=n.slice();if(!l)return[new zr(0),0];if(l==1){var u=new zr(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,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=l-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(s=1;l>s;++s)c[s].s>y&&(y=c[s].s);var b=new Zn(y+1),_=ag(n[g-1],b,0);if(_>t){s=0;var j=0,E=_-t,k=1<<E;for(c.sort((function(O,L){return b[L.s]-b[O.s]||O.f-L.f}));l>s;++s){var A=c[s].s;if(t>=b[A])break;j+=k-(1<<_-b[A]),b[A]=t}for(j>>>=E;j>0;){var C=c[s].s;t>b[C]?j-=1<<t-b[C]++-1:++s}for(;s>=0&&j;--s){var D=c[s].s;b[D]==t&&(--b[D],++j)}_=t}return[new zr(b),_]},ag=function(e,t,n){return e.s==-1?Math.max(ag(e.l,t,n+1),ag(e.r,t,n+1)):t[e.s]=n},ty=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Zn(++t),s=0,l=e[0],c=1,u=function(h){n[s++]=h},f=1;t>=f;++f)if(e[f]==l&&f!=t)++c;else{if(!l&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(l),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(l);c=1,l=e[f]}return[n.subarray(0,s),t]},Uo=function(e,t){for(var n=0,s=0;t.length>s;++s)n+=e[s]*t[s];return n},lg=function(e,t,n){var s=n.length,l=xw(t+2);e[l]=255&s,e[l+1]=s>>>8,e[l+2]=255^e[l],e[l+3]=255^e[l+1];for(var c=0;s>c;++c)e[l+c+4]=n[c];return 8*(l+4+s)},ny=function(e,t,n,s,l,c,u,f,h,p,g){As(t,g++,n),++l[256];for(var v=Pp(l,15),y=v[0],b=v[1],_=Pp(c,15),j=_[0],E=_[1],k=ty(y),A=k[0],C=k[1],D=ty(j),O=D[0],L=D[1],I=new Zn(19),$=0;A.length>$;++$)I[31&A[$]]++;for($=0;O.length>$;++$)I[31&O[$]]++;for(var G=Pp(I,7),B=G[0],F=G[1],T=19;T>4&&!B[Jb[T-1]];--T);var le,W,Y,U,z=p+5<<3,se=Uo(l,xa)+Uo(c,Qd)+u,me=Uo(l,y)+Uo(c,j)+u+14+3*T+Uo(I,B)+(2*I[16]+3*I[17]+7*I[18]);if(se>=z&&me>=z)return lg(t,g,e.subarray(h,h+p));if(As(t,g,1+(se>me)),g+=2,se>me){le=lc(y,b),W=y,Y=lc(j,E),U=j;var R=lc(B,F);for(As(t,g,C-257),As(t,g+5,L-1),As(t,g+10,T-4),g+=14,$=0;T>$;++$)As(t,g+3*$,B[Jb[$]]);g+=3*T;for(var P=[A,O],Z=0;2>Z;++Z){var M=P[Z];for($=0;M.length>$;++$)As(t,g,R[he=31&M[$]]),g+=B[he],he>15&&(As(t,g,M[$]>>>5&127),g+=M[$]>>>12)}}else le=_C,W=xa,Y=wC,U=Qd;for($=0;f>$;++$)if(s[$]>255){var he;Po(t,g,le[257+(he=s[$]>>>18&31)]),g+=W[he+257],he>7&&(As(t,g,s[$]>>>23&31),g+=Ig[he]);var _e=31&s[$];Po(t,g,Y[_e]),g+=U[_e],_e>3&&(Po(t,g,s[$]>>>5&8191),g+=qg[_e])}else Po(t,g,le[s[$]]),g+=W[s[$]];return Po(t,g,le[256]),g+W[256]},SC=new Tl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),kC=(function(){for(var e=new Tl(256),t=0;256>t;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Up=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function jC(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=kC[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),s=e.length;n.p(e);var l,c,u,f,h,p=(f=10+((l=t).filename&&l.filename.length+1||0),h=8,(function(v,y,b,_,j,E){var k=v.length,A=new zr(_+k+5*(1+Math.floor(k/7e3))+j),C=A.subarray(_,A.length-j),D=0;if(!y||8>k)for(var O=0;k>=O;O+=65535){var L=O+65535;k>L?D=lg(C,D,v.subarray(O,L)):(C[O]=!0,D=lg(C,D,v.subarray(O,k)))}else{for(var I=SC[y-1],$=I>>>13,G=8191&I,B=(1<<b)-1,F=new Zn(32768),T=new Zn(B+1),le=Math.ceil(b/3),W=2*le,Y=function(yt){return(v[yt]^v[yt+1]<<le^v[yt+2]<<W)&B},U=new Tl(25e3),z=new Zn(288),se=new Zn(32),me=0,R=0,P=(O=0,0),Z=0,M=0;k>O;++O){var he=Y(O),_e=32767&O,Ce=T[he];if(F[_e]=Ce,T[he]=_e,O>=Z){var Re=k-O;if((me>7e3||P>24576)&&Re>423){D=ny(v,C,0,U,z,se,R,P,M,O-M,D),P=me=R=0,M=O;for(var Le=0;286>Le;++Le)z[Le]=0;for(Le=0;30>Le;++Le)se[Le]=0}var Be=2,Je=0,xe=G,Pe=_e-Ce&32767;if(Re>2&&he==Y(O-Pe))for(var ft=Math.min($,Re)-1,Rt=Math.min(32767,O),bt=Math.min(258,Re);Rt>=Pe&&--xe&&_e!=Ce;){if(v[O+Be]==v[O+Be-Pe]){for(var Lt=0;bt>Lt&&v[O+Lt]==v[O+Lt-Pe];++Lt);if(Lt>Be){if(Be=Lt,Je=Pe,Lt>ft)break;var un=Math.min(Pe,Lt-2),st=0;for(Le=0;un>Le;++Le){var dn=O-Pe+Le+32768&32767,bn=dn-F[dn]+32768&32767;bn>st&&(st=bn,Ce=dn)}}}Pe+=(_e=Ce)-(Ce=F[_e])+32768&32767}if(Je){U[P++]=268435456|ig[Be]<<18|ey[Je];var je=31&ig[Be],ze=31&ey[Je];R+=Ig[je]+qg[ze],++z[257+je],++se[ze],Z=O+Be,++me}else U[P++]=v[O],++z[v[O]]}}D=ny(v,C,!0,U,z,se,R,P,M,O-M,D)}return vw(A,0,_+xw(D)+j)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&Up(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),Up(p,g-8,n.d()),Up(p,g-4,s),p}var NC=!!Cm||!!Nm,bw="text/plain",Sd=!1,CC=(e,t)=>{var[n,s]=e.split("#"),[l,c]=n.split("?");if(!c)return e;var u=c.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return l+(u?"?"+u:"")+(s?"#"+s:"")},yw=function(e,t,n){var s;n===void 0&&(n=!0);var[l,c]=e.split("?"),u=ye({},t),f=(s=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&s!==void 0?s:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return At(p,(function(_,j){Se(_)||Se(j)||j==="undefined"||(v=encodeURIComponent((E=>E instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(j),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),l+"?"+f.join("&")},_l=(e,t)=>JSON.stringify(e,((n,s)=>typeof s=="bigint"?s.toString():s),t),ry=e=>{if(e.xt)return e.xt;var{data:t,compression:n}=e;if(t){if(n===as.GZipJS){var s=jC((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new zr(f.length+(f.length>>>1)),v=0,y=function(E){g[v++]=E},b=0;p>b;++b){if(v+5>g.length){var _=new zr(v+8+(p-b<<1));_.set(g),g=_}var j=f.charCodeAt(b);128>j?y(j):2048>j?(y(192|j>>>6),y(128|63&j)):j>55295&&57344>j?(y(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++b))>>>18),y(128|j>>>12&63),y(128|j>>>6&63),y(128|63&j)):(y(224|j>>>12),y(128|j>>>6&63),y(128|63&j))}return vw(g,0,v)})(_l(t)),{mtime:0});return{contentType:bw,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(n===as.Base64){var l=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(_l(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:_l(f)))(l);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=_l(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},$p=e=>{var t,n,s,l=ry(e);return!l||(n=e.compression,s=yc(e.url,"compression"),n!==Tb.GZipJS&&s!==Tb.GZipJS&&s!=="gzip")||((t=l.body)instanceof ArrayBuffer?Em(new Uint8Array(t)):ArrayBuffer.isView(t)&&Em(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:l}:(Sd=!0,{url:CC(e.url,"compression"),encodedBody:ry(ye({},e,{compression:void 0,xt:void 0}))})},EC=(function(){var e=vn((function*(t){var n=_l(t.data),s=yield(function(c,u,f){return Tm.apply(this,arguments)})(n,Zt.DEBUG,{rethrow:!0});if(!s)return t;var l=yield s.arrayBuffer();return ye({},t,{xt:{contentType:bw,body:l,estimatedSize:l.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),sy=(e,t)=>yw(e,{_:new Date().getTime().toString(),ver:Zt.JS_SDK_VERSION,compression:t}),kd=[];Nm&&kd.push({transport:"fetch",method(e){var t,{url:n,encodedBody:s}=$p(e),{contentType:l,body:c,estimatedSize:u}=s??{},f=new Headers;At(e.headers,(function(v,y){f.append(y,v)})),l&&f.append("Content-Type",l);var h=null,p=null;if(Nb){var g=new Nb;h={signal:g.signal,timeout:setTimeout((()=>{var v,y;v=e.timeout,(y=new Error("PostHog request timed out"+(v?" after "+v+"ms":""))).name="AbortError",g.abort(p=y)}),e.timeout)}}Nm(n,ye({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&52428.8>(u||0),body:c,signal:(t=h)==null?void 0:t.signal},e.fetchOptions)).then((v=>v.text().then((y=>{var b={statusCode:v.status,text:y};if(v.status===200)try{b.json=JSON.parse(y)}catch(_){ke.error(_)}e.callback==null||e.callback(b)})))).catch((v=>{v===p?ke.warn(v):ke.error(v),e.callback==null||e.callback({statusCode:0,error:v})})).finally((()=>h?clearTimeout(h.timeout):null))}}),Cm&&kd.push({transport:"XHR",method(e){var t=new Cm,{url:n,encodedBody:s}=$p(e);t.open(e.method||"GET",n,!0);var{contentType:l,body:c}=s??{};At(e.headers,(function(u,f){t.setRequestHeader(f,u)})),l&&t.setRequestHeader("Content-Type",l),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var u={statusCode:t.status,text:t.responseText};if(t.status===200)try{u.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(u)}},t.send(c)}}),dr!=null&&dr.sendBeacon&&kd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=$p(e),{contentType:s,body:l}=n??{};if(!l)return;var c=l instanceof Blob?l:new Blob([l],{type:s});dr.sendBeacon(t,c)}catch{}}});var og=3e3;class TC{constructor(t,n){this.br=!0,this._r=[],this.wr=os((n==null?void 0:n.flush_interval_ms)||og,250,5e3,ke.createLogger("flush interval"),og),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},n=Object.values(t);[...n.filter((s=>s.url.indexOf("/e")===0)),...n.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.kr(ye({},s,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var n=this.Tr(),s=function(){var c=n[l],u=new Date().getTime();c.data&&nt(c.data)&&At(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.kr(c)};for(var l in n)s()}}),this.wr))}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return At(this._r,(n=>{var s,l=n,c=(l?l.batchKey:null)||l.url;Se(t[c])&&(t[c]=ye({},l,{data:[]})),(s=t[c].data)==null||s.push(l.data)})),this._r=[],t}}var AC=["retriesPerformedSoFar"];class MC{constructor(t){this.Er=!1,this.Mr=3e3,this._r=[],this._instance=t,this._r=[],this.Pr=!0,!Se(re)&&"onLine"in re.navigator&&(this.Pr=re.navigator.onLine,this.Rr=()=>{this.Pr=!0,this.Or()},this.Lr=()=>{this.Pr=!1},Xt(re,"online",this.Rr),Xt(re,"offline",this.Lr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=r_(t,AC);zs(n)&&(s.url=yw(s.url,{retry_count:n})),this._instance._send_request(ye({},s,{callback:l=>{if(l.statusCode!==200&&(400>l.statusCode||l.statusCode>=500)){if((l.statusCode===0?3:10)>(n??0))return void this.st(ye({retriesPerformedSoFar:n},s));l.statusCode===0&&ke.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.")}s.callback==null||s.callback(l)}}))}st(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var s=(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),l=Date.now()+s;this._r.push({retryAt:l,requestOptions:t});var c="Enqueued failed request for retry in "+s;navigator.onLine||(c+=" (Browser is offline)"),ke.warn(c),this.Er||(this.Er=!0,this.Fr())}Fr(){if(this.Ar&&clearTimeout(this.Ar),this._r.length===0)return this.Er=!1,void(this.Ar=void 0);this.Ar=setTimeout((()=>{this.Pr&&this._r.length>0&&this.Or(),this.Fr()}),this.Mr)}Or(){var t=Date.now(),n=[],s=this._r.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this._r=n,s.length>0)for(var{requestOptions:l}of s)this.retriableRequest(l)}unload(){for(var{requestOptions:t}of(this.Ar&&(clearTimeout(this.Ar),this.Ar=void 0),this.Er=!1,Se(re)||(this.Rr&&(re.removeEventListener("online",this.Rr),this.Rr=void 0),this.Lr&&(re.removeEventListener("offline",this.Lr),this.Lr=void 0)),this._r))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){ke.error(n)}this._r=[]}}class RC{constructor(t){this.$r=()=>{var n,s,l,c;this.Dr||(this.Dr={});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.Dr.lastScrollY=Math.ceil(f),this.Dr.maxScrollY=Math.max(f,(n=this.Dr.maxScrollY)!==null&&n!==void 0?n:0),this.Dr.maxScrollHeight=Math.max(h,(s=this.Dr.maxScrollHeight)!==null&&s!==void 0?s:0),this.Dr.lastContentY=p,this.Dr.maxContentY=Math.max(p,(l=this.Dr.maxContentY)!==null&&l!==void 0?l:0),this.Dr.maxContentHeight=Math.max(g,(c=this.Dr.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get Nr(){return this._instance.config.scroll_root_selector}getContext(){return this.Dr}resetContext(){var t=this.Dr;return setTimeout(this.$r,0),t}startMeasuringScrollPosition(){Xt(re,"scroll",this.$r,{capture:!0}),Xt(re,"scrollend",this.$r,{capture:!0}),Xt(re,"resize",this.$r)}scrollElement(){if(!this.Nr)return re==null?void 0:re.document.documentElement;var t=nt(this.Nr)?this.Nr:[this.Nr];for(var n of t){var s=re==null?void 0:re.document.querySelector(n);if(s)return s}}qr(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.Nr){var s=this.scrollElement();return s&&s[n]||0}return re?t==="y"?re.scrollY||re.pageYOffset||re.document.documentElement.scrollTop||0:re.scrollX||re.pageXOffset||re.document.documentElement.scrollLeft||0:0}scrollY(){return this.qr("y")}scrollX(){return this.qr("x")}}var LC=e=>uw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class iy{constructor(t,n,s,l){this.jr=c=>{var u=this.Br();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Hr(this._instance)};this.Ur.register({[Wm]:f})}},this._instance=t,this.zr=n,this.Ur=s,this.Hr=l||LC,this.zr.onSessionId(this.jr)}Br(){return this.Ur.props[Wm]}getSetOnceProps(){var t,n=(t=this.Br())==null?void 0:t.props;return n?"r"in n?dw(n):{$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 At(Ug(this.getSetOnceProps()),((n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_"+Am(s)]=n})),t}}class Vg{constructor(){this.Vr={}}on(t,n){return this.Vr[t]||(this.Vr[t]=[]),this.Vr[t].push(n),()=>{this.Vr[t]=this.Vr[t].filter((s=>s!==n))}}emit(t,n){for(var s of this.Vr[t]||[])s(n);for(var l of this.Vr["*"]||[])l(t,n)}}var $o=Gt("[SessionId]");class ay{on(t,n){return this.Wr.on(t,n)}constructor(t,n,s){var l;if(this.Gr=null,this.Zr=[],this.Qr=void 0,this.Jr=!1,this.Wr=new Vg,this.Yr=(p,g)=>!(!zs(p)||!zs(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===$s)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.Ur=t.persistence,this.Kr=void 0,this.Xr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ei=n||Us,this.ti=s||Us;var c=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*os(this.Se.session_idle_timeout_seconds||1800,60,36e3,$o.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ri(),this.ii="ph_"+c+"_window_id",this.ni="ph_"+c+"_primary_window_exists",this.si()){var u=Cn.F(this.ii),f=Cn.F(this.ni);u&&!f?this.Kr=u:Cn.P(this.ii),Cn.q(this.ni,!0)}if((l=this.Se.bootstrap)!=null&&l.sessionID)try{var h=(p=>{var g=this.Se.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.oi(this.Se.bootstrap.sessionID,new Date().getTime(),h)}catch(p){$o.error("Invalid sessionID in bootstrap",p)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.Zr)&&(this.Zr=[]),this.Zr.push(t),this.Xr&&t(this.Xr,this.Kr),()=>{this.Zr=this.Zr.filter((n=>n!==t))}}si(){return this.Se.persistence!=="memory"&&!this.Ur.Vt&&Cn.N()}li(t){t!==this.Kr&&(this.Kr=t,this.si()&&Cn.q(this.ii,t))}ui(){return this.Kr?this.Kr:this.si()?Cn.F(this.ii):null}hi(t){var n=this.Gr;return!$n(n)&&!$n(t)&&5e3>Math.abs(t-n)}oi(t,n,s){var l=n!==this._sessionActivityTimestamp,c=!(t!==this.Xr||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this.Xr=t,c&&!l||c&&this.hi(n)||(this.Gr=n,this.Ur.register({[yl]:[n,t,s]}))}di(){var t,n=(t=this.Se)==null?void 0:t.persistence_save_debounce_ms;return zs(n)&&n>0}ci(){this.di()?this.Ur.refreshKey(yl):(this.Ur.flush(),this.Ur.load())}vi(){var t;if(!$n(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Gr){this.ci();var[,n,s]=this.fi();n===this.Xr&&s===this._sessionStartTimestamp&&(this.Gr=this._sessionActivityTimestamp,this.Ur.register({[yl]:[this._sessionActivityTimestamp,(t=this.Xr)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Ur.flush())}}pi(){var[t]=this.fi(),n=zs(t)?t:0,s=zs(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,s)}gi(t){return this.ci(),this.Yr(t,this.pi())}fi(){var t=this.Ur.props[yl];return nt(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Gr=null,clearTimeout(this.mi),this.mi=void 0,this.oi(null,null,null)}destroy(){this.Jr=!0,this.vi(),clearTimeout(this.mi),this.mi=void 0,this.Qr&&re&&(re.removeEventListener(Hd,this.Qr,{capture:!1}),this.Qr=void 0),this.Zr=[]}ai(){this.Qr=()=>{this.vi(),this.si()&&Cn.P(this.ni)},Xt(re,Hd,this.Qr,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Se.cookieless_mode===$s)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=n||new Date().getTime(),[,l,c]=this.fi(),u=this.pi(),f=this.ui(),h=zs(c)&&Math.abs(s-c)>864e5,p=!1,g=!1,v=!l,y=l,b=!v&&!t&&this.Yr(s,u);b&&((b=this.gi(s))||$o.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,c]=this.fi()),v||b||h?(l=this.ei(),f=this.ti(),$o.info("new session ID generated",{sessionId:l,windowId:f,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),c=s,p=!0):(f||(f=this.ti(),p=!0),(g=l!==y)&&($o.info("adopted cross-tab session id",{sessionId:l,windowId:f}),p=!0));var _=zs(u)&&t&&!h?u:s,j=zs(c)?c:new Date().getTime();this.li(f),this.oi(l,_,j),t||this.ri();var E={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:g};return p&&this.Zr.forEach((k=>k(l,f,E))),{sessionId:l,windowId:f,sessionStartTimestamp:j,changeReason:p?E:void 0,lastActivityTimestamp:u}}ri(){this.Jr||(clearTimeout(this.mi),this.mi=setTimeout((()=>{if(!this.Jr)if(this.gi(new Date().getTime())){var t=this.Xr;this.resetSessionId(),this.Wr.emit("forcedIdleReset",{idleSessionId:t})}else this.ri()}),1.1*this.sessionTimeoutMs))}}var _w=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Mb(n,t))return!0;try{var s=e==null?void 0:e.userAgentData;if(s!=null&&s.brands&&s.brands.some((l=>Mb(l==null?void 0:l.brand,t))))return!0}catch{}return!!e.webdriver},Xd=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 ly(e,t,n){return _l({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ww={exact:(e,t)=>t.some((n=>e.some((s=>n===s)))),is_not:(e,t)=>t.every((n=>e.every((s=>n!==s)))),regex:(e,t)=>t.some((n=>e.some((s=>Xd(n,s))))),not_regex:(e,t)=>t.every((n=>e.every((s=>!Xd(n,s))))),icontains:(e,t)=>t.map(od).some((n=>e.map(od).some((s=>n.includes(s))))),not_icontains:(e,t)=>t.map(od).every((n=>e.map(od).every((s=>!n.includes(s))))),gt:(e,t)=>t.some((n=>{var s=parseFloat(n);return!isNaN(s)&&e.some((l=>s>parseFloat(l)))})),lt:(e,t)=>t.some((n=>{var s=parseFloat(n);return!isNaN(s)&&e.some((l=>s<parseFloat(l)))}))},od=e=>e.toLowerCase();function Sw(e,t){return!e||Object.entries(e).every((n=>{var[s,l]=n,c=t==null?void 0:t[s];if(Se(c)||$n(c))return!1;var u=[String(c)],f=ww[l.operator];return!!f&&f(l.values,u)}))}var cg="custom",oy="i.posthog.com",DC=/^\/static\//;class zC{constructor(t){this.yi={},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("."+oy,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.yi[this.apiHost]||(this.yi[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":cg),this.yi[this.apiHost]}bi(t){if(DC.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 s=this.bi(n);if(s)return""+s+n}if(this.region===cg)return this.apiHost+n;var l=oy+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}var Nt=Gt("[Surveys]"),ug="seenSurvey_",OC=[Op.Popover,Op.Widget,Op.API],BC={ignoreConditions:!1,ignoreDelay:!1,displayType:sg.Popover},PC=Gt("[PostHog ExternalIntegrations]"),UC={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class $C{constructor(t){this._instance=t}Mt(t,n){var s;(s=De.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,t,(l=>{if(l)return PC.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!l||(f=De.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.Mt(UC[u],(()=>{var g;(g=De.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!l&&(h=De.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=De.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[s,l]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(s)}}}var fl,oc={},Fp=0,dg=()=>{},cy='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Fo="Surveys module not available",uy="sanitize_properties is deprecated. Use before_send instead",kw="Invalid value for property_denylist config: ",vl="posthog",jw=!NC&&(Kn==null?void 0:Kn.indexOf("MSIE"))===-1&&(Kn==null?void 0:Kn.indexOf("Mozilla"))===-1,dy=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:I3(Ne==null?void 0:Ne.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:dg,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:Nn&&Bt(Nn==null?void 0:Nn.search)&&Nn.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,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.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){ke.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:tg,before_send:void 0,request_queue_config:{flush_interval_ms:og},error_tracking:{},_onCapture:dg},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:tC,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-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)}))(e))},FC=[["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"]],fy=e=>{var t={};for(var[n,s]of FC)Se(e[n])||(t[s]=e[n]);var l=Ot({},t,e),c=e.__preview_external_dependency_versioned_paths;return Se(c)||(Se(e.strict_script_versioning)&&(l.strict_script_versioning=!!c),Bt(c)&&Se(e.asset_host)&&(l.asset_host=c)),nt(e.property_blacklist)&&(Se(e.property_denylist)?l.property_denylist=e.property_blacklist:nt(e.property_denylist)?l.property_denylist=[...e.property_blacklist,...e.property_denylist]:ke.error(kw+e.property_denylist)),l};class HC{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(t){ke.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Lr{xi(t,n){if(t){var s=this.ki.indexOf(t);s!==-1&&this.ki.splice(s,1)}return this.ki.push(n),n.initialize==null||n.initialize(),n}Si(){return this.config.cookieless_mode===$s||this.config.cookieless_mode===da&&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 HC,this.Ci=!1,this.version=Zt.LIB_VERSION,this.Ii=new Vg,this.ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=dy(),this.SentryIntegration=uC,this.sentryIntegration=s=>(function(l,c){var u=iw(l,c);return{name:sw,processEvent:f=>u(f)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ti=!1,this.Ei=null,this.Mi=null,this.Pi=null,this.scrollManager=new RC(this),this.pageViewManager=new Xb(this),this.rateLimiter=new yC(this),this.requestRouter=new zC(this),this.consent=new W3(this),this.externalIntegrations=new $C(this);var n=(t=Lr.__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.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(s,l,c)=>{var u=Bt(s)?{[s]:l}:s;this.setPersonProperties(u),c==null||c({})},set_once:(s,l,c)=>{var u=Bt(s)?{[s]:l}:s;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(s=>ke.info('send "'+(s==null?void 0:s.event)+'"',s)))}init(t,n,s){if(s&&s!==vl){var l,c=(l=oc[s])!==null&&l!==void 0?l:new Lr;return c._init(t,n,s),oc[s]=c,oc[vl][s]=c,c}return this._init(t,n,s)}_init(t,n,s){var l,c;n===void 0&&(n={});var u=Bt(t)?t.trim():"";if(!u)return ke.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Ri(n.debug),this.Oi=n,this.Li=[],n.person_profiles?this.Mi=n.person_profiles:n.process_person&&(this.Mi=n.process_person);var f=dy(n.defaults),h=fy(n),p=Ot({},f,h,{name:s,token:u});$t(f.rageclick)&&$t(h.rageclick)&&(p.rageclick=Ot({},f.rageclick,h.rageclick)),$t(f.session_recording)&&$t(h.session_recording)&&(p.session_recording=Ot({},f.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&ke.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:as.GZipJS;var g=this.Fi();this.persistence=new zp(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new zp(ye({},this.config,{persistence:"sessionStorage"}),g,!1);var v=ye({},this.persistence.props),y=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ai=new TC((D=>this.$i(D)),this.config.request_queue_config),this.Di=new MC(this),this.__request_queue=[];var b=this.Si();if(b||(this.sessionManager=new ay(this),this.sessionPropsManager=new iy(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ke.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ni(b)}),0)):(ke.info("Initializing extensions synchronously"),this.Ni(b)),Zt.DEBUG=Zt.DEBUG||this.config.debug,Zt.DEBUG&&ke.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:v,s:y}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var _=n.bootstrap.distinctID,j=this.get_distinct_id(),E=this.persistence.get_property(qr);if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&E===ol)this.identify(_);else if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&E===cl)ke.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 k=this.config.get_device_id(Us()),A=n.bootstrap.isIdentifiedID?k:_;this.persistence.set_property(qr,n.bootstrap.isIdentifiedID?cl:ol),this.register({distinct_id:_,$device_id:A})}}if(b)this.register_once({distinct_id:nd,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(Us());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(qr,ol)}return Xt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(D,O){var L=D.config.segment;if(!L)return O();(function(I,$){var G=I.config.segment;if(!G)return $();var B=T=>{var le=()=>T.anonymousId()||Us();I.config.get_device_id=le,T.id()&&(I.register({distinct_id:T.id(),$device_id:le()}),I.persistence.set_property(qr,cl)),$()},F=G.user();"then"in F&&Ps(F.then)?F.then(B):B(F)})(D,(()=>{L.register((I=>{Promise&&Promise.resolve||Dp.warn("This browser does not have Promise support, and can not use the segment integration");var $=(G,B)=>{if(!B)return G;G.event.userId||G.event.anonymousId===I.get_distinct_id()||(Dp.info("No userId set, resetting PostHog"),I.reset()),G.event.userId&&G.event.userId!==I.get_distinct_id()&&(Dp.info("UserId set, identifying with PostHog"),I.identify(G.event.userId));var F=I.calculateEventProperties(B,G.event.properties);return G.event.properties=Object.assign({},F,G.event.properties),G};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:G=>$(G,G.event.event),page:G=>$(G,xl),identify:G=>$(G,Mp),screen:G=>$(G,"$screen")}})(D)).then((()=>{O()}))}))})(this,(()=>this.qi())):this.qi(),Ps(this.config._onCapture)&&this.config._onCapture!==dg&&(ke.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(D=>this.config._onCapture(D.event,D)))),this.config.ip&&ke.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}Ni(t){var n,s,l,c,u,f,h,p=performance.now(),g=ye({},Lr.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.ki.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.ki.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new g.exceptions(this)),g.historyAutocapture&&this.ki.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.ki.push(this.tracingHeaders=new g.tracingHeaders(this)),g.siteApps&&this.ki.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.ki.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.ki.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.ki.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new g.surveys(this)),g.logs&&this.ki.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.ki.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.ki.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.ki.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.ki.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.ki.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.ki.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,cC)),g.toolbar&&this.ki.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.ki.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.ki.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.ji){var y=this.ji;this.ji=void 0,this.pr(y)}})),this.Bi(v,p)}Bi(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Bi(t,n)}),0);var s=t.shift();if(s)try{s()}catch(c){ke.error("Error initializing extension:",c)}}var l=Math.round(performance.now()-n);this.register_for_session({[I_]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[q_]:l}),this.config.__preview_deferred_init_extensions&&ke.info("PostHog extensions initialized ("+l+"ms)")}pr(t){var n;if(!Ne||!Ne.body)return ke.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ji=t),this.Hi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(t.supportedCompression,as.GZipJS)?as.GZipJS:Ie(t.supportedCompression,as.Base64)?as.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Mi?this.Mi:tg}),this.ki.forEach((s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(t)))}qi(){try{this.config.loaded(this)}catch(s){ke.critical("`loaded` function failed",s)}if(this.Ui(),this.config.internal_or_test_user_hostname&&Nn!=null&&Nn.hostname){var t=Nn.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.Si())&&this.zi()}),1),this.Vi=new hw(this),this.Vi.load()}Ui(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ai)==null||t.enable())}_dom_loaded(){this.is_capturing()&&rd(this.__request_queue,(t=>this.$i(t))),this.__request_queue=[],this.Ui()}_handle_unload(){var t,n,s,l;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.Wi()&&this.capture(Ap),(n=this.logs)==null||n.flushLogs("sendBeacon"),(s=this.Ai)==null||s.unload(),(l=this.Di)==null||l.unload()):this.Wi()&&this.capture(Ap,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?jw?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=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Se(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 s,l,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=sy(u.url,u.compression);var f=(s=u.transport)!==null&&s!==void 0?s:"fetch",h=kd.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(l=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&l!==void 0?l:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===as.GZipJS&&qN&&!Sd?EC(u).then((g=>{p(g)})).catch((g=>{if(Ab(g))return Sd=!0,void p(ye({},u,{compression:void 0,url:sy(n.url,void 0)}));(v=>{if(!v||typeof v!="object")return!1;var y="name"in v?String(v.name):"";return Ab(v)||y===s_})(g)&&(Sd=!0),p(u)})):p(u)})(ye({},t,{callback:n=>{var s,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(s=(l=this.config).on_request_error)==null||s.call(l,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}$i(t){this.Di?this.Di.retriableRequest(t):this._send_request(t)}_execute_array(t){Fp++;try{var n,s=[],l=[],c=[];rd(t,(f=>{if(f)if(nt(n=f[0]))c.push(f);else if(Ps(f))try{f.call(this)}catch(h){ke.error("Error executing queued PostHog call",f,h)}else nt(f)&&n==="alias"?s.push(f):nt(f)&&n.indexOf("capture")!==-1&&Ps(this[n])?c.push(f):l.push(f)}));var u=function(f,h){rd(f,(function(p){try{if(nt(p[0])){var g=h;At(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(v){ke.error("Error executing queued PostHog call",p,v)}}))};u(s,this),u(l,this),u(c,this)}finally{Fp--}}push(t){if(Fp>0&&nt(t)&&Bt(t[0])){var n=Lr.prototype[t[0]];Ps(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,s){var l,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ai){if(this.is_capturing())if(!Se(t)&&Bt(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!Bt(n==null?void 0:n.$current_url)&&(ke.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||s!=null&&s.Gi||ke.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 v=new Date,y=(s==null?void 0:s.timestamp)||v,b=zb(s==null?void 0:s.uuid,Us),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===xl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),s!=null&&s.$set&&(_.$set=s==null?void 0:s.$set);var j=s==null?void 0:s.$unset;j&&(_.$unset=j);var E,k,A,C=this.Zi(s==null?void 0:s.$set_once,t!==Pb,t===Mp);if(C&&(_.$set_once=C),s!=null&&s._noTruncate||(c=this.config.properties_string_max_length,u=_,f=B=>Bt(B)?B.slice(0,c):B,h=new Set,_=(function B(F,T){return F!==Object(F)?f?f(F):F:h.has(F)?void 0:(h.add(F),nt(F)?(le=[],rd(F,(W=>{le.push(B(W))}))):(le={},At(F,((W,Y)=>{h.has(W)||(le[Y]=B(W))}))),le);var le})(u)),_.timestamp=y,Se(s==null?void 0:s.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===Fs.DISMISSED||t===Fs.SENT){var D=n==null?void 0:n[Bp.SURVEY_ID],O=n==null?void 0:n[Bp.SURVEY_ITERATION];(B=>{try{var F=(T=>((le,W)=>{var Y=""+ug+W.id;return W.current_iteration&&W.current_iteration>0&&(Y=""+ug+W.id+"_"+W.current_iteration),Y})(0,T))(B);if(localStorage.getItem(F))return;localStorage.setItem(F,"true")}catch(T){Nt.error("Failed to persist survey seen state",T)}})({id:D,current_iteration:O}),_.$set=ye({},_.$set,{[(E={id:D,current_iteration:O},k=t===Fs.SENT?"responded":"dismissed",A="$survey_"+k+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(A="$survey_"+k+"/"+E.id+"/"+E.current_iteration),A)]:!0})}else t===Fs.SHOWN&&(_.$set=ye({},_.$set,{[Bp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===bC.SHOWN){var L=n==null?void 0:n[Kb.TOUR_TYPE];L&&(_.$set=ye({},_.$set,{[Kb.TOUR_LAST_SEEN_DATE+"/"+L]:new Date().toISOString()}))}var I=ye({},_.properties.$set,_.$set);if(ji(I)||this.setPersonPropertiesForFlags(I),!rt(this.config.before_send)){var $=this.it(_);if(!$)return;(_=$).uuid=zb(_.uuid,Us)}this.Ii.emit("eventCaptured",_);var G={method:"POST",url:(l=s==null?void 0:s._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:s==null?void 0:s._batchKey,transport:s==null?void 0:s.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.$i(G):this.Ai.enqueue(G),_}ke.critical("This capture call is ignored due to client rate limiting.")}}else ke.error("No event name provided to posthog.capture")}else ke.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,s,l,c){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.Si()&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!Bt(f.distinct_id)&&!Fn(f.distinct_id)||Mm(f.distinct_id))&&ke.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(k,A,C){var D,O,L,I;if(!Kn)return{};var $,G,B,F,T,le,W,Y,U,z=k?[...El,...A||[]]:[],[se,me]=(function(M){for(var he=0;Lb.length>he;he++){var[_e,Ce]=Lb[he],Re=_e.exec(M),Le=Re&&(Ps(Ce)?Ce(Re,M):Ce);if(Le)return Le}return["",""]})(Kn),R=($=typeof navigator<"u"?navigator:void 0)!=null&&$.brave?{brave:!0}:{},P={detectGoogleSearchApp:C},Z=Ot(Ug({$os:se,$os_version:me,$browser:C_(Kn,navigator.vendor,R,P),$device:Db(Kn),$device_type:(B=Kn,F={userAgentDataPlatform:(D=navigator)==null||(D=D.userAgentData)==null?void 0:D.platform,maxTouchPoints:(O=navigator)==null?void 0:O.maxTouchPoints,screenWidth:re==null||(L=re.screen)==null?void 0:L.width,screenHeight:re==null||(I=re.screen)==null?void 0:I.height,devicePixelRatio:re==null?void 0:re.devicePixelRatio},U=Db(B),U===c_||U===o_||U==="Kobo"||U==="Kindle Fire"||U===w_?jl:U===gc||U===Sl||U===xc||U===Lm?"Console":U===d_?"Wearable":U?hr:(F==null?void 0:F.userAgentDataPlatform)==="Android"&&((T=F==null?void 0:F.maxTouchPoints)!==null&&T!==void 0?T:0)>0?600>Math.min((le=F==null?void 0:F.screenWidth)!==null&&le!==void 0?le:0,(W=F==null?void 0:F.screenHeight)!==null&&W!==void 0?W:0)/((Y=F==null?void 0:F.devicePixelRatio)!==null&&Y!==void 0?Y:1)?hr:jl:"Desktop"),$timezone:fw(),$timezone_offset:mC()}),{$current_url:_c(Nn==null?void 0:Nn.href,z,wc),$host:Nn==null?void 0:Nn.host,$pathname:Nn==null?void 0:Nn.pathname,$raw_user_agent:Kn.length>1e3?Kn.substring(0,997)+"...":Kn,$browser_version:f3(Kn,navigator.vendor,R,P),$browser_language:Wb(),$browser_language_prefix:(G=Wb(),typeof G=="string"?G.split("-")[0]:void 0),$screen_height:re==null?void 0:re.screen.height,$screen_width:re==null?void 0:re.screen.width,$viewport_height:re==null?void 0:re.innerHeight,$viewport_width:re==null?void 0:re.innerWidth,$lib:Zt.LIB_NAME,$lib_version:Zt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Zt.SDK_DIST_CHANNEL&&(Z.$sdk_dist_channel=Zt.SDK_DIST_CHANNEL),Z})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,s.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&Ot(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&Ot(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.Di)==null?void 0:b.length}catch(k){f.$sdk_debug_error_capturing_properties=String(k)}if(this.requestRouter.region===cg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==xl||c?t!==Ap||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,l),f=Ot(f,p),t===xl&&Ne&&(f.title=Ne.title),!Se(u)){var _=s.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Kn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=Ot({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),nt(this.config.property_denylist)?At(this.config.property_denylist,(function(k){delete f[k]})):ke.error(kw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var j=this.config.sanitize_properties;j&&(ke.error(uy),f=j(f,t));var E=this.Qi();return f.$process_person_profile=E,E&&!c&&this.Ji("_calculate_event_properties"),f}Zi(t,n,s){var l;if(n===void 0&&(n=!0),s===void 0&&(s=!1),!this.persistence||!this.Qi()||this.Ci&&!s)return t;var c=this.persistence.get_initial_props(),u=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),f=Ot({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(ke.error(uy),f=h(f,"$set_once")),n&&(this.Ci=!0),ji(f)?void 0:f}register(t,n){var s;(s=this.persistence)==null||s.register(t,n)}register_once(t,n,s){var l;(l=this.persistence)==null||l.register_once(t,n,s)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Yi(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(t,n)}isFeatureEnabled(t,n){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,s){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,s)}updateEarlyAccessFeatureEnrollment(t,n,s){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,s)}getEarlyAccessFeatures(t,n,s){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,s)}on(t,n){return this.Ii.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:Fo}),()=>{})}onSessionId(t){var n,s;return(n=(s=this.sessionManager)==null?void 0:s.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:Fo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Fo})}renderSurvey(t,n){var s;(s=this.surveys)==null||s.renderSurvey(t,n)}displaySurvey(t,n){var s;n===void 0&&(n=BC),(s=this.surveys)==null||s.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,s;return(n=(s=this.surveys)==null?void 0:s.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:Fo}}canRenderSurveyAsync(t,n){var s,l;return n===void 0&&(n=!1),(s=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Fo})}Ki(t){return!t||Mm(t)?(ke.critical("Unique user id has not been set in posthog.identify"),!1):t===nd?(ke.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())||(ke.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,s){if(!this.__loaded||!this.persistence)return ke.uninitializedWarning("posthog.identify");if(Fn(t)&&(t=t.toString(),ke.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ki(t)&&this.Ji("posthog.identify")){var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Pd)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Wo)&&(this.unregister(Wo),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(qr)||ol)===ol;t!==l&&u?(this.persistence.set_property(qr,cl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:s||{}},!1),this.capture(Mp,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:s||{}}),this.Pi=ly(t,n,s),(c=this.featureFlags)==null||c.setAnonymousDistinctId(l)):(n||s)&&this.setPersonProperties(n,s),t!==l&&(this.reloadFeatureFlags(),this.unregister(ic))}}setPersonProperties(t,n){if((t||n)&&this.Ji("posthog.setPersonProperties")){var s=ly(this.get_distinct_id(),t,n);this.Pi!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Pi=s):ke.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,s=(nt(t)?t:[t]).filter((l=>Bt(l)&&l.length>0));s.length!==0&&this.Ji("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Pi=null)}group(t,n,s){if(t&&n){var l=this.getGroups(),c=l[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},l,{[t]:n})}),c||s){var u={$group_type:t,$group_key:n};s&&(u.$group_set=s),this.capture(Pb,u)}s&&this.setGroupPropertiesForFlags({[t]:s}),c&&!s&&this.reloadFeatureFlags()}else ke.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var s;n===void 0&&(n=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var s;n===void 0&&(n=!0),this.Ji("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,s,l,c,u,f,h,p,g;if(ke.info("reset"),!this.__loaded)return ke.uninitializedWarning("posthog.reset");var v,y=this.get_property(Pd),b=this.get_property(pa);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(s=this.sessionPersistence)==null||s.clear(),Se(b)||(v=this.persistence)==null||v.register({[pa]:b}),(l=this.surveys)==null||l.reset(),(c=this.Vi)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.persistence)==null||p.set_property(qr,ol),(g=this.sessionManager)==null||g.resetSessionId(),this.Pi=null,this.config.cookieless_mode===$s)this.register_once({distinct_id:nd,$device_id:null},"");else{var _=this.config.get_device_id(Us());this.register_once({distinct_id:_,$device_id:t?_:y},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var s;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(s=this.conversations)==null||s.Xi()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.en()}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{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&s){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!s)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-u,0)}return l}alias(t,n){return t===this.get_property(O_)?(ke.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ji("posthog.alias")?(Se(n)&&(n=this.get_distinct_id()),t!==n?(this.Yi(Wo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(ke.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if($t(t)){var s,l,c,u,f,h,p,g,v,y,b;Ot(this.config,fy(t));var _=this.Fi();(s=this.persistence)==null||s.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new zp(ye({},this.config,{persistence:"sessionStorage"}),_,!1);var j=this.Ri(this.config.debug);cs(j)&&(this.config.debug=j),cs(this.config.debug)&&(this.config.debug?(Zt.DEBUG=!0,Tt.N()&&Tt.q("ph_debug",!0),ke.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(Zt.DEBUG=!1,Tt.N()&&Tt.P("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(c=this.exceptions)==null||c.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(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.tn(),(b=this.externalIntegrations)==null||b.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Zt.LIB_NAME=t,Zt.LIB_VERSION=n}startSessionRecording(t){var n,s,l,c,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&&((s=this.sessionRecording)==null||s.overrideSampling()),h.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.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 s=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(ye({},l,n))}}addExceptionStep(t,n){var s;(s=this.exceptions)==null||s.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:Lr.rn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,s;return(n=(s=this.toolbar)==null?void 0:s.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:vl;return n!==vl&&(n=vl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(qr))===cl||((n=this.sessionPersistence)==null?void 0:n.get_property(qr))===cl}Qi(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===tg&&!this._isIdentified()&&ji(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Wo])&&((n=this.persistence)==null||(n=n.props)==null||!n[$d]))}Wi(){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.Qi()||this.Ji("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ji("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ji(t){return this.config.person_profiles==="never"?(ke.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Yi($d,!0),!0)}Fi(){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!==da)}tn(){var t,n,s,l,c=this.Fi();return((t=this.persistence)==null?void 0:t.Vt)!==c&&((s=this.persistence)==null||s.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.Vt)!==c&&((l=this.sessionPersistence)==null||l.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==$s){if(this.Si()){var s,l,c,u,f;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new ay(this),this.pageViewManager=new Xb(this),this.persistence&&(this.sessionPropsManager=new iy(this,this.sessionManager,this.persistence));var h,p=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=Lr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.xi(this.sessionRecording,new p(this)),this.Hi&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.Hi)))}var g,v;this.consent.optInOut(!0),this.tn(),this.Ui(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==da&&((g=this.surveys)==null||g.loadIfEnabled()),(Se(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.zi()}else ke.warn(cy)}opt_out_capturing(){var t,n,s;this.config.cookieless_mode!==$s?(this.config.cookieless_mode===da&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===da&&(this.register({distinct_id:nd,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.zi(),this.Ui())):ke.warn(cy)}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===$s||(this.config.cookieless_mode===da?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return dr?_w(dr,this.config.custom_blocked_useragents):void 0}zi(){Ne&&(Ne.visibilityState==="visible"?this.Ti||(this.Ti=!0,this.capture(xl,{title:Ne.title},{send_instantly:!0}),this.Ei&&(Ne.removeEventListener(Fd,this.Ei),this.Ei=null)):this.Ei||(this.Ei=this.zi.bind(this),Xt(Ne,Fd,this.Ei)))}debug(t){t===!1?(re==null||re.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(re==null||re.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}))}mr(){var t,n,s,l,c,u,f=this.Oi||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ke.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):(s="advanced_disable_decide",l=ke,c=(n="advanced_disable_flags")in(t=f)&&!rt(t[n]),u=s in t&&!rt(t[s]),c?t[n]:!!u&&(l&&l.warn("Config field '"+s+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[s]))}it(t){var n;if(rt(this.config.before_send))return t;var s=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(e3),l=nt(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var u of l){if(c=u(c),rt(c)){var f="Event '"+t.event+"' was rejected in beforeSend function";return JN(t.event)?ke.warn(f+". This can cause unexpected behavior."):ke.info(f),null}c.properties&&!ji(c.properties)||ke.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of s)if(c.properties&&rt(c.properties[h]))return ke.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 c}getPageViewId(){var t;return(t=this.pageViewManager.Ot)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(s)})}Ri(t){var n=cs(t)&&!t,s=Tt.N()&&Tt.A("ph_debug")==="true";return!n&&(!!s||t)}}Lr.__defaultExtensionClasses={},Lr.rn={trace:fl=()=>{},debug:fl,info:fl,warn:fl,error:fl,fatal:fl},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=F3(e.prototype[t[n]])})(Lr,["identify"]);class hy{constructor(t){this.disabled=t===!1;var n=$t(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,s){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>s-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var Hp="$copy_autocapture",Ip=Gt("[AutoCapture]");function qp(e,t){return t.length>e?t.slice(0,e)+"...":t}function IC(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ei(t));return t}function qC(e,t){var n,s,{e:l,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h}=t;if(!Ei(e))return{props:{}};for(var p=[e],g=e;g.parentNode&&!fr(g,"body");)if(X_(g.parentNode))p.push(g.parentNode.host),g=g.parentNode.host;else{if(!Ei(g.parentNode))break;p.push(g.parentNode),g=g.parentNode}var v,y,b=[],_={},j=!1,E=!1;if(At(p,(O=>{var L=rg(O);if(fr(O,"a")){var I=O.getAttribute("href");j=L&&!!I&&ac(I)&&I}Ie(qd(O),"ph-no-capture")&&(E=!0),b.push((function(G,B,F,T){var le=G.tagName.toLowerCase(),W={tag_name:le};Fg.indexOf(le)>-1&&!F&&(W.$el_text=le.toLowerCase()==="a"||le.toLowerCase()==="button"?qp(1024,Gb(G)):qp(1024,bc(G)));var Y=qd(G);Y.length>0&&(W.classes=Y.filter((function(me){return me!==""}))),At(G.attributes,(function(me){var R;if((!ew(G)||["name","id","class","aria-label"].indexOf(me.name)!==-1)&&(T==null||!T.includes(me.name))&&!B&&ac(me.value)&&(!Bt(R=me.name)||R.substring(0,10)!=="_ngcontent"&&R.substring(0,7)!=="_nghost")){var P=me.value;me.name==="class"&&(P=$g(P).join(" ")),W["attr__"+me.name]=qp(1024,P)}}));for(var U=1,z=1,se=G;se=IC(se);)U++,se.tagName===G.tagName&&z++;return W.nth_child=U,W.nth_of_type=z,W})(O,c,u,f));var $=(function(G){if(!rg(G))return{};var B={};return At(G.attributes,(function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var T=F.name.replace("data-ph-capture-attribute-",""),le=F.value;T&&le&&ac(le)&&(B[T]=le)}})),B})(O);Ot(_,$)})),E)return{props:{},explicitNoCapture:E};if(u||(b[0].$el_text=fr(e,"a")||fr(e,"button")?Gb(e):bc(e)),j){var k,A;b[0].attr__href=j;var C=(k=Vd(j))==null?void 0:k.host,D=re==null||(A=re.location)==null?void 0:A.host;C&&D&&C!==D&&(v=j)}return{props:Ot({$event_type:l.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(y=b,(function(O){return O.map((L=>{var I,$,G="";if(L.tag_name&&(G+=L.tag_name),L.attr_class)for(var B of(L.attr_class.sort(),L.attr_class))G+="."+B.replace(/"/g,"");var F=ye({},L.text?{text:L.text}:{},{"nth-child":(I=L.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":($=L.nth_of_type)!==null&&$!==void 0?$:0},L.href?{href:L.href}:{},L.attr_id?{attr_id:L.attr_id}:{},L.attributes),T={};return wd(F).sort(((le,W)=>{var[Y]=le,[U]=W;return Y.localeCompare(U)})).forEach((le=>{var[W,Y]=le;return T[Yb(W.toString())]=Yb(Y.toString())})),(G+=":")+wd(T).map((le=>{var[W,Y]=le;return W+'="'+Y+'"'})).join("")})).join(";")})((function(O){return O.map((L=>{var I,$,G={text:(I=L.$el_text)==null?void 0:I.slice(0,400),tag_name:L.tag_name,href:($=L.attr__href)==null?void 0:$.slice(0,2048),attr_class:lC(L),attr_id:L.attr__id,nth_child:L.nth_child,nth_of_type:L.nth_of_type,attributes:{}};return wd(L).filter((B=>{var[F]=B;return F.indexOf("attr__")===0})).forEach((B=>{var[F,T]=B;return G.attributes[F]=T})),G}))})(y)))},(n=b[0])!=null&&n.$el_text?{$el_text:(s=b[0])==null?void 0:s.$el_text}:{},v&&l.type==="click"?{$external_click_url:v}:{},_)}}var Ho=Gt("[ExceptionAutocapture]"),VC=Gt("[TracingHeaders]"),sa=Gt("[Web Vitals]"),py=9e5,my="disabled",gy="lazy_loading",Io="awaiting_config",cd="missing_config";Gt("[SessionRecording]"),Gt("[SessionRecording]");var fg="[SessionRecording]",Ms=Gt(fg),GC=Gt("[Heatmaps]");function xy(e){return $t(e)&&"clientX"in e&&"clientY"in e&&Fn(e.clientX)&&Fn(e.clientY)}var Vp=Gt("[Product Tours]"),Gp=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Og))},YC=["$set_once","$set"],rs=Gt("[SiteApps]"),vy="Error while initializing PostHog app with config id ";function hl(e,t,n){if(rt(e))return!1;switch(n){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class QC{constructor(t){this.nn=new Vg,this.sn=(n,s)=>this.an(n,s)&&this.ln(n,s)&&this.un(n,s)&&this.hn(n,s),this.an=(n,s)=>s==null||!s.event||(n==null?void 0:n.event)===(s==null?void 0:s.event),this._instance=t,this.dn=new Set,this.cn=new Set}init(){var t,n;Se((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((s,l)=>{this.on(s,l)}))}register(t){var n,s;if(!Se((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.cn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.dn)==null||g.add((p==null?void 0:p.event)||"")}))})),(s=this._instance)!=null&&s.autocapture)){var l,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(c)}}on(t,n){var s;n!=null&&t.length!=0&&(this.dn.has(t)||this.dn.has(n==null?void 0:n.event))&&this.cn&&((s=this.cn)==null?void 0:s.size)>0&&this.cn.forEach((l=>{this.vn(n,l)&&this.nn.emit("actionCaptured",l.name)}))}fn(t){this.onAction("actionCaptured",(n=>t(n)))}vn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var s of n.steps)if(this.sn(t,s))return!0;return!1}onAction(t,n){return this.nn.on(t,n)}ln(t,n){if(n!=null&&n.url){var s,l=t==null||(s=t.properties)==null?void 0:s.$current_url;if(!l||typeof l!="string"||!hl(l,n.url,n.url_matching||"contains"))return!1}return!0}un(t,n){return!!this.pn(t,n)&&!!this.gn(t,n)&&!!this.mn(t,n)}pn(t,n){var s;if(n==null||!n.href)return!0;var l=this.yn(t);if(l.length>0)return l.some((f=>hl(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";return!!u&&hl((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}gn(t,n){var s;if(n==null||!n.text)return!0;var l=this.yn(t);if(l.length>0)return l.some((p=>hl(p.text,n.text,n.text_matching||"exact")||hl(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!rt(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>hl(p,u,f))))}mn(t,n){var s,l;if(n==null||!n.selector)return!0;var c=t==null||(s=t.properties)==null?void 0:s.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}yn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}hn(t,n){return n==null||!n.properties||n.properties.length===0||Sw(n.properties.reduce(((s,l)=>{var c=nt(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return s[l.key]={values:c,operator:l.operator||"exact"},s}),{}),t==null?void 0:t.properties)}}class XC{constructor(t){this.bn=[],this._instance=t,this._n=new Map,this.wn=new Map,this.xn=new Map}kn(t,n){return!!t&&Sw(t.propertyFilters,n==null?void 0:n.properties)}Sn(t,n){var s=new Map;return t.forEach((l=>{var c;(c=l.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=s.get(u.name)||[];f.push(l.id),s.set(u.name,f)}}))})),s}Cn(t,n,s){var l=(s===Oo.Activation?this._n:this.wn).get(t),c=[];return this.In((u=>{c=u.filter((f=>l==null?void 0:l.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[s])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.kn(h,n)}))}register(t){var n;Se((n=this._instance)==null?void 0:n._addCaptureHook)||(this.Tn(t),this.En(t))}En(t){var n=t.filter((s=>{var l,c;return((l=s.conditions)==null?void 0:l.actions)&&((c=s.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.Mn==null&&(this.Mn=new QC(this._instance),this.Mn.init(),this.Mn.fn((s=>{this.onAction(s)}))),n.forEach((s=>{var l,c,u,f,h;s.conditions&&(l=s.conditions)!=null&&l.actions&&(c=s.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=s.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.Mn)==null||f.register(s.conditions.actions.values),(h=s.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.xn.get(p.name);g&&g.push(s.id),this.xn.set(p.name,g||[s.id])}})))})))}Tn(t){var n,s=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),l=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));s.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this._n=this.Sn(t,Oo.Activation),this.wn=this.Sn(t,Oo.Cancellation))}onEvent(t,n){var s,l,c=this.Pn(),u=(n==null||(s=n.properties)==null?void 0:s.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.Rn(t,u);if(f==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.On([u]);if(f==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.Ln(u)}if(this.wn.has(t)){var h=this.Cn(t,n,Oo.Cancellation);h.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.On(h.map((g=>g.id))),h.forEach((g=>this.Fn(g.id))))}if(this._n.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this._n.get(t)});var p=this.Cn(t,n,Oo.Activation);this.An(p.map((g=>g.id)))}}onAction(t){this.xn.has(t)&&this.An(this.xn.get(t)||[])}An(t){t.length!==0&&(this.bn=[...new Set([...this.bn,...t])],this.Pn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Ln(t){this.bn=this.bn.filter((s=>s!==t));var n=this.$n();n.includes(t)||this.Dn([...n,t])}On(t){var n=new Set(t);this.bn=this.bn.filter((c=>!n.has(c)));var s=this.$n(),l=s.filter((c=>!n.has(c)));l.length!==s.length&&this.Dn(l)}$n(){var t,n=this.Nn();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getActivatedIds(){return[...new Set([...this.$n(),...this.bn])].filter((t=>!this.qn(t)))}reset(){this.bn=[],this.$n().length>0&&this.Dn([])}getEventToItemsMap(){return this._n}jn(){return this.Mn}}class WC extends XC{constructor(t){super(t)}Nn(){return Ym}Bn(){return Fs.SHOWN}In(t){var n;(n=this._instance)==null||n.getSurveys(t)}Fn(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Pn(){return Nt}Dn(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Ym]:t})}qn(){return!1}Rn(t,n){var s;this.In((c=>{s=c.find((u=>u.id===n))}));var l=!s||(function(c){var u,f,h,p=((u=(f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)!==null&&u!==void 0?u:0)>0;return c.schedule===vC.Always||!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation||!p)})(s);return l?t===Fs.SHOWN?"consume":"ignore":t===Fs.SHOWN?"persist":t===Fs.DISMISSED||t===Fs.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Yp="SDK is not enabled or survey functionality is not yet loaded",by="Disabled. Not loading surveys.",KC=re!=null&&re.location?Gd(re.location.hash,"__posthog")||Gd(location.hash,"state"):null,yy="_postHogToolbarParams",_y=Gt("[Toolbar]"),jn=Gt("[FeatureFlags]"),ia=Gt("[FeatureFlags]",{debugEnabled:!0}),Qp=`" 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},Sy=e=>{var t={};for(var[n,s]of wd(e||{}))s&&(t[n]=s);return t},Rs=Gt("[Error tracking]"),ky="Refusing to render web experiment since the viewer is a likely bot",ZC={icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!re&&Xd(t.href,e),not_regex:(e,t)=>!!re&&!Xd(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Mn{get Se(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),n.getWebExperiments((l=>{Mn.Hn("retrieved web experiments from the server"),n.Un=new Map,l.forEach((c=>{if(c.feature_flag_key){var u;n.Un&&(Mn.Hn("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.Un)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);Bt(f)&&c.variants[f]&&n.zn(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];Mn.Vn(p)&&n.zn(c.name,h,p.transforms)}}))}),s)},this._instance=t,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.Hn(ky);else if(!this.Se.disable_web_experiments){if(rt(this.Un))return this.Un=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.Hn("applying feature flags",t),t.forEach((n=>{var s;if(this.Un&&(s=this.Un)!=null&&s.has(n)){var l,c=this._instance.getFeatureFlag(n),u=(l=this.Un)==null?void 0:l.get(n);c&&u!=null&&u.variants[c]&&this.zn(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=yc(t==null?void 0:t.search,"__experiment_id"),s=yc(t==null?void 0:t.search,"__experiment_variant");n&&s&&(Mn.Hn("previewing web experiments "+n+" && "+s),this.getWebExperiments((l=>{this.Wn(parseInt(n),s,l)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,s){if(this.Se.disable_web_experiments&&!s)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}Wn(t,n,s){var l=s.filter((c=>c.id===t));l&&l.length>0&&(Mn.Hn("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.zn(l[0].name,n,l[0].variants[n].transforms))}static Vn(t){return!rt(t.conditions)&&Mn.Gn(t)&&Mn.Zn(t)}static Gn(t){var n;if(rt(t.conditions)||rt((n=t.conditions)==null?void 0:n.url))return!0;var s,l,c,u=Mn.getWindowLocation();return!!u&&((s=t.conditions)==null||!s.url||ZC[(l=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](t.conditions.url,u))}static getWindowLocation(){return re==null?void 0:re.location}static Zn(t){var n;if(rt(t.conditions)||rt((n=t.conditions)==null?void 0:n.utm))return!0;var s=aw();if(s.utm_source){var l,c,u,f,h,p,g,v,y=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==s.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==s.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)==s.utm_medium,j=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==s.utm_term;return y&&_&&j&&b}return!1}static Hn(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;n>l;l++)s[l-1]=arguments[l];ke.info("[WebExperiments] "+t,s)}zn(t,n,s){this._is_bot()?Mn.Hn(ky):n!=="control"?s.forEach((l=>{if(l.selector){var c;Mn.Hn("applying transform of variant "+n+" for experiment "+t+" ",l);var u=(c=document)==null?void 0:c.querySelectorAll(l.selector);u==null||u.forEach((f=>{var h=f;l.html&&(h.innerHTML=l.html),l.css&&h.setAttribute("style",l.css)}))}})):Mn.Hn("Control variants leave the page unmodified.")}_is_bot(){return dr&&this._instance?_w(dr,this.Se.custom_blocked_useragents):void 0}}var Tr=Gt("[Conversations]"),aa="Conversations not available yet.",jy="console",af={featureFlags:class{constructor(e){this.Qn=!1,this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get Ur(){return this._instance.persistence}ns(e){return this._instance.get_property(e)}ss(){var e,t;return(e=(t=this.Ur)==null?void 0:t.Gt(this.Se.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}os(){return!!this.ss()&&(this.rs||this.Yn||(this.rs=!0,jn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ls(){var e,t=(e=this.Se.evaluation_contexts)!==null&&e!==void 0?e:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ts||(jn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ts=!0),t!=null&&t.length?t.filter((n=>{var s=n&&typeof n=="string"&&n.trim().length>0;return s||jn.error("Invalid evaluation context found:",n,"Expected non-empty string"),s})):[]}us(){return this.ls().length>0}hs(){var e=this.Se.flag_keys;if(!Se(e)){if(nt(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||jn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));jn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,s=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var l,c,u=(l=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&l!==void 0?l:{},f=Object.keys(s).filter((p=>!!s[p])).reduce(((p,g)=>(p[g]=s[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 s,l,c=n!=null&&n.merge&&(s=this.ns(ha))!==null&&s!==void 0?s:{},u=n!=null&&n.merge&&(l=this.ns(_d))!==null&&l!==void 0?l:{},f=ye({},c,e),h=ye({},u,t),p={};for(var[g,v]of Object.entries(f))p[g]={key:g,enabled:GN(v),variant:YN(v),reason:void 0,metadata:Se(h==null?void 0:h[g])?void 0:{id:0,version:void 0,description:void 0,payload:h[g]}};this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.ns(qm),t=this.ns(Os),n=this.ns(gl);if(!n&&!t)return e||{};var s=Ot({},e||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of l){var u,f,h=s[c],p=t==null?void 0:t[c],g=Se(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Se(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),s[c]=b}return this.Qn||(jn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:s}),this.Qn=!0),s}getFlagVariants(){var e=this.ns(ha),t=this.ns(Os);if(!t)return e||{};for(var n=Ot({},e),s=Object.keys(t),l=0;s.length>l;l++)n[s[l]]=t[s[l]];return this.Qn||(jn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Qn=!0),n}getFlagPayloads(){var e=this.ns(_d),t=this.ns(gl);if(!t)return e||{};for(var n=Ot({},e||{}),s=Object.keys(t),l=0;s.length>l;l++)n[s[l]]=t[s[l]];return this.Qn||(jn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Qn=!0),n}reloadFeatureFlags(){this.Kn||this.Se.advanced_disable_feature_flags||this.ds||(this._instance.Ii.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.cs()}),5))}vs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Jn||this.Yn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Kn=e}cs(e){var t;if(this.vs(),!this._instance.mr())if(this.Yn)this.Xn=!0;else{var n=this.Se.token,s=this.ns(Pd),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.Ur)==null?void 0:t.get_initial_props())||{},this.ns(ca)||{}),group_properties:this.ns(ua),timezone:fw()};$n(s)||Se(s)||(l.$device_id=s),(e!=null&&e.disableFlags||this.Se.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.us()&&(l.evaluation_contexts=this.ls());var c=this.hs();Se(c)||(l.flag_keys=c);var u=!!this.Se.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Yn=!0,this._instance._send_request({method:"POST",url:f,data:l,compression:this.Se.disable_compression?void 0:as.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:h=>{var p,g,v,y=!0;if(h.statusCode===200&&(this.Xn||(this.$anon_distinct_id=void 0),y=!1),this.Yn=!1,!l.disable_flags||this.Xn){this.es=!y;var b=[];h.error?h.error instanceof Error?b.push(h.error.name==="AbortError"?"timeout":"connection_error"):b.push("unknown_error"):h.statusCode!==200&&b.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&b.push("errors_while_computing_flags");var _,j=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));j&&b.push("quota_limited"),(v=this.Ur)==null||v.register({[Xm]:b}),j?jn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(l.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},y,{partialResponse:u}),this.Xn&&(this.Xn=!1,this.cs()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var s=this.getFeatureFlagResult(e,t);return(n=s==null?void 0:s.variant)!==null&&n!==void 0?n:s==null?void 0:s.enabled}}else jn.warn('getFeatureFlag for key "'+e+Qp)}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.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var n=this.getFlagVariants(),s=e in n,l=n[e],c=this.getFlagPayloads()[e],u=String(l),f=this.ns(Vm)||void 0,h=this.ns(vc)||void 0,p=this.ns(ic)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.ns(Qm);v&&v!==y&&(p={},(g=this.Ur)==null||g.register({[ic]:p,[Qm]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,j,E,k,A,C,D,O,L;nt(p[e])?p[e].push(u):p[e]=[u],(b=this.Ur)==null||b.register({[ic]:p});var I=this.getFeatureFlagDetails(e),$=[...(_=this.ns(Xm))!==null&&_!==void 0?_:[]];Se(l)&&$.push("flag_missing");var G={$feature_flag:e,$feature_flag_response:l,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((j=this.Se.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[e])||null,$feature_flag_bootstrapped_payload:((E=this.Se.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])||null,$used_bootstrap_value:!this.es};Se(I==null||(k=I.metadata)==null?void 0:k.version)||(G.$feature_flag_version=I.metadata.version);var B,F=(A=I==null||(C=I.reason)==null?void 0:C.description)!==null&&A!==void 0?A:I==null||(D=I.reason)==null?void 0:D.code;F&&(G.$feature_flag_reason=F),I!=null&&(O=I.metadata)!=null&&O.id&&(G.$feature_flag_id=I.metadata.id),Se(I==null?void 0:I.original_variant)&&Se(I==null?void 0:I.original_enabled)||(G.$feature_flag_original_response=Se(I.original_variant)?I.original_enabled:I.original_variant),I!=null&&(L=I.metadata)!=null&&L.original_payload&&(G.$feature_flag_original_payload=I==null||(B=I.metadata)==null?void 0:B.original_payload),$.length&&(G.$feature_flag_error=$.join(",")),this._instance.capture("$feature_flag_called",G)}if(s)return{key:e,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:VN(c)}}}else jn.warn('getFeatureFlagResult for key "'+e+Qp)}getRemoteConfigPayload(e,t){var n=this.Se.token,s={distinct_id:this._instance.get_distinct_id(),token:n};this.us()&&(s.evaluation_contexts=this.ls());var l=this.hs();Se(l)||(s.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Se.disable_compression?void 0:as.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(c){var u,f=(u=c.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.es){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Se(n)?void 0:!!n}jn.warn('isFeatureEnabled for key "'+e+Qp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.Ur){this.Jn=!0;var s=this.getFlagVariants(),l=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=($=>{var G=$.flags;return G?($.featureFlags=Object.fromEntries(Object.keys(G).map((B=>{var F;return[B,(F=G[B].variant)!==null&&F!==void 0?F:G[B].enabled]}))),$.featureFlagPayloads=Object.fromEntries(Object.keys(G).filter((B=>G[B].enabled)).filter((B=>{var F;return(F=G[B].metadata)==null?void 0:F.payload})).map((B=>{var F;return[B,(F=G[B].metadata)==null?void 0:F.payload]})))):jn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),$})(u),b=y.flags,_=y.featureFlags,j=y.featureFlagPayloads;if(_){var E=u.requestId,k=u.evaluatedAt;if(nt(_)){jn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var A={};if(_)for(var C=0;_.length>C;C++)A[_[C]]=!0;f&&f.register({[yd]:_,[ha]:A})}else{var D=_,O=j,L=b;if(v!=null&&v.partialResponse)D=ye({},h,D),O=ye({},p,O),L=ye({},g,L);else if(u.errorsWhileComputingFlags)if(b){var I=new Set(Object.keys(b).filter(($=>{var G;return!((G=b[$])!=null&&G.failed)})));D=ye({},h,Object.fromEntries(Object.entries(D).filter(($=>{var[G]=$;return I.has(G)})))),O=ye({},p,Object.fromEntries(Object.entries(O||{}).filter(($=>{var[G]=$;return I.has(G)})))),L=ye({},g,Object.fromEntries(Object.entries(L||{}).filter(($=>{var[G]=$;return I.has(G)}))))}else D=ye({},h,D),O=ye({},p,O),L=ye({},g,L);f&&f.register(ye({[yd]:Object.keys(Sy(D)),[ha]:D||{},[_d]:O||{},[qm]:L||{}},E?{[Vm]:E}:{},k?{[vc]:k}:{}))}}})(e,this.Ur,s,l,c,n),t||(this.rs=!1),this.fs(t)}}override(e,t){t===void 0&&(t=!1),jn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Ur)return jn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.Ur.unregister(Os),this.Ur.unregister(gl),this.fs(),ia.info("All overrides cleared");if(nt(e)){var t=wy(e);return this.Ur.register({[Os]:t}),this.fs(),ia.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,s=e;if(this.Qn=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this.Ur.unregister(Os),ia.info("Flag overrides cleared");else if(s.flags){if(nt(s.flags)){var l=wy(s.flags);this.Ur.register({[Os]:l})}else this.Ur.register({[Os]:s.flags});ia.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.Ur.unregister(gl),ia.info("Payload overrides cleared")):s.payloads&&(this.Ur.register({[gl]:s.payloads}),ia.info("Payload overrides set",{payloads:s.payloads}))),void this.fs()}if(e&&typeof e=="object")return this.Ur.register({[Os]:e}),this.fs(),ia.info("Flag overrides set",{flags:e});jn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Jn){var{flags:t,flagVariants:n}=this.ps();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var s,l=(this.ns(Zo)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};l&&(u.$early_access_feature_name=l.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(s=this.Ur)==null||s.register({[yd]:Object.keys(Sy(f)),[ha]:f}),this.fs()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var s=this.ns(Zo),l=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+l),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.Ur)==null||u.unregister(Zo),(f=this.Ur)==null||f.register({[Zo]:h}),e(h)}}})}ps(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,s)=>(n[s]=t[s],n)),{})}}fs(e){var{flags:t,flagVariants:n}=this.ps();this.featureFlagEventHandlers.forEach((s=>s(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.ns(ca)||{},s=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),l=e==null?void 0:e.$set_once,c={};if(l)for(var u in l)({}).hasOwnProperty.call(l,u)&&(u in n||(c[u]=l[u]));this._instance.register({[ca]:ye({},n,c,s)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=ye({},this.ns(ca)||{});e.forEach((s=>{delete n[s]})),this._instance.register({[ca]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ca),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.ns(ua)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((s=>{n[s]=ye({},n[s],e[s]),delete e[s]})),this._instance.register({[ua]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.ns(ua)||{};this._instance.register({[ua]:ye({},t,{[e]:{}})})}else this._instance.unregister(ua)}reset(){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.$anon_distinct_id=void 0,this.vs(),this.Qn=!1}}},JC={sessionRecording:class{get Se(){return this._instance.config}get Ur(){return this._instance.persistence}get started(){var e;return!((e=this.gs)==null||!e.isStarted)}get status(){var e,t;return this.ys===Io||this.ys===cd?this.ys:(e=(t=this.gs)==null?void 0:t.status)!==null&&e!==void 0?e:this.ys}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=my,this.bs=void 0,this._instance=e,!this._instance.sessionManager)throw Ms.error("started without valid sessionManager"),new Error(fg+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===$s)throw new Error(fg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var e,t=!((e=this._instance.get_property(pa))==null||!e.enabled),n=!this.Se.disable_session_recording,s=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!s}startIfEnabledOrStop(e){var t;if(!this._s||(t=this.gs)==null||!t.isStarted){var n=!Se(Object.assign)&&!Se(Array.from);this._s&&n?(this.ws(e),Ms.info("starting")):(this.ys=my,this.stopRecording())}}ws(e){var t,n,s;this._s&&(this.ys!==Io&&this.ys!==cd&&(this.ys=gy),De!=null&&(t=De.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=De.__PosthogExtensions__)!=null&&n.initSessionRecording?this.xs(e):(s=De.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.ks,(l=>{if(l)return Ms.error("could not load recorder",l);this.xs(e)})))}stopRecording(){var e,t;(e=this.bs)==null||e.call(this),this.bs=void 0,(t=this.gs)==null||t.stop()}Ss(){var e,t;(e=this.bs)==null||e.call(this),this.bs=void 0,(t=this.gs)==null||t.discard()}Cs(){var e,t;(e=this.Ur)==null||e.unregister(Bg),(t=this.Ur)==null||t.unregister(B_)}Is(e,t){if(rt(e))return null;var n,s=Fn(e)?e:parseFloat(e);return typeof(n=s)!="number"||!Number.isFinite(n)||0>n||n>1?(Ms.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}Ts(e){if(this.Ur){var t,n,s=this.Ur,l=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Is((c=this.Se.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Is(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;rt(p)&&this.Cs();var g=u==null?void 0:u.minimumDurationMilliseconds;s.register({[pa]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({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:Se(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})})};l(),(t=this.bs)==null||t.call(this),this.bs=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.Ts(e),void this.Ss()):(this.Ts(e),void this.startIfEnabledOrStop()):(this.ys===Io&&(this.ys=cd,Ms.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.gs)!=null&&n.log?this.gs.log(e,t):Ms.warn("log called before recorder was ready")}get ks(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(pa);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Es(){var e,t,n=this._instance.get_property(pa);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(l){return Ms.warn("persisted remote config for session recording is invalid and will be ignored",l),!1}var s=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-s}xs(e){var t,n;if((t=De.__PosthogExtensions__)==null||!t.initSessionRecording)return Ms.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[V_]:!0});if(this.gs||(this.gs=(n=De.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es())return this.ys===cd||this.ys===Io?void 0:(this.ys=Io,Ms.info("persisted remote config is stale, requesting fresh config before starting"),void new hw(this._instance).load());this.ys=gy,this.gs.start(e)}onRRwebEmit(e){var t;(t=this.gs)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.gs||(t=this.Ur)==null||t.register({[U_]:!0}),(e=this.gs)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.gs||(t=this.Ur)==null||t.register({[P_]:!0}),(e=this.gs)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.gs||(n=this.Ur)==null||n.register({[e==="url"?$_:F_]:!0}),(t=this.gs)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.gs)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.gs)==null||!n.tryAddCustomEvent(e,t))}}},e4={autocapture:class{constructor(e){this.Ms=!1,this.Ps=null,this.Rs=!1,this.instance=e,this.rageclicks=new hy(e.config.rageclick),this.Os=null}initialize(){this.startIfEnabled()}get Se(){var e,t,n=$t(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),n}Ls(){if(this.isBrowserSupported()){if(re&&Ne){var e=n=>{n=n||(re==null?void 0:re.event);try{this.Fs(n)}catch(s){Ip.error("Failed to capture event",s)}};if(Xt(Ne,"submit",e,{capture:!0}),Xt(Ne,"change",e,{capture:!0}),Xt(Ne,"click",e,{capture:!0}),this.Se.capture_copied_text){var t=n=>{n=n||(re==null?void 0:re.event);try{this.Fs(n,Hp)}catch(s){Ip.error("Failed to capture copy/cut event",s)}};Xt(Ne,"copy",t,{capture:!0}),Xt(Ne,"cut",t,{capture:!0})}}}else Ip.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ms&&(this.Ls(),this.Ms=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Rs=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Bm]:!!e.autocapture_opt_out}),this.Ps=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Os=e}getElementSelectors(e){var t,n=[];return(t=this.Os)==null||t.forEach((s=>{var l=Ne==null?void 0:Ne.querySelectorAll(s);l==null||l.forEach((c=>{e===c&&n.push(s)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Bm];if($n(this.Ps)&&!cs(n)&&!this.instance.mr())return!1;var s=(t=this.Ps)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!s}Fs(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,s=Lp(e);Q_(s)&&(s=s.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())&&Vb(s,this.instance.config.rageclick)&&this.Fs(e,"$rageclick");var l=t===Hp;if(s&&(function(v,y,b,_,j){var E,k,A,C,D,O;if(b===void 0&&(b=void 0),!re||Hg(v)||(E=b)!=null&&E.url_allowlist&&!Hb(b.url_allowlist)||(k=b)!=null&&k.url_ignorelist&&Hb(b.url_ignorelist))return!1;if((A=b)!=null&&A.dom_event_allowlist){var L=b.dom_event_allowlist;if(L&&!L.some((F=>y.type===F)))return!1}var{parentIsUsefulElement:I,targetElementList:$}=J_(v,_);if(!(function(F,T){var le=T==null?void 0:T.element_allowlist;if(Se(le))return!0;var W,Y=function(z){if(le.some((se=>z.tagName.toLowerCase()===se)))return{v:!0}};for(var U of F)if(W=Y(U))return W.v;return!1})($,b)||!ng($,(C=b)==null?void 0:C.css_selector_allowlist)||ng($,(D=(O=b)==null?void 0:O.css_selector_ignorelist)!==null&&D!==void 0?D:eC))return!1;var G=re.getComputedStyle(v);if(G&&G.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var B=v.tagName.toLowerCase();switch(B){case"html":return!1;case"form":return(j||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(y.type)>=0;default:return I?(j||["click"]).indexOf(y.type)>=0:(j||["click"]).indexOf(y.type)>=0&&(Fg.indexOf(B)>-1||v.getAttribute("contenteditable")==="true")}})(s,e,this.Se,l,l?["copy","cut"]:void 0)){var{props:c,explicitNoCapture:u}=qC(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Rs});if(u)return!1;var f=this.getElementSelectors(s);if(f&&f.length>0&&(c.$element_selectors=f),t===Hp){var h,p=W_(re==null||(h=re.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return Ps(Ne==null?void 0:Ne.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.As=(re==null||(t=re.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(ke.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,ke.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.Ds("pushState"),this.Ds("replaceState"),this.Ns())}Ds(e){var t;if(re&&((t=re.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(s,l,c){try{if(!(l in s))return()=>{};var u=s[l],f=c(u);return Ps(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0}})),s[l]=f,()=>{s[l]===f&&(s[l]=u)}}catch{return()=>{}}})(re.history,e,(s=>function(l,c,u){s.call(this,l,c,u),n.qs(e)}))}}qs(e){try{var t,n=re==null||(t=re.location)==null?void 0:t.pathname;if(!n)return;n!==this.As&&this.isEnabled&&this._instance.capture(xl,{navigation_type:e}),this.As=n}catch(s){ke.error("Error capturing "+e+" pageview",s)}}Ns(){if(!this.$s){var e=()=>{this.qs("popstate")};Xt(re,"popstate",e),this.$s=()=>{re&&re.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(e){var t;this.js=!1,this.Ms=!1,this.Bs=null,this.instance=e,this.js=!((t=this.instance.persistence)==null||!t.props[Pm]),this.rageclicks=new hy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return $t(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(e=this.Se.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return rt(this.Se.capture_heatmaps)?rt(this.Se.enable_heatmaps)?this.js:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ms)return;GC.info("starting..."),this.Hs(),this.ke()}else{var e;clearInterval((e=this.Bs)!==null&&e!==void 0?e:void 0),this.Us(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Pm]:t}),this.js=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}zs(e){this.fe(e.originalEvent,"deadclick")}ke(){this.Bs&&clearInterval(this.Bs),this.Bs=(Ne==null?void 0:Ne.visibilityState)==="visible"?setInterval(this.Or.bind(this),this.flushIntervalMilliseconds):null}Hs(){re&&Ne&&(this.Vs=this.Or.bind(this),Xt(re,Hd,this.Vs),this.Ws=e=>this.fe(e||(re==null?void 0:re.event)),Xt(Ne,"click",this.Ws,{capture:!0}),this.Gs=e=>this.Zs(e||(re==null?void 0:re.event)),Xt(Ne,"mousemove",this.Gs,{capture:!0}),this.Qs=new Qb(this.instance,oC,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.ke.bind(this),Xt(Ne,Fd,this.Js),this.Ms=!0)}Us(){var e;re&&Ne&&(this.Vs&&re.removeEventListener(Hd,this.Vs),this.Ws&&Ne.removeEventListener("click",this.Ws,{capture:!0}),this.Gs&&Ne.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Js&&Ne.removeEventListener(Fd,this.Js),clearTimeout(this.Ys),(e=this.Qs)==null||e.stop(),this.Ms=!1)}Ks(e,t){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&Ei(p)&&!fr(p,"body");){if(p===h)return!1;if(Ie(f,re==null?void 0:re.getComputedStyle(p).position))return!0;p=K_(p)}return!1})(Lp(e),["fixed","sticky"],l);return{x:e.clientX+(c?0:s),y:e.clientY+(c?0:n),target_fixed:c,type:t}}fe(e,t){var n;if(t===void 0&&(t="click"),!Fb(e.target)&&xy(e)){var s=this.Ks(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Vb(Lp(e),this.instance.config.rageclick)&&this.Xs(ye({},s,{type:"rageclick"})),this.Xs(s)}}Zs(e){!Fb(e.target)&&xy(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout((()=>{this.Xs(this.Ks(e,"mousemove"))}),500))}Xs(e){if(re){var t=re.location.href,n=this.Se.custom_personal_data_properties,s=this.Se.mask_personal_data_properties?[...El,...n||[]]:[],l=_c(t,s,wc);this.R=this.R||{},this.R[l]||(this.R[l]=[]),this.R[l].push(e)}}Or(){this.R&&!ji(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Qb,webVitalsAutocapture:class{constructor(e){var t;this.js=!1,this.Ms=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,s)=>ye({},n,{["$web_vitals_"+s.name+"_event"]:ye({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.io=n=>{var s;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.no();if(!Se(l))if(rt(n==null?void 0:n.name)||rt(n==null?void 0:n.value))sa.error("Invalid metric received",n);else if(!this.so||this.so>n.value){this.R.url!==l&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),Se(this.R.url)&&(this.R.url=l),this.R.firstMetricTimestamp=Se(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),u=ye({},n,{$current_url:l,timestamp:Date.now()});Se(c)||(u.$session_id=c.sessionId,u.$window_id=c.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this.eo()}else sa.error("Ignoring metric with value >= "+this.so,n)},this.oo=()=>{if(!this.Ms){var n,s,l,c,u=De.__PosthogExtensions__;Se(u)||Se(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:s,onFCP:l,onINP:c}=u.postHogWebVitalsCallbacks),n&&s&&l&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.io.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.io.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.io.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.io.bind(this)),this.Ms=!0):sa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.js=!((t=this._instance.persistence)==null||!t.props[Hm]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=$t(this.ao)?(e=this.ao)==null?void 0:e.web_vitals_allowed_metrics:void 0;return rt(n)?((t=this._instance.persistence)==null?void 0:t.props[Im])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return($t(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=$t(this.ao)?this.ao.web_vitals_attribution:void 0;return e!=null&&e}get so(){var e=$t(this.ao)&&Fn(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:py;return e>0&&6e4>=e?py:e}get isEnabled(){var e=Nn==null?void 0:Nn.protocol;if(e!=="http:"&&e!=="https:")return sa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=$t(this.ao)?this.ao.web_vitals:cs(this.ao)?this.ao:void 0;return cs(t)?t:this.js}startIfEnabled(){this.isEnabled&&!this.Ms&&(sa.info("enabled, starting..."),this.Mt(this.oo))}onRemoteConfig(e){if("capturePerformance"in e){var t=$t(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$t(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Hm]:t}),this._instance.persistence.register({[Im]:n})),this.js=t,this.startIfEnabled()}}Mt(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?sa.error("failed to load script",s):e()}))}no(){var e=re?re.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...El,...t||[]]:[];return _c(e,n,wc)}sa.error("Could not determine current URL")}}},t4={exceptionObserver:class{constructor(e){var t,n,s;this.oo=()=>{var l;if(re&&this.isEnabled&&(l=De.__PosthogExtensions__)!=null&&l.errorWrappingFunctions){var c=De.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=De.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=De.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lo&&this.Se.capture_unhandled_errors&&(this.lo=c(this.captureException.bind(this))),!this.uo&&this.Se.capture_unhandled_rejections&&(this.uo=u(this.captureException.bind(this))),!this.ho&&this.Se.capture_console_errors&&(this.ho=f(this.captureException.bind(this)))}catch(h){Ho.error("failed to start",h),this.do()}}},this._instance=e,this.co=!((t=this._instance.persistence)==null||!t.props[Um]),this.vo=new r3({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,Ae:Ho}),this.Se=this.fo(),this.startIfEnabledOrStop()}fo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $t(e)?t=ye({},t,e):(Se(e)?this.co:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ho.info("enabled"),this.do(),this.Mt(this.oo)):this.do()}Mt(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return Ho.error("failed to load script",s);e()}))}do(){var e,t,n;(e=this.lo)==null||e.call(this),this.lo=void 0,(t=this.uo)==null||t.call(this),this.uo=void 0,(n=this.ho)==null||n.call(this),this.ho=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.co=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Um]:this.co}),this.Se=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.fo()}captureException(e){var t,n,s,l=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.vo.consumeRateLimit(l)?Ho.info("Skipping exception capture because of client rate limiting.",{exception:l}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.po=[],this.mo=new b3([new C3,new O3,new T3,new E3,new D3,new L3,new M3,new z3],(function(s){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
|
|
64
|
+
`),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=Bb.test(y)?y.replace(Bb,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var j=_(b,s);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(E){if(!E.length)return[];var k=Array.from(E);return k.reverse(),k.slice(0,50).map((A=>{return ye({},A,{filename:A.filename||(C=k,C[C.length-1]||{}).filename,function:A.function||Cl});var C}))})(p)}})("web:javascript",S3,N3)),this._instance=e,this.po=(t=(n=this._instance.persistence)==null?void 0:n.get_property($m))!==null&&t!==void 0?t:[],this.yo=Bd(this.bo()),this._o=new P3(this.yo)}onConfigChange(){this.yo=Bd(this.bo()),this._o.setConfig(this.yo)}onRemoteConfig(e){var t,n,s;if("errorTracking"in e){var l=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.po=l,this._instance.persistence&&this._instance.persistence.register({[$m]:this.po,[Fm]:c})}}get wo(){var e,t=!!this._instance.get_property(Fm),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.mo.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.yo.enabled)try{if(!Bt(e)||e.trim().length===0)return void Rs.warn("Ignoring exception step because message must be a non-empty string");var n=this.xo(t),{sanitizedProperties:s,droppedKeys:l}=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(c).reduce(((f,h)=>B3.has(h)?(u.push(h),f):(f[h]=c[h],f)),{}),droppedKeys:u}})(n);l.length>0&&Rs.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this._o.add(ye({[zd]:e,[Od]:new Date().toISOString()},s))}catch(c){Rs.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.ko(t)){if(this.So(t))return this.Co("Exception dropped: matched a suppression rule"),void Rs.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void Rs.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Rs.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.yo.enabled&&rt(e.$exception_steps)?this.Eo(e):e;try{var s=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Gi:!0});return s&&this._o.clear(),s}catch(l){return Rs.error("Failed to capture exception event. Dropping this exception.",l),void this._o.clear()}}catch(l){return void Rs.error("Failed to process exception event. Ignoring this exception.",l)}}Eo(e){try{var t=this._o.getAttachable();return t.length===0?e:ye({},e,{$exception_steps:t})}catch(n){return Rs.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Co(e){this.yo.enabled&&this._o.add({[zd]:e,[Od]:new Date().toISOString()})}xo(e){return $t(e)?ye({},e):{}}bo(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}So(e){if(e.length===0)return!1;var t=e.reduce(((n,s)=>{var{type:l,value:c}=s;return Bt(l)&&l.length>0&&n.$exception_types.push(l),Bt(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.po.some((n=>{var s=n.values.map((l=>{var c,u=ww[l.operator],f=nt(l.value)?l.value:[l.value],h=(c=t[l.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?s.some(Boolean):s.every(Boolean)}))}Io(e){return e.flatMap((t=>{var n,s;return(n=(s=t.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}To(e){if(e.length>0){var t,n,s,l,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(s=u==null||(l=u.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ko(e){return!rt(e)&&nt(e)}}},n4=ye({productTours:class{get Ur(){return this._instance.persistence}constructor(e){this.Mo=null,this.Po=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,n;if(this.Ur&&this.Ur.register({[Og]:!!e.productTours}),!Gp(this._instance))return!this.Mo&&rt((t=this.Ur)==null?void 0:t.props[Jo])||Vp.info("product tours disabled; stopping and clearing cached tours"),(n=this.Mo)==null||n.stop(),this.Mo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Mo&&Gp(this._instance)&&this.Mt((()=>this.Ro()))}Mt(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(s=>{s?Vp.error("Could not load product tours script",s):e()}))}Ro(){var e;!this.Mo&&(e=De.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Mo=De.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!nt(this.Po)||t){var n=this.Ur;if(n){var s=n.props[Jo];if(nt(s)&&!t)return this.Po=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:l=>{if(Gp(this._instance)){var c=l.statusCode;if(c!==200||!l.json){var u="Product Tours API could not be loaded, status: "+c;return Vp.error(u),void e([],{isLoaded:!1,error:u})}var f=nt(l.json.product_tours)?l.json.product_tours:[];this.Po=f,n&&n.register({[Jo]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}getActiveProductTours(e){rt(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Mo)==null||t.showTourById(e)}previewTour(e){this.Mo?this.Mo.previewTour(e):this.Mt((()=>{var t;this.Ro(),(t=this.Mo)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Mo)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Mo)==null||e.nextStep()}previousStep(){var e;(e=this.Mo)==null||e.previousStep()}clearCache(){var e;this.Po=null,(e=this.Ur)==null||e.unregister(Jo)}resetTour(e){var t;(t=this.Mo)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Mo)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Mo)==null||t.cancelPendingTour(e)}}},af),r4={siteApps:class{constructor(e){this.Oo=0,this._instance=e,this.Lo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Fo(e,t){if(t){var n=this.globalsForEvent(t);this.Lo.push(n),this.Lo.length>1e3&&(this.Lo=this.Lo.slice(10))}}get siteAppLoaders(){var e;return(e=De._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.Fo.bind(this));this.Ao=()=>{e(),this.Lo=[],this.Ao=void 0}}}globalsForEvent(e){var t,n,s,l,c,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[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},r_(e,YC),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(s=(l=e.properties)==null?void 0:l.$set_once)!==null&&s!==void 0?s:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}$o(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)||(rs.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)||(rs.error("prepare_external_dependency_script returned null"),null):e}Do(){var e,t,n,s,l,c,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ne==null?void 0:Ne.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Oo++,this.No)return this.qo();var g=[],v=this,y=new WeakSet,b=(E,k,A)=>{if(E!=null&&E[k]){var C=E[k];E[k]=A(C),g.push((()=>{E[k]=C}))}},_=E=>{if(y.has(E))return E;var k=v.$o(E);return k&&y.add(k),k},j=E=>E.map((k=>typeof k=="string"?k:_(k))).filter((k=>!$n(k)));return b(p,"appendChild",(E=>function(k){var A=_(k);return A?E.call(this,A):k})),b(p,"insertBefore",(E=>function(k,A){var C=_(k);return C?E.call(this,C,A):k})),b(p,"replaceChild",(E=>function(k,A){var C=_(k);return C?E.call(this,C,A):A})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(s=h.DocumentFragment)==null?void 0:s.prototype].forEach((E=>{b(E,"append",(k=>function(){for(var A=arguments.length,C=new Array(A),D=0;A>D;D++)C[D]=arguments[D];return k.apply(this,j(C))})),b(E,"prepend",(k=>function(){for(var A=arguments.length,C=new Array(A),D=0;A>D;D++)C[D]=arguments[D];return k.apply(this,j(C))}))})),[(l=h.Element)==null?void 0:l.prototype,(c=h.CharacterData)==null?void 0:c.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((E=>{b(E,"before",(k=>function(){for(var A=arguments.length,C=new Array(A),D=0;A>D;D++)C[D]=arguments[D];return k.apply(this,j(C))})),b(E,"after",(k=>function(){for(var A=arguments.length,C=new Array(A),D=0;A>D;D++)C[D]=arguments[D];return k.apply(this,j(C))})),b(E,"replaceWith",(k=>function(){for(var A=arguments.length,C=new Array(A),D=0;A>D;D++)C[D]=arguments[D];var O=j(C);return C.length&&!O.length?void 0:k.apply(this,O)}))})),b((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(E=>function(k,A){var C=_(A);return C?E.call(this,k,C):null})),this.No=()=>{g.forEach((E=>E())),this.No=void 0},this.qo()}qo(){var e=!1;return()=>{var t;e||(e=!0,this.Oo--,this.Oo===0&&((t=this.No)==null||t.call(this)))}}jo(e,t){t===void 0&&(t=!0);var n=this.Do();try{var s=e(n);return t&&n(),s}catch(l){throw n(),l}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.Lo.length&&(rs.info("Processing "+this.Lo.length+" events for site app with id "+e.id),this.Lo.forEach((f=>this.jo((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.Ao)==null||u.call(this))},s=!1,l=u=>{t.errored=!u,t.loaded=!0,rs.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),s&&n()};try{var{processEvent:c}=this.jo((u=>e.init({posthog:this._instance,callback(f){u(),l(f)}})),!1);c&&(t.processEvent=c),s=!0}catch(u){rs.error(vy+e.id,u),l(!1)}if(s&&t.loaded)try{n()}catch(u){rs.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Bo(){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)}Ho(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),s=function(c){try{t.jo((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(u){rs.error("Error while processing event "+e.event+" for site app "+c.id,u)}};for(var l of Object.values(this.apps))s(l)}}onRemoteConfig(e){var t,n,s,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Bo(),void this._instance.on("eventCaptured",(h=>this.Ho(h)))):void rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ao)==null||n.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var c=function(h){var p;De["__$$ph_site_app_"+h]=l._instance,(p=De.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(l._instance,f,(g=>{if(g)return rs.error(vy+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},s4={tracingHeaders:class{constructor(e){this.Uo=void 0,this.zo=void 0,this.Vo=void 0,this.oo=()=>{var t,n,s=this.Wo();s?(Se(this.Uo)&&(this.Uo=(t=De.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Se(this.zo)&&(this.zo=(n=De.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.do()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Mt(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return VC.error("failed to load script",s);e()}))}Go(){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}Wo(){var e=this.Go();return nt(e)?(nt(this.Vo)?this.Vo.splice(0,this.Vo.length,...e):this.Vo=[...e],e.length>0?this.Vo:void 0):(nt(this.Vo)&&this.Vo.splice(0),this.Vo=e||void 0,this.Vo)}do(){var e,t;(e=this.Uo)==null||e.call(this),(t=this.zo)==null||t.call(this),this.Uo=void 0,this.zo=void 0}startIfEnabledOrStop(){this.Wo()?this.Mt(this.oo):this.do()}}},i4=ye({surveys:class{get Se(){return this._instance.config}constructor(e){this.Zo=void 0,this._surveyManager=null,this.Qo=!1,this.Jo=[],this.Yo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Se.disable_surveys){var t=e.surveys;if(rt(t))return Nt.warn("Flags not loaded yet. Not loading surveys.");var n=nt(t);this.Zo=n?t.length>0:t,Nt.info("flags response received, isSurveysEnabled: "+this.Zo),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 s=localStorage.key(n);(s!=null&&s.startsWith(ug)||s!=null&&s.startsWith("inProgressSurvey_"))&&t.push(s)}t.forEach((l=>localStorage.removeItem(l)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Qo)Nt.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)Nt.info(by);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())Nt.info("Not loading surveys in cookieless mode without consent.");else{var e=De==null?void 0:De.__PosthogExtensions__;if(e){if(!Se(this.Zo)||this.Se.advanced_enable_surveys){var t=this.Zo||this.Se.advanced_enable_surveys;this.Qo=!0;try{var n=e.generateSurveys;if(n)return void this.Ko(n,t);var s=e.loadExternalDependency;if(!s)return void this.Xo(eg);s(this._instance,"surveys",(l=>{l||!e.generateSurveys?this.Xo("Could not load surveys script",l):this.Ko(e.generateSurveys,t)}))}catch(l){throw this.Xo("Error initializing surveys",l),l}finally{this.Qo=!1}}}else Nt.error("PostHog Extensions not found.")}}Ko(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new WC(this._instance),Nt.info("Surveys loaded successfully"),this.ea({isLoaded:!0})}Xo(e,t){Nt.error(e,t),this.ea({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Jo.push(e),this._surveyManager&&this.ea({isLoaded:!0}),()=>{this.Jo=this.Jo.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Se.disable_surveys)return Nt.info(by),e([]);var n,s=this._instance.get_property(Gm);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.Yo?this.Yo.then((l=>{var{surveys:c,context:u}=l;return e(c,u)})):(typeof Promise<"u"&&(this.Yo=new Promise((l=>{n=l}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:l=>{var c;this.Yo=null;var u=l.statusCode;if(u!==200||!l.json){var f="Surveys API could not be loaded, status: "+u;Nt.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=l.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var j;return!((j=_.conditions)==null||(j=j.events)==null||(j=j.values)==null||!j.length)})(b)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[Gm]:g,[Pg]:Date.now()});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}ea(e){for(var t of this.Jo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Nt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Nt.warn("init was not called")}ta(e){var t=null;return this.getSurveys((n=>{var s;t=(s=n.find((l=>l.id===e)))!==null&&s!==void 0?s:null})),t}ra(e){if(rt(this._surveyManager))return{eligible:!1,reason:Yp};var t=typeof e=="string"?this.ta(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(rt(this._surveyManager))return Nt.warn("init was not called"),{visible:!1,disabledReason:Yp};var t=this.ra(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return rt(this._surveyManager)?(Nt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Yp})):new Promise((n=>{this.getSurveys((s=>{var l,c=(l=s.find((f=>f.id===e)))!==null&&l!==void 0?l:null;if(c){var u=this.ra(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var s;if(rt(this._surveyManager))Nt.warn("init was not called");else{var l=typeof e=="string"?this.ta(e):e;if(l!=null&&l.id)if(OC.includes(l.type)){var c=Ne==null?void 0:Ne.querySelector(t);if(c)return(s=l.appearance)!=null&&s.surveyPopupDelaySeconds?(Nt.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Nt.info("Rendering survey "+l.id+" with delay of "+((u=l.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(l,c,n),Nt.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,c,n);Nt.warn("Survey element not found")}else Nt.warn("Surveys of type "+l.type+" cannot be rendered in the app");else Nt.warn("Survey not found")}}displaySurvey(e,t){var n;if(rt(this._surveyManager))Nt.warn("init was not called");else{var s=this.ta(e);if(s){var l=s;if((n=s.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=ye({},s,{appearance:ye({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==sg.Popover&&t.initialResponses&&Nt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(s);if(!c.visible)return void Nt.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==sg.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else Nt.warn("Survey not found")}}cancelPendingSurvey(e){rt(this._surveyManager)?Nt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},af),a4={toolbar:class{constructor(e){this.instance=e}ia(e){De.ph_toolbar_state=e}na(){var e;return(e=De.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),G_(this.instance.config)||!re||!Ne)return!1;e=e??re.location,n=n??re.history;try{if(!t){try{re.localStorage.setItem("test","test"),re.localStorage.removeItem("test")}catch{return!1}t=re==null?void 0:re.localStorage}var s,l=KC||Gd(e.hash,"__posthog")||Gd(e.hash,"state"),c=l?Ub((()=>JSON.parse(atob(decodeURIComponent(l)))))||Ub((()=>JSON.parse(decodeURIComponent(l)))):null;return c&&c.action==="ph_authorize"?((s=c).source="url",s&&Object.keys(s).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(yy)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}sa(e){var t=De.ph_load_toolbar||De.ph_load_editor;!rt(t)&&Ps(t)?t(e,this.instance):_y.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ne==null||!Ne.getElementById(H_));if(!re||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(yy,JSON.stringify(ye({},s,{source:void 0}))),this.na()===2)this.sa(s);else if(this.na()===0){var l;this.ia(1),(l=De.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return _y.error("[Toolbar] Failed to load",c),void this.ia(0);this.ia(2),this.sa(s)})),Xt(re,"turbolinks:load",(()=>{this.ia(0),this.loadToolbar(s)}))}return!0}oa(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)}}},l4=ye({experiments:Mn},af),o4=ye({},af,JC,e4,t4,n4,r4,i4,s4,a4,l4,{conversations:class{constructor(e){this.aa=void 0,this._conversationsManager=null,this.la=!1,this.ua=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;rt(t)||(cs(t)?this.aa=t:(this.aa=t.enabled,this.ua=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.aa=void 0,this.ua=null}loadIfEnabled(){if(!(this._conversationsManager||this.la||this._instance.config.disable_conversations||G_(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=De==null?void 0:De.__PosthogExtensions__;if(e&&!Se(this.aa)&&this.aa)if(this.ua&&this.ua.token){this.la=!0;try{var t=e.initConversations;if(t)return this.ha(t),void(this.la=!1);var n=e.loadExternalDependency;if(!n)return void this.da(eg);n(this._instance,"conversations",(s=>{s||!e.initConversations?this.da("Could not load conversations script",s):this.ha(e.initConversations),this.la=!1}))}catch(s){this.da("Error initializing conversations",s),this.la=!1}}else Tr.error("Conversations enabled but missing token in remote config.")}}ha(e){if(this.ua)try{this._conversationsManager=e(this.ua,this._instance),Tr.info("Conversations loaded successfully")}catch(t){this.da("Error completing conversations initialization",t)}else Tr.error("Cannot complete initialization: remote config is null")}da(e,t){Tr.error(e,t),this._conversationsManager=null,this.la=!1}show(){this._conversationsManager?this._conversationsManager.show():Tr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.aa===!0&&!$n(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 s=this;return vn((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,n):(Tr.warn(aa),null)}))()}getMessages(e,t){var n=this;return vn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Tr.warn(aa),null)}))()}markAsRead(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Tr.warn(aa),null)}))()}getTickets(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Tr.warn(aa),null)}))()}requestRestoreLink(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Tr.warn(aa),null)}))()}restoreFromToken(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Tr.warn(aa),null)}))()}restoreFromUrlToken(){var e=this;return vn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Tr.warn(aa),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}Xi(){var e;(e=this._conversationsManager)==null||e.setIdentity()}en(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.ca=!1,this.va=!1,this.Ae=Gt("[logs]"),this._r=[],this.fa=[],this.pa=()=>{var n,s;(n=this.ga)==null||n.onReconnect(),(s=this.ma)==null||s.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ca=!0),re&&Xt(re,"online",this.pa)}ya(e,t,n,s){var l,c=(function(u,f){var h,p,g,v,y,b,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,E=(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,A=Se(k)?Math.max(E,2048):Math.max(E,k),C=u==null?void 0:u.resourceAttributes;return{serviceName:(v=(y=C==null?void 0:C["service.name"])!==null&&y!==void 0?y:u==null?void 0:u.serviceName)!==null&&v!==void 0?v:f==null?void 0:f.serviceNameDefault,serviceVersion:(b=C==null?void 0:C["service.version"])!==null&&b!==void 0?b:u==null?void 0:u.serviceVersion,environment:(_=C==null?void 0:C["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:C,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:E,maxQueueSize:A,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((l=this._instance)==null||(l=l.config)==null?void 0:l.logs,n);return[new x3(this.ba(e,t),c,this.Ae,(()=>this._a()),(u=>u()),void 0,s),c]}wa(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.ga&&this.xa===n||((t=this.ga)==null||t.reset(),this.xa=n,[this.ga,this.ka]=this.ya((()=>this._r),(s=>{this._r=s}))),this.ga}Sa(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.ma&&this.Ca===n||((t=this.ma)==null||t.reset(),this.Ca=n,[this.ma,this.Ia]=this.ya((()=>this.fa),(s=>{this.fa=s}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},jy)),this.ma}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!rt(n)&&n&&(this.ca=!0,this.loadIfEnabled())}reset(){var e,t;this._r=[],(e=this.ga)==null||e.reset(),this.fa=[],(t=this.ma)==null||t.reset()}captureLog(e){this.wa().captureLog(e)}le(e){this.Sa().captureLog(e)}get logger(){return this.Ta||(this.Ta={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.Ta}flushLogs(e){e?this.Ea(e):(this.ga&&this.ga.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.ma&&this.ma.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.ca&&!this.va){var e=De==null?void 0:De.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var s;n||(s=e.logs)==null||!s.initializeLogs?this.Ae.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.va=!0)})):this.Ae.error(eg)}else this.Ae.error("PostHog Extensions not found.")}}ba(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:s=>s===Bs.LogsQueue?e():void 0,setPersistedProperty(s,l){var c;s===Bs.LogsQueue&&t((c=l)!==null&&c!==void 0?c:[])},ht:s=>this.ht(s),getLibraryId:()=>Zt.LIB_NAME,getLibraryVersion:()=>Zt.LIB_VERSION}}ht(e){return new Promise((t=>{var n=!1,s=c=>{n||(n=!0,clearTimeout(l),t(c))},l=setTimeout((()=>s({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Ma(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(c){var u=c.statusCode;if(u>=200&&300>u)s({kind:"ok"});else if(u===413)s({kind:"too-large"});else if(u!==0&&u!==429&&500>u)s({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;s({kind:"retry-later",error:(f=c.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}))}Ea(e){this._r.length>0&&this.Pa(e,this._r,this.ka,Zt.LIB_NAME,(t=>{this._r=t})),this.fa.length>0&&this.Pa(e,this.fa,this.Ia,jy,(t=>{this.fa=t}))}Pa(e,t,n,s,l){if(t.length!==0){var c=t.map((f=>f.record));l([]);var u=R_(c,M_(n,Zt.LIB_NAME,Zt.LIB_VERSION),s,Zt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ma(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Ma(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_a(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(De!=null&&(e=De.location)!=null&&e.href&&(t.currentUrl=De.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}});Lr.__defaultExtensionClasses=ye({},o4);var Sc=(function(){Zt.SDK_DIST_CHANNEL="npm";var e=oc[vl]=new Lr;return(function(){function t(){t.done||(t.done=!0,jw=!1,At(oc,(function(n){n._dom_loaded()})))}Ne!=null&&Ne.addEventListener?Ne.readyState==="complete"?t():Xt(Ne,"DOMContentLoaded",t,{capture:!1}):re&&ke.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const c4="https://us.i.posthog.com",Nw="cc-telemetry-enabled";let hg=!1,kc=!1;function u4(){return c4}function d4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(Nw);return e===null?!0:e==="true"}function Cw(e){hg&&(e?(Sc.opt_in_capturing({captureEventName:null}),kc=!0):(Sc.opt_out_capturing(),kc=!1))}function $L(e){typeof localStorage<"u"&&localStorage.setItem(Nw,String(e)),Cw(e)}function f4(){const e=void 0;return e?(Sc.init(e,{api_host:u4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),hg=!0,Cw(d4()),!0):(hg=!1,kc=!1,!1)}function Gg(e,t){kc&&Sc.capture(e,t)}function Ti(e,t){kc&&Sc.captureException(e,t)}function h4(e){Gg("$pageview",{$current_url:e})}const us="/api",Ew="companion_auth_token";function Ai(){if(typeof window>"u")return{};const e=localStorage.getItem(Ew);return e?{Authorization:`Bearer ${e}`}:{}}function va(e){e===401&&typeof window<"u"&&(localStorage.removeItem(Ew),Jn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>Oj);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function cn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Tc(e,t,n,s){Gg("api_request_succeeded",{method:e,path:t,status:s,duration_ms:Math.round(n)})}function ds(e,t,n,s,l){Gg("api_request_failed",{method:e,path:t,status:l,duration_ms:Math.round(n),error:s instanceof Error?s.message:String(s)}),Ti(s,{method:e,path:t,status:l})}async function He(e,t){const n=cn();let s=!1;try{const l=await fetch(`${us}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ai()},body:t?JSON.stringify(t):void 0});if(!l.ok){va(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ds("POST",e,cn()-n,u,l.status),s=!0,u}return Tc("POST",e,cn()-n,l.status),l.json()}catch(l){throw s||ds("POST",e,cn()-n,l),l}}async function Me(e){const t=cn();let n=!1;try{const s=await fetch(`${us}${e}`,{headers:{...Ai()}});if(!s.ok){va(s.status);const l=await s.json().catch(()=>({error:s.statusText})),c=new Error(l.error||s.statusText);throw ds("GET",e,cn()-t,c,s.status),n=!0,c}return Tc("GET",e,cn()-t,s.status),s.json()}catch(s){throw n||ds("GET",e,cn()-t,s),s}}async function Ar(e,t){const n=cn();let s=!1;try{const l=await fetch(`${us}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ai()},body:t?JSON.stringify(t):void 0});if(!l.ok){va(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ds("PUT",e,cn()-n,u,l.status),s=!0,u}return Tc("PUT",e,cn()-n,l.status),l.json()}catch(l){throw s||ds("PUT",e,cn()-n,l),l}}async function p4(e,t){const n=cn();let s=!1;try{const l=await fetch(`${us}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ai()},body:t?JSON.stringify(t):void 0});if(!l.ok){va(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ds("PATCH",e,cn()-n,u,l.status),s=!0,u}return Tc("PATCH",e,cn()-n,l.status),l.json()}catch(l){throw s||ds("PATCH",e,cn()-n,l),l}}async function Mr(e,t){const n=cn();let s=!1;try{const l=await fetch(`${us}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ai()},body:t?JSON.stringify(t):void 0});if(!l.ok){va(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ds("DELETE",e,cn()-n,u,l.status),s=!0,u}return Tc("DELETE",e,cn()-n,l.status),l.json()}catch(l){throw s||ds("DELETE",e,cn()-n,l),l}}async function m4(e,t){const n=await fetch(`${us}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ai()},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 s=n.body.getReader(),l=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await s.read();if(f)break;c+=l.decode(h,{stream:!0});const p=c.split(`
|
|
65
|
+
|
|
66
|
+
`);c=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",y="";for(const _ of g.split(`
|
|
67
|
+
`))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function g4(){try{const e=await fetch(`${us}/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 Ny(e){try{const t=await fetch(`${us}/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 we={getAuthQr:()=>Me("/auth/qr"),getAuthToken:()=>Me("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>Me("/sessions"),discoverClaudeSessions:(e=200)=>Me(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),s=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Me(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(s))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Mr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${us}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ai()}});if(!n.ok)throw va(n.status),new Error(`Export failed (${n.status})`);const s=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:s,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Me(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>p4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Me(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Me("/fs/home"),listEnvs:()=>Me("/envs"),getEnv:e=>Me(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Ar(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Mr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Me("/sandboxes"),getSandbox:e=>Me(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Ar(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Mr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>Me("/docker/base-image"),getSettings:()=>Me("/settings"),updateSettings:e=>Ar("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Me("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>Me("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Ar(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Mr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Me(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Me(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Me(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Me(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Me(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Me(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Ar("/linear/project-mappings",e),removeLinearProjectMapping:e=>Mr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Ar(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Mr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Me(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Me(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Me(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>Me(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Mr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Me(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Me("/backends"),getBackendModels:e=>Me(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Me("/containers/status"),getContainerImages:()=>Me("/containers/images"),getImageStatus:e=>Me(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Me(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Me(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Me(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${us}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ai()}});if(!t.ok){va(t.status);const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Ar("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Me(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Me(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Me(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Ar("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Me(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Me("/usage-limits"),getSessionUsageLimits:e=>Me(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Me("/system/memory"),spawnTerminal:(e,t,n,s)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:s==null?void 0:s.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>Me(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Me("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>Me("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Me("/cron/jobs"),getCronJob:e=>Me(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Ar(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Mr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Me(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Me(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Me("/agents"),getAgent:e=>Me(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Ar(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Mr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Me(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>Me(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/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 Me(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Me(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const s=n.toString();return Me(`/linear/oauth/authorize-url${s?`?${s}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>Me(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Mr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Me("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Ar(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Mr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Me(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Me("/skills"),sendSessionMessage:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const s=n.toString();return Me(`/prompts${s?`?${s}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Ar(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Mr(`/prompts/${encodeURIComponent(e)}`)};let Cy=!1;function Ey(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.position="fixed",s.style.left="-9999px",document.body.appendChild(s),s.select();const l=document.execCommand("copy");if(document.body.removeChild(s),!l){n(new Error("Copy command was rejected"));return}t()}catch(s){n(s instanceof Error?s:new Error("Clipboard copy failed"))}})}function Ty(){return new Promise(()=>{})}function x4(){if(Cy||typeof window>"u")return;Cy=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async s=>{try{await n(s)}catch{try{await Ey(s)}catch{return Ty()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Ey(n)}catch{return Ty()}}}})}catch{}}const Ay="#/session/",My="#/agents/";let Ry=!1;function Yg(){Ry||(x4(),Ry=!0)}function Qg(e){if(Yg(),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(My)){const n=e.slice(My.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(Ay)){const n=e.slice(Ay.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function v4(e){return`#/session/${e}`}function Xg(e,t=!1){Yg();const n=v4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Xp(e=!1){Yg(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function b4(){const[e,t]=S.useState(""),[n,s]=S.useState(null),[l,c]=S.useState(!1),u=X(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){s("Please enter a token");return}c(!0),s(null),await Ny(v)?u(v):s("Invalid token"),c(!1)},[e,u]);S.useEffect(()=>{g4().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),Ny(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else s("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=S.useState(!1);return a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:a.jsxs("div",{className:"w-full max-w-sm px-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),a.jsxs("form",{onSubmit:f,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),s(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:l}),a.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&&a.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),a.jsx("button",{type:"submit",disabled:l||!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:l?"Verifying...":"Login"})]}),a.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 Ll=I5();function y4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:s,archiveTransitionStateName:l,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Ll.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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&&a.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.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:a.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"})}),a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),a.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",a.jsx("strong",{className:"text-cc-fg",children:e})," ",a.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),a.jsxs("fieldset",{className:"space-y-2 mb-4",children:[a.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),a.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:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),a.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),s&&l&&a.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:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),a.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",l]})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.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"}),a.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 _4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function w4({status:e}){switch(e){case"running":return a.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function S4({type:e}){return e==="codex"?a.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"}):a.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 jd({session:e,isActive:t,isArchived:n,sessionName:s,permCount:l,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:j,onCancelRename:E,editInputRef:k}){const A=e.id.slice(0,8),C=s||e.model||A,D=y===e.id,[O,L]=S.useState(!1),I=S.useRef(null),$=S.useRef(null),G=n?"exited":_4(e,l),B=e.cwd||"";S.useEffect(()=>{if(!O)return;function T(W){var Y;I.current&&!I.current.contains(W.target)&&$.current&&!$.current.contains(W.target)&&(L(!1),(Y=$.current)==null||Y.focus())}function le(W){var Y,U,z;if(W.key==="Escape"){L(!1),(Y=$.current)==null||Y.focus();return}if(W.key==="Tab"){L(!1);return}if((W.key==="ArrowDown"||W.key==="ArrowUp")&&((U=I.current)!=null&&U.contains(document.activeElement)||$.current===document.activeElement)){W.preventDefault();const se=(z=I.current)==null?void 0:z.querySelectorAll("[role='menuitem']");if(!se||se.length===0)return;const me=document.activeElement,R=Array.from(se).indexOf(me);W.key==="ArrowDown"?se[R<se.length-1?R+1:0].focus():se[R>0?R-1:se.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",le),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",le)}},[O]),S.useEffect(()=>{O&&requestAnimationFrame(()=>{var T,le;(le=(T=I.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||le.focus()})},[O]);const F=S.useCallback(T=>{L(!1),T()},[]);return a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),f(e.id,C)},onKeyDown:T=>{T.key==="F2"&&!D&&(T.preventDefault(),f(e.id,C))},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:[a.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&&a.jsx(w4,{status:G}),D?a.jsx("input",{ref:k,value:b,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),E()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.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"}):a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:C}),B&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:B})]}),!D&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(S4,{type:e.backendType}),e.isContainerized&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:a.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:a.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&&a.jsx("button",{onClick:T=>{T.stopPropagation(),h(T,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})})}),a.jsx("button",{ref:$,onClick:T=>{T.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:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),O&&a.jsxs("div",{ref:I,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&&a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>F(()=>f(e.id,C)),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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.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?a.jsxs(a.Fragment,{children:[a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>F(()=>p(T,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:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[a.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"}),a.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"]}),a.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>F(()=>g(T,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:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[a.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"}),a.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"]})]}):a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>F(()=>h(T,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.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 k4({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:s,sessionNames:l,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:j,onConfirmRename:E,onCancelRename:k,editInputRef:A,isFirst:C}){const D=t?e.sessions.slice(0,2).map(O=>l.get(O.id)||O.model||O.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return a.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),a.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&D&&a.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:D}),!t&&a.jsx("div",{className:"mt-0.5",children:e.sessions.map(O=>{var I;const L=((I=c.get(O.id))==null?void 0:I.size)??0;return a.jsx(jd,{session:O,isActive:s===O.id,sessionName:l.get(O.id),permCount:L,isRecentlyRenamed:u.has(O.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:j,onConfirmRename:E,onCancelRename:k,editInputRef:A},O.id)})})]})}function j4(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function N4(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function C4(e){const t=new Map;for(const s of e){const l=j4(s.cwd,s.repoRoot||void 0,s.isContainerized),c=N4(l);t.has(l)||t.set(l,{key:l,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(l);u.sessions.push(s),s.status==="running"&&u.runningCount++,u.permCount+=s.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,s.createdAt)}const n=Array.from(t.values()).sort((s,l)=>s.label.localeCompare(l.label));for(const s of n)s.sessions.sort((l,c)=>c.createdAt-l.createdAt);return n}const E4=[{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"}],T4=[{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"}],A4=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],M4=new Map(T4.map(e=>[e.id,e]));function R4(){var Br,Pr;const[e,t]=S.useState(null),[n,s]=S.useState(""),[l,c]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(null),[y,b]=S.useState(!1),[_,j]=S.useState(null),[E,k]=S.useState(!1),[A,C]=S.useState(()=>typeof window<"u"?window.location.hash:""),D=S.useRef(null),O=S.useRef(null),L=X(te=>te.sessions),I=X(te=>te.sdkSessions),$=X(te=>te.currentSessionId),G=X(te=>te.cliConnected),B=X(te=>te.cliReconnecting),F=X(te=>te.sessionStatus),T=X(te=>te.removeSession),le=X(te=>te.sessionNames),W=X(te=>te.recentlyRenamed),Y=X(te=>te.clearRecentlyRenamed),U=X(te=>te.pendingPermissions),z=X(te=>te.linkedLinearIssues),se=X(te=>te.collapsedProjects),me=X(te=>te.toggleProjectCollapse),R=Qg(A);S.useEffect(()=>{let te=!0;async function pe(){try{const Qe=await we.listSessions();if(te){const Dt=X.getState();Dt.setSdkSessions(Qe);const nn=X.getState(),Tn=new Set(Qe.map(zt=>zt.sessionId));for(const zt of nn.sessions.keys())!Tn.has(zt)&&nn.connectionStatus.get(zt)!=="connected"&&nn.removeSession(zt);PN(Qe);for(const zt of Qe)if(zt.name&&(!Dt.sessionNames.has(zt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Dt.sessionNames.get(zt.sessionId)))){const Dn=Dt.sessionNames.get(zt.sessionId),mr=!!Dn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Dn);Dn!==zt.name&&(Dt.setSessionName(zt.sessionId,zt.name),mr&&Dt.markRecentlyRenamed(zt.sessionId))}}}catch{}}pe();const ge=setInterval(pe,5e3);return()=>{te=!1,clearInterval(ge)}},[]),S.useEffect(()=>{const te=()=>C(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function P(te){Xg(te),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){Xp(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&D.current&&(D.current.focus(),D.current.select())},[e]);function M(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),s("")}function he(){t(null),s("")}function _e(te,pe){t(te),s(pe)}const Ce=S.useCallback((te,pe)=>{te.stopPropagation(),j(pe)},[]),Re=S.useCallback(async te=>{try{jm(te),await we.deleteSession(te)}catch{}X.getState().currentSessionId===te&&Xp(),T(te)},[T]),Le=S.useCallback(()=>{_&&(Re(_),j(null))},[_,Re]),Be=S.useCallback(()=>{j(null)},[]),Je=S.useCallback(()=>{k(!0)},[]),xe=S.useCallback(async()=>{k(!1);const te=X.getState(),pe=new Set;for(const Qe of te.sessions.keys())pe.add(Qe);for(const Qe of te.sdkSessions)pe.add(Qe.sessionId);const ge=Array.from(pe).filter(Qe=>{const Dt=te.sdkSessions.find(nn=>nn.sessionId===Qe);return(Dt==null?void 0:Dt.archived)??!1});for(const Qe of ge)await Re(Qe)},[Re]),Pe=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!E)return;requestAnimationFrame(()=>{var pe,ge;(ge=(pe=O.current)==null?void 0:pe.querySelector("button"))==null||ge.focus()});function te(pe){var nn;if(pe.key==="Escape"){E?Pe():Be();return}if(pe.key!=="Tab")return;const ge=(nn=O.current)==null?void 0:nn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ge||ge.length===0)return;const Qe=ge[0],Dt=ge[ge.length-1];pe.shiftKey&&document.activeElement===Qe?(pe.preventDefault(),Dt.focus()):!pe.shiftKey&&document.activeElement===Dt&&(pe.preventDefault(),Qe.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,E,Be,Pe]);const ft=S.useCallback(async(te,pe)=>{te.stopPropagation();const ge=I.find(Dn=>Dn.sessionId===pe),Qe=L.get(pe),Dt=(Qe==null?void 0:Qe.is_containerized)||!!(ge!=null&&ge.containerId)||!1,nn=z.get(pe),Tn=((nn==null?void 0:nn.stateType)||"").toLowerCase();if(nn&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const Dn=await we.getArchiveInfo(pe);if(Dn.issueNotDone){p(pe),v(Dn),b(Dt);return}}catch{}if(Dt){f(pe);return}Rt(pe)},[I,L,z]),Rt=S.useCallback(async(te,pe,ge)=>{try{jm(te);const Qe={};pe&&(Qe.force=!0),ge&&ge!=="none"&&(Qe.linearTransition=ge),await we.archiveSession(te,Object.keys(Qe).length>0?Qe:void 0)}catch{}X.getState().currentSessionId===te&&(Xp(),X.getState().newSession());try{const Qe=await we.listSessions();X.getState().setSdkSessions(Qe)}catch{}},[]),bt=S.useCallback(()=>{u&&(Rt(u,!0),f(null))},[u,Rt]),Lt=S.useCallback(()=>{f(null)},[]),un=S.useCallback((te,pe)=>{h&&(Rt(h,pe,te),p(null),v(null))},[h,Rt]),st=S.useCallback(()=>{p(null),v(null)},[]),dn=S.useCallback(async(te,pe)=>{te.stopPropagation();try{await we.unarchiveSession(pe)}catch{}try{const ge=await we.listSessions();X.getState().setSdkSessions(ge)}catch{}},[]),bn=new Set;for(const te of L.keys())bn.add(te);for(const te of I)bn.add(te.sessionId);const je=Array.from(bn).map(te=>{var Qe;const pe=L.get(te),ge=I.find(Dt=>Dt.sessionId===te);return{id:te,model:(pe==null?void 0:pe.model)||(ge==null?void 0:ge.model)||"",cwd:(pe==null?void 0:pe.cwd)||(ge==null?void 0:ge.cwd)||"",gitBranch:(pe==null?void 0:pe.git_branch)||(ge==null?void 0:ge.gitBranch)||"",isContainerized:(pe==null?void 0:pe.is_containerized)||!!(ge!=null&&ge.containerId)||!1,gitAhead:(pe==null?void 0:pe.git_ahead)||(ge==null?void 0:ge.gitAhead)||0,gitBehind:(pe==null?void 0:pe.git_behind)||(ge==null?void 0:ge.gitBehind)||0,linesAdded:(pe==null?void 0:pe.total_lines_added)||(ge==null?void 0:ge.totalLinesAdded)||0,linesRemoved:(pe==null?void 0:pe.total_lines_removed)||(ge==null?void 0:ge.totalLinesRemoved)||0,isConnected:G.get(te)??!1,isReconnecting:B.get(te)??!1,status:F.get(te)??null,sdkState:(ge==null?void 0:ge.state)??null,createdAt:(ge==null?void 0:ge.createdAt)??0,archived:(ge==null?void 0:ge.archived)??!1,backendType:(pe==null?void 0:pe.backend_type)||(ge==null?void 0:ge.backendType)||"claude",repoRoot:(pe==null?void 0:pe.repo_root)||"",permCount:((Qe=U.get(te))==null?void 0:Qe.size)??0,cronJobId:(pe==null?void 0:pe.cronJobId)||(ge==null?void 0:ge.cronJobId),cronJobName:(pe==null?void 0:pe.cronJobName)||(ge==null?void 0:ge.cronJobName),agentId:(pe==null?void 0:pe.agentId)||(ge==null?void 0:ge.agentId),agentName:(pe==null?void 0:pe.agentName)||(ge==null?void 0:ge.agentName),userName:ge==null?void 0:ge.userName}}).sort((te,pe)=>pe.createdAt-te.createdAt),ze=S.useMemo(()=>Array.from(new Set(je.map(te=>te.userName).filter(te=>!!te))).sort(),[je]),[yt,qe]=S.useState("__all__"),Or=te=>yt==="__all__"?!0:yt==="__none__"?!te.userName:te.userName===yt,ae=je.some(te=>!te.userName),ve=je.filter(Or),Q=ve.filter(te=>!te.archived&&!te.cronJobId&&!te.agentId),fe=ve.filter(te=>!te.archived&&!!te.cronJobId),Te=ve.filter(te=>!te.archived&&!!te.agentId),Ye=ve.filter(te=>te.archived),et=$?je.find(te=>te.id===$):null,tt=(et==null?void 0:et.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[vt,fn]=S.useState(!0),[Ke,tr]=S.useState(!0),En=S.useMemo(()=>C4(Q),[Q]),Yr={onSelect:P,onStartRename:_e,onArchive:ft,onUnarchive:dn,onDelete:Ce,onClearRecentlyRenamed:Y,editingSessionId:e,editingName:n,setEditingName:s,onConfirmRename:M,onCancelRename:he,editInputRef:D};return a.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[a.jsx("div",{className:"p-3.5 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("img",{src:tt,alt:"",className:"w-6 h-6"}),a.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),a.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"}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:a.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&&a.jsxs("div",{className:"px-3.5 pb-2",children:[a.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),a.jsxs("select",{id:"sidebar-user-filter",value:yt,onChange:te=>qe(te.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:[a.jsx("option",{value:"__all__",children:"All users"}),ze.map(te=>a.jsx("option",{value:te,children:te},te)),ae&&a.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&a.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:a.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"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:Lt,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"}),a.jsx("button",{onClick:bt,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"})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Q.length===0&&fe.length===0&&Ye.length===0?a.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):a.jsxs(a.Fragment,{children:[En.map((te,pe)=>a.jsx(k4,{group:te,isCollapsed:se.has(te.key),onToggleCollapse:me,currentSessionId:$,sessionNames:le,pendingPermissions:U,recentlyRenamed:W,isFirst:pe===0,...Yr},te.key)),fe.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>fn(!vt),"aria-expanded":vt,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${vt?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",fe.length,")"]}),vt&&a.jsx("div",{className:"mt-0.5",children:fe.map(te=>{var pe;return a.jsx(jd,{session:te,isActive:$===te.id,sessionName:le.get(te.id),permCount:((pe=U.get(te.id))==null?void 0:pe.size)??0,isRecentlyRenamed:W.has(te.id),...Yr},te.id)})})]}),Te.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>tr(!Ke),"aria-expanded":Ke,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${Ke?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Te.length,")"]}),Ke&&a.jsx("div",{className:"mt-0.5",children:Te.map(te=>{var pe;return a.jsx(jd,{session:te,isActive:$===te.id,sessionName:le.get(te.id),permCount:((pe=U.get(te.id))==null?void 0:pe.size)??0,isRecentlyRenamed:W.has(te.id),...Yr},te.id)})})]}),Ye.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsxs("button",{onClick:()=>c(!l),"aria-expanded":l,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${l?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Ye.length,")"]}),l&&Ye.length>1&&a.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"})]}),l&&a.jsx("div",{className:"mt-0.5",children:Ye.map(te=>{var pe;return a.jsx(jd,{session:te,isActive:$===te.id,isArchived:!0,sessionName:le.get(te.id),permCount:((pe=U.get(te.id))==null?void 0:pe.size)??0,isRecentlyRenamed:W.has(te.id),...Yr},te.id)})})]})]})}),a.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})})}),a.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[a.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:A4.map(te=>a.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),a.jsx("div",{className:"flex flex-col",children:te.itemIds.map(pe=>{const ge=M4.get(pe);if(!ge)return null;const Qe=ge.activePages?ge.activePages.some(Dt=>R.page===Dt):R.page===ge.id;return a.jsxs("button",{onClick:()=>{window.location.hash=ge.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:ge.label,"aria-current":Qe?"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 ${Qe?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Qe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),a.jsx("svg",{viewBox:ge.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:a.jsx("path",{d:ge.iconPath,fillRule:ge.fillRule,clipRule:ge.clipRule})}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ge.label})]},ge.id)})})]},te.id))}),a.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),a.jsx("div",{className:"flex items-center gap-0.5",children:E4.map(te=>a.jsx("a",{href:te.url,target:"_blank",rel:"noopener noreferrer",title:te.label,"aria-label":`Open ${te.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:a.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||E)&&a.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:E?Pe:Be,children:a.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:te=>te.stopPropagation(),children:[a.jsx("div",{className:"flex justify-center mb-3",children:a.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[a.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"}),a.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"})]})})}),a.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:E?"Delete all archived?":"Delete session?"}),a.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:E?`This will permanently delete ${Ye.length} archived session${Ye.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),a.jsxs("div",{className:"flex gap-2.5 mt-4",children:[a.jsx("button",{onClick:E?Pe: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"}),a.jsx("button",{onClick:E?xe: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:E?"Delete all":"Delete"})]})]})}),h&&g&&a.jsx(y4,{issueIdentifier:((Br=g.issue)==null?void 0:Br.identifier)||"",issueStateName:((Pr=g.issue)==null?void 0:Pr.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:un,onCancel:st})]})}function L4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const D4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,z4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O4={};function Ly(e,t){return(O4.jsx?z4:D4).test(e)}const B4=/[ \t\n\f\r]/g;function P4(e){return typeof e=="object"?e.type==="text"?Dy(e.value):!1:Dy(e)}function Dy(e){return e.replace(B4,"")===""}class Ac{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Ac.prototype.normal={};Ac.prototype.property={};Ac.prototype.space=void 0;function Tw(e,t){const n={},s={};for(const l of e)Object.assign(n,l.property),Object.assign(s,l.normal);return new Ac(n,s,t)}function pg(e){return e.toLowerCase()}class er{constructor(t,n){this.attribute=n,this.property=t}}er.prototype.attribute="";er.prototype.booleanish=!1;er.prototype.boolean=!1;er.prototype.commaOrSpaceSeparated=!1;er.prototype.commaSeparated=!1;er.prototype.defined=!1;er.prototype.mustUseProperty=!1;er.prototype.number=!1;er.prototype.overloadedBoolean=!1;er.prototype.property="";er.prototype.spaceSeparated=!1;er.prototype.space=void 0;let U4=0;const Ve=ya(),on=ya(),mg=ya(),be=ya(),Et=ya(),ga=ya(),ur=ya();function ya(){return 2**++U4}const gg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:on,commaOrSpaceSeparated:ur,commaSeparated:ga,number:be,overloadedBoolean:mg,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),Wp=Object.keys(gg);class Wg extends er{constructor(t,n,s,l){let c=-1;if(super(t,n),zy(this,"space",l),typeof s=="number")for(;++c<Wp.length;){const u=Wp[c];zy(this,Wp[c],(s&gg[u])===gg[u])}}}Wg.prototype.defined=!0;function zy(e,t,n){n&&(e[t]=n)}function Dl(e){const t={},n={};for(const[s,l]of Object.entries(e.properties)){const c=new Wg(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[pg(s)]=s,n[pg(c.attribute)]=s}return new Ac(t,n,e.space)}const Aw=Dl({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Et,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:be,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Et,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:on,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Mw(e,t){return t in e?e[t]:t}function Rw(e,t){return Mw(e,t.toLowerCase())}const $4=Dl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ga,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Et,autoFocus:Ve,autoPlay:Ve,blocking:Et,capture:null,charSet:null,checked:Ve,cite:null,className:Et,closedBy:null,colorSpace:null,cols:be,colSpan:be,command:null,commandFor:null,content:null,contentEditable:on,controls:Ve,controlsList:Et,coords:be|ga,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:mg,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Et,height:be,hidden:mg,high:be,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Et,itemRef:Et,itemScope:Ve,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:be,pattern:null,ping:Et,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Et,required:Ve,reversed:Ve,rows:be,rowSpan:be,sandbox:Et,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:on,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:ga,part:Et,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Rw}),F4=Dl({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:ur,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Et,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:ga,g2:ga,glyphName:ga,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:ur,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ur,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ur,rev:ur,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ur,requiredFeatures:ur,requiredFonts:ur,requiredFormats:ur,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:ur,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ur,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ur,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mw}),Lw=Dl({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()}}),Dw=Dl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Rw}),zw=Dl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),H4={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"},I4=/[A-Z]/g,Oy=/-[a-z]/g,q4=/^data[-\w.:]+$/i;function V4(e,t){const n=pg(t);let s=t,l=er;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&q4.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Oy,Y4);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Oy.test(c)){let u=c.replace(I4,G4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=Wg}return new l(s,t)}function G4(e){return"-"+e.toLowerCase()}function Y4(e){return e.charAt(1).toUpperCase()}const Q4=Tw([Aw,$4,Lw,Dw,zw],"html"),Kg=Tw([Aw,F4,Lw,Dw,zw],"svg");function X4(e){return e.join(" ").trim()}var pl={},Kp,By;function W4(){if(By)return Kp;By=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
68
|
+
`,p="/",g="*",v="",y="comment",b="declaration";function _(E,k){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];k=k||{};var A=1,C=1;function D(W){var Y=W.match(t);Y&&(A+=Y.length);var U=W.lastIndexOf(h);C=~U?W.length-U:C+W.length}function O(){var W={line:A,column:C};return function(Y){return Y.position=new L(W),G(),Y}}function L(W){this.start=W,this.end={line:A,column:C},this.source=k.source}L.prototype.content=E;function I(W){var Y=new Error(k.source+":"+A+":"+C+": "+W);if(Y.reason=W,Y.filename=k.source,Y.line=A,Y.column=C,Y.source=E,!k.silent)throw Y}function $(W){var Y=W.exec(E);if(Y){var U=Y[0];return D(U),E=E.slice(U.length),Y}}function G(){$(n)}function B(W){var Y;for(W=W||[];Y=F();)Y!==!1&&W.push(Y);return W}function F(){var W=O();if(!(p!=E.charAt(0)||g!=E.charAt(1))){for(var Y=2;v!=E.charAt(Y)&&(g!=E.charAt(Y)||p!=E.charAt(Y+1));)++Y;if(Y+=2,v===E.charAt(Y-1))return I("End of comment missing");var U=E.slice(2,Y-2);return C+=2,D(U),E=E.slice(Y),C+=2,W({type:y,comment:U})}}function T(){var W=O(),Y=$(s);if(Y){if(F(),!$(l))return I("property missing ':'");var U=$(c),z=W({type:b,property:j(Y[0].replace(e,v)),value:U?j(U[0].replace(e,v)):v});return $(u),z}}function le(){var W=[];B(W);for(var Y;Y=T();)Y!==!1&&(W.push(Y),B(W));return W}return G(),le()}function j(E){return E?E.replace(f,v):v}return Kp=_,Kp}var Py;function K4(){if(Py)return pl;Py=1;var e=pl&&pl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(pl,"__esModule",{value:!0}),pl.default=n;const t=e(W4());function n(s,l){let c=null;if(!s||typeof s!="string")return c;const u=(0,t.default)(s),f=typeof l=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?l(p,g,h):g&&(c=c||{},c[p]=g)}),c}return pl}var qo={},Uy;function Z4(){if(Uy)return qo;Uy=1,Object.defineProperty(qo,"__esModule",{value:!0}),qo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,c=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={}),c(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(l,f):p=p.replace(s,f),p.replace(t,u))};return qo.camelCase=h,qo}var Vo,$y;function J4(){if($y)return Vo;$y=1;var e=Vo&&Vo.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(K4()),n=Z4();function s(l,c){var u={};return!l||typeof l!="string"||(0,t.default)(l,function(f,h){f&&h&&(u[(0,n.camelCase)(f,c)]=h)}),u}return s.default=s,Vo=s,Vo}var eE=J4();const tE=Eg(eE),Ow=Bw("end"),Zg=Bw("start");function Bw(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function nE(e){const t=Zg(e),n=Ow(e);if(t&&n)return{start:t,end:n}}function cc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fy(e.position):"start"in e||"end"in e?Fy(e):"line"in e||"column"in e?xg(e):""}function xg(e){return Hy(e&&e.line)+":"+Hy(e&&e.column)}function Fy(e){return xg(e&&e.start)+"-"+xg(e&&e.end)}function Hy(e){return e&&typeof e=="number"?e:1}class Ln extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let l="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?l=t:!c.cause&&t&&(u=!0,l=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof s=="string"){const h=s.indexOf(":");h===-1?c.ruleId=s:(c.source=s.slice(0,h),c.ruleId=s.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=cc(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ln.prototype.file="";Ln.prototype.name="";Ln.prototype.reason="";Ln.prototype.message="";Ln.prototype.stack="";Ln.prototype.column=void 0;Ln.prototype.line=void 0;Ln.prototype.ancestors=void 0;Ln.prototype.cause=void 0;Ln.prototype.fatal=void 0;Ln.prototype.place=void 0;Ln.prototype.ruleId=void 0;Ln.prototype.source=void 0;const Jg={}.hasOwnProperty,rE=new Map,sE=/[A-Z]/g,iE=new Set(["table","tbody","thead","tfoot","tr"]),aE=new Set(["td","th"]),Pw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=mE(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");s=pE(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?Kg:Q4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Uw(l,e,void 0);return c&&typeof c!="string"?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}function Uw(e,t,n){if(t.type==="element")return oE(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return cE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return dE(e,t,n);if(t.type==="mdxjsEsm")return uE(e,t);if(t.type==="root")return fE(e,t,n);if(t.type==="text")return hE(e,t)}function oE(e,t,n){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Kg,e.schema=l),e.ancestors.push(t);const c=Fw(e,t.tagName,!1),u=gE(e,t);let f=tx(e,t);return iE.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!P4(h):!0})),$w(e,u,c,t),ex(u,f),e.ancestors.pop(),e.schema=s,e.create(t,c,u,n)}function cE(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}jc(e,t.position)}function uE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);jc(e,t.position)}function dE(e,t,n){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Kg,e.schema=l),e.ancestors.push(t);const c=t.name===null?e.Fragment:Fw(e,t.name,!0),u=xE(e,t),f=tx(e,t);return $w(e,u,c,t),ex(u,f),e.ancestors.pop(),e.schema=s,e.create(t,c,u,n)}function fE(e,t,n){const s={};return ex(s,tx(e,t)),e.create(t,e.Fragment,s,n)}function hE(e,t){return t.value}function $w(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function ex(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function pE(e,t,n){return s;function s(l,c,u,f){const p=Array.isArray(u.children)?n:t;return f?p(c,u,f):p(c,u)}}function mE(e,t){return n;function n(s,l,c,u){const f=Array.isArray(c.children),h=Zg(s);return t(l,c,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function gE(e,t){const n={};let s,l;for(l in t.properties)if(l!=="children"&&Jg.call(t.properties,l)){const c=vE(e,l,t.properties[l]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&aE.has(t.tagName)?s=f:n[u]=f}}if(s){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function xE(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const u=c.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else jc(e,t.position);else{const l=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else jc(e,t.position);else c=s.value===null?!0:s.value;n[l]=c}return n}function tx(e,t){const n=[];let s=-1;const l=e.passKeys?new Map:rE;for(;++s<t.children.length;){const c=t.children[s];let u;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const p=l.get(h)||0;u=h+"-"+p,l.set(h,p+1)}}const f=Uw(e,c,u);f!==void 0&&n.push(f)}return n}function vE(e,t,n){const s=V4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?L4(n):X4(n)),s.property==="style"){let l=typeof n=="object"?n:bE(e,String(n));return e.stylePropertyNameCase==="css"&&(l=yE(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?H4[s.property]||s.property:s.attribute,n]}}function bE(e,t){try{return tE(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,l=new Ln("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Pw+"#cannot-parse-style-attribute",l}}function Fw(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let c=-1,u;for(;++c<l.length;){const f=Ly(l[c])?{type:"Identifier",name:l[c]}:{type:"Literal",value:l[c]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}s=u}else s=Ly(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Jg.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);jc(e)}function jc(e,t){const n=new Ln("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=Pw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function yE(e){const t={};let n;for(n in e)Jg.call(e,n)&&(t[_E(n)]=e[n]);return t}function _E(e){let t=e.replace(sE,wE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function wE(e){return"-"+e.toLowerCase()}const Zp={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"]},SE={};function nx(e,t){const n=SE,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Hw(e,s,l)}function Hw(e,t,n){if(kE(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 Iy(e.children,t,n)}return Array.isArray(e)?Iy(e,t,n):""}function Iy(e,t,n){const s=[];let l=-1;for(;++l<e.length;)s[l]=Hw(e[l],t,n);return s.join("")}function kE(e){return!!(e&&typeof e=="object")}const qy=document.createElement("i");function rx(e){const t="&"+e+";";qy.innerHTML=t;const n=qy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function pr(e,t,n,s){const l=e.length;let c=0,u;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,s.length<1e4)u=Array.from(s),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<s.length;)u=s.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Dr(e,t){return e.length>0?(pr(e,e.length,0,t),e):t}const Vy={}.hasOwnProperty;function Iw(e){const t={};let n=-1;for(;++n<e.length;)jE(t,e[n]);return t}function jE(e,t){let n;for(n in t){const l=(Vy.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){Vy.call(l,u)||(l[u]=[]);const f=c[u];NE(l[u],Array.isArray(f)?f:f?[f]:[])}}}function NE(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);pr(e,0,0,s)}function qw(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 Gr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Un=Mi(/[A-Za-z]/),Rn=Mi(/[\dA-Za-z]/),CE=Mi(/[#-'*+\--9=?A-Z^-~]/);function Wd(e){return e!==null&&(e<32||e===127)}const vg=Mi(/\d/),EE=Mi(/[\dA-Fa-f]/),TE=Mi(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function Mt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const lf=Mi(new RegExp("\\p{P}|\\p{S}","u")),ba=Mi(/\s/);function Mi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function zl(e){const t=[];let n=-1,s=0,l=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&Rn(e.charCodeAt(n+1))&&Rn(e.charCodeAt(n+2)))l=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(n+1);c<56320&&f>56319&&f<57344?(u=String.fromCharCode(c,f),l=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(s,n),encodeURIComponent(u)),s=n+l+1,u=""),l&&(n+=l,l=0)}return t.join("")+e.slice(s)}function pt(e,t,n,s){const l=s?s-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(h){return ot(h)?(e.enter(n),f(h)):t(h)}function f(h){return ot(h)&&c++<l?(e.consume(h),f):(e.exit(n),t(h))}}const AE={tokenize:ME};function ME(e){const t=e.attempt(this.parser.constructs.contentInitial,s,l);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),pt(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),c(f)}function c(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 Ue(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),u)}}const RE={tokenize:LE},Gy={tokenize:DE};function LE(e){const t=this,n=[];let s=0,l,c,u;return f;function f(C){if(s<n.length){const D=n[s];return t.containerState=D[1],e.attempt(D[0].continuation,h,p)(C)}return p(C)}function h(C){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&A();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(s);let I=D;for(;I<t.events.length;)t.events[I][1].end={...L},I++;return pr(t.events,O+1,0,t.events.slice(D)),t.events.length=I,p(C)}return f(C)}function p(C){if(s===n.length){if(!l)return y(C);if(l.currentConstruct&&l.currentConstruct.concrete)return _(C);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Gy,g,v)(C)}function g(C){return l&&A(),k(s),y(C)}function v(C){return t.parser.lazy[t.now().line]=s!==n.length,u=t.now().offset,_(C)}function y(C){return t.containerState={},e.attempt(Gy,b,_)(C)}function b(C){return s++,n.push([t.currentConstruct,t.containerState]),y(C)}function _(C){if(C===null){l&&A(),k(0),e.consume(C);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:c}),j(C)}function j(C){if(C===null){E(e.exit("chunkFlow"),!0),k(0),e.consume(C);return}return Ue(C)?(e.consume(C),E(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(C),j)}function E(C,D){const O=t.sliceStream(C);if(D&&O.push(null),C.previous=c,c&&(c.next=C),c=C,l.defineSkip(C.start),l.write(O),t.parser.lazy[C.start.line]){let L=l.events.length;for(;L--;)if(l.events[L][1].start.offset<u&&(!l.events[L][1].end||l.events[L][1].end.offset>u))return;const I=t.events.length;let $=I,G,B;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(G){B=t.events[$][1].end;break}G=!0}for(k(s),L=I;L<t.events.length;)t.events[L][1].end={...B},L++;pr(t.events,$+1,0,t.events.slice(I)),t.events.length=L}}function k(C){let D=n.length;for(;D-- >C;){const O=n[D];t.containerState=O[1],O[0].exit.call(t,e)}n.length=C}function A(){l.write([null]),c=void 0,l=void 0,t.containerState._closeFlow=void 0}}function DE(e,t,n){return pt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Al(e){if(e===null||Mt(e)||ba(e))return 1;if(lf(e))return 2}function of(e,t,n){const s=[];let l=-1;for(;++l<e.length;){const c=e[l].resolveAll;c&&!s.includes(c)&&(t=c(t,n),s.push(c))}return t}const bg={name:"attention",resolveAll:zE,tokenize:OE};function zE(e,t){let n=-1,s,l,c,u,f,h,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[s][1].end},y={...e[n][1].start};Yy(v,-h),Yy(y,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[s][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:h>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},l={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[s][1].end={...u.start},e[n][1].start={...f.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=Dr(p,[["enter",e[s][1],t],["exit",e[s][1],t]])),p=Dr(p,[["enter",l,t],["enter",u,t],["exit",u,t],["enter",c,t]]),p=Dr(p,of(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),p=Dr(p,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Dr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,pr(e,s-1,n-s+3,p),n=s+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function OE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Al(s);let c;return u;function u(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const p=e.exit("attentionSequence"),g=Al(h),v=!g||g===2&&l||n.includes(h),y=!l||l===2&&g||n.includes(s);return p._open=!!(c===42?v:v&&(l||!y)),p._close=!!(c===42?y:y&&(g||!v)),t(h)}}function Yy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const BE={name:"autolink",tokenize:PE};function PE(e,t,n){let s=0;return l;function l(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return Un(b)?(e.consume(b),u):b===64?n(b):p(b)}function u(b){return b===43||b===45||b===46||Rn(b)?(s=1,f(b)):p(b)}function f(b){return b===58?(e.consume(b),s=0,h):(b===43||b===45||b===46||Rn(b))&&s++<32?(e.consume(b),f):(s=0,p(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Wd(b)?n(b):(e.consume(b),h)}function p(b){return b===64?(e.consume(b),g):CE(b)?(e.consume(b),p):n(b)}function g(b){return Rn(b)?v(b):n(b)}function v(b){return b===46?(e.consume(b),s=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Rn(b))&&s++<63){const _=b===45?y:v;return e.consume(b),_}return n(b)}}const Mc={partial:!0,tokenize:UE};function UE(e,t,n){return s;function s(c){return ot(c)?pt(e,l,"linePrefix")(c):l(c)}function l(c){return c===null||Ue(c)?t(c):n(c)}}const Vw={continuation:{tokenize:FE},exit:HE,name:"blockQuote",tokenize:$E};function $E(e,t,n){const s=this;return l;function l(u){if(u===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function FE(e,t,n){const s=this;return l;function l(u){return ot(u)?pt(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(Vw,t,n)(u)}}function HE(e){e.exit("blockQuote")}const Gw={name:"characterEscape",tokenize:IE};function IE(e,t,n){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),l}function l(c){return TE(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Yw={name:"characterReference",tokenize:qE};function qE(e,t,n){const s=this;let l=0,c,u;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,u=Rn,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=EE,g):(e.enter("characterReferenceValue"),c=7,u=vg,g(v))}function g(v){if(v===59&&l){const y=e.exit("characterReferenceValue");return u===Rn&&!rx(s.sliceSerialize(y))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&l++<c?(e.consume(v),g):n(v)}}const Qy={partial:!0,tokenize:GE},Xy={concrete:!0,name:"codeFenced",tokenize:VE};function VE(e,t,n){const s=this,l={partial:!0,tokenize:O};let c=0,u=0,f;return h;function h(L){return p(L)}function p(L){const I=s.events[s.events.length-1];return c=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[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)?pt(e,v,"whitespace")(L):v(L))}function v(L){return L===null||Ue(L)?(e.exit("codeFencedFence"),s.interrupt?t(L):e.check(Qy,j,D)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(L))}function y(L){return L===null||Ue(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(L)):ot(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pt(e,b,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),y)}function b(L){return L===null||Ue(L)?v(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(L))}function _(L){return L===null||Ue(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(L)):L===96&&L===f?n(L):(e.consume(L),_)}function j(L){return e.attempt(l,D,E)(L)}function E(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),k}function k(L){return c>0&&ot(L)?pt(e,A,"linePrefix",c+1)(L):A(L)}function A(L){return L===null||Ue(L)?e.check(Qy,j,D)(L):(e.enter("codeFlowValue"),C(L))}function C(L){return L===null||Ue(L)?(e.exit("codeFlowValue"),A(L)):(e.consume(L),C)}function D(L){return e.exit("codeFenced"),t(L)}function O(L,I,$){let G=0;return B;function B(Y){return L.enter("lineEnding"),L.consume(Y),L.exit("lineEnding"),F}function F(Y){return L.enter("codeFencedFence"),ot(Y)?pt(L,T,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):T(Y)}function T(Y){return Y===f?(L.enter("codeFencedFenceSequence"),le(Y)):$(Y)}function le(Y){return Y===f?(G++,L.consume(Y),le):G>=u?(L.exit("codeFencedFenceSequence"),ot(Y)?pt(L,W,"whitespace")(Y):W(Y)):$(Y)}function W(Y){return Y===null||Ue(Y)?(L.exit("codeFencedFence"),I(Y)):$(Y)}}}function GE(e,t,n){const s=this;return l;function l(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return s.parser.lazy[s.now().line]?n(u):t(u)}}const Jp={name:"codeIndented",tokenize:QE},YE={partial:!0,tokenize:XE};function QE(e,t,n){const s=this;return l;function l(p){return e.enter("codeIndented"),pt(e,c,"linePrefix",5)(p)}function c(p){const g=s.events[s.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):Ue(p)?e.attempt(YE,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||Ue(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function XE(e,t,n){const s=this;return l;function l(u){return s.parser.lazy[s.now().line]?n(u):Ue(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):pt(e,c,"linePrefix",5)(u)}function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Ue(u)?l(u):n(u)}}const WE={name:"codeText",previous:ZE,resolve:KE,tokenize:JE};function KE(e){let t=e.length-4,n=3,s,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)l===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(l=s):(s===t||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),t-=s-l-2,s=l+2),l=void 0);return e}function ZE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JE(e,t,n){let s=0,l,c;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),s++,f):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(c=e.enter("codeTextSequence"),l=0,g(v)):Ue(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||Ue(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),l++,g):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",p(v))}}class e6{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 s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const l=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Go(this.left,s),c.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),Go(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Go(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);Go(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Go(this.left,n.reverse())}}}function Go(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 Qw(e){const t={};let n=-1,s,l,c,u,f,h,p;const g=new e6(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(s=g.get(n),n&&s[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=s[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,t6(g,n)),n=t[n],p=!0);else if(s[1]._container){for(c=n,l=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),u[1].type="lineEnding",l=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;l&&(s[1].end={...g.get(l)[1].start},f=g.slice(l,n),f.unshift(s),g.splice(l,n-l+1,f))}}return pr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function t6(e,t){const n=e.get(t)[1],s=e.get(t)[2];let l=t-1;const c=[];let u=n._tokenizer;u||(u=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let g,v,y=-1,b=n,_=0,j=0;const E=[j];for(;b;){for(;e.get(++l)[1]!==b;);c.push(l),b._tokenizer||(g=s.sliceStream(b),b.next||g.push(null),v&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=b,b=b.next}for(b=n;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(j=y+1,E.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):E.pop(),y=E.length;y--;){const k=f.slice(E[y],E[y+1]),A=c.pop();h.push([A,A+k.length-1]),e.splice(A,2,k)}for(h.reverse(),y=-1;++y<h.length;)p[_+h[y][0]]=_+h[y][1],_+=h[y][1]-h[y][0]-1;return p}const n6={resolve:s6,tokenize:i6},r6={partial:!0,tokenize:a6};function s6(e){return Qw(e),e}function i6(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?c(f):Ue(f)?e.check(r6,u,c)(f):(e.consume(f),l)}function c(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,l}}function a6(e,t,n){const s=this;return l;function l(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),pt(e,c,"linePrefix")}function c(u){if(u===null||Ue(u))return n(u);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(s.parser.constructs.flow,n,t)(u)}}function Xw(e,t,n,s,l,c,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return v;function v(k){return k===60?(e.enter(s),e.enter(l),e.enter(c),e.consume(k),e.exit(c),y):k===null||k===32||k===41||Wd(k)?n(k):(e.enter(s),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(c),e.consume(k),e.exit(c),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(f),y(k)):k===null||k===60||Ue(k)?n(k):(e.consume(k),k===92?_:b)}function _(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!g&&(k===null||k===41||Mt(k))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(s),t(k)):g<p&&k===40?(e.consume(k),g++,j):k===41?(e.consume(k),g--,j):k===null||k===32||k===40||Wd(k)?n(k):(e.consume(k),k===92?E:j)}function E(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function Ww(e,t,n,s,l,c){const u=this;let f=0,h;return p;function p(b){return e.enter(s),e.enter(l),e.consume(b),e.exit(l),e.enter(c),g}function g(b){return f>999||b===null||b===91||b===93&&!h||b===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(c),e.enter(l),e.consume(b),e.exit(l),e.exit(s),t):Ue(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===null||b===91||b===93||Ue(b)||f++>999?(e.exit("chunkString"),g(b)):(e.consume(b),h||(h=!ot(b)),b===92?y:v)}function y(b){return b===91||b===92||b===93?(e.consume(b),f++,v):v(b)}}function Kw(e,t,n,s,l,c){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(s),e.enter(l),e.consume(y),e.exit(l),u=y===40?41:y,h):n(y)}function h(y){return y===u?(e.enter(l),e.consume(y),e.exit(l),e.exit(s),t):(e.enter(c),p(y))}function p(y){return y===u?(e.exit(c),h(u)):y===null?n(y):Ue(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),pt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||Ue(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?v:g)}function v(y){return y===u||y===92?(e.consume(y),g):g(y)}}function uc(e,t){let n;return s;function s(l){return Ue(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,s):ot(l)?pt(e,s,n?"linePrefix":"lineSuffix")(l):t(l)}}const l6={name:"definition",tokenize:c6},o6={partial:!0,tokenize:u6};function c6(e,t,n){const s=this;let l;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return Ww.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return l=Gr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return Mt(b)?uc(e,p)(b):p(b)}function p(b){return Xw(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(o6,v,v)(b)}function v(b){return ot(b)?pt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Ue(b)?(e.exit("definition"),s.parser.defined.push(l),t(b)):n(b)}}function u6(e,t,n){return s;function s(f){return Mt(f)?uc(e,l)(f):n(f)}function l(f){return Kw(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return ot(f)?pt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Ue(f)?t(f):n(f)}}const d6={name:"hardBreakEscape",tokenize:f6};function f6(e,t,n){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),l}function l(c){return Ue(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const h6={name:"headingAtx",resolve:p6,tokenize:m6};function p6(e,t){let n=e.length-2,s=3,l,c;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},c={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},pr(e,s,n-s+1,[["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t]])),e}function m6(e,t,n){let s=0;return l;function l(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&s++<6?(e.consume(g),u):g===null||Mt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||Ue(g)?(e.exit("atxHeading"),t(g)):ot(g)?pt(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||Mt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const g6=["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"],Wy=["pre","script","style","textarea"],x6={concrete:!0,name:"htmlFlow",resolveTo:y6,tokenize:_6},v6={partial:!0,tokenize:S6},b6={partial:!0,tokenize:w6};function y6(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 _6(e,t,n){const s=this;let l,c,u,f,h;return p;function p(M){return g(M)}function g(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),v}function v(M){return M===33?(e.consume(M),y):M===47?(e.consume(M),c=!0,j):M===63?(e.consume(M),l=3,s.interrupt?t:R):Un(M)?(e.consume(M),u=String.fromCharCode(M),E):n(M)}function y(M){return M===45?(e.consume(M),l=2,b):M===91?(e.consume(M),l=5,f=0,_):Un(M)?(e.consume(M),l=4,s.interrupt?t:R):n(M)}function b(M){return M===45?(e.consume(M),s.interrupt?t:R):n(M)}function _(M){const he="CDATA[";return M===he.charCodeAt(f++)?(e.consume(M),f===he.length?s.interrupt?t:T:_):n(M)}function j(M){return Un(M)?(e.consume(M),u=String.fromCharCode(M),E):n(M)}function E(M){if(M===null||M===47||M===62||Mt(M)){const he=M===47,_e=u.toLowerCase();return!he&&!c&&Wy.includes(_e)?(l=1,s.interrupt?t(M):T(M)):g6.includes(u.toLowerCase())?(l=6,he?(e.consume(M),k):s.interrupt?t(M):T(M)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):c?A(M):C(M))}return M===45||Rn(M)?(e.consume(M),u+=String.fromCharCode(M),E):n(M)}function k(M){return M===62?(e.consume(M),s.interrupt?t:T):n(M)}function A(M){return ot(M)?(e.consume(M),A):B(M)}function C(M){return M===47?(e.consume(M),B):M===58||M===95||Un(M)?(e.consume(M),D):ot(M)?(e.consume(M),C):B(M)}function D(M){return M===45||M===46||M===58||M===95||Rn(M)?(e.consume(M),D):O(M)}function O(M){return M===61?(e.consume(M),L):ot(M)?(e.consume(M),O):C(M)}function L(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),h=M,I):ot(M)?(e.consume(M),L):$(M)}function I(M){return M===h?(e.consume(M),h=null,G):M===null||Ue(M)?n(M):(e.consume(M),I)}function $(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Mt(M)?O(M):(e.consume(M),$)}function G(M){return M===47||M===62||ot(M)?C(M):n(M)}function B(M){return M===62?(e.consume(M),F):n(M)}function F(M){return M===null||Ue(M)?T(M):ot(M)?(e.consume(M),F):n(M)}function T(M){return M===45&&l===2?(e.consume(M),U):M===60&&l===1?(e.consume(M),z):M===62&&l===4?(e.consume(M),P):M===63&&l===3?(e.consume(M),R):M===93&&l===5?(e.consume(M),me):Ue(M)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(v6,Z,le)(M)):M===null||Ue(M)?(e.exit("htmlFlowData"),le(M)):(e.consume(M),T)}function le(M){return e.check(b6,W,Z)(M)}function W(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),Y}function Y(M){return M===null||Ue(M)?le(M):(e.enter("htmlFlowData"),T(M))}function U(M){return M===45?(e.consume(M),R):T(M)}function z(M){return M===47?(e.consume(M),u="",se):T(M)}function se(M){if(M===62){const he=u.toLowerCase();return Wy.includes(he)?(e.consume(M),P):T(M)}return Un(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),se):T(M)}function me(M){return M===93?(e.consume(M),R):T(M)}function R(M){return M===62?(e.consume(M),P):M===45&&l===2?(e.consume(M),R):T(M)}function P(M){return M===null||Ue(M)?(e.exit("htmlFlowData"),Z(M)):(e.consume(M),P)}function Z(M){return e.exit("htmlFlow"),t(M)}}function w6(e,t,n){const s=this;return l;function l(u){return Ue(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return s.parser.lazy[s.now().line]?n(u):t(u)}}function S6(e,t,n){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Mc,t,n)}}const k6={name:"htmlText",tokenize:j6};function j6(e,t,n){const s=this;let l,c,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),C):Un(R)?(e.consume(R),$):n(R)}function p(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),c=0,_):Un(R)?(e.consume(R),A):n(R)}function g(R){return R===45?(e.consume(R),b):n(R)}function v(R){return R===null?n(R):R===45?(e.consume(R),y):Ue(R)?(u=v,z(R)):(e.consume(R),v)}function y(R){return R===45?(e.consume(R),b):v(R)}function b(R){return R===62?U(R):R===45?y(R):v(R)}function _(R){const P="CDATA[";return R===P.charCodeAt(c++)?(e.consume(R),c===P.length?j:_):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),E):Ue(R)?(u=j,z(R)):(e.consume(R),j)}function E(R){return R===93?(e.consume(R),k):j(R)}function k(R){return R===62?U(R):R===93?(e.consume(R),k):j(R)}function A(R){return R===null||R===62?U(R):Ue(R)?(u=A,z(R)):(e.consume(R),A)}function C(R){return R===null?n(R):R===63?(e.consume(R),D):Ue(R)?(u=C,z(R)):(e.consume(R),C)}function D(R){return R===62?U(R):C(R)}function O(R){return Un(R)?(e.consume(R),L):n(R)}function L(R){return R===45||Rn(R)?(e.consume(R),L):I(R)}function I(R){return Ue(R)?(u=I,z(R)):ot(R)?(e.consume(R),I):U(R)}function $(R){return R===45||Rn(R)?(e.consume(R),$):R===47||R===62||Mt(R)?G(R):n(R)}function G(R){return R===47?(e.consume(R),U):R===58||R===95||Un(R)?(e.consume(R),B):Ue(R)?(u=G,z(R)):ot(R)?(e.consume(R),G):U(R)}function B(R){return R===45||R===46||R===58||R===95||Rn(R)?(e.consume(R),B):F(R)}function F(R){return R===61?(e.consume(R),T):Ue(R)?(u=F,z(R)):ot(R)?(e.consume(R),F):G(R)}function T(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),l=R,le):Ue(R)?(u=T,z(R)):ot(R)?(e.consume(R),T):(e.consume(R),W)}function le(R){return R===l?(e.consume(R),l=void 0,Y):R===null?n(R):Ue(R)?(u=le,z(R)):(e.consume(R),le)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Mt(R)?G(R):(e.consume(R),W)}function Y(R){return R===47||R===62||Mt(R)?G(R):n(R)}function U(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function z(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),se}function se(R){return ot(R)?pt(e,me,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):me(R)}function me(R){return e.enter("htmlTextData"),u(R)}}const sx={name:"labelEnd",resolveAll:T6,resolveTo:A6,tokenize:M6},N6={tokenize:R6},C6={tokenize:L6},E6={tokenize:D6};function T6(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",t+=l}}return e.length!==n.length&&pr(e,0,e.length,n),e}function A6(e,t){let n=e.length,s=0,l,c,u,f;for(;n--;)if(l=e[n][1],c){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(c=n,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(u=n);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=Dr(f,e.slice(c+1,c+s+3)),f=Dr(f,[["enter",g,t]]),f=Dr(f,of(t.parser.constructs.insideSpan.null,e.slice(c+s+4,u-3),t)),f=Dr(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=Dr(f,e.slice(u+1)),f=Dr(f,[["exit",h,t]]),pr(e,c,e.length,f),e}function M6(e,t,n){const s=this;let l=s.events.length,c,u;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){c=s.events[l][1];break}return f;function f(y){return c?c._inactive?v(y):(u=s.parser.defined.includes(Gr(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):n(y)}function h(y){return y===40?e.attempt(N6,g,u?g:v)(y):y===91?e.attempt(C6,g,u?p:v)(y):u?g(y):v(y)}function p(y){return e.attempt(E6,g,v)(y)}function g(y){return t(y)}function v(y){return c._balanced=!0,n(y)}}function R6(e,t,n){return s;function s(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),l}function l(v){return Mt(v)?uc(e,c)(v):c(v)}function c(v){return v===41?g(v):Xw(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Mt(v)?uc(e,h)(v):g(v)}function f(v){return n(v)}function h(v){return v===34||v===39||v===40?Kw(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Mt(v)?uc(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function L6(e,t,n){const s=this;return l;function l(f){return Ww.call(s,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return s.parser.defined.includes(Gr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function D6(e,t,n){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),l}function l(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const z6={name:"labelStartImage",resolveAll:sx.resolveAll,tokenize:O6};function O6(e,t,n){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(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 s.parser.constructs?n(f):t(f)}}const B6={name:"labelStartLink",resolveAll:sx.resolveAll,tokenize:P6};function P6(e,t,n){const s=this;return l;function l(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const em={name:"lineEnding",tokenize:U6};function U6(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),pt(e,t,"linePrefix")}}const Nd={name:"thematicBreak",tokenize:$6};function $6(e,t,n){let s=0,l;return c;function c(p){return e.enter("thematicBreak"),u(p)}function u(p){return l=p,f(p)}function f(p){return p===l?(e.enter("thematicBreakSequence"),h(p)):s>=3&&(p===null||Ue(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===l?(e.consume(p),s++,h):(e.exit("thematicBreakSequence"),ot(p)?pt(e,f,"whitespace")(p):f(p))}}const Wn={continuation:{tokenize:q6},exit:G6,name:"list",tokenize:I6},F6={partial:!0,tokenize:Y6},H6={partial:!0,tokenize:V6};function I6(e,t,n){const s=this,l=s.events[s.events.length-1];let c=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return f;function f(b){const _=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:vg(b)){if(s.containerState.type||(s.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Nd,n,p)(b):p(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return vg(b)&&++u<10?(e.consume(b),h):(!s.interrupt||u<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(Mc,s.interrupt?n:g,e.attempt(F6,y,v))}function g(b){return s.containerState.initialBlankLine=!0,c++,y(b)}function v(b){return ot(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function q6(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Mc,l,c);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,pt(e,t,"listItemIndent",s.containerState.size+1)(f)}function c(f){return s.containerState.furtherBlankLines||!ot(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,u(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(H6,t,u)(f))}function u(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,pt(e,e.attempt(Wn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function V6(e,t,n){const s=this;return pt(e,l,"listItemIndent",s.containerState.size+1);function l(c){const u=s.events[s.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===s.containerState.size?t(c):n(c)}}function G6(e){e.exit(this.containerState.type)}function Y6(e,t,n){const s=this;return pt(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(c){const u=s.events[s.events.length-1];return!ot(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Ky={name:"setextUnderline",resolveTo:Q6,tokenize:X6};function Q6(e,t){let n=e.length,s,l,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",c?(e.splice(l,0,["enter",u,t]),e.splice(c+1,0,["exit",e[s][1],t]),e[s][1].end={...e[c][1].end}):e[s][1]=u,e.push(["exit",u,t]),e}function X6(e,t,n){const s=this;let l;return c;function c(p){let g=s.events.length,v;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){v=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||v)?(e.enter("setextHeadingLine"),l=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===l?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ot(p)?pt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||Ue(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const W6={tokenize:K6};function K6(e){const t=this,n=e.attempt(Mc,s,e.attempt(this.parser.constructs.flowInitial,l,pt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(n6,l)),"linePrefix")));return n;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Z6={resolveAll:Jw()},J6=Zw("string"),eT=Zw("text");function Zw(e){return{resolveAll:Jw(e==="text"?tT:void 0),tokenize:t};function t(n){const s=this,l=this.parser.constructs[e],c=n.attempt(l,u,f);return u;function u(g){return p(g)?c(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"),c(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const v=l[g];let y=-1;if(v)for(;++y<v.length;){const b=v[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function Jw(e){return t;function t(n,s){let l=-1,c;for(;++l<=n.length;)c===void 0?n[l]&&n[l][1].type==="data"&&(c=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==c+2&&(n[c][1].end=n[l-1][1].end,n.splice(c+2,l-c-2),l=c+2),c=void 0);return e?e(n,s):n}}function tT(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 s=e[n-1][1],l=t.sliceStream(s);let c=l.length,u=-1,f=0,h;for(;c--;){const p=l[c];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){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:s.start._bufferIndex+u,_index:s.start._index+c,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const nT={42:Wn,43:Wn,45:Wn,48:Wn,49:Wn,50:Wn,51:Wn,52:Wn,53:Wn,54:Wn,55:Wn,56:Wn,57:Wn,62:Vw},rT={91:l6},sT={[-2]:Jp,[-1]:Jp,32:Jp},iT={35:h6,42:Nd,45:[Ky,Nd],60:x6,61:Ky,95:Nd,96:Xy,126:Xy},aT={38:Yw,92:Gw},lT={[-5]:em,[-4]:em,[-3]:em,33:z6,38:Yw,42:bg,60:[BE,k6],91:B6,92:[d6,Gw],93:sx,95:bg,96:WE},oT={null:[bg,Z6]},cT={null:[42,95]},uT={null:[]},dT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:cT,contentInitial:rT,disable:uT,document:nT,flow:iT,flowInitial:sT,insideSpan:oT,string:aT,text:lT},Symbol.toStringTag,{value:"Module"}));function fT(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},c=[];let u=[],f=[];const h={attempt:I(O),check:I(L),consume:A,enter:C,exit:D,interrupt:I(L,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:v};let g=t.tokenize.call(p,h);return t.resolveAll&&c.push(t),p;function v(F){return u=Dr(u,F),E(),u[u.length-1]!==null?[]:($(t,0),p.events=of(c,p.events,p),p.events)}function y(F,T){return pT(b(F),T)}function b(F){return hT(u,F)}function _(){const{_bufferIndex:F,_index:T,line:le,column:W,offset:Y}=s;return{_bufferIndex:F,_index:T,line:le,column:W,offset:Y}}function j(F){l[F.line]=F.column,B()}function E(){let F;for(;s._index<u.length;){const T=u[s._index];if(typeof T=="string")for(F=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===F&&s._bufferIndex<T.length;)k(T.charCodeAt(s._bufferIndex));else k(T)}}function k(F){g=g(F)}function A(F){Ue(F)?(s.line++,s.column=1,s.offset+=F===-3?2:1,B()):F!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===u[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=F}function C(F,T){const le=T||{};return le.type=F,le.start=_(),p.events.push(["enter",le,p]),f.push(le),le}function D(F){const T=f.pop();return T.end=_(),p.events.push(["exit",T,p]),T}function O(F,T){$(F,T.from)}function L(F,T){T.restore()}function I(F,T){return le;function le(W,Y,U){let z,se,me,R;return Array.isArray(W)?Z(W):"tokenize"in W?Z([W]):P(W);function P(Ce){return Re;function Re(Le){const Be=Le!==null&&Ce[Le],Je=Le!==null&&Ce.null,xe=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Je)?Je:Je?[Je]:[]];return Z(xe)(Le)}}function Z(Ce){return z=Ce,se=0,Ce.length===0?U:M(Ce[se])}function M(Ce){return Re;function Re(Le){return R=G(),me=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?_e():Ce.tokenize.call(T?Object.assign(Object.create(p),T):p,h,he,_e)(Le)}}function he(Ce){return F(me,R),Y}function _e(Ce){return R.restore(),++se<z.length?M(z[se]):U}}}function $(F,T){F.resolveAll&&!c.includes(F)&&c.push(F),F.resolve&&pr(p.events,T,p.events.length-T,F.resolve(p.events.slice(T),p)),F.resolveTo&&(p.events=F.resolveTo(p.events,p))}function G(){const F=_(),T=p.previous,le=p.currentConstruct,W=p.events.length,Y=Array.from(f);return{from:W,restore:U};function U(){s=F,p.previous=T,p.currentConstruct=le,p.events.length=W,f=Y,B()}}function B(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function hT(e,t){const n=t.start._index,s=t.start._bufferIndex,l=t.end._index,c=t.end._bufferIndex;let u;if(n===l)u=[e[n].slice(s,c)];else{if(u=e.slice(n,l),s>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(s):u.shift()}c>0&&u.push(e[l].slice(0,c))}return u}function pT(e,t){let n=-1;const s=[];let l;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
69
|
+
`;break}case-3:{u=`\r
|
|
70
|
+
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&l)continue;u=" ";break}default:u=String.fromCharCode(c)}l=c===-2,s.push(u)}return s.join("")}function mT(e){const s={constructs:Iw([dT,...(e||{}).extensions||[]]),content:l(AE),defined:[],document:l(RE),flow:l(W6),lazy:{},string:l(J6),text:l(eT)};return s;function l(c){return u;function u(f){return fT(s,c,f)}}}function gT(e){for(;!Qw(e););return e}const Zy=/[\0\t\n\r]/g;function xT(){let e=1,t="",n=!0,s;return l;function l(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(Zy.lastIndex=v,p=Zy.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){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:s=!0,e=1}v=y+1}return f&&(s&&h.push(-5),t&&h.push(t),h.push(null)),h}}const vT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bT(e){return e.replace(vT,yT)}function yT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),c=l===120||l===88;return qw(n.slice(c?2:1),c?16:10)}return rx(n)||e}const e2={}.hasOwnProperty;function _T(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),wT(n)(gT(mT(n).document().write(xT()(e,t,!0))))}function wT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(dn),autolinkProtocol:G,autolinkEmail:G,atxHeading:c(bt),blockQuote:c(Je),characterEscape:G,characterReference:G,codeFenced:c(xe),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(xe,u),codeText:c(Pe,u),codeTextData:G,data:G,codeFlowValue:G,definition:c(ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Rt),hardBreakEscape:c(Lt),hardBreakTrailing:c(Lt),htmlFlow:c(un,u),htmlFlowData:G,htmlText:c(un,u),htmlTextData:G,image:c(st),label:u,link:c(dn),listItem:c(je),listItemValue:y,listOrdered:c(bn,v),listUnordered:c(bn),paragraph:c(ze),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(bt),strong:c(yt),thematicBreak:c(Or)},exit:{atxHeading:h(),atxHeadingSequence:O,autolink:h(),autolinkEmail:Be,autolinkProtocol:Le,blockQuote:h(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:Re,codeFenced:h(E),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:B,codeIndented:h(k),codeText:h(Y),codeTextData:B,data:B,definition:h(),definitionDestinationString:D,definitionLabelString:A,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(T),hardBreakTrailing:h(T),htmlFlow:h(le),htmlFlowData:B,htmlText:h(W),htmlTextData:B,image:h(z),label:me,labelText:se,lineEnding:F,link:h(U),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:he,resourceDestinationString:R,resourceTitleString:P,resource:Z,setextHeading:h($),setextHeadingLineSequence:I,setextHeadingText:L,strong:h(),thematicBreak:h()}};t2(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ae){let ve={type:"root",children:[]};const Q={stack:[ve],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},fe=[];let Te=-1;for(;++Te<ae.length;)if(ae[Te][1].type==="listOrdered"||ae[Te][1].type==="listUnordered")if(ae[Te][0]==="enter")fe.push(Te);else{const Ye=fe.pop();Te=l(ae,Ye,Te)}for(Te=-1;++Te<ae.length;){const Ye=t[ae[Te][0]];e2.call(Ye,ae[Te][1].type)&&Ye[ae[Te][1].type].call(Object.assign({sliceSerialize:ae[Te][2].sliceSerialize},Q),ae[Te][1])}if(Q.tokenStack.length>0){const Ye=Q.tokenStack[Q.tokenStack.length-1];(Ye[1]||Jy).call(Q,void 0,Ye[0])}for(ve.position={start:Si(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Si(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<t.transforms.length;)ve=t.transforms[Te](ve)||ve;return ve}function l(ae,ve,Q){let fe=ve-1,Te=-1,Ye=!1,et,tt,vt,fn;for(;++fe<=Q;){const Ke=ae[fe];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?Te++:Te--,fn=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(et&&!fn&&!Te&&!vt&&(vt=fe),fn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fn=void 0}if(!Te&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||Te===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(et){let tr=fe;for(tt=void 0;tr--;){const En=ae[tr];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;tt&&(ae[tt][1].type="lineEndingBlank",Ye=!0),En[1].type="lineEnding",tt=tr}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}vt&&(!tt||vt<tt)&&(et._spread=!0),et.end=Object.assign({},tt?ae[tt][1].start:Ke[1].end),ae.splice(tt||fe,0,["exit",et,Ke[2]]),fe++,Q++}if(Ke[1].type==="listItemPrefix"){const tr={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};et=tr,ae.splice(fe,0,["enter",tr,Ke[2]]),fe++,Q++,vt=void 0,fn=!0}}}return ae[ve][1]._spread=Ye,Q}function c(ae,ve){return Q;function Q(fe){f.call(this,ae(fe),fe),ve&&ve.call(this,fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ae,ve,Q){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([ve,Q||void 0]),ae.position={start:Si(ve.start),end:void 0}}function h(ae){return ve;function ve(Q){ae&&ae.call(this,Q),p.call(this,Q)}}function p(ae,ve){const Q=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==ae.type&&(ve?ve.call(this,ae,fe[0]):(fe[1]||Jy).call(this,ae,fe[0]));else throw new Error("Cannot close `"+ae.type+"` ("+cc({start:ae.start,end:ae.end})+"): it’s not open");Q.position.end=Si(ae.end)}function g(){return nx(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ae}function _(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const ve=this.resume(),Q=this.stack[this.stack.length-1];Q.label=ve,Q.identifier=Gr(this.sliceSerialize(ae)).toLowerCase()}function C(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function D(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function O(ae){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Q=this.sliceSerialize(ae).length;ve.depth=Q}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function I(ae){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function G(ae){const Q=this.stack[this.stack.length-1].children;let fe=Q[Q.length-1];(!fe||fe.type!=="text")&&(fe=qe(),fe.position={start:Si(ae.start),end:void 0},Q.push(fe)),this.stack.push(fe)}function B(ae){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ae),ve.position.end=Si(ae.end)}function F(ae){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=ve.children[ve.children.length-1];Q.position.end=Si(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(G.call(this,ae),B.call(this,ae))}function T(){this.data.atHardBreak=!0}function le(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function W(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function Y(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function U(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function z(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function se(ae){const ve=this.sliceSerialize(ae),Q=this.stack[this.stack.length-2];Q.label=bT(ve),Q.identifier=Gr(ve).toLowerCase()}function me(){const ae=this.stack[this.stack.length-1],ve=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const fe=ae.children;Q.children=fe}else Q.alt=ve}function R(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function P(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function he(ae){const ve=this.resume(),Q=this.stack[this.stack.length-1];Q.label=ve,Q.identifier=Gr(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function _e(ae){this.data.characterReferenceType=ae.type}function Ce(ae){const ve=this.sliceSerialize(ae),Q=this.data.characterReferenceType;let fe;Q?(fe=qw(ve,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=rx(ve);const Te=this.stack[this.stack.length-1];Te.value+=fe}function Re(ae){const ve=this.stack.pop();ve.position.end=Si(ae.end)}function Le(ae){B.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ae)}function Be(ae){B.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ae)}function Je(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Pe(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Rt(){return{type:"emphasis",children:[]}}function bt(){return{type:"heading",depth:0,children:[]}}function Lt(){return{type:"break"}}function un(){return{type:"html",value:""}}function st(){return{type:"image",title:null,url:"",alt:null}}function dn(){return{type:"link",title:null,url:"",children:[]}}function bn(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function je(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function Or(){return{type:"thematicBreak"}}}function Si(e){return{line:e.line,column:e.column,offset:e.offset}}function t2(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?t2(e,s):ST(e,s)}}function ST(e,t){let n;for(n in t)if(e2.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Jy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+cc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is still open")}function kT(e){const t=this;t.parser=n;function n(s){return _T(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function jT(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 NT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
71
|
+
`}]}function CT(e,t){const n=t.value?t.value+`
|
|
72
|
+
`:"",s={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function ET(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=zl(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let u,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),u=e.footnoteOrder.length):u=c+1,f+=1,e.footnoteCounts.set(s,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(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 MT(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 RT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function n2(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const l=e.all(t),c=l[0];c&&c.type==="text"?c.value="["+c.value:l.unshift({type:"text",value:"["});const u=l[l.length-1];return u&&u.type==="text"?u.value+=s:l.push({type:"text",value:s}),l}function LT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return n2(e,t);const l={src:zl(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const c={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,c),e.applyData(t,c)}function DT(e,t){const n={src:zl(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 s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function zT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function OT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return n2(e,t);const l={href:zl(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const c={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function BT(e,t){const n={href:zl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function PT(e,t,n){const s=e.all(t),l=n?UT(n):r2(t),c={},u=[];if(typeof t.checked=="boolean"){const g=s[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},s.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(l||f!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
73
|
+
`}),g.type==="element"&&g.tagName==="p"&&!l?u.push(...g.children):u.push(g)}const h=s[s.length-1];h&&(l||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
|
|
74
|
+
`});const p={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,p),e.applyData(t,p)}function UT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=r2(n[s])}return t}function r2(e){const t=e.spread;return t??e.children.length>1}function $T(e,t){const n={},s=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l<s.length;){const u=s[l];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 c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)}function FT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function HT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function IT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qT(e,t){const n=e.all(t),s=n.shift(),l=[];if(s){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],u),l.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=Zg(t.children[1]),h=Ow(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),l.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)}function VT(e,t,n){const s=n?n.children:void 0,c=(s?s.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 v=t.children[h],y={},b=u?u[h]:void 0;b&&(y.align=b);let _={type:"element",tagName:c,properties:y,children:[]};v&&(_.children=e.all(v),e.patch(v,_),_=e.applyData(v,_)),p.push(_)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,g),e.applyData(t,g)}function GT(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const e5=9,t5=32;function YT(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),l=0;const c=[];for(;s;)c.push(n5(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=n.exec(t);return c.push(n5(t.slice(l),l>0,!1)),c.join("")}function n5(e,t,n){let s=0,l=e.length;if(t){let c=e.codePointAt(s);for(;c===e5||c===t5;)s++,c=e.codePointAt(s)}if(n){let c=e.codePointAt(l-1);for(;c===e5||c===t5;)l--,c=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function QT(e,t){const n={type:"text",value:YT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function XT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const WT={blockquote:jT,break:NT,code:CT,delete:ET,emphasis:TT,footnoteReference:AT,heading:MT,html:RT,imageReference:LT,image:DT,inlineCode:zT,linkReference:OT,link:BT,listItem:PT,list:$T,paragraph:FT,root:HT,strong:IT,table:qT,tableCell:GT,tableRow:VT,text:QT,thematicBreak:XT,toml:ud,yaml:ud,definition:ud,footnoteDefinition:ud};function ud(){}const s2=-1,cf=0,dc=1,Kd=2,ix=3,ax=4,lx=5,ox=6,i2=7,a2=8,KT=typeof self=="object"?self:globalThis,r5=(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 KT[e](t)},ZT=(e,t)=>{const n=(l,c)=>(e.set(c,l),l),s=l=>{if(e.has(l))return e.get(l);const[c,u]=t[l];switch(c){case cf:case s2:return n(u,l);case dc:{const f=n([],l);for(const h of u)f.push(s(h));return f}case Kd:{const f=n({},l);for(const[h,p]of u)f[s(h)]=s(p);return f}case ix:return n(new Date(u),l);case ax:{const{source:f,flags:h}=u;return n(new RegExp(f,h),l)}case lx:{const f=n(new Map,l);for(const[h,p]of u)f.set(s(h),s(p));return f}case ox:{const f=n(new Set,l);for(const h of u)f.add(s(h));return f}case i2:{const{name:f,message:h}=u;return n(r5(f,h),l)}case a2:return n(BigInt(u),l);case"BigInt":return n(Object(BigInt(u)),l);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(r5(c,u),l)};return s},s5=e=>ZT(new Map,e)(0),fa="",{toString:JT}={},{keys:eA}=Object,Yo=e=>{const t=typeof e;if(t!=="object"||!e)return[cf,t];const n=JT.call(e).slice(8,-1);switch(n){case"Array":return[dc,fa];case"Object":return[Kd,fa];case"Date":return[ix,fa];case"RegExp":return[ax,fa];case"Map":return[lx,fa];case"Set":return[ox,fa];case"DataView":return[dc,n]}return n.includes("Array")?[dc,n]:n.includes("Error")?[i2,n]:[Kd,n]},dd=([e,t])=>e===cf&&(t==="function"||t==="symbol"),tA=(e,t,n,s)=>{const l=(u,f)=>{const h=s.push(u)-1;return n.set(f,h),h},c=u=>{if(n.has(u))return n.get(u);let[f,h]=Yo(u);switch(f){case cf:{let g=u;switch(h){case"bigint":f=a2,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return l([s2],u)}return l([f,g],u)}case dc:{if(h){let y=u;return h==="DataView"?y=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(y=new Uint8Array(u)),l([h,[...y]],u)}const g=[],v=l([f,g],u);for(const y of u)g.push(c(y));return v}case Kd:{if(h)switch(h){case"BigInt":return l([h,u.toString()],u);case"Boolean":case"Number":case"String":return l([h,u.valueOf()],u)}if(t&&"toJSON"in u)return c(u.toJSON());const g=[],v=l([f,g],u);for(const y of eA(u))(e||!dd(Yo(u[y])))&&g.push([c(y),c(u[y])]);return v}case ix:return l([f,isNaN(u.getTime())?fa:u.toISOString()],u);case ax:{const{source:g,flags:v}=u;return l([f,{source:g,flags:v}],u)}case lx:{const g=[],v=l([f,g],u);for(const[y,b]of u)(e||!(dd(Yo(y))||dd(Yo(b))))&&g.push([c(y),c(b)]);return v}case ox:{const g=[],v=l([f,g],u);for(const y of u)(e||!dd(Yo(y)))&&g.push(c(y));return v}}const{message:p}=u;return l([f,{name:h,message:p}],u)};return c},i5=(e,{json:t,lossy:n}={})=>{const s=[];return tA(!(t||n),!!t,new Map,s)(e),s},Zd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?s5(i5(e,t)):structuredClone(e):(e,t)=>s5(i5(e,t));function nA(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 rA(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function sA(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||nA,s=e.options.footnoteBackLabel||rA,l=e.options.footnoteLabel||"Footnotes",c=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),v=String(p.identifier).toUpperCase(),y=zl(v.toLowerCase());let b=0;const _=[],j=e.footnoteCounts.get(v);for(;j!==void 0&&++b<=j;){_.length>0&&_.push({type:"text",value:" "});let A=typeof n=="string"?n:n(h,b);typeof A=="string"&&(A={type:"text",value:A}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(h,b),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const A=E.children[E.children.length-1];A&&A.type==="text"?A.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(..._)}else g.push(..._);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},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:c,properties:{...Zd(u),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
75
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
76
|
+
`}]}}const uf=(function(e){if(e==null)return oA;if(typeof e=="function")return df(e);if(typeof e=="object")return Array.isArray(e)?iA(e):aA(e);if(typeof e=="string")return lA(e);throw new Error("Expected function, string, or object as test")});function iA(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=uf(e[n]);return df(s);function s(...l){let c=-1;for(;++c<t.length;)if(t[c].apply(this,l))return!0;return!1}}function aA(e){const t=e;return df(n);function n(s){const l=s;let c;for(c in e)if(l[c]!==t[c])return!1;return!0}}function lA(e){return df(t);function t(n){return n&&n.type===e}}function df(e){return t;function t(n,s,l){return!!(cA(n)&&e.call(this,n,typeof s=="number"?s:void 0,l||void 0))}}function oA(){return!0}function cA(e){return e!==null&&typeof e=="object"&&"type"in e}const l2=[],uA=!0,yg=!1,dA="skip";function o2(e,t,n,s){let l;typeof t=="function"&&typeof n!="function"?(s=n,n=t):l=t;const c=uf(l),u=s?-1:1;f(e,void 0,[])();function f(h,p,g){const v=h&&typeof h=="object"?h:{};if(typeof v.type=="string"){const b=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(h.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=l2,_,j,E;if((!t||c(h,p,g[g.length-1]||void 0))&&(b=fA(n(h,g)),b[0]===yg))return b;if("children"in h&&h.children){const k=h;if(k.children&&b[0]!==dA)for(j=(s?k.children.length:-1)+u,E=g.concat(k);j>-1&&j<k.children.length;){const A=k.children[j];if(_=f(A,j,E)(),_[0]===yg)return _;j=typeof _[1]=="number"?_[1]:j+u}}return b}}}function fA(e){return Array.isArray(e)?e:typeof e=="number"?[uA,e]:e==null?l2:[e]}function cx(e,t,n,s){let l,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,l=n):(c=t,u=n,l=s),o2(e,c,f,l);function f(h,p){const g=p[p.length-1],v=g?g.children.indexOf(h):void 0;return u(h,v,g)}}const _g={}.hasOwnProperty,hA={};function pA(e,t){const n=t||hA,s=new Map,l=new Map,c=new Map,u={...WT,...n.handlers},f={all:p,applyData:gA,definitionById:s,footnoteById:l,footnoteCounts:c,footnoteOrder:[],handlers:u,one:h,options:n,patch:mA,wrap:vA};return cx(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?s:l,y=String(g.identifier).toUpperCase();v.has(y)||v.set(y,g)}}),f;function h(g,v){const y=g.type,b=f.handlers[y];if(_g.call(f.handlers,y)&&b)return b(f,g,v);if(f.options.passThrough&&f.options.passThrough.includes(y)){if("children"in g){const{children:j,...E}=g,k=Zd(E);return k.children=f.all(g),k}return Zd(g)}return(f.options.unknownHandler||xA)(f,g,v)}function p(g){const v=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const _=f.one(y[b],g);if(_){if(b&&y[b-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=a5(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=a5(j.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function mA(e,t){e.position&&(t.position=nE(e))}function gA(e,t){let n=t;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const u="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,Zd(c)),"children"in n&&n.children&&l!==null&&l!==void 0&&(n.children=l)}return n}function xA(e,t){const n=t.data||{},s="value"in t&&!(_g.call(n,"hProperties")||_g.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function vA(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
77
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
78
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
79
|
+
`}),n}function a5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function l5(e,t){const n=pA(e,t),s=n.one(e,void 0),l=sA(n),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&c.children.push({type:"text",value:`
|
|
80
|
+
`},l),c}function bA(e,t){return e&&"run"in e?async function(n,s){const l=l5(n,{file:s,...t});await e.run(l,s)}:function(n,s){return l5(n,{file:s,...e||t})}}function o5(e){if(e)throw e}var tm,c5;function yA(){if(c5)return tm;c5=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),v=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!v)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},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(s)return s(p,g).value}else return;return p[g]};return tm=function h(){var p,g,v,y,b,_,j=arguments[0],E=1,k=arguments.length,A=!1;for(typeof j=="boolean"&&(A=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<k;++E)if(p=arguments[E],p!=null)for(g in p)v=f(j,g),y=f(p,g),j!==y&&(A&&y&&(c(y)||(b=l(y)))?(b?(b=!1,_=v&&l(v)?v:[]):_=v&&c(v)?v:{},u(j,{name:g,newValue:h(A,_,y)})):typeof y<"u"&&u(j,{name:g,newValue:y}));return j},tm}var _A=yA();const nm=Eg(_A);function wg(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 wA(){const e=[],t={run:n,use:s};return t;function n(...l){let c=-1;const u=l.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...l);function f(h,...p){const g=e[++c];let v=-1;if(h){u(h);return}for(;++v<l.length;)(p[v]===null||p[v]===void 0)&&(p[v]=l[v]);l=p,g?SA(g,f)(...p):u(null,...p)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function SA(e,t){let n;return s;function s(...u){const f=e.length>u.length;let h;f&&u.push(l);try{h=e.apply(this,u)}catch(p){const g=p;if(f&&n)throw g;return l(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(c,l):h instanceof Error?l(h):c(h))}function l(u,...f){n||(n=!0,t(u,...f))}function c(u){l(null,u)}}const is={basename:kA,dirname:jA,extname:NA,join:CA,sep:"/"};function kA(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Rc(e);let n=0,s=-1,l=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(c){n=l+1;break}}else s<0&&(c=!0,s=l+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let u=-1,f=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(c){n=l+1;break}}else u<0&&(c=!0,u=l+1),f>-1&&(e.codePointAt(l)===t.codePointAt(f--)?f<0&&(s=l):(f=-1,s=u));return n===s?s=u:s<0&&(s=e.length),e.slice(n,s)}function jA(e){if(Rc(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function NA(e){Rc(e);let t=e.length,n=-1,s=0,l=-1,c=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){s=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?l<0?l=t:c!==1&&(c=1):l>-1&&(c=-1)}return l<0||n<0||c===0||c===1&&l===n-1&&l===s+1?"":e.slice(l,n)}function CA(...e){let t=-1,n;for(;++t<e.length;)Rc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":EA(n)}function EA(e){Rc(e);const t=e.codePointAt(0)===47;let n=TA(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function TA(e,t){let n="",s=0,l=-1,c=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(!(l===u-1||c===1))if(l!==u-1&&c===2){if(n.length<2||s!==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="",s=0):(n=n.slice(0,h),s=n.length-1-n.lastIndexOf("/")),l=u,c=0;continue}}else if(n.length>0){n="",s=0,l=u,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(l+1,u):n=e.slice(l+1,u),s=u-l-1;l=u,c=0}else f===46&&c>-1?c++:c=-1}return n}function Rc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const AA={cwd:MA};function MA(){return"/"}function Sg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function RA(e){if(typeof e=="string")e=new URL(e);else if(!Sg(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 LA(e)}function LA(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const rm=["history","path","basename","stem","extname","dirname"];class c2{constructor(t){let n;t?Sg(t)?n={path:t}:typeof t=="string"||DA(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":AA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<rm.length;){const c=rm[s];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let l;for(l in n)rm.includes(l)||(this[l]=n[l])}get basename(){return typeof this.path=="string"?is.basename(this.path):void 0}set basename(t){im(t,"basename"),sm(t,"basename"),this.path=is.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?is.dirname(this.path):void 0}set dirname(t){u5(this.basename,"dirname"),this.path=is.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?is.extname(this.path):void 0}set extname(t){if(sm(t,"extname"),u5(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=is.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sg(t)&&(t=RA(t)),im(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?is.basename(this.path,this.extname):void 0}set stem(t){im(t,"stem"),sm(t,"stem"),this.path=is.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const l=this.message(t,n,s);throw l.fatal=!0,l}info(t,n,s){const l=this.message(t,n,s);return l.fatal=void 0,l}message(t,n,s){const l=new Ln(t,n,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function sm(e,t){if(e&&e.includes(is.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+is.sep+"`")}function im(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function u5(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function DA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zA=(function(e){const s=this.constructor.prototype,l=s[e],c=function(){return l.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),OA={}.hasOwnProperty;class ux extends zA{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=wA()}copy(){const t=new ux;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(nm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(om("data",this.frozen),this.namespace[t]=n,this):OA.call(this.namespace,t)&&this.namespace[t]||void 0:t?(om("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,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=n.call(t,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=fd(t),s=this.parser||this.Parser;return am("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),am("process",this.parser||this.Parser),lm("process",this.compiler||this.Compiler),n?l(void 0,n):new Promise(l);function l(c,u){const f=fd(t),h=s.parse(f);s.run(h,f,function(g,v,y){if(g||!v||!y)return p(g);const b=v,_=s.stringify(b,y);UA(_)?y.value=_:y.result=_,p(g,y)});function p(g,v){g||!v?u(g):c?c(v):n(void 0,v)}}}processSync(t){let n=!1,s;return this.freeze(),am("processSync",this.parser||this.Parser),lm("processSync",this.compiler||this.Compiler),this.process(t,l),f5("processSync","process",n),s;function l(c,u){n=!0,o5(c),s=u}}run(t,n,s){d5(t),this.freeze();const l=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?c(void 0,s):new Promise(c);function c(u,f){const h=fd(n);l.run(t,h,p);function p(g,v,y){const b=v||t;g?f(g):u?u(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,l;return this.run(t,n,c),f5("runSync","run",s),l;function c(u,f){o5(u),l=f,s=!0}}stringify(t,n){this.freeze();const s=fd(n),l=this.compiler||this.Compiler;return lm("stringify",l),d5(t),l(t,s)}use(t,...n){const s=this.attachers,l=this.namespace;if(om("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 c(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...v]=p;h(g,v)}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&&(l.settings=nm(!0,l.settings,p.settings))}function f(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const v=p[g];c(v)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,g){let v=-1,y=-1;for(;++v<s.length;)if(s[v][0]===p){y=v;break}if(y===-1)s.push([p,...g]);else if(g.length>0){let[b,..._]=g;const j=s[y][1];wg(j)&&wg(b)&&(b=nm(!0,j,b)),s[y]=[p,b,..._]}}}}const BA=new ux().freeze();function am(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function lm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function om(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 d5(e){if(!wg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function f5(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function fd(e){return PA(e)?e:new c2(e)}function PA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UA(e){return typeof e=="string"||$A(e)}function $A(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const FA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",h5=[],p5={allowDangerousHtml:!0},HA=/^(https?|ircs?|mailto|xmpp)$/i,IA=[{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 dx(e){const t=qA(e),n=VA(e);return GA(t.runSync(t.parse(n),n),e)}function qA(e){const t=e.rehypePlugins||h5,n=e.remarkPlugins||h5,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...p5}:p5;return BA().use(kT).use(n).use(bA,s).use(t)}function VA(e){const t=e.children||"",n=new c2;return typeof t=="string"&&(n.value=t),n}function GA(e,t){const n=t.allowedElements,s=t.allowElement,l=t.components,c=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||YA;for(const g of IA)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+FA+g.id,void 0);return cx(e,p),lE(e,{Fragment:a.Fragment,components:l,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function p(g,v,y){if(g.type==="raw"&&y&&typeof v=="number")return u?y.children.splice(v,1):y.children[v]={type:"text",value:g.value},v;if(g.type==="element"){let b;for(b in Zp)if(Object.hasOwn(Zp,b)&&Object.hasOwn(g.properties,b)){const _=g.properties[b],j=Zp[b];(j===null||j.includes(g.tagName))&&(g.properties[b]=h(String(_||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):c?c.includes(g.tagName):!1;if(!b&&s&&typeof v=="number"&&(b=!s(g,v,y)),b&&y&&typeof v=="number")return f&&g.children?y.children.splice(v,1,...g.children):y.children.splice(v,1),v}}}function YA(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||s!==-1&&t>s||HA.test(e.slice(0,t))?e:""}function m5(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,l=n.indexOf(t);for(;l!==-1;)s++,l=n.indexOf(t,l+t.length);return s}function QA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function XA(e,t,n){const l=uf((n||{}).ignore||[]),c=WA(t);let u=-1;for(;++u<c.length;)o2(e,"text",f);function f(p,g){let v=-1,y;for(;++v<g.length;){const b=g[v],_=y?y.children:void 0;if(l(b,_?_.indexOf(b):void 0,y))return;y=b}if(y)return h(p,g)}function h(p,g){const v=g[g.length-1],y=c[u][0],b=c[u][1];let _=0;const E=v.children.indexOf(p);let k=!1,A=[];y.lastIndex=0;let C=y.exec(p.value);for(;C;){const D=C.index,O={index:C.index,input:C.input,stack:[...g,p]};let L=b(...C,O);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?y.lastIndex=D+1:(_!==D&&A.push({type:"text",value:p.value.slice(_,D)}),Array.isArray(L)?A.push(...L):L&&A.push(L),_=D+C[0].length,k=!0),!y.global)break;C=y.exec(p.value)}return k?(_<p.value.length&&A.push({type:"text",value:p.value.slice(_)}),v.children.splice(E,1,...A)):A=[p],E+A.length}}function WA(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 s=-1;for(;++s<n.length;){const l=n[s];t.push([KA(l[0]),ZA(l[1])])}return t}function KA(e){return typeof e=="string"?new RegExp(QA(e),"g"):e}function ZA(e){return typeof e=="function"?e:function(){return e}}const cm="phrasing",um=["autolink","link","image","label"];function JA(){return{transforms:[aM],enter:{literalAutolink:tM,literalAutolinkEmail:dm,literalAutolinkHttp:dm,literalAutolinkWww:dm},exit:{literalAutolink:iM,literalAutolinkEmail:sM,literalAutolinkHttp:nM,literalAutolinkWww:rM}}}function eM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cm,notInConstruct:um},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cm,notInConstruct:um},{character:":",before:"[ps]",after:"\\/",inConstruct:cm,notInConstruct:um}]}}function tM(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function dm(e){this.config.enter.autolinkProtocol.call(this,e)}function nM(e){this.config.exit.autolinkProtocol.call(this,e)}function rM(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 sM(e){this.config.exit.autolinkEmail.call(this,e)}function iM(e){this.exit(e)}function aM(e){XA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,lM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),oM]],{ignore:["link","linkReference"]})}function lM(e,t,n,s,l){let c="";if(!u2(l)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!cM(n)))return!1;const u=uM(n+s);if(!u[0])return!1;const f={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function oM(e,t,n,s){return!u2(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function cM(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 uM(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const l=m5(e,"(");let c=m5(e,")");for(;s!==-1&&l>c;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),c++;return[e,n]}function u2(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ba(n)||lf(n))&&(!t||n!==47)}d2.peek=bM;function dM(){this.buffer()}function fM(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function hM(){this.buffer()}function pM(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function mM(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Gr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function gM(e){this.exit(e)}function xM(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Gr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function vM(e){this.exit(e)}function bM(){return"["}function d2(e,t,n,s){const l=n.createTracker(s);let c=l.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return c+=l.move(n.safe(n.associationId(e),{after:"]",before:c})),f(),u(),c+=l.move("]"),c}function yM(){return{enter:{gfmFootnoteCallString:dM,gfmFootnoteCall:fM,gfmFootnoteDefinitionLabelString:hM,gfmFootnoteDefinition:pM},exit:{gfmFootnoteCallString:mM,gfmFootnoteCall:gM,gfmFootnoteDefinitionLabelString:xM,gfmFootnoteDefinition:vM}}}function _M(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:d2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,l,c,u){const f=c.createTracker(u);let h=f.move("[^");const p=c.enter("footnoteDefinition"),g=c.enter("label");return h+=f.move(c.safe(c.associationId(s),{before:h,after:"]"})),g(),h+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),h+=f.move((t?`
|
|
81
|
+
`:" ")+c.indentLines(c.containerFlow(s,f.current()),t?f2:wM))),p(),h}}function wM(e,t,n){return t===0?e:f2(e,t,n)}function f2(e,t,n){return(n?"":" ")+e}const SM=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];h2.peek=EM;function kM(){return{canContainEols:["delete"],enter:{strikethrough:NM},exit:{strikethrough:CM}}}function jM(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:SM}],handlers:{delete:h2}}}function NM(e){this.enter({type:"delete",children:[]},e)}function CM(e){this.exit(e)}function h2(e,t,n,s){const l=n.createTracker(s),c=n.enter("strikethrough");let u=l.move("~~");return u+=n.containerPhrasing(e,{...l.current(),before:u,after:"~"}),u+=l.move("~~"),c(),u}function EM(){return"~"}function TM(e){return e.length}function AM(e,t){const n=t||{},s=(n.align||[]).concat(),l=n.stringLength||TM,c=[],u=[],f=[],h=[];let p=0,g=-1;for(;++g<e.length;){const j=[],E=[];let k=-1;for(e[g].length>p&&(p=e[g].length);++k<e[g].length;){const A=MM(e[g][k]);if(n.alignDelimiters!==!1){const C=l(A);E[k]=C,(h[k]===void 0||C>h[k])&&(h[k]=C)}j.push(A)}u[g]=j,f[g]=E}let v=-1;if(typeof s=="object"&&"length"in s)for(;++v<p;)c[v]=g5(s[v]);else{const j=g5(s);for(;++v<p;)c[v]=j}v=-1;const y=[],b=[];for(;++v<p;){const j=c[v];let E="",k="";j===99?(E=":",k=":"):j===108?E=":":j===114&&(k=":");let A=n.alignDelimiters===!1?1:Math.max(1,h[v]-E.length-k.length);const C=E+"-".repeat(A)+k;n.alignDelimiters!==!1&&(A=E.length+A+k.length,A>h[v]&&(h[v]=A),b[v]=A),y[v]=C}u.splice(1,0,y),f.splice(1,0,b),g=-1;const _=[];for(;++g<u.length;){const j=u[g],E=f[g];v=-1;const k=[];for(;++v<p;){const A=j[v]||"";let C="",D="";if(n.alignDelimiters!==!1){const O=h[v]-(E[v]||0),L=c[v];L===114?C=" ".repeat(O):L===99?O%2?(C=" ".repeat(O/2+.5),D=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),D=C):D=" ".repeat(O)}n.delimiterStart!==!1&&!v&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&A==="")&&(n.delimiterStart!==!1||v)&&k.push(" "),n.alignDelimiters!==!1&&k.push(C),k.push(A),n.alignDelimiters!==!1&&k.push(D),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||v!==p-1)&&k.push("|")}_.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return _.join(`
|
|
82
|
+
`)}function MM(e){return e==null?"":String(e)}function g5(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 RM(e,t,n,s){const l=n.enter("blockquote"),c=n.createTracker(s);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),LM);return l(),u}function LM(e,t,n){return">"+(n?"":" ")+e}function DM(e,t){return x5(e,t.inConstruct,!0)&&!x5(e,t.notInConstruct,!1)}function x5(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function v5(e,t,n,s){let l=-1;for(;++l<n.unsafe.length;)if(n.unsafe[l].character===`
|
|
83
|
+
`&&DM(n.stack,n.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
84
|
+
`}function zM(e,t){const n=String(e);let s=n.indexOf(t),l=s,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++c>u&&(u=c):c=1,l=s+t.length,s=n.indexOf(t,l);return u}function OM(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 BM(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 PM(e,t,n,s){const l=BM(n),c=e.value||"",u=l==="`"?"GraveAccent":"Tilde";if(OM(e,n)){const v=n.enter("codeIndented"),y=n.indentLines(c,UM);return v(),y}const f=n.createTracker(s),h=l.repeat(Math.max(zM(c,l)+1,3)),p=n.enter("codeFenced");let g=f.move(h);if(e.lang){const v=n.enter(`codeFencedLang${u}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${u}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
|
|
85
|
+
`,encode:["`"],...f.current()})),v()}return g+=f.move(`
|
|
86
|
+
`),c&&(g+=f.move(c+`
|
|
87
|
+
`)),g+=f.move(h),p(),g}function UM(e,t,n){return(n?"":" ")+e}function fx(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 $M(e,t,n,s){const l=fx(n),c=l==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(s);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?" ":`
|
|
88
|
+
`,...h.current()}))),f(),e.title&&(f=n.enter(`title${c}`),p+=h.move(" "+l),p+=h.move(n.safe(e.title,{before:p,after:l,...h.current()})),p+=h.move(l),f()),u(),p}function FM(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 Nc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Jd(e,t,n){const s=Al(e),l=Al(t);return s===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}p2.peek=HM;function p2(e,t,n,s){const l=FM(n),c=n.enter("emphasis"),u=n.createTracker(s),f=u.move(l);let h=u.move(n.containerPhrasing(e,{after:l,before:f,...u.current()}));const p=h.charCodeAt(0),g=Jd(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(h=Nc(p)+h.slice(1));const v=h.charCodeAt(h.length-1),y=Jd(s.after.charCodeAt(0),v,l);y.inside&&(h=h.slice(0,-1)+Nc(v));const b=u.move(l);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},f+h+b}function HM(e,t,n){return n.options.emphasis||"*"}function IM(e,t){let n=!1;return cx(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,yg}),!!((!e.depth||e.depth<3)&&nx(e)&&(t.options.setext||n))}function qM(e,t,n,s){const l=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(s);if(IM(e,n)){const g=n.enter("headingSetext"),v=n.enter("phrasing"),y=n.containerPhrasing(e,{...c.current(),before:`
|
|
89
|
+
`,after:`
|
|
90
|
+
`});return v(),g(),y+`
|
|
91
|
+
`+(l===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
92
|
+
`))+1))}const u="#".repeat(l),f=n.enter("headingAtx"),h=n.enter("phrasing");c.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
93
|
+
`,...c.current()});return/^[\t ]/.test(p)&&(p=Nc(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),h(),f(),p}m2.peek=VM;function m2(e){return e.value||""}function VM(){return"<"}g2.peek=GM;function g2(e,t,n,s){const l=fx(n),c=l==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(s);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${c}`),p+=h.move(" "+l),p+=h.move(n.safe(e.title,{before:p,after:l,...h.current()})),p+=h.move(l),f()),p+=h.move(")"),u(),p}function GM(){return"!"}x2.peek=YM;function x2(e,t,n,s){const l=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(s);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 v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,c(),l==="full"||!p||p!==v?h+=f.move(v+"]"):l==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function YM(){return"!"}v2.peek=QM;function v2(e,t,n){let s=e.value||"",l="`",c=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<n.unsafe.length;){const u=n.unsafe[c],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(s);){let p=h.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(h.index+1)}}return l+s+l}function QM(){return"`"}function b2(e,t){const n=nx(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))}y2.peek=XM;function y2(e,t,n,s){const l=fx(n),c=l==='"'?"Quote":"Apostrophe",u=n.createTracker(s);let f,h;if(b2(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let v=u.move("<");return v+=u.move(n.containerPhrasing(e,{before:v,after:">",...u.current()})),v+=u.move(">"),f(),n.stack=g,v}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${c}`),p+=u.move(" "+l),p+=u.move(n.safe(e.title,{before:p,after:l,...u.current()})),p+=u.move(l),h()),p+=u.move(")"),f(),p}function XM(e,t,n){return b2(e,n)?"<":"["}_2.peek=WM;function _2(e,t,n,s){const l=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(s);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 v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,c(),l==="full"||!p||p!==v?h+=f.move(v+"]"):l==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function WM(){return"["}function hx(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 KM(e){const t=hx(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 ZM(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 w2(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 JM(e,t,n,s){const l=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?ZM(n):hx(n);const f=e.ordered?u==="."?")":".":KM(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),w2(n)===u&&g){let v=-1;for(;++v<e.children.length;){const y=e.children[v];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const p=n.containerFlow(e,s);return n.bulletLastUsed=u,n.bulletCurrent=c,l(),p}function e8(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 t8(e,t,n,s){const l=e8(n);let c=n.bulletCurrent||hx(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(s);f.move(c+" ".repeat(u-c.length)),f.shift(u);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,f.current()),g);return h(),p;function g(v,y,b){return y?(b?"":" ".repeat(u))+v:(b?c:c+" ".repeat(u-c.length))+v}}function n8(e,t,n,s){const l=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,s);return c(),l(),u}const r8=uf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function s8(e,t,n,s){return(e.children.some(function(u){return r8(u)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function i8(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}S2.peek=a8;function S2(e,t,n,s){const l=i8(n),c=n.enter("strong"),u=n.createTracker(s),f=u.move(l+l);let h=u.move(n.containerPhrasing(e,{after:l,before:f,...u.current()}));const p=h.charCodeAt(0),g=Jd(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(h=Nc(p)+h.slice(1));const v=h.charCodeAt(h.length-1),y=Jd(s.after.charCodeAt(0),v,l);y.inside&&(h=h.slice(0,-1)+Nc(v));const b=u.move(l+l);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},f+h+b}function a8(e,t,n){return n.options.strong||"*"}function l8(e,t,n,s){return n.safe(e.value,s)}function o8(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 c8(e,t,n){const s=(w2(n)+(n.options.ruleSpaces?" ":"")).repeat(o8(n));return n.options.ruleSpaces?s.slice(0,-1):s}const k2={blockquote:RM,break:v5,code:PM,definition:$M,emphasis:p2,hardBreak:v5,heading:qM,html:m2,image:g2,imageReference:x2,inlineCode:v2,link:y2,linkReference:_2,list:JM,listItem:t8,paragraph:n8,root:s8,strong:S2,text:l8,thematicBreak:c8};function u8(){return{enter:{table:d8,tableData:b5,tableHeader:b5,tableRow:h8},exit:{codeText:p8,table:f8,tableData:fm,tableHeader:fm,tableRow:fm}}}function d8(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 f8(e){this.exit(e),this.data.inTable=void 0}function h8(e){this.enter({type:"tableRow",children:[]},e)}function fm(e){this.exit(e)}function b5(e){this.enter({type:"tableCell",children:[]},e)}function p8(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,m8));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function m8(e,t){return t==="|"?t:e}function g8(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
94
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:h,tableRow:f}};function u(b,_,j,E){return p(g(b,j,E),b.align)}function f(b,_,j,E){const k=v(b,j,E),A=p([k]);return A.slice(0,A.indexOf(`
|
|
95
|
+
`))}function h(b,_,j,E){const k=j.enter("tableCell"),A=j.enter("phrasing"),C=j.containerPhrasing(b,{...E,before:c,after:c});return A(),k(),C}function p(b,_){return AM(b,{align:_,alignDelimiters:s,padding:n,stringLength:l})}function g(b,_,j){const E=b.children;let k=-1;const A=[],C=_.enter("table");for(;++k<E.length;)A[k]=v(E[k],_,j);return C(),A}function v(b,_,j){const E=b.children;let k=-1;const A=[],C=_.enter("tableRow");for(;++k<E.length;)A[k]=h(E[k],b,_,j);return C(),A}function y(b,_,j){let E=k2.inlineCode(b,_,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function x8(){return{exit:{taskListCheckValueChecked:y5,taskListCheckValueUnchecked:y5,paragraph:b8}}}function v8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:y8}}}function y5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function b8(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 s=n.children[0];if(s&&s.type==="text"){const l=t.children;let c=-1,u;for(;++c<l.length;){const f=l[c];if(f.type==="paragraph"){u=f;break}}u===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function y8(e,t,n,s){const l=e.children[0],c=typeof e.checked=="boolean"&&l&&l.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(s);c&&f.move(u);let h=k2.listItem(e,t,n,{...s,...f.current()});return c&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(g){return g+u}}function _8(){return[JA(),yM(),kM(),u8(),x8()]}function w8(e){return{extensions:[eM(),_M(e),jM(),g8(e),v8()]}}const S8={tokenize:T8,partial:!0},j2={tokenize:A8,partial:!0},N2={tokenize:M8,partial:!0},C2={tokenize:R8,partial:!0},k8={tokenize:L8,partial:!0},E2={name:"wwwAutolink",tokenize:C8,previous:A2},T2={name:"protocolAutolink",tokenize:E8,previous:M2},Vs={name:"emailAutolink",tokenize:N8,previous:R2},fs={};function j8(){return{text:fs}}let la=48;for(;la<123;)fs[la]=Vs,la++,la===58?la=65:la===91&&(la=97);fs[43]=Vs;fs[45]=Vs;fs[46]=Vs;fs[95]=Vs;fs[72]=[Vs,T2];fs[104]=[Vs,T2];fs[87]=[Vs,E2];fs[119]=[Vs,E2];function N8(e,t,n){const s=this;let l,c;return u;function u(v){return!kg(v)||!R2.call(s,s.previous)||px(s.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(v))}function f(v){return kg(v)?(e.consume(v),f):v===64?(e.consume(v),h):n(v)}function h(v){return v===46?e.check(k8,g,p)(v):v===45||v===95||Rn(v)?(c=!0,e.consume(v),h):g(v)}function p(v){return e.consume(v),l=!0,h}function g(v){return c&&l&&Un(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function C8(e,t,n){const s=this;return l;function l(u){return u!==87&&u!==119||!A2.call(s,s.previous)||px(s.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(S8,e.attempt(j2,e.attempt(N2,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function E8(e,t,n){const s=this;let l="",c=!1;return u;function u(v){return(v===72||v===104)&&M2.call(s,s.previous)&&!px(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(v),e.consume(v),f):n(v)}function f(v){if(Un(v)&&l.length<5)return l+=String.fromCodePoint(v),e.consume(v),f;if(v===58){const y=l.toLowerCase();if(y==="http"||y==="https")return e.consume(v),h}return n(v)}function h(v){return v===47?(e.consume(v),c?p:(c=!0,h)):n(v)}function p(v){return v===null||Wd(v)||Mt(v)||ba(v)||lf(v)?n(v):e.attempt(j2,e.attempt(N2,g),n)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function T8(e,t,n){let s=0;return l;function l(u){return(u===87||u===119)&&s<3?(s++,e.consume(u),l):u===46&&s===3?(e.consume(u),c):n(u)}function c(u){return u===null?n(u):t(u)}}function A8(e,t,n){let s,l,c;return u;function u(p){return p===46||p===95?e.check(C2,h,f)(p):p===null||Mt(p)||ba(p)||p!==45&&lf(p)?h(p):(c=!0,e.consume(p),u)}function f(p){return p===95?s=!0:(l=s,s=void 0),e.consume(p),u}function h(p){return l||s||!c?n(p):t(p)}}function M8(e,t){let n=0,s=0;return l;function l(u){return u===40?(n++,e.consume(u),l):u===41&&s<n?c(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(C2,t,c)(u):u===null||Mt(u)||ba(u)?t(u):(e.consume(u),l)}function c(u){return u===41&&s++,e.consume(u),l}}function R8(e,t,n){return s;function s(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),s):f===38?(e.consume(f),c):f===93?(e.consume(f),l):f===60||f===null||Mt(f)||ba(f)?t(f):n(f)}function l(f){return f===null||f===40||f===91||Mt(f)||ba(f)?t(f):s(f)}function c(f){return Un(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),s):Un(f)?(e.consume(f),u):n(f)}}function L8(e,t,n){return s;function s(c){return e.consume(c),l}function l(c){return Rn(c)?n(c):t(c)}}function A2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Mt(e)}function M2(e){return!Un(e)}function R2(e){return!(e===47||kg(e))}function kg(e){return e===43||e===45||e===46||e===95||Rn(e)}function px(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const D8={tokenize:H8,partial:!0};function z8(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:U8,continuation:{tokenize:$8},exit:F8}},text:{91:{name:"gfmFootnoteCall",tokenize:P8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:O8,resolveTo:B8}}}}function O8(e,t,n){const s=this;let l=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u;for(;l--;){const h=s.events[l][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=Gr(s.sliceSerialize({start:u.end,end:s.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function B8(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 s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...f),e}function P8(e,t,n){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,u;return f;function f(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),h}function h(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(v){if(c>999||v===93&&!u||v===null||v===91||Mt(v))return n(v);if(v===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return l.includes(Gr(s.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Mt(v)||(u=!0),c++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function U8(e,t,n){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,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||Mt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=Gr(s.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Mt(_)||(f=!0),u++,e.consume(_),_===92?v:g}function v(_){return _===91||_===92||_===93?(e.consume(_),u++,g):g(_)}function y(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),l.includes(c)||l.push(c),pt(e,b,"gfmFootnoteDefinitionWhitespace")):n(_)}function b(_){return t(_)}}function $8(e,t,n){return e.check(Mc,t,e.attempt(D8,t,n))}function F8(e){e.exit("gfmFootnoteDefinition")}function H8(e,t,n){const s=this;return pt(e,l,"gfmFootnoteDefinitionIndent",5);function l(c){const u=s.events[s.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function I8(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:l};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(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)},v={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[h][1].start)},y=[["enter",g,f],["enter",u[p][1],f],["exit",u[p][1],f],["enter",v,f]],b=f.parser.constructs.insideSpan.null;b&&pr(y,y.length,0,of(b,u.slice(p+1,h),f)),pr(y,y.length,0,[["exit",v,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",g,f]]),pr(u,p-1,h-p+3,y),h=p+y.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function c(u,f,h){const p=this.previous,g=this.events;let v=0;return y;function y(_){return p===126&&g[g.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),b(_))}function b(_){const j=Al(p);if(_===126)return v>1?h(_):(u.consume(_),v++,b);if(v<2&&!n)return h(_);const E=u.exit("strikethroughSequenceTemporary"),k=Al(_);return E._open=!k||k===2&&!!j,E._close=!j||j===2&&!!k,f(_)}}}class q8{constructor(){this.map=[]}add(t,n,s){V8(this,t,n,s)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let l=s.pop();for(;l;){for(const c of l)t.push(c);l=s.pop()}this.map.length=0}}function V8(e,t,n,s){let l=0;if(!(n===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=n,e.map[l][2].push(...s);return}l+=1}e.map.push([t,n,s])}}function G8(e,t){let n=!1;const s=[];for(;t<e.length;){const l=e[t];if(n){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function Y8(){return{flow:{null:{name:"table",tokenize:Q8,resolveAll:X8}}}}function Q8(e,t,n){const s=this;let l=0,c=0,u;return f;function f(B){let F=s.events.length-1;for(;F>-1;){const W=s.events[F][1].type;if(W==="lineEnding"||W==="linePrefix")F--;else break}const T=F>-1?s.events[F][1].type:null,le=T==="tableHead"||T==="tableRow"?L:h;return le===L&&s.parser.lazy[s.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,c+=1),g(B)}function g(B){return B===null?n(B):Ue(B)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),b):n(B):ot(B)?pt(e,g,"whitespace")(B):(c+=1,u&&(u=!1,l+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),v(B)))}function v(B){return B===null||B===124||Mt(B)?(e.exit("data"),g(B)):(e.consume(B),B===92?y:v)}function y(B){return B===92||B===124?(e.consume(B),v):v(B)}function b(B){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(B):(e.enter("tableDelimiterRow"),u=!1,ot(B)?pt(e,_,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):_(B))}function _(B){return B===45||B===58?E(B):B===124?(u=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),j):O(B)}function j(B){return ot(B)?pt(e,E,"whitespace")(B):E(B)}function E(B){return B===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),k):B===45?(c+=1,k(B)):B===null||Ue(B)?D(B):O(B)}function k(B){return B===45?(e.enter("tableDelimiterFiller"),A(B)):O(B)}function A(B){return B===45?(e.consume(B),A):B===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(B))}function C(B){return ot(B)?pt(e,D,"whitespace")(B):D(B)}function D(B){return B===124?_(B):B===null||Ue(B)?!u||l!==c?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"),I(B)}function I(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),I):B===null||Ue(B)?(e.exit("tableRow"),t(B)):ot(B)?pt(e,I,"whitespace")(B):(e.enter("data"),$(B))}function $(B){return B===null||B===124||Mt(B)?(e.exit("data"),I(B)):(e.consume(B),B===92?G:$)}function G(B){return B===92||B===124?(e.consume(B),$):$(B)}}function X8(e,t){let n=-1,s=!0,l=0,c=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,p,g,v;const y=new q8;for(;++n<e.length;){const b=e[n],_=b[1];b[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(_5(y,t,h,p,g),g=void 0,h=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(s=!0,v=void 0,c=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",g,t]])),l=_.type==="tableDelimiterRow"?2:g?3:1):l&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(s=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],v=hd(y,t,c,l,void 0,v),c=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(u[0]=u[1],v=hd(y,t,c,l,void 0,v)),c=u,u=[c[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,c[1]!==0?(u[0]=u[1],v=hd(y,t,c,l,n,v)):u[1]!==0&&(v=hd(y,t,u,l,n,v)),l=0):l&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&_5(y,t,h,p,g),y.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=G8(t.events,n))}return e}function hd(e,t,n,s,l,c){const u=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(c.end=Object.assign({},bl(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const h=bl(t.events,n[1]);if(c={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const p=bl(t.events,n[2]),g=bl(t.events,n[3]),v={type:f,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",v,t]]),s!==2){const y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[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",v,t]])}return l!==void 0&&(c.end=Object.assign({},bl(t.events,l)),e.add(l,0,[["exit",c,t]]),c=void 0),c}function _5(e,t,n,s,l){const c=[],u=bl(t.events,n);l&&(l.end=Object.assign({},u),c.push(["exit",l,t])),s.end=Object.assign({},u),c.push(["exit",s,t]),e.add(n+1,0,c)}function bl(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const W8={name:"tasklistCheck",tokenize:Z8};function K8(){return{text:{91:W8}}}function Z8(e,t,n){const s=this;return l;function l(h){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),c)}function c(h){return Mt(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 Ue(h)?t(h):ot(h)?e.check({tokenize:J8},t,n)(h):n(h)}}function J8(e,t,n){return pt(e,s,"whitespace");function s(l){return l===null?n(l):t(l)}}function e7(e){return Iw([j8(),z8(),I8(e),Y8(),K8()])}const t7={};function mx(e){const t=this,n=e||t7,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),u=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(e7(n)),c.push(_8()),u.push(w8(n))}const n7=1500;async function r7(e){var s;try{if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.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 gx({text:e,label:t="Copy",className:n=""}){const[s,l]=S.useState(!1),c=S.useRef(null);S.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const u=async()=>{await r7(e)&&(l(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>l(!1),n7))},f=s?"Copied":t;return a.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:s?a.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:a.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):a.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:[a.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),a.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 ef=25*1024*1024,tf=100*1024*1024;function L2(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const c=s.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:c,mediaType:u})},s.onerror=n,s.readAsDataURL(e)})}function Ni(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 D2(e){return e.startsWith("image/")}function z2({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let s="FILE";return t==="application/pdf"||n==="pdf"?s="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?s="ZIP":["csv","tsv"].includes(n)?s="CSV":["json","yaml","yml","toml","xml"].includes(n)?s="DATA":["md","txt","log"].includes(n)?s="TXT":["doc","docx","rtf","odt"].includes(n)?s="DOC":["xls","xlsx","ods"].includes(n)?s="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?s="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?s="VID":n&&(s=n.slice(0,4).toUpperCase()),a.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[a.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"}),a.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),a.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:s})]})}function O2({name:e,mediaType:t,base64:n,size:s,onRemove:l,className:c="w-12 h-12"}){const u=D2(t);return a.jsxs("div",{className:"relative group",title:`${e} (${Ni(s)})`,children:[a.jsx("div",{className:`${c} rounded-lg overflow-hidden border border-cc-border`,children:u?a.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):a.jsx(z2,{name:e,mediaType:t})}),l&&a.jsx("button",{onClick:l,"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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function s7({name:e,mediaType:t,data:n,size:s}){return D2(t)?a.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"}):a.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:[a.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:a.jsx(z2,{name:e,mediaType:t})}),a.jsxs("div",{className:"min-w-0 flex flex-col",children:[a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:Ni(s)})]})]})}function jg(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(jg).join(""):typeof e=="object"&&e!==null&&"props"in e?jg((t=e.props)==null?void 0:t.children):""}function i7({message:e}){return e.role==="system"?a.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-0",children:[a.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),a.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),a.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):e.role==="user"?a.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:a.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&&a.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>a.jsx(s7,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),a.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:a.jsx(xx,{text:e.content})})]})}):a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsx(o7,{message:e})})}function a7(e){const t=[];for(const n of e)if(n.type==="tool_use"){const s=t[t.length-1];(s==null?void 0:s.kind)==="tool_group"&&s.name===n.name?s.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 l7(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 o7({message:e}){const t=e.contentBlocks||[],n=S.useMemo(()=>a7(t),[t]),s=S.useMemo(()=>l7(t),[t]);if(t.length===0&&e.content){const l=e.isStreaming&&e.streamingPhase==="thinking";return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(w5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:l?a.jsx(B2,{text:e.content}):a.jsx(xx,{text:e.content,showCursor:!!e.isStreaming})})]})}return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(w5,{}),a.jsx("div",{className:"flex-1 min-w-0 space-y-3",children:n.map((l,c)=>{if(l.kind==="content")return a.jsx(c7,{block:l.block,toolUseById:s},c);if(l.items.length===1){const u=l.items[0];return a.jsx(K5,{name:u.name,input:u.input,toolUseId:u.id},c)}return a.jsx(d7,{name:l.name,items:l.items},c)})})]})}function w5(){return a.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function xx({text:e,showCursor:t=!1}){return a.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[a.jsx(dx,{remarkPlugins:[mx],components:{p:({children:n})=>a.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>a.jsx("em",{className:"italic",children:n}),h1:({children:n})=>a.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>a.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>a.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>a.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>a.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>a.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:s})=>a.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:s}),blockquote:({children:n})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>a.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:s,className:l}=n,c=/language-(\w+)/.exec(l||"");if(c||typeof s=="string"&&s.includes(`
|
|
96
|
+
`)){const f=(c==null?void 0:c[1])||"",h=jg(s);return a.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:[a.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),f&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),a.jsx(gx,{text:h,label:"Copy code",className:"ml-auto -mr-1"})]}),a.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:a.jsx("code",{children:s})})]})}return a.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:s})},pre:({children:n})=>a.jsx(a.Fragment,{children:n}),table:({children:n})=>a.jsx("div",{className:"overflow-x-auto my-2",children:a.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>a.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>a.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})=>a.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&a.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 c7({block:e,toolUseById:t}){if(e.type==="text")return a.jsx(xx,{text:e.text});if(e.type==="thinking")return a.jsx(B2,{text:e.thinking});if(e.type==="tool_use")return a.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),s=t.get(e.tool_use_id),l=s==null?void 0:s.name,c=e.is_error??!1;return l==="Bash"?a.jsx(u7,{text:n,isError:c}):a.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx(gx,{text:n,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),a.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${c?"text-cc-error":"text-cc-code-fg/60"}`,children:n})]})}return null}function u7({text:e,isError:t}){const n=e.split(/\r?\n/),s=n.length>20,[l,c]=S.useState(!1),u=l||!s?e:n.slice(-20).join(`
|
|
97
|
+
`);return a.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx(gx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),a.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:u}),s&&a.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[a.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:l?`${n.length} lines`:`last 20 of ${n.length}`}),a.jsx("button",{onClick:()=>c(!l),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:l?"Show tail":"Show all"})]})]})}function d7({name:e,items:t}){const[n,s]=S.useState(!1),l=Cc(e),c=Ci(e);return a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>s(!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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(kl,{type:l}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:c}),a.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&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=hc(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function B2({text:e}){const t=e.trim(),[n,s]=S.useState(!1),l=t.split(`
|
|
98
|
+
`),c=l.length>8||t.length>600,u=c&&!n?l.slice(0,8).join(`
|
|
99
|
+
`):t;return a.jsxs("div",{children:[a.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:a.jsx(dx,{remarkPlugins:[mx],components:{p:({children:f})=>a.jsx("p",{className:"mb-2 last:mb-0",children:f}),ul:({children:f})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:f}),ol:({children:f})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:f}),li:({children:f})=>a.jsx("li",{children:f}),code:({children:f})=>a.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:f})},children:u||"No thinking text captured."})}),c&&!n&&a.jsx("button",{onClick:()=>s(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function ec(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function hm(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function S5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":f7(t):"N/A"}catch{return"N/A"}}function k5(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const s=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4);return s>0?`${s}d ${l}h`:l>0?`${l}h${c}m`:`${c}m`}function j5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function f7(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),s=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${s}m`:n>0?`${n}h${s}m`:`${s}m`}function h7({tools:e}){return e.length===0?null:a.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)=>a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[a.jsx(kl,{type:Cc(t.toolName)}),a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),a.jsx("span",{className:"text-cc-fg/70",children:Ci(t.toolName)}),a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function p7({entries:e}){const[t,n]=S.useState(!1),s=S.useMemo(()=>{const l=e.reduce((h,p)=>h+p.elapsedSeconds,0),c=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:l,maxTime:c,errorCount:u,running:f}},[e]);return e.length===0?null:a.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.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 ${s.totalTime.toFixed(1)}s`,children:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"tabular-nums",children:[s.totalTime.toFixed(1),"s"]}),s.errorCount>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-error",children:[s.errorCount," error",s.errorCount>1?"s":""]})]}),s.running>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-primary",children:[s.running," running"]})]})]}),!t&&e.length>1&&a.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(l=>a.jsx("span",{className:`h-full rounded-full ${l.isError?"bg-cc-error/40":l.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,l.elapsedSeconds/s.maxTime*100)}%`,minWidth:"3px"},title:`${Ci(l.toolName)} ${l.elapsedSeconds}s`},l.toolUseId))})]}),t&&a.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(l=>a.jsx(m7,{entry:l,maxTime:s.maxTime},l.toolUseId))})]})}function m7({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),s=!e.completedAt;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":s?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),a.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[a.jsx(kl,{type:Cc(e.toolName)}),a.jsx("span",{className:"text-cc-fg/70 truncate",children:Ci(e.toolName)})]}),a.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:a.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":s?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),a.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&a.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const pd=100,g7=40,x7=120,v7=1e4,b7=7*6e4,pm=new Map,y7=[],_7=[];function w7(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function S7(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const s of t){if(s.type==="text"&&s.text.trim()||s.type==="thinking")return null;if(s.type==="tool_use"){if(n===null)n=s.name;else if(n!==s.name)return null}}return n}function N5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function k7(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 P2(e){const t=[];for(const n of e){const s=S7(n);if(s){const l=t[t.length-1];if((l==null?void 0:l.kind)==="tool_msg_group"&&l.toolName===s){l.items.push(...N5(n));continue}t.push({kind:"tool_msg_group",toolName:s,items:N5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function U2(e,t,n){const s=P2(e),l=[];for(const c of s){l.push(c);const u=k7(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},g=U2(h,t,n);l.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 l}function j7(e){const t=new Map;for(const l of e)if(l.contentBlocks){for(const c of l.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:f}=c,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(y=>typeof y=="string"&&y.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,v=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:v?"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 P2(e);const n=new Map,s=[];for(const l of e)if(l.parentToolUseId&&t.has(l.parentToolUseId)){let c=n.get(l.parentToolUseId);c||(c=[],n.set(l.parentToolUseId,c)),c.push(l)}else s.push(l);return U2(s,t,n)}function N7({group:e}){const[t,n]=S.useState(!1),s=Cc(e.toolName),l=Ci(e.toolName),c=e.items.length;if(c===1){const u=e.items[0];return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(C5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(kl,{type:s}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:hc(u.name,u.input)})]}),t&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:a.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 a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(C5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(kl,{type:s}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:c})]}),t&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=hc(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function $2({entries:e,toolActivity:t}){return a.jsx(a.Fragment,{children:e.map((n,s)=>{if(n.kind==="tool_msg_group")return a.jsx(N7,{group:n},n.firstId||s);if(n.kind==="subagent")return a.jsx(T7,{group:n},n.taskToolUseId);const l=n.msg,c=C7(l),u=t&&c.length>0?t.filter(h=>c.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return a.jsxs("div",{children:[a.jsx(i7,{message:l}),f&&a.jsx(p7,{entries:u})]},l.id)})})}function C7(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function E7(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 T7({group:e}){const[t,n]=S.useState(!1),s=e.description||"Subagent",l=e.agentType,c=e.children.length,u=E7(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",v=e.children[e.children.length-1],y=S.useMemo(()=>{var b,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${Ci(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const j=(b=v.msg.content)==null?void 0:b.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const E=(_=v.msg.contentBlocks)==null?void 0:_.find(k=>k.type==="tool_use");if(E)return Ci(E.name)}return""},[v]);return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:s}),l&&a.jsx("span",{className:"text-[10px] text-cc-muted/50",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&a.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&a.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&y&&a.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:y}),a.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&a.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&a.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&a.jsxs("span",{children:["receivers: ",p.map(b=>a.jsx("span",{className:"font-mono-code ml-1",children:b},b))]})]}),a.jsx($2,{entries:e.children})]})]})})}function C5(){return a.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function A7({sessionId:e}){const t=X(xe=>xe.messages.get(e)??y7),n=X(xe=>(xe.sdkSessions||_7).find(Pe=>Pe.sessionId===e)),s=X(xe=>xe.streamingStartedAt.get(e)),l=X(xe=>xe.streamingOutputTokens.get(e)),c=X(xe=>xe.sessionStatus.get(e)),u=X(xe=>xe.lastActivityAt.get(e)),f=X(xe=>xe.toolProgress.get(e)),h=X(xe=>xe.toolActivity.get(e)),p=S.useRef(null),g=S.useRef(null),v=S.useRef(!0),[y,b]=S.useState(0),[_,j]=S.useState(pd),[E,k]=S.useState([]),[A,C]=S.useState(0),[D,O]=S.useState(!1),[L,I]=S.useState(!1),[$,G]=S.useState(!1),[B,F]=S.useState(""),T=S.useRef(new Set),le=X(xe=>xe.chatTabReentryTickBySession.get(e)??0),W=S.useMemo(()=>t.some(xe=>xe.role==="assistant"&&xe.isStreaming),[t]),Y=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]),U=Y.length>0,z=n!=null&&n.forkSession?"Forked from":"Continuing from",se=S.useMemo(()=>{if(E.length===0)return t;const xe=[],Pe=new Set;for(const ft of E)Pe.has(ft.id)||(Pe.add(ft.id),xe.push(ft));for(const ft of t)Pe.has(ft.id)||(Pe.add(ft.id),xe.push(ft));return xe},[E,t]),me=S.useMemo(()=>j7(se),[se]);S.useEffect(()=>{j(pd),k([]),C(0),O(!1),I(!1),G(!1),F(""),T.current=new Set},[e,Y]);const R=me.length,P=R>_,Z=P?me.slice(R-_):me,M=R-Z.length,he=S.useCallback(()=>{const xe=g.current,Pe=(xe==null?void 0:xe.scrollHeight)??0;j(ft=>ft+pd),requestAnimationFrame(()=>{if(xe){const ft=xe.scrollHeight;xe.scrollTop+=ft-Pe}})},[]),_e=S.useCallback(async(xe={})=>{if(!U||!Y||$)return;const Pe=g.current,ft=(Pe==null?void 0:Pe.scrollHeight)??0,Rt=L?A:0;G(!0),F("");try{const bt=await we.getClaudeSessionHistory(Y,{cursor:Rt,limit:g7}),Lt=bt.messages.map(st=>({id:st.id,role:st.role,content:st.content,contentBlocks:st.role==="assistant"?st.contentBlocks:void 0,timestamp:st.timestamp||Date.now(),model:st.role==="assistant"?st.model:void 0,stopReason:st.role==="assistant"?st.stopReason:void 0})),un=[];for(const st of Lt)T.current.has(st.id)||(T.current.add(st.id),un.push(st));k(st=>[...un,...st]),C(bt.nextCursor),O(bt.hasMore),I(!0),un.length>0&&j(st=>st+un.length),xe.preserveScroll!==!1&&Pe&&requestAnimationFrame(()=>{const st=Pe.scrollHeight;Pe.scrollTop+=st-ft})}catch(bt){const Lt=bt instanceof Error?bt.message:String(bt);F(Lt||"Failed to load previous history"),L||(k([]),C(0),O(!1))}finally{G(!1)}},[U,Y,$,L,A]);S.useEffect(()=>{if(!s&&c!=="running"){b(0);return}const xe=s||Date.now();b(Date.now()-xe);const Pe=setInterval(()=>b(Date.now()-xe),1e3);return()=>clearInterval(Pe)},[s,c]);function Ce(){const xe=g.current;if(!xe)return;v.current=xe.scrollHeight-xe.scrollTop-xe.clientHeight<120;const Pe=Math.max(0,xe.scrollHeight-xe.clientHeight-xe.scrollTop);pm.set(e,Pe),U&&L&&D&&!$&&xe.scrollTop<=x7&&_e({preserveScroll:!0})}const Re=S.useCallback(()=>{const xe=g.current;if(!xe)return;const Pe=xe.style.scrollBehavior;xe.style.scrollBehavior="auto",xe.scrollTop=xe.scrollHeight,xe.style.scrollBehavior=Pe},[]),Le=S.useCallback(()=>{const xe=g.current;if(!xe)return;const Pe=xe.style.scrollBehavior;xe.style.scrollBehavior="auto";const ft=pm.get(e);typeof ft=="number"?xe.scrollTop=Math.max(0,xe.scrollHeight-xe.clientHeight-ft):xe.scrollTop=xe.scrollHeight,xe.style.scrollBehavior=Pe},[e]);if(S.useEffect(()=>{requestAnimationFrame(()=>Le())},[e,Le]),S.useEffect(()=>()=>{const xe=g.current;if(!xe)return;const Pe=Math.max(0,xe.scrollHeight-xe.clientHeight-xe.scrollTop);pm.set(e,Pe)},[e]),S.useEffect(()=>{le&&requestAnimationFrame(()=>Re())},[le,Re]),S.useEffect(()=>{var xe;v.current&&((xe=p.current)==null||xe.scrollIntoView({behavior:"smooth"}))},[t]),se.length===0)return a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[a.jsxs("div",{className:"relative",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[a.jsx("polyline",{points:"4 17 10 11 4 5"}),a.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:a.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:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),a.jsx("div",{className:"text-center max-w-xs",children:U?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),a.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[z," ",a.jsx("span",{className:"font-mono-code text-cc-fg/70",children:Y.slice(0,8)}),". Load earlier messages when needed."]}),a.jsxs("button",{onClick:()=>void _e({preserveScroll:!1}),disabled:$,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),$?"Loading...":"Load previous history"]}),B&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:B})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const Be=c==="running"&&u!=null?Math.max(0,Date.now()-u):0,Je=Be>=b7?"stalled":Be>=v7?"quiet":"active";return a.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[a.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"}),a.jsx("div",{ref:g,onScroll:Ce,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:a.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[U&&!L&&a.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[z," existing Claude thread"]}),a.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[Y," ",n!=null&&n.cwd?`· ${w7(n.cwd)}`:""]})]}),a.jsx("button",{onClick:()=>void _e({preserveScroll:!0}),disabled:$,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:$?"Loading...":"Load previous history"})]}),B&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:B})]}),U&&L&&a.jsx("div",{className:"flex justify-center",children:a.jsx("p",{className:"text-[11px] text-cc-muted",children:D?$?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),P&&a.jsx("div",{className:"flex justify-center pb-3",children:a.jsxs("button",{onClick:he,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(pd,M)," more",a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",M," hidden)"]})]})}),a.jsx($2,{entries:Z,toolActivity:h}),f&&f.size>0&&!W&&a.jsx(h7,{tools:Array.from(f.values())}),c==="compacting"&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[a.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:[a.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),a.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),a.jsx("span",{children:"Compacting context..."})]}),c==="running"&&y>=0&&a.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":Je,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${Je==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[a.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${Je==="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]"}`}),Je==="stalled"?a.jsxs("span",{children:["No activity for ",hm(Be)," — the agent may be stuck"]}):Je==="quiet"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-fg/70",children:"Still working…"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:["no update for ",hm(Be)]})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsx("span",{className:"tabular-nums",children:hm(y)}),(l??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:[ec(l)," tokens"]})]})]})]}),a.jsx("div",{ref:p})]})})]})}const M7={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function R7(e,t){for(const[s,l]of Object.entries(M7))if(e.includes(s))return l;const n=["◆","●","◕","✦"];return n[t%n.length]}function L7(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:R7(t.value,n)}))}const F2=[{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-4-6",label:"Sonnet 4.6",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],H2=[{value:"gpt-5.3-codex-max",label:"GPT-5.3 Max",icon:"■"},{value:"gpt-5.3-codex-xhigh",label:"GPT-5.3 xHigh",icon:"★"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"✳"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex",icon:"◆"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Max",icon:"■"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"},{value:"gpt-5.1-codex-mini",label:"GPT-5.1 Mini",icon:"⚡"}],vx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],bx=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],D7=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],I2=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],q2=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function V2(e){return e==="codex"?H2:F2}function E5(e){return e==="codex"?bx:vx}function FL(e){return e==="codex"?q2:I2}function T5(e){return e==="codex"?H2[0].value:F2[0].value}function A5(e){return e==="codex"?bx[0].value:vx[0].value}function HL(e){return e==="codex"?q2[0].value:I2[0].value}function z7(e){return e==="codex"?[]:D7}function M5({sessionId:e}){const[t,n]=S.useState(!1),s=S.useRef(null),l=X(y=>y.sdkSessions.find(b=>b.sessionId===e)||null),c=X(y=>y.sessions.get(e)),u=X(y=>y.cliConnected.get(e)??!1),f=(l==null?void 0:l.backendType)??(c==null?void 0:c.backend_type)??"claude",h=(c==null?void 0:c.model)??(l==null?void 0:l.model)??"",p=V2(f),g=p.find(y=>y.value===h)||(h?{label:h,icon:"?"}:null),v=S.useCallback(y=>{if(n(!1),y===h)return;Pn(e,{type:"set_model",model:y});const{sdkSessions:b,setSdkSessions:_}=X.getState();_(b.map(j=>j.sessionId===e?{...j,model:y}:j))},[e,h]);return S.useEffect(()=>{if(!t)return;const y=b=>{s.current&&!s.current.contains(b.target)&&n(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[t]),S.useEffect(()=>{if(!t)return;const y=b=>{b.key==="Escape"&&n(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t]),f==="codex"||!u||!g?null:a.jsxs("div",{ref:s,className:"relative shrink-0",children:[a.jsxs("button",{onClick:()=>n(y=>!y),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&&a.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),a.jsx("span",{children:g.label}),a.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:a.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&a.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(y=>a.jsxs("button",{onClick:()=>v(y.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${y.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":y.value===h,children:[y.icon&&a.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:y.icon}),a.jsx("span",{className:"flex-1 text-left",children:y.label}),y.value===h&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.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"})})]},y.value))})]})}function G2({open:e,loading:t,prompts:n,selectedIndex:s,onSelect:l,menuRef:c,className:u=""}){return e?a.jsx("div",{ref:c,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?a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>a.jsxs("button",{"data-prompt-index":h,onClick:()=>l(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===s?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),a.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function Y2({text:e,caretPos:t,cwd:n,enabled:s=!0}){const[l,c]=S.useState(!1),[u,f]=S.useState(0),[h,p]=S.useState([]),[g,v]=S.useState(!1),y=S.useRef(null),b=S.useCallback(async()=>{v(!0);try{const k=await we.listPrompts(n);p(k.filter(A=>!!A.name.trim()))}catch{p([])}finally{v(!1)}},[n]);S.useEffect(()=>{b()},[b]);const _=S.useMemo(()=>{const k=e.slice(0,t),A=k.match(/(^|\s)@([^\s@]*)$/);if(!A||A.index===void 0)return null;const C=k.length-A[0].length+A[1].length;return{query:A[2]||"",start:C,end:t}},[e,t]),j=S.useMemo(()=>{if(!l||!_)return[];const k=_.query.toLowerCase();if(!k)return h;const A=h.filter(D=>D.name.toLowerCase().startsWith(k)),C=h.filter(D=>!D.name.toLowerCase().startsWith(k)&&D.name.toLowerCase().includes(k));return[...A,...C]},[l,_,h]);S.useEffect(()=>{const k=s&&!!_;k&&!l?(c(!0),f(0)):!k&&l&&c(!1)},[s,_,l]),S.useEffect(()=>{u>=j.length&&f(Math.max(0,j.length-1))},[j.length,u]),S.useEffect(()=>{if(!y.current||!l)return;const A=y.current.querySelectorAll("[data-prompt-index]")[u];A&&A.scrollIntoView({block:"nearest"})},[u,l]);const E=S.useCallback(k=>{if(!_)return{nextText:e,nextCursor:t};const A=`${k.content} `,C=`${e.slice(0,_.start)}${A}${e.slice(_.end)}`,D=_.start+A.length;return{nextText:C,nextCursor:D}},[_,e,t]);return{mentionMenuOpen:l,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:j,promptsLoading:g,savedPrompts:h,selectPrompt:E,refreshPrompts:b,mentionMenuRef:y}}const O7=[];function R5({isPlan:e,isConnected:t,onToggle:n,modeLabel:s,size:l}){const c=l==="desktop",u=c?"px-2.5 py-1.5":"px-2 py-1",f=c?"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=c?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return a.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?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),a.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),a.jsx("span",{children:s})]})}function md({onClick:e,disabled:t,active:n,title:s,children:l}){return a.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:s,children:l})}function L5(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.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 D5({isRunning:e,canSend:t,onSend:n,onInterrupt:s,size:l}){const c=l==="desktop",u=c?"w-9 h-9":"w-10 h-10",f=c?"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?a.jsx("button",{onClick:s,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function B7({sessionId:e}){var ae,ve;const[t,n]=S.useState(""),[s,l]=S.useState([]),[c,u]=S.useState(null),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[v,y]=S.useState(0),[b,_]=S.useState(!1),[j,E]=S.useState(""),[k,A]=S.useState("global"),[C,D]=S.useState(null),[O,L]=S.useState(0),I=S.useRef(null),$=S.useRef(null),G=S.useRef(null),B=S.useRef(null),F=X(Q=>Q.cliConnected),T=X(Q=>Q.sessions.get(e)),le=X(Q=>Q.previousPermissionMode.get(e)||"acceptEdits"),W=F.get(e)??!1,Y=(T==null?void 0:T.permissionMode)||"acceptEdits",U=Y==="plan",z=(T==null?void 0:T.backend_type)==="codex",me=((ve=(ae=(z?bx:vx).find(Q=>Q.value===Y))==null?void 0:ae.label)==null?void 0:ve.toLowerCase())||Y,R=Y2({text:t,caretPos:O,cwd:T==null?void 0:T.cwd,enabled:!p}),P=S.useMemo(()=>{const Q=[];if(T!=null&&T.slash_commands)for(const fe of T.slash_commands)Q.push({name:fe,type:"command"});if(T!=null&&T.skills)for(const fe of T.skills)Q.push({name:fe,type:"skill"});return Q},[T==null?void 0:T.slash_commands,T==null?void 0:T.skills]),Z=S.useMemo(()=>{if(!p)return[];const Q=t.match(/^\/(\S*)$/);if(!Q)return[];const fe=Q[1].toLowerCase();return fe===""?P:P.filter(Te=>Te.name.toLowerCase().includes(fe))},[t,p,P]);S.useEffect(()=>{const Q=t.startsWith("/")&&/^\/\S*$/.test(t)&&P.length>0;Q&&!p?(g(!0),y(0)):!Q&&p&&g(!1)},[t,P.length,p]),S.useEffect(()=>{v>=Z.length&&y(Math.max(0,Z.length-1))},[Z.length,v]),S.useEffect(()=>{if(!G.current||!p)return;const fe=G.current.querySelectorAll("[data-cmd-index]")[v];fe&&fe.scrollIntoView({block:"nearest"})},[v,p]),S.useEffect(()=>{if(B.current===null||!I.current)return;const Q=B.current;I.current.setSelectionRange(Q,Q),B.current=null},[t]);const M=S.useCallback(Q=>{var fe;n(`/${Q.name} `),g(!1),(fe=I.current)==null||fe.focus()},[]),he=S.useCallback(Q=>{var Te;const fe=R.selectPrompt(Q);B.current=fe.nextCursor,n(fe.nextText),R.setMentionMenuOpen(!1),L(fe.nextCursor),(Te=I.current)==null||Te.focus(),I.current&&(I.current.style.height="auto",I.current.style.height=Math.min(I.current.scrollHeight,200)+"px")},[R]);function _e(){var et;const Q=t.trim();if(!Q||!W)return;const fe=wm(),Te=s.length>0?s.map(tt=>({name:tt.name,media_type:tt.mediaType,data:tt.base64,size:tt.size})):void 0;Pn(e,{type:"user_message",content:Q,session_id:e,attachments:Te,client_msg_id:fe});const Ye=X.getState();Ye.appendMessage(e,{id:fe,role:"user",content:Q,attachments:Te,timestamp:Date.now()}),Ye.setSessionStatus(e,"running"),Ye.setLastActivity(e,Date.now()),Ye.streamingStartedAt.has(e)||Ye.setStreamingStats(e,{startedAt:Date.now()}),n(""),l([]),u(null),g(!1),R.setMentionMenuOpen(!1),I.current&&(I.current.style.height="auto"),(et=I.current)==null||et.focus()}function Ce(Q){if(p&&Z.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),y(fe=>(fe+1)%Z.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),y(fe=>(fe-1+Z.length)%Z.length);return}if(Q.key==="Tab"&&!Q.shiftKey){Q.preventDefault(),M(Z[v]);return}if(Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),M(Z[v]);return}if(Q.key==="Escape"){Q.preventDefault(),g(!1);return}}if(R.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),R.setMentionMenuIndex(fe=>(fe+1)%R.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),R.setMentionMenuIndex(fe=>(fe-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),he(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault(),st();return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),_e())}function Re(Q){n(Q.target.value),L(Q.target.selectionStart??Q.target.value.length);const fe=Q.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Le(){I.current&&L(I.current.selectionStart??0)}function Be(){Pn(e,{type:"interrupt"})}async function Je(Q){if(Q.length===0)return;const fe=[],Te=[];let Ye=s.reduce((et,tt)=>et+tt.size,0);for(const et of Q){if(et.size>ef){Te.push(`${et.name} is too large (${Ni(et.size)}, max ${Ni(ef)})`);continue}if(Ye+et.size>tf){Te.push(`${et.name} would exceed the per-message limit (${Ni(tf)})`);continue}const{base64:tt,mediaType:vt}=await L2(et);fe.push({name:et.name,base64:tt,mediaType:vt,size:et.size}),Ye+=et.size}fe.length>0&&l(et=>[...et,...fe]),u(Te.length>0?Te.join("; "):null)}async function xe(Q){const fe=Q.target.files;fe&&(await Je(Array.from(fe)),Q.target.value="")}function Pe(Q){l(fe=>fe.filter((Te,Ye)=>Ye!==Q))}async function ft(Q){var Ye;const fe=(Ye=Q.clipboardData)==null?void 0:Ye.items;if(!fe)return;const Te=[];for(const et of Array.from(fe)){if(et.kind!=="file")continue;const tt=et.getAsFile();if(!tt)continue;const vt=tt.name&&tt.name.length>0?tt.name:`pasted-${Date.now()}.${(tt.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Te.push(new File([tt],vt,{type:tt.type,lastModified:tt.lastModified}))}Te.length>0&&(Q.preventDefault(),await Je(Te))}function Rt(Q){Q.dataTransfer.types.includes("Files")&&(Q.preventDefault(),Q.stopPropagation(),h(!0))}function bt(Q){Q.currentTarget===Q.target&&h(!1)}async function Lt(Q){if(!Q.dataTransfer.types.includes("Files"))return;Q.preventDefault(),Q.stopPropagation(),h(!1);const fe=Array.from(Q.dataTransfer.files);fe.length>0&&await Je(fe)}function un(){const Q=t.trim().slice(0,32);E(Q||""),D(null),_(fe=>!fe)}function st(){if(!W)return;const Q=X.getState();if(!U)Q.setPreviousPermissionMode(e,Y),Pn(e,{type:"set_permission_mode",mode:"plan"}),Q.updateSession(e,{permissionMode:"plan"});else{const fe=le||(z?"bypassPermissions":"acceptEdits");Pn(e,{type:"set_permission_mode",mode:fe}),Q.updateSession(e,{permissionMode:fe})}}async function dn(){const Q=t.trim(),fe=j.trim();if(!Q||!fe)return;if(k==="project"&&!(T!=null&&T.cwd)){D("No project folder available for this session");return}const Te={name:fe,content:Q,scope:k};k==="project"&&(Te.projectPaths=[T.cwd]);try{await we.createPrompt(Te),await R.refreshPrompts(),_(!1),E(""),A("global"),D(null)}catch(Ye){const et=Ye instanceof Error&&Ye.message?Ye.message:"Could not save prompt.";D(et)}}const je=X(Q=>Q.promptSuggestions.get(e))??O7,ze=X(Q=>Q.clearPromptSuggestions),qe=X(Q=>Q.sessionStatus).get(e)==="running",Or=t.trim().length>0&&W;return a.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:Rt,onDragLeave:bt,onDrop:Lt,children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&a.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:a.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),s.length>0&&a.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:s.map((Q,fe)=>a.jsx(O2,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>Pe(fe)},fe))}),c&&a.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:c}),a.jsx("input",{ref:$,type:"file",multiple:!0,onChange:xe,className:"hidden","aria-label":"Attach files"}),je.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:je.map((Q,fe)=>a.jsx("button",{onClick:()=>{if(!W||qe)return;const Te=wm();Pn(e,{type:"user_message",content:Q,session_id:e,client_msg_id:Te}),X.getState().appendMessage(e,{id:Te,role:"user",content:Q,timestamp:Date.now()}),ze(e)},disabled:!W||qe,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:Q,children:Q},fe))}),a.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 ${U?"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&&a.jsx("div",{ref:G,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((Q,fe)=>a.jsxs("button",{"data-cmd-index":fe,onClick:()=>M(Q),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${fe===v?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:Q.type==="skill"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",Q.name]}),a.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Q.type})]})]},`${Q.type}-${Q.name}`))}),a.jsx(G2,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:he,menuRef:R.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),b&&a.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:[a.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),a.jsx("input",{value:j,onChange:Q=>{E(Q.target.value),C&&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"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","aria-pressed":k==="global",onClick:()=>A("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"}),a.jsx("button",{type:"button","aria-pressed":k==="project",onClick:()=>A("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"&&(T==null?void 0:T.cwd)&&a.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:T.cwd,children:T.cwd}),C?a.jsx("div",{className:"text-[11px] text-cc-error",children:C}):null,a.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[a.jsx("button",{onClick:()=>{_(!1),A("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"}),a.jsx("button",{onClick:dn,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"})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[a.jsx(R5,{isPlan:U,isConnected:W,onToggle:st,modeLabel:me,size:"mobile"}),a.jsx(M5,{sessionId:e}),a.jsx("div",{className:"flex-1"}),a.jsx(md,{onClick:un,disabled:!W||!t.trim(),active:W&&!!t.trim(),title:"Save as prompt",children:a.jsx(L5,{})}),a.jsx(md,{onClick:()=>{var Q;return(Q=$.current)==null?void 0:Q.click()},disabled:!W,active:W,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.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"})})})]}),a.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:a.jsx("textarea",{ref:I,value:t,onChange:Re,onKeyDown:Ce,onClick:Le,onKeyUp:Le,onPaste:ft,"aria-label":"Message input",placeholder:W?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!W,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"}})}),a.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:a.jsx(D5,{isRunning:qe,canSend:Or,onSend:_e,onInterrupt:Be,size:"mobile"})}),a.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[a.jsx(md,{onClick:()=>{var Q;return(Q=$.current)==null?void 0:Q.click()},disabled:!W,active:W,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx(md,{onClick:un,disabled:!W||!t.trim(),active:W&&!!t.trim(),title:"Save as prompt",children:a.jsx(L5,{})}),a.jsx(R5,{isPlan:U,isConnected:W,onToggle:st,modeLabel:me,size:"desktop"}),a.jsx("div",{className:"flex-1"}),a.jsx(M5,{sessionId:e}),a.jsx(D5,{isRunning:qe,canSend:Or,onSend:_e,onInterrupt:Be,size:"desktop"})]})]})]})})}function P7(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 s=e.rules[0];if(s!=null&&s.ruleContent)return`Allow "${s.ruleContent}" ${n}`;if(s!=null&&s.toolName)return`Allow ${s.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function U7({permission:e,sessionId:t}){const[n,s]=S.useState(!1),l=X(p=>p.removePermission);function c(p,g){s(!0),Pn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),l(t,e.request_id)}function u(){s(!0),Pn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),l(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return a.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:a.jsx("div",{className:"max-w-3xl mx-auto",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.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?a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:a.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"})}):a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:a.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"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&a.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&a.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?a.jsx(q7,{input:e.input,onSelect:p=>c({...e.input,answers:p}),disabled:n}):a.jsx(H7,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&a.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&a.jsx(F7,{validation:e.ai_validation}),!f&&a.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>c(),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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,g)=>a.jsxs("button",{onClick:()=>c(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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),P7(p)]},g)),a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function $7(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 F7({validation:e}){const t=e.verdict==="uncertain"&&$7(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",s=t?"AI analysis unavailable — manual review:":"AI analysis:";return a.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.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"})}),a.jsx("span",{className:"font-medium",children:s}),a.jsx("span",{children:e.reason})]})}function H7({toolName:e,input:t,description:n}){return e==="Bash"?a.jsx(I7,{input:t}):e==="Edit"?a.jsx(V7,{input:t}):e==="Write"?a.jsx(G7,{input:t}):e==="Read"?a.jsx(Y7,{input:t}):e==="Glob"?a.jsx(Q7,{input:t}):e==="Grep"?a.jsx(X7,{input:t}):e==="ExitPlanMode"?a.jsx(W7,{input:t}):a.jsx(Q2,{input:t,description:n})}function I7({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsx("div",{className:"text-xs text-cc-muted",children:n}),a.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:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function q7({input:e,onSelect:t,disabled:n}){const s=Array.isArray(e.questions)?e.questions:[],[l,c]=S.useState({}),[u,f]=S.useState({}),[h,p]=S.useState({});function g(E){const k={};for(const[A,C]of Object.entries(E)){const D=s[Number(A)],O=typeof(D==null?void 0:D.question)=="string"&&D.question?D.question:A;k[O]=C}return k}function v(E,k){const A=String(E);c(C=>({...C,[A]:k})),p(C=>({...C,[A]:!1})),s.length<=1&&t(g({[A]:k}))}function y(E){var C;const k=String(E),A=(C=u[k])==null?void 0:C.trim();A&&(c(D=>({...D,[k]:A})),s.length<=1&&t(g({[k]:A})))}function b(E,k){const A=String(E);f(D=>({...D,[A]:k}));const C=k.trim();c(D=>{if(!C){const O={...D};return delete O[A],O}return{...D,[A]:C}})}function _(E){const k=String(E);p(A=>{const C=!!A[k],D={...A,[k]:!C};return C&&(c(O=>{const L={...O};return delete L[k],L}),f(O=>{const L={...O};return delete L[k],L})),D})}function j(){t(g(l))}if(s.length===0){const E=typeof e.question=="string"?e.question:"";return E?a.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:E}):a.jsx(Q2,{input:e})}return a.jsxs("div",{className:"space-y-3",children:[s.map((E,k)=>{const A=typeof E.header=="string"?E.header:"",C=typeof E.question=="string"?E.question:"",D=Array.isArray(E.options)?E.options:[],O=String(k),L=l[O],I=h[O];return a.jsxs("div",{className:"space-y-2",children:[A&&a.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:A}),C&&a.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:C}),D.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[D.map(($,G)=>{const B=typeof $.label=="string"?$.label:String($),F=typeof $.description=="string"?$.description:"",T=L===B;return a.jsx("button",{onClick:()=>v(k,B),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${T?"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:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${T?"border-cc-primary":"border-cc-muted/40"}`,children:T&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:B}),F&&a.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:F})]})]})},G)}),a.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 ${I?"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:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${I?"border-cc-primary":"border-cc-muted/40"}`,children:I&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),I&&a.jsxs("div",{className:"pl-6",children:[a.jsx("input",{type:"text",value:u[O]||"",onChange:$=>b(k,$.target.value),onKeyDown:$=>{$.key==="Enter"&&y(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}),s.length<=1&&a.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},k)}),s.length>1&&Object.keys(l).length>0&&a.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 V7({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),s=String(e.new_string||"");return a.jsx(Rl,{oldText:n,newText:s,fileName:t,mode:"compact"})}function G7({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(Rl,{newText:n,fileName:t,mode:"compact"})}function Y7({input:e}){const t=String(e.file_path||"");return a.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 Q7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n})]})}function X7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",s=typeof e.glob=="string"?e.glob:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n}),s&&a.jsx("div",{className:"text-cc-muted",children:s})]})}function W7({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return a.jsxs("div",{className:"space-y-2",children:[t&&a.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),a.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),a.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:a.jsx(dx,{remarkPlugins:[mx],components:{h1:({children:s})=>a.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:s}),h2:({children:s})=>a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:s}),h3:({children:s})=>a.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:s}),p:({children:s})=>a.jsx("p",{className:"mb-2 last:mb-0",children:s}),ul:({children:s})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:s}),ol:({children:s})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:s}),li:({children:s})=>a.jsx("li",{children:s}),strong:({children:s})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:s}),a:({href:s,children:l})=>a.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:l}),code:s=>{const{children:l,className:c}=s;return/language-(\w+)/.exec(c||"")||typeof l=="string"&&l.includes(`
|
|
100
|
+
`)?a.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:a.jsx("code",{children:l})}):a.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:l})},pre:({children:s})=>a.jsx(a.Fragment,{children:s}),blockquote:({children:s})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:s})},children:t})})]}),n.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),a.jsx("div",{className:"space-y-1",children:n.map((s,l)=>a.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:[a.jsx("span",{className:"text-cc-muted shrink-0",children:String(s.tool||"")}),a.jsx("span",{className:"text-cc-fg",children:String(s.prompt||"")})]},l))})]}),!t&&n.length===0&&a.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function Q2({input:e,description:t}){const n=Object.entries(e).filter(([,s])=>s!=null&&s!=="");return n.length===0&&t?a.jsx("div",{className:"text-xs text-cc-fg",children:t}):a.jsxs("div",{className:"space-y-1",children:[t&&a.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),a.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([s,l])=>{const c=typeof l=="string"?l.length>200?l.slice(0,200)+"...":l:JSON.stringify(l);return a.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[a.jsxs("span",{className:"text-cc-muted shrink-0",children:[s,":"]}),a.jsx("span",{className:"text-cc-fg break-all",children:c})]},s)})})]})}function K7({entry:e,onDismiss:t}){const{request:n,behavior:s,reason:l}=e,c=s==="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 a.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${c?"text-cc-success":"text-cc-error"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:a.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"})}),a.jsxs("span",{className:"flex-1",children:["AI auto-",c?"approved":"denied",":"," ",a.jsx("span",{className:"font-mono-code opacity-80",children:u}),l&&a.jsxs("span",{className:"text-cc-muted ml-1",children:["(",l,")"]})]}),t&&a.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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 Z7=[],J7=[],z5="activity-tray-panel";function eR(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60),l=n%60;return`${s}m${l>0?` ${l}s`:""}`}function tR(e,t,n=4e3){const[s,l]=S.useState(!1),c=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(c.current),f?c.current=setTimeout(()=>l(!0),n):l(!1),()=>clearTimeout(c.current)),[f,n]),S.useEffect(()=>{l(!1)},[u]),s}function nR(e){const[t,n]=S.useState(0);return S.useEffect(()=>{if(!e)return;const s=setInterval(()=>n(l=>l+1),1e3);return()=>clearInterval(s)},[e]),t}function rR({status:e}){return e==="running"||e==="in_progress"?a.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function sR({agent:e,tick:t}){const[n,s]=S.useState(!1),l=e.status!=="running",c=!!e.summary,u=a.jsxs(a.Fragment,{children:[a.jsx(rR,{status:e.status}),a.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&a.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:eR(e.startedAt,e.completedAt)})]});return a.jsxs("div",{className:`transition-opacity duration-300 ${l?"opacity-60":""}`,children:[c?a.jsx("button",{type:"button",onClick:()=>s(!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}):a.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&a.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 iR({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[a.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?a.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:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:a.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.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.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&&a.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function aR({sessionId:e}){const[t,n]=S.useState(!1),s=S.useRef(null),l=S.useRef(null),c=X(C=>C.sessionTasks.get(e)??Z7),u=X(C=>C.sessionBackgroundAgents.get(e)??J7),f=tR(c,u),h=u.some(C=>C.status==="running"),p=nR(h),g=u.filter(C=>C.status==="running").length,v=c.length,y=c.filter(C=>C.status==="completed").length,b=c.filter(C=>C.status==="in_progress").length,_=c.length>0||u.length>0,j=g>0||b>0,E=S.useCallback(()=>n(!1),[]);S.useEffect(()=>{if(!t)return;const C=D=>{D.key==="Escape"&&(D.stopPropagation(),E())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,E]),S.useEffect(()=>{if(!t)return;const C=D=>{s.current&&!s.current.contains(D.target)&&E()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,E]),S.useEffect(()=>{t&&l.current&&l.current.focus()},[t]);const[k,A]=S.useState(!1);return S.useEffect(()=>{_&&A(!1)},[_,c.length,u.length]),!_||k?null:a.jsxs("div",{ref:s,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&&A(!0)},children:[t&&a.jsxs("div",{ref:l,id:z5,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:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),a.jsx("button",{type:"button",onClick:E,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(C=>a.jsx(sR,{agent:C,tick:p},C.toolUseId))]}),u.length>0&&c.length>0&&a.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),c.length>0&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),c.map(C=>a.jsx(iR,{task:C},C.id))]})]}),a.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":z5,className:`
|
|
101
|
+
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
102
|
+
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
103
|
+
shadow-md shadow-black/15
|
|
104
|
+
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
105
|
+
transition-all duration-200 cursor-pointer
|
|
106
|
+
${t?"ring-1 ring-cc-primary/30":""}
|
|
107
|
+
`,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[j?a.jsxs("span",{className:"relative flex h-2 w-2",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):a.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&a.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&&c.length>0&&a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),a.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:a.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function lR({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),s=X(_=>_.clearAiResolvedPermissions),l=X(_=>_.connectionStatus.get(e)??"disconnected"),c=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,c]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const v=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await we.relaunchSession(e)}catch(_){Ti(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=S.useMemo(()=>t?Array.from(t.values()):[],[t]),b=l==="connected"&&!c;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&a.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?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),a.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),a.jsx("button",{onClick:v,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?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):a.jsxs(a.Fragment,{children:[a.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"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),a.jsx("button",{onClick:v,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"})]})}),l==="disconnected"&&a.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:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a.jsx(A7,{sessionId:e}),a.jsx(aR,{sessionId:e})]}),n&&n.length>0&&a.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:a.jsx(K7,{entry:n[n.length-1],onDismiss:()=>s(e)})}),y.length>0&&a.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>a.jsx(U7,{permission:_,sessionId:e},_.request_id))}),a.jsx(B7,{sessionId:e})]})}function oR({sessionId:e}){const[t,n]=S.useState(!1),s=S.useRef(null),l=X(p=>p.sessions.get(e)),c=(l==null?void 0:l.aiValidationEnabled)??!1,u=(l==null?void 0:l.aiValidationAutoApprove)??!0,f=(l==null?void 0:l.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(g){s.current&&!s.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};X.getState().setSessionAiValidation(e,y),IN(e,y)}return a.jsxs("div",{ref:s,className:"relative",children:[a.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:a.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&&a.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:[a.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),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:[a.jsx("span",{className:"text-xs",children:"Enabled"}),a.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&a.jsxs(a.Fragment,{children:[a.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:[a.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),a.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),a.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:[a.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),a.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function cR({sessionId:e}){const[t,n]=S.useState(!1),[s,l]=S.useState(null),[c,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=v=>{f.current&&!f.current.contains(v.target)&&n(!1)},g=v=>{v.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=>{l(p),u(!1);try{const{blob:g,filename:v}=await we.exportSession(e,p),y=URL.createObjectURL(g),b=document.createElement("a");b.href=y,b.download=v,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(y),n(!1)}catch(g){Ti(g),u(!0)}finally{l(null)}},[e]);return a.jsxs("div",{ref:f,className:"relative",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&a.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:[a.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),a.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:s!==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:[s==="html"?"Exporting…":"Download as HTML",a.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),a.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:s!==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:[s==="txt"?"Exporting…":"Download as Text",a.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),c&&a.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function uR(){var I;const e=S.useSyncExternalStore($=>(window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)),()=>window.location.hash),t=S.useMemo(()=>Qg(e),[e]),n=t.page==="session"||t.page==="home",s=X($=>$.currentSessionId),l=X($=>$.cliConnected),c=X($=>$.sessionStatus),u=X($=>$.sessionNames),f=X($=>$.sdkSessions),h=X($=>$.sidebarOpen),p=X($=>$.setSidebarOpen),g=X($=>$.taskPanelOpen),v=X($=>$.setTaskPanelOpen),y=X($=>$.activeTab),b=X($=>$.setActiveTab),_=X($=>$.markChatTabReentry),j=X($=>s?$.gitChangedFilesCount.get(s)??0:0),E=s?c.get(s)??null:null,k=s?l.get(s)??!1:!1,A=s?(u==null?void 0:u.get(s))||((I=f.find($=>$.sessionId===s))==null?void 0:I.name)||`Session ${s.slice(0,8)}`:null,C=!!(s&&n),D=t.page==="session"&&!!s,O=["chat","diff"],L=$=>{$==="chat"&&y!=="chat"&&s&&_(s),b($)};return S.useEffect(()=>{const $=G=>{if(!(G.metaKey||G.ctrlKey)||G.key.toLowerCase()!=="j"||!C)return;const B=G.target;if(B&&(B.tagName==="TEXTAREA"||B.tagName==="INPUT"||B.isContentEditable))return;G.preventDefault();const F=Math.max(0,O.indexOf(y)),T=G.shiftKey?-1:1,le=(F+T+O.length)%O.length;L(O[le])};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[C,O,y,b,_,s]),a.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:a.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&a.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:[a.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 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:A||"Session","aria-label":"Session tab",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?E==="running"?"bg-cc-primary":E==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),a.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 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&a.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})]})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&s&&a.jsx(oR,{sessionId:s}),C&&s&&a.jsx(cR,{sessionId:s}),a.jsx(dR,{}),D&&a.jsx("button",{onClick:()=>v(!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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function dR(){const e=X(n=>n.darkMode),t=S.useCallback(()=>X.getState().toggleDarkMode(),[]);return a.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?a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.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"})]}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:a.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const X2="cc-recent-dirs";function nf(){try{return JSON.parse(localStorage.getItem(X2)||"[]")}catch{return[]}}function W2(e){const t=nf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(X2,JSON.stringify(t.slice(0,5)))}function fR(){return!1}function K2({onClose:e,embedded:t=!1}){const[n,s]=S.useState([]),[l,c]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,v]=S.useState([]),[y,b]=S.useState(""),[_,j]=S.useState(!1),[E,k]=S.useState(""),[A,C]=S.useState([{key:"",value:""}]),[D,O]=S.useState(!1),L=S.useCallback(()=>{we.listEnvs().then(s).catch(()=>{}).finally(()=>c(!1))},[]);S.useEffect(()=>{L()},[L]);function I(Y){f(Y.slug),p(Y.name);const U=Object.entries(Y.variables).map(([z,se])=>({key:z,value:se}));U.length===0&&U.push({key:"",value:""}),v(U),b("")}function $(){f(null),b("")}async function G(){if(!u)return;const Y={};for(const U of g){const z=U.key.trim();z&&(Y[z]=U.value)}try{await we.updateEnv(u,{name:h.trim()||void 0,variables:Y}),f(null),b(""),L()}catch(U){b(U instanceof Error?U.message:String(U))}}async function B(Y){try{await we.deleteEnv(Y),u===Y&&f(null),L()}catch(U){b(U instanceof Error?U.message:String(U))}}async function F(){const Y=E.trim();if(!Y)return;O(!0);const U={};for(const z of A){const se=z.key.trim();se&&(U[se]=z.value)}try{await we.createEnv(Y,U),k(""),C([{key:"",value:""}]),j(!1),b(""),L()}catch(z){b(z instanceof Error?z.message:String(z))}finally{O(!1)}}if(t)return a.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:a.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[a.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),a.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[a.jsx("div",{className:"flex-1"}),a.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:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?a.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):a.jsx("path",{d:"M12 5v14M5 12h14"})}),a.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&a.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:[a.jsx("input",{type:"text",value:E,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"&&E.trim()&&F()}}),a.jsx(gd,{rows:A,onChange:C}),y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),a.jsxs("div",{className:"flex items-center justify-between pt-1",children:[a.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",a.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),a.jsx("button",{onClick:F,disabled:!E.trim()||D,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${E.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"})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:a.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),l?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):a.jsx("div",{className:"space-y-1",children:n.map(Y=>{const U=u===Y.slug,z=Object.keys(Y.variables).length;return U?a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:h,onChange:se=>p(se.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"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(gd,{rows:g,onChange:v})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:$,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"}),a.jsx("button",{onClick:()=>void G(),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):a.jsx(hR,{env:Y,varCount:z,onStartEdit:()=>I(Y),onDelete:()=>void B(Y.slug)},Y.slug)})}),y&&!_&&a.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const T=a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),a.jsx("input",{type:"text",value:E,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"&&E.trim()&&F()}}),a.jsx(gd,{rows:A,onChange:C}),a.jsx("button",{onClick:F,disabled:!E.trim()||D,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${E.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=l?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):a.jsx("div",{className:"space-y-3",children:n.map(Y=>a.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:Y.name}),a.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?a.jsx("button",{onClick:$,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>I(Y),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),a.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&&a.jsxs("div",{className:"px-3 py-3 space-y-2",children:[a.jsx("input",{type:"text",value:h,onChange:U=>p(U.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"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(gd,{rows:g,onChange:v})]})}),a.jsx("button",{onClick:G,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&&a.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(Y.variables).map(([U,z])=>a.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[a.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:U}),a.jsx("span",{className:"text-cc-muted",children:"="}),a.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:z})]},U))})]},Y.slug))}),W=a.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:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),le,T]})]});return Ll.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:W}),document.body)}function hR({env:e,varCount:t,onStartEdit:n,onDelete:s}){return a.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:[a.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:a.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:a.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),a.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),a.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),a.jsx("button",{onClick:s,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:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.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 gd({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function s(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function l(){t([...e,{key:"",value:""}])}return a.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:c.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"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),a.jsx("input",{type:"text",value:c.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"}),a.jsx("button",{onClick:()=>s(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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),a.jsx("button",{onClick:l,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const pR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:K2},Symbol.toStringTag,{value:"Module"}));function mR(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let s="";for(const l of t)s+="/"+l,n.push({label:l,path:s});return n}function gR({initialPath:e,onSelect:t,onClose:n}){const[s,l]=S.useState(""),[c,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[v,y]=S.useState(""),[b,_]=S.useState(!1),[j,E]=S.useState(""),[k,A]=S.useState(-1),[C,D]=S.useState(!1),[O,L]=S.useState(()=>nf()),I=S.useRef(null),$=S.useRef(null),G=S.useRef(null),B=S.useRef(new Map),F=S.useMemo(()=>{if(!j)return c;const z=j.toLowerCase();return c.filter(se=>se.name.toLowerCase().includes(z))},[c,j]),T=S.useCallback(async z=>{h(!0),g(""),E(""),A(-1);try{const se=await we.listDirs(z);l(se.path),u(se.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{T(e||void 0)},[]),S.useEffect(()=>{const z=I.current;if(!z)return;function se(R){if(R.key!=="Tab")return;const P=z.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const Z=P[0],M=P[P.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",se);const me=setTimeout(()=>{var R;(R=G.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",se),clearTimeout(me)}},[]);const le=S.useCallback(()=>{C||(D(!0),setTimeout(n,150))},[n,C]);S.useEffect(()=>{function z(se){if(se.key==="Escape"){if(b)return;le()}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,le]),S.useEffect(()=>{function z(se){var R,P;if(b)return;if(se.key==="Backspace"&&document.activeElement!==G.current){if(s&&s!=="/"){se.preventDefault();const Z=s.split("/").slice(0,-1).join("/")||"/";T(Z)}return}const me=F.length;if(me!==0){if(se.key==="ArrowDown"){se.preventDefault();const Z=k<me-1?k+1:0;A(Z),(R=B.current.get(Z))==null||R.focus()}else if(se.key==="ArrowUp"){se.preventDefault();const Z=k>0?k-1:me-1;A(Z),(P=B.current.get(Z))==null||P.focus()}}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,F.length,k,s,T]),S.useEffect(()=>{var z;k>=0&&((z=B.current.get(k))==null||z.scrollIntoView({block:"nearest"}))},[k]);function W(z){W2(z),L(nf()),t(z),n()}const Y=mR(s),U=s.split("/").pop()||"/";return Ll.createPortal(a.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:le,children:a.jsxs("div",{ref:I,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 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:z=>z.stopPropagation(),children:[a.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:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),O.length>0&&a.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[a.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"}),a.jsx("ul",{className:"list-none m-0 p-0",children:O.map(z=>a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>W(z),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:[a.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:[a.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"}),a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),a.jsx("span",{className:"font-medium truncate",children:z.split("/").pop()||z}),a.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:z})]})},z))})]}),a.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?a.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:z=>y(z.target.value),onKeyDown:z=>{z.key==="Enter"&&v.trim()&&W(v.trim()),z.key==="Escape"&&(z.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}):a.jsxs(a.Fragment,{children:[a.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:Y.map((z,se)=>{const me=se===Y.length-1;return a.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[se>0&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("button",{type:"button",onClick:()=>{me||T(z.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${me?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":me?"location":void 0,tabIndex:me?-1:0,children:z.label})]},z.path)})}),a.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(s)},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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})})})]})}),!b&&a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.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:a.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"})}),a.jsx("input",{ref:G,type:"text","aria-label":"Filter directories",value:j,onChange:z=>{E(z.target.value),A(-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"})]}),a.jsxs("button",{type:"button",onClick:()=>W(s),"aria-label":`Select ${U}`,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:a.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"})}),a.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),a.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:U})]})]}),a.jsx("div",{ref:$,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?a.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((z,se)=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[a.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"}}),a.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+se*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 ${se*.1}s infinite`}})]},se))}):p?a.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:a.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"})}),a.jsx("p",{className:"text-xs text-cc-muted",children:p}),a.jsx("button",{type:"button",onClick:()=>T(s||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):F.length===0?a.jsxs("div",{className:"px-4 py-8 text-center",children:[a.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&a.jsx("button",{type:"button",onClick:()=>E(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):a.jsx("ul",{className:"list-none m-0 p-0",children:F.map((z,se)=>a.jsxs("li",{className:`flex items-center transition-colors ${k===se?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[a.jsxs("button",{type:"button",ref:me=>{me?B.current.set(se,me):B.current.delete(se)},onClick:()=>T(z.path),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),W(z.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:z.path,"aria-label":`Navigate into ${z.name}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:a.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"})}),a.jsx("span",{className:"truncate",children:z.name}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:a.jsx("path",{d:"M6 4l4 4-4 4"})})]}),a.jsx("button",{type:"button",onClick:()=>W(z.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 ${z.name}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})})})]},z.path))})}),a.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:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),a.jsxs("span",{className:"ml-auto",children:[a.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 xR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function vR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():xR(e.identifier,e.title)}function fc({className:e}){return a.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[a.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"}),a.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"}),a.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"}),a.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 bR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:s}){const[l,c]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(0),[y,b]=S.useState(!0),[_,j]=S.useState([]),[E,k]=S.useState(""),[A,C]=S.useState(""),[D,O]=S.useState(!0),[L,I]=S.useState(!1),[$,G]=S.useState("");S.useEffect(()=>{let F=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([T,le])=>{var Y;if(!F)return;j(T.teams),k(le.viewerId);const W=((Y=T.teams[0])==null?void 0:Y.id)||"";p(W)}).catch(T=>{F&&G(T instanceof Error?T.message:"Failed to load teams")}).finally(()=>{F&&O(!1)}),()=>{F=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){C("");return}const F=_.find(le=>le.id===h),T=F==null?void 0:F.states.find(le=>le.type==="backlog");C((T==null?void 0:T.id)||"")},[h,_]);async function B(){if(!(!l.trim()||!h)){I(!0),G("");try{const F=await we.createLinearIssue({title:l.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&E?E:void 0,stateId:A||void 0,connectionId:t});n(F.issue)}catch(F){G(F instanceof Error?F.message:"Failed to create issue")}finally{I(!1)}}}return Ll.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:s,children:a.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),a.jsx("button",{type:"button",onClick:s,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})})]}),$&&a.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:$}),D?a.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),a.jsx("input",{id:"create-issue-title",type:"text",value:l,onChange:F=>c(F.target.value),onKeyDown:F=>{F.key==="Enter"&&l.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"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),a.jsx("textarea",{id:"create-issue-desc",value:u,onChange:F=>f(F.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"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),a.jsx("select",{id:"create-issue-team",value:h,onChange:F=>p(F.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(F=>a.jsxs("option",{value:F.id,children:[F.name," (",F.key,")"]},F.id))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),a.jsxs("select",{id:"create-issue-priority",value:g,onChange:F=>v(Number(F.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:[a.jsx("option",{value:0,children:"No priority"}),a.jsx("option",{value:1,children:"Urgent"}),a.jsx("option",{value:2,children:"High"}),a.jsx("option",{value:3,children:"Medium"}),a.jsx("option",{value:4,children:"Low"})]})]}),a.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:F=>b(F.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),a.jsxs("div",{className:"flex gap-2.5 pt-2",children:[a.jsx("button",{type:"button",onClick:s,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"}),a.jsx("button",{type:"button",onClick:B,disabled:!l.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 yR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:s,onIssueSelect:l,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[v,y]=S.useState(!1),[b,_]=S.useState(""),[j,E]=S.useState([]),[k,A]=S.useState(!1),[C,D]=S.useState(!1),[O,L]=S.useState(""),[I,$]=S.useState(!1),[G,B]=S.useState(null),[F,T]=S.useState([]),[le,W]=S.useState(!1),[Y,U]=S.useState(""),[z,se]=S.useState(!1),[me,R]=S.useState([]),[P,Z]=S.useState(!1),[M,he]=S.useState(""),[_e,Ce]=S.useState(!1),[Re,Le]=S.useState([]),[Be,Je]=S.useState(!1),[xe,Pe]=S.useState(!1),ft=S.useRef(null);S.useEffect(()=>{function je(ze){ft.current&&!ft.current.contains(ze.target)&&(A(!1),se(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),S.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let je=!0;return we.listLinearConnections().then(({connections:ze})=>{je&&(h(ze),y(!0),ze.length>0?(g(ze[0].id),u(ze[0].id)):(g(null),u(null)))}).catch(()=>{je&&y(!0)}),()=>{je=!1}},[n]);const Rt=S.useCallback(je=>{g(je),u(je),l(null),E([]),_(""),L(""),Le([]),he(""),R([]),G&&(W(!0),U(""),we.getLinearProjectIssues(G.projectId,10,je).then(({issues:ze})=>{T(ze)}).catch(ze=>{U(ze instanceof Error?ze.message:String(ze))}).finally(()=>{W(!1)}))},[G,u,l]);S.useEffect(()=>{if(!t||!n){B(null),T([]);return}let je=!0;return W(!0),U(""),(async()=>{try{const{mapping:ze}=await we.getLinearProjectMapping(t.repoRoot);if(!je)return;if(B(ze),ze){const{issues:yt}=await we.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!je)return;T(yt)}else T([])}catch(ze){if(!je)return;U(ze instanceof Error?ze.message:String(ze))}finally{je&&W(!1)}})(),()=>{je=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const je=b.trim();if(je.length<2){E([]),L(""),D(!1);return}let ze=!0;D(!0),L("");const yt=setTimeout(()=>{we.searchLinearIssues(je,8,p??void 0).then(qe=>{ze&&E(qe.issues)}).catch(qe=>{ze&&(E([]),L(qe instanceof Error?qe.message:String(qe)))}).finally(()=>{ze&&D(!1)})},400);return()=>{ze=!1,clearTimeout(yt)}},[n,b,p]),S.useEffect(()=>{if(!n||!_e){Le([]),Je(!1);return}const je=M.trim();if(je.length<2){Le([]),Je(!1);return}let ze=!0;Je(!0);const yt=setTimeout(()=>{we.searchLinearIssues(je,10,p??void 0).then(qe=>{ze&&Le(qe.issues)}).catch(()=>{ze&&Le([])}).finally(()=>{ze&&Je(!1)})},400);return()=>{ze=!1,clearTimeout(yt)}},[n,_e,M,p]);function bt(je,ze=!1){l(je),_(`${je.identifier} - ${je.title}`);const yt=vR(je);c(yt,!0),ze&&A(!1)}function Lt(){l(null),_(""),E([]),L("")}async function un(je){if(t)try{const{mapping:ze}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});B(ze),se(!1),W(!0),U("");const{issues:yt}=await we.getLinearProjectIssues(je.id,10,p??void 0);T(yt)}catch(ze){U(ze instanceof Error?ze.message:String(ze))}finally{W(!1)}}async function st(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}B(null),T([]),l(null),_("")}}function dn(){if(!n){window.location.hash="#/integrations/linear";return}se(!0),me.length===0&&(Z(!0),we.listLinearProjects(p??void 0).then(({projects:je})=>R(je)).catch(()=>{}).finally(()=>Z(!1)))}function bn(je){Pe(!1),bt(je),G&&(W(!0),we.getLinearProjectIssues(G.projectId,10,p??void 0).then(({issues:ze})=>T(ze)).catch(()=>{}).finally(()=>W(!1)))}return n?a.jsxs("aside",{className:"space-y-2 mt-0.5",ref:ft,children:[a.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&a.jsx("select",{value:p??"",onChange:je=>Rt(je.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(je=>a.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),G?a.jsxs(a.Fragment,{children:[a.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:[a.jsx(fc,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:G.projectName}),a.jsx("button",{type:"button",onClick:st,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})})})]}),a.jsxs("button",{type:"button",onClick:()=>Pe(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:"Create issue"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}A(!k)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${s?"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:[a.jsx(fc,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Linear"})]}),n&&t&&a.jsxs("button",{type:"button",onClick:dn,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:"Attach project"})]}),n&&a.jsxs("button",{type:"button",onClick:()=>Pe(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:"Create issue"})]}),!n&&a.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),G&&(()=>{const je=M.trim().toLowerCase(),ze=!_e&&je?F.filter(qe=>qe.identifier.toLowerCase().includes(je)||qe.title.toLowerCase().includes(je)):_e?[]:F,yt=_e?Re:ze;return a.jsxs("div",{className:"mt-2",children:[s&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[a.jsx("span",{className:"font-mono-code",children:s.identifier})," - ",s.title]}),a.jsx("button",{type:"button",onClick:Lt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})})]}),a.jsx("input",{type:"text",value:M,onChange:qe=>he(qe.target.value),placeholder:_e?"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?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):Y?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:Y}):Be?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&je.length<2?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):yt.length===0?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:je?"No matching issues":"No active issues found"}):a.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:yt.map(qe=>a.jsxs("button",{type:"button",onClick:()=>bt(qe),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(s==null?void 0:s.id)===qe.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:qe.identifier})," ",qe.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[qe.stateName,qe.priorityLabel].filter(Boolean).join(" - ")})]},qe.id))}),a.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:_e,onChange:qe=>{Ce(qe.target.checked),qe.target.checked||Le([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),z&&a.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:[a.jsx("div",{className:"p-2 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),a.jsx("button",{type:"button",onClick:()=>se(!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"})]})}),P?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):me.length===0?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):a.jsx("div",{className:"max-h-48 overflow-y-auto",children:me.map(je=>a.jsx("button",{type:"button",onClick:()=>un(je),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("div",{className:"text-xs text-cc-fg",children:je.name})},je.id))})]}),k&&n&&a.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:[a.jsxs("div",{className:"p-2 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:b,onChange:je=>{_(je.target.value)},onFocus:()=>A(!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"}),a.jsx("button",{type:"button",onClick:()=>{A(!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"})]}),a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[a.jsx("span",{children:"Attach an issue to this draft"}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&C&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!C&&O&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:O}),b.trim().length>=2&&!C&&!O&&j.length===0&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!C&&!O&&a.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>a.jsxs("button",{type:"button",onClick:()=>bt(je,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:je.identifier})," - ",je.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[je.stateName,je.teamName].filter(Boolean).join(" • ")})]},je.id))})]}),a.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:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})})]}),I&&a.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),a.jsx("div",{className:"flex gap-2 mt-2.5",children:a.jsx("button",{type:"button",onClick:()=>{$(!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"})})]}),xe&&a.jsx(bR,{defaultProjectId:G==null?void 0:G.projectId,connectionId:p??void 0,onCreated:bn,onClose:()=>Pe(!1)})]}):null}function _R({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:s,useWorktree:l,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,v]=S.useState(!1),[y,b]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(E){_.current&&!_.current.contains(E.target)&&v(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?we.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:_,children:[a.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),v(!g),b("")},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":s?"true":"false",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:a.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"})}),a.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&a.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:[a.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:a.jsx("input",{type:"text",value:y,onChange:j=>b(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"&&v(!1)}})}),a.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=y.toLowerCase().trim(),E=h.filter(D=>!D.isRemote&&(!j||D.name.toLowerCase().includes(j))),k=h.filter(D=>D.isRemote&&(!j||D.name.toLowerCase().includes(j))),A=h.some(D=>D.name.toLowerCase()===j),C=E.length>0||k.length>0;return a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),E.map(D=>a.jsxs("button",{onClick:()=>{c(D.name,!1),v(!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:[a.jsx("span",{className:"truncate font-mono-code",children:D.name}),a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[D.ahead>0&&a.jsxs("span",{className:"text-[9px] text-green-500",children:[D.ahead,"↑"]}),D.behind>0&&a.jsxs("span",{className:"text-[9px] text-amber-500",children:[D.behind,"↓"]}),D.worktreePath&&a.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&&a.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&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(D=>a.jsxs("button",{onClick:()=>{c(D.name,!1),v(!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:[a.jsx("span",{className:"truncate font-mono-code",children:D.name}),a.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}`))]}),!C&&j&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!A&&a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.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"})}),a.jsxs("span",{children:["Create ",a.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),a.jsxs("button",{onClick:()=>u(!l),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${l?"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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:a.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"})}),a.jsx("span",{children:"Worktree"})]})]}):null}const wR=336*60*60*1e3,oa=12,SR=24;function Ng(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())||Ng(e.cwd)}function kR(e){return e.length>8?e.slice(0,8):e}function jR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function NR(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 s=Math.floor(n/60);if(s<24)return`${s}h ago`;const l=Math.floor(s/24);if(l<14)return`${l}d ago`;const c=Math.floor(l/7);if(c<8)return`${c}w ago`;const u=Math.floor(l/30);return`${Math.max(1,u)}mo ago`}function CR(){var Js;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[s,l]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,y]=S.useState([]),[b,_]=S.useState(()=>T5(localStorage.getItem("cc-backend")||"claude")),[j,E]=S.useState(()=>A5(localStorage.getItem("cc-backend")||"claude")),[k,A]=S.useState(()=>localStorage.getItem("cc-effort")||""),[C,D]=S.useState(()=>nf()[0]||""),[O,L]=S.useState([]),[I,$]=S.useState(null),[G,B]=S.useState(!1),[F,T]=S.useState(""),[le,W]=S.useState(null),[Y,U]=S.useState(!1),[z,se]=S.useState(null),[me,R]=S.useState(null),[P,Z]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=le||V2(p),he=E5(p),_e=z7(p),[Ce,Re]=S.useState([]),[Le,Be]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Je,xe]=S.useState(!1),[Pe,ft]=S.useState(!1),Rt=fR(),[bt,Lt]=S.useState(()=>Rt),[un,st]=S.useState([]),[dn,bn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,ze]=S.useState(!1),yt=S.useRef(null),[qe,Or]=S.useState(null),ae=S.useRef(null),ve=S.useRef(null),[Q,fe]=S.useState(!1),[Te,Ye]=S.useState(!1),[et,tt]=S.useState(!1),[vt,fn]=S.useState(!1),[Ke,tr]=S.useState(!1),[En,Yr]=S.useState(""),[Br,Pr]=S.useState(!0),[te,pe]=S.useState([]),[ge,Qe]=S.useState(!1),[Dt,nn]=S.useState(""),[Tn,zt]=S.useState(!1),[Dn,mr]=S.useState(oa),[_a,Ol]=S.useState(""),[zn,Ri]=S.useState(null),[Bl,Pl]=S.useState(!1),[gr,Ht]=S.useState(""),[yn,nr]=S.useState(!1),[Ul,ff]=S.useState([]),[Li,Di]=S.useState(null),[Qr,Gs]=S.useState(!1),[hs,Hn]=S.useState(""),[zi,Xr]=S.useState(0),Yt=S.useRef(null),In=S.useRef(null),wa=S.useRef(null),Ur=S.useRef(null),Wr=S.useRef(null),$l=S.useRef(null),Fl=X(q=>q.currentSessionId),Qt=Y2({text:e,caretPos:zi,cwd:C||void 0});S.useEffect(()=>{if(Yt.current===null||!In.current)return;const q=Yt.current;In.current.setSelectionRange(q,q),Yt.current=null},[e]),S.useEffect(()=>{var de;window.matchMedia("(min-width: 640px)").matches&&((de=In.current)==null||de.focus())},[]),S.useEffect(()=>{we.getHome().then(({home:q,cwd:de})=>{C||D(de||q)}).catch(()=>{}),we.listEnvs().then(Re).catch(()=>{}),we.listSandboxes().then(st).catch(()=>{}),we.getBackends().then(y).catch(()=>{}),we.getSettings().then(q=>{U(q.linearApiKeyConfigured)}).catch(()=>{})},[]);function hf(q){g(q),localStorage.setItem("cc-backend",q),W(null),_(T5(q)),E(A5(q)),q!=="claude"&&(tr(!1),pe([]),nn(""),Qe(!1),zt(!1),mr(oa),Ol(""))}S.useEffect(()=>{if(p!=="codex"){W(null);return}we.getBackendModels(p).then(q=>{if(q.length>0){const de=L7(q);W(de),de.some(Xe=>Xe.value===b)||_(de[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(ae.current&&(clearInterval(ae.current),ae.current=null),Or(null),!bt)return;const q="the-companion:latest",de=()=>{we.getImageStatus(q).then(Xe=>{Or(Xe),Xe.status==="idle"&&we.pullImage(q).catch(()=>{}),(Xe.status==="ready"||Xe.status==="error")&&ae.current&&(clearInterval(ae.current),ae.current=null)}).catch(()=>{})};return de(),ae.current=setInterval(de,2e3),()=>{ae.current&&(clearInterval(ae.current),ae.current=null)}},[bt]),S.useEffect(()=>{function q(de){wa.current&&!wa.current.contains(de.target)&&fe(!1),Ur.current&&!Ur.current.contains(de.target)&&Ye(!1),Wr.current&&!Wr.current.contains(de.target)&&tt(!1),$l.current&&!$l.current.contains(de.target)&&xe(!1),yt.current&&!yt.current.contains(de.target)&&ze(!1)}return document.addEventListener("pointerdown",q),()=>document.removeEventListener("pointerdown",q)},[]),S.useEffect(()=>{if(!C){Ri(null);return}we.getRepoInfo(C).then(q=>{Ri(q),Ht(q.currentBranch),nr(!1)}).catch(()=>{Ri(null),Ht(""),nr(!1)})},[C]);const Oi=M.find(q=>q.value===b)||M[0],Sa=he.find(q=>q.value===j)||he[0],$r=_e.find(q=>q.value===k)||_e[0],qn=p==="codex"?"/logo-codex.svg":"/logo.svg",Dc=C?C.split("/").pop()||C:"Select folder",Hl=S.useMemo(()=>En.trim(),[En]),ka=p==="claude"&&Ke&&Hl.length>0,Kr=S.useMemo(()=>{const q=Date.now()-wR;return te.filter(de=>de.createdAt>=q)},[te]),Ys=S.useMemo(()=>Tn?te:Kr.length>0?Kr:te,[Tn,Kr,te]),xr=S.useMemo(()=>_a.trim().toLowerCase(),[_a]),Jt=S.useMemo(()=>xr?Ys.filter(q=>{const de=O5(q).toLowerCase(),Xe=Ng(q.cwd).toLowerCase(),ht=(q.gitBranch||"").toLowerCase(),it=q.cwd.toLowerCase(),Fe=q.resumeSessionId.toLowerCase();return de.includes(xr)||Xe.includes(xr)||ht.includes(xr)||it.includes(xr)||Fe.includes(xr)}):Ys,[Ys,xr]),Bi=S.useMemo(()=>Jt.slice(0,Dn),[Jt,Dn]),zc=Dn<Jt.length,ja=Math.max(0,te.length-Kr.length),Qs=!Tn&&Kr.length>0,Na=S.useCallback(async()=>{if(p==="claude"){Qe(!0),nn("");try{const[q,de]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then(Fe=>Fe.sessions)]),Xe=new Map,ht=Fe=>{const On=Xe.get(Fe.resumeSessionId);(!On||Fe.createdAt>On.createdAt)&&Xe.set(Fe.resumeSessionId,Fe)};for(const Fe of q)Fe.backendType!=="codex"&&Fe.cliSessionId&&ht({resumeSessionId:Fe.cliSessionId,sessionId:Fe.sessionId,name:Fe.name,model:Fe.model,createdAt:Fe.createdAt,cwd:Fe.cwd,gitBranch:Fe.gitBranch,source:"companion"});for(const Fe of de)ht({resumeSessionId:Fe.sessionId,sessionId:Fe.sessionId,slug:Fe.slug,createdAt:Fe.lastActivityAt,cwd:Fe.cwd,gitBranch:Fe.gitBranch,source:"claude_disk"});const it=Array.from(Xe.values()).sort((Fe,On)=>{const hn=C&&Fe.cwd===C?0:1,yr=C&&On.cwd===C?0:1;return hn!==yr?hn-yr:On.createdAt-Fe.createdAt});pe(it),zt(!1),mr(oa)}catch(q){const de=q instanceof Error?q.message:String(q);nn(de||"Failed to load existing sessions"),pe([]),mr(oa)}finally{Qe(!1)}}},[p,C]);S.useEffect(()=>{p==="claude"&&Ke&&Na()},[p,Ke,Na]),S.useEffect(()=>{mr(oa)},[xr,Tn]);async function Il(q){if(q.length===0)return;const de=[],Xe=[];let ht=O.reduce((it,Fe)=>it+Fe.size,0);for(const it of q){if(it.size>ef){Xe.push(`${it.name} is too large (${Ni(it.size)}, max ${Ni(ef)})`);continue}if(ht+it.size>tf){Xe.push(`${it.name} would exceed the per-message limit (${Ni(tf)})`);continue}const{base64:Fe,mediaType:On}=await L2(it);de.push({name:it.name,base64:Fe,mediaType:On,size:it.size}),ht+=it.size}de.length>0&&L(it=>[...it,...de]),$(Xe.length>0?Xe.join("; "):null)}async function Xs(q){const de=q.target.files;de&&(await Il(Array.from(de)),q.target.value="")}function pf(q){L(de=>de.filter((Xe,ht)=>ht!==q))}async function Oc(q){var ht;const de=(ht=q.clipboardData)==null?void 0:ht.items;if(!de)return;const Xe=[];for(const it of Array.from(de)){if(it.kind!=="file")continue;const Fe=it.getAsFile();if(!Fe)continue;const On=Fe.name&&Fe.name.length>0?Fe.name:`pasted-${Date.now()}.${(Fe.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Xe.push(new File([Fe],On,{type:Fe.type,lastModified:Fe.lastModified}))}Xe.length>0&&(q.preventDefault(),await Il(Xe))}function Bc(q){t(q.target.value),Xr(q.target.selectionStart??q.target.value.length);const de=q.target;de.style.height="auto",de.style.height=Math.min(de.scrollHeight,200)+"px"}function Ca(){In.current&&Xr(In.current.selectionStart??0)}function Pc(q){var Xe;const de=Qt.selectPrompt(q);Yt.current=de.nextCursor,t(de.nextText),Qt.setMentionMenuOpen(!1),Xr(de.nextCursor),(Xe=In.current)==null||Xe.focus(),In.current&&(In.current.style.height="auto",In.current.style.height=Math.min(In.current.scrollHeight,200)+"px")}function mf(q){if(Qt.mentionMenuOpen&&q.key==="Escape"){q.preventDefault(),Qt.setMentionMenuOpen(!1);return}if(Qt.mentionMenuOpen&&Qt.filteredPrompts.length>0){if(q.key==="ArrowDown"){q.preventDefault(),Qt.setMentionMenuIndex(de=>(de+1)%Qt.filteredPrompts.length);return}if(q.key==="ArrowUp"){q.preventDefault(),Qt.setMentionMenuIndex(de=>(de-1+Qt.filteredPrompts.length)%Qt.filteredPrompts.length);return}if(q.key==="Tab"&&!q.shiftKey||q.key==="Enter"&&!q.shiftKey){q.preventDefault(),Pc(Qt.filteredPrompts[Qt.mentionMenuIndex]);return}}if(Qt.mentionMenuOpen&&Qt.filteredPrompts.length===0&&(q.key==="Enter"&&!q.shiftKey||q.key==="Tab"&&!q.shiftKey)){q.preventDefault();return}if(q.key==="Tab"&&q.shiftKey){q.preventDefault();const de=E5(p),ht=(de.findIndex(it=>it.value===j)+1)%de.length;E(de[ht].value);return}q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),vr())}function Ea(q){const de=s.trim(),Xe=de?`[${de}]: ${q}`:q;if(!z)return Xe;const ht=(z.description??"").trim();return`${["Linear issue context:",`- Identifier: ${z.identifier}`,`- Title: ${z.title}`,z.stateName?`- State: ${z.stateName}`:"",z.priorityLabel?`- Priority: ${z.priorityLabel}`:"",z.teamName?`- Team: ${z.teamName}`:"",`- URL: ${z.url}`,ht?`- Description:
|
|
108
|
+
${ht}`:""].filter(Boolean).join(`
|
|
109
|
+
`)}
|
|
110
|
+
|
|
111
|
+
User request:
|
|
112
|
+
${Xe}`}async function vr(){const q=e.trim();if(!(!q||G)){if(n&&!s.trim()){T("Please enter your name before starting a session.");return}if(B(!0),T(""),Hn(""),zn){const de=gr||zn.currentBranch;if(de&&de===zn.currentBranch){const Xe=Ul.find(ht=>ht.name===de&&!ht.isRemote);if(Xe&&Xe.behind>0){Di({behind:Xe.behind,branchName:de});return}}}await Ws(q)}}async function Ws(q,de){const Xe=X.getState();Xe.clearCreation(),Xe.setSessionCreating(!0,p);try{Fl&&jm(Fl);const ht=(de==null?void 0:de.resumeSessionAt)||(ka?Hl:void 0),it=ht?(de==null?void 0:de.forkSession)??(ka?Br:void 0):void 0,Fe=(de==null?void 0:de.cwd)||C,On=(de==null?void 0:de.branch)!==void 0?de.branch.trim()||void 0:gr.trim()||void 0,hn=(de==null?void 0:de.useWorktree)!==void 0?de.useWorktree:Bl,yr=(de==null?void 0:de.createBranch)!==void 0?de.createBranch:!!(On&&yn),ps=await m4({model:b,permissionMode:j,effort:p==="claude"&&k?k:void 0,cwd:Fe||void 0,envSlug:Le||void 0,sandboxEnabled:bt?!0:void 0,sandboxSlug:bt&&dn?dn:void 0,branch:On,createBranch:yr?!0:void 0,useWorktree:hn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:ht,forkSession:it,userName:s.trim()||void 0,linearConnectionId:z&&me||void 0,linearIssue:z?{identifier:z.identifier,title:z.title,stateName:z.stateName,teamName:z.teamName,url:z.url}:void 0},Zr=>{X.getState().addCreationProgress(Zr)}),pn=ps.sessionId,Fc=X.getState(),Vl=Fc.sdkSessions.filter(Zr=>Zr.sessionId!==pn);Fc.setSdkSessions([...Vl,{sessionId:pn,state:ps.state,cwd:ps.cwd,createdAt:Date.now(),backendType:ps.backendType||p,model:b,permissionMode:j,userName:s.trim()||void 0,resumeSessionAt:ht,forkSession:ht?it===!0:void 0}]);const Gl=new Set(X.getState().sessionNames.values()),Ui=Y5(Gl),$i=c.trim()||s.trim(),Hc=f.trim()||Ui,Ic=$i?`${$i}_${Hc}`:Hc;X.getState().setSessionName(pn,Ic),we.renameSession(pn,Ic).catch(()=>{}),h(""),Fe&&W2(Fe),X.getState().setPreviousPermissionMode(pn,j),Xg(pn,!0),Ec(pn),await UN(pn);const qc=q.trim();if(qc.length>0){const Zr=Ea(qc),Vc=wm(),Gc=O.length>0?O.map(Ma=>({name:Ma.name,media_type:Ma.mediaType,data:Ma.base64,size:Ma.size})):void 0;Pn(pn,{type:"user_message",content:Zr,session_id:pn,attachments:Gc,client_msg_id:Vc}),X.getState().appendMessage(pn,{id:Vc,role:"user",content:Zr,attachments:Gc,timestamp:Date.now()})}z&&(we.linkLinearIssue(pn,z,me||void 0).then(()=>X.getState().setLinkedLinearIssue(pn,z)).catch(()=>{}),we.transitionLinearIssue(z.id,me||void 0).catch(()=>{})),X.getState().clearCreation()}catch(ht){const it=ht instanceof Error?ht.message:String(ht);T(it),X.getState().setCreationError(it),B(!1)}}async function Ta(q,de){G||(B(!0),T(""),Hn(""),D(q.cwd),Pl(!1),nr(!1),Ht(q.gitBranch||""),Yr(q.resumeSessionId),Pr(de),await Ws("",{resumeSessionAt:q.resumeSessionId,forkSession:de,cwd:q.cwd,branch:q.gitBranch,useWorktree:!1,createBranch:!1}))}async function Ks(){if(Li){Gs(!0),Hn("");try{const q=C||(zn==null?void 0:zn.repoRoot);if(!q)throw new Error("No working directory");const de=await we.gitPull(q);if(!de.success){Hn(de.output||"Pull failed"),Gs(!1),B(!1);return}Di(null),Gs(!1),await Ws(e.trim())}catch(q){Hn(q instanceof Error?q.message:String(q)),Gs(!1)}}}function Zs(){const q=e.trim();Di(null),Hn(""),Ws(q)}function Uc(){Di(null),Hn(""),B(!1)}const ql=S.useCallback((q,de)=>{Ht(q),nr(de)},[]),$c=S.useCallback((q,de)=>{Ht(q),nr(de)},[]),Pi=S.useCallback(q=>{ff(q)},[]),br=S.useCallback(q=>{se(q),!q&&zn&&(Ht(zn.currentBranch),nr(!1))},[zn]),Aa=e.trim().length>0&&!G&&(!n||s.trim().length>0);return a.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:[a.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),a.jsxs("div",{className:"w-full max-w-[720px]",children:[a.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[a.jsx("img",{src:qn,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),a.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",a.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&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[a.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",a.jsx("span",{className:"text-cc-error",children:"*"})]}),a.jsx("input",{type:"text",value:s,onChange:q=>{const de=q.target.value;l(de),localStorage.setItem("cc-user-name",de)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":s.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"})]}),a.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",a.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),a.jsx("input",{type:"text",value:c,onChange:q=>{const de=q.target.value;u(de),localStorage.setItem("cc-session-prefix",de)},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"})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[a.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",a.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),a.jsx("input",{type:"text",value:f,onChange:q=>h(q.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"}),a.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",a.jsxs("span",{className:"font-mono-code",children:[c.trim()||s.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),a.jsx("input",{ref:ve,type:"file",multiple:!0,onChange:Xs,className:"hidden","aria-label":"Attach files"}),a.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[a.jsx(G2,{open:Qt.mentionMenuOpen,loading:Qt.promptsLoading,prompts:Qt.filteredPrompts,selectedIndex:Qt.mentionMenuIndex,onSelect:Pc,menuRef:Qt.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(z||O.length>0)&&a.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[z&&a.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:[a.jsx("span",{className:"shrink-0",children:"Linear"}),a.jsx("span",{className:"font-mono-code shrink-0",children:z.identifier}),a.jsx("span",{className:"truncate",children:z.title}),a.jsx("button",{type:"button",onClick:()=>br(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((q,de)=>a.jsx(O2,{name:q.name,mediaType:q.mediaType,base64:q.base64,size:q.size,onRemove:()=>pf(de),className:"w-10 h-10"},de))]}),I&&a.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:I}),a.jsx("textarea",{ref:In,value:e,onChange:Bc,onKeyDown:mf,onClick:Ca,onKeyUp:Ca,onPaste:Oc,"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"}}),a.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[a.jsxs("div",{className:"relative",ref:wa,children:[a.jsxs("button",{onClick:()=>fe(!Q),"aria-expanded":Q,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:[a.jsx("span",{children:Oi.icon}),a.jsx("span",{children:Oi.label}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Q&&a.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:M.map(q=>a.jsxs("button",{onClick:()=>{_(q.value),fe(!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 ${q.value===b?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{children:q.icon}),q.label]},q.value))})]}),_e.length>0&&a.jsxs("div",{className:"relative",ref:Wr,children:[a.jsxs("button",{onClick:()=>tt(!et),"aria-expanded":et,"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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:$r.label}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),et&&a.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:_e.map(q=>a.jsx("button",{onClick:()=>{A(q.value),localStorage.setItem("cc-effort",q.value),tt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value||"default"))})]}),a.jsxs("div",{className:"relative",ref:Ur,children:[a.jsxs("button",{onClick:()=>Ye(!Te),"aria-expanded":Te,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Sa.label,a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Te&&a.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:he.map(q=>a.jsx("button",{onClick:()=>{E(q.value),Ye(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value))})]}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>fn(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.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"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Dc})]}),vt&&a.jsx(gR,{initialPath:C||"",onSelect:q=>{D(q)},onClose:()=>fn(!1)})]}),a.jsx(_R,{cwd:C,gitRepoInfo:zn,selectedBranch:gr,isNewBranch:yn,useWorktree:Bl,onBranchChange:ql,onWorktreeChange:Pl,onBranchesLoaded:Pi}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{className:"relative",ref:$l,children:[a.jsxs("button",{onClick:()=>{Je||we.listEnvs().then(Re).catch(()=>{}),xe(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.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"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Le?((Js=Ce.find(q=>q.slug===Le))==null?void 0:Js.name)||"Env":"No env"})]}),Je&&a.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:[a.jsx("button",{onClick:()=>{Be(""),localStorage.setItem("cc-selected-env",""),xe(!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"}),Ce.map(q=>a.jsxs("button",{onClick:()=>{Be(q.slug),localStorage.setItem("cc-selected-env",q.slug),xe(!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 ${q.slug===Le?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate",children:q.name}),a.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(q.variables).length," var",Object.keys(q.variables).length!==1?"s":""]})]},q.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("button",{onClick:()=>{ft(!0),xe(!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..."})})]})]}),Rt,a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{var q;return(q=ve.current)==null?void 0:q.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.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"})})}),a.jsx("button",{onClick:vr,disabled:!Aa,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Aa?"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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),a.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(q=>a.jsxs("button",{onClick:()=>q.available&&hf(q.id),disabled:!q.available,title:q.available?q.name:`${q.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${q.available?p===q.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:[q.name,!q.available&&a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},q.id))})}),p==="claude"&&a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>tr(q=>!q),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ke?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ke,"aria-controls":"branch-from-session-panel",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[a.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"}),a.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${Ke?"rotate-180":""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),a.jsx("div",{className:"accordion-panel","data-open":Ke?"true":"false",children:a.jsx("div",{className:"accordion-inner",inert:!Ke||void 0,children:a.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:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>void Na(),disabled:ge,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:ge?"Refreshing...":"Refresh detected sessions"}),te.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",Bi.length," of ",Jt.length," ",xr?"matching":Qs?"recent":"detected"," Claude session",Jt.length!==1?"s":"","."]}),!Tn&&ja>0&&Kr.length>0&&a.jsxs("button",{type:"button",onClick:()=>{zt(!0),mr(oa)},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 (",ja,")"]}),Tn&&Kr.length>0&&a.jsx("button",{type:"button",onClick:()=>{zt(!1),mr(oa)},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"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"sr-only",children:"Search sessions"}),a.jsxs("div",{className:"relative",children:[a.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:[a.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),a.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),a.jsx("input",{type:"text",value:_a,onChange:q=>Ol(q.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"})]})]}),a.jsxs("p",{className:"text-[11px] text-cc-muted",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",a.jsx("span",{className:"mx-1",children:"•"}),a.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Dt&&a.jsx("p",{className:"text-[11px] text-cc-error",children:Dt}),!ge&&!Dt&&Jt.length===0&&a.jsx("p",{className:"text-[11px] text-cc-muted",children:xr?"No sessions match this search.":"No Claude sessions detected yet."}),Bi.length>0&&a.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[a.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:[a.jsx("span",{children:"Session"}),a.jsx("span",{children:"Project"}),a.jsx("span",{children:"Branch"}),a.jsx("span",{children:"Last active"}),a.jsx("span",{className:"text-right",children:"Action"})]}),a.jsx("div",{className:"divide-y divide-cc-border/50",children:Bi.map(q=>{const de=O5(q),Xe=Ng(q.cwd),ht=q.source==="companion"?"Companion":"Claude",it=Hl===q.resumeSessionId;return a.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:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:`text-xs truncate ${it?"text-cc-primary font-medium":"text-cc-fg"}`,children:de}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"font-mono-code text-cc-muted",children:kR(q.resumeSessionId)}),a.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:ht})]})]}),a.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:q.cwd,children:[a.jsx("div",{className:"truncate",children:Xe}),a.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:q.cwd,children:jR(q.cwd)})]}),a.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:q.gitBranch||"—"}),a.jsx("div",{className:"text-[11px] text-cc-muted",children:NR(q.createdAt)}),a.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[a.jsx("button",{type:"button",onClick:()=>{Yr(q.resumeSessionId),Pr(!0),Ta(q,!0)},"aria-label":`Fork and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&Br?"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
|
|
113
|
+
${q.cwd}${q.gitBranch?` (${q.gitBranch})`:""}
|
|
114
|
+
${q.resumeSessionId}`,children:"Fork"}),a.jsx("button",{type:"button",onClick:()=>{Yr(q.resumeSessionId),Pr(!1),Ta(q,!1)},"aria-label":`Continue and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&!Br?"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
|
|
115
|
+
${q.resumeSessionId}`,children:"Continue"})]})]},`${q.resumeSessionId}-row-${q.sessionId}`)})}),zc&&a.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:a.jsxs("button",{type:"button",onClick:()=>mr(q=>Math.min(q+SR,Jt.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 (",Jt.length-Dn," remaining)"]})})]}),a.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."})]})})})]}),P&&a.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:[a.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:a.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"})}),a.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&a.jsxs(a.Fragment,{children:[" ",a.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx(yR,{cwd:C,gitRepoInfo:zn,linearConfigured:Y,selectedLinearIssue:z,onIssueSelect:br,onBranchFromIssue:$c,onConnectionSelect:R})]}),Li&&a.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:a.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"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[a.jsx("span",{className:"font-mono-code font-medium",children:Li.branchName})," is"," ",a.jsxs("span",{className:"font-semibold text-amber-500",children:[Li.behind," commit",Li.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),hs&&a.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:hs}),a.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[a.jsx("button",{onClick:Uc,disabled:Qr,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"}),a.jsx("button",{onClick:Zs,disabled:Qr,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"}),a.jsx("button",{onClick:Ks,disabled:Qr,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:Qr?a.jsxs(a.Fragment,{children:[a.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"})]})]})]})}),F&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:a.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"})}),a.jsx("p",{className:"text-xs text-cc-error",children:F})]})]}),Pe&&a.jsx(K2,{onClose:()=>{ft(!1),we.listEnvs().then(Re).catch(()=>{})}})]})}const ER=[],TR=[],AR={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"}},MR={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function RR({server:e,sessionId:t}){var f,h;const[n,s]=S.useState(!1),l=AR[e.status]||MR,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return a.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.dot}`}),a.jsx("button",{onClick:()=>s(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${l.badge}`,children:l.label}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>$N(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"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:c?"Disable server":"Enable server",children:c?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&a.jsx("button",{onClick:()=>FN(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:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.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"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&a.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[a.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),a.jsx("span",{children:e.config.type})]}),e.config.command&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),a.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&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),a.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),a.jsx("span",{children:e.scope})]})]}),e.error&&a.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>a.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 LR({sessionId:e,onDone:t}){const[n,s]=S.useState(""),[l,c]=S.useState("stdio"),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(""),y=n.trim()&&(l==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const j={type:l};l==="stdio"?(j.command=u.trim(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=g.trim(),HN(e,{[n.trim()]:j}),t()}return a.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),a.jsx("input",{type:"text",value:n,onChange:_=>s(_.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),a.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>a.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${l===_?"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:_},_))})]}),l==="stdio"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),a.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"})]})]}),(l==="sse"||l==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),a.jsx("input",{type:"text",value:g,onChange:_=>v(_.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"})]}),a.jsxs("div",{className:"flex gap-1.5 pt-1",children:[a.jsx("button",{type:"submit",disabled:!y,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${y?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),a.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 DR({sessionId:e}){const t=X(f=>f.mcpServers.get(e)||ER),n=X(f=>f.cliConnected.get(e)??!1),[s,l]=S.useState(!1),c=X(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??TR});S.useEffect(()=>{n&&jb(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[a.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:a.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"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>l(!s),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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx("button",{onClick:()=>jb(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:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.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"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),s&&a.jsx("div",{className:"px-3 py-2",children:a.jsx(LR,{sessionId:e,onDone:()=>l(!1)})}),u.length>0&&a.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>a.jsx(RR,{server:f,sessionId:e},f.name))}),!s&&u.length===0&&a.jsx("div",{className:"px-3 py-3",children:a.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&a.jsx("button",{onClick:()=>l(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function zR({cwd:e,open:t,onClose:n}){var F;const[s,l]=S.useState([]),[c,u]=S.useState(!0),[f,h]=S.useState(0),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[j,E]=S.useState(null),[k,A]=S.useState(null),C=S.useCallback(()=>{u(!0),E(null),we.getClaudeMdFiles(e).then(T=>{l(T.files),T.files.length>0&&(h(0),g(T.files[0].content)),A(null),y(!1),u(!1)}).catch(T=>{E(T.message),u(!1)})},[e]);S.useEffect(()=>{t&&C()},[t,C]);const D=T=>{v&&!confirm("Discard unsaved changes?")||(h(T),g(s[T].content),y(!1),A(null))},O=async()=>{var le;const T=k||((le=s[f])==null?void 0:le.path);if(T){_(!0),E(null);try{await we.saveClaudeMd(T,p),y(!1),k?C():l(W=>W.map((Y,U)=>U===f?{...Y,content:p}:Y))}catch(W){E(W instanceof Error?W.message:"Failed to save")}finally{_(!1)}}},L=T=>{const le=T==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;A(le),g(`# CLAUDE.md
|
|
116
|
+
|
|
117
|
+
`),y(!0)},I=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const $=T=>T.startsWith(e+"/")?T.slice(e.length+1):T,G=s.some(T=>T.path===`${e}/CLAUDE.md`),B=s.some(T=>T.path===`${e}/.claude/CLAUDE.md`);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:I}),a.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:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),a.jsx("button",{onClick:I,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 flex min-h-0",children:c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[a.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),a.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[s.map((T,le)=>a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:a.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"})}),a.jsx("span",{className:"truncate font-mono-code",children:$(T.path)})]},T.path)),k&&a.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.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"})}),a.jsx("span",{className:"truncate font-mono-code",children:$(k)})]})]}),(!G||!B)&&!k&&a.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!G&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.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"})}),a.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!B&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.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"})}),a.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.length===0&&!k?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:a.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"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),a.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."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.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"}),a.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"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:$(k||(((F=s[f])==null?void 0:F.path)??""))}),a.jsxs("div",{className:"flex items-center gap-2",children:[v&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:O,disabled:!v||b,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!b?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:b?"Saving...":"Save"})]})]}),a.jsx("textarea",{value:p,onChange:T=>{g(T.target.value),y(!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&&a.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 B5({icon:e,title:t,expanded:n,onToggle:s}){return a.jsxs("button",{onClick:s,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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),a.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function Ls({label:e,sublabel:t,count:n,onClick:s}){return a.jsxs("button",{onClick:s,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:[a.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&a.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),a.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:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function OR({path:e,content:t,onClose:n}){let s;try{s=JSON.stringify(JSON.parse(t),null,2)}catch{s=t}return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),a.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:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:s})}),a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:a.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function BR({path:e,label:t,onClose:n}){const[s,l]=S.useState(""),[c,u]=S.useState(!0),[f,h]=S.useState(!1),[p,g]=S.useState(!1),[v,y]=S.useState(null);S.useEffect(()=>{we.readFile(e).then(j=>{l(j.content),u(!1)}).catch(j=>{y(j instanceof Error?j.message:"Failed to read file"),u(!1)})},[e]);const b=async()=>{g(!0),y(null);try{await we.writeFile(e,s),h(!1)}catch(j){y(j instanceof Error?j.message:"Failed to save")}finally{g(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),a.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:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),a.jsxs("div",{className:"flex items-center gap-2",children:[f&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:b,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"})]})]}),a.jsx("textarea",{value:s,onChange:j=>{l(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..."})]}),v&&a.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:v})]})]})}function PR({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[s,l]=S.useState(null),[c,u]=S.useState(!0);return S.useEffect(()=>{we.readFile(e.path).then(f=>{l(f.content),u(!1)}).catch(()=>{l("Failed to read file"),u(!1)})},[e.path]),c?null:a.jsx(OR,{path:e.path,content:s||"",onClose:n})}return e.kind==="claude-md"?a.jsx(zR,{cwd:e.editorCwd||t,open:!0,onClose:n}):a.jsx(BR,{path:e.path,label:e.label,onClose:n})}function UR({sessionId:e}){const t=X(k=>k.sessions.get(e)),n=X(k=>k.sdkSessions.find(A=>A.sessionId===e)),s=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[l,c]=S.useState(null),[u,f]=S.useState(!0),[h,p]=S.useState(!1),[g,v]=S.useState(!1),[y,b]=S.useState(null),_=S.useCallback(async()=>{if(s)try{const k=await we.getClaudeConfig(s);c(k)}catch{}finally{f(!1)}},[s]);if(S.useEffect(()=>{_()},[_]),!s)return null;if(u)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!l)return null;const j=l.project.claudeMd.length+(l.project.settings?1:0)+(l.project.settingsLocal?1:0)+l.project.commands.length,E=(l.user.claudeMd?1:0)+l.user.skills.length+l.user.agents.length+(l.user.settings?1:0)+l.user.commands.length;return a.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[a.jsx(B5,{icon:"project",title:`Project (${j})`,expanded:h,onToggle:()=>p(k=>!k)}),h&&a.jsxs("div",{className:"pb-1",children:[l.project.claudeMd.map(k=>a.jsx(Ls,{label:k.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:k.path,kind:"claude-md"})},k.path)),l.project.settings&&a.jsx(Ls,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.project.settings.path,kind:"json"})}),l.project.settingsLocal&&a.jsx(Ls,{label:"settings.local.json",onClick:()=>b({label:"settings.local.json",path:l.project.settingsLocal.path,kind:"json"})}),l.project.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.project.commands.length,")"]}),l.project.commands.map(k=>a.jsx(Ls,{label:`/${k.name}`,onClick:()=>b({label:k.name,path:k.path,kind:"md"})},k.path))]}),j===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),a.jsx(B5,{icon:"user",title:`User (${E})`,expanded:g,onToggle:()=>v(k=>!k)}),g&&a.jsxs("div",{className:"pb-1",children:[l.user.claudeMd&&a.jsx(Ls,{label:"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:l.user.claudeMd.path,kind:"claude-md",editorCwd:l.user.root})}),l.user.skills.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",l.user.skills.length,")"]}),l.user.skills.map(k=>a.jsx(Ls,{label:k.name,sublabel:k.description?k.description.slice(0,40):void 0,onClick:()=>b({label:k.name,path:k.path,kind:"md"})},k.path))]}),l.user.agents.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",l.user.agents.length,")"]}),l.user.agents.map(k=>a.jsx(Ls,{label:k.name,onClick:()=>b({label:k.name,path:k.path,kind:"md"})},k.path))]}),l.user.settings&&a.jsx(Ls,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.user.settings.path,kind:"json"})}),l.user.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.user.commands.length,")"]}),l.user.commands.map(k=>a.jsx(Ls,{label:`/${k.name}`,onClick:()=>b({label:k.name,path:k.path,kind:"md"})},k.path))]}),E===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),y&&Ll.createPortal(a.jsx(PR,{item:y,cwd:s,onClose:()=>b(null)}),document.body)]})}function $R(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 s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class FR extends S.Component{constructor(){super(...arguments);Y1(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Ti(n,{section:this.props.label})}render(){return this.state.hasError?a.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),a.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 Z2=[],J2=3e4,HR=6e4;let P5=null,U5=new Map;function IR(e){return e!==P5&&(P5=e,U5=new Map(e.map(t=>[t.sessionId,t]))),U5}function Lc(e){return X(S.useCallback(t=>IR(t.sdkSessions).get(e),[e]))}const eS="cc-panel-collapsed";function $5(){try{const e=localStorage.getItem(eS);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function qR(e){try{localStorage.setItem(eS,JSON.stringify([...e]))}catch{}}function tS({id:e,label:t,badge:n,defaultOpen:s=!0,children:l}){const[c,u]=S.useState(()=>$5().has(e)?!0:!s),f=S.useRef(!0);S.useEffect(()=>{if(f.current){f.current=!1;return}const p=$5();c?p.add(e):p.delete(e),qR(p)},[c,e]);const h=S.useCallback(()=>{u(p=>!p)},[]);return a.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[a.jsxs("button",{onClick:h,"aria-expanded":!c,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:[a.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 ${c?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&a.jsx("span",{className:"shrink-0",children:n})]}),a.jsx("div",{className:"accordion-panel","data-open":c?"false":"true",children:a.jsx("div",{className:"accordion-inner",children:l})})]})}function VR(){const[e,t]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[n,s]=S.useState(()=>localStorage.getItem("cc-session-prefix")||"");return a.jsx(tS,{id:"identity",label:"Identity",children:a.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[a.jsxs("label",{className:"flex flex-col gap-1",children:[a.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),a.jsx("input",{type:"text",value:e,onChange:l=>{const c=l.target.value;t(c),localStorage.setItem("cc-user-name",c)},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"})]}),a.jsxs("label",{className:"flex flex-col gap-1",children:[a.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",a.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),a.jsx("input",{type:"text",value:n,onChange:l=>{const c=l.target.value;s(c),localStorage.setItem("cc-session-prefix",c)},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"})]}),a.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",a.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",a.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function nS(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function rS(e){return e>80?"critical":e>50?"elevated":"normal"}function Ml({label:e,pct:t,detail:n}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),a.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&a.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),a.jsx("div",{role:"meter","aria-label":`${e} usage — ${rS(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:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${nS(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function GR({sessionId:e}){var h;const[t,n]=S.useState(null),s=S.useCallback(async()=>{try{const p=await we.getSessionUsageLimits(e);n(p)}catch{}},[e]),l=S.useRef(0);if(S.useEffect(()=>{s();const p=setInterval(()=>{l.current+=1,l.current%2===0?s():n(g=>g?{...g}:null)},J2);return()=>clearInterval(p)},[s]),!t)return null;const c=t.five_hour!==null,u=t.seven_day!==null,f=!c&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!c&&!u&&!f?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&a.jsx(Ml,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?S5(t.five_hour.resets_at):void 0}),t.seven_day&&a.jsx(Ml,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?S5(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),a.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&&a.jsx("div",{role:"meter","aria-label":`Extra usage — ${rS(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:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${nS(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function F5(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function YR(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let s=!1;const l=async()=>{try{const u=await we.getSystemMemory();s||n(u)}catch{}};l();const c=setInterval(l,HR);return()=>{s=!0,clearInterval(c)}},[]),t?a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:a.jsx(Ml,{label:"Memory",pct:t.used_percent,detail:`${F5(t.used_bytes)} / ${F5(t.total_bytes)}`})}):null}function QR({sessionId:e}){const t=X(c=>{var u;return(u=c.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=S.useState(0);if(S.useEffect(()=>{if(!t)return;const c=setInterval(()=>n(u=>u+1),J2);return()=>clearInterval(c)},[t]),!t)return null;const{primary:s,secondary:l}=t;return!s&&!l?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[s&&a.jsx(Ml,{label:`${j5(s.windowDurationMins)} Limit`,pct:s.usedPercent,detail:s.resetsAt>0?k5(s.resetsAt):void 0}),l&&a.jsx(Ml,{label:`${j5(l.windowDurationMins)} Limit`,pct:l.usedPercent,detail:l.resetsAt>0?k5(l.resetsAt):void 0})]})}function XR({sessionId:e}){const t=X(s=>{var l;return(l=s.sessions.get(e))==null?void 0:l.codex_token_details}),n=X(s=>{var l;return((l=s.sessions.get(e))==null?void 0:l.context_used_percent)??0});return t?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ec(t.inputTokens)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ec(t.outputTokens)})]}),t.cachedInputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ec(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ec(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&a.jsx(Ml,{label:"Context",pct:n})]}):null}function WR(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 KR({pr:e}){const t=WR(e.state,e.isDraft),{checksSummary:n,reviewThreads:s}=e;return a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.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]}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&a.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?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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?a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),a.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&a.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"]})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),s.unresolved>0&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),s.unresolved," unresolved"]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[a.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),a.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),a.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function ZR({sessionId:e}){const t=X(u=>u.sessions.get(e)),n=Lc(e),s=X(u=>u.prStatus.get(e)),l=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),c=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return S.useEffect(()=>{s||!l||!c||we.getPRStatus(l,c).then(u=>{X.getState().setPRStatus(e,u)}).catch(()=>{})},[e,l,c,s]),!(s!=null&&s.available)||!s.pr?null:a.jsx(KR,{pr:s.pr})}const JR=6e4;function mm(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 eL({sessionId:e}){const t=X(T=>T.linkedLinearIssues.get(e)),[n,s]=S.useState([]),[l,c]=S.useState(null),[u,f]=S.useState([]),[h,p]=S.useState(""),[g,v]=S.useState(!1),[y,b]=S.useState(!1),[_,j]=S.useState(!1),[E,k]=S.useState(""),[A,C]=S.useState([]),[D,O]=S.useState(!1),L=S.useRef(null);S.useEffect(()=>{we.getLinkedLinearIssue(e).then(T=>{T.issue&&X.getState().setLinkedLinearIssue(e,T.issue)}).catch(()=>{})},[e]);const I=S.useCallback(async()=>{if(t)try{const T=await we.getLinkedLinearIssue(e,!0);T.issue&&(X.getState().setLinkedLinearIssue(e,T.issue),T.issue.stateType==="completed"&&b(!0)),T.comments&&s(T.comments),T.assignee!==void 0&&c(T.assignee??null),T.labels&&f(T.labels)}catch{}},[e,t]);S.useEffect(()=>{if(!t)return;I();const T=setInterval(I,JR);return()=>clearInterval(T)},[I,t]),S.useEffect(()=>{if(!_)return;const T=E.trim();if(T.length<2){C([]);return}let le=!0;O(!0);const W=setTimeout(()=>{we.searchLinearIssues(T,6).then(Y=>{le&&C(Y.issues)}).catch(()=>{le&&C([])}).finally(()=>{le&&O(!1)})},400);return()=>{le=!1,clearTimeout(W)}},[E,_]),S.useEffect(()=>{_&&setTimeout(()=>{var T;return(T=L.current)==null?void 0:T.focus()},50)},[_]);async function $(){if(!(!t||!h.trim()||g)){v(!0);try{const T=await we.addLinearComment(t.id,h.trim());s(le=>[...le,T.comment]),p("")}catch{}finally{v(!1)}}}async function G(){try{await we.unlinkLinearIssue(e),X.getState().setLinkedLinearIssue(e,null),s([]),c(null),f([]),b(!1)}catch{}}async function B(T){try{await we.linkLinearIssue(e,T),X.getState().setLinkedLinearIssue(e,T),j(!1),k(""),C([])}catch{}}if(!t)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(fc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.jsx("input",{ref:L,type:"text",value:E,onChange:T=>k(T.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"}),a.jsx("button",{onClick:()=>{j(!1),k(""),C([])},"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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),D&&a.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),A.length>0&&a.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:A.map(T=>a.jsxs("button",{onClick:()=>B(T),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:T.identifier}),a.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${mm(T.stateType,T.stateName).cls}`,children:mm(T.stateType,T.stateName).label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:T.title})]},T.id))}),E.trim().length>=2&&!D&&A.length===0&&a.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):a.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:[a.jsx(fc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const F=mm(t.stateType,t.stateName);return a.jsxs("div",{className:"shrink-0",children:[a.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(fc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.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}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${F.cls}`,children:F.label}),a.jsx("button",{onClick:G,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&a.jsx("span",{children:t.priorityLabel}),t.teamName&&a.jsxs(a.Fragment,{children:[t.priorityLabel&&a.jsx("span",{children:"·"}),a.jsx("span",{children:t.teamName})]}),l&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{children:["@ ",l.name]})]})]}),u.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(T=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id))})]}),y&&t.stateType==="completed"&&a.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:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),a.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("button",{onClick:()=>b(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),a.jsx("button",{onClick:async()=>{try{await we.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&&a.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[a.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(T=>a.jsxs("div",{className:"text-[11px]",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:T.userName}),a.jsx("span",{className:"text-[9px] text-cc-muted",children:$R(new Date(T.createdAt).getTime())})]}),a.jsx("p",{className:"text-cc-muted line-clamp-2",children:T.body})]},T.id))]}),a.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:h,onChange:T=>p(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),$())},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"}),a.jsx("button",{onClick:$,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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 tL({sessionId:e}){const t=X(l=>l.sessions.get(e)),n=Lc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?a.jsxs(a.Fragment,{children:[a.jsx(QR,{sessionId:e}),a.jsx(XR,{sessionId:e})]}):a.jsx(GR,{sessionId:e})}function nL({sessionId:e}){const t=X(p=>p.sessions.get(e)),n=Lc(e),s=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),l=(t==null?void 0:t.git_ahead)||0,c=(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 s?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:s,children:s}),(t==null?void 0:t.is_containerized)&&a.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"})]}),(l>0||c>0||u>0||f>0)&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[l>0&&a.jsxs("span",{className:"text-cc-success",children:[l,"↑",a.jsx("span",{className:"sr-only",children:" commits ahead"})]}),c>0&&a.jsxs("span",{className:"text-cc-warning",children:[c,"↓",a.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&a.jsxs("span",{className:"text-cc-success",children:["+",u,a.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&a.jsxs("span",{className:"text-cc-error",children:["-",f,a.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),c>0&&h&&a.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{we.gitPull(h).then(p=>{X.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Ti(new Error(`git pull failed: ${p.output}`))}).catch(p=>Ti(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function rL({sessionId:e}){const t=X(c=>c.sessionTasks.get(e)||Z2),n=X(c=>c.sessions.get(e)),s=Lc(e),l=((n==null?void 0:n.backend_type)||(s==null?void 0:s.backendType))==="codex";return!n||l?null:a.jsx("div",{className:"px-3 py-2",children:t.length===0?a.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):a.jsx("div",{className:"space-y-0.5",children:t.map(c=>a.jsx(cL,{task:c},c.id))})})}const sL={"usage-limits":tL,"server-memory":YR,"git-branch":nL,"github-pr":ZR,"linear-issue":eL,"mcp-servers":DR,tasks:rL};function iL(e,t){const n=X(s=>s.sessionTasks.get(t)||Z2);if(e==="tasks"&&n.length>0){const s=n.filter(l=>l.status==="completed").length;return a.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[s,"/",n.length]})}return null}function aL({isCodex:e}){const t=X(p=>p.taskPanelConfig),n=X(p=>p.toggleSectionEnabled),s=X(p=>p.moveSectionUp),l=X(p=>p.moveSectionDown),c=X(p=>p.resetTaskPanelConfig),u=X(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const g=qs.find(v=>v.id===p);return!(!g||g.backends&&!g.backends.includes(f))});return a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((p,g)=>{const v=qs.find(j=>j.id===p),y=t.enabled[p]??!0,b=g===0,_=g===h.length-1;return a.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 ${y?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[a.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>s(p),disabled:b,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),a.jsx("button",{onClick:()=>l(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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:v.label}),a.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.description})]}),a.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${y?"bg-cc-primary":"bg-cc-hover"}`,title:y?"Hide section":"Show section",role:"switch","aria-checked":y,"data-testid":`toggle-${p}`,children:a.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${y?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),a.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[a.jsx("button",{onClick:()=>c(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),a.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 lL({sectionId:e,sessionId:t,children:n}){var c;const s=((c=qs.find(u=>u.id===e))==null?void 0:c.label)??e,l=iL(e,t);return a.jsx(tS,{id:e,label:s,badge:l,children:n})}function oL({sessionId:e}){const t=X(g=>g.sessions.get(e)),n=Lc(e),s=X(g=>g.taskPanelOpen),l=X(g=>g.setTaskPanelOpen),c=X(g=>g.taskPanelConfigMode),u=X(g=>g.taskPanelConfig);if(!s)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 v=qs.find(y=>y.id===g);return!(!v||v.backends&&!v.backends.includes(h))});return a.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:c?"Panel Settings":"Context"}),a.jsx("button",{onClick:()=>{c?X.getState().setTaskPanelConfigMode(!1):l(!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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),c?a.jsx(aL,{isCodex:f}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[a.jsx(VR,{}),a.jsx(UR,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var y;const v=sL[g];return v?a.jsx(lL,{sectionId:g,sessionId:e,children:a.jsx(FR,{label:(y=qs.find(b=>b.id===g))==null?void 0:y.label,children:a.jsx(v,{sessionId:e})})},g):null})]}),a.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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 cL({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?a.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:a.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.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),a.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),a.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&a.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&a.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),a.jsxs("span",{children:["blocked by ",e.blockedBy.map(s=>`#${s}`).join(", ")]})]})]})}function uL({status:e}){return e==="created"?a.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"?a.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"}):a.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 dL({sessionId:e}){const t=X(O=>O.sessions.get(e)),n=X(O=>O.sdkSessions.find(L=>L.sessionId===e)),s=X(O=>O.diffPanelSelectedFile.get(e)??null),l=X(O=>O.setDiffPanelSelectedFile),c=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(""),[v,y]=S.useState(!1),[b,_]=S.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,E]=S.useState([]),k=X(O=>O.setGitChangedFilesCount);S.useEffect(()=>{if(!h)return;let O=!1;return we.getChangedFiles(h,c).then(({files:L})=>{if(O)return;const I=`${h}/`,$=L.filter(G=>G.path===h||G.path.startsWith(I)).map(G=>({abs:G.path,rel:G.path.startsWith(I)?G.path.slice(I.length):G.path,status:G.status==="A"||G.status==="?"?"created":G.status==="D"?"deleted":"updated"})).sort((G,B)=>G.rel.localeCompare(B.rel));E($),k(e,$.length)}).catch(()=>{O||(E([]),k(e,0))}),()=>{O=!0}},[h,c,f,e,k]);const A=j;S.useEffect(()=>{!s&&A.length>0&&l(e,A[0].abs)},[s,A,e,l]),S.useEffect(()=>{var O;s&&(A.some(L=>L.abs===s)||l(e,((O=A[0])==null?void 0:O.abs)??null))},[s,A,e,l]),S.useEffect(()=>{if(!s){g("");return}let O=!1;return y(!0),we.getFileDiff(s,c).then(L=>{O||(g(L.diff),y(!1))}).catch(()=>{O||(g(""),y(!1))}),()=>{O=!0}},[s,c]);const C=S.useCallback(O=>{l(e,O),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,l]),D=S.useMemo(()=>!s||!h?s:s.startsWith(h+"/")?s.slice(h.length+1):s,[s,h]);return h?A.length===0?a.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:a.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),a.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."})]})]}):a.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[b&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),a.jsxs("div",{className:`
|
|
118
|
+
${b?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
119
|
+
fixed sm:relative z-30 sm:z-auto
|
|
120
|
+
${b?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
121
|
+
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
122
|
+
`,children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),a.jsxs("span",{children:["Changed (",A.length,")"]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:A.map(({abs:O,rel:L,status:I})=>a.jsxs("button",{onClick:()=>C(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===s?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[a.jsx(uL,{status:I}),a.jsx("span",{className:"truncate leading-snug",children:L})]},O))})]}),a.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[s&&a.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:[!b&&a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:D==null?void 0:D.split("/").pop()}),a.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:D})]}),a.jsx("button",{onClick:()=>u(c==="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 ${c==="last-commit"?"default branch":"last commit"} comparison`,children:c==="default-branch"?"vs default branch":"vs last commit"})]}),a.jsx("div",{className:"flex-1 overflow-auto",children:v?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):s?a.jsx("div",{className:"p-4",children:a.jsx(Rl,{unifiedDiff:p,fileName:D||void 0,mode:"full"})}):a.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!b&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"]}),a.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:a.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function fL(){const e=X(h=>h.updateInfo),t=X(h=>h.updateDismissedVersion),n=X(h=>h.dismissUpdate),[s,l]=S.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const c=async()=>{l(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await we.triggerUpdate(),X.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),Ti(h),l(!1)}},u=()=>{n(e.latestVersion)},f=s||e.updateInProgress;return a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.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"})}),a.jsxs("span",{className:"text-xs text-cc-fg",children:[a.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",a.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?a.jsx("button",{onClick:c,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"}):a.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",a.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"]}),a.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function hL({steps:e,error:t,backend:n,onCancel:s}){const l=n==="codex"?"/logo-codex.svg":"/logo.svg",c=e.some(v=>v.status==="in_progress"),u=e.length>0&&e.every(v=>v.status==="done"),f=e.some(v=>v.status==="error")||!!t,h=[...e].reverse().find(v=>v.status==="in_progress"),p=[...e].reverse().find(v=>v.status==="done"),g=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.label)||(p==null?void 0:p.label)||"Preparing...";return a.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:[a.jsxs("div",{className:"relative mb-8",children:[c&&!f&&a.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),a.jsx("img",{src:l,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${c&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),c&&!f&&a.jsx("div",{className:"absolute -inset-3 z-0",children:a.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:a.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&&a.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),a.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:g}),a.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((v,y)=>a.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${y*60}ms`},children:[a.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[v.status==="in_progress"&&a.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),v.status==="done"&&a.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:a.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.status==="error"&&a.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),a.jsx("span",{className:`text-xs transition-colors duration-200 ${v.status==="in_progress"?"text-cc-fg font-medium":v.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:v.label}),v.detail&&v.status==="in_progress"&&a.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:v.detail})]},v.step))}),t&&a.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:a.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:a.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(f||c)&&s&&a.jsx("button",{onClick:s,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&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:a.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(v=>v.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function pL(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const mL={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function gL(e){const[t,n]=S.useState("installing"),s=S.useRef(null),l=S.useRef(!0);return S.useEffect(()=>(l.current=!0,()=>{l.current=!1,s.current&&clearTimeout(s.current)}),[]),S.useEffect(()=>{if(!e)return;const c=setTimeout(()=>{l.current&&n("restarting")},3e3),u=setTimeout(()=>{l.current&&n("waiting"),f()},5e3);function f(){l.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:pL()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{l.current&&(n("ready"),setTimeout(()=>{l.current&&window.location.reload()},800))}).catch(()=>{s.current=setTimeout(f,1500)})}return()=>{clearTimeout(c),clearTimeout(u),s.current&&clearTimeout(s.current)}},[e]),t}function sS({phase:e,className:t}){const n=e==="ready";return a.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[a.jsxs("div",{className:"relative mb-8",children:[!n&&a.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),a.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&a.jsx("div",{className:"absolute -inset-3 z-0",children:a.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:a.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&&a.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),a.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:mL[e]}),a.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&a.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(s=>a.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:`${s*.2}s`}},s))}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:a.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 xL({active:e}){const t=gL(e);return e?a.jsx(sS,{phase:t,className:"fixed inset-0 z-[100]"}):null}function IL({phase:e}){return a.jsx(sS,{phase:e,className:"absolute inset-0"})}function vL(){const e=X(j=>j.dockerUpdateDialogOpen),t=X(j=>j.setDockerUpdateDialogOpen),[n,s]=S.useState("prompt"),[l,c]=S.useState(!1),[u,f]=S.useState(null),h=S.useRef(null);if(S.useEffect(()=>{e&&we.getSettings().then(j=>{c(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(()=>{we.getImageStatus("the-companion:latest").then(j=>{f(j),j.status==="ready"?s("done"):j.status==="error"&&s("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function p(){s("pulling"),we.pullImage("the-companion:latest").then(j=>{j.state&&f(j.state)}).catch(()=>{s(j=>j==="pulling"?"error":j)})}function g(){p()}function v(){b()}function y(){b()}function b(){s("prompt"),f(null),t(!1)}async function _(){const j=!l;c(j);try{await we.updateSettings({dockerAutoUpdate:j})}catch{c(!j)}}return a.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:a.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"&&a.jsxs("div",{className:"p-6",children:[a.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),a.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?"}),a.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:[a.jsx("span",{children:"Always update Docker image automatically"}),a.jsx("span",{role:"switch","aria-checked":l,"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 ${l?"bg-cc-primary":"bg-cc-border"}`,children:a.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${l?"translate-x-4":"translate-x-0"}`})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:v,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"}),a.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"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.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&&a.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(`
|
|
123
|
+
`)})]}),n==="done"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:a.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"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:y,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"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:a.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"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&a.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&a.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(`
|
|
124
|
+
`)}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:b,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"}),a.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 qL({phase:e}){return a.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:a.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"&&a.jsxs("div",{className:"p-5",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),a.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?"}),a.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:[a.jsx("span",{children:"Always update automatically"}),a.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:a.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.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...
|
|
125
|
+
Layer 1/5: abc123 downloading
|
|
126
|
+
Layer 2/5: def456 complete`})]}),e==="done"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.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"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:a.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"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const gm=["welcome","claude","codex","done"],H5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Cg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function bL({onComplete:e}){const[t,n]=S.useState("welcome"),[s,l]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[j,E]=S.useState(Cg),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>E(!0))},[j]),S.useEffect(()=>{const F=k.current;if(!F)return;function T(W){if(W.key==="Escape"){W.preventDefault();return}if(W.key!=="Tab")return;const Y=F.querySelectorAll(H5);if(Y.length===0)return;const U=Y[0],z=Y[Y.length-1];W.shiftKey?document.activeElement===U&&(W.preventDefault(),z.focus()):document.activeElement===z&&(W.preventDefault(),U.focus())}document.addEventListener("keydown",T);const le=F.querySelector(H5);return le==null||le.focus(),()=>document.removeEventListener("keydown",T)},[t]);const A=S.useCallback(async()=>{if(!s.trim()){n("codex");return}h(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:s.trim()}),y(!0),n("codex")}catch(F){g(F instanceof Error?F.message:"Failed to save token")}finally{h(!1)}},[s]),C=S.useCallback(async()=>{h(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await O()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(F){g(F instanceof Error?F.message:"Failed to check auth status")}finally{h(!1)}},[]),D=S.useCallback(async()=>{h(!0),g("");try{await we.updateSettings({openaiApiKey:c.trim()}),_(!0),await O()}catch(F){g(F instanceof Error?F.message:"Failed to save API key")}finally{h(!1)}},[c]),O=S.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=S.useCallback(()=>{e()},[e]),I=S.useCallback(async()=>{await O(),e()},[O,e]),$=S.useCallback(F=>{g(""),n(F)},[]),G=gm.indexOf(t),B=Cg();return Ll.createPortal(a.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:[a.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}}),a.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"&&a.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${G+1} of ${gm.length-1}`,children:gm.slice(0,3).map((F,T)=>a.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:T===G?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:T<=G?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:T<=G?1:.5}},F))}),a.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"&&a.jsx(yL,{onSetupClaude:()=>$("claude"),onSetupCodex:()=>$("codex")}),t==="claude"&&a.jsx(_L,{token:s,onTokenChange:l,onSave:A,onSkip:()=>$("codex"),saving:f,error:p}),t==="codex"&&a.jsx(wL,{apiKey:c,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:D,onSkip:()=>O(),onBack:()=>$("claude"),saving:f,error:p}),t==="done"&&a.jsx(SL,{claudeConfigured:v,codexConfigured:b,onDone:L})]}),t==="welcome"&&a.jsx("button",{onClick:I,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 yL({onSetupClaude:e,onSetupCodex:t}){return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),a.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."})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.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:[a.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"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a.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:[a.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"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function _L({token:e,onTokenChange:t,onSave:n,onSkip:s,saving:l,error:c}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(iS,{text:"claude setup-token"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),a.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":c?f:void 0,"aria-invalid":c?!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"})]}),c&&a.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:c})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("button",{onClick:s,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"}),a.jsx("button",{onClick:n,disabled:l,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:l?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:l?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function wL({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:s,onSkip:l,onBack:c,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),a.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:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(iS,{text:"codex --login"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&a.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),a.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:a.jsx("div",{className:"accordion-inner",children:a.jsxs("div",{className:"mt-3",children:[a.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),a.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.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"})]})})})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsxs("button",{onClick:c,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:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:l,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"}),a.jsx("button",{onClick:e.trim()?s: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 SL({claudeConfigured:e,codexConfigured:t,onDone:n}){const s=!e&&!t,l=Cg(),[c,u]=S.useState(l);return S.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),a.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:l?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:s?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:s?a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:s?"Setup Skipped":"You're all set!"}),a.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:s?"You can configure providers anytime in Settings.":a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&a.jsx("span",{className:"block",children:"Codex is ready."}),a.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),a.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 iS({text:e}){const[t,n]=S.useState(!1),s=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return a.jsx("button",{onClick:s,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?a.jsxs(a.Fragment,{children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const kL=S.lazy(()=>Jn(()=>import("./Playground-Dlv72b_8.js"),[]).then(e=>({default:e.Playground}))),jL=S.lazy(()=>Jn(()=>import("./SettingsPage-SvStjnbd.js"),[]).then(e=>({default:e.SettingsPage}))),NL=S.lazy(()=>Jn(()=>import("./IntegrationsPage-ClbDqoEP.js"),[]).then(e=>({default:e.IntegrationsPage}))),CL=S.lazy(()=>Jn(()=>import("./LinearSettingsPage-DN2raNtR.js"),[]).then(e=>({default:e.LinearSettingsPage}))),EL=S.lazy(()=>Jn(()=>import("./LinearOAuthSettingsPage-BEeYBnSb.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),TL=S.lazy(()=>Jn(()=>import("./TailscalePage-C5J3VAqt.js"),[]).then(e=>({default:e.TailscalePage}))),AL=S.lazy(()=>Jn(()=>import("./PromptsPage-BOxtGtfT.js"),[]).then(e=>({default:e.PromptsPage}))),ML=S.lazy(()=>Jn(()=>Promise.resolve().then(()=>pR),void 0).then(e=>({default:e.EnvManager}))),RL=S.lazy(()=>Jn(()=>import("./SandboxManager-B90xK3cu.js"),[]).then(e=>({default:e.SandboxManager}))),LL=S.lazy(()=>Jn(()=>import("./CronManager-B_DSvQtN.js"),[]).then(e=>({default:e.CronManager}))),DL=S.lazy(()=>Jn(()=>import("./AgentsPage-BeDMkE2_.js"),[]).then(e=>({default:e.AgentsPage}))),zL=S.lazy(()=>Jn(()=>import("./RunsPage-CYUUHysG.js"),[]).then(e=>({default:e.RunsPage})));function Rr(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function OL(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function BL(){const e=X(z=>z.isAuthenticated),t=X(z=>z.darkMode),n=X(z=>z.currentSessionId),s=X(z=>z.sidebarOpen),l=X(z=>z.taskPanelOpen),c=X(z=>z.homeResetKey),u=X(z=>z.activeTab),f=X(z=>z.sessionCreating),h=X(z=>z.sessionCreatingBackend),p=X(z=>z.creationProgress),g=X(z=>z.creationError),v=X(z=>z.updateOverlayActive),y=OL(),b=S.useMemo(()=>Qg(y),[y]),_=b.page==="settings",j=b.page==="prompts",E=b.page==="integrations",k=b.page==="integration-linear",A=b.page==="integration-linear-oauth",C=b.page==="integration-tailscale",D=b.page==="environments",O=b.page==="sandboxes",L=b.page==="scheduled",I=b.page==="agents"||b.page==="agent-detail",$=b.page==="runs",G=b.page==="session"||b.page==="home";S.useEffect(()=>{h4(y||"#/")},[y]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const B=S.useRef(X.getState().currentSessionId);S.useEffect(()=>{if(B.current!==null&&b.page==="home"){Xg(B.current,!0),B.current=null;return}if(B.current=null,b.page==="session"){const z=X.getState();z.currentSessionId!==b.sessionId&&z.setCurrentSession(b.sessionId),Ec(b.sessionId)}else if(b.page==="home"){const z=X.getState();z.currentSessionId!==null&&z.setCurrentSession(null)}},[b]);const F=X(z=>n?z.changedFilesTick.get(n)??0:0),T=X(z=>z.diffBase),le=X(z=>z.setGitChangedFilesCount),W=X(z=>{var se,me;return n&&(((se=z.sessions.get(n))==null?void 0:se.cwd)||((me=z.sdkSessions.find(R=>R.sessionId===n))==null?void 0:me.cwd))||null});S.useEffect(()=>{if(!n||!W)return;let z=!1;return we.getChangedFiles(W,T).then(({files:se})=>{if(z)return;const me=`${W}/`,R=se.filter(P=>P.path===W||P.path.startsWith(me)).length;le(n,R)}).catch(()=>{}),()=>{z=!0}},[n,W,T,F,le]),S.useEffect(()=>{const z=()=>{we.checkForUpdate().then(me=>{X.getState().setUpdateInfo(me)}).catch(()=>{})};z();const se=setInterval(z,300*1e3);return()=>clearInterval(se)},[]),S.useEffect(()=>{const z=()=>{we.getClaudeCompat().then(me=>{X.getState().setClaudeCompatInfo(me)}).catch(()=>{})};z();const se=setInterval(z,300*1e3);return()=>clearInterval(se)},[]);const[Y,U]=S.useState(!1);return S.useEffect(()=>{e&&we.getSettings().then(z=>{z.publicUrl&&X.getState().setPublicUrl(z.publicUrl),z.onboardingCompleted||U(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?b.page==="playground"?a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(kL,{})}):a.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[s&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),a.jsx("div",{className:`
|
|
127
|
+
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
128
|
+
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
129
|
+
${s?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
130
|
+
overflow-hidden
|
|
131
|
+
`,children:a.jsx(R4,{})}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[a.jsx(uR,{}),a.jsx(fL,{}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[_&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(jL,{embedded:!0})})}),j&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(AL,{embedded:!0})})}),E&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(NL,{embedded:!0})})}),k&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(CL,{embedded:!0})})}),A&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(EL,{embedded:!0})})}),C&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(TL,{embedded:!0})})}),D&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(ML,{embedded:!0})})}),O&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(RL,{embedded:!0})})}),L&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(LL,{embedded:!0})})}),I&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(DL,{route:b})})}),$&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(S.Suspense,{fallback:a.jsx(Rr,{}),children:a.jsx(zL,{})})}),G&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?a.jsx(dL,{sessionId:n}):a.jsx(lR,{sessionId:n}):a.jsx(CR,{},c)}),f&&p&&p.length>0&&a.jsx(hL,{steps:p,error:g,backend:h??void 0,onCancel:()=>X.getState().clearCreation()})]})]})]}),n&&G&&a.jsxs(a.Fragment,{children:[!l&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),l&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>X.getState().setTaskPanelOpen(!1)}),a.jsx("div",{className:`
|
|
132
|
+
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
133
|
+
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
134
|
+
${l?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
135
|
+
overflow-hidden
|
|
136
|
+
`,children:a.jsx(oL,{sessionId:n})})]}),a.jsx(xL,{active:v}),a.jsx(vL,{}),Y&&a.jsx(bL,{onComplete:()=>U(!1)})]}):a.jsx(b4,{})}class PL extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Ti(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:a.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[a.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),a.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),a.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}}f4();hj.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(PL,{children:a.jsx(BL,{})})}));Jn(()=>import("./sw-register-BPlfMfHI.js"),[]).catch(()=>{});export{K7 as A,L7 as B,lR as C,Rl as D,HL as E,gR as F,KR as G,FL as H,fc as L,i7 as M,U7 as P,hL as S,K5 as T,fL as U,Jn as _,we as a,Xp as b,IL as c,qL as d,h7 as e,p7 as f,d4 as g,oR as h,fR as i,a as j,QR as k,XR as l,Ci as m,Xg as n,kl as o,hc as p,zR as q,S as r,$L as s,$R as t,X as u,jd as v,Cc as w,Ll as x,T5 as y,V2 as z};
|