@hellcoder/companion 0.116.1-preview.20260814050532.93fba26 → 0.117.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-DPt9YKyQ.js → AgentsPage-DJIGGU86.js} +1 -1
- package/dist/assets/{CronManager-BxRWyTp3.js → CronManager-D7aAMVgs.js} +1 -1
- package/dist/assets/{DashboardPage-BSnJNNNL.js → DashboardPage-Bporj7Vr.js} +1 -1
- package/dist/assets/{IntegrationsPage-DWrnBrBa.js → IntegrationsPage-BSY0-fsO.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-DZJpyUr3.js → LinearOAuthSettingsPage-Cl5dP05g.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CUV6wc7-.js → LinearSettingsPage-dwMpnpxL.js} +1 -1
- package/dist/assets/{MagicUIDashboard-CbruKd65.js → MagicUIDashboard-Bpa4AupX.js} +1 -1
- package/dist/assets/{MagicUIView-NSITfXce.js → MagicUIView-BoHMBELi.js} +1 -1
- package/dist/assets/{Playground-BoyZfARc.js → Playground-By2aXWQF.js} +1 -1
- package/dist/assets/{PromptsPage-D3aJBO9h.js → PromptsPage-DVv0Qn3d.js} +1 -1
- package/dist/assets/{RunsPage-C6YY6SGq.js → RunsPage-bu3TZ6ai.js} +1 -1
- package/dist/assets/{SandboxManager-_mggajaE.js → SandboxManager-CDjGbD5N.js} +1 -1
- package/dist/assets/{SettingsPage-DBjt4SLp.js → SettingsPage-D0v_BZTU.js} +1 -1
- package/dist/assets/{TailscalePage-BaAGOCMu.js → TailscalePage-B8SJQpMF.js} +1 -1
- package/dist/assets/index-BqOdTpct.css +1 -0
- package/dist/assets/index-DqIZ_Ol5.js +140 -0
- package/dist/assets/{sw-register-BH5kpgnP.js → sw-register-CvyRJNug.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/linear-agent-bridge.ts +0 -1
- package/server/magic-ui-watcher.test.ts +85 -0
- package/server/magic-ui-watcher.ts +0 -1
- package/server/routes/system-routes.test.ts +401 -0
- package/server/routes/system-routes.ts +10 -0
- package/server/system-disk.test.ts +48 -0
- package/server/system-disk.ts +55 -0
- package/server/system-memory.test.ts +32 -0
- package/server/system-memory.ts +32 -0
- package/dist/assets/index-BaDsUsyb.js +0 -140
- package/dist/assets/index-DSCRqqpK.css +0 -1
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-BoyZfARc.js","assets/MagicUIDashboard-CbruKd65.js","assets/MagicUIView-NSITfXce.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var eN=Object.defineProperty;var tN=(e,t,n)=>t in e?eN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hb=(e,t,n)=>tN(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const nN="modulepreload",rN=function(e){return"/"+e},pb={},Dn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=u(n.map(p=>{if(p=rN(p),p in pb)return;pb[p]=!0;const m=p.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":nN,m||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),m)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})};function Vg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tp={exports:{}},Bo={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var mb;function iN(){if(mb)return Bo;mb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:o}}return Bo.Fragment=t,Bo.jsx=n,Bo.jsxs=n,Bo}var gb;function sN(){return gb||(gb=1,Tp.exports=iN()),Tp.exports}var l=sN(),Ap={exports:{}},Qe={};/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var xb;function aN(){if(xb)return Qe;xb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function y(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function k(B,K,M){this.props=B,this.context=K,this.refs=N,this.updater=M||_}k.prototype.isReactComponent={},k.prototype.setState=function(B,K){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,K,"setState")},k.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=k.prototype;function C(B,K,M){this.props=B,this.context=K,this.refs=N,this.updater=M||_}var O=C.prototype=new E;O.constructor=C,j(O,k.prototype),O.isPureReactComponent=!0;var z=Array.isArray;function L(){}var V={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function Q(B,K,M){var pe=M.ref;return{$$typeof:e,type:B,key:K,ref:pe!==void 0?pe:null,props:M}}function D(B,K){return Q(B.type,K,B.props)}function I(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function A(B){var K={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(M){return K[M]})}var se=/\/+/g;function Z(B,K){return typeof B=="object"&&B!==null&&B.key!=null?A(""+B.key):K.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(L,L):(B.status="pending",B.then(function(K){B.status==="pending"&&(B.status="fulfilled",B.value=K)},function(K){B.status==="pending"&&(B.status="rejected",B.reason=K)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function P(B,K,M,pe,_e){var Ce=typeof B;(Ce==="undefined"||Ce==="boolean")&&(B=null);var De=!1;if(B===null)De=!0;else switch(Ce){case"bigint":case"string":case"number":De=!0;break;case"object":switch(B.$$typeof){case e:case t:De=!0;break;case m:return De=B._init,P(De(B._payload),K,M,pe,_e)}}if(De)return _e=_e(B),De=pe===""?"."+Z(B,0):pe,z(_e)?(M="",De!=null&&(M=De.replace(se,"$&/")+"/"),P(_e,K,M,"",function(Je){return Je})):_e!=null&&(I(_e)&&(_e=D(_e,M+(_e.key==null||B&&B.key===_e.key?"":(""+_e.key).replace(se,"$&/")+"/")+De)),K.push(_e)),1;De=0;var Ee=pe===""?".":pe+":";if(z(B))for(var Be=0;Be<B.length;Be++)pe=B[Be],Ce=Ee+Z(pe,Be),De+=P(pe,K,M,Ce,_e);else if(Be=y(B),typeof Be=="function")for(B=Be.call(B),Be=0;!(pe=B.next()).done;)pe=pe.value,Ce=Ee+Z(pe,Be++),De+=P(pe,K,M,Ce,_e);else if(Ce==="object"){if(typeof B.then=="function")return P(G(B),K,M,pe,_e);throw K=String(B),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return De}function $(B,K,M){if(B==null)return B;var pe=[],_e=0;return P(B,pe,"","",function(Ce){return K.call(M,Ce,_e++)}),pe}function ie(B){if(B._status===-1){var K=B._result;K=K(),K.then(function(M){(B._status===0||B._status===-1)&&(B._status=1,B._result=M)},function(M){(B._status===0||B._status===-1)&&(B._status=2,B._result=M)}),B._status===-1&&(B._status=0,B._result=K)}if(B._status===1)return B._result.default;throw B._result}var ae=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},R={map:$,forEach:function(B,K,M){$(B,function(){K.apply(this,arguments)},M)},count:function(B){var K=0;return $(B,function(){K++}),K},toArray:function(B){return $(B,function(K){return K})||[]},only:function(B){if(!I(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Qe.Activity=x,Qe.Children=R,Qe.Component=k,Qe.Fragment=n,Qe.Profiler=a,Qe.PureComponent=C,Qe.StrictMode=i,Qe.Suspense=h,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(B){return V.H.useMemoCache(B)}},Qe.cache=function(B){return function(){return B.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(B,K,M){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var pe=j({},B.props),_e=B.key;if(K!=null)for(Ce in K.key!==void 0&&(_e=""+K.key),K)!F.call(K,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&K.ref===void 0||(pe[Ce]=K[Ce]);var Ce=arguments.length-2;if(Ce===1)pe.children=M;else if(1<Ce){for(var De=Array(Ce),Ee=0;Ee<Ce;Ee++)De[Ee]=arguments[Ee+2];pe.children=De}return Q(B.type,_e,pe)},Qe.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},Qe.createElement=function(B,K,M){var pe,_e={},Ce=null;if(K!=null)for(pe in K.key!==void 0&&(Ce=""+K.key),K)F.call(K,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(_e[pe]=K[pe]);var De=arguments.length-2;if(De===1)_e.children=M;else if(1<De){for(var Ee=Array(De),Be=0;Be<De;Be++)Ee[Be]=arguments[Be+2];_e.children=Ee}if(B&&B.defaultProps)for(pe in De=B.defaultProps,De)_e[pe]===void 0&&(_e[pe]=De[pe]);return Q(B,Ce,_e)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(B){return{$$typeof:f,render:B}},Qe.isValidElement=I,Qe.lazy=function(B){return{$$typeof:m,_payload:{_status:-1,_result:B},_init:ie}},Qe.memo=function(B,K){return{$$typeof:p,type:B,compare:K===void 0?null:K}},Qe.startTransition=function(B){var K=V.T,M={};V.T=M;try{var pe=B(),_e=V.S;_e!==null&&_e(M,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(L,ae)}catch(Ce){ae(Ce)}finally{K!==null&&M.types!==null&&(K.types=M.types),V.T=K}},Qe.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},Qe.use=function(B){return V.H.use(B)},Qe.useActionState=function(B,K,M){return V.H.useActionState(B,K,M)},Qe.useCallback=function(B,K){return V.H.useCallback(B,K)},Qe.useContext=function(B){return V.H.useContext(B)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(B,K){return V.H.useDeferredValue(B,K)},Qe.useEffect=function(B,K){return V.H.useEffect(B,K)},Qe.useEffectEvent=function(B){return V.H.useEffectEvent(B)},Qe.useId=function(){return V.H.useId()},Qe.useImperativeHandle=function(B,K,M){return V.H.useImperativeHandle(B,K,M)},Qe.useInsertionEffect=function(B,K){return V.H.useInsertionEffect(B,K)},Qe.useLayoutEffect=function(B,K){return V.H.useLayoutEffect(B,K)},Qe.useMemo=function(B,K){return V.H.useMemo(B,K)},Qe.useOptimistic=function(B,K){return V.H.useOptimistic(B,K)},Qe.useReducer=function(B,K,M){return V.H.useReducer(B,K,M)},Qe.useRef=function(B){return V.H.useRef(B)},Qe.useState=function(B){return V.H.useState(B)},Qe.useSyncExternalStore=function(B,K,M){return V.H.useSyncExternalStore(B,K,M)},Qe.useTransition=function(){return V.H.useTransition()},Qe.version="19.2.8",Qe}var vb;function Gg(){return vb||(vb=1,Ap.exports=aN()),Ap.exports}var S=Gg();const rd=Vg(S);var Mp={exports:{}},Po={},Rp={exports:{}},Lp={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var bb;function lN(){return bb||(bb=1,(function(e){function t(P,$){var ie=P.length;P.push($);e:for(;0<ie;){var ae=ie-1>>>1,R=P[ae];if(0<a(R,$))P[ae]=$,P[ie]=R,ie=ae;else break e}}function n(P){return P.length===0?null:P[0]}function i(P){if(P.length===0)return null;var $=P[0],ie=P.pop();if(ie!==$){P[0]=ie;e:for(var ae=0,R=P.length,B=R>>>1;ae<B;){var K=2*(ae+1)-1,M=P[K],pe=K+1,_e=P[pe];if(0>a(M,ie))pe<R&&0>a(_e,M)?(P[ae]=_e,P[pe]=ie,ae=pe):(P[ae]=M,P[K]=ie,ae=K);else if(pe<R&&0>a(_e,ie))P[ae]=_e,P[pe]=ie,ae=pe;else break e}}return $}function a(P,$){var ie=P.sortIndex-$.sortIndex;return ie!==0?ie:P.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],m=1,x=null,b=3,y=!1,_=!1,j=!1,N=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function O(P){for(var $=n(p);$!==null;){if($.callback===null)i(p);else if($.startTime<=P)i(p),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(p)}}function z(P){if(j=!1,O(P),!_)if(n(h)!==null)_=!0,L||(L=!0,A());else{var $=n(p);$!==null&&G(z,$.startTime-P)}}var L=!1,V=-1,F=5,Q=-1;function D(){return N?!0:!(e.unstable_now()-Q<F)}function I(){if(N=!1,L){var P=e.unstable_now();Q=P;var $=!0;try{e:{_=!1,j&&(j=!1,E(V),V=-1),y=!0;var ie=b;try{t:{for(O(P),x=n(h);x!==null&&!(x.expirationTime>P&&D());){var ae=x.callback;if(typeof ae=="function"){x.callback=null,b=x.priorityLevel;var R=ae(x.expirationTime<=P);if(P=e.unstable_now(),typeof R=="function"){x.callback=R,O(P),$=!0;break t}x===n(h)&&i(h),O(P)}else i(h);x=n(h)}if(x!==null)$=!0;else{var B=n(p);B!==null&&G(z,B.startTime-P),$=!1}}break e}finally{x=null,b=ie,y=!1}$=void 0}}finally{$?A():L=!1}}}var A;if(typeof C=="function")A=function(){C(I)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,Z=se.port2;se.port1.onmessage=I,A=function(){Z.postMessage(null)}}else A=function(){k(I,0)};function G(P,$){V=k(function(){P(e.unstable_now())},$)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var $=3;break;default:$=b}var ie=b;b=$;try{return P()}finally{b=ie}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(P,$){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var ie=b;b=P;try{return $()}finally{b=ie}},e.unstable_scheduleCallback=function(P,$,ie){var ae=e.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?ae+ie:ae):ie=ae,P){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=ie+R,P={id:m++,callback:$,priorityLevel:P,startTime:ie,expirationTime:R,sortIndex:-1},ie>ae?(P.sortIndex=ie,t(p,P),n(h)===null&&P===n(p)&&(j?(E(V),V=-1):j=!0,G(z,ie-ae))):(P.sortIndex=R,t(h,P),_||y||(_=!0,L||(L=!0,A()))),P},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(P){var $=b;return function(){var ie=b;b=$;try{return P.apply(this,arguments)}finally{b=ie}}}})(Lp)),Lp}var yb;function oN(){return yb||(yb=1,Rp.exports=lN()),Rp.exports}var Dp={exports:{}},An={};/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var _b;function cN(){if(_b)return An;_b=1;var e=Gg();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(h,p,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:h,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return An.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,An.createPortal=function(h,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return o(h,p,null,m)},An.flushSync=function(h){var p=u.T,m=i.p;try{if(u.T=null,i.p=2,h)return h()}finally{u.T=p,i.p=m,i.d.f()}},An.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(h,p))},An.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},An.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var m=p.as,x=f(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?i.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:y}):m==="script"&&i.d.X(h,{crossOrigin:x,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},An.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=f(p.as,p.crossOrigin);i.d.M(h,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(h)},An.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,x=f(m,p.crossOrigin);i.d.L(h,m,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},An.preloadModule=function(h,p){if(typeof h=="string")if(p){var m=f(p.as,p.crossOrigin);i.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(h)},An.requestFormReset=function(h){i.d.r(h)},An.unstable_batchedUpdates=function(h,p){return h(p)},An.useFormState=function(h,p,m){return u.H.useFormState(h,p,m)},An.useFormStatus=function(){return u.H.useHostTransitionStatus()},An.version="19.2.8",An}var wb;function S5(){if(wb)return Dp.exports;wb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Dp.exports=cN(),Dp.exports}/**
|
|
35
|
-
* @license React
|
|
36
|
-
* react-dom-client.production.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var Sb;function uN(){if(Sb)return Po;Sb=1;var e=oN(),t=Gg(),n=S5();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var s=r,c=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(c=s.return),r=s.return;while(r)}return s.tag===3?c:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(o(r)!==r)throw Error(i(188))}function p(r){var s=r.alternate;if(!s){if(s=o(r),s===null)throw Error(i(188));return s!==r?null:r}for(var c=r,d=s;;){var g=c.return;if(g===null)break;var v=g.alternate;if(v===null){if(d=g.return,d!==null){c=d;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===c)return h(g),r;if(v===d)return h(g),s;v=v.sibling}throw Error(i(188))}if(c.return!==d.return)c=g,d=v;else{for(var w=!1,T=g.child;T;){if(T===c){w=!0,c=g,d=v;break}if(T===d){w=!0,d=g,c=v;break}T=T.sibling}if(!w){for(T=v.child;T;){if(T===c){w=!0,c=v,d=g;break}if(T===d){w=!0,d=v,c=g;break}T=T.sibling}if(!w)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:s}function m(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=m(r),s!==null)return s;r=r.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),C=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function A(r){return r===null||typeof r!="object"?null:(r=I&&r[I]||r["@@iterator"],typeof r=="function"?r:null)}var se=Symbol.for("react.client.reference");function Z(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===se?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case k:return"Profiler";case N:return"StrictMode";case z:return"Suspense";case L:return"SuspenseList";case Q:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case C:return r.displayName||"Context";case E:return(r._context.displayName||"Context")+".Consumer";case O:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case V:return s=r.displayName||null,s!==null?s:Z(r.type)||"Memo";case F:s=r._payload,r=r._init;try{return Z(r(s))}catch{}}return null}var G=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],R=-1;function B(r){return{current:r}}function K(r){0>R||(r.current=ae[R],ae[R]=null,R--)}function M(r,s){R++,ae[R]=r.current,r.current=s}var pe=B(null),_e=B(null),Ce=B(null),De=B(null);function Ee(r,s){switch(M(Ce,s),M(_e,r),M(pe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?O1(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=O1(s),r=B1(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}K(pe),M(pe,r)}function Be(){K(pe),K(_e),K(Ce)}function Je(r){r.memoizedState!==null&&M(De,r);var s=pe.current,c=B1(s,r.type);s!==c&&(M(_e,r),M(pe,c))}function jt(r){_e.current===r&&(K(pe),K(_e)),De.current===r&&(K(De),Lo._currentValue=ie)}var dt,gt;function xt(r){if(dt===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);dt=s&&s[1]||"",gt=-1<c.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+dt+r+gt}var _t=!1;function Nt(r,s){if(!r||_t)return"";_t=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(le){var ne=le}Reflect.construct(r,[],de)}else{try{de.call()}catch(le){ne=le}r.call(de.prototype)}}else{try{throw Error()}catch(le){ne=le}(de=r())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(le){if(le&&ne&&typeof le.stack=="string")return[le.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),w=v[0],T=v[1];if(w&&T){var U=w.split(`
|
|
45
|
-
`),ee=T.split(`
|
|
46
|
-
`);for(g=d=0;d<U.length&&!U[d].includes("DetermineComponentFrameRoot");)d++;for(;g<ee.length&&!ee[g].includes("DetermineComponentFrameRoot");)g++;if(d===U.length||g===ee.length)for(d=U.length-1,g=ee.length-1;1<=d&&0<=g&&U[d]!==ee[g];)g--;for(;1<=d&&0<=g;d--,g--)if(U[d]!==ee[g]){if(d!==1||g!==1)do if(d--,g--,0>g||U[d]!==ee[g]){var ce=`
|
|
47
|
-
`+U[d].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=d&&0<=g);break}}}finally{_t=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?xt(c):""}function ve(r,s){switch(r.tag){case 26:case 27:case 5:return xt(r.type);case 16:return xt("Lazy");case 13:return r.child!==s&&s!==null?xt("Suspense Fallback"):xt("Suspense");case 19:return xt("SuspenseList");case 0:case 15:return Nt(r.type,!1);case 11:return Nt(r.type.render,!1);case 1:return Nt(r.type,!0);case 31:return xt("Activity");default:return""}}function $e(r){try{var s="",c=null;do s+=ve(r,c),c=r,r=r.return;while(r);return s}catch(d){return`
|
|
48
|
-
Error generating stack: `+d.message+`
|
|
49
|
-
`+d.stack}}var nt=Object.prototype.hasOwnProperty,nn=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,ze=e.unstable_shouldYield,ht=e.unstable_requestPaint,Te=e.unstable_now,$r=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,W=e.unstable_NormalPriority,me=e.unstable_LowPriority,Re=e.unstable_IdlePriority,We=e.log,rt=e.unstable_setDisableYieldValue,it=null,St=null;function xn(r){if(typeof We=="function"&&rt(r),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(it,r)}catch{}}var et=Math.clz32?Math.clz32:Wr,ir=Math.log,En=Math.LN2;function Wr(r){return r>>>=0,r===0?32:31-(ir(r)/En|0)|0}var Fr=256,Ur=262144,te=4194304;function ge(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function be(r,s,c){var d=r.pendingLanes;if(d===0)return 0;var g=0,v=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var T=d&134217727;return T!==0?(d=T&~v,d!==0?g=ge(d):(w&=T,w!==0?g=ge(w):c||(c=T&~r,c!==0&&(g=ge(c))))):(T=d&~v,T!==0?g=ge(T):w!==0?g=ge(w):c||(c=d&~r,c!==0&&(g=ge(c)))),g===0?0:s!==0&&s!==g&&(s&v)===0&&(v=g&-g,c=s&-s,v>=c||v===32&&(c&4194048)!==0)?s:g}function Xe(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function $t(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function un(){var r=te;return te<<=1,(te&62914560)===0&&(te=4194304),r}function Tn(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function Ft(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function On(r,s,c,d,g,v){var w=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var T=r.entanglements,U=r.expirationTimes,ee=r.hiddenUpdates;for(c=w&~c;0<c;){var ce=31-et(c),de=1<<ce;T[ce]=0,U[ce]=-1;var ne=ee[ce];if(ne!==null)for(ee[ce]=null,ce=0;ce<ne.length;ce++){var le=ne[ce];le!==null&&(le.lane&=-536870913)}c&=~de}d!==0&&yr(r,d,0),v!==0&&g===0&&r.tag!==0&&(r.suspendedLanes|=v&~(w&~s))}function yr(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-et(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function Ea(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var d=31-et(c),g=1<<d;g&s|r[d]&s&&(r[d]|=s),c&=~g}}function Il(r,s){var c=s&-s;return c=(c&42)!==0?1:Bn(c),(c&(r.suspendedLanes|s))!==0?0:c}function Bn(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 zs(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Hl(){var r=$.p;return r!==0?r:(r=window.event,r===void 0?32:ab(r.type))}function ql(r,s){var c=$.p;try{return $.p=r,s()}finally{$.p=c}}var _r=Math.random().toString(36).slice(2),Xt="__reactFiber$"+_r,wn="__reactProps$"+_r,sr="__reactContainer$"+_r,Vl="__reactEvents$"+_r,Tf="__reactListeners$"+_r,Os="__reactHandles$"+_r,Bs="__reactResources$"+_r,Xr="__reactMarker$"+_r;function Yi(r){delete r[Xt],delete r[wn],delete r[Vl],delete r[Tf],delete r[Os]}function pi(r){var s=r[Xt];if(s)return s;for(var c=r.parentNode;c;){if(s=c[sr]||c[Xt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=q1(r);r!==null;){if(c=r[Xt])return c;r=q1(r)}return s}r=c,c=r.parentNode}return null}function qn(r){if(r=r[Xt]||r[sr]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Ps(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Kr(r){var s=r[Bs];return s||(s=r[Bs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function en(r){r[Xr]=!0}var Vn=new Set,Ta={};function Ir(r,s){Zr(r,s),Zr(r+"Capture",s)}function Zr(r,s){for(Ta[r]=s,r=0;r<s.length;r++)Vn.add(s[r])}var Gl=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]*$"),Yl={},tn={};function Af(r){return nt.call(tn,r)?!0:nt.call(Yl,r)?!1:Gl.test(r)?tn[r]=!0:(Yl[r]=!0,!1)}function $s(r,s,c){if(Af(s))if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+c)}}function Aa(r,s,c){if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+c)}}function Hr(r,s,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(s,c,""+d)}}function Gn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Uc(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Ql(r,s,c){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,v=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return g.call(this)},set:function(w){c=""+w,v.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Ma(r){if(!r._valueTracker){var s=Uc(r)?"checked":"value";r._valueTracker=Ql(r,s,""+r[s])}}function Jr(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),d="";return r&&(d=Uc(r)?r.checked?"true":"false":r.value),r=d,r!==c?(s.setValue(r),!0):!1}function Qi(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 wr=/[\n"\\]/g;function ln(r){return r.replace(wr,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Fs(r,s,c,d,g,v,w,T){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Gn(s)):r.value!==""+Gn(s)&&(r.value=""+Gn(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?Ra(r,w,Gn(s)):c!=null?Ra(r,w,Gn(c)):d!=null&&r.removeAttribute("value"),g==null&&v!=null&&(r.defaultChecked=!!v),g!=null&&(r.checked=g&&typeof g!="function"&&typeof g!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?r.name=""+Gn(T):r.removeAttribute("name")}function Ic(r,s,c,d,g,v,w,T){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),s!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){Ma(r);return}c=c!=null?""+Gn(c):"",s=s!=null?""+Gn(s):c,T||s===r.value||(r.value=s),r.defaultValue=s}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=T?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Ma(r)}function Ra(r,s,c){s==="number"&&Qi(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Wi(r,s,c,d){if(r=r.options,s){s={};for(var g=0;g<c.length;g++)s["$"+c[g]]=!0;for(c=0;c<r.length;c++)g=s.hasOwnProperty("$"+r[c].value),r[c].selected!==g&&(r[c].selected=g),g&&d&&(r[c].defaultSelected=!0)}else{for(c=""+Gn(c),s=null,g=0;g<r.length;g++){if(r[g].value===c){r[g].selected=!0,d&&(r[g].defaultSelected=!0);return}s!==null||r[g].disabled||(s=r[g])}s!==null&&(s.selected=!0)}}function La(r,s,c){if(s!=null&&(s=""+Gn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+Gn(c):""}function Wl(r,s,c,d){if(s==null){if(d!=null){if(c!=null)throw Error(i(92));if(G(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),s=c}c=Gn(s),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),Ma(r)}function Xi(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var Mf=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 Hc(r,s,c){var d=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,c):typeof c!="number"||c===0||Mf.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function qc(r,s,c){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var g in s)d=s[g],s.hasOwnProperty(g)&&c[g]!==d&&Hc(r,g,d)}else for(var v in s)s.hasOwnProperty(v)&&Hc(r,v,s[v])}function Da(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 Vc=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"]]),Rf=/^[\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 za(r){return Rf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Sr(){}var Ki=null;function Oa(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Zi=null,Ji=null;function Gc(r){var s=qn(r);if(s&&(r=s.stateNode)){var c=r[wn]||null;e:switch(r=s.stateNode,s.type){case"input":if(Fs(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+ln(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var d=c[s];if(d!==r&&d.form===r.form){var g=d[wn]||null;if(!g)throw Error(i(90));Fs(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(s=0;s<c.length;s++)d=c[s],d.form===r.form&&Jr(d)}break e;case"textarea":La(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Wi(r,!!c.multiple,s,!1)}}}var Xl=!1;function Yc(r,s,c){if(Xl)return r(s,c);Xl=!0;try{var d=r(s);return d}finally{if(Xl=!1,(Zi!==null||Ji!==null)&&(zu(),Zi&&(s=Zi,r=Ji,Ji=Zi=null,Gc(s),r)))for(s=0;s<r.length;s++)Gc(r[s])}}function Us(r,s){var c=r.stateNode;if(c===null)return null;var d=c[wn]||null;if(d===null)return null;c=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(i(231,s,typeof c));return c}var kr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ba=!1;if(kr)try{var es={};Object.defineProperty(es,"passive",{get:function(){Ba=!0}}),window.addEventListener("test",es,es),window.removeEventListener("test",es,es)}catch{Ba=!1}var H=null,he=null,Ke=null;function pt(){if(Ke)return Ke;var r,s=he,c=s.length,d,g="value"in H?H.value:H.textContent,v=g.length;for(r=0;r<c&&s[r]===g[r];r++);var w=c-r;for(d=1;d<=w&&s[c-d]===g[v-d];d++);return Ke=g.slice(r,1<d?1-d:void 0)}function st(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function He(){return!0}function Pn(){return!1}function vn(r){function s(c,d,g,v,w){this._reactName=c,this._targetInst=g,this.type=d,this.nativeEvent=v,this.target=w,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(c=r[T],this[T]=c?c(v):v[T]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?He:Pn,this.isPropagationStopped=Pn,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=He)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=He)},persist:function(){},isPersistent:He}),s}var jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mi=vn(jr),bn=x({},jr,{view:0,detail:0}),Qc=vn(bn),Kl,Zl,Is,Hs=x({},bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Df,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!==Is&&(Is&&r.type==="mousemove"?(Kl=r.screenX-Is.screenX,Zl=r.screenY-Is.screenY):Zl=Kl=0,Is=r),Kl)},movementY:function(r){return"movementY"in r?r.movementY:Zl}}),Lf=vn(Hs),Wc=x({},Hs,{dataTransfer:0}),Xc=vn(Wc),Kc=x({},bn,{relatedTarget:0}),ei=vn(Kc),Zc=x({},jr,{animationName:0,elapsedTime:0,pseudoElement:0}),Jc=vn(Zc),Pa=x({},jr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),sk=vn(Pa),ak=x({},jr,{data:0}),Fx=vn(ak),lk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ok={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"},ck={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uk(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=ck[r])?!!s[r]:!1}function Df(){return uk}var dk=x({},bn,{key:function(r){if(r.key){var s=lk[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=st(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?ok[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Df,charCode:function(r){return r.type==="keypress"?st(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?st(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),fk=vn(dk),hk=x({},Hs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ux=vn(hk),pk=x({},bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Df}),mk=vn(pk),gk=x({},jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),xk=vn(gk),vk=x({},Hs,{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}),bk=vn(vk),yk=x({},jr,{newState:0,oldState:0}),_k=vn(yk),wk=[9,13,27,32],zf=kr&&"CompositionEvent"in window,Jl=null;kr&&"documentMode"in document&&(Jl=document.documentMode);var Sk=kr&&"TextEvent"in window&&!Jl,Ix=kr&&(!zf||Jl&&8<Jl&&11>=Jl),Hx=" ",qx=!1;function Vx(r,s){switch(r){case"keyup":return wk.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var $a=!1;function kk(r,s){switch(r){case"compositionend":return Gx(s);case"keypress":return s.which!==32?null:(qx=!0,Hx);case"textInput":return r=s.data,r===Hx&&qx?null:r;default:return null}}function jk(r,s){if($a)return r==="compositionend"||!zf&&Vx(r,s)?(r=pt(),Ke=he=H=null,$a=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ix&&s.locale!=="ko"?null:s.data;default:return null}}var Nk={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 Yx(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Nk[r.type]:s==="textarea"}function Qx(r,s,c,d){Zi?Ji?Ji.push(d):Ji=[d]:Zi=d,s=Iu(s,"onChange"),0<s.length&&(c=new mi("onChange","change",null,c,d),r.push({event:c,listeners:s}))}var eo=null,to=null;function Ck(r){A1(r,0)}function eu(r){var s=Ps(r);if(Jr(s))return r}function Wx(r,s){if(r==="change")return s}var Xx=!1;if(kr){var Of;if(kr){var Bf="oninput"in document;if(!Bf){var Kx=document.createElement("div");Kx.setAttribute("oninput","return;"),Bf=typeof Kx.oninput=="function"}Of=Bf}else Of=!1;Xx=Of&&(!document.documentMode||9<document.documentMode)}function Zx(){eo&&(eo.detachEvent("onpropertychange",Jx),to=eo=null)}function Jx(r){if(r.propertyName==="value"&&eu(to)){var s=[];Qx(s,to,r,Oa(r)),Yc(Ck,s)}}function Ek(r,s,c){r==="focusin"?(Zx(),eo=s,to=c,eo.attachEvent("onpropertychange",Jx)):r==="focusout"&&Zx()}function Tk(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return eu(to)}function Ak(r,s){if(r==="click")return eu(s)}function Mk(r,s){if(r==="input"||r==="change")return eu(s)}function Rk(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var ar=typeof Object.is=="function"?Object.is:Rk;function no(r,s){if(ar(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var c=Object.keys(r),d=Object.keys(s);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var g=c[d];if(!nt.call(s,g)||!ar(r[g],s[g]))return!1}return!0}function e0(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function t0(r,s){var c=e0(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=s&&d>=s)return{node:c,offset:s-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=e0(c)}}function n0(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?n0(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function r0(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Qi(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=Qi(r.document)}return s}function Pf(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var Lk=kr&&"documentMode"in document&&11>=document.documentMode,Fa=null,$f=null,ro=null,Ff=!1;function i0(r,s,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ff||Fa==null||Fa!==Qi(d)||(d=Fa,"selectionStart"in d&&Pf(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}),ro&&no(ro,d)||(ro=d,d=Iu($f,"onSelect"),0<d.length&&(s=new mi("onSelect","select",null,s,c),r.push({event:s,listeners:d}),s.target=Fa)))}function qs(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var Ua={animationend:qs("Animation","AnimationEnd"),animationiteration:qs("Animation","AnimationIteration"),animationstart:qs("Animation","AnimationStart"),transitionrun:qs("Transition","TransitionRun"),transitionstart:qs("Transition","TransitionStart"),transitioncancel:qs("Transition","TransitionCancel"),transitionend:qs("Transition","TransitionEnd")},Uf={},s0={};kr&&(s0=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function Vs(r){if(Uf[r])return Uf[r];if(!Ua[r])return r;var s=Ua[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in s0)return Uf[r]=s[c];return r}var a0=Vs("animationend"),l0=Vs("animationiteration"),o0=Vs("animationstart"),Dk=Vs("transitionrun"),zk=Vs("transitionstart"),Ok=Vs("transitioncancel"),c0=Vs("transitionend"),u0=new Map,If="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(" ");If.push("scrollEnd");function qr(r,s){u0.set(r,s),Ir(s,[r])}var tu=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Nr=[],Ia=0,Hf=0;function nu(){for(var r=Ia,s=Hf=Ia=0;s<r;){var c=Nr[s];Nr[s++]=null;var d=Nr[s];Nr[s++]=null;var g=Nr[s];Nr[s++]=null;var v=Nr[s];if(Nr[s++]=null,d!==null&&g!==null){var w=d.pending;w===null?g.next=g:(g.next=w.next,w.next=g),d.pending=g}v!==0&&d0(c,g,v)}}function ru(r,s,c,d){Nr[Ia++]=r,Nr[Ia++]=s,Nr[Ia++]=c,Nr[Ia++]=d,Hf|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function qf(r,s,c,d){return ru(r,s,c,d),iu(r)}function Gs(r,s){return ru(r,null,null,s),iu(r)}function d0(r,s,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var g=!1,v=r.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(g=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,g&&s!==null&&(g=31-et(c),r=v.hiddenUpdates,d=r[g],d===null?r[g]=[s]:d.push(s),s.lane=c|536870912),v):null}function iu(r){if(50<No)throw No=0,Jh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Ha={};function Bk(r,s,c,d){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lr(r,s,c,d){return new Bk(r,s,c,d)}function Vf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function gi(r,s){var c=r.alternate;return c===null?(c=lr(r.tag,s,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=s,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,s=r.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function f0(r,s){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,s=c.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function su(r,s,c,d,g,v){var w=0;if(d=r,typeof r=="function")Vf(r)&&(w=1);else if(typeof r=="string")w=Ij(r,c,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Q:return r=lr(31,c,s,g),r.elementType=Q,r.lanes=v,r;case j:return Ys(c.children,g,v,s);case N:w=8,g|=24;break;case k:return r=lr(12,c,s,g|2),r.elementType=k,r.lanes=v,r;case z:return r=lr(13,c,s,g),r.elementType=z,r.lanes=v,r;case L:return r=lr(19,c,s,g),r.elementType=L,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case E:w=9;break e;case O:w=11;break e;case V:w=14;break e;case F:w=16,d=null;break e}w=29,c=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=lr(w,c,s,g),s.elementType=r,s.type=d,s.lanes=v,s}function Ys(r,s,c,d){return r=lr(7,r,d,s),r.lanes=c,r}function Gf(r,s,c){return r=lr(6,r,null,s),r.lanes=c,r}function h0(r){var s=lr(18,null,null,0);return s.stateNode=r,s}function Yf(r,s,c){return s=lr(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var p0=new WeakMap;function Cr(r,s){if(typeof r=="object"&&r!==null){var c=p0.get(r);return c!==void 0?c:(s={value:r,source:s,stack:$e(s)},p0.set(r,s),s)}return{value:r,source:s,stack:$e(s)}}var qa=[],Va=0,au=null,io=0,Er=[],Tr=0,ts=null,ti=1,ni="";function xi(r,s){qa[Va++]=io,qa[Va++]=au,au=r,io=s}function m0(r,s,c){Er[Tr++]=ti,Er[Tr++]=ni,Er[Tr++]=ts,ts=r;var d=ti;r=ni;var g=32-et(d)-1;d&=~(1<<g),c+=1;var v=32-et(s)+g;if(30<v){var w=g-g%5;v=(d&(1<<w)-1).toString(32),d>>=w,g-=w,ti=1<<32-et(s)+g|c<<g|d,ni=v+r}else ti=1<<v|c<<g|d,ni=r}function Qf(r){r.return!==null&&(xi(r,1),m0(r,1,0))}function Wf(r){for(;r===au;)au=qa[--Va],qa[Va]=null,io=qa[--Va],qa[Va]=null;for(;r===ts;)ts=Er[--Tr],Er[Tr]=null,ni=Er[--Tr],Er[Tr]=null,ti=Er[--Tr],Er[Tr]=null}function g0(r,s){Er[Tr++]=ti,Er[Tr++]=ni,Er[Tr++]=ts,ti=s.id,ni=s.overflow,ts=r}var Sn=null,qt=null,ft=!1,ns=null,Ar=!1,Xf=Error(i(519));function rs(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw so(Cr(s,r)),Xf}function x0(r){var s=r.stateNode,c=r.type,d=r.memoizedProps;switch(s[Xt]=r,s[wn]=d,c){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(c=0;c<Eo.length;c++)lt(Eo[c],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":lt("invalid",s),Ic(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",s);break;case"textarea":lt("invalid",s),Wl(s,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||d.suppressHydrationWarning===!0||D1(s.textContent,c)?(d.popover!=null&&(lt("beforetoggle",s),lt("toggle",s)),d.onScroll!=null&<("scroll",s),d.onScrollEnd!=null&<("scrollend",s),d.onClick!=null&&(s.onclick=Sr),s=!0):s=!1,s||rs(r,!0)}function v0(r){for(Sn=r.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:Ar=!1;return;case 27:case 3:Ar=!0;return;default:Sn=Sn.return}}function Ga(r){if(r!==Sn)return!1;if(!ft)return v0(r),ft=!0,!1;var s=r.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||pp(r.type,r.memoizedProps)),c=!c),c&&qt&&rs(r),v0(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));qt=H1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));qt=H1(r)}else s===27?(s=qt,xs(r.type)?(r=bp,bp=null,qt=r):qt=s):qt=Sn?Rr(r.stateNode.nextSibling):null;return!0}function Qs(){qt=Sn=null,ft=!1}function Kf(){var r=ns;return r!==null&&(Xn===null?Xn=r:Xn.push.apply(Xn,r),ns=null),r}function so(r){ns===null?ns=[r]:ns.push(r)}var Zf=B(null),Ws=null,vi=null;function is(r,s,c){M(Zf,s._currentValue),s._currentValue=c}function bi(r){r._currentValue=Zf.current,K(Zf)}function Jf(r,s,c){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===c)break;r=r.return}}function eh(r,s,c,d){var g=r.child;for(g!==null&&(g.return=r);g!==null;){var v=g.dependencies;if(v!==null){var w=g.child;v=v.firstContext;e:for(;v!==null;){var T=v;v=g;for(var U=0;U<s.length;U++)if(T.context===s[U]){v.lanes|=c,T=v.alternate,T!==null&&(T.lanes|=c),Jf(v.return,c,r),d||(w=null);break e}v=T.next}}else if(g.tag===18){if(w=g.return,w===null)throw Error(i(341));w.lanes|=c,v=w.alternate,v!==null&&(v.lanes|=c),Jf(w,c,r),w=null}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===r){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}}function Ya(r,s,c,d){r=null;for(var g=s,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var w=g.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var T=g.type;ar(g.pendingProps.value,w.value)||(r!==null?r.push(T):r=[T])}}else if(g===De.current){if(w=g.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(r!==null?r.push(Lo):r=[Lo])}g=g.return}r!==null&&eh(s,r,c,d),s.flags|=262144}function lu(r){for(r=r.firstContext;r!==null;){if(!ar(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Xs(r){Ws=r,vi=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function kn(r){return b0(Ws,r)}function ou(r,s){return Ws===null&&Xs(r),b0(r,s)}function b0(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},vi===null){if(r===null)throw Error(i(308));vi=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else vi=vi.next=s;return c}var Pk=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(c){return c()})}},$k=e.unstable_scheduleCallback,Fk=e.unstable_NormalPriority,dn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function th(){return{controller:new Pk,data:new Map,refCount:0}}function ao(r){r.refCount--,r.refCount===0&&$k(Fk,function(){r.controller.abort()})}var lo=null,nh=0,Qa=0,Wa=null;function Uk(r,s){if(lo===null){var c=lo=[];nh=0,Qa=sp(),Wa={status:"pending",value:void 0,then:function(d){c.push(d)}}}return nh++,s.then(y0,y0),s}function y0(){if(--nh===0&&lo!==null){Wa!==null&&(Wa.status="fulfilled");var r=lo;lo=null,Qa=0,Wa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Ik(r,s){var c=[],d={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var g=0;g<c.length;g++)(0,c[g])(s)},function(g){for(d.status="rejected",d.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),d}var _0=P.S;P.S=function(r,s){i1=Te(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Uk(r,s),_0!==null&&_0(r,s)};var Ks=B(null);function rh(){var r=Ks.current;return r!==null?r:zt.pooledCache}function cu(r,s){s===null?M(Ks,Ks.current):M(Ks,s.pool)}function w0(){var r=rh();return r===null?null:{parent:dn._currentValue,pool:r}}var Xa=Error(i(460)),ih=Error(i(474)),uu=Error(i(542)),du={then:function(){}};function S0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function k0(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(Sr,Sr),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,N0(r),r;default:if(typeof s.status=="string")s.then(Sr,Sr);else{if(r=zt,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var g=s;g.status="fulfilled",g.value=d}},function(d){if(s.status==="pending"){var g=s;g.status="rejected",g.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,N0(r),r}throw Js=s,Xa}}function Zs(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Js=c,Xa):c}}var Js=null;function j0(){if(Js===null)throw Error(i(459));var r=Js;return Js=null,r}function N0(r){if(r===Xa||r===uu)throw Error(i(483))}var Ka=null,oo=0;function fu(r){var s=oo;return oo+=1,Ka===null&&(Ka=[]),k0(Ka,r,s)}function co(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function hu(r,s){throw s.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function C0(r){function s(X,q){if(r){var J=X.deletions;J===null?(X.deletions=[q],X.flags|=16):J.push(q)}}function c(X,q){if(!r)return null;for(;q!==null;)s(X,q),q=q.sibling;return null}function d(X){for(var q=new Map;X!==null;)X.key!==null?q.set(X.key,X):q.set(X.index,X),X=X.sibling;return q}function g(X,q){return X=gi(X,q),X.index=0,X.sibling=null,X}function v(X,q,J){return X.index=J,r?(J=X.alternate,J!==null?(J=J.index,J<q?(X.flags|=67108866,q):J):(X.flags|=67108866,q)):(X.flags|=1048576,q)}function w(X){return r&&X.alternate===null&&(X.flags|=67108866),X}function T(X,q,J,ue){return q===null||q.tag!==6?(q=Gf(J,X.mode,ue),q.return=X,q):(q=g(q,J),q.return=X,q)}function U(X,q,J,ue){var Pe=J.type;return Pe===j?ce(X,q,J.props.children,ue,J.key):q!==null&&(q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===F&&Zs(Pe)===q.type)?(q=g(q,J.props),co(q,J),q.return=X,q):(q=su(J.type,J.key,J.props,null,X.mode,ue),co(q,J),q.return=X,q)}function ee(X,q,J,ue){return q===null||q.tag!==4||q.stateNode.containerInfo!==J.containerInfo||q.stateNode.implementation!==J.implementation?(q=Yf(J,X.mode,ue),q.return=X,q):(q=g(q,J.children||[]),q.return=X,q)}function ce(X,q,J,ue,Pe){return q===null||q.tag!==7?(q=Ys(J,X.mode,ue,Pe),q.return=X,q):(q=g(q,J),q.return=X,q)}function de(X,q,J){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Gf(""+q,X.mode,J),q.return=X,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case y:return J=su(q.type,q.key,q.props,null,X.mode,J),co(J,q),J.return=X,J;case _:return q=Yf(q,X.mode,J),q.return=X,q;case F:return q=Zs(q),de(X,q,J)}if(G(q)||A(q))return q=Ys(q,X.mode,J,null),q.return=X,q;if(typeof q.then=="function")return de(X,fu(q),J);if(q.$$typeof===C)return de(X,ou(X,q),J);hu(X,q)}return null}function ne(X,q,J,ue){var Pe=q!==null?q.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Pe!==null?null:T(X,q,""+J,ue);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case y:return J.key===Pe?U(X,q,J,ue):null;case _:return J.key===Pe?ee(X,q,J,ue):null;case F:return J=Zs(J),ne(X,q,J,ue)}if(G(J)||A(J))return Pe!==null?null:ce(X,q,J,ue,null);if(typeof J.then=="function")return ne(X,q,fu(J),ue);if(J.$$typeof===C)return ne(X,q,ou(X,J),ue);hu(X,J)}return null}function le(X,q,J,ue,Pe){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return X=X.get(J)||null,T(q,X,""+ue,Pe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return X=X.get(ue.key===null?J:ue.key)||null,U(q,X,ue,Pe);case _:return X=X.get(ue.key===null?J:ue.key)||null,ee(q,X,ue,Pe);case F:return ue=Zs(ue),le(X,q,J,ue,Pe)}if(G(ue)||A(ue))return X=X.get(J)||null,ce(q,X,ue,Pe,null);if(typeof ue.then=="function")return le(X,q,J,fu(ue),Pe);if(ue.$$typeof===C)return le(X,q,J,ou(q,ue),Pe);hu(q,ue)}return null}function Ae(X,q,J,ue){for(var Pe=null,bt=null,Le=q,tt=q=0,ut=null;Le!==null&&tt<J.length;tt++){Le.index>tt?(ut=Le,Le=null):ut=Le.sibling;var yt=ne(X,Le,J[tt],ue);if(yt===null){Le===null&&(Le=ut);break}r&&Le&&yt.alternate===null&&s(X,Le),q=v(yt,q,tt),bt===null?Pe=yt:bt.sibling=yt,bt=yt,Le=ut}if(tt===J.length)return c(X,Le),ft&&xi(X,tt),Pe;if(Le===null){for(;tt<J.length;tt++)Le=de(X,J[tt],ue),Le!==null&&(q=v(Le,q,tt),bt===null?Pe=Le:bt.sibling=Le,bt=Le);return ft&&xi(X,tt),Pe}for(Le=d(Le);tt<J.length;tt++)ut=le(Le,X,tt,J[tt],ue),ut!==null&&(r&&ut.alternate!==null&&Le.delete(ut.key===null?tt:ut.key),q=v(ut,q,tt),bt===null?Pe=ut:bt.sibling=ut,bt=ut);return r&&Le.forEach(function(ws){return s(X,ws)}),ft&&xi(X,tt),Pe}function Ue(X,q,J,ue){if(J==null)throw Error(i(151));for(var Pe=null,bt=null,Le=q,tt=q=0,ut=null,yt=J.next();Le!==null&&!yt.done;tt++,yt=J.next()){Le.index>tt?(ut=Le,Le=null):ut=Le.sibling;var ws=ne(X,Le,yt.value,ue);if(ws===null){Le===null&&(Le=ut);break}r&&Le&&ws.alternate===null&&s(X,Le),q=v(ws,q,tt),bt===null?Pe=ws:bt.sibling=ws,bt=ws,Le=ut}if(yt.done)return c(X,Le),ft&&xi(X,tt),Pe;if(Le===null){for(;!yt.done;tt++,yt=J.next())yt=de(X,yt.value,ue),yt!==null&&(q=v(yt,q,tt),bt===null?Pe=yt:bt.sibling=yt,bt=yt);return ft&&xi(X,tt),Pe}for(Le=d(Le);!yt.done;tt++,yt=J.next())yt=le(Le,X,tt,yt.value,ue),yt!==null&&(r&&yt.alternate!==null&&Le.delete(yt.key===null?tt:yt.key),q=v(yt,q,tt),bt===null?Pe=yt:bt.sibling=yt,bt=yt);return r&&Le.forEach(function(Jj){return s(X,Jj)}),ft&&xi(X,tt),Pe}function Mt(X,q,J,ue){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 y:e:{for(var Pe=J.key;q!==null;){if(q.key===Pe){if(Pe=J.type,Pe===j){if(q.tag===7){c(X,q.sibling),ue=g(q,J.props.children),ue.return=X,X=ue;break e}}else if(q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===F&&Zs(Pe)===q.type){c(X,q.sibling),ue=g(q,J.props),co(ue,J),ue.return=X,X=ue;break e}c(X,q);break}else s(X,q);q=q.sibling}J.type===j?(ue=Ys(J.props.children,X.mode,ue,J.key),ue.return=X,X=ue):(ue=su(J.type,J.key,J.props,null,X.mode,ue),co(ue,J),ue.return=X,X=ue)}return w(X);case _:e:{for(Pe=J.key;q!==null;){if(q.key===Pe)if(q.tag===4&&q.stateNode.containerInfo===J.containerInfo&&q.stateNode.implementation===J.implementation){c(X,q.sibling),ue=g(q,J.children||[]),ue.return=X,X=ue;break e}else{c(X,q);break}else s(X,q);q=q.sibling}ue=Yf(J,X.mode,ue),ue.return=X,X=ue}return w(X);case F:return J=Zs(J),Mt(X,q,J,ue)}if(G(J))return Ae(X,q,J,ue);if(A(J)){if(Pe=A(J),typeof Pe!="function")throw Error(i(150));return J=Pe.call(J),Ue(X,q,J,ue)}if(typeof J.then=="function")return Mt(X,q,fu(J),ue);if(J.$$typeof===C)return Mt(X,q,ou(X,J),ue);hu(X,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,q!==null&&q.tag===6?(c(X,q.sibling),ue=g(q,J),ue.return=X,X=ue):(c(X,q),ue=Gf(J,X.mode,ue),ue.return=X,X=ue),w(X)):c(X,q)}return function(X,q,J,ue){try{oo=0;var Pe=Mt(X,q,J,ue);return Ka=null,Pe}catch(Le){if(Le===Xa||Le===uu)throw Le;var bt=lr(29,Le,null,X.mode);return bt.lanes=ue,bt.return=X,bt}finally{}}}var ea=C0(!0),E0=C0(!1),ss=!1;function sh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ah(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function as(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ls(r,s,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(wt&2)!==0){var g=d.pending;return g===null?s.next=s:(s.next=g.next,g.next=s),d.pending=s,s=iu(r),d0(r,null,c),s}return ru(r,d,s,c),iu(r)}function uo(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,Ea(r,c)}}function lh(r,s){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=w:v=v.next=w,c=c.next}while(c!==null);v===null?g=v=s:v=v.next=s}else g=v=s;c={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var oh=!1;function fo(){if(oh){var r=Wa;if(r!==null)throw r}}function ho(r,s,c,d){oh=!1;var g=r.updateQueue;ss=!1;var v=g.firstBaseUpdate,w=g.lastBaseUpdate,T=g.shared.pending;if(T!==null){g.shared.pending=null;var U=T,ee=U.next;U.next=null,w===null?v=ee:w.next=ee,w=U;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,T=ce.lastBaseUpdate,T!==w&&(T===null?ce.firstBaseUpdate=ee:T.next=ee,ce.lastBaseUpdate=U))}if(v!==null){var de=g.baseState;w=0,ce=ee=U=null,T=v;do{var ne=T.lane&-536870913,le=ne!==T.lane;if(le?(ct&ne)===ne:(d&ne)===ne){ne!==0&&ne===Qa&&(oh=!0),ce!==null&&(ce=ce.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Ae=r,Ue=T;ne=s;var Mt=c;switch(Ue.tag){case 1:if(Ae=Ue.payload,typeof Ae=="function"){de=Ae.call(Mt,de,ne);break e}de=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ue.payload,ne=typeof Ae=="function"?Ae.call(Mt,de,ne):Ae,ne==null)break e;de=x({},de,ne);break e;case 2:ss=!0}}ne=T.callback,ne!==null&&(r.flags|=64,le&&(r.flags|=8192),le=g.callbacks,le===null?g.callbacks=[ne]:le.push(ne))}else le={lane:ne,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ce===null?(ee=ce=le,U=de):ce=ce.next=le,w|=ne;if(T=T.next,T===null){if(T=g.shared.pending,T===null)break;le=T,T=le.next,le.next=null,g.lastBaseUpdate=le,g.shared.pending=null}}while(!0);ce===null&&(U=de),g.baseState=U,g.firstBaseUpdate=ee,g.lastBaseUpdate=ce,v===null&&(g.shared.lanes=0),fs|=w,r.lanes=w,r.memoizedState=de}}function T0(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function A0(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)T0(c[r],s)}var Za=B(null),pu=B(0);function M0(r,s){r=Ei,M(pu,r),M(Za,s),Ei=r|s.baseLanes}function ch(){M(pu,Ei),M(Za,Za.current)}function uh(){Ei=pu.current,K(Za),K(pu)}var or=B(null),Mr=null;function os(r){var s=r.alternate;M(on,on.current&1),M(or,r),Mr===null&&(s===null||Za.current!==null||s.memoizedState!==null)&&(Mr=r)}function dh(r){M(on,on.current),M(or,r),Mr===null&&(Mr=r)}function R0(r){r.tag===22?(M(on,on.current),M(or,r),Mr===null&&(Mr=r)):cs()}function cs(){M(on,on.current),M(or,or.current)}function cr(r){K(or),Mr===r&&(Mr=null),K(on)}var on=B(0);function mu(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||xp(c)||vp(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var yi=0,Ze=null,Tt=null,fn=null,gu=!1,Ja=!1,ta=!1,xu=0,po=0,el=null,Hk=0;function rn(){throw Error(i(321))}function fh(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!ar(r[c],s[c]))return!1;return!0}function hh(r,s,c,d,g,v){return yi=v,Ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,P.H=r===null||r.memoizedState===null?mv:Eh,ta=!1,v=c(d,g),ta=!1,Ja&&(v=D0(s,c,d,g)),L0(r),v}function L0(r){P.H=xo;var s=Tt!==null&&Tt.next!==null;if(yi=0,fn=Tt=Ze=null,gu=!1,po=0,el=null,s)throw Error(i(300));r===null||hn||(r=r.dependencies,r!==null&&lu(r)&&(hn=!0))}function D0(r,s,c,d){Ze=r;var g=0;do{if(Ja&&(el=null),po=0,Ja=!1,25<=g)throw Error(i(301));if(g+=1,fn=Tt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}P.H=gv,v=s(c,d)}while(Ja);return v}function qk(){var r=P.H,s=r.useState()[0];return s=typeof s.then=="function"?mo(s):s,r=r.useState()[0],(Tt!==null?Tt.memoizedState:null)!==r&&(Ze.flags|=1024),s}function ph(){var r=xu!==0;return xu=0,r}function mh(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function gh(r){if(gu){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}gu=!1}yi=0,fn=Tt=Ze=null,Ja=!1,po=xu=0,el=null}function $n(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?Ze.memoizedState=fn=r:fn=fn.next=r,fn}function cn(){if(Tt===null){var r=Ze.alternate;r=r!==null?r.memoizedState:null}else r=Tt.next;var s=fn===null?Ze.memoizedState:fn.next;if(s!==null)fn=s,Tt=r;else{if(r===null)throw Ze.alternate===null?Error(i(467)):Error(i(310));Tt=r,r={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},fn===null?Ze.memoizedState=fn=r:fn=fn.next=r}return fn}function vu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function mo(r){var s=po;return po+=1,el===null&&(el=[]),r=k0(el,r,s),s=Ze,(fn===null?s.memoizedState:fn.next)===null&&(s=s.alternate,P.H=s===null||s.memoizedState===null?mv:Eh),r}function bu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return mo(r);if(r.$$typeof===C)return kn(r)}throw Error(i(438,String(r)))}function xh(r){var s=null,c=Ze.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var d=Ze.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(g){return g.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=vu(),Ze.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(r),d=0;d<r;d++)c[d]=D;return s.index++,c}function _i(r,s){return typeof s=="function"?s(r):s}function yu(r){var s=cn();return vh(s,Tt,r)}function vh(r,s,c){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var g=r.baseQueue,v=d.pending;if(v!==null){if(g!==null){var w=g.next;g.next=v.next,v.next=w}s.baseQueue=g=v,d.pending=null}if(v=r.baseState,g===null)r.memoizedState=v;else{s=g.next;var T=w=null,U=null,ee=s,ce=!1;do{var de=ee.lane&-536870913;if(de!==ee.lane?(ct&de)===de:(yi&de)===de){var ne=ee.revertLane;if(ne===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),de===Qa&&(ce=!0);else if((yi&ne)===ne){ee=ee.next,ne===Qa&&(ce=!0);continue}else de={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},U===null?(T=U=de,w=v):U=U.next=de,Ze.lanes|=ne,fs|=ne;de=ee.action,ta&&c(v,de),v=ee.hasEagerState?ee.eagerState:c(v,de)}else ne={lane:de,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},U===null?(T=U=ne,w=v):U=U.next=ne,Ze.lanes|=de,fs|=de;ee=ee.next}while(ee!==null&&ee!==s);if(U===null?w=v:U.next=T,!ar(v,r.memoizedState)&&(hn=!0,ce&&(c=Wa,c!==null)))throw c;r.memoizedState=v,r.baseState=w,r.baseQueue=U,d.lastRenderedState=v}return g===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function bh(r){var s=cn(),c=s.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var d=c.dispatch,g=c.pending,v=s.memoizedState;if(g!==null){c.pending=null;var w=g=g.next;do v=r(v,w.action),w=w.next;while(w!==g);ar(v,s.memoizedState)||(hn=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),c.lastRenderedState=v}return[v,d]}function z0(r,s,c){var d=Ze,g=cn(),v=ft;if(v){if(c===void 0)throw Error(i(407));c=c()}else c=s();var w=!ar((Tt||g).memoizedState,c);if(w&&(g.memoizedState=c,hn=!0),g=g.queue,wh(P0.bind(null,d,g,r),[r]),g.getSnapshot!==s||w||fn!==null&&fn.memoizedState.tag&1){if(d.flags|=2048,tl(9,{destroy:void 0},B0.bind(null,d,g,c,s),null),zt===null)throw Error(i(349));v||(yi&127)!==0||O0(d,s,c)}return c}function O0(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=Ze.updateQueue,s===null?(s=vu(),Ze.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function B0(r,s,c,d){s.value=c,s.getSnapshot=d,$0(s)&&F0(r)}function P0(r,s,c){return c(function(){$0(s)&&F0(r)})}function $0(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!ar(r,c)}catch{return!0}}function F0(r){var s=Gs(r,2);s!==null&&Kn(s,r,2)}function yh(r){var s=$n();if(typeof r=="function"){var c=r;if(r=c(),ta){xn(!0);try{c()}finally{xn(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_i,lastRenderedState:r},s}function U0(r,s,c,d){return r.baseState=c,vh(r,Tt,typeof d=="function"?d:_i)}function Vk(r,s,c,d,g){if(Su(r))throw Error(i(485));if(r=s.action,r!==null){var v={payload:g,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){v.listeners.push(w)}};P.T!==null?c(!0):v.isTransition=!1,d(v),c=s.pending,c===null?(v.next=s.pending=v,I0(s,v)):(v.next=c.next,s.pending=c.next=v)}}function I0(r,s){var c=s.action,d=s.payload,g=r.state;if(s.isTransition){var v=P.T,w={};P.T=w;try{var T=c(g,d),U=P.S;U!==null&&U(w,T),H0(r,s,T)}catch(ee){_h(r,s,ee)}finally{v!==null&&w.types!==null&&(v.types=w.types),P.T=v}}else try{v=c(g,d),H0(r,s,v)}catch(ee){_h(r,s,ee)}}function H0(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){q0(r,s,d)},function(d){return _h(r,s,d)}):q0(r,s,c)}function q0(r,s,c){s.status="fulfilled",s.value=c,V0(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,I0(r,c)))}function _h(r,s,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=c,V0(s),s=s.next;while(s!==d)}r.action=null}function V0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function G0(r,s){return s}function Y0(r,s){if(ft){var c=zt.formState;if(c!==null){e:{var d=Ze;if(ft){if(qt){t:{for(var g=qt,v=Ar;g.nodeType!==8;){if(!v){g=null;break t}if(g=Rr(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){qt=Rr(g.nextSibling),d=g.data==="F!";break e}}rs(d)}d=!1}d&&(s=c[0])}}return c=$n(),c.memoizedState=c.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:G0,lastRenderedState:s},c.queue=d,c=fv.bind(null,Ze,d),d.dispatch=c,d=yh(!1),v=Ch.bind(null,Ze,!1,d.queue),d=$n(),g={state:s,dispatch:null,action:r,pending:null},d.queue=g,c=Vk.bind(null,Ze,g,v,c),g.dispatch=c,d.memoizedState=r,[s,c,!1]}function Q0(r){var s=cn();return W0(s,Tt,r)}function W0(r,s,c){if(s=vh(r,s,G0)[0],r=yu(_i)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=mo(s)}catch(w){throw w===Xa?uu:w}else d=s;s=cn();var g=s.queue,v=g.dispatch;return c!==s.memoizedState&&(Ze.flags|=2048,tl(9,{destroy:void 0},Gk.bind(null,g,c),null)),[d,v,r]}function Gk(r,s){r.action=s}function X0(r){var s=cn(),c=Tt;if(c!==null)return W0(s,c,r);cn(),s=s.memoizedState,c=cn();var d=c.queue.dispatch;return c.memoizedState=r,[s,d,!1]}function tl(r,s,c,d){return r={tag:r,create:c,deps:d,inst:s,next:null},s=Ze.updateQueue,s===null&&(s=vu(),Ze.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,s.lastEffect=r),r}function K0(){return cn().memoizedState}function _u(r,s,c,d){var g=$n();Ze.flags|=r,g.memoizedState=tl(1|s,{destroy:void 0},c,d===void 0?null:d)}function wu(r,s,c,d){var g=cn();d=d===void 0?null:d;var v=g.memoizedState.inst;Tt!==null&&d!==null&&fh(d,Tt.memoizedState.deps)?g.memoizedState=tl(s,v,c,d):(Ze.flags|=r,g.memoizedState=tl(1|s,v,c,d))}function Z0(r,s){_u(8390656,8,r,s)}function wh(r,s){wu(2048,8,r,s)}function Yk(r){Ze.flags|=4;var s=Ze.updateQueue;if(s===null)s=vu(),Ze.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function J0(r){var s=cn().memoizedState;return Yk({ref:s,nextImpl:r}),function(){if((wt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function ev(r,s){return wu(4,2,r,s)}function tv(r,s){return wu(4,4,r,s)}function nv(r,s){if(typeof s=="function"){r=r();var c=s(r);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function rv(r,s,c){c=c!=null?c.concat([r]):null,wu(4,4,nv.bind(null,s,r),c)}function Sh(){}function iv(r,s){var c=cn();s=s===void 0?null:s;var d=c.memoizedState;return s!==null&&fh(s,d[1])?d[0]:(c.memoizedState=[r,s],r)}function sv(r,s){var c=cn();s=s===void 0?null:s;var d=c.memoizedState;if(s!==null&&fh(s,d[1]))return d[0];if(d=r(),ta){xn(!0);try{r()}finally{xn(!1)}}return c.memoizedState=[d,s],d}function kh(r,s,c){return c===void 0||(yi&1073741824)!==0&&(ct&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=a1(),Ze.lanes|=r,fs|=r,c)}function av(r,s,c,d){return ar(c,s)?c:Za.current!==null?(r=kh(r,c,d),ar(r,s)||(hn=!0),r):(yi&42)===0||(yi&1073741824)!==0&&(ct&261930)===0?(hn=!0,r.memoizedState=c):(r=a1(),Ze.lanes|=r,fs|=r,s)}function lv(r,s,c,d,g){var v=$.p;$.p=v!==0&&8>v?v:8;var w=P.T,T={};P.T=T,Ch(r,!1,s,c);try{var U=g(),ee=P.S;if(ee!==null&&ee(T,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ce=Ik(U,d);go(r,s,ce,fr(r))}else go(r,s,d,fr(r))}catch(de){go(r,s,{then:function(){},status:"rejected",reason:de},fr())}finally{$.p=v,w!==null&&T.types!==null&&(w.types=T.types),P.T=w}}function Qk(){}function jh(r,s,c,d){if(r.tag!==5)throw Error(i(476));var g=ov(r).queue;lv(r,g,s,ie,c===null?Qk:function(){return cv(r),c(d)})}function ov(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_i,lastRenderedState:ie},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_i,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function cv(r){var s=ov(r);s.next===null&&(s=r.alternate.memoizedState),go(r,s.next.queue,{},fr())}function Nh(){return kn(Lo)}function uv(){return cn().memoizedState}function dv(){return cn().memoizedState}function Wk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=fr();r=as(c);var d=ls(s,r,c);d!==null&&(Kn(d,s,c),uo(d,s,c)),s={cache:th()},r.payload=s;return}s=s.return}}function Xk(r,s,c){var d=fr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Su(r)?hv(s,c):(c=qf(r,s,c,d),c!==null&&(Kn(c,r,d),pv(c,s,d)))}function fv(r,s,c){var d=fr();go(r,s,c,d)}function go(r,s,c,d){var g={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Su(r))hv(s,g);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var w=s.lastRenderedState,T=v(w,c);if(g.hasEagerState=!0,g.eagerState=T,ar(T,w))return ru(r,s,g,0),zt===null&&nu(),!1}catch{}finally{}if(c=qf(r,s,g,d),c!==null)return Kn(c,r,d),pv(c,s,d),!0}return!1}function Ch(r,s,c,d){if(d={lane:2,revertLane:sp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Su(r)){if(s)throw Error(i(479))}else s=qf(r,c,d,2),s!==null&&Kn(s,r,2)}function Su(r){var s=r.alternate;return r===Ze||s!==null&&s===Ze}function hv(r,s){Ja=gu=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function pv(r,s,c){if((c&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,Ea(r,c)}}var xo={readContext:kn,use:bu,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useLayoutEffect:rn,useInsertionEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useSyncExternalStore:rn,useId:rn,useHostTransitionStatus:rn,useFormState:rn,useActionState:rn,useOptimistic:rn,useMemoCache:rn,useCacheRefresh:rn};xo.useEffectEvent=rn;var mv={readContext:kn,use:bu,useCallback:function(r,s){return $n().memoizedState=[r,s===void 0?null:s],r},useContext:kn,useEffect:Z0,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,_u(4194308,4,nv.bind(null,s,r),c)},useLayoutEffect:function(r,s){return _u(4194308,4,r,s)},useInsertionEffect:function(r,s){_u(4,2,r,s)},useMemo:function(r,s){var c=$n();s=s===void 0?null:s;var d=r();if(ta){xn(!0);try{r()}finally{xn(!1)}}return c.memoizedState=[d,s],d},useReducer:function(r,s,c){var d=$n();if(c!==void 0){var g=c(s);if(ta){xn(!0);try{c(s)}finally{xn(!1)}}}else g=s;return d.memoizedState=d.baseState=g,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:g},d.queue=r,r=r.dispatch=Xk.bind(null,Ze,r),[d.memoizedState,r]},useRef:function(r){var s=$n();return r={current:r},s.memoizedState=r},useState:function(r){r=yh(r);var s=r.queue,c=fv.bind(null,Ze,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:Sh,useDeferredValue:function(r,s){var c=$n();return kh(c,r,s)},useTransition:function(){var r=yh(!1);return r=lv.bind(null,Ze,r.queue,!0,!1),$n().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var d=Ze,g=$n();if(ft){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),zt===null)throw Error(i(349));(ct&127)!==0||O0(d,s,c)}g.memoizedState=c;var v={value:c,getSnapshot:s};return g.queue=v,Z0(P0.bind(null,d,v,r),[r]),d.flags|=2048,tl(9,{destroy:void 0},B0.bind(null,d,v,c,s),null),c},useId:function(){var r=$n(),s=zt.identifierPrefix;if(ft){var c=ni,d=ti;c=(d&~(1<<32-et(d)-1)).toString(32)+c,s="_"+s+"R_"+c,c=xu++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=Hk++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:Nh,useFormState:Y0,useActionState:Y0,useOptimistic:function(r){var s=$n();s.memoizedState=s.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=Ch.bind(null,Ze,!0,c),c.dispatch=s,[r,s]},useMemoCache:xh,useCacheRefresh:function(){return $n().memoizedState=Wk.bind(null,Ze)},useEffectEvent:function(r){var s=$n(),c={impl:r};return s.memoizedState=c,function(){if((wt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},Eh={readContext:kn,use:bu,useCallback:iv,useContext:kn,useEffect:wh,useImperativeHandle:rv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:sv,useReducer:yu,useRef:K0,useState:function(){return yu(_i)},useDebugValue:Sh,useDeferredValue:function(r,s){var c=cn();return av(c,Tt.memoizedState,r,s)},useTransition:function(){var r=yu(_i)[0],s=cn().memoizedState;return[typeof r=="boolean"?r:mo(r),s]},useSyncExternalStore:z0,useId:uv,useHostTransitionStatus:Nh,useFormState:Q0,useActionState:Q0,useOptimistic:function(r,s){var c=cn();return U0(c,Tt,r,s)},useMemoCache:xh,useCacheRefresh:dv};Eh.useEffectEvent=J0;var gv={readContext:kn,use:bu,useCallback:iv,useContext:kn,useEffect:wh,useImperativeHandle:rv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:sv,useReducer:bh,useRef:K0,useState:function(){return bh(_i)},useDebugValue:Sh,useDeferredValue:function(r,s){var c=cn();return Tt===null?kh(c,r,s):av(c,Tt.memoizedState,r,s)},useTransition:function(){var r=bh(_i)[0],s=cn().memoizedState;return[typeof r=="boolean"?r:mo(r),s]},useSyncExternalStore:z0,useId:uv,useHostTransitionStatus:Nh,useFormState:X0,useActionState:X0,useOptimistic:function(r,s){var c=cn();return Tt!==null?U0(c,Tt,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:xh,useCacheRefresh:dv};gv.useEffectEvent=J0;function Th(r,s,c,d){s=r.memoizedState,c=c(d,s),c=c==null?s:x({},s,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Ah={enqueueSetState:function(r,s,c){r=r._reactInternals;var d=fr(),g=as(d);g.payload=s,c!=null&&(g.callback=c),s=ls(r,g,d),s!==null&&(Kn(s,r,d),uo(s,r,d))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var d=fr(),g=as(d);g.tag=1,g.payload=s,c!=null&&(g.callback=c),s=ls(r,g,d),s!==null&&(Kn(s,r,d),uo(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=fr(),d=as(c);d.tag=2,s!=null&&(d.callback=s),s=ls(r,d,c),s!==null&&(Kn(s,r,c),uo(s,r,c))}};function xv(r,s,c,d,g,v,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,w):s.prototype&&s.prototype.isPureReactComponent?!no(c,d)||!no(g,v):!0}function vv(r,s,c,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,d),s.state!==r&&Ah.enqueueReplaceState(s,s.state,null)}function na(r,s){var c=s;if("ref"in s){c={};for(var d in s)d!=="ref"&&(c[d]=s[d])}if(r=r.defaultProps){c===s&&(c=x({},c));for(var g in r)c[g]===void 0&&(c[g]=r[g])}return c}function bv(r){tu(r)}function yv(r){console.error(r)}function _v(r){tu(r)}function ku(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function wv(r,s,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Mh(r,s,c){return c=as(c),c.tag=3,c.payload={element:null},c.callback=function(){ku(r,s)},c}function Sv(r){return r=as(r),r.tag=3,r}function kv(r,s,c,d){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=d.value;r.payload=function(){return g(v)},r.callback=function(){wv(s,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){wv(s,c,d),typeof g!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function Kk(r,s,c,d,g){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=c.alternate,s!==null&&Ya(s,c,g,!0),c=or.current,c!==null){switch(c.tag){case 31:case 13:return Mr===null?Ou():c.alternate===null&&sn===0&&(sn=3),c.flags&=-257,c.flags|=65536,c.lanes=g,d===du?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([d]):s.add(d),np(r,d,g)),!1;case 22:return c.flags|=65536,d===du?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([d]):c.add(d)),np(r,d,g)),!1}throw Error(i(435,c.tag))}return np(r,d,g),Ou(),!1}if(ft)return s=or.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=g,d!==Xf&&(r=Error(i(422),{cause:d}),so(Cr(r,c)))):(d!==Xf&&(s=Error(i(423),{cause:d}),so(Cr(s,c))),r=r.current.alternate,r.flags|=65536,g&=-g,r.lanes|=g,d=Cr(d,c),g=Mh(r.stateNode,d,g),lh(r,g),sn!==4&&(sn=2)),!1;var v=Error(i(520),{cause:d});if(v=Cr(v,c),jo===null?jo=[v]:jo.push(v),sn!==4&&(sn=2),s===null)return!0;d=Cr(d,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=g&-g,c.lanes|=r,r=Mh(c.stateNode,d,r),lh(c,r),!1;case 1:if(s=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(hs===null||!hs.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=Sv(g),kv(g,r,c,d),lh(c,g),!1}c=c.return}while(c!==null);return!1}var Rh=Error(i(461)),hn=!1;function jn(r,s,c,d){s.child=r===null?E0(s,null,c,d):ea(s,r.child,c,d)}function jv(r,s,c,d,g){c=c.render;var v=s.ref;if("ref"in d){var w={};for(var T in d)T!=="ref"&&(w[T]=d[T])}else w=d;return Xs(s),d=hh(r,s,c,w,v,g),T=ph(),r!==null&&!hn?(mh(r,s,g),wi(r,s,g)):(ft&&T&&Qf(s),s.flags|=1,jn(r,s,d,g),s.child)}function Nv(r,s,c,d,g){if(r===null){var v=c.type;return typeof v=="function"&&!Vf(v)&&v.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=v,Cv(r,s,v,d,g)):(r=su(c.type,null,d,s,s.mode,g),r.ref=s.ref,r.return=s,s.child=r)}if(v=r.child,!Fh(r,g)){var w=v.memoizedProps;if(c=c.compare,c=c!==null?c:no,c(w,d)&&r.ref===s.ref)return wi(r,s,g)}return s.flags|=1,r=gi(v,d),r.ref=s.ref,r.return=s,s.child=r}function Cv(r,s,c,d,g){if(r!==null){var v=r.memoizedProps;if(no(v,d)&&r.ref===s.ref)if(hn=!1,s.pendingProps=d=v,Fh(r,g))(r.flags&131072)!==0&&(hn=!0);else return s.lanes=r.lanes,wi(r,s,g)}return Lh(r,s,c,d,g)}function Ev(r,s,c,d){var g=d.children,v=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,r!==null){for(d=s.child=r.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~v}else d=0,s.child=null;return Tv(r,s,v,c,d)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&cu(s,v!==null?v.cachePool:null),v!==null?M0(s,v):ch(),R0(s);else return d=s.lanes=536870912,Tv(r,s,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(cu(s,v.cachePool),M0(s,v),cs(),s.memoizedState=null):(r!==null&&cu(s,null),ch(),cs());return jn(r,s,g,c),s.child}function vo(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Tv(r,s,c,d,g){var v=rh();return v=v===null?null:{parent:dn._currentValue,pool:v},s.memoizedState={baseLanes:c,cachePool:v},r!==null&&cu(s,null),ch(),R0(s),r!==null&&Ya(r,s,d,!0),s.childLanes=g,null}function ju(r,s){return s=Cu({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function Av(r,s,c){return ea(s,r.child,null,c),r=ju(s,s.pendingProps),r.flags|=2,cr(s),s.memoizedState=null,r}function Zk(r,s,c){var d=s.pendingProps,g=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ft){if(d.mode==="hidden")return r=ju(s,d),s.lanes=536870912,vo(null,r);if(dh(s),(r=qt)?(r=I1(r,Ar),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ts!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},c=h0(r),c.return=s,s.child=c,Sn=s,qt=null)):r=null,r===null)throw rs(s);return s.lanes=536870912,null}return ju(s,d)}var v=r.memoizedState;if(v!==null){var w=v.dehydrated;if(dh(s),g)if(s.flags&256)s.flags&=-257,s=Av(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(hn||Ya(r,s,c,!1),g=(c&r.childLanes)!==0,hn||g){if(d=zt,d!==null&&(w=Il(d,c),w!==0&&w!==v.retryLane))throw v.retryLane=w,Gs(r,w),Kn(d,r,w),Rh;Ou(),s=Av(r,s,c)}else r=v.treeContext,qt=Rr(w.nextSibling),Sn=s,ft=!0,ns=null,Ar=!1,r!==null&&g0(s,r),s=ju(s,d),s.flags|=4096;return s}return r=gi(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function Nu(r,s){var c=s.ref;if(c===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(s.flags|=4194816)}}function Lh(r,s,c,d,g){return Xs(s),c=hh(r,s,c,d,void 0,g),d=ph(),r!==null&&!hn?(mh(r,s,g),wi(r,s,g)):(ft&&d&&Qf(s),s.flags|=1,jn(r,s,c,g),s.child)}function Mv(r,s,c,d,g,v){return Xs(s),s.updateQueue=null,c=D0(s,d,c,g),L0(r),d=ph(),r!==null&&!hn?(mh(r,s,v),wi(r,s,v)):(ft&&d&&Qf(s),s.flags|=1,jn(r,s,c,v),s.child)}function Rv(r,s,c,d,g){if(Xs(s),s.stateNode===null){var v=Ha,w=c.contextType;typeof w=="object"&&w!==null&&(v=kn(w)),v=new c(d,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Ah,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=d,v.state=s.memoizedState,v.refs={},sh(s),w=c.contextType,v.context=typeof w=="object"&&w!==null?kn(w):Ha,v.state=s.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(Th(s,c,w,d),v.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(w=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),w!==v.state&&Ah.enqueueReplaceState(v,v.state,null),ho(s,d,v,g),fo(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){v=s.stateNode;var T=s.memoizedProps,U=na(c,T);v.props=U;var ee=v.context,ce=c.contextType;w=Ha,typeof ce=="object"&&ce!==null&&(w=kn(ce));var de=c.getDerivedStateFromProps;ce=typeof de=="function"||typeof v.getSnapshotBeforeUpdate=="function",T=s.pendingProps!==T,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T||ee!==w)&&vv(s,v,d,w),ss=!1;var ne=s.memoizedState;v.state=ne,ho(s,d,v,g),fo(),ee=s.memoizedState,T||ne!==ee||ss?(typeof de=="function"&&(Th(s,c,de,d),ee=s.memoizedState),(U=ss||xv(s,c,U,d,ne,ee,w))?(ce||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=ee),v.props=d,v.state=ee,v.context=w,d=U):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{v=s.stateNode,ah(r,s),w=s.memoizedProps,ce=na(c,w),v.props=ce,de=s.pendingProps,ne=v.context,ee=c.contextType,U=Ha,typeof ee=="object"&&ee!==null&&(U=kn(ee)),T=c.getDerivedStateFromProps,(ee=typeof T=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(w!==de||ne!==U)&&vv(s,v,d,U),ss=!1,ne=s.memoizedState,v.state=ne,ho(s,d,v,g),fo();var le=s.memoizedState;w!==de||ne!==le||ss||r!==null&&r.dependencies!==null&&lu(r.dependencies)?(typeof T=="function"&&(Th(s,c,T,d),le=s.memoizedState),(ce=ss||xv(s,c,ce,d,ne,le,U)||r!==null&&r.dependencies!==null&&lu(r.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,U)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=le),v.props=d,v.state=le,v.context=U,d=ce):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=1024),d=!1)}return v=d,Nu(r,s),d=(s.flags&128)!==0,v||d?(v=s.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,r!==null&&d?(s.child=ea(s,r.child,null,g),s.child=ea(s,null,c,g)):jn(r,s,c,g),s.memoizedState=v.state,r=s.child):r=wi(r,s,g),r}function Lv(r,s,c,d){return Qs(),s.flags|=256,jn(r,s,c,d),s.child}var Dh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zh(r){return{baseLanes:r,cachePool:w0()}}function Oh(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=dr),r}function Dv(r,s,c){var d=s.pendingProps,g=!1,v=(s.flags&128)!==0,w;if((w=v)||(w=r!==null&&r.memoizedState===null?!1:(on.current&2)!==0),w&&(g=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ft){if(g?os(s):cs(),(r=qt)?(r=I1(r,Ar),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:ts!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},c=h0(r),c.return=s,s.child=c,Sn=s,qt=null)):r=null,r===null)throw rs(s);return vp(r)?s.lanes=32:s.lanes=536870912,null}var T=d.children;return d=d.fallback,g?(cs(),g=s.mode,T=Cu({mode:"hidden",children:T},g),d=Ys(d,g,c,null),T.return=s,d.return=s,T.sibling=d,s.child=T,d=s.child,d.memoizedState=zh(c),d.childLanes=Oh(r,w,c),s.memoizedState=Dh,vo(null,d)):(os(s),Bh(s,T))}var U=r.memoizedState;if(U!==null&&(T=U.dehydrated,T!==null)){if(v)s.flags&256?(os(s),s.flags&=-257,s=Ph(r,s,c)):s.memoizedState!==null?(cs(),s.child=r.child,s.flags|=128,s=null):(cs(),T=d.fallback,g=s.mode,d=Cu({mode:"visible",children:d.children},g),T=Ys(T,g,c,null),T.flags|=2,d.return=s,T.return=s,d.sibling=T,s.child=d,ea(s,r.child,null,c),d=s.child,d.memoizedState=zh(c),d.childLanes=Oh(r,w,c),s.memoizedState=Dh,s=vo(null,d));else if(os(s),vp(T)){if(w=T.nextSibling&&T.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(i(419)),d.stack="",d.digest=w,so({value:d,source:null,stack:null}),s=Ph(r,s,c)}else if(hn||Ya(r,s,c,!1),w=(c&r.childLanes)!==0,hn||w){if(w=zt,w!==null&&(d=Il(w,c),d!==0&&d!==U.retryLane))throw U.retryLane=d,Gs(r,d),Kn(w,r,d),Rh;xp(T)||Ou(),s=Ph(r,s,c)}else xp(T)?(s.flags|=192,s.child=r.child,s=null):(r=U.treeContext,qt=Rr(T.nextSibling),Sn=s,ft=!0,ns=null,Ar=!1,r!==null&&g0(s,r),s=Bh(s,d.children),s.flags|=4096);return s}return g?(cs(),T=d.fallback,g=s.mode,U=r.child,ee=U.sibling,d=gi(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,ee!==null?T=gi(ee,T):(T=Ys(T,g,c,null),T.flags|=2),T.return=s,d.return=s,d.sibling=T,s.child=d,vo(null,d),d=s.child,T=r.child.memoizedState,T===null?T=zh(c):(g=T.cachePool,g!==null?(U=dn._currentValue,g=g.parent!==U?{parent:U,pool:U}:g):g=w0(),T={baseLanes:T.baseLanes|c,cachePool:g}),d.memoizedState=T,d.childLanes=Oh(r,w,c),s.memoizedState=Dh,vo(r.child,d)):(os(s),c=r.child,r=c.sibling,c=gi(c,{mode:"visible",children:d.children}),c.return=s,c.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=c,s.memoizedState=null,c)}function Bh(r,s){return s=Cu({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function Cu(r,s){return r=lr(22,r,null,s),r.lanes=0,r}function Ph(r,s,c){return ea(s,r.child,null,c),r=Bh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function zv(r,s,c){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),Jf(r.return,s,c)}function $h(r,s,c,d,g,v){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:g,treeForkCount:v}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=g,w.treeForkCount=v)}function Ov(r,s,c){var d=s.pendingProps,g=d.revealOrder,v=d.tail;d=d.children;var w=on.current,T=(w&2)!==0;if(T?(w=w&1|2,s.flags|=128):w&=1,M(on,w),jn(r,s,d,c),d=ft?io:0,!T&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&zv(r,c,s);else if(r.tag===19)zv(r,c,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(g){case"forwards":for(c=s.child,g=null;c!==null;)r=c.alternate,r!==null&&mu(r)===null&&(g=c),c=c.sibling;c=g,c===null?(g=s.child,s.child=null):(g=c.sibling,c.sibling=null),$h(s,!1,g,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=s.child,s.child=null;g!==null;){if(r=g.alternate,r!==null&&mu(r)===null){s.child=g;break}r=g.sibling,g.sibling=c,c=g,g=r}$h(s,!0,c,null,v,d);break;case"together":$h(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function wi(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),fs|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(Ya(r,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,c=gi(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=gi(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function Fh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&lu(r)))}function Jk(r,s,c){switch(s.tag){case 3:Ee(s,s.stateNode.containerInfo),is(s,dn,r.memoizedState.cache),Qs();break;case 27:case 5:Je(s);break;case 4:Ee(s,s.stateNode.containerInfo);break;case 10:is(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,dh(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(os(s),s.flags|=128,null):(c&s.child.childLanes)!==0?Dv(r,s,c):(os(s),r=wi(r,s,c),r!==null?r.sibling:null);os(s);break;case 19:var g=(r.flags&128)!==0;if(d=(c&s.childLanes)!==0,d||(Ya(r,s,c,!1),d=(c&s.childLanes)!==0),g){if(d)return Ov(r,s,c);s.flags|=128}if(g=s.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),M(on,on.current),d)break;return null;case 22:return s.lanes=0,Ev(r,s,c,s.pendingProps);case 24:is(s,dn,r.memoizedState.cache)}return wi(r,s,c)}function Bv(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)hn=!0;else{if(!Fh(r,c)&&(s.flags&128)===0)return hn=!1,Jk(r,s,c);hn=(r.flags&131072)!==0}else hn=!1,ft&&(s.flags&1048576)!==0&&m0(s,io,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Zs(s.elementType),s.type=r,typeof r=="function")Vf(r)?(d=na(r,d),s.tag=1,s=Rv(null,s,r,d,c)):(s.tag=0,s=Lh(null,s,r,d,c));else{if(r!=null){var g=r.$$typeof;if(g===O){s.tag=11,s=jv(null,s,r,d,c);break e}else if(g===V){s.tag=14,s=Nv(null,s,r,d,c);break e}}throw s=Z(r)||r,Error(i(306,s,""))}}return s;case 0:return Lh(r,s,s.type,s.pendingProps,c);case 1:return d=s.type,g=na(d,s.pendingProps),Rv(r,s,d,g,c);case 3:e:{if(Ee(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var v=s.memoizedState;g=v.element,ah(r,s),ho(s,d,null,c);var w=s.memoizedState;if(d=w.cache,is(s,dn,d),d!==v.cache&&eh(s,[dn],c,!0),fo(),d=w.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=Lv(r,s,d,c);break e}else if(d!==g){g=Cr(Error(i(424)),s),so(g),s=Lv(r,s,d,c);break e}else{switch(r=s.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(qt=Rr(r.firstChild),Sn=s,ft=!0,ns=null,Ar=!0,c=E0(s,null,d,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Qs(),d===g){s=wi(r,s,c);break e}jn(r,s,d,c)}s=s.child}return s;case 26:return Nu(r,s),r===null?(c=Q1(s.type,null,s.pendingProps,null))?s.memoizedState=c:ft||(c=s.type,r=s.pendingProps,d=Hu(Ce.current).createElement(c),d[Xt]=s,d[wn]=r,Nn(d,c,r),en(d),s.stateNode=d):s.memoizedState=Q1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return Je(s),r===null&&ft&&(d=s.stateNode=V1(s.type,s.pendingProps,Ce.current),Sn=s,Ar=!0,g=qt,xs(s.type)?(bp=g,qt=Rr(d.firstChild)):qt=g),jn(r,s,s.pendingProps.children,c),Nu(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ft&&((g=d=qt)&&(d=Tj(d,s.type,s.pendingProps,Ar),d!==null?(s.stateNode=d,Sn=s,qt=Rr(d.firstChild),Ar=!1,g=!0):g=!1),g||rs(s)),Je(s),g=s.type,v=s.pendingProps,w=r!==null?r.memoizedProps:null,d=v.children,pp(g,v)?d=null:w!==null&&pp(g,w)&&(s.flags|=32),s.memoizedState!==null&&(g=hh(r,s,qk,null,null,c),Lo._currentValue=g),Nu(r,s),jn(r,s,d,c),s.child;case 6:return r===null&&ft&&((r=c=qt)&&(c=Aj(c,s.pendingProps,Ar),c!==null?(s.stateNode=c,Sn=s,qt=null,r=!0):r=!1),r||rs(s)),null;case 13:return Dv(r,s,c);case 4:return Ee(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=ea(s,null,d,c):jn(r,s,d,c),s.child;case 11:return jv(r,s,s.type,s.pendingProps,c);case 7:return jn(r,s,s.pendingProps,c),s.child;case 8:return jn(r,s,s.pendingProps.children,c),s.child;case 12:return jn(r,s,s.pendingProps.children,c),s.child;case 10:return d=s.pendingProps,is(s,s.type,d.value),jn(r,s,d.children,c),s.child;case 9:return g=s.type._context,d=s.pendingProps.children,Xs(s),g=kn(g),d=d(g),s.flags|=1,jn(r,s,d,c),s.child;case 14:return Nv(r,s,s.type,s.pendingProps,c);case 15:return Cv(r,s,s.type,s.pendingProps,c);case 19:return Ov(r,s,c);case 31:return Zk(r,s,c);case 22:return Ev(r,s,c,s.pendingProps);case 24:return Xs(s),d=kn(dn),r===null?(g=rh(),g===null&&(g=zt,v=th(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),s.memoizedState={parent:d,cache:g},sh(s),is(s,dn,g)):((r.lanes&c)!==0&&(ah(r,s),ho(s,null,null,c),fo()),g=r.memoizedState,v=s.memoizedState,g.parent!==d?(g={parent:d,cache:d},s.memoizedState=g,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=g),is(s,dn,d)):(d=v.cache,is(s,dn,d),d!==g.cache&&eh(s,[dn],c,!0))),jn(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function Si(r){r.flags|=4}function Uh(r,s,c,d,g){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(g&335544128)===g)if(r.stateNode.complete)r.flags|=8192;else if(u1())r.flags|=8192;else throw Js=du,ih}else r.flags&=-16777217}function Pv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!J1(s))if(u1())r.flags|=8192;else throw Js=du,ih}function Eu(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?un():536870912,r.lanes|=s,sl|=s)}function bo(r,s){if(!ft)switch(r.tailMode){case"hidden":s=r.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Vt(r){var s=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(s)for(var g=r.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=d,r.childLanes=c,s}function ej(r,s,c){var d=s.pendingProps;switch(Wf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(s),null;case 1:return Vt(s),null;case 3:return c=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),bi(dn),Be(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Ga(s)?Si(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Kf())),Vt(s),null;case 26:var g=s.type,v=s.memoizedState;return r===null?(Si(s),v!==null?(Vt(s),Pv(s,v)):(Vt(s),Uh(s,g,null,d,c))):v?v!==r.memoizedState?(Si(s),Vt(s),Pv(s,v)):(Vt(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&Si(s),Vt(s),Uh(s,g,r,d,c)),null;case 27:if(jt(s),c=Ce.current,g=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&Si(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Vt(s),null}r=pe.current,Ga(s)?x0(s):(r=V1(g,d,c),s.stateNode=r,Si(s))}return Vt(s),null;case 5:if(jt(s),g=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&Si(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Vt(s),null}if(v=pe.current,Ga(s))x0(s);else{var w=Hu(Ce.current);switch(v){case 1:v=w.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=w.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=w.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=w.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=w.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?w.createElement(g,{is:d.is}):w.createElement(g)}}v[Xt]=s,v[wn]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)v.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=v;e:switch(Nn(v,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Si(s)}}return Vt(s),Uh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&Si(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=Ce.current,Ga(s)){if(r=s.stateNode,c=s.memoizedProps,d=null,g=Sn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}r[Xt]=s,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||D1(r.nodeValue,c)),r||rs(s,!0)}else r=Hu(r).createTextNode(d),r[Xt]=s,s.stateNode=r}return Vt(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(d=Ga(s),c!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Xt]=s}else Qs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Vt(s),r=!1}else c=Kf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(cr(s),s):(cr(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Vt(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(g=Ga(s),d!==null&&d.dehydrated!==null){if(r===null){if(!g)throw Error(i(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));g[Xt]=s}else Qs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Vt(s),g=!1}else g=Kf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=g),g=!0;if(!g)return s.flags&256?(cr(s),s):(cr(s),null)}return cr(s),(s.flags&128)!==0?(s.lanes=c,s):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=s.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==g&&(d.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),Eu(s,s.updateQueue),Vt(s),null);case 4:return Be(),r===null&&cp(s.stateNode.containerInfo),Vt(s),null;case 10:return bi(s.type),Vt(s),null;case 19:if(K(on),d=s.memoizedState,d===null)return Vt(s),null;if(g=(s.flags&128)!==0,v=d.rendering,v===null)if(g)bo(d,!1);else{if(sn!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(v=mu(r),v!==null){for(s.flags|=128,bo(d,!1),r=v.updateQueue,s.updateQueue=r,Eu(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)f0(c,r),c=c.sibling;return M(on,on.current&1|2),ft&&xi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&Te()>Lu&&(s.flags|=128,g=!0,bo(d,!1),s.lanes=4194304)}else{if(!g)if(r=mu(v),r!==null){if(s.flags|=128,g=!0,r=r.updateQueue,s.updateQueue=r,Eu(s,r),bo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ft)return Vt(s),null}else 2*Te()-d.renderingStartTime>Lu&&c!==536870912&&(s.flags|=128,g=!0,bo(d,!1),s.lanes=4194304);d.isBackwards?(v.sibling=s.child,s.child=v):(r=d.last,r!==null?r.sibling=v:s.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Te(),r.sibling=null,c=on.current,M(on,g?c&1|2:c&1),ft&&xi(s,d.treeForkCount),r):(Vt(s),null);case 22:case 23:return cr(s),uh(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(c&536870912)!==0&&(s.flags&128)===0&&(Vt(s),s.subtreeFlags&6&&(s.flags|=8192)):Vt(s),c=s.updateQueue,c!==null&&Eu(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048),r!==null&&K(Ks),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),bi(dn),Vt(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function tj(r,s){switch(Wf(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return bi(dn),Be(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return jt(s),null;case 31:if(s.memoizedState!==null){if(cr(s),s.alternate===null)throw Error(i(340));Qs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(cr(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Qs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return K(on),null;case 4:return Be(),null;case 10:return bi(s.type),null;case 22:case 23:return cr(s),uh(),r!==null&&K(Ks),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return bi(dn),null;case 25:return null;default:return null}}function $v(r,s){switch(Wf(s),s.tag){case 3:bi(dn),Be();break;case 26:case 27:case 5:jt(s);break;case 4:Be();break;case 31:s.memoizedState!==null&&cr(s);break;case 13:cr(s);break;case 19:K(on);break;case 10:bi(s.type);break;case 22:case 23:cr(s),uh(),r!==null&&K(Ks);break;case 24:bi(dn)}}function yo(r,s){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var g=d.next;c=g;do{if((c.tag&r)===r){d=void 0;var v=c.create,w=c.inst;d=v(),w.destroy=d}c=c.next}while(c!==g)}}catch(T){Et(s,s.return,T)}}function us(r,s,c){try{var d=s.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var v=g.next;d=v;do{if((d.tag&r)===r){var w=d.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,g=s;var U=c,ee=T;try{ee()}catch(ce){Et(g,U,ce)}}}d=d.next}while(d!==v)}}catch(ce){Et(s,s.return,ce)}}function Fv(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{A0(s,c)}catch(d){Et(r,r.return,d)}}}function Uv(r,s,c){c.props=na(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){Et(r,s,d)}}function _o(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof c=="function"?r.refCleanup=c(d):c.current=d}}catch(g){Et(r,s,g)}}function ri(r,s){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(g){Et(r,s,g)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Et(r,s,g)}else c.current=null}function Iv(r){var s=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(g){Et(r,r.return,g)}}function Ih(r,s,c){try{var d=r.stateNode;Sj(d,r.type,c,s),d[wn]=s}catch(g){Et(r,r.return,g)}}function Hv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&xs(r.type)||r.tag===4}function Hh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Hv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&xs(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function qh(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(r),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=Sr));else if(d!==4&&(d===27&&xs(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(qh(r,s,c),r=r.sibling;r!==null;)qh(r,s,c),r=r.sibling}function Tu(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?c.insertBefore(r,s):c.appendChild(r);else if(d!==4&&(d===27&&xs(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Tu(r,s,c),r=r.sibling;r!==null;)Tu(r,s,c),r=r.sibling}function qv(r){var s=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,g=s.attributes;g.length;)s.removeAttributeNode(g[0]);Nn(s,d,c),s[Xt]=r,s[wn]=c}catch(v){Et(r,r.return,v)}}var ki=!1,pn=!1,Vh=!1,Vv=typeof WeakSet=="function"?WeakSet:Set,_n=null;function nj(r,s){if(r=r.containerInfo,fp=Xu,r=r0(r),Pf(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var g=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var w=0,T=-1,U=-1,ee=0,ce=0,de=r,ne=null;t:for(;;){for(var le;de!==c||g!==0&&de.nodeType!==3||(T=w+g),de!==v||d!==0&&de.nodeType!==3||(U=w+d),de.nodeType===3&&(w+=de.nodeValue.length),(le=de.firstChild)!==null;)ne=de,de=le;for(;;){if(de===r)break t;if(ne===c&&++ee===g&&(T=w),ne===v&&++ce===d&&(U=w),(le=de.nextSibling)!==null)break;de=ne,ne=de.parentNode}de=le}c=T===-1||U===-1?null:{start:T,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(hp={focusedElem:r,selectionRange:c},Xu=!1,_n=s;_n!==null;)if(s=_n,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,_n=r;else for(;_n!==null;){switch(s=_n,v=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)g=r[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=s,g=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Ae=na(c.type,g);r=d.getSnapshotBeforeUpdate(Ae,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){Et(c,c.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)gp(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":gp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,_n=r;break}_n=s.return}}function Gv(r,s,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Ni(r,c),d&4&&yo(5,c);break;case 1:if(Ni(r,c),d&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(w){Et(c,c.return,w)}else{var g=na(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(g,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(c,c.return,w)}}d&64&&Fv(c),d&512&&_o(c,c.return);break;case 3:if(Ni(r,c),d&64&&(r=c.updateQueue,r!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{A0(r,s)}catch(w){Et(c,c.return,w)}}break;case 27:s===null&&d&4&&qv(c);case 26:case 5:Ni(r,c),s===null&&d&4&&Iv(c),d&512&&_o(c,c.return);break;case 12:Ni(r,c);break;case 31:Ni(r,c),d&4&&Wv(r,c);break;case 13:Ni(r,c),d&4&&Xv(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=dj.bind(null,c),Mj(r,c))));break;case 22:if(d=c.memoizedState!==null||ki,!d){s=s!==null&&s.memoizedState!==null||pn,g=ki;var v=pn;ki=d,(pn=s)&&!v?Ci(r,c,(c.subtreeFlags&8772)!==0):Ni(r,c),ki=g,pn=v}break;case 30:break;default:Ni(r,c)}}function Yv(r){var s=r.alternate;s!==null&&(r.alternate=null,Yv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Yi(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Kt=null,Yn=!1;function ji(r,s,c){for(c=c.child;c!==null;)Qv(r,s,c),c=c.sibling}function Qv(r,s,c){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(it,c)}catch{}switch(c.tag){case 26:pn||ri(c,s),ji(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:pn||ri(c,s);var d=Kt,g=Yn;xs(c.type)&&(Kt=c.stateNode,Yn=!1),ji(r,s,c),Ao(c.stateNode),Kt=d,Yn=g;break;case 5:pn||ri(c,s);case 6:if(d=Kt,g=Yn,Kt=null,ji(r,s,c),Kt=d,Yn=g,Kt!==null)if(Yn)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(c.stateNode)}catch(v){Et(c,s,v)}else try{Kt.removeChild(c.stateNode)}catch(v){Et(c,s,v)}break;case 18:Kt!==null&&(Yn?(r=Kt,F1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),hl(r)):F1(Kt,c.stateNode));break;case 4:d=Kt,g=Yn,Kt=c.stateNode.containerInfo,Yn=!0,ji(r,s,c),Kt=d,Yn=g;break;case 0:case 11:case 14:case 15:us(2,c,s),pn||us(4,c,s),ji(r,s,c);break;case 1:pn||(ri(c,s),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Uv(c,s,d)),ji(r,s,c);break;case 21:ji(r,s,c);break;case 22:pn=(d=pn)||c.memoizedState!==null,ji(r,s,c),pn=d;break;default:ji(r,s,c)}}function Wv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{hl(r)}catch(c){Et(s,s.return,c)}}}function Xv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{hl(r)}catch(c){Et(s,s.return,c)}}function rj(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Vv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Vv),s;default:throw Error(i(435,r.tag))}}function Au(r,s){var c=rj(r);s.forEach(function(d){if(!c.has(d)){c.add(d);var g=fj.bind(null,r,d);d.then(g,g)}})}function Qn(r,s){var c=s.deletions;if(c!==null)for(var d=0;d<c.length;d++){var g=c[d],v=r,w=s,T=w;e:for(;T!==null;){switch(T.tag){case 27:if(xs(T.type)){Kt=T.stateNode,Yn=!1;break e}break;case 5:Kt=T.stateNode,Yn=!1;break e;case 3:case 4:Kt=T.stateNode.containerInfo,Yn=!0;break e}T=T.return}if(Kt===null)throw Error(i(160));Qv(v,w,g),Kt=null,Yn=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Kv(s,r),s=s.sibling}var Vr=null;function Kv(r,s){var c=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Qn(s,r),Wn(r),d&4&&(us(3,r,r.return),yo(3,r),us(5,r,r.return));break;case 1:Qn(s,r),Wn(r),d&512&&(pn||c===null||ri(c,c.return)),d&64&&ki&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var g=Vr;if(Qn(s,r),Wn(r),d&512&&(pn||c===null||ri(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=r.memoizedState,c===null)if(d===null)if(r.stateNode===null){e:{d=r.type,c=r.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":v=g.getElementsByTagName("title")[0],(!v||v[Xr]||v[Xt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(d),g.head.insertBefore(v,g.querySelector("head > title"))),Nn(v,d,c),v[Xt]=r,en(v),d=v;break e;case"link":var w=K1("link","href",g).get(d+(c.href||""));if(w){for(var T=0;T<w.length;T++)if(v=w[T],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){w.splice(T,1);break t}}v=g.createElement(d),Nn(v,d,c),g.head.appendChild(v);break;case"meta":if(w=K1("meta","content",g).get(d+(c.content||""))){for(T=0;T<w.length;T++)if(v=w[T],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){w.splice(T,1);break t}}v=g.createElement(d),Nn(v,d,c),g.head.appendChild(v);break;default:throw Error(i(468,d))}v[Xt]=r,en(v),d=v}r.stateNode=d}else Z1(g,r.type,r.stateNode);else r.stateNode=X1(g,d,r.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?Z1(g,r.type,r.stateNode):X1(g,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Ih(r,r.memoizedProps,c.memoizedProps)}break;case 27:Qn(s,r),Wn(r),d&512&&(pn||c===null||ri(c,c.return)),c!==null&&d&4&&Ih(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Qn(s,r),Wn(r),d&512&&(pn||c===null||ri(c,c.return)),r.flags&32){g=r.stateNode;try{Xi(g,"")}catch(Ae){Et(r,r.return,Ae)}}d&4&&r.stateNode!=null&&(g=r.memoizedProps,Ih(r,g,c!==null?c.memoizedProps:g)),d&1024&&(Vh=!0);break;case 6:if(Qn(s,r),Wn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,c=r.stateNode;try{c.nodeValue=d}catch(Ae){Et(r,r.return,Ae)}}break;case 3:if(Gu=null,g=Vr,Vr=qu(s.containerInfo),Qn(s,r),Vr=g,Wn(r),d&4&&c!==null&&c.memoizedState.isDehydrated)try{hl(s.containerInfo)}catch(Ae){Et(r,r.return,Ae)}Vh&&(Vh=!1,Zv(r));break;case 4:d=Vr,Vr=qu(r.stateNode.containerInfo),Qn(s,r),Wn(r),Vr=d;break;case 12:Qn(s,r),Wn(r);break;case 31:Qn(s,r),Wn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Au(r,d)));break;case 13:Qn(s,r),Wn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Ru=Te()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Au(r,d)));break;case 22:g=r.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,ee=ki,ce=pn;if(ki=ee||g,pn=ce||U,Qn(s,r),pn=ce,ki=ee,Wn(r),d&8192)e:for(s=r.stateNode,s._visibility=g?s._visibility&-2:s._visibility|1,g&&(c===null||U||ki||pn||ra(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){U=c=s;try{if(v=U.stateNode,g)w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{T=U.stateNode;var de=U.memoizedProps.style,ne=de!=null&&de.hasOwnProperty("display")?de.display:null;T.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ae){Et(U,U.return,Ae)}}}else if(s.tag===6){if(c===null){U=s;try{U.stateNode.nodeValue=g?"":U.memoizedProps}catch(Ae){Et(U,U.return,Ae)}}}else if(s.tag===18){if(c===null){U=s;try{var le=U.stateNode;g?U1(le,!0):U1(U.stateNode,!1)}catch(Ae){Et(U,U.return,Ae)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Au(r,c))));break;case 19:Qn(s,r),Wn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Au(r,d)));break;case 30:break;case 21:break;default:Qn(s,r),Wn(r)}}function Wn(r){var s=r.flags;if(s&2){try{for(var c,d=r.return;d!==null;){if(Hv(d)){c=d;break}d=d.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var g=c.stateNode,v=Hh(r);Tu(r,v,g);break;case 5:var w=c.stateNode;c.flags&32&&(Xi(w,""),c.flags&=-33);var T=Hh(r);Tu(r,T,w);break;case 3:case 4:var U=c.stateNode.containerInfo,ee=Hh(r);qh(r,ee,U);break;default:throw Error(i(161))}}catch(ce){Et(r,r.return,ce)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Zv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Zv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function Ni(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Gv(r,s.alternate,s),s=s.sibling}function ra(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:us(4,s,s.return),ra(s);break;case 1:ri(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&Uv(s,s.return,c),ra(s);break;case 27:Ao(s.stateNode);case 26:case 5:ri(s,s.return),ra(s);break;case 22:s.memoizedState===null&&ra(s);break;case 30:ra(s);break;default:ra(s)}r=r.sibling}}function Ci(r,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,g=r,v=s,w=v.flags;switch(v.tag){case 0:case 11:case 15:Ci(g,v,c),yo(4,v);break;case 1:if(Ci(g,v,c),d=v,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ee){Et(d,d.return,ee)}if(d=v,g=d.updateQueue,g!==null){var T=d.stateNode;try{var U=g.shared.hiddenCallbacks;if(U!==null)for(g.shared.hiddenCallbacks=null,g=0;g<U.length;g++)T0(U[g],T)}catch(ee){Et(d,d.return,ee)}}c&&w&64&&Fv(v),_o(v,v.return);break;case 27:qv(v);case 26:case 5:Ci(g,v,c),c&&d===null&&w&4&&Iv(v),_o(v,v.return);break;case 12:Ci(g,v,c);break;case 31:Ci(g,v,c),c&&w&4&&Wv(g,v);break;case 13:Ci(g,v,c),c&&w&4&&Xv(g,v);break;case 22:v.memoizedState===null&&Ci(g,v,c),_o(v,v.return);break;case 30:break;default:Ci(g,v,c)}s=s.sibling}}function Gh(r,s){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&ao(c))}function Yh(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ao(r))}function Gr(r,s,c,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Jv(r,s,c,d),s=s.sibling}function Jv(r,s,c,d){var g=s.flags;switch(s.tag){case 0:case 11:case 15:Gr(r,s,c,d),g&2048&&yo(9,s);break;case 1:Gr(r,s,c,d);break;case 3:Gr(r,s,c,d),g&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ao(r)));break;case 12:if(g&2048){Gr(r,s,c,d),r=s.stateNode;try{var v=s.memoizedProps,w=v.id,T=v.onPostCommit;typeof T=="function"&&T(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(U){Et(s,s.return,U)}}else Gr(r,s,c,d);break;case 31:Gr(r,s,c,d);break;case 13:Gr(r,s,c,d);break;case 23:break;case 22:v=s.stateNode,w=s.alternate,s.memoizedState!==null?v._visibility&2?Gr(r,s,c,d):wo(r,s):v._visibility&2?Gr(r,s,c,d):(v._visibility|=2,nl(r,s,c,d,(s.subtreeFlags&10256)!==0||!1)),g&2048&&Gh(w,s);break;case 24:Gr(r,s,c,d),g&2048&&Yh(s.alternate,s);break;default:Gr(r,s,c,d)}}function nl(r,s,c,d,g){for(g=g&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=r,w=s,T=c,U=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:nl(v,w,T,U,g),yo(8,w);break;case 23:break;case 22:var ce=w.stateNode;w.memoizedState!==null?ce._visibility&2?nl(v,w,T,U,g):wo(v,w):(ce._visibility|=2,nl(v,w,T,U,g)),g&&ee&2048&&Gh(w.alternate,w);break;case 24:nl(v,w,T,U,g),g&&ee&2048&&Yh(w.alternate,w);break;default:nl(v,w,T,U,g)}s=s.sibling}}function wo(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=r,d=s,g=d.flags;switch(d.tag){case 22:wo(c,d),g&2048&&Gh(d.alternate,d);break;case 24:wo(c,d),g&2048&&Yh(d.alternate,d);break;default:wo(c,d)}s=s.sibling}}var So=8192;function rl(r,s,c){if(r.subtreeFlags&So)for(r=r.child;r!==null;)e1(r,s,c),r=r.sibling}function e1(r,s,c){switch(r.tag){case 26:rl(r,s,c),r.flags&So&&r.memoizedState!==null&&Hj(c,Vr,r.memoizedState,r.memoizedProps);break;case 5:rl(r,s,c);break;case 3:case 4:var d=Vr;Vr=qu(r.stateNode.containerInfo),rl(r,s,c),Vr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=So,So=16777216,rl(r,s,c),So=d):rl(r,s,c));break;default:rl(r,s,c)}}function t1(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function ko(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];_n=d,r1(d,r)}t1(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)n1(r),r=r.sibling}function n1(r){switch(r.tag){case 0:case 11:case 15:ko(r),r.flags&2048&&us(9,r,r.return);break;case 3:ko(r);break;case 12:ko(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,Mu(r)):ko(r);break;default:ko(r)}}function Mu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];_n=d,r1(d,r)}t1(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:us(8,s,s.return),Mu(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,Mu(s));break;default:Mu(s)}r=r.sibling}}function r1(r,s){for(;_n!==null;){var c=_n;switch(c.tag){case 0:case 11:case 15:us(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ao(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,_n=d;else e:for(c=r;_n!==null;){d=_n;var g=d.sibling,v=d.return;if(Yv(d),d===c){_n=null;break e}if(g!==null){g.return=v,_n=g;break e}_n=v}}}var ij={getCacheForType:function(r){var s=kn(dn),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return kn(dn).controller.signal}},sj=typeof WeakMap=="function"?WeakMap:Map,wt=0,zt=null,at=null,ct=0,Ct=0,ur=null,ds=!1,il=!1,Qh=!1,Ei=0,sn=0,fs=0,ia=0,Wh=0,dr=0,sl=0,jo=null,Xn=null,Xh=!1,Ru=0,i1=0,Lu=1/0,Du=null,hs=null,yn=0,ps=null,al=null,Ti=0,Kh=0,Zh=null,s1=null,No=0,Jh=null;function fr(){return(wt&2)!==0&&ct!==0?ct&-ct:P.T!==null?sp():Hl()}function a1(){if(dr===0)if((ct&536870912)===0||ft){var r=Ur;Ur<<=1,(Ur&3932160)===0&&(Ur=262144),dr=r}else dr=536870912;return r=or.current,r!==null&&(r.flags|=32),dr}function Kn(r,s,c){(r===zt&&(Ct===2||Ct===9)||r.cancelPendingCommit!==null)&&(ll(r,0),ms(r,ct,dr,!1)),Ft(r,c),((wt&2)===0||r!==zt)&&(r===zt&&((wt&2)===0&&(ia|=c),sn===4&&ms(r,ct,dr,!1)),ii(r))}function l1(r,s,c){if((wt&6)!==0)throw Error(i(327));var d=!c&&(s&127)===0&&(s&r.expiredLanes)===0||Xe(r,s),g=d?oj(r,s):tp(r,s,!0),v=d;do{if(g===0){il&&!d&&ms(r,s,0,!1);break}else{if(c=r.current.alternate,v&&!aj(c)){g=tp(r,s,!1),v=!1;continue}if(g===2){if(v=s,r.errorRecoveryDisabledLanes&v)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var T=r;g=jo;var U=T.current.memoizedState.isDehydrated;if(U&&(ll(T,w).flags|=256),w=tp(T,w,!1),w!==2){if(Qh&&!U){T.errorRecoveryDisabledLanes|=v,ia|=v,g=4;break e}v=Xn,Xn=g,v!==null&&(Xn===null?Xn=v:Xn.push.apply(Xn,v))}g=w}if(v=!1,g!==2)continue}}if(g===1){ll(r,0),ms(r,s,0,!0);break}e:{switch(d=r,v=g,v){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:ms(d,s,dr,!ds);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(g=Ru+300-Te(),10<g)){if(ms(d,s,dr,!ds),be(d,0,!0)!==0)break e;Ti=s,d.timeoutHandle=P1(o1.bind(null,d,c,Xn,Du,Xh,s,dr,ia,sl,ds,v,"Throttled",-0,0),g);break e}o1(d,c,Xn,Du,Xh,s,dr,ia,sl,ds,v,null,-0,0)}}break}while(!0);ii(r)}function o1(r,s,c,d,g,v,w,T,U,ee,ce,de,ne,le){if(r.timeoutHandle=-1,de=s.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Sr},e1(s,v,de);var Ae=(v&62914560)===v?Ru-Te():(v&4194048)===v?i1-Te():0;if(Ae=qj(de,Ae),Ae!==null){Ti=v,r.cancelPendingCommit=Ae(g1.bind(null,r,s,v,c,d,g,w,T,U,ce,de,null,ne,le)),ms(r,v,w,!ee);return}}g1(r,s,v,c,d,g,w,T,U)}function aj(r){for(var s=r;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var g=c[d],v=g.getSnapshot;g=g.value;try{if(!ar(v(),g))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ms(r,s,c,d){s&=~Wh,s&=~ia,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var g=s;0<g;){var v=31-et(g),w=1<<v;d[v]=-1,g&=~w}c!==0&&yr(r,c,s)}function zu(){return(wt&6)===0?(Co(0),!1):!0}function ep(){if(at!==null){if(Ct===0)var r=at.return;else r=at,vi=Ws=null,gh(r),Ka=null,oo=0,r=at;for(;r!==null;)$v(r.alternate,r),r=r.return;at=null}}function ll(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,Nj(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Ti=0,ep(),zt=r,at=c=gi(r.current,null),ct=s,Ct=0,ur=null,ds=!1,il=Xe(r,s),Qh=!1,sl=dr=Wh=ia=fs=sn=0,Xn=jo=null,Xh=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var g=31-et(d),v=1<<g;s|=r[g],d&=~v}return Ei=s,nu(),c}function c1(r,s){Ze=null,P.H=xo,s===Xa||s===uu?(s=j0(),Ct=3):s===ih?(s=j0(),Ct=4):Ct=s===Rh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ur=s,at===null&&(sn=1,ku(r,Cr(s,r.current)))}function u1(){var r=or.current;return r===null?!0:(ct&4194048)===ct?Mr===null:(ct&62914560)===ct||(ct&536870912)!==0?r===Mr:!1}function d1(){var r=P.H;return P.H=xo,r===null?xo:r}function f1(){var r=P.A;return P.A=ij,r}function Ou(){sn=4,ds||(ct&4194048)!==ct&&or.current!==null||(il=!0),(fs&134217727)===0&&(ia&134217727)===0||zt===null||ms(zt,ct,dr,!1)}function tp(r,s,c){var d=wt;wt|=2;var g=d1(),v=f1();(zt!==r||ct!==s)&&(Du=null,ll(r,s)),s=!1;var w=sn;e:do try{if(Ct!==0&&at!==null){var T=at,U=ur;switch(Ct){case 8:ep(),w=6;break e;case 3:case 2:case 9:case 6:or.current===null&&(s=!0);var ee=Ct;if(Ct=0,ur=null,ol(r,T,U,ee),c&&il){w=0;break e}break;default:ee=Ct,Ct=0,ur=null,ol(r,T,U,ee)}}lj(),w=sn;break}catch(ce){c1(r,ce)}while(!0);return s&&r.shellSuspendCounter++,vi=Ws=null,wt=d,P.H=g,P.A=v,at===null&&(zt=null,ct=0,nu()),w}function lj(){for(;at!==null;)h1(at)}function oj(r,s){var c=wt;wt|=2;var d=d1(),g=f1();zt!==r||ct!==s?(Du=null,Lu=Te()+500,ll(r,s)):il=Xe(r,s);e:do try{if(Ct!==0&&at!==null){s=at;var v=ur;t:switch(Ct){case 1:Ct=0,ur=null,ol(r,s,v,1);break;case 2:case 9:if(S0(v)){Ct=0,ur=null,p1(s);break}s=function(){Ct!==2&&Ct!==9||zt!==r||(Ct=7),ii(r)},v.then(s,s);break e;case 3:Ct=7;break e;case 4:Ct=5;break e;case 7:S0(v)?(Ct=0,ur=null,p1(s)):(Ct=0,ur=null,ol(r,s,v,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var T=at;if(w?J1(w):T.stateNode.complete){Ct=0,ur=null;var U=T.sibling;if(U!==null)at=U;else{var ee=T.return;ee!==null?(at=ee,Bu(ee)):at=null}break t}}Ct=0,ur=null,ol(r,s,v,5);break;case 6:Ct=0,ur=null,ol(r,s,v,6);break;case 8:ep(),sn=6;break e;default:throw Error(i(462))}}cj();break}catch(ce){c1(r,ce)}while(!0);return vi=Ws=null,P.H=d,P.A=g,wt=c,at!==null?0:(zt=null,ct=0,nu(),sn)}function cj(){for(;at!==null&&!ze();)h1(at)}function h1(r){var s=Bv(r.alternate,r,Ei);r.memoizedProps=r.pendingProps,s===null?Bu(r):at=s}function p1(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=Mv(c,s,s.pendingProps,s.type,void 0,ct);break;case 11:s=Mv(c,s,s.pendingProps,s.type.render,s.ref,ct);break;case 5:gh(s);default:$v(c,s),s=at=f0(s,Ei),s=Bv(c,s,Ei)}r.memoizedProps=r.pendingProps,s===null?Bu(r):at=s}function ol(r,s,c,d){vi=Ws=null,gh(s),Ka=null,oo=0;var g=s.return;try{if(Kk(r,g,s,c,ct)){sn=1,ku(r,Cr(c,r.current)),at=null;return}}catch(v){if(g!==null)throw at=g,v;sn=1,ku(r,Cr(c,r.current)),at=null;return}s.flags&32768?(ft||d===1?r=!0:il||(ct&536870912)!==0?r=!1:(ds=r=!0,(d===2||d===9||d===3||d===6)&&(d=or.current,d!==null&&d.tag===13&&(d.flags|=16384))),m1(s,r)):Bu(s)}function Bu(r){var s=r;do{if((s.flags&32768)!==0){m1(s,ds);return}r=s.return;var c=ej(s.alternate,s,Ei);if(c!==null){at=c;return}if(s=s.sibling,s!==null){at=s;return}at=s=r}while(s!==null);sn===0&&(sn=5)}function m1(r,s){do{var c=tj(r.alternate,r);if(c!==null){c.flags&=32767,at=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){at=r;return}at=r=c}while(r!==null);sn=6,at=null}function g1(r,s,c,d,g,v,w,T,U){r.cancelPendingCommit=null;do Pu();while(yn!==0);if((wt&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(v=s.lanes|s.childLanes,v|=Hf,On(r,c,v,w,T,U),r===zt&&(at=zt=null,ct=0),al=s,ps=r,Ti=c,Kh=v,Zh=g,s1=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,hj(W,function(){return _1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=P.T,P.T=null,g=$.p,$.p=2,w=wt,wt|=4;try{nj(r,s,c)}finally{wt=w,$.p=g,P.T=d}}yn=1,x1(),v1(),b1()}}function x1(){if(yn===1){yn=0;var r=ps,s=al,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var d=$.p;$.p=2;var g=wt;wt|=4;try{Kv(s,r);var v=hp,w=r0(r.containerInfo),T=v.focusedElem,U=v.selectionRange;if(w!==T&&T&&T.ownerDocument&&n0(T.ownerDocument.documentElement,T)){if(U!==null&&Pf(T)){var ee=U.start,ce=U.end;if(ce===void 0&&(ce=ee),"selectionStart"in T)T.selectionStart=ee,T.selectionEnd=Math.min(ce,T.value.length);else{var de=T.ownerDocument||document,ne=de&&de.defaultView||window;if(ne.getSelection){var le=ne.getSelection(),Ae=T.textContent.length,Ue=Math.min(U.start,Ae),Mt=U.end===void 0?Ue:Math.min(U.end,Ae);!le.extend&&Ue>Mt&&(w=Mt,Mt=Ue,Ue=w);var X=t0(T,Ue),q=t0(T,Mt);if(X&&q&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var J=de.createRange();J.setStart(X.node,X.offset),le.removeAllRanges(),Ue>Mt?(le.addRange(J),le.extend(q.node,q.offset)):(J.setEnd(q.node,q.offset),le.addRange(J))}}}}for(de=[],le=T;le=le.parentNode;)le.nodeType===1&&de.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<de.length;T++){var ue=de[T];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Xu=!!fp,hp=fp=null}finally{wt=g,$.p=d,P.T=c}}r.current=s,yn=2}}function v1(){if(yn===2){yn=0;var r=ps,s=al,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var d=$.p;$.p=2;var g=wt;wt|=4;try{Gv(r,s.alternate,s)}finally{wt=g,$.p=d,P.T=c}}yn=3}}function b1(){if(yn===4||yn===3){yn=0,ht();var r=ps,s=al,c=Ti,d=s1;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?yn=5:(yn=0,al=ps=null,y1(r,r.pendingLanes));var g=r.pendingLanes;if(g===0&&(hs=null),zs(c),s=s.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(it,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=P.T,g=$.p,$.p=2,P.T=null;try{for(var v=r.onRecoverableError,w=0;w<d.length;w++){var T=d[w];v(T.value,{componentStack:T.stack})}}finally{P.T=s,$.p=g}}(Ti&3)!==0&&Pu(),ii(r),g=r.pendingLanes,(c&261930)!==0&&(g&42)!==0?r===Jh?No++:(No=0,Jh=r):No=0,Co(0)}}function y1(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,ao(s)))}function Pu(){return x1(),v1(),b1(),_1()}function _1(){if(yn!==5)return!1;var r=ps,s=Kh;Kh=0;var c=zs(Ti),d=P.T,g=$.p;try{$.p=32>c?32:c,P.T=null,c=Zh,Zh=null;var v=ps,w=Ti;if(yn=0,al=ps=null,Ti=0,(wt&6)!==0)throw Error(i(331));var T=wt;if(wt|=4,n1(v.current),Jv(v,v.current,w,c),wt=T,Co(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(it,v)}catch{}return!0}finally{$.p=g,P.T=d,y1(r,s)}}function w1(r,s,c){s=Cr(c,s),s=Mh(r.stateNode,s,2),r=ls(r,s,2),r!==null&&(Ft(r,2),ii(r))}function Et(r,s,c){if(r.tag===3)w1(r,r,c);else for(;s!==null;){if(s.tag===3){w1(s,r,c);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(hs===null||!hs.has(d))){r=Cr(c,r),c=Sv(2),d=ls(s,c,2),d!==null&&(kv(c,d,s,r),Ft(d,2),ii(d));break}}s=s.return}}function np(r,s,c){var d=r.pingCache;if(d===null){d=r.pingCache=new sj;var g=new Set;d.set(s,g)}else g=d.get(s),g===void 0&&(g=new Set,d.set(s,g));g.has(c)||(Qh=!0,g.add(c),r=uj.bind(null,r,s,c),s.then(r,r))}function uj(r,s,c){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,zt===r&&(ct&c)===c&&(sn===4||sn===3&&(ct&62914560)===ct&&300>Te()-Ru?(wt&2)===0&&ll(r,0):Wh|=c,sl===ct&&(sl=0)),ii(r)}function S1(r,s){s===0&&(s=un()),r=Gs(r,s),r!==null&&(Ft(r,s),ii(r))}function dj(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),S1(r,c)}function fj(r,s){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,g=r.memoizedState;g!==null&&(c=g.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),S1(r,c)}function hj(r,s){return nn(r,s)}var $u=null,cl=null,rp=!1,Fu=!1,ip=!1,gs=0;function ii(r){r!==cl&&r.next===null&&(cl===null?$u=cl=r:cl=cl.next=r),Fu=!0,rp||(rp=!0,mj())}function Co(r,s){if(!ip&&Fu){ip=!0;do for(var c=!1,d=$u;d!==null;){if(r!==0){var g=d.pendingLanes;if(g===0)var v=0;else{var w=d.suspendedLanes,T=d.pingedLanes;v=(1<<31-et(42|r)+1)-1,v&=g&~(w&~T),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,C1(d,v))}else v=ct,v=be(d,d===zt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Xe(d,v)||(c=!0,C1(d,v));d=d.next}while(c);ip=!1}}function pj(){k1()}function k1(){Fu=rp=!1;var r=0;gs!==0&&jj()&&(r=gs);for(var s=Te(),c=null,d=$u;d!==null;){var g=d.next,v=j1(d,s);v===0?(d.next=null,c===null?$u=g:c.next=g,g===null&&(cl=c)):(c=d,(r!==0||(v&3)!==0)&&(Fu=!0)),d=g}yn!==0&&yn!==5||Co(r),gs!==0&&(gs=0)}function j1(r,s){for(var c=r.suspendedLanes,d=r.pingedLanes,g=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var w=31-et(v),T=1<<w,U=g[w];U===-1?((T&c)===0||(T&d)!==0)&&(g[w]=$t(T,s)):U<=s&&(r.expiredLanes|=T),v&=~T}if(s=zt,c=ct,c=be(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===s&&(Ct===2||Ct===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||Xe(r,c)){if(s=c&-c,s===r.callbackPriority)return s;switch(d!==null&&je(d),zs(c)){case 2:case 8:c=we;break;case 32:c=W;break;case 268435456:c=Re;break;default:c=W}return d=N1.bind(null,r),c=nn(c,d),r.callbackPriority=s,r.callbackNode=c,s}return d!==null&&d!==null&&je(d),r.callbackPriority=2,r.callbackNode=null,2}function N1(r,s){if(yn!==0&&yn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Pu()&&r.callbackNode!==c)return null;var d=ct;return d=be(r,r===zt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(l1(r,d,s),j1(r,Te()),r.callbackNode!=null&&r.callbackNode===c?N1.bind(null,r):null)}function C1(r,s){if(Pu())return null;l1(r,s,!0)}function mj(){Cj(function(){(wt&6)!==0?nn(oe,pj):k1()})}function sp(){if(gs===0){var r=Qa;r===0&&(r=Fr,Fr<<=1,(Fr&261888)===0&&(Fr=256)),gs=r}return gs}function E1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:za(""+r)}function T1(r,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,r.id&&c.setAttribute("form",r.id),s.parentNode.insertBefore(c,s),r=new FormData(r),c.parentNode.removeChild(c),r}function gj(r,s,c,d,g){if(s==="submit"&&c&&c.stateNode===g){var v=E1((g[wn]||null).action),w=d.submitter;w&&(s=(s=w[wn]||null)?E1(s.formAction):w.getAttribute("formAction"),s!==null&&(v=s,w=null));var T=new mi("action","action",null,d,g);r.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(gs!==0){var U=w?T1(g,w):new FormData(g);jh(c,{pending:!0,data:U,method:g.method,action:v},null,U)}}else typeof v=="function"&&(T.preventDefault(),U=w?T1(g,w):new FormData(g),jh(c,{pending:!0,data:U,method:g.method,action:v},v,U))},currentTarget:g}]})}}for(var ap=0;ap<If.length;ap++){var lp=If[ap],xj=lp.toLowerCase(),vj=lp[0].toUpperCase()+lp.slice(1);qr(xj,"on"+vj)}qr(a0,"onAnimationEnd"),qr(l0,"onAnimationIteration"),qr(o0,"onAnimationStart"),qr("dblclick","onDoubleClick"),qr("focusin","onFocus"),qr("focusout","onBlur"),qr(Dk,"onTransitionRun"),qr(zk,"onTransitionStart"),qr(Ok,"onTransitionCancel"),qr(c0,"onTransitionEnd"),Zr("onMouseEnter",["mouseout","mouseover"]),Zr("onMouseLeave",["mouseout","mouseover"]),Zr("onPointerEnter",["pointerout","pointerover"]),Zr("onPointerLeave",["pointerout","pointerover"]),Ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ir("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eo="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(" "),bj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Eo));function A1(r,s){s=(s&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],g=d.event;d=d.listeners;e:{var v=void 0;if(s)for(var w=d.length-1;0<=w;w--){var T=d[w],U=T.instance,ee=T.currentTarget;if(T=T.listener,U!==v&&g.isPropagationStopped())break e;v=T,g.currentTarget=ee;try{v(g)}catch(ce){tu(ce)}g.currentTarget=null,v=U}else for(w=0;w<d.length;w++){if(T=d[w],U=T.instance,ee=T.currentTarget,T=T.listener,U!==v&&g.isPropagationStopped())break e;v=T,g.currentTarget=ee;try{v(g)}catch(ce){tu(ce)}g.currentTarget=null,v=U}}}}function lt(r,s){var c=s[Vl];c===void 0&&(c=s[Vl]=new Set);var d=r+"__bubble";c.has(d)||(M1(s,r,2,!1),c.add(d))}function op(r,s,c){var d=0;s&&(d|=4),M1(c,r,d,s)}var Uu="_reactListening"+Math.random().toString(36).slice(2);function cp(r){if(!r[Uu]){r[Uu]=!0,Vn.forEach(function(c){c!=="selectionchange"&&(bj.has(c)||op(c,!1,r),op(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Uu]||(s[Uu]=!0,op("selectionchange",!1,s))}}function M1(r,s,c,d){switch(ab(s)){case 2:var g=Yj;break;case 8:g=Qj;break;default:g=kp}c=g.bind(null,s,c,r),g=void 0,!Ba||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(g=!0),d?g!==void 0?r.addEventListener(s,c,{capture:!0,passive:g}):r.addEventListener(s,c,!0):g!==void 0?r.addEventListener(s,c,{passive:g}):r.addEventListener(s,c,!1)}function up(r,s,c,d,g){var v=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var T=d.stateNode.containerInfo;if(T===g)break;if(w===4)for(w=d.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===g)return;w=w.return}for(;T!==null;){if(w=pi(T),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){d=v=w;continue e}T=T.parentNode}}d=d.return}Yc(function(){var ee=v,ce=Oa(c),de=[];e:{var ne=u0.get(r);if(ne!==void 0){var le=mi,Ae=r;switch(r){case"keypress":if(st(c)===0)break e;case"keydown":case"keyup":le=fk;break;case"focusin":Ae="focus",le=ei;break;case"focusout":Ae="blur",le=ei;break;case"beforeblur":case"afterblur":le=ei;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Xc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=mk;break;case a0:case l0:case o0:le=Jc;break;case c0:le=xk;break;case"scroll":case"scrollend":le=Qc;break;case"wheel":le=bk;break;case"copy":case"cut":case"paste":le=sk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Ux;break;case"toggle":case"beforetoggle":le=_k}var Ue=(s&4)!==0,Mt=!Ue&&(r==="scroll"||r==="scrollend"),X=Ue?ne!==null?ne+"Capture":null:ne;Ue=[];for(var q=ee,J;q!==null;){var ue=q;if(J=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||J===null||X===null||(ue=Us(q,X),ue!=null&&Ue.push(To(q,ue,J))),Mt)break;q=q.return}0<Ue.length&&(ne=new le(ne,Ae,null,c,ce),de.push({event:ne,listeners:Ue}))}}if((s&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",le=r==="mouseout"||r==="pointerout",ne&&c!==Ki&&(Ae=c.relatedTarget||c.fromElement)&&(pi(Ae)||Ae[sr]))break e;if((le||ne)&&(ne=ce.window===ce?ce:(ne=ce.ownerDocument)?ne.defaultView||ne.parentWindow:window,le?(Ae=c.relatedTarget||c.toElement,le=ee,Ae=Ae?pi(Ae):null,Ae!==null&&(Mt=o(Ae),Ue=Ae.tag,Ae!==Mt||Ue!==5&&Ue!==27&&Ue!==6)&&(Ae=null)):(le=null,Ae=ee),le!==Ae)){if(Ue=Lf,ue="onMouseLeave",X="onMouseEnter",q="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=Ux,ue="onPointerLeave",X="onPointerEnter",q="pointer"),Mt=le==null?ne:Ps(le),J=Ae==null?ne:Ps(Ae),ne=new Ue(ue,q+"leave",le,c,ce),ne.target=Mt,ne.relatedTarget=J,ue=null,pi(ce)===ee&&(Ue=new Ue(X,q+"enter",Ae,c,ce),Ue.target=J,Ue.relatedTarget=Mt,ue=Ue),Mt=ue,le&&Ae)t:{for(Ue=yj,X=le,q=Ae,J=0,ue=X;ue;ue=Ue(ue))J++;ue=0;for(var Pe=q;Pe;Pe=Ue(Pe))ue++;for(;0<J-ue;)X=Ue(X),J--;for(;0<ue-J;)q=Ue(q),ue--;for(;J--;){if(X===q||q!==null&&X===q.alternate){Ue=X;break t}X=Ue(X),q=Ue(q)}Ue=null}else Ue=null;le!==null&&R1(de,ne,le,Ue,!1),Ae!==null&&Mt!==null&&R1(de,Mt,Ae,Ue,!0)}}e:{if(ne=ee?Ps(ee):window,le=ne.nodeName&&ne.nodeName.toLowerCase(),le==="select"||le==="input"&&ne.type==="file")var bt=Wx;else if(Yx(ne))if(Xx)bt=Mk;else{bt=Tk;var Le=Ek}else le=ne.nodeName,!le||le.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Da(ee.elementType)&&(bt=Wx):bt=Ak;if(bt&&(bt=bt(r,ee))){Qx(de,bt,c,ce);break e}Le&&Le(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Ra(ne,"number",ne.value)}switch(Le=ee?Ps(ee):window,r){case"focusin":(Yx(Le)||Le.contentEditable==="true")&&(Fa=Le,$f=ee,ro=null);break;case"focusout":ro=$f=Fa=null;break;case"mousedown":Ff=!0;break;case"contextmenu":case"mouseup":case"dragend":Ff=!1,i0(de,c,ce);break;case"selectionchange":if(Lk)break;case"keydown":case"keyup":i0(de,c,ce)}var tt;if(zf)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 $a?Vx(r,c)&&(ut="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(ut="onCompositionStart");ut&&(Ix&&c.locale!=="ko"&&($a||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&$a&&(tt=pt()):(H=ce,he="value"in H?H.value:H.textContent,$a=!0)),Le=Iu(ee,ut),0<Le.length&&(ut=new Fx(ut,r,null,c,ce),de.push({event:ut,listeners:Le}),tt?ut.data=tt:(tt=Gx(c),tt!==null&&(ut.data=tt)))),(tt=Sk?kk(r,c):jk(r,c))&&(ut=Iu(ee,"onBeforeInput"),0<ut.length&&(Le=new Fx("onBeforeInput","beforeinput",null,c,ce),de.push({event:Le,listeners:ut}),Le.data=tt)),gj(de,r,ee,c,ce)}A1(de,s)})}function To(r,s,c){return{instance:r,listener:s,currentTarget:c}}function Iu(r,s){for(var c=s+"Capture",d=[];r!==null;){var g=r,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=Us(r,c),g!=null&&d.unshift(To(r,g,v)),g=Us(r,s),g!=null&&d.push(To(r,g,v))),r.tag===3)return d;r=r.return}return[]}function yj(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function R1(r,s,c,d,g){for(var v=s._reactName,w=[];c!==null&&c!==d;){var T=c,U=T.alternate,ee=T.stateNode;if(T=T.tag,U!==null&&U===d)break;T!==5&&T!==26&&T!==27||ee===null||(U=ee,g?(ee=Us(c,v),ee!=null&&w.unshift(To(c,ee,U))):g||(ee=Us(c,v),ee!=null&&w.push(To(c,ee,U)))),c=c.return}w.length!==0&&r.push({event:s,listeners:w})}var _j=/\r\n?/g,wj=/\u0000|\uFFFD/g;function L1(r){return(typeof r=="string"?r:""+r).replace(_j,`
|
|
50
|
-
`).replace(wj,"")}function D1(r,s){return s=L1(s),L1(r)===s}function At(r,s,c,d,g,v){switch(c){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Xi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Xi(r,""+d);break;case"className":Aa(r,"class",d);break;case"tabIndex":Aa(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Aa(r,c,d);break;case"style":qc(r,d,v);break;case"data":if(s!=="object"){Aa(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=za(""+d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(c==="formAction"?(s!=="input"&&At(r,s,"name",g.name,g,null),At(r,s,"formEncType",g.formEncType,g,null),At(r,s,"formMethod",g.formMethod,g,null),At(r,s,"formTarget",g.formTarget,g,null)):(At(r,s,"encType",g.encType,g,null),At(r,s,"method",g.method,g,null),At(r,s,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=za(""+d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=Sr);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(i(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}c=za(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""+d):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),$s(r,"popover",d);break;case"xlinkActuate":Hr(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Hr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Hr(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Hr(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Hr(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Hr(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Hr(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Hr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Hr(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":$s(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Vc.get(c)||c,$s(r,c,d))}}function dp(r,s,c,d,g,v){switch(c){case"style":qc(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"children":typeof d=="string"?Xi(r,d):(typeof d=="number"||typeof d=="bigint")&&Xi(r,""+d);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Sr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ta.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),s=c.slice(2,g?c.length-7:void 0),v=r[wn]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(s,v,g),typeof d=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(s,d,g);break e}c in r?r[c]=d:d===!0?r.setAttribute(c,""):$s(r,c,d)}}}function Nn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",r),lt("load",r);var d=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var w=c[v];if(w!=null)switch(v){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:At(r,s,v,w,c,null)}}g&&At(r,s,"srcSet",c.srcSet,c,null),d&&At(r,s,"src",c.src,c,null);return;case"input":lt("invalid",r);var T=v=w=g=null,U=null,ee=null;for(d in c)if(c.hasOwnProperty(d)){var ce=c[d];if(ce!=null)switch(d){case"name":g=ce;break;case"type":w=ce;break;case"checked":U=ce;break;case"defaultChecked":ee=ce;break;case"value":v=ce;break;case"defaultValue":T=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,s));break;default:At(r,s,d,ce,c,null)}}Ic(r,v,T,U,ee,w,g,!1);return;case"select":lt("invalid",r),d=w=v=null;for(g in c)if(c.hasOwnProperty(g)&&(T=c[g],T!=null))switch(g){case"value":v=T;break;case"defaultValue":w=T;break;case"multiple":d=T;default:At(r,s,g,T,c,null)}s=v,c=w,r.multiple=!!d,s!=null?Wi(r,!!d,s,!1):c!=null&&Wi(r,!!d,c,!0);return;case"textarea":lt("invalid",r),v=g=d=null;for(w in c)if(c.hasOwnProperty(w)&&(T=c[w],T!=null))switch(w){case"value":d=T;break;case"defaultValue":g=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:At(r,s,w,T,c,null)}Wl(r,d,g,v);return;case"option":for(U in c)if(c.hasOwnProperty(U)&&(d=c[U],d!=null))switch(U){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:At(r,s,U,d,c,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<Eo.length;d++)lt(Eo[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 c)if(c.hasOwnProperty(ee)&&(d=c[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:At(r,s,ee,d,c,null)}return;default:if(Da(s)){for(ce in c)c.hasOwnProperty(ce)&&(d=c[ce],d!==void 0&&dp(r,s,ce,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&At(r,s,T,d,c,null))}function Sj(r,s,c,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,w=null,T=null,U=null,ee=null,ce=null;for(le in c){var de=c[le];if(c.hasOwnProperty(le)&&de!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":U=de;default:d.hasOwnProperty(le)||At(r,s,le,null,d,de)}}for(var ne in d){var le=d[ne];if(de=c[ne],d.hasOwnProperty(ne)&&(le!=null||de!=null))switch(ne){case"type":v=le;break;case"name":g=le;break;case"checked":ee=le;break;case"defaultChecked":ce=le;break;case"value":w=le;break;case"defaultValue":T=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,s));break;default:le!==de&&At(r,s,ne,le,d,de)}}Fs(r,w,T,U,ee,ce,v,g);return;case"select":le=w=T=ne=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":le=U;default:d.hasOwnProperty(v)||At(r,s,v,null,d,U)}for(g in d)if(v=d[g],U=c[g],d.hasOwnProperty(g)&&(v!=null||U!=null))switch(g){case"value":ne=v;break;case"defaultValue":T=v;break;case"multiple":w=v;default:v!==U&&At(r,s,g,v,d,U)}s=T,c=w,d=le,ne!=null?Wi(r,!!c,ne,!1):!!d!=!!c&&(s!=null?Wi(r,!!c,s,!0):Wi(r,!!c,c?[]:"",!1));return;case"textarea":le=ne=null;for(T in c)if(g=c[T],c.hasOwnProperty(T)&&g!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:At(r,s,T,null,d,g)}for(w in d)if(g=d[w],v=c[w],d.hasOwnProperty(w)&&(g!=null||v!=null))switch(w){case"value":ne=g;break;case"defaultValue":le=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==v&&At(r,s,w,g,d,v)}La(r,ne,le);return;case"option":for(var Ae in c)if(ne=c[Ae],c.hasOwnProperty(Ae)&&ne!=null&&!d.hasOwnProperty(Ae))switch(Ae){case"selected":r.selected=!1;break;default:At(r,s,Ae,null,d,ne)}for(U in d)if(ne=d[U],le=c[U],d.hasOwnProperty(U)&&ne!==le&&(ne!=null||le!=null))switch(U){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:At(r,s,U,ne,d,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in c)ne=c[Ue],c.hasOwnProperty(Ue)&&ne!=null&&!d.hasOwnProperty(Ue)&&At(r,s,Ue,null,d,ne);for(ee in d)if(ne=d[ee],le=c[ee],d.hasOwnProperty(ee)&&ne!==le&&(ne!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,s));break;default:At(r,s,ee,ne,d,le)}return;default:if(Da(s)){for(var Mt in c)ne=c[Mt],c.hasOwnProperty(Mt)&&ne!==void 0&&!d.hasOwnProperty(Mt)&&dp(r,s,Mt,void 0,d,ne);for(ce in d)ne=d[ce],le=c[ce],!d.hasOwnProperty(ce)||ne===le||ne===void 0&&le===void 0||dp(r,s,ce,ne,d,le);return}}for(var X in c)ne=c[X],c.hasOwnProperty(X)&&ne!=null&&!d.hasOwnProperty(X)&&At(r,s,X,null,d,ne);for(de in d)ne=d[de],le=c[de],!d.hasOwnProperty(de)||ne===le||ne==null&&le==null||At(r,s,de,ne,d,le)}function z1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function kj(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var g=c[d],v=g.transferSize,w=g.initiatorType,T=g.duration;if(v&&T&&z1(w)){for(w=0,T=g.responseEnd,d+=1;d<c.length;d++){var U=c[d],ee=U.startTime;if(ee>T)break;var ce=U.transferSize,de=U.initiatorType;ce&&z1(de)&&(U=U.responseEnd,w+=ce*(U<T?1:(T-ee)/(U-ee)))}if(--d,s+=8*(v+w)/(g.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var fp=null,hp=null;function Hu(r){return r.nodeType===9?r:r.ownerDocument}function O1(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 B1(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function pp(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var mp=null;function jj(){var r=window.event;return r&&r.type==="popstate"?r===mp?!1:(mp=r,!0):(mp=null,!1)}var P1=typeof setTimeout=="function"?setTimeout:void 0,Nj=typeof clearTimeout=="function"?clearTimeout:void 0,$1=typeof Promise=="function"?Promise:void 0,Cj=typeof queueMicrotask=="function"?queueMicrotask:typeof $1<"u"?function(r){return $1.resolve(null).then(r).catch(Ej)}:P1;function Ej(r){setTimeout(function(){throw r})}function xs(r){return r==="head"}function F1(r,s){var c=s,d=0;do{var g=c.nextSibling;if(r.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(g),hl(s);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Ao(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,Ao(c);for(var v=c.firstChild;v;){var w=v.nextSibling,T=v.nodeName;v[Xr]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=w}}else c==="body"&&Ao(r.ownerDocument.body);c=g}while(c);hl(s)}function U1(r,s){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function gp(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":gp(c),Yi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function Tj(r,s,c,d){for(;r.nodeType===1;){var g=c;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Xr])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==g.rel||r.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||r.getAttribute("title")!==(g.title==null?null:g.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(g.src==null?null:g.src)||r.getAttribute("type")!==(g.type==null?null:g.type)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Rr(r.nextSibling),r===null)break}return null}function Aj(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Rr(r.nextSibling),r===null))return null;return r}function I1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=Rr(r.nextSibling),r===null))return null;return r}function xp(r){return r.data==="$?"||r.data==="$~"}function vp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Mj(r,s){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||c.readyState!=="loading")s();else{var d=function(){s(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Rr(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var bp=null;function H1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return Rr(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function q1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return r;s--}else c!=="/$"&&c!=="/&"||s++}r=r.previousSibling}return null}function V1(r,s,c){switch(s=Hu(c),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function Ao(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Yi(r)}var Lr=new Map,G1=new Set;function qu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ai=$.d;$.d={f:Rj,r:Lj,D:Dj,C:zj,L:Oj,m:Bj,X:$j,S:Pj,M:Fj};function Rj(){var r=Ai.f(),s=zu();return r||s}function Lj(r){var s=qn(r);s!==null&&s.tag===5&&s.type==="form"?cv(s):Ai.r(r)}var ul=typeof document>"u"?null:document;function Y1(r,s,c){var d=ul;if(d&&typeof s=="string"&&s){var g=ln(s);g='link[rel="'+r+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),G1.has(g)||(G1.add(g),r={rel:r,crossOrigin:c,href:s},d.querySelector(g)===null&&(s=d.createElement("link"),Nn(s,"link",r),en(s),d.head.appendChild(s)))}}function Dj(r){Ai.D(r),Y1("dns-prefetch",r,null)}function zj(r,s){Ai.C(r,s),Y1("preconnect",r,s)}function Oj(r,s,c){Ai.L(r,s,c);var d=ul;if(d&&r&&s){var g='link[rel="preload"][as="'+ln(s)+'"]';s==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+ln(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+ln(c.imageSizes)+'"]')):g+='[href="'+ln(r)+'"]';var v=g;switch(s){case"style":v=dl(r);break;case"script":v=fl(r)}Lr.has(v)||(r=x({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Lr.set(v,r),d.querySelector(g)!==null||s==="style"&&d.querySelector(Mo(v))||s==="script"&&d.querySelector(Ro(v))||(s=d.createElement("link"),Nn(s,"link",r),en(s),d.head.appendChild(s)))}}function Bj(r,s){Ai.m(r,s);var c=ul;if(c&&r){var d=s&&typeof s.as=="string"?s.as:"script",g='link[rel="modulepreload"][as="'+ln(d)+'"][href="'+ln(r)+'"]',v=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=fl(r)}if(!Lr.has(v)&&(r=x({rel:"modulepreload",href:r},s),Lr.set(v,r),c.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ro(v)))return}d=c.createElement("link"),Nn(d,"link",r),en(d),c.head.appendChild(d)}}}function Pj(r,s,c){Ai.S(r,s,c);var d=ul;if(d&&r){var g=Kr(d).hoistableStyles,v=dl(r);s=s||"default";var w=g.get(v);if(!w){var T={loading:0,preload:null};if(w=d.querySelector(Mo(v)))T.loading=5;else{r=x({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Lr.get(v))&&yp(r,c);var U=w=d.createElement("link");en(U),Nn(U,"link",r),U._p=new Promise(function(ee,ce){U.onload=ee,U.onerror=ce}),U.addEventListener("load",function(){T.loading|=1}),U.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Vu(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:T},g.set(v,w)}}}function $j(r,s){Ai.X(r,s);var c=ul;if(c&&r){var d=Kr(c).hoistableScripts,g=fl(r),v=d.get(g);v||(v=c.querySelector(Ro(g)),v||(r=x({src:r,async:!0},s),(s=Lr.get(g))&&_p(r,s),v=c.createElement("script"),en(v),Nn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function Fj(r,s){Ai.M(r,s);var c=ul;if(c&&r){var d=Kr(c).hoistableScripts,g=fl(r),v=d.get(g);v||(v=c.querySelector(Ro(g)),v||(r=x({src:r,async:!0,type:"module"},s),(s=Lr.get(g))&&_p(r,s),v=c.createElement("script"),en(v),Nn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function Q1(r,s,c,d){var g=(g=Ce.current)?qu(g):null;if(!g)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=dl(c.href),c=Kr(g).hoistableStyles,d=c.get(s),d||(d={type:"style",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=dl(c.href);var v=Kr(g).hoistableStyles,w=v.get(r);if(w||(g=g.ownerDocument||g,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,w),(v=g.querySelector(Mo(r)))&&!v._p&&(w.instance=v,w.state.loading=5),Lr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Lr.set(r,c),v||Uj(g,r,c,w.state))),s&&d===null)throw Error(i(528,""));return w}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=fl(c),c=Kr(g).hoistableScripts,d=c.get(s),d||(d={type:"script",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function dl(r){return'href="'+ln(r)+'"'}function Mo(r){return'link[rel="stylesheet"]['+r+"]"}function W1(r){return x({},r,{"data-precedence":r.precedence,precedence:null})}function Uj(r,s,c,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),Nn(s,"link",c),en(s),r.head.appendChild(s))}function fl(r){return'[src="'+ln(r)+'"]'}function Ro(r){return"script[async]"+r}function X1(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+ln(c.href)+'"]');if(d)return s.instance=d,en(d),d;var g=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),en(d),Nn(d,"style",g),Vu(d,c.precedence,r),s.instance=d;case"stylesheet":g=dl(c.href);var v=r.querySelector(Mo(g));if(v)return s.state.loading|=4,s.instance=v,en(v),v;d=W1(c),(g=Lr.get(g))&&yp(d,g),v=(r.ownerDocument||r).createElement("link"),en(v);var w=v;return w._p=new Promise(function(T,U){w.onload=T,w.onerror=U}),Nn(v,"link",d),s.state.loading|=4,Vu(v,c.precedence,r),s.instance=v;case"script":return v=fl(c.src),(g=r.querySelector(Ro(v)))?(s.instance=g,en(g),g):(d=c,(g=Lr.get(v))&&(d=x({},c),_p(d,g)),r=r.ownerDocument||r,g=r.createElement("script"),en(g),Nn(g,"link",d),r.head.appendChild(g),s.instance=g);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Vu(d,c.precedence,r));return s.instance}function Vu(r,s,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,v=g,w=0;w<d.length;w++){var T=d[w];if(T.dataset.precedence===s)v=T;else if(v!==g)break}v?v.parentNode.insertBefore(r,v.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(r,s.firstChild))}function yp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function _p(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Gu=null;function K1(r,s,c){if(Gu===null){var d=new Map,g=Gu=new Map;g.set(c,d)}else g=Gu,d=g.get(c),d||(d=new Map,g.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),g=0;g<c.length;g++){var v=c[g];if(!(v[Xr]||v[Xt]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var w=v.getAttribute(s)||"";w=r+w;var T=d.get(w);T?T.push(v):d.set(w,[v])}}return d}function Z1(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function Ij(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function J1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Hj(r,s,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=dl(d.href),v=s.querySelector(Mo(g));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Yu.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=v,en(v);return}v=s.ownerDocument||s,d=W1(d),(g=Lr.get(g))&&yp(d,g),v=v.createElement("link"),en(v);var w=v;w._p=new Promise(function(T,U){w.onload=T,w.onerror=U}),Nn(v,"link",d),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=Yu.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var wp=0;function qj(r,s){return r.stylesheets&&r.count===0&&Wu(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&Wu(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+s);0<r.imgBytes&&wp===0&&(wp=62500*kj());var g=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Wu(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>wp?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function Yu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Qu=null;function Wu(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Qu=new Map,s.forEach(Vj,r),Qu=null,Yu.call(r))}function Vj(r,s){if(!(s.state.loading&4)){var c=Qu.get(r);if(c)var d=c.get(null);else{c=new Map,Qu.set(r,c);for(var g=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var w=g[v];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}g=s.instance,w=g.getAttribute("data-precedence"),v=c.get(w)||d,v===d&&c.set(null,g),c.set(w,g),this.count++,d=Yu.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),v?v.parentNode.insertBefore(g,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(g,r.firstChild)),s.state.loading|=4}}var Lo={$$typeof:C,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function Gj(r,s,c,d,g,v,w,T,U){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tn(0),this.hiddenUpdates=Tn(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function eb(r,s,c,d,g,v,w,T,U,ee,ce,de){return r=new Gj(r,s,c,w,U,ee,ce,de,T),s=1,v===!0&&(s|=24),v=lr(3,null,null,s),r.current=v,v.stateNode=r,s=th(),s.refCount++,r.pooledCache=s,s.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:s},sh(v),r}function tb(r){return r?(r=Ha,r):Ha}function nb(r,s,c,d,g,v){g=tb(g),d.context===null?d.context=g:d.pendingContext=g,d=as(s),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=ls(r,d,s),c!==null&&(Kn(c,r,s),uo(c,r,s))}function rb(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function Sp(r,s){rb(r,s),(r=r.alternate)&&rb(r,s)}function ib(r){if(r.tag===13||r.tag===31){var s=Gs(r,67108864);s!==null&&Kn(s,r,67108864),Sp(r,67108864)}}function sb(r){if(r.tag===13||r.tag===31){var s=fr();s=Bn(s);var c=Gs(r,s);c!==null&&Kn(c,r,s),Sp(r,s)}}var Xu=!0;function Yj(r,s,c,d){var g=P.T;P.T=null;var v=$.p;try{$.p=2,kp(r,s,c,d)}finally{$.p=v,P.T=g}}function Qj(r,s,c,d){var g=P.T;P.T=null;var v=$.p;try{$.p=8,kp(r,s,c,d)}finally{$.p=v,P.T=g}}function kp(r,s,c,d){if(Xu){var g=jp(d);if(g===null)up(r,s,d,Ku,c),lb(r,d);else if(Xj(g,r,s,c,d))d.stopPropagation();else if(lb(r,d),s&4&&-1<Wj.indexOf(r)){for(;g!==null;){var v=qn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var w=ge(v.pendingLanes);if(w!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var U=1<<31-et(w);T.entanglements[1]|=U,w&=~U}ii(v),(wt&6)===0&&(Lu=Te()+500,Co(0))}}break;case 31:case 13:T=Gs(v,2),T!==null&&Kn(T,v,2),zu(),Sp(v,2)}if(v=jp(d),v===null&&up(r,s,d,Ku,c),v===g)break;g=v}g!==null&&d.stopPropagation()}else up(r,s,d,null,c)}}function jp(r){return r=Oa(r),Np(r)}var Ku=null;function Np(r){if(Ku=null,r=pi(r),r!==null){var s=o(r);if(s===null)r=null;else{var c=s.tag;if(c===13){if(r=u(s),r!==null)return r;r=null}else if(c===31){if(r=f(s),r!==null)return r;r=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Ku=r,null}function ab(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($r()){case oe:return 2;case we:return 8;case W:case me:return 32;case Re:return 268435456;default:return 32}default:return 32}}var Cp=!1,vs=null,bs=null,ys=null,Do=new Map,zo=new Map,_s=[],Wj="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 lb(r,s){switch(r){case"focusin":case"focusout":vs=null;break;case"dragenter":case"dragleave":bs=null;break;case"mouseover":case"mouseout":ys=null;break;case"pointerover":case"pointerout":Do.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":zo.delete(s.pointerId)}}function Oo(r,s,c,d,g,v){return r===null||r.nativeEvent!==v?(r={blockedOn:s,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[g]},s!==null&&(s=qn(s),s!==null&&ib(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,g!==null&&s.indexOf(g)===-1&&s.push(g),r)}function Xj(r,s,c,d,g){switch(s){case"focusin":return vs=Oo(vs,r,s,c,d,g),!0;case"dragenter":return bs=Oo(bs,r,s,c,d,g),!0;case"mouseover":return ys=Oo(ys,r,s,c,d,g),!0;case"pointerover":var v=g.pointerId;return Do.set(v,Oo(Do.get(v)||null,r,s,c,d,g)),!0;case"gotpointercapture":return v=g.pointerId,zo.set(v,Oo(zo.get(v)||null,r,s,c,d,g)),!0}return!1}function ob(r){var s=pi(r.target);if(s!==null){var c=o(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){r.blockedOn=s,ql(r.priority,function(){sb(c)});return}}else if(s===31){if(s=f(c),s!==null){r.blockedOn=s,ql(r.priority,function(){sb(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Zu(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=jp(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);Ki=d,c.target.dispatchEvent(d),Ki=null}else return s=qn(c),s!==null&&ib(s),r.blockedOn=c,!1;s.shift()}return!0}function cb(r,s,c){Zu(r)&&c.delete(s)}function Kj(){Cp=!1,vs!==null&&Zu(vs)&&(vs=null),bs!==null&&Zu(bs)&&(bs=null),ys!==null&&Zu(ys)&&(ys=null),Do.forEach(cb),zo.forEach(cb)}function Ju(r,s){r.blockedOn===s&&(r.blockedOn=null,Cp||(Cp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Kj)))}var ed=null;function ub(r){ed!==r&&(ed=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ed===r&&(ed=null);for(var s=0;s<r.length;s+=3){var c=r[s],d=r[s+1],g=r[s+2];if(typeof d!="function"){if(Np(d||c)===null)continue;break}var v=qn(c);v!==null&&(r.splice(s,3),s-=3,jh(v,{pending:!0,data:g,method:c.method,action:d},d,g))}}))}function hl(r){function s(U){return Ju(U,r)}vs!==null&&Ju(vs,r),bs!==null&&Ju(bs,r),ys!==null&&Ju(ys,r),Do.forEach(s),zo.forEach(s);for(var c=0;c<_s.length;c++){var d=_s[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<_s.length&&(c=_s[0],c.blockedOn===null);)ob(c),c.blockedOn===null&&_s.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var g=c[d],v=c[d+1],w=g[wn]||null;if(typeof v=="function")w||ub(c);else if(w){var T=null;if(v&&v.hasAttribute("formAction")){if(g=v,w=v[wn]||null)T=w.formAction;else if(Np(g)!==null)continue}else T=w.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),ub(c)}}}function db(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(w){return g=w})},focusReset:"manual",scroll:"manual"})}function s(){g!==null&&(g(),g=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),g!==null&&(g(),g=null)}}}function Ep(r){this._internalRoot=r}td.prototype.render=Ep.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var c=s.current,d=fr();nb(c,d,r,s,null,null)},td.prototype.unmount=Ep.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;nb(r.current,2,null,r,null,null),zu(),s[sr]=null}};function td(r){this._internalRoot=r}td.prototype.unstable_scheduleHydration=function(r){if(r){var s=Hl();r={blockedOn:null,target:r,priority:s};for(var c=0;c<_s.length&&s!==0&&s<_s[c].priority;c++);_s.splice(c,0,r),c===0&&ob(r)}};var fb=t.version;if(fb!=="19.2.8")throw Error(i(527,fb,"19.2.8"));$.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(s),r=r!==null?m(r):null,r=r===null?null:r.stateNode,r};var Zj={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nd.isDisabled&&nd.supportsFiber)try{it=nd.inject(Zj),St=nd}catch{}}return Po.createRoot=function(r,s){if(!a(r))throw Error(i(299));var c=!1,d="",g=bv,v=yv,w=_v;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(g=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=eb(r,1,!1,null,null,c,d,null,g,v,w,db),r[sr]=s.current,cp(r),new Ep(s)},Po.hydrateRoot=function(r,s,c){if(!a(r))throw Error(i(299));var d=!1,g="",v=bv,w=yv,T=_v,U=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),s=eb(r,1,!0,s,c??null,d,g,U,v,w,T,db),s.context=tb(null),c=s.current,d=fr(),d=Bn(d),g=as(d),g.callback=null,ls(c,g,d),c=d,s.current.lanes=c,Ft(s,c),ii(s),r[sr]=s.current,cp(r),new td(s)},Po.version="19.2.8",Po}var kb;function dN(){if(kb)return Mp.exports;kb=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(),Mp.exports=uN(),Mp.exports}var fN=dN();const jb=e=>{let t;const n=new Set,i=(p,m)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const b=t;t=m??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,f={setState:i,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,a,f);return f},hN=(e=>e?jb(e):jb),pN=e=>e;function mN(e,t=pN){const n=rd.useSyncExternalStore(e.subscribe,rd.useCallback(()=>t(e.getState()),[e,t]),rd.useCallback(()=>t(e.getInitialState()),[e,t]));return rd.useDebugValue(n),n}const Nb=e=>{const t=hN(e),n=i=>mN(t,i);return Object.assign(n,t),n},gN=(e=>e?Nb(e):Nb),Pm="companion_auth_token";function Cb(){return typeof window>"u"?null:localStorage.getItem(Pm)||null}const xN=e=>({authToken:Cb(),isAuthenticated:Cb()!==null,setAuthToken:t=>{localStorage.setItem(Pm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(Pm),e({authToken:null,isAuthenticated:!1})}});function Gt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function vN(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function bN(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function yN(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function _N(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const wN=e=>({sessions:new Map,sdkSessions:[],currentSessionId:yN(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:bN(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:_N(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=Gt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Gt(n.sessions,t),connectionStatus:Gt(n.connectionStatus,t),cliConnected:Gt(n.cliConnected,t),cliReconnecting:Gt(n.cliReconnecting,t),sessionStatus:Gt(n.sessionStatus,t),previousPermissionMode:Gt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:vN(n.recentlyRenamed,t),mcpServers:Gt(n.mcpServers,t),rateLimit:Gt(n.rateLimit,t),prStatus:Gt(n.prStatus,t),linkedLinearIssues:Gt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Gt(n.messages,t),streaming:Gt(n.streaming,t),streamingStartedAt:Gt(n.streamingStartedAt,t),streamingOutputTokens:Gt(n.streamingOutputTokens,t),pendingPermissions:Gt(n.pendingPermissions,t),aiResolvedPermissions:Gt(n.aiResolvedPermissions,t),sessionTasks:Gt(n.sessionTasks,t),changedFilesTick:Gt(n.changedFilesTick,t),gitChangedFilesCount:Gt(n.gitChangedFilesCount,t),sessionProcesses:Gt(n.sessionProcesses,t),toolProgress:Gt(n.toolProgress,t),toolActivity:Gt(n.toolActivity,t),diffPanelSelectedFile:Gt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Gt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),SN=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),kN=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),jN=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=o[u];o[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:o}})}),Vi=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],NN=Vi.map(e=>e.id),k5="cc-task-panel-config";function $m(){return{order:[...NN],enabled:Object.fromEntries(Vi.map(e=>[e.id,!0]))}}function CN(){if(typeof window>"u")return $m();try{const e=localStorage.getItem(k5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of Vi)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(Vi.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return $m()}function id(e){try{localStorage.setItem(k5,JSON.stringify(e))}catch{}}function EN(){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 TN(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function AN(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function j5(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}function MN(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const RN=e=>({darkMode:EN(),notificationSound:TN(),notificationDesktop:AN(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:CN(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:j5(),density:MN(),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}),setMagicUiAvailable:t=>e({magicUiAvailable:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return id(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const o={...n.taskPanelConfig,order:i};return id(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return id(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=$m();id(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})},setDensity:t=>{typeof window<"u"&&localStorage.setItem("cc-density",t),e({density:t})},toggleDensity:()=>e(t=>{const n=t.density==="compact"?"standard":"compact";return typeof window<"u"&&localStorage.setItem("cc-density",n),{density:n}})});function N5(){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 LN=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:N5(),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(m=>m.cwd===t.cwd&&m.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,f=i?o+1:o,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function DN(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const zN=e=>({updateInfo:null,updateDismissedVersion:DN(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),ON=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(i=>{const a=i.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(i.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const i=new Map(n.magicUiState);return i.delete(t),{magicUiState:i}})}),Y=gN((...e)=>({...xN(...e),...wN(...e),...SN(...e),...kN(...e),...jN(...e),...RN(...e),...LN(...e),...zN(...e),...ON(...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,magicUiState: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:j5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:N5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),BN=Object.freeze(Object.defineProperty({__proto__:null,useStore:Y},Symbol.toStringTag,{value:"Module"})),PN="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",$N=/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 FN(e){return $N.test(e)}function UN(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:FN(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const Eb=["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"],Tb=["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 Ab(){const e=Eb[Math.floor(Math.random()*Eb.length)],t=Tb[Math.floor(Math.random()*Tb.length)];return`${e} ${t}`}function C5(e){for(let t=0;t<100;t++){const n=Ab();if(!e.has(n))return n}return Ab()}let zp=null;function IN(){return zp||(zp=new AudioContext),zp}function HN(){try{const e=IN();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class E5{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(o,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=E=>{if(E=this.postProcess(E,i),a){setTimeout(function(){a(E)},0);return}else return E},f=n.length,h=t.length;let p=1,m=f+h;i.maxEditLength!=null&&(m=Math.min(m,i.maxEditLength));const x=(o=i.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const k=()=>{for(let E=Math.max(j,-p);E<=Math.min(N,p);E+=2){let C;const O=y[E-1],z=y[E+1];O&&(y[E-1]=void 0);let L=!1;if(z){const F=z.oldPos-E;L=z&&0<=F&&F<f}const V=O&&O.oldPos+1<h;if(!L&&!V){y[E]=void 0;continue}if(!V||L&&O.oldPos<z.oldPos?C=this.addToPath(z,!0,!1,0,i):C=this.addToPath(O,!1,!0,1,i),_=this.extractCommon(C,n,t,E,i),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;y[E]=C,C.oldPos+1>=h&&(N=Math.min(N,E-1)),_+1>=f&&(j=Math.max(j,E+1))}p++};if(a)(function E(){setTimeout(function(){if(p>m||Date.now()>b)return a(void 0);k()||E()},0)})();else for(;p<=m&&Date.now()<=b;){const E=k();if(E)return E}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,f=i.length;let h=t.oldPos,p=h-a,m=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],o);)p++,h++,m++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!o.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let f=0,h=0,p=0;for(;f<u;f++){const m=a[f];if(m.removed)m.value=this.join(i.slice(p,p+m.count)),p+=m.count;else{if(!m.added&&this.useLongestToken){let x=n.slice(h,h+m.count);x=x.map(function(b,y){const _=i[p+y];return _.length>b.length?_:b}),m.value=this.join(x)}else m.value=this.join(n.slice(h,h+m.count));h+=m.count,m.added||(p+=m.count)}}return a}}function Mb(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 Rb(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 Fm(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 Um(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 $o(e,t){return Fm(e,t,"")}function sd(e,t){return Um(e,t,"")}function Lb(e,t){return t.slice(0,qN(e,t))}function qN(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function T5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Im(e,t){if(t)return cc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function yl(e,t){if(t)return cc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function cc(e,t){if(!t)return[yl(e),Im(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=T5(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const Db="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}",VN=new RegExp(`[${Db}]+|\\s+|[^${Db}]`,"ug");class GN extends E5{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=T5(t,u)}else i=t.match(VN)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&zb(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&zb(i,o,a,null,n.intlSegmenter),t}}const YN=new GN;function QN(e,t,n){return YN.diff(e,t,n)}function zb(e,t,n,i,a){if(t&&n){const[o,u]=cc(t.value,a),[f,h]=cc(n.value,a);if(e){const p=Mb(o,f);e.value=Um(e.value,f,p),t.value=$o(t.value,p),n.value=$o(n.value,p)}if(i){const p=Rb(u,h);i.value=Fm(i.value,h,p),t.value=sd(t.value,p),n.value=sd(n.value,p)}}else if(n){if(e){const o=yl(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=yl(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=yl(i.value,a),[u,f]=cc(t.value,a),h=Mb(o,u);t.value=$o(t.value,h);const p=Rb($o(o,h),f);t.value=sd(t.value,p),i.value=Fm(i.value,o,p),e.value=Um(e.value,o,o.slice(0,o.length-p.length))}else if(i){const o=yl(i.value,a),u=Im(t.value,a),f=Lb(u,o);t.value=sd(t.value,f)}else if(e){const o=Im(e.value,a),u=yl(t.value,a),f=Lb(o,u);t.value=$o(t.value,f)}}class WN extends E5{constructor(){super(...arguments),this.tokenize=KN}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
51
|
-
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
52
|
-
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
53
|
-
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
54
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const XN=new WN;function Ob(e,t,n){return XN.diff(e,t,n)}function KN(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
55
|
-
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let a=0;a<i.length;a++){const o=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function ZN(e,t,n,i,a,o,u){let f;u?typeof u=="function"?f={callback:u}:f=u:f={},typeof f.context>"u"&&(f.context=4);const h=f.context;if(f.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(f.callback){const{callback:m}=f;Ob(n,i,Object.assign(Object.assign({},f),{callback:x=>{const b=p(x);m(b)}}))}else return p(Ob(n,i,f));function p(m){if(!m)return;m.push({value:"",lines:[]});function x(E){return E.map(function(C){return" "+C})}const b=[];let y=0,_=0,j=[],N=1,k=1;for(let E=0;E<m.length;E++){const C=m[E],O=C.lines||JN(C.value);if(C.lines=O,C.added||C.removed){if(!y){const z=m[E-1];y=N,_=k,z&&(j=h>0?x(z.lines.slice(-h)):[],y-=j.length,_-=j.length)}for(const z of O)j.push((C.added?"+":"-")+z);C.added?k+=O.length:N+=O.length}else{if(y)if(O.length<=h*2&&E<m.length-2)for(const z of x(O))j.push(z);else{const z=Math.min(O.length,h);for(const V of x(O.slice(0,z)))j.push(V);const L={oldStart:y,oldLines:N-y+z,newStart:_,newLines:k-_+z,lines:j};b.push(L),y=0,_=0,j=[]}N+=O.length,k+=O.length}}for(const E of b)for(let C=0;C<E.lines.length;C++)E.lines[C].endsWith(`
|
|
56
|
-
`)?E.lines[C]=E.lines[C].slice(0,-1):(E.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:o,hunks:b}}}function JN(e){const t=e.endsWith(`
|
|
57
|
-
`),n=e.split(`
|
|
58
|
-
`).map(i=>i+`
|
|
59
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function eC(e,t){return ZN("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,o=[];let u=i.oldStart,f=i.newStart;for(const h of i.lines){const p=h[0],m=h.slice(1);p==="-"?o.push({type:"del",content:m,oldLineNo:u++}):p==="+"?o.push({type:"add",content:m,newLineNo:f++}):o.push({type:"context",content:m,oldLineNo:u++,newLineNo:f++})}return A5(o),{header:a,lines:o}})}function tC(e){const t=[],n=e.split(`
|
|
60
|
-
`);let i=null,a=null,o=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){a&&i&&i.hunks.push(a),i&&t.push(i),i={fileName:"",hunks:[]},a=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){i&&(i.fileName=f.slice(6));continue}if(f.startsWith("+++ /dev/null")||f.startsWith("index ")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from")||f.startsWith("rename to")||f.startsWith("similarity index")||f.startsWith("Binary files"))continue;const h=f.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(h){a&&i&&i.hunks.push(a),o=parseInt(h[1],10),u=parseInt(h[2],10),a={header:f,lines:[]};continue}a&&(f.startsWith("+")?a.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?a.lines.push({type:"del",content:f.slice(1),oldLineNo:o++}):f.startsWith(" ")&&a.lines.push({type:"context",content:f.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const f of t)for(const h of f.hunks)A5(h.lines);return t}function A5(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=i-n,f=o-a;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const m=e[n+p],x=e[a+p],b=QN(m.content,x.content);m.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),x.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function nC({line:e}){return e.wordChanges?l.jsx(l.Fragment,{children:e.wordChanges.map((t,n)=>t.added?l.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?l.jsx("span",{className:"diff-word-del",children:t.value},n):l.jsx("span",{children:t.value},n))}):l.jsx(l.Fragment,{children:e.content})}function rC({hunk:e,showLineNumbers:t}){return l.jsxs("div",{className:"diff-hunk",children:[l.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>l.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),l.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),l.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),l.jsxs("span",{className:"diff-content",children:[l.jsx(nC,{line:n}),!n.content&&" "]})]},i))]})}function iC({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return l.jsxs("div",{className:"diff-file-header",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&l.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function Bl({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const o=a==="compact",u=!o,f=S.useMemo(()=>{if(n)return tC(n);const h=e??"",p=t??"";if(!h&&!p)return[];const m=eC(h,p);return[{fileName:i||"",hunks:m}]},[e,t,n,i]);return f.length===0||f.every(h=>h.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${o?"diff-compact":"diff-full"}`,children:f.map((h,p)=>l.jsxs("div",{className:"diff-file",children:[(h.fileName||i)&&l.jsx(iC,{fileName:h.fileName||i||""}),h.hunks.map((m,x)=>l.jsx(rC,{hunk:m,showLineNumbers:u},x))]},p))})}const M5=S.createContext(null);function rz({value:e,children:t}){return l.jsx(M5.Provider,{value:e,children:t})}function sC(){const e=S.useContext(M5),t=Y(n=>n.density);return e??t}function Pl(){return sC()==="compact"}function bf({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:o=""}){return l.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${e?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),n&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-muted/40 select-none shrink-0",children:n}),l.jsx("span",{className:`text-[11px] text-cc-muted/60 group-hover:text-cc-muted truncate min-w-0 ${o}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const aC={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 Dc(e){return aC[e]||"tool"}function Ts(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 R5({name:e,input:t,toolUseId:n}){const[i,a]=S.useState(e==="Edit"),o=Dc(e),u=Ts(e),f=_c(e,t);return e==="Edit"?l.jsx(lC,{input:t,toolUseId:n}):e==="Bash"?l.jsx(oC,{input:t,toolUseId:n}):l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[l.jsxs("button",{onClick:()=>a(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(El,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),i&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(cC,{name:e,input:t})})})]})}function lC({input:e,toolUseId:t}){const n=Pl(),[i,a]=S.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",f=String(e.old_string||""),h=String(e.new_string||""),p=!!(f||h),m=!!e.replace_all,[x,b]=S.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(E=>({path:typeof E.path=="string"?E.path:"",kind:typeof E.kind=="string"?E.kind:"update"})).filter(E=>E.path),j=(f+h).split(`
|
|
61
|
-
`).length,N=j>15,k=l.jsx(l.Fragment,{children:p?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!x?"max-h-[240px]":""}`,children:l.jsx(Bl,{oldText:f,newText:h,mode:"compact"})}),N&&!x&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),N&&l.jsx("button",{type:"button",onClick:()=>b(!x),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:x?"Show less":`Show all ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((E,C)=>{const O=E.path.split("/").pop()||E.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${E.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":E.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:E.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:O})]},`${E.path}-${C}`)})}):l.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})});return n?l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(bf,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${m?" (all)":""}`,meta:p?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),i&&l.jsx("div",{className:"mt-0.5",children:k})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),m&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),k]})}function oC({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=Pl(),[o,u]=S.useState(!1);if(a){const f=n.split(`
|
|
62
|
-
`)[0]||"",h=i||f||"Command",p=n?n.split(`
|
|
63
|
-
`).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(bf,{open:o,onToggle:()=>u(!o),marker:"$",label:h,meta:!o&&p>0?`+${p}`:void 0,labelClassName:i?"italic":"font-mono-code"}),o&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function cC({name:e,input:t}){switch(e){case"Bash":return l.jsx(uC,{input:t});case"Edit":return l.jsx(dC,{input:t});case"Write":return l.jsx(fC,{input:t});case"Read":return l.jsx(hC,{input:t});case"Glob":return l.jsx(pC,{input:t});case"Grep":return l.jsx(mC,{input:t});case"WebSearch":case"web_search":return l.jsx(gC,{input:t});case"WebFetch":return l.jsx(xC,{input:t});case"Task":return l.jsx(vC,{input:t});case"TodoWrite":return l.jsx(bC,{input:t});case"NotebookEdit":return l.jsx(yC,{input:t});case"SendMessage":return l.jsx(_C,{input:t});default:return l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function uC({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function dC({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),o=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?l.jsx(Bl,{oldText:n,newText:i,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,f)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function fC({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Bl,{newText:n,fileName:t,mode:"compact"})}function hC({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),i!=null&&l.jsxs("span",{children:["limit: ",i]})]})]})}function pC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function mC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function gC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function xC({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function vC({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function bC({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function yC({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),i&&l.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function _C({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function _c(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+i;return a.length>60?a.slice(0,60)+"...":a}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function El({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const wC=2e3,SC=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),Yr=new Map,qi=new Map,$d=new Map,Nd=new Map,Cs=new Map,uc=new Map,wc=new Map,Fd=new Map;function L5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function D5(e){const t=Y.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function kC(){const e=Y.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 Sc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){Sc=!0;for(const[e,t]of qi)clearTimeout(t),qi.delete(e)}else{Sc=!1;for(const e of kC()){if(!D5(e))continue;const t=Yr.get(e);if(!L5(t)){if(t){try{t.close()}catch{}Yr.delete(e)}zc(e)}}}});function Cd(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const a of n)if(!(!a||a===".")){if(a===".."){i.length>0&&i.pop();continue}i.push(a)}return`${t?"/":""}${i.join("/")}`}function jC(e,t){return e.startsWith("/")||!t?Cd(e):Cd(`${t}/${e}`)}function NC(e,t){if(!t)return!0;const n=Cd(t);return e===n||e.startsWith(`${n}/`)}function CC(e){let t=Fd.get(e);return t||(t=new Set,Fd.set(e,t)),t}function Op(e,t){const n=Y.getState(),i=CC(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:f}=a;if(f){if(i.has(f))continue;i.add(f)}if(o==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((m,x)=>({id:String(x+1),subject:m.content||"Task",description:"",activeForm:m.activeForm,status:m.status||"pending"}));n.setTasks(e,p),Nd.set(e,p.length)}continue}if(o==="TaskCreate"){const h=(Nd.get(e)||0)+1;Nd.set(e,h);const p={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const h=u.taskId;if(h){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,h,p)}}}}function Bp(e,t){var o,u;const n=Y.getState(),i=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:p}=f;if((h==="Edit"||h==="Write")&&typeof p.file_path=="string"){const m=jC(p.file_path,i);NC(m,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const ec=new Map,EC=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function Pp(e,t){const n=Y.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const a=i.input;if(a.run_in_background===!0){let o=ec.get(e);o||(o=new Map,ec.set(e,o)),o.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,o=ec.get(e),u=o==null?void 0:o.get(a);if(o&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(EC);if(h){const p={taskId:h[1],toolUseId:a,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&ec.delete(e)}}}}const ad=new Map,Ud=new Map;function $p(e,t){const n=Y.getState();let i=Ud.get(e);i||(i=new Set,Ud.set(e,i));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&i.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&i.add(a.id);let u=ad.get(e);u||(u=new Map,ad.set(e,u));const f={toolUseId:a.id,name:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=ad.get(e),f=u==null?void 0:u.get(o);if(u&&f){const h=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(m=>"text"in m?m.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(o),u.size===0&&ad.delete(e)}}}}function Bb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function Pb(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 TC=0,AC=0;function li(){return`msg-${Date.now()}-${++TC}`}function $b(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 UN(e)?`${PN}
|
|
64
|
-
|
|
65
|
-
Details: ${t}`:`Error: ${t}`}function MC(e,t){const n=wc.get(e)||[];n.push(t),wc.set(e,n)}function RC(e,t){const n=wc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){wc.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const Di=new Map;function Fb(e,t,n){const i=Y.getState(),a=i.messages.get(e)||[],o=uc.get(e);let u=a.filter(h=>!h.isStreaming||h.id===o),f=-1;if(o&&(f=u.findIndex(h=>h.id===o),f===-1&&uc.delete(e)),f===-1){const h=`stream-${e}-${li()}`;uc.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function Ss(e){uc.delete(e);const t=Y.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const Ub=new Map,LC=8e3;function pl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=Ub.get(e);a&&a.code===t&&i-a.at<LC||(Ub.set(e,{code:t,at:i}),Y.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function z5(){return`cmsg-${Date.now()}-${++AC}`}function Hm(){return z5()}const DC=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","set_magic_ui"]);function zC(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 O5(e){return`companion:last-seq:${e}`}function qm(e){const t=$d.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(O5(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return $d.set(e,a),a}catch{return 0}}function Ib(e,t){const n=Math.max(0,Math.floor(t));$d.set(e,n);try{localStorage.setItem(O5(e),String(n))}catch{}}function Hb(e,t){Cn(e,{type:"session_ack",last_seq:t})}function Ed(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
-
`)}function Fp(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 OC(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const f of i)a.set(Fp(f),f);const o=[],u=new Set;for(const f of n){const h=Fp(f);u.has(h)||(u.add(h),o.push(a.get(h)||f))}for(const f of i){const h=Fp(f);u.has(h)||(u.add(h),o.push(f))}return o}function qb(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:_c(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function Vm(e,t){const n=OC(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Ed(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function BC(e,t){const n=Y.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...i];o[a]=Vm(o[a],t),n.setMessages(e,o)}function PC(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=Y.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),B5(e,n)}function B5(e,t,n={}){var u,f,h,p,m,x;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=Y.getState();if(i&&typeof t.seq=="number"){const b=qm(e);if(t.seq<=b)return;Ib(e,t.seq),a&&Hb(e,t.seq)}switch(SC.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=C5(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Ss(e),o.setStreaming(e,null),pl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Ed(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=Ed(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(Ss(e),BC(e,_),o.setStreaming(e,null),Cs.delete(e),Di.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(f=b.content)!=null&&f.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,qb(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=b.content)!=null&&h.length&&(Op(e,b.content),Bp(e,b.content),Pp(e,b.content),$p(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(Cs.delete(e),Di.delete(e),Ss(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=Di.get(e)||{thinking:"",text:""};Cs.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Di.set(e,_),Cs.set(e,"text"),o.setStreaming(e,_.text),Fb(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Di.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Di.set(e,_),Cs.set(e,"thinking"),o.setStreaming(e,_.thinking),Fb(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Fd.delete(e),Ud.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}o.updateSession(e,y),Ss(e),o.setStreaming(e,null),Cs.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&HN(),!document.hasFocus()&&o.notificationDesktop&&Bb("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:li(),role:"system",content:$b(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;Bb("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];Op(e,y),Bp(e,y),Pp(e,y),$p(e,y)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:li(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||li(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((m=t.event)==null?void 0:m.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=Pb(t.event);if(!b)break;o.appendMessage(e,{id:li(),role:"system",content:b,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:li(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:li(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Ss(e)?pl(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."}):pl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Ss(e)&&pl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Ss(e)?pl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):pl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const N=t.messages[j];if(N.type==="user_message")b.push({id:N.id||li(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const k=N.message,E=Ed(k.content),C={id:k.id,role:"assistant",content:E,contentBlocks:k.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},O=b.findIndex(z=>z.role==="assistant"&&z.id===C.id);if(O===-1?b.push(C):b[O]=Vm(b[O],C),(x=k.content)!=null&&x.length){Op(e,k.content),Bp(e,k.content),Pp(e,k.content),$p(e,k.content);const z=N.timestamp||Date.now();for(const L of k.content){if(L.type==="tool_use"){const V=L.input||{},F=y.get(L.id);y.set(L.id,F??qb(L.id,L.name,V,z,N.parent_tool_use_id))}if(L.type==="tool_result"){const V=y.get(L.tool_use_id);V&&y.set(L.tool_use_id,{...V,completedAt:z,isError:V.isError||!!L.is_error,elapsedSeconds:Math.max(V.elapsedSeconds,V.completedAt?V.elapsedSeconds:Math.max(0,(z-V.startedAt)/1e3))})}}}}else if(N.type==="result"){const k=N.data;k.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:$b(k),timestamp:Date.now()});const E={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(E.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(E.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const C of Object.values(k.modelUsage))if(C.contextWindow>0){const O=C,z=Math.round((O.inputTokens+O.outputTokens)/O.contextWindow*100);E.context_used_percent=Math.max(0,Math.min(z,100))}}o.updateSession(e,E)}else if(N.type==="system_event"){const k=Pb(N.event);if(!k)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:N.timestamp||Date.now()})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const k of b){const E=N.findIndex(O=>O.id===k.id);if(E===-1){N.push(k);continue}const C=N[E];C.role==="assistant"&&k.role==="assistant"?N[E]=Vm(C,k):N[E]=k}N.sort((k,E)=>(k.timestamp??0)-(E.timestamp??0)),o.setMessages(e,N)}}o.setToolActivity(e,Array.from(y.values()).sort((j,N)=>j.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(Ss(e),o.setStreaming(e,null),Cs.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=qm(e);y.seq<=_||(Ib(e,y.seq),b=y.seq,B5(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&Hb(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:li(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:li(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{o.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function zc(e){const t=Yr.get(e);if(L5(t))return;if(t){try{t.close()}catch{}Yr.delete(e)}Y.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(zC(e));Yr.set(e,i),i.onopen=()=>{const a=qm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),RC(e,i);const o=qi.get(e);o&&(clearTimeout(o),qi.delete(e))},i.onmessage=a=>PC(e,a),i.onclose=()=>{Yr.get(e)===i&&(Yr.delete(e),Y.getState().setConnectionStatus(e,"disconnected"),$C(e))},i.onerror=()=>{i.close()}}function $C(e){if(qi.has(e)||Sc)return;const t=setTimeout(()=>{qi.delete(e),!Sc&&D5(e)&&zc(e)},wC);qi.set(e,t)}function Gm(e){const t=qi.get(e);t&&(clearTimeout(t),qi.delete(e));const n=Yr.get(e);n&&(n.close(),Yr.delete(e)),Y.getState().setConnectionStatus(e,"disconnected"),Fd.delete(e),Ud.delete(e),ec.delete(e),Nd.delete(e),Cs.delete(e),uc.delete(e),Di.delete(e),$d.delete(e),wc.delete(e)}function FC(e){if(!Sc)for(const t of e)t.archived||zc(t.sessionId)}function UC(e){return new Promise((t,n)=>{const i=setInterval(()=>{const o=Yr.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Cn(e,t){const n=Yr.get(e);let i=t;const a=DC.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":case"set_magic_ui":t.client_msg_id||(i={...t,client_msg_id:z5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&MC(e,i)}function Vb(e){Cn(e,{type:"mcp_get_status"})}function IC(e,t,n){Cn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function HC(e,t){Cn(e,{type:"mcp_reconnect",serverName:t})}function qC(e,t){Cn(e,{type:"mcp_set_servers",servers:t})}function Gb(e,t){Cn(e,{type:"set_magic_ui",magicUiActive:t})}function iz(e){Cn(e,{type:"magic_ui_sync"})}function VC(e,t){Cn(e,{type:"set_ai_validation",...t})}var re=typeof window<"u"?window:void 0,Rn=typeof globalThis<"u"?globalThis:re,Hn=Rn==null?void 0:Rn.navigator,ke=Rn==null?void 0:Rn.document,Yt=Rn==null?void 0:Rn.location,Yg=Rn==null?void 0:Rn.fetch,Ym=Rn!=null&&Rn.XMLHttpRequest&&"withCredentials"in new Rn.XMLHttpRequest?Rn.XMLHttpRequest:void 0,Yb=Rn==null?void 0:Rn.AbortController,GC=Rn==null?void 0:Rn.CompressionStream,er=Hn==null?void 0:Hn.userAgent;function P5(){return!(!re||re.navigator.onLine===!1)}var Fo=typeof globalThis<"u"?globalThis:re;Fo&&typeof self>"u"&&(Fo.self=Fo),Fo&&typeof File>"u"&&(Fo.File=function(){});var Oe=re??{},Rt={DEBUG:!1,LIB_VERSION:"0.5.0",LIB_NAME:"browser-common"};function Qb(e,t,n,i,a,o,u){try{var f=e[o](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,a)}function Dt(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function u(h){Qb(o,i,a,u,f,"next",h)}function f(h){Qb(o,i,a,u,f,"throw",h)}u(void 0)}))}}function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},fe.apply(null,arguments)}function $5(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var Wb=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Xb(e){return typeof e=="string"||e}function Kb(e){return typeof e=="string"?e:void 0}var Uo,YC=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Bi=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Zb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),QC=["$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"],WC=["token"],F5="NativeGzipValidationError",Qm=e=>e.length>=2&&e[0]===31&&e[1]===139,Jb=(e,t)=>e===Zb.GZipJS||t===Zb.GZipJS||t==="gzip",ey=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",ld=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=F5,t},XC=(function(){var e=Dt((function*(t,n){18>t.size&&ld("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Qm(i)&&i[2]===8||ld("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Uo)return Uo;Uo=[];for(var m=0;256>m;m++){for(var x=m,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;Uo[m]=x>>>0}return Uo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&ld("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&ld("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Wm(){return Wm=Dt((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(i).then((()=>o.close())).catch((function(){var p=Dt((function*(m){try{yield o.abort(m)}catch{}throw m}));return function(m){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),h=(yield Promise.all([f,u]))[0];return yield XC(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Wm.apply(this,arguments)}var KC=["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"],ty=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return KC.concat(t).some((i=>{var a=i.toLowerCase();return n.indexOf(a)!==-1}))};function qe(e,t){return e.indexOf(t)!==-1}var yf=function(e){return e.trim()},Xm=function(e){return e.replace(/^\$/,"")};function U5(e){var t,n=[];return(t=JSON.stringify(e,(function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}})))!==null&&t!==void 0?t:"null"}var I5=Object.prototype,H5=I5.hasOwnProperty,_f=I5.toString,Ve=Array.isArray||function(e){return _f.call(e)==="[object Array]"},Fn=e=>typeof e=="function",It=e=>e===Object(e)&&!Ve(e),Ii=e=>{if(It(e)){for(var t in e)if(H5.call(e,t))return!1;return!0}return!1},xe=e=>e===void 0,vt=e=>_f.call(e)=="[object String]",Km=e=>vt(e)&&e.trim().length===0,nr=e=>e===null,Ge=e=>xe(e)||nr(e),an=e=>_f.call(e)=="[object Number]"&&e==e,zi=e=>an(e)&&e>0,gr=e=>_f.call(e)==="[object Boolean]",ZC=e=>e instanceof FormData,JC=e=>qe(QC,e),e3=e=>qe(WC,e);function q5(e){return e===null||typeof e!="object"}function Id(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Qg(e){return typeof Event<"u"&&V5(e,Event)}function V5(e,t){try{return e instanceof t}catch{return!1}}var t3=[!0,"true",1,"1","yes"],Up=e=>qe(t3,e),n3=[!1,"false",0,"0","no"];function ui(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),an(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),ui(a||n,t,n,i))}class r3{constructor(t){this.tt={},this.et=t.et,this.it=ui(t.bucketSize,0,100,t.rt),this.nt=ui(t.refillRate,0,this.it,t.rt),this.st=ui(t.refillInterval,0,864e5,t.rt)}ot(t,n){var i=Math.floor((n-t.lastAccess)/this.st);i>0&&(t.tokens=Math.min(t.tokens+i*this.nt,this.it),t.lastAccess=t.lastAccess+i*this.st)}consumeRateLimit(t){var n,i=Date.now(),a=String(t),o=this.tt[a];return o?this.ot(o,i):this.tt[a]=o={tokens:this.it,lastAccess:i},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.et)==null||n.call(this,t)),o.tokens===0)}stop(){this.tt={}}}var vr="Mobile",Hd="iOS",Hi="Android",Tl="Tablet",G5=Hi+" "+Tl,Y5="iPad",Q5="Apple",W5=Q5+" Watch",dc="Safari",Al="BlackBerry",X5="Samsung",K5=X5+"Browser",Z5=X5+" Internet",_a="Chrome",i3=_a+" OS",J5=_a+" "+Hd,Wg="Internet Explorer",ew=Wg+" "+vr,Xg="Opera",s3=Xg+" Mini",Kg="Edge",tw="Microsoft "+Kg,Nl="Firefox",nw=Nl+" "+Hd,kc="Nintendo",jc="PlayStation",Cl="Xbox",rw=Hi+" "+vr,iw=vr+" "+dc,tc="Windows",Zm=tc+" Phone",ny="Nokia",Jm="Ouya",sw="Generic",a3=sw+" "+vr.toLowerCase(),aw=sw+" "+Tl.toLowerCase(),eg="Konqueror",lw="Oculus Browser",qd="Vivaldi",ow="Yandex",Vd="Whale",tg="DuckDuckGo",cw="Pale Moon",Gd="Waterfox",fc="Brave",uw="Google Search App",Zt="(\\d+(\\.\\d+)?)",Ip=new RegExp("Version/"+Zt),l3=new RegExp(Cl,"i"),o3=new RegExp(jc+" \\w+","i"),c3=new RegExp(kc+" \\w+","i"),Zg=new RegExp(Al+"|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"},dw=function(e,t,n,i){t=t||"";var a=(function(o){return o!=null&&o.brave?fc:null})(n);return a||(i!=null&&i.detectGoogleSearchApp&&qe(e,"GSA/")?uw:qe(e," OPR/")&&qe(e,"Mini")?s3:qe(e," OPR/")?Xg:Zg.test(e)?Al:qe(e,"IE"+vr)||qe(e,"WPDesktop")?ew:qe(e,"OculusBrowser")?lw:qe(e,K5)?Z5:qe(e,Kg)||qe(e,"Edg/")?tw:qe(e,qd+"/")?qd:qe(e,"YaBrowser/")?ow:qe(e,Vd+"/")?Vd:qe(e,tg+"/")||qe(e,"Ddg/")?tg:qe(e,"FBIOS")?"Facebook "+vr:qe(e,"UCWEB")||qe(e,"UCBrowser")?"UC Browser":qe(e,"CriOS")?J5:qe(e,"CrMo")||qe(e,_a)?_a:qe(e,Hi)&&qe(e,dc)?rw:qe(e,"FxiOS")?nw:qe(e.toLowerCase(),eg.toLowerCase())?eg:qe(e,fc+"/")?fc:((o,u)=>u&&qe(u,Q5)||(function(f){return qe(f,dc)&&!qe(f,_a)&&!qe(f,Hi)})(o))(e,t)?qe(e,vr)?iw:dc:qe(e,"PaleMoon/")?cw:qe(e,Gd+"/")?Gd:qe(e,Nl)?Nl:qe(e,"MSIE")||qe(e,"Trident/")?Wg:qe(e,"Gecko")?Nl:"")},d3={[ew]:[new RegExp("rv:"+Zt)],[tw]:[new RegExp(Kg+"?\\/"+Zt)],[_a]:[new RegExp("("+_a+"|CrMo)\\/"+Zt)],[J5]:[new RegExp("CriOS\\/"+Zt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Zt)],[dc]:[Ip],[iw]:[Ip],[Xg]:[new RegExp("(Opera|OPR)\\/"+Zt)],[Nl]:[new RegExp(Nl+"\\/"+Zt)],[nw]:[new RegExp("FxiOS\\/"+Zt)],[eg]:[new RegExp("Konqueror[:/]?"+Zt,"i")],[Al]:[new RegExp(Al+" "+Zt),Ip],[rw]:[new RegExp("android\\s"+Zt,"i")],[Z5]:[new RegExp(K5+"\\/"+Zt)],[lw]:[new RegExp("OculusBrowser\\/"+Zt)],[qd]:[new RegExp(qd+"\\/"+Zt)],[ow]:[new RegExp("YaBrowser\\/"+Zt)],[Vd]:[new RegExp(Vd+"\\/"+Zt)],[fc]:[new RegExp(fc+"\\/"+Zt)],[tg]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Zt)],[cw]:[new RegExp("PaleMoon\\/"+Zt)],[Gd]:[new RegExp(Gd+"\\/"+Zt)],[uw]:[new RegExp("GSA\\/"+Zt)],[Wg]:[new RegExp("(rv:|MSIE )"+Zt)],Mozilla:[new RegExp("rv:"+Zt)]},f3=function(e,t,n,i){var a=dw(e,t,n,i),o=d3[a];if(xe(o))return null;for(var u=0;o.length>u;u++){var f=e.match(o[u]);if(f)return parseFloat(f[f.length-2])}return null},ry=[[new RegExp(Cl+"; "+Cl+" (.*?)[);]","i"),e=>[Cl,e&&e[1]||""]],[new RegExp(kc,"i"),[kc,""]],[new RegExp(jc,"i"),[jc,""]],[Zg,[Al,""]],[new RegExp(tc,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Zm,""];if(new RegExp(vr).test(t)&&!/IEMobile\b/.test(t))return[tc+" "+vr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=u3[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[tc,i]}return[tc,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Hd,[e[3],e[4],e[5]||"0"].join(".")]:[Hd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=xe(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hi+")","i"),e=>e&&e[2]?[Hi,[e[2],e[3],e[4]||"0"].join(".")]:[Hi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[i3,""]],[/Linux|debian/i,["Linux",""]]],iy=function(e){return c3.test(e)?kc:o3.test(e)?jc:l3.test(e)?Cl:new RegExp(Jm,"i").test(e)?Jm:new RegExp("("+Zm+"|WPDesktop)","i").test(e)?Zm:/iPad/.test(e)?Y5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?W5:Zg.test(e)?Al:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ny,"i").test(e)?ny:/(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(vr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Hi:G5:new RegExp("(pda|"+vr+")","i").test(e)?a3:new RegExp(Tl,"i").test(e)&&!new RegExp(Tl+" pc","i").test(e)?aw:""},h3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sy(e,t){return typeof(n=e)=="string"&&h3.test(n)?e:t();var n}function As(e){return e&&e.split("#")[0]}function Jg(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function ay(e,t,n){return fw.apply(this,arguments)}function fw(){return(fw=Dt((function*(e,t,n){var i;try{return yield Promise.race([e,new Promise(((a,o)=>{i=Jg((()=>{try{n==null||n(),a()}catch(u){o(u)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var p3=e=>e instanceof Error,hw={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=hw.info;function pw(e){if(gr(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(Ve(e))return{arrayValue:{values:e.map((t=>pw(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Yd(e){var t=[];for(var n in e){var i=e[n];nr(i)||xe(i)||t.push({key:n,value:pw(i)})}return t}function g3(e,t){var n=hw[e.level||"info"]||m3,i=n.text,a=n.number,o=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),Ge(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ge(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=fe({},u,e.attributes||{}),h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:e.body},attributes:Yd(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),xe(e.trace_flags)||(h.flags=e.trace_flags),h}function mw(e,t,n){return fe({},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 gw(e,t,n,i){return{resourceLogs:[{resource:{attributes:Yd(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}let x3=class{constructor(e,t,n,i,a,o,u){var f;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.Ne=t,this.rt=n,this.ut=i,this.ht=a,this.dt=o,this.vt=u,this.ct=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.kt=t.maxBufferSize,this.xt=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.St=t.flushIntervalMs,this.Ct=t.maxBatchRecordsPerPost,this.Mt=t.rateCapWindowMs,this.Tt=t.maxLogsPerInterval}reset(){this.Et(),this.ct=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ne.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.It()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.Pt(e);if(t!==null)if(t.body){if(this.Rt()){var n={record:g3(t,this.ut())};this.ht((()=>this.At(n)))}}else this.rt.info("Log was rejected in beforeSend function")}}Pt(e){var t=this.Ne.beforeSend;if(!t)return e;var n=Ve(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.rt.info("Log was rejected in beforeSend function"),null;i=o}catch(u){return this.rt.error("Error in beforeSend function for log:",u),null}return i}Rt(){if(this.Tt===void 0)return!0;var e=Date.now(),t=e-this.bt;return this.Mt>t&&t>=0||(this.bt=e,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.rt.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var e=this;return Dt((function*(){if(!e._instance.isDisabled)return e.ct||(e.ct=e.Ft().finally((()=>{e.ct=null}))),e.ct}))()}Ft(){var e=this;return Dt((function*(){var t;e.Et();var n=(t=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var i=n.length,a=0;n.length>0&&i>a;){var o,u;e.ft=0;var f=Math.min(n.length,e.Ct),h=n.slice(0,f),p=gw(h.map((x=>x.record)),e.Lt(),(o=e.vt)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),m=yield e._instance.Ot(p);if(m.kind==="too-large"&&h.length>1)e.Ct=Math.max(1,Math.floor(h.length/2)),e.rt.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Ct);else if(m.kind==="retry-later"||(m.kind==="too-large"?e.rt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):m.kind==="ok"&&e.Ne.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Ne.maxBatchRecordsPerPost,e.Ct+1)),yield e.Dt(h.length),n=(u=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,m.kind==="fatal"))throw m.error}}))()}Dt(e){var t=this;return Dt((function*(){var n,i=Math.max(0,e-t.ft),a=(n=t._instance.getPersistedProperty(Bi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Bi.LogsQueue,a.slice(i)),yield t.dt()}))()}Lt(){return mw(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion())}At(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];this.xt>n.length||(n.shift(),this.ft++,this.rt.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Bi.LogsQueue,n),this.kt>n.length?this.$t():this.It()}}$t(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=Jg((()=>{this.Nt=void 0,this.It()}),e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(Bi.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Dt((function*(){t.Et();var n=t.flush().catch((()=>{}));e!==void 0?yield ay(n,e):yield n}))()}flushWithTimeout(e){var t=this;return Dt((function*(){var n=t.flush();yield ay(n,e,(()=>{n.catch((()=>{}))}))}))()}It(){this.flush().then((()=>{this.yt=0}),(e=>{this.yt++,this.rt.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.$t(this.qt())}))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Hp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ly(e){return String(e)+"000000"}function oy(e,t,n,i){var a="";return i&&(a=Object.keys(i).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(i[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let v3=class{constructor(e,t,n){this._instance=e,this.Ne=t,this.rt=n,this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Wt=0}count(e,t,n){t===void 0&&(t=1),this.Vt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Vt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Vt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.ct,n=(function(){var a=Dt((function*(){t&&(yield t.catch((()=>{}))),yield e.Zt()}));return function(){return a.apply(this,arguments)}})(),i=n().finally((()=>{this.ct===i&&(this.ct=null)}));return this.ct=i,i}drainWindow(){if(this.Bt.size===0)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Wt++,this.Et(),this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Vt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Pt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.rt.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,i;try{n=t.attributes?fe({},t.attributes):void 0,i=oy(t.type,t.name,t.unit,n)}catch(u){return void this.rt.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.Bt.get(i);if(!a){if(!this.Qt())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(i,a)}var o=this.Ut.get(t.name);o===void 0?this.Ut.set(t.name,t.type):o===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.rt.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Kt(a,t.value),this.$t()}else this.rt.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.rt.warn("Dropping metric with empty name")}}Qt(){return this.Ne.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.rt.warn("Metric series cap reached ("+this.Ne.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Kt(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Hp.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,Hp)]+=1}}Pt(e){var t=this.Ne.beforeSend;if(!t)return e;var n=Ve(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.rt.info("Metric was rejected in beforeSend function"),null;i=o}catch(u){return this.rt.error("Error in beforeSend function for metric:",u),null}return i}$t(){this.Nt||(this.Nt=Jg((()=>{this.Nt=void 0,this.flush().catch((e=>{this.rt.error("Metrics flush failed:",e)}))}),this.Ne.flushIntervalMs))}Et(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var e=this;return Dt((function*(){if(e.Bt.size!==0){var t=e.Bt;e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set;var n=e.Wt,i=yield e._instance.Jt(e.Gt(t));if(n===e.Wt)switch(i.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.$t();case"too-large":return void e.rt.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.rt.error("Failed to send metrics batch:",i.error)}}}))()}Gt(e){return t=this.Xt(e),n=(function(o,u,f){return fe({},o.resourceAttributes,{"service.name":o.serviceName||"unknown_service"},o.environment&&{"deployment.environment":o.environment},o.serviceVersion&&{"service.version":o.serviceVersion},{"telemetry.sdk.name":u,"telemetry.sdk.version":f})})(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Yd(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}Xt(e){var t=ly(Date.now()),n=new Map;for(var i of e.values()){var a,o=oy(i.type,i.name,i.unit,void 0),u=n.get(o);u||(u=fe({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var f=Yd((a=i.attributes)!==null&&a!==void 0?a:{}),h=ly(i.windowStartMs);if(i.type==="count"){var p,m={attributes:f,startTimeUnixNano:h,timeUnixNano:t,asDouble:(p=i.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(m)}else if(i.type==="gauge"){var x,b={attributes:f,timeUnixNano:t,asDouble:(x=i.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else i.hist&&u.histogram.dataPoints.push({attributes:f,startTimeUnixNano:h,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Hp})}return Array.from(n.values())}Yt(e){var t,n;for(var i of e){var a=i[0],o=i[1],u=this.Bt.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.type){case"count":u.total=((t=u.total)!==null&&t!==void 0?t:0)+((n=o.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(var f=0;u.hist.bucketCounts.length>f;f++)u.hist.bucketCounts[f]+=o.hist.bucketCounts[f]}else u.hist=o.hist}else this.Qt()&&this.Bt.set(a,o)}}};var od,cy,qp;function b3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return qp&&n.length===cy||(cy=n.length,qp=n.reduce(((i,a)=>{od||(od={});var o=od[a];if(o)i[o[0]]=o[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,m=t[a];if(p&&m){i[p]=m,od[a]=[p,m];break}}return i}),{})),qp}}class y3{constructor(t,n,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}buildFromUnknown(t,n){n===void 0&&(n={});var i=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(i,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return Dt((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Ve(i.stacktrace.frames)&&(i.stacktrace.frames=yield n.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var i,a;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),fe({},t,{cause:i,stack:a})}applyChunkIds(t,n){return t.map((i=>(i.filename&&n&&(i.chunk_id=n[i.filename]),i)))}applyCoercers(t,n){for(var i of this.coercers)if(i.match(t))return i.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Dt((function*(){var i=t;for(var a of n.modifiers)i=yield a(i);return i}))()}convertToExceptionList(t,n){var i,a,o,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(o=t.synthetic)!==null&&o!==void 0&&o}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,fe({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:b3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var a=(o,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,f)}};return fe({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,i),next:o=>a(o,i+1)})}}var Ml="?";function ng(e,t,n,i,a){var o={platform:e,filename:t,function:n==="<anonymous>"?Ml:n,in_app:!0};return xe(i)||(o.lineno=i),xe(a)||(o.colno=a),o}var xw=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:Ml,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},_3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,w3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,S3=/\((\S*)(?::(\d+))(?::(\d+))\)/,k3=(e,t)=>{var n=_3.exec(e);if(n)return ng(t,n[1],Ml,+n[2],+n[3]);var i=w3.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=S3.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var o=xw(i[1]||Ml,i[2]);return ng(t,o[1],o[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},j3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,N3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,C3=(e,t)=>{var n=j3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=N3.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var a=n[3],o=n[1]||Ml,u=xw(o,a);return ng(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},uy=/\(error: (.*)\)/;class E3{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=vt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return Id(t,"DOMException")}isDOMError(t){return Id(t,"DOMError")}}class T3{match(t){return(function(n){switch({}.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return V5(n,Error)}})(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class A3{constructor(){}match(t){return!!Id(t,"ErrorEvent")&&(t.error!=null||this.fe(t))}coerce(t,n){var i;if(t.error!=null)return n.apply(t.error);var a=n.apply(t.message);return fe({},a,{stack:(i=this.pe(t))!==null&&i!==void 0?i:a.stack,synthetic:!0})}fe(t){return vt(t.message)&&t.message.length>0}pe(t){var n=t;if(vt(n.filename)&&n.filename.length>0){var i,a,o=(i=n.lineno)!==null&&i!==void 0?i:0,u=(a=n.colno)!==null&&a!==void 0?a:0;return`Error
|
|
67
|
-
at `+n.filename+":"+o+":"+u}}}var M3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class R3{match(t){return typeof t=="string"}coerce(t,n){var i,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,a=t.match(M3);return a&&(n=a[1],i=a[2]),[n,i]}}var L3=["fatal","error","warning","log","info","debug"];function vw(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class D3{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,a,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(i=this.getStack(t))!==null&&i!==void 0?i:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Qg(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+vw(t)}isSeverityLevel(t){return vt(t)&&!Km(t)&&L3.indexOf(t)>=0}getStack(t){try{return vt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:vt(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(p3(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class z3{match(t){return Qg(t)}coerce(t,n){var i,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+vw(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class O3{match(t){return q5(t)}coerce(t,n){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class B3{match(t){return Id(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Qg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i,a=this.getUnhandledRejectionReason(t);return q5(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Qd="$message",Wd="$timestamp",P3=new Set([Qd,Wd]),Vp={enabled:!0,max_bytes:32768};function Xd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Vp.enabled,max_bytes:F3(e.max_bytes,Vp.max_bytes)}:fe({},Vp)}class $3{constructor(t){this.Ke=[],this.Je=0,this.Ne=Xd(t)}setConfig(t){this.Ne=Xd(t),this.Xe()}add(t){var n=(function(a){var o;try{o=U5(a)}catch{return}try{var u=JSON.parse(o);if(!It(u))return;var f=u,h=f[Qd],p=f[Wd];return!vt(h)||h.trim().length===0||!vt(p)&&!an(p)?void 0:{step:f,json:o}}catch{return}})(t);if(n){var i=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,f=0;o.length>f;f++)o[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.Ne.max_bytes||(this.Ke.push({step:n.step,bytes:i}),this.Je+=i,this.Xe())}}getAttachable(){return this.Ke.map((t=>t.step))}clear(){this.Ke=[],this.Je=0}size(){return this.Ke.length}Xe(){for(;this.Je>this.Ne.max_bytes&&this.Ke.length>0;){var t=this.Ke.shift();t&&(this.Je-=t.bytes)}}}function F3(e,t){if(!an(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var bw=function(e,t){var n=(t===void 0?{}:t).debugEnabled,i={k(a){if(re&&(Rt.DEBUG||re.POSTHOG_DEBUG||n)&&!xe(re.console)&&re.console){for(var o=("__rrweb_original__"in re.console[a])?re.console[a].__rrweb_original__:re.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];o(e,...f)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("error",...o)},critical(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];console.error(e,...o)},uninitializedWarning(a){i.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>bw(e+" "+a,o)};return i},ye=bw("[PostHog.js]"),Ht=ye.createLogger,U3=Ht("[ExternalScriptsLoader]"),Kd=e=>{var t=ke==null?void 0:ke.querySelectorAll("script");if(t){for(var n=0;t.length>n;n++)if(t[n].src===e)return t[n]}},ha=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return U3.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Kd(t);if(i){if(i.__posthog_loading_callback_fired)return n();var a=i.__posthog_loading_error;return a?n(a):(i.addEventListener("load",(u=>{i.__posthog_loading_callback_fired=!0,n(void 0,u)})),void i.addEventListener("error",(u=>{i.__posthog_loading_error=u,n(u)})))}var o=()=>{if(!ke)return n("document not found");if(Kd(t))return ha(e,t,n);var u=ke.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=t,u.onload=p=>{u.__posthog_loading_callback_fired=!0,n(void 0,p)},u.onerror=p=>{u.__posthog_loading_error=p,n(p)},e.config.prepare_external_dependency_script&&(u=e.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")ke.head.appendChild(u);else{var f,h=ke.querySelectorAll("body > script");h.length>0?(f=h[0].parentNode)==null||f.insertBefore(u,h[0]):ke.body.appendChild(u)}};ke!=null&&ke.body?o():ke==null||ke.addEventListener("DOMContentLoaded",o)},Gp={},dy=(e,t)=>{var n="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var i=3e5;n=n+"&t="+Math.floor(Date.now()/i)*i}return e.requestRouter.endpointFor("assets",n)};Oe.__PosthogExtensions__=Oe.__PosthogExtensions__||{},Oe.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var i=e.config.strict_script_versioning;if(i){var a=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),o=Gp[a];if(i==="fallback"&&o){if(Kd(o))return void ha(e,o,n);delete Gp[a]}ha(e,a,i==="fallback"?(f,h)=>{if(f)if(typeof f=="string")n(f);else{var p,m=dy(e,t);Gp[a]=m;var x=Kd(a);x==null||(p=x.parentNode)==null||p.removeChild(x),ha(e,m,n)}else n(void 0,h)}:n)}else ha(e,dy(e,t),n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");ha(e,u,n)}},Oe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);ha(e,i,n)};Rt.DEBUG=!1,Rt.LIB_VERSION="1.417.0",Rt.LIB_NAME="web";var yw="$people_distinct_id",Nc="$device_id",Yp="$device_model",nc="__alias",rc="__timers",rg="$autocapture_disabled_server_side",ig="$heatmaps_enabled_server_side",sg="$exception_capture_enabled_server_side",ag="$error_tracking_suppression_rules",lg="$error_tracking_capture_extension_exceptions",og="$web_vitals_enabled_server_side",ex="$dead_clicks_enabled_server_side",tx="$product_tours_enabled_server_side",cg="$web_vitals_allowed_metrics",ya="$session_recording_remote_config",_w="$replay_sample_rate",ww="$replay_override_sampling",Sw="$replay_override_linked_flag",kw="$replay_override_url_trigger",jw="$replay_override_event_trigger",kl="$sesid",nx="$session_is_sampled",pa="$enabled_feature_flags",ic="$active_feature_flags",Td="$early_access_features",ug="$feature_flag_details",sc="$feature_flag_payloads",Ad="$feature_flag_request_id",Zd="$minimal_flag_called_events",oi="$override_feature_flags",ma="$override_feature_flag_payloads",Oi="$stored_person_properties",ga="$stored_group_properties",dg="$surveys",Jd="$surveys_loaded_at",fg="$surveys_activated",Md="$surveys_activated_session",Rd="$surveys_activated_timestamps",ac="ph_product_tours",ba="$flag_call_reported",lc="$flag_call_reported_session_id",Ld="$feature_flag_errors",hc="$feature_flag_evaluated_at",pr="$user_state",hg="$client_session_props",pg="$capture_rate_limit",mg="$initial_campaign_params",gg="$initial_referrer_info",ef="$initial_person_info",tf="$epp",cd="$posthog_cookieless",Nw="$cookieless_mode",Cw="$sdk_debug_extensions_init_method",Ew="$sdk_debug_extensions_init_time_ms",Tw="$sdk_debug_recording_script_not_loaded",rx="PostHog loadExternalDependency extension not found.",xa="on_reject",$i="always",sa="anonymous",ks="identified",xg="identified_only",nf="visibilitychange",rf="beforeunload",_l="$pageview",Qp="$pageleave",Wp="$identify",fy="$groupidentify";function ud(e,t){Ve(e)&&e.forEach(t)}function Lt(e,t){if(!Ge(e))if(Ve(e))e.forEach(t);else if(ZC(e))e.forEach(((i,a)=>t(i,a)));else for(var n in e)H5.call(e,n)&&t(e[n],n)}var Ut=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function Dd(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var hy=function(e){try{return e()}catch{return}},I3=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(a){ye.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ye.critical(a)}}},ix=function(e){var t={};return Lt(e,(function(n,i){(vt(n)&&n.length>0||an(n))&&(t[i]=n)})),t},H3=["herokuapp.com","vercel.app","netlify.app"];function q3(e){var t=e==null?void 0:e.hostname;if(!vt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of H3)if(n===i)return!1;return!0}function Qt(e,t,n,i){var a=i??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function vg(e){return e.name==="ph_toolbar_internal"}var Aw=e=>{if(ke){try{for(var t=e+"=",n=ke.cookie.split(";").filter((o=>o.length)),i=0;n.length>i;i++){for(var a=n[i];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return an(e)&&isFinite(e)&&Math.floor(e)===e});class sf{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new sf(o)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new sf(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}}class V3{generate(){var t=this.generateOrAbort();if(!xe(t))return t;this.S=0;var n=this.generateOrAbort();if(xe(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return sf.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.A.nextUint32())}C(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}constructor(){this.S=0,this.I=0,this.A=new G3}}var py,Mw=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&&!xe(re.crypto)&&crypto.getRandomValues&&(Mw=e=>crypto.getRandomValues(e));class G3{nextUint32(){return this.R.length>this.O||(Mw(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Pi=()=>Y3().toString(),Y3=()=>(py||(py=new V3)).generate(),Io="",Q3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fi={N:()=>!!ke,j(e){ye.error("cookieStore error: "+e)},P:Aw,H(e){var t;try{t=JSON.parse(Fi.P(e))||{}}catch{}return t},F(e,t,n,i,a){if(!ke)return!1;try{var o="",u="",f=(function(m,x){if(x){var b=(function(_,j){if(j===void 0&&(j=ke),Io)return Io;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),k=Math.min(N.length,8),E="dmn_chk_"+Pi();!Io&&k--;){var C=N.slice(k).join("."),O=E+"=1;domain=."+C+";path=/";j.cookie=O+";max-age=3",j.cookie.includes(E)&&(j.cookie=O+";max-age=0",Io=C)}return Io})(m);if(!b){var y=(_=>{var j=_.match(Q3);return j?j[0]:""})(m);y!==b&&ye.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(ke.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),o="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+p.length),ke.cookie=p,!0}catch{return!1}},q(e,t){if(ke!=null&&ke.cookie)try{Fi.F(e,"",-1,t)}catch{return}}},Xp=null,Bt={N(){if(!nr(Xp))return Xp;var e=!0;if(xe(re))e=!1;else try{var t="__mplssupport__";Bt.F(t,"xyz"),Bt.P(t)!=='"xyz"'&&(e=!1),Bt.q(t)}catch{e=!1}return e||ye.error("localStorage unsupported; falling back to cookie store"),Xp=e,e},j(e){ye.error("localStorage error: "+e)},P(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){Bt.j(t)}return null},H(e){try{return JSON.parse(Bt.P(e))||{}}catch{}return null},F(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Bt.j(n)}return!1},q(e){try{re==null||re.localStorage.removeItem(e)}catch(t){Bt.j(t)}}},W3=[Nc,"distinct_id",kl,nx,tf,ef,pr],dd={},X3={N:()=>!0,j(e){ye.error("memoryStorage error: "+e)},P:e=>dd[e]||null,H:e=>dd[e]||null,F:(e,t)=>(dd[e]=t,!0),q(e){delete dd[e]}},aa=null,Jt={N(){if(!nr(aa))return aa;if(aa=!0,xe(re))aa=!1;else try{var e="__support__";Jt.F(e,"xyz"),Jt.P(e)!=='"xyz"'&&(aa=!1),Jt.q(e)}catch{aa=!1}return aa},j(e){ye.error("sessionStorage error: ",e)},P(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){Jt.j(t)}return null},H(e){try{return JSON.parse(Jt.P(e))||null}catch{}return null},F(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Jt.j(n)}return!1},q(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){Jt.j(t)}}};class K3{constructor(t){this._instance=t}get Ne(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Ne.cookieless_mode===$i||this.isRejected()||this.consent===-1&&this.Ne.cookieless_mode===xa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ne.opt_out_capturing_by_default}optInOut(t){this.ii.F(this.ri,t?1:0,this.Ne.cookie_expiration,this.Ne.cross_subdomain_cookie,this.Ne.secure_cookie)}reset(){this.ii.q(this.ri,this.Ne.cross_subdomain_cookie)}get ri(){var t=this._instance.config,n=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+n:"__ph_opt_in_out_"+n)}get ei(){var t=this.ii.P(this.ri);return Up(t)?1:qe(n3,t)?0:-1}get ii(){var t=this.Ne.opt_out_capturing_persistence_type,n=t==="localStorage"?Bt:Fi;if(!this.ni||this.ni!==n){this.ni=n;var i=t==="localStorage"?Fi:Bt;i.P(this.ri)&&(this.ni.P(this.ri)||this.optInOut(Up(i.P(this.ri))),i.q(this.ri,this.Ne.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Ne.respect_dnt&&[Hn==null?void 0:Hn.doNotTrack,Hn==null?void 0:Hn.msDoNotTrack,Oe.doNotTrack].some((t=>Up(t)))}}function Rw(e,t){var n,i=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Fn(i))return t;try{var a=i(t);return vt(a)&&a?a:t}catch(o){return ye.error("Error in get_current_url, falling back to window.location.href",o),t}}var Lw="__POSTHOG_TOOLBAR__",Z3=1,J3=3,e4=11;function my(e){return e instanceof Element&&(e.id===Lw||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ms(e){return!!e&&e.nodeType===Z3}function xr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Dw(e){return!!e&&e.nodeType===J3}function zw(e){return!!e&&e.nodeType===e4&&Ms(e.host)}var Ow=1e3;function sx(e){return e?yf(e).split(/\s+/):[]}function gy(e,t){var n=(function(i){var a,o=re==null||(a=re.location)==null?void 0:a.href;return xe(o)?void 0:Rw(i,o)})(t);return!!(n&&e&&e.some((i=>n.match(i))))}function af(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 sx(t)}function Bw(e){return Ge(e)?null:yf(e).split(/(\s+)/).filter((t=>pc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cc(e){var t="";return yg(e)&&!Uw(e)&&e.childNodes&&e.childNodes.length&&Lt(e.childNodes,(function(n){var i;Dw(n)&&n.textContent&&(t+=(i=Bw(n.textContent))!==null&&i!==void 0?i:"")})),yf(t)}function Kp(e){var t;return xe(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var ax=["a","button","form","input","select","textarea","label"];function bg(e,t){if(xe(t))return!0;var n,i=function(o){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(o,u))))return{v:!0}};for(var a of e)if(n=i(a))return n.v;return!1}function Pw(e){var t=e.parentNode;return!(!t||!Ms(t))&&t}var t4=[".ph-no-autocapture","[data-ph-no-autocapture]"],$w=["next","previous","prev",">","<"],n4=[...$w,"+","-","−","–"],xy=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,vy=[".ph-no-rageclick",".ph-no-capture"],r4=["","text","search","email","password","url","tel","number"];function by(e,t){if(!re||lx(e))return!1;var n,i,a,o,u;if(gr(t)?(n=!!t&&vy,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:vy,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!Ms(h))&&(!!xr(h,"textarea")||(xr(h,"input")?qe(r4,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var m=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return m==="true"||m===""})(h)))})(e))return!1;var f=Fw(e,!1).targetElementList;return!(function(h,p){if(h===!1||xe(h))return!1;var m;if(h===!0)m=$w;else{if(!Ve(h))return!1;if(h.length>10)return ye.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;m=h.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return m.some((_=>xy(b,_)||xy(y,_)))}))})(i,f.map((h=>{var p;return{safeText:Cc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!bg(f,n)}var lx=e=>!e||xr(e,"html")||!Ms(e),Fw=(e,t)=>{if(!re||lx(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],a=e;a.parentNode&&!xr(a,"body");)if(zw(a.parentNode))i.push(a.parentNode.host),a=a.parentNode.host;else{var o=Pw(a);if(!o)break;if(t||ax.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=re.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function yg(e){for(var t=new Set,n=0,i=e;i.parentNode&&!xr(i,"body");i=i.parentNode){if(n++>=Ow||t.has(i))return!1;t.add(i);var a=af(i);if(qe(a,"ph-sensitive")||qe(a,"ph-no-capture"))return!1}if(qe(af(e),"ph-include"))return!0;var o=e.type||"";if(vt(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!vt(u)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(u.replace(/[^a-zA-Z0-9]/g,""))}function Uw(e){return!!(xr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||xr(e,"select")||xr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var yy=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),_y=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,i4=[16,15,14,13],s4=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),wy=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Sy=/[0-9A-Za-z_]/;function a4(e){for(var t=0,n=!1,i=e.length-1;i>=0;i--){var a=e.charCodeAt(i)-48;n&&(a*=2)>9&&(a-=9),t+=a,n=!n}return t%10==0}function pc(e,t){if(t===void 0&&(t=!0),Ge(e))return!1;if(vt(e)){e=yf(e);var n=t?yy.test((e||"").replace(/[- ]/g,"")):(function(a){var o;for(_y.lastIndex=0;o=_y.exec(a);){var u=o[2];if(u)for(var f=u.replace(/[- ]/g,""),h=0;f.length>h;h++)for(var p of i4){var m=h+p;if(f.length>=m){var x=f.slice(h,m);if(yy.test(x)&&a4(x))return!0}}}return!1})(e);if(n)return!1;var i=t?s4.test(e):(function(a){var o;for(wy.lastIndex=0;o=wy.exec(a);){var u=o[1],f=o[3];if(!(u&&f&&Sy.test(u)&&Sy.test(f)))return!0}return!1})(e);if(i)return!1}return!0}function ky(e){var t=Cc(e);return pc(t=(t+" "+Iw(e)).trim())?t:""}function Iw(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Lt(e.childNodes,(function(n){var i;if(n&&((i=n.tagName)==null?void 0:i.toLowerCase())==="span")try{var a=Cc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+Iw(n)).trim())}catch(o){ye.error("[AutoCapture]",o)}})),t}function jy(e){return e.replace(/"|\\"/g,'\\"')}function l4(e){var t=e.attr__class;if(t)return Ve(t)?t:sx(t)}var fd=Ht("[Dead Clicks]"),o4=()=>!0,c4=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(ex)),i=e.instance.config.capture_dead_clicks;return gr(i)?i:!!It(i)||n};class Ny{get lazyLoadedDeadClicksAutocapture(){return this.si}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[ex]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.ai((()=>{this.oi()})):this.stop()}ai(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?fd.error("failed to load script",a):t()}))}oi(){var t;if(ke){if(!this.si&&(t=Oe.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=It(this.instance.config.capture_dead_clicks)?fe({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.si=Oe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.si.start(ke),fd.info("starting...")}}else fd.error("`document` not found. Cannot start.")}stop(){this.si&&(this.si.stop(),this.si=void 0,fd.info("stopping..."))}}var Zp=Ht("[SegmentIntegration]"),Hw="posthog-js";function qw(e,t){var n=t===void 0?{}:t,i=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,f=u===void 0?["error"]:u,h=n.sendExceptionsToPostHog,p=h===void 0||h;return m=>{var x,b,y,_,j;if(f!=="*"&&!f.includes(m.level)||!e.__loaded)return m;m.tags||(m.tags={});var N=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());m.tags["PostHog Person URL"]=N,e.sessionRecordingStarted()&&(m.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var k,E=((x=m.exception)==null?void 0:x.values)||[],C=E.map((z=>fe({},z,{stacktrace:z.stacktrace?fe({},z.stacktrace,{type:"raw",frames:(z.stacktrace.frames||[]).map((L=>fe({},L,{platform:"web:javascript"})))}):void 0}))),O={$exception_message:((b=E[0])==null?void 0:b.value)||m.message,$exception_type:(y=E[0])==null?void 0:y.type,$exception_level:m.level,$exception_list:C,$sentry_event_id:m.event_id,$sentry_exception:m.exception,$sentry_exception_message:((_=E[0])==null?void 0:_.value)||m.message,$sentry_exception_type:(j=E[0])==null?void 0:j.type,$sentry_tags:m.tags};return i&&a&&(O.$sentry_url=(o||"https://sentry.io/organizations/")+i+"/issues/?project="+a+"&query="+m.event_id),p&&((k=e.exceptions)==null||k.sendExceptionEvent(O)),m}}class u4{constructor(t,n,i,a,o,u){this.name=Hw,this.setupOnce=function(f){f(qw(t,{organization:n,projectId:i,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class Cy{constructor(t){this.li=(n,i,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(ye.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hi()}hi(){var t;this.di=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.li)}destroy(){var t;(t=this.di)==null||t.call(this),this.di=void 0}doPageView(t,n){var i,a=this.vi(t,n);return this.ui={pathname:(i=re==null?void 0:re.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.vi(t,(n=this.ui)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ui)==null?void 0:t.pageViewId}}vi(t,n){var i=this.ui;if(!i)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:i.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,f=o.lastScrollY,h=o.maxScrollY,p=o.maxContentHeight,m=o.lastContentY,x=o.maxContentY;if(!(xe(u)||xe(f)||xe(h)||xe(p)||xe(m)||xe(x))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),m=Math.ceil(m),x=Math.ceil(x);var b=u>1?ui(f/u,0,1,ye):1,y=u>1?ui(h/u,0,1,ye):1,_=p>1?ui(m/p,0,1,ye):1,j=p>1?ui(x/p,0,1,ye):1;a=Ut(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:m,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:x,$prev_pageview_max_content_percentage:j})}}return i.pathname&&(a.$prev_pageview_pathname=i.pathname),i.timestamp&&(a.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),a}}var Jp=["flags","surveys"],d4={[yw]:{exposure:"hidden"},[nc]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[rc]:{exposure:"hidden"},[rg]:{exposure:"event"},[ig]:{exposure:"hidden"},[sg]:{exposure:"event"},[ag]:{exposure:"hidden"},[lg]:{exposure:"event"},[og]:{exposure:"event"},[ex]:{exposure:"event"},[tx]:{exposure:"hidden"},[cg]:{exposure:"event"},[ya]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[kl]:{exposure:"hidden"},[nx]:{exposure:"event"},[_w]:{exposure:"event",shouldSkipFromEventProperties:e=>nr(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"},[pa]:{exposure:"hidden",storageGroup:"flags"},[ic]:{exposure:"hidden",storageGroup:"flags"},[Td]:{exposure:"hidden"},[ug]:{exposure:"hidden",storageGroup:"flags"},[sc]:{exposure:"hidden",storageGroup:"flags"},[Ad]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Zd]:{exposure:"hidden",storageGroup:"flags"},[oi]:{exposure:"hidden"},[ma]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[ga]:{exposure:"hidden"},[dg]:{exposure:"hidden",storageGroup:"surveys"},[Jd]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[fg]:{exposure:"event"},[Md]:{exposure:"hidden"},[Rd]:{exposure:"hidden"},[ac]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[ba]:{exposure:"hidden"},[lc]:{exposure:"hidden"},[Ld]:{exposure:"hidden"},[hc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[pr]:{exposure:"hidden"},[hg]:{exposure:"hidden"},[pg]:{exposure:"hidden"},[mg]:{exposure:"hidden"},[gg]:{exposure:"hidden"},[ef]:{exposure:"hidden"},[tf]:{exposure:"hidden"},[ww]:{exposure:"event"},[Sw]:{exposure:"event"},[kw]:{exposure:"event"},[jw]:{exposure:"event"},[Cw]:{exposure:"event"},[Ew]:{exposure:"event"},[Tw]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},f4=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],la=e=>{var t=d4[e];if(t)return t;for(var n of f4){var i=n[1];if(e.indexOf(n[0])===0)return i}},jl=(e,t)=>{try{return JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t)}catch{return U5(e)}},Rl=e=>{var t=ke==null?void 0:ke.createElement("a");return xe(t)?null:(t.href=e,t)},Ll=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;i.length>a;a++){var o=i[a].split("=");if(o[0]===t){n=o;break}}if(!Ve(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{ye.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Ec=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],f=o[0],h=(u||"").split("&"),p=[],m=0;h.length>m;m++){var x=h[m].split("=");Ve(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(h[m]))}var b=f;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},lf=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Vw=(e,t)=>e>=t&&P5(),Gw=(e,t,n,i)=>{if(e===0){if(P5()){var a=t+1;return a===n&&i(),a}return t}return 0},hd="https?://(.*)",Dl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],h4=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Dl],Tc="<masked>",p4=["li_fat_id"];function Yw(e,t,n){if(!ke)return{};var i,a=t?[...Dl,...n||[]]:[],o=Qw(Ec(ke.URL,a,Tc),e),u=(i={},Lt(p4,(function(f){var h=Aw(f);i[f]=h||null})),i);return Ut(u,o)}function Qw(e,t){var n=h4.concat(t||[]),i={};return Lt(n,(function(a){var o=Ll(e,a);i[a]=o||null})),i}function Ww(e){var t=(function(o){return o?o.search(hd+"google.([^/?]*)")===0?"google":o.search(hd+"bing.com")===0?"bing":o.search(hd+"yahoo.com")===0?"yahoo":o.search(hd+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!nr(t)){i.$search_engine=t;var a=ke?Ll(ke.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function Ey(){return navigator.language||navigator.userLanguage}var of="$direct";function Xw(){return(ke==null?void 0:ke.referrer)||of}function Kw(e,t,n){n===void 0&&(n=!1);var i=e?[...Dl,...t||[]]:[],a=n?As(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,o=a==null?void 0:a.substring(0,1e3);return{r:Xw().substring(0,1e3),u:o?Ec(o,i,Tc):void 0}}function Zw(e,t){var n;t===void 0&&(t=!1);var i=e.r,a=e.u,o=t?As(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==of?of:(n=Rl(i))==null?void 0:n.host};if(o){u.$current_url=o;var f=Rl(o);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=Qw(o);Ut(u,h)}if(i){var p=Ww(i);Ut(u,p)}return u}function Jw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function m4(){try{return new Date().getTimezoneOffset()}catch{return}}var g4={flags:hc,surveys:Jd},x4=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ml="main";class em{constructor(t,n,i){if(i===void 0&&(i=!0),this.ci={},this.fi=!1,this.pi=!1,this.Ne=t,this.gi=i,this.props={},this.mi=void 0,this.yi=(o=>{var u="";return o.token&&(u=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+u+"_posthog"})(t),this.ii=this.bi(t),this.pi=this.wi(t),this.load(),t.debug&&ye.info("Persistence loaded",t.persistence,fe({},this.props)),this.update_config(t,t,n),this.save(),re){var a=()=>this.flush();Qt(re,"beforeunload",a,{capture:!1}),Qt(re,"pagehide",a,{capture:!1})}}ki(){var t,n=(t=this.Ne)==null?void 0:t.persistence_save_debounce_ms;return an(n)&&n>0?n:0}isDisabled(){return!!this.xi}bi(t){x4.indexOf(t.persistence.toLowerCase())===-1&&(ye.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,i=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...W3,...u];return fe({},Bt,{H(p){try{var m={};try{m=Fi.H(p)||{}}catch{}var x,b=JSON.parse(Bt.P(p)||"{}");if(f){var y={};for(var _ in m){var j=m[_];nr(j)||j===""||(y[_]=j)}x=Ut(b,y)}else x=Ut(m,b);return Bt.F(p,x),x}catch{}return null},F(p,m,x,b,y,_){var j=Bt.F(p,m,void 0,void 0,_);try{var N={};h.forEach((k=>{m[k]&&(N[k]=m[k])})),Object.keys(N).length&&Fi.F(p,N,x,b,y,_)}catch(k){Bt.j(k)}return j},q(p,m){try{re==null||re.localStorage.removeItem(p),Fi.q(p,m)}catch(x){Bt.j(x)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),a=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&Bt.N()?(n=Bt,a=!0):o==="localstorage+cookie"&&i.N()?(n=i,a=!0):o==="sessionstorage"&&Jt.N()?n=Jt:o==="memory"?n=X3:o==="cookie"?n=Fi:i.N()?(n=i,a=!0):n=Fi,this.fi=a,n}Si(t){return this.yi+"__"+t}wi(t){return this.fi&&!!t.split_storage}properties(){var t={};return Lt(this.props,((n,i)=>{var a=la(i);if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n))return;t[i]=n}})),t}load(){if(!this.xi){var t=this.ii.H(this.yi);t&&(this.props=Ut({},t)),this.pi&&this.Ci()}}Ci(){for(var t of Jp){var n=Bt.H(this.Si(t));if(n&&!Ii(n)){var i=this.Mi(t);i.persisted=!0,this.Ti(t)||(i.fingerprint=this.Ei(n,t)),this.Ii(t,n)||Ut(this.props,n)}}}Ti(t){return Object.keys(this.props).some((n=>{var i;return((i=la(n))==null?void 0:i.storageGroup)===t}))}Ii(t,n){var i=g4[t];if(!i)return!1;var a=n[i],o=this.props[i];return an(a)&&an(o)&&o>a}refreshKey(t){var n;if(!this.xi){var i=this.pi?(n=la(t))==null?void 0:n.storageGroup:void 0,a=i?Bt.H(this.Si(i)):this.ii.H(this.yi);if(a&&t in a)this.Pi(t,a[t]);else{if(i){var o=this.ii.H(this.yi);if(o&&t in o)return void this.Pi(t,o[t])}this.Ri(t)}}}save(){if(!this.xi){var t=this.ki();t>0?xe(this.Ai)&&(this.Ai=setTimeout((()=>{this.Ai=void 0,this.Fi()}),t)):this.Fi()}}flush(){xe(this.Ai)||(clearTimeout(this.Ai),this.Ai=void 0,this.Fi())}Fi(){this.xi||(this.pi?this.Li():this.Oi(this.ii,this.yi,this.props,ml))}Li(){var t=this.Di(),n=t.main,i=t.groups;for(var a of(this.Oi(this.ii,this.yi,n,ml),Jp)){var o,u=i[a];(!Ii(u)||(o=this.ci[a])!=null&&o.persisted)&&this.Oi(Bt,this.Si(a),u,a)}}Di(){var t={},n={flags:{},surveys:{}};return Lt(this.props,((i,a)=>{var o,u=(o=la(a))==null?void 0:o.storageGroup;u?n[u][a]=i:t[a]=i})),{main:t,groups:n}}Ei(t,n){if(n===ml)return JSON.stringify(t)+"|"+this.$i+"|"+this.Ni+"|"+this.qi;var i={};return Lt(t,((a,o)=>{var u;i[o]=(u=la(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(i)}Oi(t,n,i,a){var o=this.Mi(a);if(a===ml||o.dirty||xe(o.fingerprint)){var u;try{if((u=this.Ei(i,a))===o.fingerprint)return void(o.dirty=!1)}catch{u=void 0}t.F(n,i,this.$i,this.Ni,this.qi,this.Ne.debug)?(o.dirty=!1,a!==ml&&(o.persisted=!0),xe(u)||(o.fingerprint=u)):this.Ne.debug&&ye.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,i=n!==void 0&&n;if(xe(this.Ai)||(clearTimeout(this.Ai),this.Ai=void 0),this.ii.q(this.yi,!1),this.ii.q(this.yi,!0),!i&&this.gi)for(var a of Jp)Bt.q(this.Si(a));i?delete this.ci[ml]:this.ci={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if(It(t)){xe(n)&&(n="None"),this.$i=xe(i)?this.ji:i;var a=!1;if(Lt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Pi(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(It(t)){this.$i=xe(n)?this.ji:n;var i=!1;if(Lt(t,((a,o)=>{t.hasOwnProperty(o)&&(this.props[o]!==a||It(a)||Ve(a))&&(this.Pi(o,a),i=!0)})),i)return this.save(),!0}return!1}unregister(t){var n=typeof t=="string"?[t]:t,i=!1;for(var a of n)a in this.props&&(this.Ri(a),i=!0);i&&this.save()}update_campaign_params(){var t=ke==null?void 0:ke.URL;if(t!==this.mi){var n=Yw(this.Ne.custom_campaign_params,this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties);Ii(ix(n))||this.register(n),this.mi=t}}update_search_keyword(){var t;this.register((t=ke==null?void 0:ke.referrer)?Ww(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Xw(),$referring_domain:ke!=null&&ke.referrer&&((t=Rl(ke.referrer))==null?void 0:t.host)||of},void 0)}set_initial_person_info(){this.props[mg]||this.props[gg]||this.register_once({[ef]:Kw(this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties,this.Ne.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Lt([gg,mg],(a=>{var o=this.props[a];o&&Lt(o,(function(u,f){t["$initial_"+Xm(f)]=u}))}));var n=this.props[ef];if(n){var i=(function(a,o){o===void 0&&(o=!1);var u=Zw(a,o),f={};return Lt(u,(function(h,p){f["$initial_"+Xm(p)]=h})),f})(n,this.Ne.disable_capture_url_hashes);Ut(t,i)}return t}safe_merge(t){return Lt(this.props,(function(n,i){i in t||(t[i]=n)})),t}update_config(t,n,i){this.ji=this.$i=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var a=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var m=[...h].sort(),x=[...p].sort();return m.every(((b,y)=>b===x[y]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=a?this.bi(t):this.ii,u=this.wi(t);if(a||u!==this.pi){var f=this.props;this.clear(),this.ii=o,this.pi=u,this.props=f,this.save()}}set_disabled(t){this.xi=t,this.xi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ni&&(this.Ni=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.qi&&(this.qi=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[rc]||{};i[t]=n,this.Pi(rc,i),this.save()}remove_event_timer(t){var n=this.props[rc]||{},i=n[t];return xe(i)||(delete n[t],this.Pi(rc,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.Pi(t,n),this.save()}Pi(t,n){var i;this.props[t]=n,(i=la(t))!=null&&i.volatile||this.Bi(t)}Ri(t){delete this.props[t],this.Bi(t)}Bi(t){var n,i=(n=la(t))==null?void 0:n.storageGroup;i&&(this.Mi(i).dirty=!0)}Mi(t){return this.ci[t]||(this.ci[t]={})}}function pd(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Fn(n.then)&&n.then(void 0,(()=>{}))}}}}var Un={GZipJS:"gzip-js",Base64:"base64"},Ho={Activation:"events",Cancellation:"cancelEvents"},tm={Popover:"popover",API:"api",Widget:"widget"},Ui={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},nm={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_g={Popover:"popover",Inline:"inline"},v4={SHOWN:"product tour shown"},Ty={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ay=Ht("[RateLimiter]");class b4{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var i=n.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((a=>{Ay.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void Ay.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,i,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(pg))!==null&&n!==void 0?n:{tokens:o,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>o&&(h.tokens=o);var p=1>h.tokens;if(p||t||(h.tokens=Math.max(0,h.tokens-1)),p&&!t){var m=(an(h.dropped)?h.dropped:0)+1;h.dropped=m,!this.lastEventRateLimited&&this.Hi(m)&&(h.dropped=0)}return this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(pg,h),{isRateLimited:p,remainingTokens:h.tokens}}Ui(t){var n=this.instance.config.property_denylist;return!Ve(n)||!n.includes(t)}zi(){var t;if(this.Ui("$current_url")&&this.Ui("$pathname")&&Yt!=null&&Yt.pathname)return""+((t=Yt.origin)!==null&&t!==void 0?t:"")+Yt.pathname}Hi(t){var n,i,a=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,u=this.zi(),f=this.Ui("$session_id")?(n=(i=this.instance).get_session_id)==null?void 0:n.call(i):void 0,h=[t+" event(s) dropped since the last warning",u?"triggered on "+u:void 0,f?"session "+f:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+h+". Config is set to "+o+" events per second and "+a+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var js=Ht("[RemoteConfig]");class e2{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Oe._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}Wi(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Vi(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return js.info("Using preloaded remote config",this.remoteConfig),this.Zi(this.remoteConfig),void this.Gi();if(this._instance.Qi())return void js.warn("Remote config is disabled. Falling back to local config.");this.Wi((t=>{if(!t)return js.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vi((n=>{this.Zi(n.json,n),this.Gi()}));this.Zi(t),this.Gi()}))}catch(t){js.error("Error loading remote config",t),this.Zi()}}stop(){this.Ki&&(clearInterval(this.Ki),this.Ki=void 0)}refresh(){!this._instance.Qi()&&ke&&ke.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Gi(){var t;if(!this.Ki){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.Ki=setInterval((()=>{this.refresh()}),n))}}Zi(t,n){!t&&n&&(n.statusCode===0?n.error||js.warn("Failed to fetch remote config from PostHog."):js.error("Failed to fetch remote config from PostHog."));try{this._instance.Zi(t?{ok:!0,config:t}:{ok:!1})}catch(a){js.error("Error applying remote config",a)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)==null||i.ensureFlagsLoaded()}catch(a){js.error("Error loading feature flags",a)}}}var Pr=Uint8Array,tr=Uint16Array,zl=Uint32Array,ox=new Pr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cx=new Pr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),My=new Pr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t2=function(e,t){for(var n=new tr(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new zl(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},n2=t2(ox,2),wg=n2[1];n2[0][28]=258,wg[258]=28;for(var Ry=t2(cx,0)[1],r2=new tr(32768),Wt=0;32768>Wt;++Wt){var gl=(43690&Wt)>>>1|(21845&Wt)<<1;r2[Wt]=((65280&(gl=(61680&(gl=(52428&gl)>>>2|(13107&gl)<<2))>>>4|(3855&gl)<<4))>>>8|(255&gl)<<8)>>>1}var mc=function(e,t,n){for(var i=e.length,a=0,o=new tr(t);i>a;++a)++o[e[a]-1];var u,f=new tr(t);for(a=0;t>a;++a)f[a]=f[a-1]+o[a-1]<<1;for(u=new tr(i),a=0;i>a;++a)u[a]=r2[f[e[a]-1]++]>>>15-e[a];return u},Sa=new Pr(288);for(Wt=0;144>Wt;++Wt)Sa[Wt]=8;for(Wt=144;256>Wt;++Wt)Sa[Wt]=9;for(Wt=256;280>Wt;++Wt)Sa[Wt]=7;for(Wt=280;288>Wt;++Wt)Sa[Wt]=8;var cf=new Pr(32);for(Wt=0;32>Wt;++Wt)cf[Wt]=5;var y4=mc(Sa,9),_4=mc(cf,5),i2=function(e){return(e/8>>0)+(7&e&&1)},s2=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof tr?tr:e instanceof zl?zl:Pr)(n-t);return i.set(e.subarray(t,n)),i},Mi=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},qo=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},rm=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,o=n.slice();if(!a)return[new Pr(0),0];if(a==1){var u=new Pr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(z,L){return z.f-L.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,m=1,x=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};m!=a-1;)f=n[n[x].f>n[p].f?p++:x++],h=n[p!=m&&n[x].f>n[p].f?p++:x++],n[m++]={s:-1,f:f.f+h.f,l:f,r:h};var b=o[0].s;for(i=1;a>i;++i)o[i].s>b&&(b=o[i].s);var y=new tr(b+1),_=Sg(n[m-1],y,0);if(_>t){i=0;var j=0,N=_-t,k=1<<N;for(o.sort((function(z,L){return y[L.s]-y[z.s]||z.f-L.f}));a>i;++i){var E=o[i].s;if(t>=y[E])break;j+=k-(1<<_-y[E]),y[E]=t}for(j>>>=N;j>0;){var C=o[i].s;t>y[C]?j-=1<<t-y[C]++-1:++i}for(;i>=0&&j;--i){var O=o[i].s;y[O]==t&&(--y[O],++j)}_=t}return[new Pr(y),_]},Sg=function(e,t,n){return e.s==-1?Math.max(Sg(e.l,t,n+1),Sg(e.r,t,n+1)):t[e.s]=n},Ly=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tr(++t),i=0,a=e[0],o=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[f]}return[n.subarray(0,i),t]},Vo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},kg=function(e,t,n){var i=n.length,a=i2(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},Dy=function(e,t,n,i,a,o,u,f,h,p,m){Mi(t,m++,n),++a[256];for(var x=rm(a,15),b=x[0],y=x[1],_=rm(o,15),j=_[0],N=_[1],k=Ly(b),E=k[0],C=k[1],O=Ly(j),z=O[0],L=O[1],V=new tr(19),F=0;E.length>F;++F)V[31&E[F]]++;for(F=0;z.length>F;++F)V[31&z[F]]++;for(var Q=rm(V,7),D=Q[0],I=Q[1],A=19;A>4&&!D[My[A-1]];--A);var se,Z,G,P,$=p+5<<3,ie=Vo(a,Sa)+Vo(o,cf)+u,ae=Vo(a,b)+Vo(o,j)+u+14+3*A+Vo(V,D)+(2*V[16]+3*V[17]+7*V[18]);if(ie>=$&&ae>=$)return kg(t,m,e.subarray(h,h+p));if(Mi(t,m,1+(ie>ae)),m+=2,ie>ae){se=mc(b,y),Z=b,G=mc(j,N),P=j;var R=mc(D,I);for(Mi(t,m,C-257),Mi(t,m+5,L-1),Mi(t,m+10,A-4),m+=14,F=0;A>F;++F)Mi(t,m+3*F,D[My[F]]);m+=3*A;for(var B=[E,z],K=0;2>K;++K){var M=B[K];for(F=0;M.length>F;++F)Mi(t,m,R[pe=31&M[F]]),m+=D[pe],pe>15&&(Mi(t,m,M[F]>>>5&127),m+=M[F]>>>12)}}else se=y4,Z=Sa,G=_4,P=cf;for(F=0;f>F;++F)if(i[F]>255){var pe;qo(t,m,se[257+(pe=i[F]>>>18&31)]),m+=Z[pe+257],pe>7&&(Mi(t,m,i[F]>>>23&31),m+=ox[pe]);var _e=31&i[F];qo(t,m,G[_e]),m+=P[_e],_e>3&&(qo(t,m,i[F]>>>5&8191),m+=cx[_e])}else qo(t,m,se[i[F]]),m+=Z[i[F]];return qo(t,m,se[256]),m+Z[256]},w4=new zl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),S4=(function(){for(var e=new zl(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),im=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function k4(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=S4[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),i=e.length;n.p(e);var a,o,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(x,b,y,_,j,N){var k=x.length,E=new Pr(_+k+5*(1+Math.floor(k/7e3))+j),C=E.subarray(_,E.length-j),O=0;if(!b||8>k)for(var z=0;k>=z;z+=65535){var L=z+65535;k>L?O=kg(C,O,x.subarray(z,L)):(C[z]=!0,O=kg(C,O,x.subarray(z,k)))}else{for(var V=w4[b-1],F=V>>>13,Q=8191&V,D=(1<<y)-1,I=new tr(32768),A=new tr(D+1),se=Math.ceil(y/3),Z=2*se,G=function(ht){return(x[ht]^x[ht+1]<<se^x[ht+2]<<Z)&D},P=new zl(25e3),$=new tr(288),ie=new tr(32),ae=0,R=0,B=(z=0,0),K=0,M=0;k>z;++z){var pe=G(z),_e=32767&z,Ce=A[pe];if(I[_e]=Ce,A[pe]=_e,z>=K){var De=k-z;if((ae>7e3||B>24576)&&De>423){O=Dy(x,C,0,P,$,ie,R,B,M,z-M,O),B=ae=R=0,M=z;for(var Ee=0;286>Ee;++Ee)$[Ee]=0;for(Ee=0;30>Ee;++Ee)ie[Ee]=0}var Be=2,Je=0,jt=Q,dt=_e-Ce&32767;if(De>2&&pe==G(z-dt))for(var gt=Math.min(F,De)-1,xt=Math.min(32767,z),_t=Math.min(258,De);xt>=dt&&--jt&&_e!=Ce;){if(x[z+Be]==x[z+Be-dt]){for(var Nt=0;_t>Nt&&x[z+Nt]==x[z+Nt-dt];++Nt);if(Nt>Be){if(Be=Nt,Je=dt,Nt>gt)break;var ve=Math.min(dt,Nt-2),$e=0;for(Ee=0;ve>Ee;++Ee){var nt=z-dt+Ee+32768&32767,nn=nt-I[nt]+32768&32767;nn>$e&&($e=nn,Ce=nt)}}}dt+=(_e=Ce)-(Ce=I[_e])+32768&32767}if(Je){P[B++]=268435456|wg[Be]<<18|Ry[Je];var je=31&wg[Be],ze=31&Ry[Je];R+=ox[je]+cx[ze],++$[257+je],++ie[ze],K=z+Be,++ae}else P[B++]=x[z],++$[x[z]]}}O=Dy(x,C,!0,P,$,ie,R,B,M,z-M,O)}return s2(E,0,_+i2(O)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,f,h)),m=p.length;return(function(x,b){var y=b.filename;if(x[0]=31,x[1]=139,x[2]=8,x[8]=2>b.level?4:b.level==9?2:0,x[9]=3,b.mtime!=0&&im(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(p,t),im(p,m-8,n.d()),im(p,m-4,i),p}var j4=!!Ym||!!Yg,a2="text/plain",zd=!1,l2=(e,t)=>{var n=e.split("#"),i=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var f=u.split("&").filter((h=>h.split("=")[0]!==t)).join("&");return o+(f?"?"+f:"")+(i?"#"+i:"")},wf=function(e,t,n){var i;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],f=fe({},t),h=(i=u==null?void 0:u.split("&").map((m=>{var x,b=m.split("="),y=b[0],_=n&&(x=f[y])!==null&&x!==void 0?x:b[1];return delete f[y],y+"="+_})))!==null&&i!==void 0?i:[],p=(function(m,x){var b,y;x===void 0&&(x="&");var _=[];return Lt(m,(function(j,N){xe(j)||xe(N)||N==="undefined"||(b=encodeURIComponent((k=>k instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(f);return p&&h.push(p),h.length>0?o+"?"+h.join("&"):o},sm=e=>{if(e.Ji)return e.Ji;var t=e.data,n=e.compression;if(t){if(n===Un.GZipJS){var i=k4((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var m=new Pr(f.length+(f.length>>>1)),x=0,b=function(N){m[x++]=N},y=0;p>y;++y){if(x+5>m.length){var _=new Pr(x+8+(p-y<<1));_.set(m),m=_}var j=f.charCodeAt(y);128>j?b(j):2048>j?(b(192|j>>>6),b(128|63&j)):j>55295&&57344>j?(b(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++y))>>>18),b(128|j>>>12&63),b(128|j>>>6&63),b(128|63&j)):(b(224|j>>>12),b(128|j>>>6&63),b(128|63&j))}return s2(m,0,x)})(jl(t)),{mtime:0});return{contentType:a2,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===Un.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(jl(t)),o=(f=>"data="+encodeURIComponent(typeof f=="string"?f:jl(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=jl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},o2=e=>{var t,n,i=()=>e.transport==="sendBeacon"?{url:wf(e.url,{compression:Un.Base64}),encodedBody:sm(fe({},e,{compression:Un.Base64,Ji:void 0}))}:{url:l2(e.url,"compression"),encodedBody:sm(fe({},e,{compression:void 0,Ji:void 0}))};try{t=sm(e)}catch(a){if(Jb(e.compression,Ll(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),i();throw a}return t&&Jb(e.compression,Ll(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Qm(new Uint8Array(n)):ArrayBuffer.isView(n)&&Qm(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(zd=!0,i()):{url:e.url,encodedBody:t}},c2=e=>{try{return o2(e)}catch(t){return ye.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},N4=(function(){var e=Dt((function*(t){var n=jl(t.data),i=yield(function(o,u,f){return Wm.apply(this,arguments)})(n,Rt.DEBUG,{rethrow:!0});if(!i)return t;var a=yield i.arrayBuffer();return fe({},t,{Ji:{contentType:a2,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),C4=/Failed to fetch|NetworkError|Load failed/i,u2=e=>(e==null?void 0:e.name)==="TypeError"&&C4.test((e==null?void 0:e.message)||""),d2=e=>{var t=c2(e);if(t){var n=t.url,i=t.encodedBody,a=i??{},o=a.contentType,u=a.body,f=a.estimatedSize,h=new Headers;Lt(e.headers,(function(_,j){h.append(j,_)})),o&&h.append("Content-Type",o);var p=null,m=!1;if(Yb){var x=new Yb;p={signal:x.signal,timeout:setTimeout((()=>{var _,j;m=!0,x.abort((_=e.timeout,(j=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",j))}),e.timeout)}}var b=_=>{m&&(_==null?void 0:_.name)==="AbortError"||u2(_)?ye.warn(_):ye.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;Yg(n,fe({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&!e.Yi&&52428.8>(f||0),body:u,signal:(y=p)==null?void 0:y.signal},e.fetchOptions)).then((_=>_.text().then((j=>{var N={statusCode:_.status,text:j};if(_.status===200)try{N.json=JSON.parse(j)}catch(k){ye.error(k)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},jg=e=>{try{var t,n=o2(e),i=n.url,a=n.encodedBody,o=a??{},u=o.body,f=o.estimatedSize;if(!u)return;var h=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Hn.sendBeacon(i,h))return;var p=Ve(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Ve(p)&&p.length>1&&(f??0)>16384){var m=Math.ceil(p.length/2),x=b=>Ve(e.data)?b:fe({},e.data,{batch:b});return jg(fe({},e,{data:x(p.slice(0,m))})),void jg(fe({},e,{data:x(p.slice(m))}))}ye.warn("Beacon of ~"+(f??0)+" bytes was rejected by the browser, falling back to fetch"),d2(fe({},e,{Yi:!0}))}catch(b){ye.warn("Beacon send failed",b)}},zy=(e,t,n,i)=>{var a=i==="query"?t==="POST"?"sent_at":"_":void 0;return wf(n===Un.GZipJS?l2(e,"compression"):e,fe({},a?{[a]:Date.now().toString()}:{},n===Un.GZipJS?{}:{compression:n}))},Od=[];Yg&&Od.push({transport:"fetch",method:d2}),Ym&&Od.push({transport:"XHR",method(e){var t=c2(e);if(t){var n=new Ym,i=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=i??{},o=a.contentType,u=a.body;Lt(e.headers,(function(f,h){n.setRequestHeader(h,f)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),Hn!=null&&Hn.sendBeacon&&Od.push({transport:"sendBeacon",method:jg});var Ng=3e3;class E4{constructor(t,n){this.Xi=!0,this.tr=[],this.er=ui((n==null?void 0:n.flush_interval_ms)||Ng,250,5e3,ye.createLogger("flush interval"),Ng),this.ir=t}enqueue(t){this.tr.push(t),this.rr||this.nr()}unload(){this.sr();var t=this.tr.length>0?this.ar():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.lr(fe({},i,{transport:"sendBeacon"}))}))}enable(){this.Xi=!1,this.nr()}nr(){var t=this;this.Xi||(this.rr=setTimeout((()=>{if(this.sr(),this.tr.length>0){var n=this.ar(),i=function(){var o=n[a],u=new Date().getTime();o.data&&Ve(o.data)&&Lt(o.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.lr(o)};for(var a in n)i()}}),this.er))}lr(t){try{this.ir(t)}catch(n){ye.error(n)}}sr(){clearTimeout(this.rr),this.rr=void 0}ar(){var t={};return Lt(this.tr,(n=>{var i,a=n,o=(a?a.batchKey:null)||a.url;xe(t[o])&&(t[o]=fe({},a,{data:[]})),(i=t[o].data)==null||i.push(a.data)})),this.tr=[],t}}var T4=["retriesPerformedSoFar"];class A4{constructor(t){this.ur=!1,this.hr=3e3,this.tr=[],this._instance=t,this.tr=[],this.dr=!0,!xe(re)&&"onLine"in re.navigator&&(this.dr=re.navigator.onLine,this.vr=()=>{this.dr=!0,this.cr()},this.pr=()=>{this.dr=!1},Qt(re,"online",this.vr),Qt(re,"offline",this.pr))}get length(){return this.tr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,i=$5(t,T4);zi(n)&&(i.url=wf(i.url,{retry_count:n})),this._instance._send_request(fe({},i,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.At(fe({retriesPerformedSoFar:n},i));a.statusCode===0&&ye.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}i.callback==null||i.callback(a)}}))}At(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var i=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),m=Math.random()-.5;return Math.ceil(p+m*(p-h))})(n),a=Date.now()+i;this.tr.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+i;navigator.onLine||(o+=" (Browser is offline)"),ye.warn(o),this.ur||(this.ur=!0,this.gr())}gr(){if(this.mr&&clearTimeout(this.mr),this.tr.length===0)return this.ur=!1,void(this.mr=void 0);this.mr=setTimeout((()=>{this.dr&&this.tr.length>0&&this.cr(),this.gr()}),this.hr)}cr(){var t=Date.now(),n=[],i=this.tr.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.tr=n,i.length>0)for(var a of i)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.mr&&(clearTimeout(this.mr),this.mr=void 0),this.ur=!1,xe(re)||(this.vr&&(re.removeEventListener("online",this.vr),this.vr=void 0),this.pr&&(re.removeEventListener("offline",this.pr),this.pr=void 0)),this.tr)){var n=t.requestOptions;try{this._instance._send_request(fe({},n,{transport:"sendBeacon"}))}catch(i){ye.error(i)}}this.tr=[]}}class M4{constructor(t){this.yr=()=>{var n,i,a,o;this.br||(this.br={});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),m=(u==null?void 0:u.scrollHeight)||0;this.br.lastScrollY=Math.ceil(f),this.br.maxScrollY=Math.max(f,(n=this.br.maxScrollY)!==null&&n!==void 0?n:0),this.br.maxScrollHeight=Math.max(h,(i=this.br.maxScrollHeight)!==null&&i!==void 0?i:0),this.br.lastContentY=p,this.br.maxContentY=Math.max(p,(a=this.br.maxContentY)!==null&&a!==void 0?a:0),this.br.maxContentHeight=Math.max(m,(o=this.br.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get _r(){return this._instance.config.scroll_root_selector}getContext(){return this.br}resetContext(){var t=this.br;return setTimeout(this.yr,0),t}startMeasuringScrollPosition(){Qt(re,"scroll",this.yr,{capture:!0}),Qt(re,"scrollend",this.yr,{capture:!0}),Qt(re,"resize",this.yr)}scrollElement(){if(!this._r)return re==null?void 0:re.document.documentElement;var t=Ve(this._r)?this._r:[this._r];for(var n of t){var i=re==null?void 0:re.document.querySelector(n);if(i)return i}}wr(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this._r){var i=this.scrollElement();return i&&i[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.wr("y")}scrollX(){return this.wr("x")}}var R4=e=>Kw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class Oy{constructor(t,n,i,a){this.kr=o=>{var u=this.Sr();if(!u||u.sessionId!==o){var f={sessionId:o,props:this.Cr(this._instance)};this.Mr.register({[hg]:f})}},this._instance=t,this.Tr=n,this.Mr=i,this.Cr=a||R4,this.Tr.onSessionId(this.kr)}Sr(){return this.Mr.props[hg]}getSetOnceProps(){var t,n=(t=this.Sr())==null?void 0:t.props;return n?"r"in n?Zw(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Lt(ix(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+Xm(i)]=n})),t}}class ux{on(t,n){return this.Er[t]||(this.Er[t]=[]),this.Er[t].push(n),()=>{this.Er[t]=this.Er[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.Er[t]||[])i(n);for(var a of this.Er["*"]||[])a(t,n)}constructor(){this.Er={}}}var xl=Ht("[SessionId]"),By=864e5;class Py{on(t,n){return this.Ir.on(t,n)}constructor(t,n,i){var a;if(this.Pr=null,this.Rr=[],this.Ar=void 0,this.Fr=!1,this.Ir=new ux,this.Lr=(h,p)=>!(!zi(h)||!zi(p))&&Math.abs(h-p)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===$i)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ne=t.config,this.Mr=t.persistence,this.Or=void 0,this.Dr=void 0,this._sessionStartTimestamp=null,this.$r=void 0,this._sessionActivityTimestamp=null,this.Nr=n||Pi,this.qr=i||Pi;var o=this.Ne.persistence_name||this.Ne.token;if(this._sessionTimeoutMs=1e3*ui(this.Ne.session_idle_timeout_seconds||1800,60,36e3,xl.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+o+"_window_id",this.Hr="ph_"+o+"_primary_window_exists",this.Ur()){var u=Jt.H(this.Br),f=Jt.H(this.Hr);u&&!f?this.Or=u:Jt.q(this.Br),Jt.F(this.Hr,!0)}(a=this.Ne.bootstrap)!=null&&a.sessionID&&this.setBootstrapSessionId(this.Ne.bootstrap.sessionID),this.zr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return xe(this.Rr)&&(this.Rr=[]),this.Rr.push(t),this.Dr&&t(this.Dr,this.Or),()=>{this.Rr=this.Rr.filter((n=>n!==t))}}Ur(){return this.Ne.persistence!=="memory"&&!this.Mr.xi&&Jt.N()}Wr(t){t!==this.Or&&(this.Or=t,this.Ur()&&Jt.F(this.Br,t))}Vr(){return this.Or?this.Or:this.Ur()?Jt.H(this.Br):null}Zr(t){var n=this.Pr;return!nr(n)&&!nr(t)&&5e3>Math.abs(t-n)}Gr(t,n,i){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Dr||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.Dr=t,o&&!a||o&&this.Zr(n)||(this.Pr=n,this.Mr.register({[kl]:[n,t,i]}))}Qr(){var t,n=(t=this.Ne)==null?void 0:t.persistence_save_debounce_ms;return zi(n)&&n>0}Kr(){this.Qr()?this.Mr.refreshKey(kl):(this.Mr.flush(),this.Mr.load())}Jr(){var t;if(!nr(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Pr){this.Kr();var n=this.Yr();n[1]===this.Dr&&n[2]===this._sessionStartTimestamp&&(this.Pr=this._sessionActivityTimestamp,this.Mr.register({[kl]:[this._sessionActivityTimestamp,(t=this.Dr)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Mr.flush())}}Xr(){var t=this.Yr()[0],n=zi(t)?t:0,i=zi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}tn(t){return this.Kr(),this.Lr(t,this.Xr())}Yr(){var t=this.Mr.props[kl];return Ve(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Pr=null,this.$r=void 0,clearTimeout(this.en),this.en=void 0,this.Gr(null,null,null)}setBootstrapSessionId(t,n){n===void 0&&(n=!1);var i=(function(a,o){o===void 0&&(o=new Date().getTime());try{var u=(f=>{var h=f.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(a);return u>o+6e4?void xl.error("Bootstrap sessionID cannot be in the future"):u}catch(f){return void xl.error("Invalid sessionID in bootstrap",f)}})(t);return!xe(i)&&(n?this.$r={sessionId:t,sessionStartTimestamp:i}:this.Gr(t,new Date().getTime(),i),!0)}destroy(){this.Fr=!0,this.Jr(),clearTimeout(this.en),this.en=void 0,this.Ar&&re&&(re.removeEventListener(rf,this.Ar,{capture:!1}),this.Ar=void 0),this.Rr=[]}zr(){this.Ar=()=>{this.Jr(),this.Ur()&&Jt.q(this.Hr)},Qt(re,rf,this.Ar,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Ne.cookieless_mode===$i)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),a=this.Yr(),o=a[1],u=a[2],f=this.Xr(),h=this.Vr(),p=this.$r,m=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>By),x=p?m:zi(u)&&Math.abs(i-u)>By,b=!1,y=!1,_=!o||!!p,j=o,N=!_&&!t&&this.Lr(i,f);if(N){(N=this.tn(i))||xl.info("cross-tab refresh kept the session alive",{sessionId:o});var k=this.Yr();o=k[1],u=k[2]}if(_||N||x){var E=p&&!m;o=E?p.sessionId:this.Nr(),h=this.qr(),xl.info("new session ID assigned",{sessionId:o,windowId:h,bootstrapped:!!E,changeReason:{noSessionId:_,activityTimeout:N,sessionPastMaximumLength:x}}),u=E?p.sessionStartTimestamp:i,this.$r=void 0,b=!0}else h||(h=this.qr(),b=!0),(y=o!==j)&&(xl.info("adopted cross-tab session id",{sessionId:o,windowId:h}),b=!0);var C=zi(f)&&t&&!x?f:i,O=zi(u)?u:new Date().getTime();this.Wr(h),this.Gr(o,C,O),t||this.jr();var z={noSessionId:_,activityTimeout:N,sessionPastMaximumLength:x,crossTabAdoption:y};return b&&this.Rr.forEach((L=>L(o,h,z))),{sessionId:o,windowId:h,sessionStartTimestamp:O,changeReason:b?z:void 0,lastActivityTimestamp:f}}jr(){this.Fr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Fr)if(this.tn(new Date().getTime())){var t=this.Dr;this.resetSessionId(),this.Ir.emit("forcedIdleReset",{idleSessionId:t})}else this.jr()}),1.1*this.sessionTimeoutMs))}}var f2=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&ty(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((a=>ty(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function h2(){return(h2=Dt((function*(){var e=Hn==null?void 0:Hn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return vt(n)&&n.length>0?n:void 0}catch(i){return void ye.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var uf=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 am(e,t,n){return jl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var p2={exact:(e,t)=>t.some((n=>e.some((i=>n===i)))),is_not:(e,t)=>t.every((n=>e.every((i=>n!==i)))),regex:(e,t)=>t.some((n=>e.some((i=>uf(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!uf(n,i))))),icontains:(e,t)=>t.map(md).some((n=>e.map(md).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(md).every((n=>e.map(md).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i<parseFloat(a)))}))},md=e=>e.toLowerCase();function m2(e,t){return!e||Object.entries(e).every((n=>{var i=n[1],a=t==null?void 0:t[n[0]];if(xe(a)||nr(a))return!1;var o=[String(a)],u=p2[i.operator];return!!u&&u(i.values,o)}))}var Cg="custom",$y="i.posthog.com",L4=/^\/static\//,D4=["/s/","/e/","/i/"];class z4{constructor(t){this.rn={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+$y,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.rn[this.apiHost]||(this.rn[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Cg),this.rn[this.apiHost]}nn(t){if(L4.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}sn(t){var n=Rl(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}an(t,n,i){if(t==="ui")return i;var a=i,o=this.instance.config.rewriteRequestPath;if(o){var u,f=((u=Rl(i))==null?void 0:u.href)||i;a=o(new URL(f)).toString()}if(o&&t==="api"&&D4.some((b=>n.indexOf(b)===0))){var h=this.sn(a);if(h){var p,m=this.apiHost,x=this.ln;((p=x)==null?void 0:p.apiHost)===m&&x.rewriteRequestPath===o||(x={apiHost:m,rewriteRequestPath:o,urls:new Set},this.ln=x),x.urls.add(h)}}return a}isIngestionEndpoint(t){var n=this.ln,i=this.sn(t);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&n.urls.has(i)}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.an(t,n,this.uiHost+n);if(t==="flags")return this.an(t,n,this.flagsApiHost+n);if(t==="assets"){var i=this.nn(n);if(i)return this.an(t,n,""+i+n)}if(this.region===Cg)return this.an(t,n,this.apiHost+n);var a=$y+n;switch(t){case"assets":return this.an(t,n,"https://"+this.region+"-assets."+a);case"api":return this.an(t,n,"https://"+this.region+"."+a)}}}function g2(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var kt=Ht("[Surveys]"),x2="seenSurvey_",v2=e=>{try{var t=(n=>((i,a)=>""+x2+(function(o){return o.current_iteration&&o.current_iteration>0?o.id+"_"+o.current_iteration:o.id})(a))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){kt.error("Failed to persist survey seen state",n)}},O4=[tm.Popover,tm.Widget,tm.API],B4={ignoreConditions:!1,ignoreDelay:!1,displayType:_g.Popover},P4=Ht("[PostHog ExternalIntegrations]"),$4={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class F4{constructor(t){this._instance=t}ai(t,n){var i;(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(a=>{if(a)return P4.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,f,h=i[0],p=i[1];!p||(o=Oe.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[h]||t.ai($4[h],(()=>{var m;(m=Oe.__PosthogExtensions__)==null||(m=m.integrations)==null||(m=m[h])==null||m.start(t._instance)})),!p&&(u=Oe.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[h]&&((f=Oe.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[h])==null||f.stop())};for(var i of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class U4{constructor(t,n){this.rt=t,this.un=n,this.hn=new Map,this.dn=!1}add(t){var n=this;return Dt((function*(){if(n.dn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.hn.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.hn.set(t.name,t);try{var i=t.setup(n.un);i&&(yield i)}catch(o){var a=n.hn.get(t.name)===t;a&&n.hn.delete(t.name),n.rt.error('Failed to set up browser extension "'+t.name+'"',o),a&&n.vn(t)}}))()}dispose(){if(!this.dn){this.dn=!0;var t=Array.from(this.hn.values()).reverse();for(var n of(this.hn.clear(),t))this.vn(n)}}vn(t){try{var n=t.dispose==null?void 0:t.dispose();n&&Fn(n.then)&&n.then(void 0,(i=>{this.rt.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.rt.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class I4{constructor(t){this._instance=t}initialize(){}get(t){var n=this._instance.persistence;if(typeof t=="string")return n==null?void 0:n.get_property(t);var i={};for(var a of t){var o=n==null?void 0:n.get_property(a);xe(o)||(i[a]=o)}return i}set(t,n){var i;(i=this._instance.persistence)==null||i.register(typeof t=="string"?{[t]:n}:t)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var Fy="extensionsRemoteConfig";class H4{constructor(t){this.dn=!1,this.instance=t,this.rt=ye,this.cn=t.fn,this.kv=new I4(t),this.onEvent=n=>pd(this.instance.on("eventCaptured",(i=>{try{n({event:i.event,properties:i.properties})}catch(a){this.rt.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.dn)return pd((()=>{}));var i=o=>{try{n(o)}catch(u){this.rt.error("Browser extension remote config listener failed",u)}},a=this.instance.pn.on(Fy,i);return this.cn&&i(this.cn),pd(a)},this.gn=new U4(ye.createLogger("[BrowserExtensions]"),this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Nc))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Nc);return typeof t=="string"?t:void 0}get library(){return{name:Rt.LIB_NAME,version:Rt.LIB_VERSION}}get initialPersonProperties(){var t,n;return(t=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,n,i,a,o=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=o==null?void 0:o.sessionId)!==null&&n!==void 0?n:"",windowId:(i=o==null?void 0:o.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(a=o==null?void 0:o.sessionStartTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.gn.add(t)}capture(t,n,i){var a=this;return Dt((function*(){i?a.instance.capture(t,n,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):a.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return pd(this.instance.mn(t))}handleRemoteConfig(t){this.dn||(this.cn=t,this.instance.pn.emit(Fy,t))}sendRequest(t,n){var i=this;return Dt((function*(){var a;n===void 0&&(n={});var o=i.instance.requestRouter.endpointFor((a=n.target)!==null&&a!==void 0?a:"api",t),u={method:n.method,url:n.query?wf(o,n.query):o,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(i.instance._send_request(u),{statusCode:202}):new Promise((f=>{u.callback=f,i.instance._send_request(u)}))}))()}dispose(){this.dn||(this.dn=!0,this.gn.dispose())}}var gc={},lm=0,df=()=>{},Uy='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Go="Surveys module not available",Iy="sanitize_properties is deprecated. Use before_send instead",b2="Invalid value for property_denylist config: ",q4=["token","distinct_id",Nw],wl="posthog",y2=!j4&&(er==null?void 0:er.indexOf("MSIE"))===-1&&(er==null?void 0:er.indexOf("Mozilla"))===-1,om=e=>{var t;return fe({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:q3(ke==null?void 0:ke.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:df,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:Yt&&vt(Yt==null?void 0:Yt.search)&&Yt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",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){ye.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:xg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ng},error_tracking:{},_onCapture:df},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:n4,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},V4=[["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"]],Hy=e=>{var t={};for(var n of V4){var i=n[0],a=n[1];xe(e[i])||(t[a]=e[i])}var o=Ut({},t,e),u=e.__preview_external_dependency_versioned_paths;return xe(u)||(xe(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),vt(u)&&xe(e.asset_host)&&(o.asset_host=u)),Ve(e.property_blacklist)&&(xe(e.property_denylist)?o.property_denylist=e.property_blacklist:Ve(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(b2+e.property_denylist)),o};class G4{constructor(){this.__forceAllowLocalhost=!1}get yn(){return this.__forceAllowLocalhost}set yn(t){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class mr{bn(t,n){if(t){var i=this.hn.indexOf(t);i!==-1&&this.hn.splice(i,1)}return this.hn.push(n),n.initialize==null||n.initialize(),n}_n(){return this.config.cookieless_mode===$i||this.config.cookieless_mode===xa&&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 G4,this.wn=!1,this.version=Rt.LIB_VERSION,this.kn=new Set,this.xn="",this.pn=new ux,this.hn=[],this.Sn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=om(),this.SentryIntegration=u4,this.sentryIntegration=i=>(function(a,o){var u=qw(a,o);return{name:Hw,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Cn=!1,this.Mn=null,this.Tn=null,this.En=null,this.scrollManager=new M4(this),this.pageViewManager=new Cy(this),this.rateLimiter=new b4(this),this.requestRouter=new z4(this),this.consent=new K3(this),this.externalIntegrations=new F4(this);var n=(t=mr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,a,o)=>{var u=vt(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{var u=vt(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(i=>ye.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==wl){var a,o=(a=gc[i])!==null&&a!==void 0?a:new mr;return o._init(t,n,i),gc[i]=o,gc[wl][i]=o,o}return this._init(t,n,i)}_init(t,n,i){var a,o;n===void 0&&(n={});var u,f=vt(t)?t.trim():"";if(!f)return ye.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return f!==((u=this.config)==null?void 0:u.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+f+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=om(n.defaults),n.debug=this.In(n.debug),this.Pn=n,this.Rn=[],n.person_profiles?this.Tn=n.person_profiles:n.process_person&&(this.Tn=n.process_person);var h=om(n.defaults),p=Hy(n),m=Ut({},h,p,{name:i,token:f});It(h.rageclick)&&It(p.rageclick)&&(m.rageclick=Ut({},h.rageclick,p.rageclick)),It(h.session_recording)&&It(p.session_recording)&&(m.session_recording=Ut({},h.session_recording,p.session_recording)),this.set_config(m),this.config.on_xhr_error&&ye.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Un.GZipJS;var x=this.An();if(this.persistence=new em(this.config,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new em(fe({},this.config,{persistence:"sessionStorage"}),x,!1),this.xn="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!x&&Jt.N()){var b=Jt.H(this.xn);Ve(b)&&b.forEach((L=>{vt(L)&&this.kn.add(L)}))}else Jt.q(this.xn);var y=fe({},this.persistence.props),_=fe({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Fn=new E4((L=>this.Ln(L)),this.config.request_queue_config),this.On=new A4(this),this.__request_queue=[];var j=this._n();if(j||(this.sessionManager=new Py(this),this.sessionPropsManager=new Oy(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((L,V,F)=>{(F!=null&&F.activityTimeout||F!=null&&F.sessionPastMaximumLength||F!=null&&F.crossTabAdoption)&&this.Dn()}))),this.$n(),this.config.__preview_deferred_init_extensions?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Nn(j)}),0)):(ye.info("Initializing extensions synchronously"),this.Nn(j)),Rt.DEBUG=Rt.DEBUG||this.config.debug,Rt.DEBUG&&ye.info("Starting in debug mode",{this:this,config:n,thisC:fe({},this.config),p:y,s:_}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=fe({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((o=n.bootstrap)==null?void 0:o.distinctID)!==void 0){var N=n.bootstrap.distinctID,k=this.get_distinct_id(),E=this.persistence.get_property(pr);if(n.bootstrap.isIdentifiedID&&k!=null&&k!==N&&E===sa)this.identify(N);else if(n.bootstrap.isIdentifiedID&&k!=null&&k!==N&&E===ks)ye.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 C=this.config.get_device_id(Pi()),O=n.bootstrap.isIdentifiedID?C:N;this.persistence.set_property(pr,n.bootstrap.isIdentifiedID?ks:sa),this.register({distinct_id:N,$device_id:O})}}if(j)this.register_once({distinct_id:cd,$device_id:null},"");else if(!this.get_distinct_id()){var z=this.config.get_device_id(Pi());this.register_once({distinct_id:z,$device_id:z},""),this.persistence.set_property(pr,sa)}return Qt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,V){var F=L.config.segment;if(!F)return V();(function(Q,D){var I=Q.config.segment;if(!I)return D();var A=Z=>{var G=()=>Z.anonymousId()||Pi();Q.config.get_device_id=G,Z.id()&&(Q.register({distinct_id:Z.id(),$device_id:G()}),Q.persistence.set_property(pr,ks)),D()},se=I.user();"then"in se&&Fn(se.then)?se.then(A):A(se)})(L,(()=>{F.register((Q=>{typeof Promise<"u"&&Promise.resolve||Zp.warn("This browser does not have Promise support, and can not use the segment integration");var D=(I,A)=>{if(!A)return I;I.event.userId||I.event.anonymousId===Q.get_distinct_id()||(Zp.info("No userId set, resetting PostHog"),Q.reset()),I.event.userId&&I.event.userId!==Q.get_distinct_id()&&(Zp.info("UserId set, identifying with PostHog"),Q.identify(I.event.userId));var se=Q.calculateEventProperties(A,I.event.properties);return I.event.properties=Object.assign({},se,I.event.properties),I};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:I=>D(I,I.event.event),page:I=>D(I,_l),identify:I=>D(I,Wp),screen:I=>D(I,"$screen")}})(L)).then((()=>{V()}))}))})(this,(()=>this.qn())):this.qn(),Fn(this.config._onCapture)&&this.config._onCapture!==df&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),this.config.ip&&ye.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return h2.apply(this,arguments)})().then((L=>{L&&this.register({[Yp]:L})})).catch(df),this}$n(){var t,n,i,a,o,u,f=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(i=mr.__defaultExtensionClasses)==null?void 0:i.featureFlags;f&&(this.featureFlags&&this.featureFlags instanceof f||((a=this.jn)==null||a.call(this),this.jn=void 0,this.featureFlags=new f(this)),Fn(this.featureFlags.onReloading)&&Fn(this.featureFlags.setup)?this.jn||(this.jn=this.featureFlags.onReloading((()=>{this.pn.emit("featureFlagsReloading",!0)})),this.Bn().add(this.featureFlags)):(o=(u=this.featureFlags).initialize)==null||o.call(u))}Nn(t){var n,i,a,o,u,f,h,p=performance.now(),m=fe({},mr.__defaultExtensionClasses,this.config.__extensionClasses),x=[];m.exceptions&&this.hn.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new m.exceptions(this)),m.historyAutocapture&&this.hn.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.hn.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.hn.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!t&&this.hn.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||x.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.hn.push(this.autocapture=new m.autocapture(this)),m.surveys&&this.hn.push(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new m.surveys(this)),m.logs&&this.hn.push(this.logs=(a=this.logs)!==null&&a!==void 0?a:new m.logs(this)),m.metrics&&this.hn.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new m.metrics(this)),m.conversations&&this.hn.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new m.conversations(this)),m.productTours&&this.hn.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.hn.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.hn.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.hn.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.hn.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,c4)),m.toolbar&&this.hn.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new m.toolbar(this)),m.experiments&&this.hn.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new m.experiments(this)),this.hn.forEach((b=>{b.initialize&&x.push((()=>{b.initialize==null||b.initialize()}))})),x.push((()=>{if(this.Hn){var b=this.Hn;this.Hn=void 0,this.hn.forEach((y=>y.onRemoteConfig==null?void 0:y.onRemoteConfig(b)))}})),this.Un(x,p)}Un(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Un(t,n)}),0);var i=t.shift();if(i)try{i()}catch(o){ye.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[Cw]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ew]:a}),this.config.__preview_deferred_init_extensions&&ye.info("PostHog extensions initialized ("+a+"ms)")}Zi(t){var n;if(!ke||!ke.body)return ye.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Zi(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Hn=t),this.fn=t,this.compression=void 0,t.ok){var i,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=qe(a.supportedCompression,Un.GZipJS)?Un.GZipJS:qe(a.supportedCompression,Un.Base64)?Un.Base64:void 0),(i=a.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Tn?this.Tn:xg}),(n=this.zn)==null||n.handleRemoteConfig(t),this.hn.forEach((o=>o.onRemoteConfig==null?void 0:o.onRemoteConfig(t)))}qn(){try{this.config.loaded(this)}catch(i){ye.critical("`loaded` function failed",i)}if(this.Wn(),this.config.internal_or_test_user_hostname&&Yt!=null&&Yt.hostname){var t=Yt.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._n())&&this.Vn()}),1),this.Zn=new e2(this),this.Zn.load()}Wn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Fn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&ud(this.__request_queue,(t=>this.Ln(t))),this.__request_queue=[],this.Wn()}_handle_unload(){var t,n,i,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Gn()&&this.capture(Qp),(i=this.logs)==null||i.flushLogs("sendBeacon"),(a=this.Fn)==null||a.unload(),(o=this.On)==null||o.unload()):this.Gn()&&this.capture(Qp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?y2?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=fe({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(xe(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var i,a,o,u=fe({},n);u.timeout=u.timeout||6e4;var f,h,p,m,x,b=(i=u.transport)!==null&&i!==void 0?i:"fetch";b==="sendBeacon"&&xe(u.compression)&&u.data&&(u.compression=Un.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data={api_key:(h=(x=(m=Ve(f=u.data)?f:[f])[0])==null||(p=x.properties)==null?void 0:p.token)!==null&&h!==void 0?h:x==null?void 0:x.token,batch:m,sent_at:new Date().toISOString()}:u.timestampMode==="body"&&(u.data=(function(N,k){return k===void 0&&(k=new Date().toISOString()),Ve(N)?N.map((E=>fe({},E,{sent_at:k}))):fe({},N,{sent_at:k})})(u.data))),u.url=zy(u.url,u.method,u.compression,u.timestampMode);var y=Od.filter((N=>!u.disableTransport||!N.transport||!u.disableTransport.includes(N.transport))),_=(a=(o=(function(N,k){for(var E=0;N.length>E;E++)if(N[E].transport===b)return N[E]})(y))==null?void 0:o.method)!==null&&a!==void 0?a:y[0].method;if(!_)throw new Error("No available transport method");var j=N=>{try{_(N)}catch(k){u2(k)?ye.warn(k):ye.error(k),u.callback==null||u.callback({statusCode:0,error:k})}};b!=="sendBeacon"&&u.data&&u.compression===Un.GZipJS&&GC&&typeof Promise<"u"&&!zd?N4(u).then((N=>{j(N)})).catch((N=>{if(ey(N))return zd=!0,void j(fe({},u,{compression:void 0,url:zy(n.url,n.method,void 0,n.timestampMode)}));(k=>{if(!k||typeof k!="object")return!1;var E="name"in k?String(k.name):"";return ey(k)||E===F5})(N)&&(zd=!0),j(u)})):_(u)})(fe({},t,{callback:n=>{var i,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(a=this.config).on_request_error)==null||i.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Ln(t){this.On?this.On.retriableRequest(t):this._send_request(t)}_execute_array(t){lm++;try{var n,i=[],a=[],o=[];ud(t,(f=>{if(f)if(Ve(n=f[0]))o.push(f);else if(Fn(f))try{f.call(this)}catch(h){ye.error("Error executing queued PostHog call",f,h)}else Ve(f)&&n==="alias"?i.push(f):Ve(f)&&n.indexOf("capture")!==-1&&Fn(this[n])?o.push(f):a.push(f)}));var u=function(f,h){ud(f,(function(p){try{if(Ve(p[0])){var m=h;Lt(p,(function(x){m=m[x[0]].apply(m,x.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(x){ye.error("Error executing queued PostHog call",p,x)}}))};u(i,this),u(a,this),u(o,this)}finally{lm--}}push(t){if(lm>0&&Ve(t)&&vt(t[0])){var n=mr.prototype[t[0]];Fn(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var a,o,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fn){if(this.is_capturing())if(!xe(t)&&vt(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var m=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(m==null||!m.isRateLimited){n!=null&&n.$current_url&&!vt(n==null?void 0:n.$current_url)&&(ye.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"||i!=null&&i.Qn||ye.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 x=new Date,b=(i==null?void 0:i.timestamp)||x,y=sy(i==null?void 0:i.uuid,Pi),_={uuid:y,event:t,properties:this.calculateEventProperties(t,n||{},b,y)};t===_l&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),m&&(_.properties.$lib_rate_limit_remaining_tokens=m.remainingTokens);var j=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(Zd)===!0;i!=null&&i.$set&&!j&&(_.$set=i==null?void 0:i.$set);var N=i==null?void 0:i.$unset;N&&(_.$unset=N);var k,E,C,O=j?void 0:this.Kn(i==null?void 0:i.$set_once,t!==fy,t===Wp);if(O&&(_.$set_once=O),i!=null&&i._noTruncate||(o=this.config.properties_string_max_length,u=_,f=A=>vt(A)?A.slice(0,o):A,h=new Set,_=(function A(se,Z){if(se!==Object(se))return f?f(se):se;if(!h.has(se)){var G;if(h.add(se),Ve(se))G=[],ud(se,($=>{G.push(A($))}));else{var P={};Lt(se,(($,ie)=>{h.has($)||(P[ie]=A($))})),G=P}return G}})(u)),_.timestamp=b,xe(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=x),j&&(_.properties=(function(A,se){se===void 0&&(se=[]);var Z={},G=P=>{A[P]!==void 0&&(Z[P]=A[P])};return YC.forEach(G),se.forEach(G),Z})(_.properties,q4)),t===Ui.DISMISSED||t===Ui.SENT){var z=n==null?void 0:n[nm.SURVEY_ID],L=n==null?void 0:n[nm.SURVEY_ITERATION];v2({id:z,current_iteration:L}),_.$set=fe({},_.$set,{[(k={id:z,current_iteration:L},E=t===Ui.SENT?"responded":"dismissed",C="$survey_"+E+"/"+k.id,k.current_iteration&&k.current_iteration>0&&(C="$survey_"+E+"/"+k.id+"/"+k.current_iteration),C)]:!0})}else t===Ui.SHOWN&&(_.$set=fe({},_.$set,{[nm.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===v4.SHOWN){var V=n==null?void 0:n[Ty.TOUR_TYPE];V&&(_.$set=fe({},_.$set,{[Ty.TOUR_LAST_SEEN_DATE+"/"+V]:new Date().toISOString()}))}var F=fe({},_.properties.$set,_.$set);if(Ii(F)||this.setPersonPropertiesForFlags(F),!Ge(this.config.before_send)){var Q=this.Pt(_);if(!Q)return;(_=Q).uuid=sy(_.uuid,Pi)}this.pn.emit("eventCaptured",_);var D=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I={method:"POST",url:D,data:_,compression:"best-available",timestampMode:(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(D)?"body":"capture-body",batchKey:i==null?void 0:i._batchKey,transport:i==null?void 0:i.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Ln(I):this.Fn.enqueue(I),_}ye.critical("This capture call is ignored due to client rate limiting.")}}else ye.error("No event name provided to posthog.capture")}else ye.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}Bn(){var t;return(t=this.zn)!==null&&t!==void 0?t:this.zn=new H4(this)}mn(t){this.Sn.push(t);var n=!0;return()=>{if(n){n=!1;var i=this.Sn.indexOf(t);i!==-1&&this.Sn.splice(i,1)}}}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=o?void 0:this.persistence.remove_event_timer(t),f=fe({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this._n()&&(f[Nw]=!0),t==="$snapshot"){var h=fe({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!vt(f.distinct_id)&&!an(f.distinct_id)||Km(f.distinct_id))&&ye.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,m=(function(z,L,V,F){var Q,D,I,A;if(F===void 0&&(F=!1),!er)return{};var se,Z=z?[...Dl,...L||[]]:[],G=(function(_t){for(var Nt=0;ry.length>Nt;Nt++){var ve=ry[Nt],$e=ve[1],nt=ve[0].exec(_t),nn=nt&&(Fn($e)?$e(nt,_t):$e);if(nn)return nn}return["",""]})(er),P=G[0],$=G[1],ie=(se=typeof navigator<"u"?navigator:void 0)!=null&&se.brave?{brave:!0}:{},ae={};xe(V)||(ae.detectGoogleSearchApp=V);var R={},B=(Q=navigator)==null||(Q=Q.userAgentData)==null?void 0:Q.platform,K=(D=navigator)==null?void 0:D.maxTouchPoints,M=re==null||(I=re.screen)==null?void 0:I.width,pe=re==null||(A=re.screen)==null?void 0:A.height,_e=re==null?void 0:re.devicePixelRatio;xe(B)||(R.userAgentDataPlatform=B),xe(K)||(R.maxTouchPoints=K),xe(M)||(R.screenWidth=M),xe(pe)||(R.screenHeight=pe),xe(_e)||(R.devicePixelRatio=_e);var Ce,De,Ee,Be,Je,jt,dt,gt,xt=Ut(ix({$os:P,$os_version:$,$browser:dw(er,navigator.vendor,ie,ae),$device:iy(er),$device_type:(De=er,Ee=R,gt=iy(De),gt===Y5||gt===G5||gt==="Kobo"||gt==="Kindle Fire"||gt===aw?Tl:gt===kc||gt===Cl||gt===jc||gt===Jm?"Console":gt===W5?"Wearable":gt?vr:(Ee==null?void 0:Ee.userAgentDataPlatform)==="Android"&&((Be=Ee==null?void 0:Ee.maxTouchPoints)!==null&&Be!==void 0?Be:0)>0?600>Math.min((Je=Ee==null?void 0:Ee.screenWidth)!==null&&Je!==void 0?Je:0,(jt=Ee==null?void 0:Ee.screenHeight)!==null&&jt!==void 0?jt:0)/((dt=Ee==null?void 0:Ee.devicePixelRatio)!==null&&dt!==void 0?dt:1)?vr:Tl:"Desktop"),$timezone:Jw(),$timezone_offset:m4()}),{$current_url:Ec(F?As(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,Z,Tc),$host:Yt==null?void 0:Yt.host,$pathname:Yt==null?void 0:Yt.pathname,$raw_user_agent:er.length>1e3?er.substring(0,997)+"...":er,$browser_version:f3(er,navigator.vendor,ie,ae),$browser_language:Ey(),$browser_language_prefix:(Ce=Ey(),typeof Ce=="string"?Ce.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:Rt.LIB_NAME,$lib_version:Rt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Rt.SDK_DIST_CHANNEL&&(xt.$sdk_dist_channel=Rt.SDK_DIST_CHANNEL),xt})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var x=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime()),b=x.windowId;f.$session_id=x.sessionId,f.$window_id=b}this.sessionPropsManager&&Ut(f,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&Ut(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(y=this.On)==null?void 0:y.length}catch(z){f.$sdk_debug_error_capturing_properties=String(z)}if(this.requestRouter.region===Cg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==_l||o?t!==Qp||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),f=Ut(f,p),t===_l&&ke&&(f.title=ke.title),!xe(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}er&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties();Lt(["$referrer","$referring_domain"],(z=>{z in j&&delete N[z]}));var k={};if(this.Sn.length>0)for(var E of this.Sn.slice())try{Ut(k,E())}catch(z){ye.error("Failed to produce browser extension event properties",z)}(f=Ut({},m,j,N,fe({},k,f))).$is_identified=this._isIdentified(),Ve(this.config.property_denylist)?Lt(this.config.property_denylist,(function(z){delete f[z]})):ye.error(b2+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var C=this.config.sanitize_properties;C&&(ye.error(Iy),f=C(f,t));var O=this.Jn();return f.$process_person_profile=O,O&&!o&&this.Yn("_calculate_event_properties"),f}Kn(t,n,i){var a;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.Jn()||this.wn&&!i)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=Ut({},o,u||{},t||{}),h=this.config.sanitize_properties;return h&&(ye.error(Iy),f=h(f,"$set_once")),n&&(this.wn=!0),Ii(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)==null||a.register_once(t,n,i)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t),Object.keys(t).forEach((i=>this.kn.add(i))),this.Xn()}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t),this.kn.delete(t),this.Xn()}ts(t,n){this.register({[t]:n})}Dn(){this.kn.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.kn.clear(),this.Xn()}Xn(){var t;if(this.xn)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.xi||!Jt.N())Jt.q(this.xn);else{var n=[];this.kn.forEach((i=>n.push(i))),n.length>0?Jt.F(this.xn,n):Jt.q(this.xn)}}getFeatureFlag(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var i,a;return(i=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.pn.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:Go}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)==null?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:Go})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Go})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=B4),(i=this.surveys)==null||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:Go}}canRenderSurveyAsync(t,n){var i,a;return n===void 0&&(n=!1),(i=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Go})}es(t){return!t||Km(t)?(ye.critical("Unique user id has not been set in posthog.identify"),!1):t===cd?(ye.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())||(ye.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return ye.uninitializedWarning("posthog.identify");if(an(t)&&(t=t.toString(),ye.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.es(t)&&this.Yn("posthog.identify")){var a=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Nc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:a},""),t!==a&&t!==this.get_property(nc)&&(this.unregister(nc),this.register({distinct_id:t}));var o,u=(this.persistence.get_property(pr)||sa)===sa,f=t!==a,h=!f&&u;if(f&&u)this.persistence.set_property(pr,ks),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Wp,{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:i||{}}),this.En=am(t,n,i),(o=this.featureFlags)==null||o.setAnonymousDistinctId(a);else if(h){this.persistence.set_property(pr,ks);var p=n||{},m=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:m},!1),this.capture("$set",{$set:p,$set_once:m}),this.En=am(t,n,i)}else(n||i)&&this.setPersonProperties(n,i);f?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ba)):h&&(n||i)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.Yn("posthog.setPersonProperties")){var i=am(this.get_distinct_id(),t,n);this.En!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.En=i):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,i=(Ve(t)?t:[t]).filter((a=>vt(a)&&a.length>0));i.length!==0&&this.Yn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.En=null)}group(t,n,i){if(t&&n){var a=this.getGroups(),o=a[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:fe({},a,{[t]:n})}),o||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(fy,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),o&&!i&&this.reloadFeatureFlags()}else ye.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),this.Yn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n=gr(t)?t:t==null?void 0:t.resetDeviceID,i=gr(t)||t==null?void 0:t.bootstrap;this.rs(n,!1,i)}rs(t,n,i){var a,o,u,f,h,p,m,x,b,y,_,j;if(n===void 0&&(n=!1),ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");var N=i==null?void 0:i.sessionID;this.config.bootstrap=i||((a=this.Pn)==null?void 0:a.bootstrap)||{},(o=this.featureFlags)==null||o.updateConfig==null||o.updateConfig(this.config,this.Qi());var k,E,C,O,z=this.get_property(Nc),L=this.get_property(Yp),V=this.get_property(ya),F=this.is_capturing();if(this.consent.reset(),n||!F||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after."),(u=this.persistence)==null||u.clear(),(f=this.sessionPersistence)==null||f.clear(),this.kn.clear(),this.Xn(),xe(V)||(k=this.persistence)==null||k.register({[ya]:V}),(h=this.surveys)==null||h.reset(),(p=this.Zn)==null||p.stop(),(m=this.featureFlags)==null||m.reset(),(x=this.conversations)==null||x.reset(),(b=this.logs)==null||b.reset(),(y=this.metrics)==null||y.reset(),(_=this.persistence)==null||_.set_property(pr,sa),(j=this.sessionManager)==null||j.resetSessionId(),this.En=null,this.config.cookieless_mode===$i)this.register_once({distinct_id:cd,$device_id:null},"");else{var Q=this.config.get_device_id(Pi());this.register_once({distinct_id:Q,$device_id:t?Q:z},""),t||xe(L)||this.register({[Yp]:L})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID===void 0||this._n()||((O=this.persistence)==null||O.set_property(pr,i.isIdentifiedID?ks:sa),this.register({distinct_id:i.distinctID})),(E=this.featureFlags)==null||E.initialize(),!(xe(N)||(C=this.sessionManager)!=null&&C.setBootstrapSessionId(N,!0)))){var D=fe({},i);delete D.sessionID,this.config.bootstrap=D}delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var n=this;return Dt((function*(){var i,a,o,u,f,h,p;if(n.__loaded){(i=n.Zn)==null||i.stop(),(a=n.zn)==null||a.dispose(),(o=n.sessionRecording)==null||o.dispose(),(u=n.logs)==null||u.flushLogs("sendBeacon"),(f=n.metrics)==null||f.flush("sendBeacon"),(h=n.Fn)==null||h.unload(),(p=n.On)==null||p.unload();try{var m;(m=n.featureFlags)==null||m.destroy()}catch(x){ye.error("Error while destroying feature flags",x)}}else ye.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.ns()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.ss()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&i){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(yw)?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this.Yn("posthog.alias")?(xe(n)&&(n=this.get_distinct_id()),t!==n?(this.ts(nc,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(ye.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=fe({},this.config);if(It(t)){var i,a,o,u,f,h,p,m,x,b,y,_;Ut(this.config,Hy(t));var j=this.An();(i=this.persistence)==null||i.update_config(this.config,n,j),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new em(fe({},this.config,{persistence:"sessionStorage"}),j,!1);var N=this.In(this.config.debug);gr(N)&&(this.config.debug=N),gr(this.config.debug)&&(this.config.debug?(Rt.DEBUG=!0,Bt.N()&&Bt.F("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:fe({},this.config)})):(Rt.DEBUG=!1,Bt.N()&&Bt.q("ph_debug"))),(a=this.featureFlags)==null||a.updateConfig==null||a.updateConfig(this.config,this.Qi()),(o=this.exceptionObserver)==null||o.onConfigChange(),(u=this.exceptions)==null||u.onConfigChange(),(f=this.sessionRecording)==null||f.startIfEnabledOrStop(),(h=this.tracingHeaders)==null||h.startIfEnabledOrStop(),(p=this.autocapture)==null||p.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),(x=this.exceptionObserver)==null||x.startIfEnabledOrStop(),(b=this.deadClicksAutocapture)==null||b.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.os(),(_=this.externalIntegrations)==null||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Rt.LIB_NAME=t,Rt.LIB_VERSION=n}startSessionRecording(t){var n,i,a,o,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),h.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var i=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(fe({},a,n))}}addExceptionStep(t,n){var i;(i=this.exceptions)==null||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:mr.ls}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)==null?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:wl;return n!==wl&&(n=wl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(pr))===ks||((n=this.sessionPersistence)==null?void 0:n.get_property(pr))===ks}Jn(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===xg&&!this._isIdentified()&&Ii(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[nc])&&((n=this.persistence)==null||(n=n.props)==null||!n[tf]))}Gn(){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.Jn()||this.Yn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yn(t){return this.config.person_profiles==="never"?(ye.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ts(tf,!0),!0)}An(){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!==xa)}os(){var t,n,i,a,o=this.An();return((t=this.persistence)==null?void 0:t.xi)!==o&&((i=this.persistence)==null||i.set_disabled(o)),((n=this.sessionPersistence)==null?void 0:n.xi)!==o&&((a=this.sessionPersistence)==null||a.set_disabled(o)),o&&(this.kn.clear(),this.Xn()),o}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==$i){if(this._n()){var i,a,o,u,f;this.rs(!0,!0),(i=this.sessionManager)==null||i.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new Py(this),this.pageViewManager=new Cy(this),this.persistence&&(this.sessionPropsManager=new Oy(this,this.sessionManager,this.persistence));var h,p=(o=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&o!==void 0?o:(f=mr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.bn(this.sessionRecording,new p(this)),this.fn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.fn)))}var m,x;this.consent.optInOut(!0),this.os(),this.Wn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==xa&&((m=this.surveys)==null||m.loadIfEnabled()),(xe(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((x=t==null?void 0:t.captureEventName)!==null&&x!==void 0?x:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vn()}else ye.warn(Uy)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==$i?(this.config.cookieless_mode===xa&&this.consent.isOptedIn()&&this.rs(!0,!0),this.consent.optInOut(!1),this.os(),this.config.cookieless_mode===xa&&(this.register({distinct_id:cd,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vn(),this.Wn())):ye.warn(Uy)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===$i||(this.config.cookieless_mode===xa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.os()}_is_bot(){return Hn?f2(Hn,this.config.custom_blocked_useragents):void 0}Vn(){ke&&(ke.visibilityState==="visible"?this.Cn||(this.Cn=!0,this.capture(_l,{title:ke.title},{send_instantly:!0}),this.Mn&&(ke.removeEventListener(nf,this.Mn),this.Mn=null)):this.Mn||(this.Mn=this.Vn.bind(this),Qt(ke,nf,this.Mn)))}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}))}Qi(){var t=this.Pn||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ye.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,i,a,o,u){var f=i in n&&!Ge(n[i]),h=a in n&&!Ge(n[a]);return f?n[i]:!!h&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,ye)}Pt(t){var n;if(Ge(this.config.before_send))return t;var i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(e3),a=Ve(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a){if(o=u(o),Ge(o)){var f="Event '"+t.event+"' was rejected in beforeSend function";return JC(t.event)?ye.warn(f+". This can cause unexpected behavior."):ye.info(f),null}o.properties&&!Ii(o.properties)||ye.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of i)if(o.properties&&Ge(o.properties[h]))return ye.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return o}getPageViewId(){var t;return(t=this.pageViewManager.ui)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}In(t){var n=gr(t)&&!t,i=Bt.N()&&Bt.P("ph_debug")==="true";return!n&&(!!i||t)}}mr.__defaultExtensionClasses={},mr.ls=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=I3(e.prototype[t[n]])})(mr,["identify"]);class qy{constructor(t){this.disabled=t===!1;var n=It(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,i){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>i-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:i}];return!1}}var cm="$copy_autocapture",um=Ht("[AutoCapture]");function dm(e,t){return t.length>e?t.slice(0,e)+"...":t}function Y4(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ms(t));return t}function Q4(e,t){var n,i,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,f=t.elementAttributeIgnoreList,h=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!Ms(e))return{props:{}};for(var m=[e],x=new Set([e]),b=e;b.parentNode&&!xr(b,"body")&&Ow>m.length;)if(zw(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),m.push(y),b=y}else{if(!Ms(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),m.push(b.parentNode),b=b.parentNode}var _,j,N=[],k={},E=!1,C=!1;if(Lt(m,(F=>{var Q=yg(F);if(xr(F,"a")){var D=F.getAttribute("href");E=!!(Q&&D&&pc(D))&&(p?As(D):D)}qe(af(F),"ph-no-capture")&&(C=!0),N.push((function(A,se,Z,G,P){P===void 0&&(P=!1);var $=A.tagName.toLowerCase(),ie={tag_name:$};ax.indexOf($)>-1&&!Z&&(ie.$el_text=$.toLowerCase()==="a"||$.toLowerCase()==="button"?dm(1024,ky(A)):dm(1024,Cc(A)));var ae=af(A);ae.length>0&&(ie.classes=ae.filter((function(M){return M!==""}))),Lt(A.attributes,(function(M){var pe;if((!Uw(A)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(G==null||!G.includes(M.name))&&!se&&pc(M.value)&&(!vt(pe=M.name)||pe.substring(0,10)!=="_ngcontent"&&pe.substring(0,7)!=="_nghost")){var _e=M.value;M.name==="class"&&(_e=sx(_e).join(" ")),ie["attr__"+M.name]=dm(1024,M.name==="href"&&P?As(_e):_e)}}));for(var R=1,B=1,K=A;K=Y4(K);)R++,K.tagName===A.tagName&&B++;return ie.nth_child=R,ie.nth_of_type=B,ie})(F,o,u,f,p));var I=(function(A){if(!yg(A))return{};var se={};return Lt(A.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var G=Z.name.replace("data-ph-capture-attribute-",""),P=Z.value;G&&P&&pc(P)&&(se[G]=P)}})),se})(F);Ut(k,I)})),C)return{props:{},explicitNoCapture:C};if(u||(N[0].$el_text=xr(e,"a")||xr(e,"button")?ky(e):Cc(e)),E){var O,z;N[0].attr__href=E;var L=(O=Rl(E))==null?void 0:O.host,V=re==null||(z=re.location)==null?void 0:z.host;L&&V&&L!==V&&(_=E)}return{props:Ut({$event_type:a.type,$ce_version:1},h?{}:{$elements:N},{$elements_chain:(j=N,(function(F){return F.map((Q=>{var D,I,A="";if(Q.tag_name&&(A+=Q.tag_name),Q.attr_class)for(var se of(Q.attr_class.sort(),Q.attr_class))A+="."+se.replace(/"/g,"");var Z=fe({},Q.text?{text:Q.text}:{},{"nth-child":(D=Q.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(I=Q.nth_of_type)!==null&&I!==void 0?I:0},Q.href?{href:Q.href}:{},Q.attr_id?{attr_id:Q.attr_id}:{},Q.attributes),G={};return Dd(Z).sort(((P,$)=>P[0].localeCompare($[0]))).forEach((P=>{var $=P[1];return G[jy(P[0].toString())]=jy($.toString())})),(A+=":")+Dd(G).map((P=>P[0]+'="'+P[1]+'"')).join("")})).join(";")})((function(F){return F.map((Q=>{var D,I,A={text:(D=Q.$el_text)==null?void 0:D.slice(0,400),tag_name:Q.tag_name,href:(I=Q.attr__href)==null?void 0:I.slice(0,2048),attr_class:l4(Q),attr_id:Q.attr__id,nth_child:Q.nth_child,nth_of_type:Q.nth_of_type,attributes:{}};return Dd(Q).filter((se=>se[0].indexOf("attr__")===0)).forEach((se=>A.attributes[se[0]]=se[1])),A}))})(j)))},(n=N[0])!=null&&n.$el_text?{$el_text:(i=N[0])==null?void 0:i.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},k)}}var Yo=Ht("[ExceptionAutocapture]"),Vy=()=>{},W4=Ht("[TracingHeaders]"),oa=Ht("[Web Vitals]"),Gy=9e5,Yy="disabled",Qy="lazy_loading",Qo="awaiting_config",gd="missing_config";Ht("[SessionRecording]"),Ht("[SessionRecording]");var Eg="[SessionRecording]",Ri=Ht(Eg),X4=Ht("[Heatmaps]");function fm(e){return It(e)&&"clientX"in e&&"clientY"in e&&an(e.clientX)&&an(e.clientY)}var xd=Ht("[Product Tours]"),hm=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(tx))},K4=["$set_once","$set"],si=Ht("[SiteApps]"),Wy="Error while initializing PostHog app with config id ";function vl(e,t,n){if(Ge(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class Z4{constructor(t){this.us=new ux,this.hs=(n,i)=>this.ds(n,i)&&this.vs(n,i)&&this.cs(n,i)&&this.fs(n,i),this.ds=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this.ps=new Set,this.gs=new Set}init(){var t,n;xe((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,a)=>{this.on(i,a)}))}register(t){var n,i;if(!xe((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.gs)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var m;(m=this.ps)==null||m.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var a,o=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&o.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(o)}}on(t,n){var i;n!=null&&t.length!=0&&(this.ps.has(t)||this.ps.has(n.event))&&this.gs&&((i=this.gs)==null?void 0:i.size)>0&&this.gs.forEach((a=>{this.ys(n,a)&&this.us.emit("actionCaptured",a.name)}))}bs(t){this.onAction("actionCaptured",(n=>t(n)))}ys(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.hs(t,i))return!0;return!1}onAction(t,n){return this.us.on(t,n)}vs(t,n){if(n!=null&&n.url){var i,a=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!a||typeof a!="string"||!vl(a,n.url,n.url_matching||"contains"))return!1}return!0}cs(t,n){return!!this._s(t,n)&&!!this.ws(t,n)&&!!this.ks(t,n)}_s(t,n){var i;if(n==null||!n.href)return!0;var a=this.xs(t);if(a.length>0)return a.some((f=>vl(f.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&vl((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}ws(t,n){var i;if(n==null||!n.text)return!0;var a=this.xs(t);if(a.length>0)return a.some((p=>vl(p.text,n.text,n.text_matching||"exact")||vl(p.$el_text,n.text,n.text_matching||"exact")));var o,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(o=(function(p){for(var m,x=[],b=/(?::|")text="(.*?)"/g;!Ge(m=b.exec(p));)x.includes(m[1])||x.push(m[1]);return x})(h),u=n.text,f=n.text_matching||"exact",o.some((p=>vl(p,u,f))))}ks(t,n){var i,a;if(n==null||!n.selector)return!0;var o=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(o!=null&&o.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}xs(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}fs(t,n){return n==null||!n.properties||n.properties.length===0||m2(n.properties.reduce(((i,a)=>{var o=Ve(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return i[a.key]={values:o,operator:a.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class J4{constructor(t){var n;this.Ss=[],this._instance=t,this.Cs=new Map,this.Ms=new Map,this.Ts=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((i=>this.Es(i)))}Is(t){return!1}Ps(){return null}Rs(t){}As(){}Fs(t,n){return!!t&&m2(t.propertyFilters,n==null?void 0:n.properties)}Ls(t,n){var i=new Map;return t.forEach((a=>{var o;(o=a.conditions)==null||(o=o[n])==null||(o=o.values)==null||o.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(a.id),i.set(u.name,f)}}))})),i}Os(t,n,i){var a=(i===Ho.Activation?this.Cs:this.Ms).get(t),o=[];return this.Ds((u=>{o=u.filter((f=>a==null?void 0:a.includes(f.id)))})),o.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[i])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Fs(h,n)}))}register(t){var n;xe((n=this._instance)==null?void 0:n._addCaptureHook)||(this.$s(t),this.Ns(t))}Ns(t){var n=t.filter((i=>{var a,o;return((a=i.conditions)==null?void 0:a.actions)&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));n.length!==0&&(this.qs==null&&(this.qs=new Z4(this._instance),this.qs.init(),this.qs.bs((i=>{this.onAction(i)}))),n.forEach((i=>{var a,o,u,f,h;i.conditions&&(a=i.conditions)!=null&&a.actions&&(o=i.conditions)!=null&&(o=o.actions)!=null&&o.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.qs)==null||f.register(i.conditions.actions.values),(h=i.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var m=this.Ts.get(p.name);m&&m.push(i.id),this.Ts.set(p.name,m||[i.id])}})))})))}$s(t){var n,i=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.events)&&((f=o.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.cancelEvents)&&((f=o.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((o,u)=>{this.onEvent(o,u)})),this.Cs=this.Ls(t,Ho.Activation),this.Ms=this.Ls(t,Ho.Cancellation))}onEvent(t,n){var i,a,o=this.js(),u=(n==null||(i=n.properties)==null?void 0:i.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.Bs(t,u);if(f==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.Hs([u]);if(f==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),this.Us(u),void this.zs([u])}if(this.Ms.has(t)){var h=this.Os(t,n,Ho.Cancellation);h.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((m=>m.id))}),this.Hs(h.map((m=>m.id))),h.forEach((m=>this.Ws(m.id))))}if(this.Cs.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.Cs.get(t)});var p=this.Os(t,n,Ho.Activation);this.Vs(p.map((m=>m.id)))}}onAction(t){this.Ts.has(t)&&this.Vs(this.Ts.get(t)||[])}Vs(t){var n;if(t.length!==0){var i=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),a=[];for(var o of t)i&&this.Is(o)?this.Us(o)&&this.Zs(o):a.push(o);a.length>0&&(this.Ss=[...new Set([...this.Ss,...a])]),this.js().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Us(t){this.Ss=this.Ss.filter((i=>i!==t));var n=this.Gs();return!n.includes(t)&&(this.Qs([...n,t]),this.Ks(),!0)}Hs(t){var n=new Set(t);this.Ss=this.Ss.filter((o=>!n.has(o)));var i=this.Js(),a=i.filter((o=>!n.has(o)));a.length!==i.length&&(this.Qs(a),a.length===0&&this.Ys()),this.zs(t)}Xs(){var t,n=this.Ps();if(!n)return{};var i=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return i&&typeof i=="object"?i:{}}Zs(t){if(this.Ps()){var n=this.Xs();this.Rs(fe({},n,{[t]:Date.now()}))}}zs(t){if(this.Ps()){var n=this.Xs(),i={},a=!1;for(var o of Object.entries(n)){var u=o[0],f=o[1];t.includes(u)?a=!0:i[u]=f}a&&(Ii(i)?this.As():this.Rs(i))}}ta(){this.Ps()&&this.As()}getActivationTimestamp(t){if(this.Gs().includes(t)){var n=this.Xs()[t];return an(n)?n:void 0}}Js(){var t,n=this.ea();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Gs(){var t,n,i=this.Js();if(i.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.ia()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?i:[]}Ks(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.ra(n)}Ys(){this.na()}Es(t){var n,i=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.ia()];if(i&&i!==t){var a=this.Js(),o=this.Xs();a.length>0&&(this.Qs([]),a.filter((u=>an(o[u]))).forEach((u=>this.Ws(u)))),this.Ys(),this.ta()}}getActivatedIds(){return[...new Set([...this.Gs(),...this.Ss])].filter((t=>!this.sa(t)))}reset(){this.Ss=[],this.Js().length>0&&this.Qs([]),this.Ys(),this.ta()}getEventToItemsMap(){return this.Cs}aa(){return this.qs}}class eE extends J4{constructor(t){super(t)}ea(){return fg}ia(){return Md}Ps(){return Rd}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Rd]:t})}As(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Rd)}Is(t){var n,i;this.Ds((o=>{i=o.find((u=>u.id===t))}));var a=(n=i)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return an(a)&&a>0}oa(){return Ui.SHOWN}Ds(t){var n;(n=this._instance)==null||n.getSurveys(t)}Ws(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}js(){return kt}Qs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[fg]:t})}ra(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Md]:t})}na(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Md)}sa(){return!1}Bs(t,n){var i;this.Ds((o=>{i=o.find((u=>u.id===n))}));var a=!i||(function(o){var u;return g2(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(i);return a?t===Ui.SHOWN?"consume":"ignore":t===Ui.SHOWN?"persist":t===Ui.DISMISSED||t===Ui.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var vd="SDK is not enabled or survey functionality is not yet loaded",Xy="Disabled. Not loading surveys.",tE=re!=null&&re.location?lf(re.location.hash,"__posthog")||lf(location.hash,"state"):null,Ky="_postHogToolbarParams",Zy=Ht("[Toolbar]"),Jy=Ht("[FeatureFlags]");class nE{constructor(t,n){n===void 0&&(n=!1),this.la=!1,this.update(t,n)}update(t,n){this.ua=((i,a)=>{var o,u,f,h;return{bootstrap:{featureFlags:(o=i.bootstrap)==null?void 0:o.featureFlags,featureFlagPayloads:(u=i.bootstrap)==null?void 0:u.featureFlagPayloads},remoteRequestsDisabled:a,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,requestTimeoutMs:i.feature_flag_request_timeout_ms,compression:i.disable_compression?"none":"base64",evaluationContexts:(f=(h=i.evaluation_contexts)!==null&&h!==void 0?h:i.evaluation_environments)!==null&&f!==void 0?f:[],flagKeys:Ve(i.flag_keys)?i.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.la||(Jy.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.la=!0),xe(t.flag_keys)||Ve(t.flag_keys)||Jy.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.ua}}var e_=Ht("[FeatureFlags]"),ca=Ht("[FeatureFlags]",{debugEnabled:!0}),pm=`" failed. Feature flags didn't load in time.`,t_="connection_error",n_=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},r_=e=>{var t={};for(var n of Dd(e||{})){var i=n[1];i&&(t[n[0]]=i)}return t},ai=Ht("[Error tracking]"),i_="Refusing to render web experiment since the viewer is a likely bot",rE={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>uf(t,e),not_regex:(e,t)=>!uf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Mn{get Ne(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((a=>{Mn.ha("retrieved web experiments from the server"),n.da=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.da&&(Mn.ha("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.da)==null||u.set(o.feature_flag_key,o));var f=n._instance.getFeatureFlag(o.feature_flag_key);vt(f)&&o.variants[f]&&n.va(o.name,f,o.variants[f].transforms)}else if(o.variants)for(var h in o.variants){var p=o.variants[h];Mn.ca(p,n._instance)&&n.va(o.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.ha(i_);else if(!this.Ne.disable_web_experiments){if(Ge(this.da))return this.da=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.ha("applying feature flags",t),t.forEach((n=>{var i;if(this.da&&(i=this.da)!=null&&i.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.da)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.va(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=Ll(t==null?void 0:t.search,"__experiment_id"),i=Ll(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Mn.ha("previewing web experiments "+n+" && "+i),this.getWebExperiments((a=>{this.fa(parseInt(n),i,a)}),!1,!0))}}loadIfEnabled(){this.Ne.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Ne.disable_web_experiments&&!i)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Ne.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}fa(t,n,i){var a=i.filter((o=>o.id===t));a&&a.length>0&&(Mn.ha("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.va(a[0].name,n,a[0].variants[n].transforms))}static ca(t,n){return!Ge(t.conditions)&&Mn.pa(t,n)&&Mn.ga(t)}static pa(t,n){var i;if(Ge(t.conditions)||Ge((i=t.conditions)==null?void 0:i.url))return!0;var a=Mn.getWindowLocation();if(a){var o,u,f,h=Rw(n,a.href);return(o=t.conditions)==null||!o.url||rE[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return re==null?void 0:re.location}static ga(t){var n;if(Ge(t.conditions)||Ge((n=t.conditions)==null?void 0:n.utm))return!0;var i=Yw();if(i.utm_source){var a,o,u,f,h,p,m,x,b=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==i.utm_campaign,y=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==i.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==i.utm_medium,j=(m=t.conditions)==null||(m=m.utm)==null||!m.utm_term||((x=t.conditions)==null||(x=x.utm)==null?void 0:x.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static ha(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;n>a;a++)i[a-1]=arguments[a];ye.info("[WebExperiments] "+t,i)}va(t,n,i){this._is_bot()?Mn.ha(i_):n!=="control"?i.forEach((a=>{if(a.selector){var o;Mn.ha("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Mn.ha("Control variants leave the page unmodified.")}_is_bot(){return Hn&&this._instance?f2(Hn,this.Ne.custom_blocked_useragents):void 0}}var Dr=Ht("[Conversations]"),ua="Conversations not available yet.",s_="console",_2="__posthogHandledLogsRequestError",mm=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[_2]=!0,n},a_=e=>!!e&&typeof e=="object"&&e[_2]===!0,Sf={featureFlags:class{constructor(e){this.name="featureFlags",this.ma=!1,this.featureFlagEventHandlers=[],this.rt=e_,this.ya={},this.ba={},this._a=[],this.wa=!1,this.ka=!1,this.xa=0,this.Sa=!1,this.Ca=!1,this.Ma=!1,this.Ta=!1,this.Ea=0,this.Ia=()=>{var t=this.Pa();this.Ea=0,t&&this.reloadFeatureFlags()},"get"in e?this.Ra=e:(this.Aa=new nE(e.config,e.Qi()),this.Ra=this.Aa)}updateConfig(e,t){var n;(n=this.Aa)==null||n.update(e,t)}setup(e){return this.Fa=e,this.rt=e.logger.createLogger("[FeatureFlags]"),n=()=>{this.Fa===e&&(this.Fa=void 0,this.un=e,this.La(e))},(t=e.kv.initialize())!=null&&t.then?t.then(n):n();var t,n}La(e){if(this.un===e)return re&&Qt(re,"online",this.Ia),this.Oa=e.registerDynamicEventProperties((()=>this.Da()?this.ya:this.ba)),this.$a(),this.initialize()}destroy(){re==null||re.removeEventListener("online",this.Ia)}dispose(){var e;this.xa++,this.Ca=!1,this.Fa=void 0,this.un&&(this.Na(),(e=this.Oa)==null||e.dispose(),this.Oa=void 0,this._a=[],re==null||re.removeEventListener("online",this.Ia),this.un=void 0)}get Ne(){return this.Ra.get()}qa(e){var t;return(t=this.un)==null?void 0:t.kv.get(e)}F(e){this.ja((()=>{var t;return(t=this.un)==null?void 0:t.kv.set(e)}))}q(e){this.ja((()=>{var t;return(t=this.un)==null?void 0:t.kv.remove(e)}))}ja(e){try{e()}catch(t){this.rt.error("Failed to update feature flag persistence",t)}}$a(){var e={};for(var t of[ic,sc,Ad,oi]){var n=this.qa(t);xe(n)||(e[t]=n)}this.ya=e;var i=fe({},e),a=this.qa(pa);if(a)for(var o of Object.entries(a))i["$feature/"+o[0]]=o[1];this.ba=i}Da(){var e=this.Ne.cacheTtlMs;if(!e||0>=e)return!1;var t=this.qa(hc);return typeof t!="number"||Date.now()-t>e}Ba(){return!!this.Da()&&(this.Ta||this.ka||(this.Ta=!0,this.rt.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ha(){var e=this.Ne.evaluationContexts;return e!=null&&e.length?e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.rt.error("Invalid evaluation context found:",t,"Expected non-empty string"),n})):[]}Ua(){var e=this.Ne.flagKeys;if(!xe(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.rt.error("Invalid flag key found:",t,"Expected non-empty string"),n}))}initialize(){var e,t,n=this.Ne,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},f=Object.keys(i).filter((p=>!!i[p])).reduce(((p,m)=>(p[m]=i[m]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,m)=>(p[m]=u[m],p)),{});return this.za({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var i,a,o=n!=null&&n.merge&&(i=this.qa(pa))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.qa(sc))!==null&&a!==void 0?a:{},f=fe({},o,e),h=fe({},u,t),p={};for(var m of Object.entries(f)){var x=m[0],b=m[1];p[x]={key:x,enabled:Xb(b),variant:Kb(b),reason:void 0,metadata:xe(h==null?void 0:h[x])?void 0:{id:0,version:void 0,description:void 0,payload:h[x]}}}this.za({flags:p})}get hasLoadedFlags(){return this.wa}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.qa(ug),t=this.qa(oi),n=this.qa(ma);if(!n&&!t)return e||{};var i=Ut({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,f,h=i[o],p=t==null?void 0:t[o],m=xe(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,x=xe(p)?h==null?void 0:h.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=fe({},h,{enabled:m,variant:m?x??(h==null?void 0:h.variant):void 0});m!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=fe({},h==null?void 0:h.metadata,{payload:b,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[o]=y}return this.ma||(this.rt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ma=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var i=e[n];return{key:n,enabled:Xb(i),variant:Kb(i),payload:Wb(t[n])}}))}getFlagVariants(){var e=this.qa(pa),t=this.qa(oi);if(!t)return e||{};for(var n=Ut({},e||{}),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ma||(this.rt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ma=!0),n}getFlagPayloads(){var e=this.qa(sc),t=this.qa(ma);if(!t)return e||{};for(var n=Ut({},e||{}),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ma||(this.rt.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ma=!0),n}reloadFeatureFlags(){this.Sa||this.Ne.featureFlagsDisabled||this.Pa()||this.Wa||(this._a.slice().forEach((e=>{try{e()}catch(t){this.rt.error("Error while running feature flags reloading callback",t)}})),this.Wa=setTimeout((()=>{this.Va()}),5))}Na(){clearTimeout(this.Wa),this.Wa=void 0}onReloading(e){return this._a.push(e),()=>{this._a=this._a.filter((t=>t!==e))}}ensureFlagsLoaded(){this.wa||this.ka||this.Wa||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Sa=e}resetFlagCallReported(){this.q(ba)}Va(e){this.Na();var t=this.un;if(t&&!this.Ne.remoteRequestsDisabled&&!this.Pa())if(this.ka)this.Ca=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:fe({},t.initialPersonProperties,this.qa(Oi)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.qa(ga),timezone:Jw()};xe(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Ne.featureFlagsDisabled)&&(n.disable_flags=!0);var i=this.Ha();i.length&&(n.evaluation_contexts=i);var a=this.Ua();xe(a)||(n.flag_keys=a);var o=this.Ne.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),f=this.xa;this.ka=!0;var h=()=>{this.Ca&&(this.Ca=!1,this.Va())},p=m=>{this.ka=!1,f===this.xa&&(this.F({[Ld]:[t_]}),this.rt.error("Feature flag request failed",m)),h()};try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.Ne.compression==="base64"?Un.Base64:void 0,sentAt:"body",timeoutMs:this.Ne.requestTimeoutMs}).then((m=>{var x,b,y=(x=m.json)!==null&&x!==void 0?x:{},_=m.statusCode!==200;if(this.ka=!1,f===this.xa){if(this.Za(m.statusCode),_||this.Ca||(this.$anon_distinct_id=void 0),!n.disable_flags||this.Ca){this.Ma=!_;var j=[];m.error?j.push(m.error instanceof Error&&m.error.name==="AbortError"?"timeout":m.error instanceof Error?t_:"unknown_error"):m.statusCode!==200&&j.push("api_error_"+m.statusCode),y.errorsWhileComputingFlags&&j.push("errors_while_computing_flags");var N=!((b=y.quotaLimited)==null||!b.includes("feature_flags"));N&&j.push("quota_limited"),this.F({[Ld]:j}),N?this.rt.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."):n.disable_flags||this.za(y,_,{partialResponse:o}),h()}}else h()})).catch(p)}catch(m){p(m)}}}Pa(){return Vw(this.Ea,3)}Za(e){this.Ea=Gw(e,this.Ea,3,(()=>this.rt.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Ma)if(this.wa||this.getFlags()&&this.getFlags().length>0){if(!this.Ba()){var i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}}else this.rt.warn('getFeatureFlag for key "'+e+pm)}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.Ma)if(this.wa||this.getFlags()&&this.getFlags().length>0){if(!this.Ba()){var n,i=this.getFlagVariants(),a=e in i,o=i[e],u=this.getFlagPayloads()[e],f=String(o),h=this.qa(Ad)||void 0,p=this.qa(hc)||void 0,m=this.qa(ba)||{};if(this.Ne.deduplicateCallsPerSession){var x,b=(x=this.un)==null?void 0:x.session.sessionId,y=this.qa(lc);b&&b!==y&&(m={},n=b)}if(t.send_event||!("send_event"in t))if(e in m&&m[e].includes(f))n&&this.F({[ba]:m,[lc]:n});else{var _,j,N,k,E,C,O,z,L,V,F,Q;Ve(m[e])?m[e].push(f):m[e]=[f],this.F(fe({[ba]:m},n?{[lc]:n}:{}));var D=this.getFeatureFlagDetails(e),I=[...(_=this.qa(Ld))!==null&&_!==void 0?_:[]];xe(o)&&I.push("flag_missing");var A={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:u??null,$feature_flag_request_id:h,$feature_flag_evaluated_at:p,$feature_flag_bootstrapped_response:(j=(N=this.Ne.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[e])!==null&&j!==void 0?j:null,$feature_flag_bootstrapped_payload:(k=(E=this.Ne.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])!==null&&k!==void 0?k:null,$used_bootstrap_value:!this.Ma};xe(D==null||(C=D.metadata)==null?void 0:C.has_experiment)||(A.$feature_flag_has_experiment=D.metadata.has_experiment),xe(D==null||(O=D.metadata)==null?void 0:O.version)||(A.$feature_flag_version=D.metadata.version);var se,Z=(z=D==null||(L=D.reason)==null?void 0:L.description)!==null&&z!==void 0?z:D==null||(V=D.reason)==null?void 0:V.code;Z&&(A.$feature_flag_reason=Z),D!=null&&(F=D.metadata)!=null&&F.id&&(A.$feature_flag_id=D.metadata.id),xe(D==null?void 0:D.original_variant)&&xe(D==null?void 0:D.original_enabled)||(A.$feature_flag_original_response=xe(D.original_variant)?D.original_enabled:D.original_variant),D!=null&&(Q=D.metadata)!=null&&Q.original_payload&&(A.$feature_flag_original_payload=D==null||(se=D.metadata)==null?void 0:se.original_payload),I.length&&(A.$feature_flag_error=I.join(",")),this.Ga(A)}else n&&this.F({[ba]:m,[lc]:n});if(a)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:Wb(u)}}}else this.rt.warn('getFeatureFlagResult for key "'+e+pm)}Ga(e){try{var t;(t=this.un)==null||t.capture("$feature_flag_called",e).catch((n=>{this.rt.error("Failed to capture feature flag call",n)}))}catch(n){this.rt.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Qa(e,t)}Qa(e,t){var n=this;return Dt((function*(){var i=n.un;if(i){var a={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},o=n.Ha();o.length&&(a.evaluation_contexts=o);var u,f=n.Ua();xe(f)||(a.flag_keys=f);try{var h,p=(h=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.Ne.compression==="base64"?Un.Base64:void 0,sentAt:"body",timeoutMs:n.Ne.requestTimeoutMs})).json)==null?void 0:h.featureFlagPayloads;u=(p==null?void 0:p[e])||void 0}catch(m){return void n.rt.error("Remote config feature flag request failed",m)}try{t(u)}catch(m){n.rt.error("Remote config feature flag callback failed",m)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.Ma)return t.defaultValue;if(!(this.wa||this.getFlags()&&this.getFlags().length>0))return this.rt.warn('isFeatureEnabled for key "'+e+pm),t.defaultValue;var n=this.getFeatureFlag(e,t);return xe(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){this.za(e,t,n)}za(e,t,n){if(this.un){this.wa=!0;var i=(function(a,o,u,f,h,p){o===void 0&&(o={}),u===void 0&&(u={}),f===void 0&&(f={}),p===void 0&&(p=e_);var m=((L,V)=>{var F=L.flags;return F?fe({},L,{featureFlags:Object.fromEntries(Object.keys(F).map((Q=>{var D;return[Q,(D=F[Q].variant)!==null&&D!==void 0?D:F[Q].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(F).filter((Q=>F[Q].enabled)).filter((Q=>{var D;return(D=F[Q].metadata)==null?void 0:D.payload})).map((Q=>{var D;return[Q,(D=F[Q].metadata)==null?void 0:D.payload]})))}):(L.featureFlags&&V.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),L)})(a,p),x=m.flags,b=m.featureFlags,y=m.featureFlagPayloads;if(b){var _=a.requestId,j=a.evaluatedAt;if(Ve(b)){p.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var N={};if(b)for(var k=0;b.length>k;k++)N[b[k]]=!0;return{[ic]:b,[pa]:N,[Zd]:!1}}var E=b,C=y,O=x;if(h!=null&&h.partialResponse)E=fe({},o,E),C=fe({},u,C),O=fe({},f,O);else if(a.errorsWhileComputingFlags)if(x){var z=new Set(Object.keys(x).filter((L=>{var V;return!((V=x[L])!=null&&V.failed)})));E=fe({},o,Object.fromEntries(Object.entries(E).filter((L=>z.has(L[0]))))),C=fe({},u,Object.fromEntries(Object.entries(C||{}).filter((L=>z.has(L[0]))))),O=fe({},f,Object.fromEntries(Object.entries(O||{}).filter((L=>z.has(L[0])))))}else E=fe({},o,E),C=fe({},u,C),O=fe({},f,O);return fe({[ic]:Object.keys(r_(E)),[pa]:E||{},[sc]:C||{},[ug]:O||{},[Zd]:a.minimalFlagCalledEvents===!0},_?{[Ad]:_}:{},j?{[hc]:j}:{})}})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.rt);i&&this.F(i),t||(this.Ta=!1),this.Ka(t)}}override(e,t){t===void 0&&(t=!1),this.rt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Ja(e)}Ja(e){if(this.un){if(e===!1)return this.q([oi,ma]),this.Ka(),void ca.info("All overrides cleared");if(Ve(e))return this.F({[oi]:n_(e)}),this.Ka(),void ca.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.ma=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var i={},a=n.flags,o=n.payloads;return a&&(i[oi]=Ve(a)?n_(a):a),o&&(i[ma]=o),Object.keys(i).length&&this.F(i),a===!1&&o===!1?this.q([oi,ma]):a===!1?this.q(oi):o===!1&&this.q(ma),this.Ka(),a===!1?ca.info("Flag overrides cleared"):a&&ca.info("Flag overrides set",{flags:a}),void(o===!1?ca.info("Payload overrides cleared"):o&&ca.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.F({[oi]:e}),this.Ka(),void ca.info("Flag overrides set",{flags:e});this.rt.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.rt.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.wa){var t=this.Ya(),n=t.flags,i=t.flagVariants;try{e(n,i)}catch(a){this.rt.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i=(this.qa(Td)||[]).find((h=>h.flagKey===e)),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n);var u=fe({},this.getFlagVariants(),{[e]:t});this.F({[ic]:Object.keys(r_(u)),[pa]:u,[Oi]:fe({},this.qa(Oi)||{},a)}),this.Ka();try{var f;(f=this.un)==null||f.capture("$feature_enrollment_update",o).catch((h=>{this.rt.error("Failed to capture early access feature enrollment",h)}))}catch(h){this.rt.error("Failed to capture early access feature enrollment",h)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.qa(Td);!i||t?this.Xa(e,n):e(i)}Xa(e,t){var n=this;return Dt((function*(){var i=n.un;if(i){var a,o=t?"&"+t.map((f=>"stage="+f)).join("&"):"";try{var u=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+o,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;n.F({[Td]:a=u.json.earlyAccessFeatures})}catch(f){return void n.rt.error("Early access feature request failed",f)}try{e(a)}catch(f){n.rt.error("Early access feature callback failed",f)}}}))()}Ya(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}Ka(e){this.$a();var t=this.Ya(),n=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,i,{errorsLoading:e})}catch(o){this.rt.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.eo(e,t)}eo(e,t){t===void 0&&(t=!0);var n=this.qa(Oi)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this.F({[Oi]:fe({},n,o,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=fe({},this.qa(Oi)||{});e.forEach((i=>{delete n[i]})),this.F({[Oi]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.q(Oi),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.qa(ga)||{},i=fe({},n);for(var a of Object.keys(e))i[a]=fe({},n[a],e[a]);this.F({[ga]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.qa(ga)||{};this.F({[ga]:fe({},t,{[e]:{}})})}else this.q(ga)}reset(){this.xa++,this.Ca=!1,this.$a(),this.wa=!1,this.Sa=!1,this.Ma=!1,this.$anon_distinct_id=void 0,this.Na(),this.ma=!1,this.Ea=0}}},iE={sessionRecording:class{get Ne(){return this._instance.config}get Mr(){return this._instance.persistence}get started(){var e;return!((e=this.io)==null||!e.isStarted)}get status(){var e,t;return this.ro===Qo||this.ro===gd?this.ro:(e=(t=this.io)==null?void 0:t.status)!==null&&e!==void 0?e:this.ro}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ro=Yy,this.no=void 0,this.so=!1,this.ao=(()=>{var t;if(ke==null||!ke.visibilityState||ke.visibilityState==="visible")return!0;var n=re==null||(t=re.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((i=>i.name==="visible"))})(),this.Ie=()=>{var t;(ke==null?void 0:ke.visibilityState)==="visible"&&(this.ao=!0,(t=this.io)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Ri.error("started without valid sessionManager"),new Error(Eg+" started without valid sessionManager. This is a bug.");if(this.Ne.cookieless_mode===$i)throw new Error(Eg+' cannot be used with cookieless_mode="always"');ke!=null&&ke.addEventListener&&Qt(ke,"visibilitychange",this.Ie)}initialize(){this.startIfEnabledOrStop()}dispose(){this.so=!0,ke==null||ke.removeEventListener==null||ke.removeEventListener("visibilitychange",this.Ie),this.stopRecording()}get oo(){var e,t=!((e=this._instance.get_property(ya))==null||!e.enabled),n=!this.Ne.disable_session_recording,i=this.Ne.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!(this.so||this.oo&&(t=this.io)!=null&&t.isStarted)){var n=!xe(Object.assign)&&!xe(Array.from);this.oo&&n?(this.lo(e),Ri.info("starting")):(this.ro=Yy,this.stopRecording())}}lo(e){var t,n,i;this.oo&&(this.ro!==Qo&&this.ro!==gd&&(this.ro=Qy),Oe!=null&&(t=Oe.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Oe.__PosthogExtensions__)!=null&&n.initSessionRecording?this.uo(e):(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.ho,(a=>{if(a)return Ri.error("could not load recorder",a);this.uo(e)})))}stopRecording(){var e,t;(e=this.no)==null||e.call(this),this.no=void 0,(t=this.io)==null||t.stop()}do(){var e,t;(e=this.no)==null||e.call(this),this.no=void 0,(t=this.io)==null||t.discard()}vo(){var e,t;(e=this.Mr)==null||e.unregister(nx),(t=this.Mr)==null||t.unregister(_w)}co(e,t){if(Ge(e))return null;var n,i=an(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(Ri.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}fo(e){if(this.Mr){var t,n,i=this.Mr,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.co((o=this.Ne.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),h=this.co(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;Ge(p)&&this.vo();var m=u==null?void 0:u.minimumDurationMilliseconds;i.register({[ya]:fe({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:fe({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:xe(m)?null:m,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this.no)==null||t.call(this),this.no=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.fo(t),void this.do()):(this.fo(t),void this.startIfEnabledOrStop()):(this.ro===Qo&&(this.ro=gd,Ri.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.io)!=null&&n.log?this.io.log(e,t):Ri.warn("log called before recorder was ready")}get ho(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ya);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}po(){var e,t=this._instance.get_property(ya);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Ri.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ge(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}uo(e){var t,n,i;if(!this.so){if((t=Oe.__PosthogExtensions__)==null||!t.initSessionRecording)return Ri.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Tw]:!0});var a;if(this.io||(this.io=(a=Oe.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.ao),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.po())return this.ro===gd||this.ro===Qo?void 0:(this.ro=Qo,Ri.info("persisted remote config is stale, requesting fresh config before starting"),void new e2(this._instance).load());this.ro=Qy,(n=(i=this.io).setDocumentWasEverVisible)==null||n.call(i,this.ao),this.io.start(e)}}onRRwebEmit(e){var t;(t=this.io)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.io||(t=this.Mr)==null||t.register({[Sw]:!0}),(e=this.io)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.io||(t=this.Mr)==null||t.register({[ww]:!0}),(e=this.io)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.io||(n=this.Mr)==null||n.register({[e==="url"?kw:jw]:!0}),(t=this.io)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.io)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.io)==null||!n.tryAddCustomEvent(e,t))}}},sE={autocapture:class{constructor(e){this.mo=!1,this.yo=null,this.bo=!1,this._o=!1,this.instance=e,this.rageclicks=new qy(e.config.rageclick),this.wo=null}initialize(){this.startIfEnabled()}get Ne(){var e,t,n=It(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}ko(){if(this.isBrowserSupported()){if(re&&ke){var e=n=>{n=n||(re==null?void 0:re.event);try{this.xo(n)}catch(i){um.error("Failed to capture event",i)}};if(Qt(ke,"submit",e,{capture:!0}),Qt(ke,"change",e,{capture:!0}),Qt(ke,"click",e,{capture:!0}),this.Ne.capture_copied_text){var t=n=>{n=n||(re==null?void 0:re.event);try{this.xo(n,cm)}catch(i){um.error("Failed to capture copy/cut event",i)}};Qt(ke,"copy",t,{capture:!0}),Qt(ke,"cut",t,{capture:!0})}}}else um.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.mo&&(this.ko(),this.mo=!0)}onRemoteConfig(e){if(this.bo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._o=t.elementsChainAsString);var n=t.autocapture_opt_out;gr(n)&&(this.instance.persistence&&this.instance.persistence.register({[rg]:n}),this.yo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.wo=e}getElementSelectors(e){var t,n=[];return(t=this.wo)==null||t.forEach((i=>{var a=ke==null?void 0:ke.querySelectorAll(i);a==null||a.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[rg],i=this.yo,a=this.instance.Qi()&&!this.bo;if(nr(i)&&!gr(n)&&!a)return!1;var o=(t=this.yo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!o}xo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Kp(e);Dw(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&by(i,this.instance.config.rageclick)&&this.xo(e,"$rageclick");var a=t===cm;if(i&&(function(x,b,y,_,j,N){var k;if(!re||lx(x)||y!=null&&y.url_allowlist&&!gy(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&gy(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){var E=y.dom_event_allowlist;if(E&&!E.some((F=>b.type===F)))return!1}var C=Fw(x,_),O=C.parentIsUsefulElement,z=C.targetElementList;if(!(function(F,Q){var D=Q==null?void 0:Q.element_allowlist;if(xe(D))return!0;var I,A=function(Z){if(D.some((G=>Z.tagName.toLowerCase()===G)))return{v:!0}};for(var se of F)if(I=A(se))return I.v;return!1})(z,y)||!bg(z,y==null?void 0:y.css_selector_allowlist)||bg(z,(k=y==null?void 0:y.css_selector_ignorelist)!==null&&k!==void 0?k:t4))return!1;try{var L=re.getComputedStyle(x);if(L&&L.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}var V=x.tagName.toLowerCase();switch(V){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return O?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(ax.indexOf(V)>-1||x.getAttribute("contenteditable")==="true")}})(i,e,this.Ne,a,a?["copy","cut"]:void 0,this.instance)){var o=Q4(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ne.element_attribute_ignorelist,elementsChainAsString:this._o,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),u=o.props;if(o.explicitNoCapture)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(u.$element_selectors=f),t===cm){var h,p=Bw(re==null||(h=re.getSelection())==null?void 0:h.toString()),m=e.type||"clipboard";if(!p)return!1;u.$selected_content=p,u.$copy_type=m}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return Fn(ke==null?void 0:ke.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.So=(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&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Co&&this.Co(),this.Co=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.Mo("pushState"),this.Mo("replaceState"),this.To())}Mo(e){var t;if(re&&((t=re.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,a,o){try{if(!(a in i))return Vy;var u={next:i[a]},f=o((function(){for(var h=arguments.length,p=new Array(h),m=0;h>m;m++)p[m]=arguments[m];return u.next.apply(this,p)}));return Fn(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:u}})),i[a]=f,()=>{if(i[a]!==f)for(var h=i[a];Fn(h)&&h.__posthog_layer__;){var p=h.__posthog_layer__;if(p.next===f)return void(p.next=u.next);h=p.next}else i[a]=u.next}}catch{return Vy}})(re.history,e,(i=>function(a,o,u){i.call(this,a,o,u),n.Eo(e)}))}}Eo(e){try{var t,n=re==null||(t=re.location)==null?void 0:t.pathname;if(!n)return;n!==this.So&&this.isEnabled&&this._instance.capture(_l,{navigation_type:e}),this.So=n}catch(i){ye.error("Error capturing "+e+" pageview",i)}}To(){if(!this.Co){var e=()=>{this.Eo("popstate")};Qt(re,"popstate",e),this.Co=()=>{re&&re.removeEventListener("popstate",e)}}}},heatmaps:class{get Ne(){return this.instance.config}constructor(e){var t;this.Io=!1,this.mo=!1,this.Po=null,this.instance=e,this.Io=!((t=this.instance.persistence)==null||!t.props[ig]),this.rageclicks=new qy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return It(this.Ne.capture_heatmaps)&&this.Ne.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ne.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ge(this.Ne.capture_heatmaps)?Ge(this.Ne.enable_heatmaps)?this.Io:this.Ne.enable_heatmaps:this.Ne.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.mo)return;X4.info("starting..."),this.Ro(),this.Ie()}else{var e;clearInterval((e=this.Po)!==null&&e!==void 0?e:void 0),this.Ao(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ig]:n}),this.Io=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Fo(e){fm(e.originalEvent)&&this.ke(e.originalEvent,"deadclick")}Ie(){this.Po&&clearInterval(this.Po),this.Po=(ke==null?void 0:ke.visibilityState)==="visible"?setInterval(this.cr.bind(this),this.flushIntervalMilliseconds):null}Ro(){re&&ke&&(this.Lo=this.cr.bind(this),Qt(re,rf,this.Lo),this.Oo=e=>this.ke(e||(re==null?void 0:re.event)),Qt(ke,"click",this.Oo,{capture:!0}),this.Do=e=>this.$o(e||(re==null?void 0:re.event)),Qt(ke,"mousemove",this.Do,{capture:!0}),this.No=new Ny(this.instance,o4,this.Fo.bind(this)),this.No.startIfEnabledOrStop(),this.qo=this.Ie.bind(this),Qt(ke,nf,this.qo),this.mo=!0)}Ao(){var e;re&&ke&&(this.Lo&&re.removeEventListener(rf,this.Lo),this.Oo&&ke.removeEventListener("click",this.Oo,{capture:!0}),this.Do&&ke.removeEventListener("mousemove",this.Do,{capture:!0}),this.qo&&ke.removeEventListener(nf,this.qo),clearTimeout(this.jo),(e=this.No)==null||e.stop(),this.mo=!1)}Bo(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,f,h){for(var p=u;p&&Ms(p)&&!xr(p,"body");){if(p===h)return!1;var m=void 0;try{var x,b,y;m=(x=(b=(y=p.ownerDocument)==null?void 0:y.defaultView)!==null&&b!==void 0?b:re)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(qe(f,m))return!0;p=Pw(p)}return!1})(Kp(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}ke(e,t){var n;if(t===void 0&&(t="click"),!my(e.target)&&fm(e)){var i=this.Bo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&by(Kp(e),this.instance.config.rageclick)&&this.Vt(fe({},i,{type:"rageclick"})),this.Vt(i)}}$o(e){!my(e.target)&&fm(e)&&(clearTimeout(this.jo),this.jo=setTimeout((()=>{this.Vt(this.Bo(e,"mousemove"))}),500))}Vt(e){if(re){var t=this.Ne.disable_capture_url_hashes?As(re.location.href):re.location.href,n=this.Ne.custom_personal_data_properties,i=this.Ne.mask_personal_data_properties?[...Dl,...n||[]]:[],a=Ec(t,i,Tc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}cr(){this.R&&!Ii(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ny,webVitalsAutocapture:class{constructor(e){var t;this.Io=!1,this.mo=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Uo),this.Uo=void 0,this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",fe({$current_url:this.R.url},this.R.metrics.reduce(((n,i)=>fe({},n,{["$web_vitals_"+i.name+"_event"]:fe({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.zo=n=>{var i;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ge(n==null?void 0:n.name)||Ge(n==null?void 0:n.value))oa.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.Wo(a);if(!xe(o)){var u=an(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+o;if(!this.Vo||this.Vo>n.value){this.R.navigationKey!==u&&(this.Ho(),this.Uo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),xe(this.R.navigationKey)&&(this.R.navigationKey=u,this.R.url=o),this.R.firstMetricTimestamp=xe(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var f=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),h=fe({},n,a?{navigationURL:o}:{},{$current_url:o,timestamp:Date.now()});xe(f)||(h.$session_id=f.sessionId,h.$window_id=f.windowId),this.R.metrics.push(h),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else oa.error("Ignoring metric with value >= "+this.Vo,n)}}},this.Zo=()=>{if(!this.mo){var n,i,a,o,u=Oe.__PosthogExtensions__,f=u==null?void 0:u.postHogWebVitalsCallbacksByFlavor,h=(f==null?void 0:f[this.Go])||(this.Go==="web-vitals"&&xe(f)?u==null?void 0:u.postHogWebVitalsCallbacks:void 0);if(xe(h)||(n=h.onLCP,i=h.onCLS,a=h.onFCP,o=h.onINP),n&&i&&a&&o){var p={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&n(this.zo.bind(this),p),this.allowedMetrics.indexOf("CLS")>-1&&i(this.zo.bind(this),p),this.allowedMetrics.indexOf("FCP")>-1&&a(this.zo.bind(this),p),this.allowedMetrics.indexOf("INP")>-1&&o(this.zo.bind(this),p),this.mo=!0}else oa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Io=!((t=this._instance.persistence)==null||!t.props[og]),this.startIfEnabled()}get Qo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=It(this.Qo)?(e=this.Qo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Ge(n)?((t=this._instance.persistence)==null?void 0:t.props[cg])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(It(this.Qo)?this.Qo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=It(this.Qo)?this.Qo.web_vitals_attribution:void 0;return e!=null&&e}get useSoftNavs(){var e=It(this.Qo)?this.Qo.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Vo(){var e=It(this.Qo)&&an(this.Qo.__web_vitals_max_value)?this.Qo.__web_vitals_max_value:Gy;return e>0&&6e4>=e?Gy:e}get isEnabled(){var e=Yt==null?void 0:Yt.protocol;if(e!=="http:"&&e!=="https:")return oa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=It(this.Qo)?this.Qo.web_vitals:gr(this.Qo)?this.Qo:void 0;return gr(t)?t:this.Io}startIfEnabled(){this.isEnabled&&!this.mo&&(oa.info("enabled, starting..."),this.ai(this.Zo))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=It(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=It(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[og]:n}),this._instance.persistence.register({[cg]:i})),this.Io=n,this.startIfEnabled()}}}get Go(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}ai(e){var t=Oe.__PosthogExtensions__,n=this.Go,i=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;i!=null&&i[n]||n==="web-vitals"&&xe(i)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?oa.error("failed to load script",a):e()}))}Wo(e){var t=e||(re==null?void 0:re.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?As(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...Dl,...i||[]]:[];return Ec(n,a,Tc)}oa.error("Could not determine current URL")}}},aE={exceptionObserver:class{constructor(e){var t;this.Zo=()=>{var n;if(re&&this.isEnabled&&(n=Oe.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var i=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ko&&this.Ne.capture_unhandled_errors&&(this.Ko=i(this.captureException.bind(this))),!this.Jo&&this.Ne.capture_unhandled_rejections&&(this.Jo=a(this.captureException.bind(this))),!this.Yo&&this.Ne.capture_console_errors&&(this.Yo=o(this.captureException.bind(this)))}catch(u){Yo.error("failed to start",u),this.Xo()}}},this._instance=e,this.tl=!((t=this._instance.persistence)==null||!t.props[sg]),this.el=new r3(fe({},(function(n){var i,a,o,u;return n===void 0&&(n={}),{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking),{refillInterval:1e4,rt:Yo})),this.Ne=this.il(),this.startIfEnabledOrStop()}il(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return It(e)?t=fe({},t,e):(xe(e)?this.tl:e)&&(t=fe({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ne.capture_console_errors||this.Ne.capture_unhandled_errors||this.Ne.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Yo.info("enabled"),this.Xo(),this.ai(this.Zo)):this.Xo()}ai(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Yo.error("failed to load script",i);e()}))}Xo(){var e,t,n;(e=this.Ko)==null||e.call(this),this.Ko=void 0,(t=this.Jo)==null||t.call(this),this.Jo=void 0,(n=this.Yo)==null||n.call(this),this.Yo=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.tl=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[sg]:this.tl}),this.Ne=this.il(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ne=this.il()}captureException(e){var t,n,i,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.el.consumeRateLimit(a)?Yo.info("Skipping exception capture because of client rate limiting.",{exception:a}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.rl=[],this.nl=new y3([new E3,new B3,new A3,new T3,new z3,new D3,new R3,new O3],(function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],m=f.split(`
|
|
68
|
-
`),x=h;m.length>x;x++){var b=m[x];if(1024>=b.length){var y=uy.test(b)?b.replace(uy,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,i);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(N){if(!N.length)return[];var k=Array.from(N);return k.reverse(),k.slice(0,50).map((E=>{return fe({},E,{filename:E.filename||(C=k,C[C.length-1]||{}).filename,function:E.function||Ml});var C}))})(p)}})("web:javascript",k3,C3)),this._instance=e,this.rl=(t=(n=this._instance.persistence)==null?void 0:n.get_property(ag))!==null&&t!==void 0?t:[],this.sl=Xd(this.al()),this.ol=new $3(this.sl)}onConfigChange(){this.sl=Xd(this.al()),this.ol.setConfig(this.sl)}onRemoteConfig(e){var t,n,i;if(e.ok){var a=e.config;if("errorTracking"in a){var o=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)==null?void 0:i.captureExtensionExceptions;this.rl=o,this._instance.persistence&&this._instance.persistence.register({[ag]:this.rl,[lg]:u})}}}get ll(){var e,t=!!this._instance.get_property(lg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.nl.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.sl.enabled)try{if(!vt(e)||e.trim().length===0)return void ai.warn("Ignoring exception step because message must be a non-empty string");var n=(function(o){if(!o)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(o).reduce(((f,h)=>P3.has(h)?(u.push(h),f):(f[h]=o[h],f)),{}),droppedKeys:u}})(this.ul(t)),i=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&ai.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.ol.add(fe({[Qd]:e,[Wd]:new Date().toISOString()},i))}catch(o){ai.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.hl(t)){if(this.dl(t))return this.vl("Exception dropped: matched a suppression rule"),void ai.info("Skipping exception capture because a suppression rule matched");if(!this.ll&&this.cl(t))return this.vl("Exception dropped: thrown by a browser extension"),void ai.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.fl(t))return this.vl("Exception dropped: thrown by the PostHog SDK"),void ai.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.sl.enabled&&Ge(e.$exception_steps)?this.pl(e):e,i=typeof(o=globalThis._posthogReleaseId)=="string"&&o.length>0?o:void 0;i&&(n.$release_id=i);try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Qn:!0});return a&&this.ol.clear(),a}catch(u){return ai.error("Failed to capture exception event. Dropping this exception.",u),void this.ol.clear()}}catch(u){return void ai.error("Failed to process exception event. Ignoring this exception.",u)}var o}pl(e){try{var t=this.ol.getAttachable();return t.length===0?e:fe({},e,{$exception_steps:t})}catch(n){return ai.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}vl(e){this.sl.enabled&&this.ol.add({[Qd]:e,[Wd]:new Date().toISOString()})}ul(e){return It(e)?fe({},e):{}}al(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}dl(e){if(e.length===0)return!1;try{var t=e.reduce(((n,i)=>{var a=i.type,o=i.value;return vt(a)&&a.length>0&&n.$exception_types.push(a),vt(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.rl.some((n=>{var i=n.values.map((a=>{var o=p2[a.operator],u=t[a.key];if(!o||!u)return!1;var f=Ve(a.value)?a.value:[a.value];return f.length>0&&o(f,u)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}catch(n){return ai.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}cl(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}fl(e){if(e.length>0){var t,n,i,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}hl(e){return!Ge(e)&&Ve(e)}}},lE=fe({productTours:class{get Mr(){return this._instance.persistence}constructor(e){this.gl=null,this.ml=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,i;if(this.Mr&&this.Mr.register({[tx]:!!t.productTours}),!hm(this._instance))return!this.gl&&Ge((n=this.Mr)==null?void 0:n.props[ac])||xd.info("product tours disabled; stopping and clearing cached tours"),(i=this.gl)==null||i.stop(),this.gl=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.gl&&hm(this._instance)&&this.ai((()=>this.yl()))}ai(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?xd.error("Could not load product tours script",i):e()}))}yl(){var e;!this.gl&&(e=Oe.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.gl=Oe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ve(this.ml)||t){var n=this.Mr;if(n){var i=n.props[ac];if(Ve(i)&&!t)return this.ml=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:a=>{if(hm(this._instance)){var o=a.statusCode;if(o!==200||!a.json){var u="Product Tours API could not be loaded, status: "+o;return o===0?a.error||xd.warn(u):xd.error(u),void e([],{isLoaded:!1,error:u})}var f=Ve(a.json.product_tours)?a.json.product_tours:[];this.ml=f,n&&n.register({[ac]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.ml,{isLoaded:!0})}getActiveProductTours(e){Ge(this.gl)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.gl.getActiveProductTours(e)}showProductTour(e){var t;(t=this.gl)==null||t.showTourById(e)}previewTour(e){this.gl?this.gl.previewTour(e):this.ai((()=>{var t;this.yl(),(t=this.gl)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.gl)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.gl)==null||e.nextStep()}previousStep(){var e;(e=this.gl)==null||e.previousStep()}clearCache(){var e;this.ml=null,(e=this.Mr)==null||e.unregister(ac)}resetTour(e){var t;(t=this.gl)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.gl)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.gl)==null||t.cancelPendingTour(e)}}},Sf),oE={siteApps:class{constructor(e){this.bl=0,this._instance=e,this._l=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wl(e,t){if(t){var n=this.globalsForEvent(t);this._l.push(n),this._l.length>1e3&&(this._l=this._l.slice(10))}}get siteAppLoaders(){var e;return(e=Oe._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.wl.bind(this));this.kl=()=>{e(),this._l=[],this.kl=void 0}}}globalsForEvent(e){var t,n,i,a,o,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],m=this._instance.get_property("$stored_group_properties")||{};for(var x of Object.entries(m)){var b=x[0];h[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:fe({},$5(e,K4),{properties:fe({},e.properties,_?{$set:fe({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:fe({},(i=(a=e.properties)==null?void 0:a.$set_once)!==null&&i!==void 0?i:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}xl(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)||(si.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)||(si.error("prepare_external_dependency_script returned null"),null):e}Sl(){var e,t,n,i,a,o,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=ke==null?void 0:ke.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.bl++,this.Cl)return this.Ml();var m=[],x=this,b=new WeakSet,y=(N,k,E)=>{if(N!=null&&N[k]){var C=N[k];N[k]=E(C),m.push((()=>{N[k]=C}))}},_=N=>{if(b.has(N))return N;var k=x.xl(N);return k&&b.add(k),k},j=N=>N.map((k=>typeof k=="string"?k:_(k))).filter((k=>!nr(k)));return y(p,"appendChild",(N=>function(k){var E=_(k);return E?N.call(this,E):k})),y(p,"insertBefore",(N=>function(k,E){var C=_(k);return C?N.call(this,C,E):k})),y(p,"replaceChild",(N=>function(k,E){var C=_(k);return C?N.call(this,C,E):E})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(i=h.DocumentFragment)==null?void 0:i.prototype].forEach((N=>{y(N,"append",(k=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return k.apply(this,j(C))})),y(N,"prepend",(k=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return k.apply(this,j(C))}))})),[(a=h.Element)==null?void 0:a.prototype,(o=h.CharacterData)==null?void 0:o.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(k=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return k.apply(this,j(C))})),y(N,"after",(k=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return k.apply(this,j(C))})),y(N,"replaceWith",(k=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];var z=j(C);return C.length&&!z.length?void 0:k.apply(this,z)}))})),y((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(N=>function(k,E){var C=_(E);return C?N.call(this,k,C):null})),this.Cl=()=>{m.forEach((N=>N())),this.Cl=void 0},this.Ml()}Ml(){var e=!1;return()=>{var t;e||(e=!0,this.bl--,this.bl===0&&((t=this.Cl)==null||t.call(this)))}}Tl(e,t){t===void 0&&(t=!0);var n=this.Sl();try{var i=e(n);return t&&n(),i}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this._l.length&&(si.info("Processing "+this._l.length+" events for site app with id "+e.id),this._l.forEach((f=>this.Tl((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.kl)==null||u.call(this))},i=!1,a=u=>{t.errored=!u,t.loaded=!0,si.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var o=this.Tl((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1).processEvent;o&&(t.processEvent=o),i=!0}catch(u){si.error(Wy+e.id,u),a(!1)}if(i&&t.loaded)try{n()}catch(u){si.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}El(){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)}Il(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),i=function(o){try{t.Tl((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){si.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))i(a)}}onRemoteConfig(e){var t,n,i,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.El(),void this._instance.on("eventCaptured",(h=>this.Il(h)))):void si.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.kl)==null||n.call(this),e.ok){var o=e.config;if((i=o.siteApps)!=null&&i.length)if(this.isEnabled){var u=function(){var h,p=f.id,m=f.url;Oe["__$$ph_site_app_"+p]=a._instance,(h=Oe.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(a._instance,m,(x=>{if(x)return si.error(Wy+p,x)}))};for(var f of o.siteApps)u()}else si.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},cE={tracingHeaders:class{constructor(e){this.Pl=void 0,this.Rl=void 0,this.Al=void 0,this.Zo=()=>{var t,n,i=this.Fl();i?(xe(this.Pl)&&(this.Pl=(t=Oe.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),xe(this.Rl)&&(this.Rl=(n=Oe.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Xo()},this._instance=e}initialize(){this.startIfEnabledOrStop()}ai(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return W4.error("failed to load script",i);e()}))}Ll(){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}Fl(){var e=this.Ll();return Ve(e)?(Ve(this.Al)?this.Al.splice(0,this.Al.length,...e):this.Al=[...e],e.length>0?this.Al:void 0):(Ve(this.Al)&&this.Al.splice(0),this.Al=e||void 0,this.Al)}Xo(){var e,t;(e=this.Pl)==null||e.call(this),(t=this.Rl)==null||t.call(this),this.Pl=void 0,this.Rl=void 0}startIfEnabledOrStop(){this.Fl()?this.ai(this.Zo):this.Xo()}}},uE=fe({surveys:class{get Ne(){return this._instance.config}constructor(e){this.Ol=void 0,this._surveyManager=null,this.Dl=!1,this.$l=[],this.Nl=null,this.ql=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Ne.disable_surveys){if(!e.ok)return kt.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(Ge(t))return kt.warn("Flags not loaded yet. Not loading surveys.");var n=Ve(t);this.Ol=n?t.length>0:t,kt.info("flags response received, isSurveysEnabled: "+this.Ol),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var i=localStorage.key(n);(i!=null&&i.startsWith(x2)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Dl)kt.info("Already initializing surveys, skipping...");else if(this.Ne.disable_surveys)kt.info(Xy);else if(this.Ne.cookieless_mode&&this._instance.consent.isOptedOut())kt.info("Not loading surveys in cookieless mode without consent.");else{var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){if(!xe(this.Ol)||this.Ne.advanced_enable_surveys){var t=this.Ol||this.Ne.advanced_enable_surveys;this.Dl=!0;try{var n=e.generateSurveys;if(n)return void this.jl(n,t);var i=e.loadExternalDependency;if(!i)return void this.Bl(rx);i(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.Bl("Could not load surveys script",a):this.jl(e.generateSurveys,t)}))}catch(a){throw this.Bl("Error initializing surveys",a),a}finally{this.Dl=!1}}}else kt.error("PostHog Extensions not found.")}}jl(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new eE(this._instance),kt.info("Surveys loaded successfully"),this.Hl({isLoaded:!0})}Bl(e,t){kt.error(e,t),this.Hl({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.$l.push(e),this._surveyManager&&this.Hl({isLoaded:!0}),()=>{this.$l=this.$l.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Ne.disable_surveys)return kt.info(Xy),e([]);var n,i=this._instance.get_property(dg);if(i&&!t)return e(i,{isLoaded:!0}),void(this.Ul()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Nl?this.Nl.then((a=>e(a.surveys,a.context))):(typeof Promise<"u"&&(this.Nl=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ne.token),method:"GET",timestampMode:"query",timeout:this.Ne.surveys_request_timeout_ms,callback:a=>{var o;this.Nl=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;u!==0?kt.error(f):a.error||kt.warn(f),this.ql=Date.now();var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}this.ql=null;var p,m=a.json.surveys||[],x=m.filter((y=>(function(_){return!(!_.start_date||_.end_date)})(y)&&(g2(y)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(y))));x.length>0&&((p=this._surveyEventReceiver)==null||p.register(x)),(o=this._instance.persistence)==null||o.register({[dg]:m,[Jd]:Date.now()});var b={isLoaded:!0};e(m,b),n==null||n({surveys:m,context:b})}}))}Ul(){return this.zl()&&!this.Nl&&!this.Wl()}zl(){var e=this._instance.get_property(Jd);return an(e)&&Date.now()-e>3e5}Wl(){return an(this.ql)&&3e5>Date.now()-this.ql}markSurveyAsSeen(e,t){var n,i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};v2(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Hl(e){for(var t of this.$l)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){kt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!Ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);kt.warn("init was not called")}Vl(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((a=>a.id===e)))!==null&&i!==void 0?i:null})),t}Zl(e){if(Ge(this._surveyManager))return{eligible:!1,reason:vd};var t=typeof e=="string"?this.Vl(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Gl(e){if(Ge(this._surveyManager))return{eligible:!1,reason:vd};var t=typeof e=="string"?this.Vl(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ge(this._surveyManager))return kt.warn("init was not called"),{visible:!1,disabledReason:vd};var t=this.Gl(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ge(this._surveyManager)?(kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vd})):new Promise((n=>{this.getSurveys((i=>{var a,o=(a=i.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(o){var u=this.Gl(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(Ge(this._surveyManager))kt.warn("init was not called");else{var a=typeof e=="string"?this.Vl(e):e;if(a!=null&&a.id)if(O4.includes(a.type)){var o=ke==null?void 0:ke.querySelector(t);if(o)return(i=a.appearance)!=null&&i.surveyPopupDelaySeconds?(kt.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;kt.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,o,n),kt.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,o,n);kt.warn("Survey element not found")}else kt.warn("Surveys of type "+a.type+" cannot be rendered in the app");else kt.warn("Survey not found")}}displaySurvey(e,t){var n;if(Ge(this._surveyManager))kt.warn("init was not called");else{var i=this.Vl(e);if(i){var a=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=fe({},i,{appearance:fe({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==_g.Popover&&t.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.Zl(i);if(!o.eligible)return void kt.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==_g.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else kt.warn("Survey not found")}}cancelPendingSurvey(e){Ge(this._surveyManager)?kt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},Sf),dE={toolbar:class{constructor(e){this.instance=e}Ql(e){Oe.ph_toolbar_state=e}Kl(){var e;return(e=Oe.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),vg(this.instance.config)||!re||!ke)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 i,a=tE||lf(e.hash,"__posthog")||lf(e.hash,"state"),o=a?hy((()=>JSON.parse(atob(decodeURIComponent(a)))))||hy((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Ky)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Jl(e){var t=Oe.ph_load_toolbar||Oe.ph_load_editor;!Ge(t)&&Fn(t)?t(e,this.instance):Zy.warn("No toolbar load function found")}loadToolbar(e){var t=!(ke==null||!ke.getElementById(Lw));if(!re||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=fe({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(Ky,JSON.stringify(fe({},i,{source:void 0}))),this.Kl()===2)this.Jl(i);else if(this.Kl()===0){var a;this.Ql(1),(a=Oe.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return Zy.error("[Toolbar] Failed to load",o),void this.Ql(0);this.Ql(2),this.Jl(i)})),Qt(re,"turbolinks:load",(()=>{this.Ql(0),this.loadToolbar(i)}))}return!0}Yl(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)}}},fE=fe({experiments:Mn},Sf),hE={conversations:class{constructor(e){this.Xl=void 0,this._conversationsManager=null,this.tu=!1,this.eu=null,this.iu=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.ru=e.ok,e.ok)){var t=e.config.conversations;Ge(t)||(gr(t)?this.Xl=t:(this.Xl=t.enabled,this.eu=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Xl=void 0,this.eu=null,this.ru=void 0,this.iu=!1}loadIfEnabled(){if(!(this._conversationsManager||this.tu||this._instance.config.disable_conversations||vg(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e&&!xe(this.Xl)&&this.Xl)if(this.eu&&this.eu.token){this.tu=!0;try{var t=e.initConversations;if(t)return this.nu(t),void(this.tu=!1);var n=e.loadExternalDependency;if(!n)return void this.su(rx);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.su("Could not load conversations script",i):this.nu(e.initConversations),this.tu=!1}))}catch(i){this.su("Error initializing conversations",i),this.tu=!1}}else Dr.error("Conversations enabled but missing token in remote config.")}}nu(e){if(this.eu)try{this._conversationsManager=e(this.eu,this._instance),this.iu=!1,Dr.info("Conversations loaded successfully")}catch(t){this.su("Error completing conversations initialization",t)}else Dr.error("Cannot complete initialization: remote config is null")}su(e,t){Dr.error(e,t),this._conversationsManager=null,this.tu=!1,this.iu=!0}show(){this._conversationsManager?this._conversationsManager.show():Dr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Xl===!0&&!nr(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":vg(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.ru===!1?"remote_config_failed":xe(this.Xl)?this.ru?"disabled_in_project":"remote_config_pending":this.Xl?Ge(this.eu)||!this.eu.token?"missing_token":Oe!=null&&Oe.__PosthogExtensions__?this.tu?"initializing":this.iu?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Dt((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Dr.warn(ua),null)}))()}getMessages(e,t){var n=this;return Dt((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Dr.warn(ua),null)}))()}markAsRead(e){var t=this;return Dt((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Dr.warn(ua),null)}))()}getTickets(e){var t=this;return Dt((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Dr.warn(ua),null)}))()}requestRestoreLink(e){var t=this;return Dt((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Dr.warn(ua),null)}))()}restoreFromToken(e){var t=this;return Dt((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Dr.warn(ua),null)}))()}restoreFromUrlToken(){var e=this;return Dt((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Dr.warn(ua),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}ns(){var e;(e=this._conversationsManager)==null||e.setIdentity()}ss(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},pE={logs:class{constructor(e){var t,n=this;this.au=!1,this.ou=!1,this.rt=Ht("[logs]"),this.lu=fe({},this.rt,{error(){for(var i=arguments.length,a=new Array(i),o=0;i>o;o++)a[o]=arguments[o];a.some(a_)||n.rt.error(...a)}}),this.tr=[],this.uu=[],this.Ea=0,this.hu=()=>{var i,a;this.Ea=0,(i=this.du)==null||i.onReconnect(),(a=this.vu)==null||a.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.au=!0),re&&Qt(re,"online",this.hu)}cu(e,t,n,i){var a,o=(function(u,f){var h,p,m,x,b,y,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,N=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,k=f!=null&&f.consoleCapture?void 0:(m=u==null?void 0:u.maxLogsPerInterval)!==null&&m!==void 0?m:1e3,E=xe(k)?Math.max(N,2048):Math.max(N,k),C=u==null?void 0:u.resourceAttributes;return{serviceName:(x=(b=C==null?void 0:C["service.name"])!==null&&b!==void 0?b:u==null?void 0:u.serviceName)!==null&&x!==void 0?x:f==null?void 0:f.serviceNameDefault,serviceVersion:(y=C==null?void 0:C["service.version"])!==null&&y!==void 0?y: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:N,maxQueueSize:E,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new x3(this.fu(e,t),o,this.lu,(()=>this.pu()),(u=>u()),void 0,i),o]}gu(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.du||this.mu!==t){var n;(n=this.du)==null||n.reset(),this.mu=t;var i=this.cu((()=>this.tr),(a=>{this.tr=a}));this.du=i[0],this.yu=i[1]}return this.du}bu(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.vu||this._u!==t){var n;(n=this.vu)==null||n.reset(),this._u=t;var i=this.cu((()=>this.uu),(a=>{this.uu=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},s_);this.vu=i[0],this.wu=i[1]}return this.vu}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!Ge(n)&&n&&(this.au=!0,this.loadIfEnabled())}}reset(){var e,t;this.tr=[],(e=this.du)==null||e.reset(),this.uu=[],(t=this.vu)==null||t.reset(),this.Ea=0}captureLog(e){this.gu().captureLog(e)}he(e){this.bu().captureLog(e)}get logger(){return this.ku||(this.ku={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.ku}flushLogs(e){e?this.xu(e):(this.du&&this.du.flush().catch((t=>this.Su(t))),this.vu&&this.vu.flush().catch((t=>this.Su(t))))}Su(e){a_(e)||this.rt.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.au&&!this.ou){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.rt.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.ou=!0)})):this.rt.error(rx)}else this.rt.error("PostHog Extensions not found.")}}fu(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Bi.LogsQueue?e():void 0,setPersistedProperty(i,a){var o;i===Bi.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},Ot:i=>this.Ot(i),getLibraryId:()=>Rt.LIB_NAME,getLibraryVersion:()=>Rt.LIB_VERSION}}Ot(e){return new Promise((t=>{if(Vw(this.Ea,3))t({kind:"fatal",error:mm(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,i=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>{this.rt.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:mm(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Cu(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this.Mu(u),u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==429&&500>u)i({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;u===0?(o.error||this.rt.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:mm(o.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(f=o.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}}))}Mu(e){(e!==0||this._instance.__loaded)&&(this.Ea=Gw(e,this.Ea,3,(()=>this.rt.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}xu(e){this.tr.length>0&&this.Tu(e,this.tr,this.yu,Rt.LIB_NAME,(t=>{this.tr=t})),this.uu.length>0&&this.Tu(e,this.uu,this.wu,s_,(t=>{this.uu=t}))}Tu(e,t,n,i,a){if(t.length!==0){var o=t.map((f=>f.record));a([]);var u=gw(o,mw(n,Rt.LIB_NAME,Rt.LIB_VERSION),i,Rt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Cu(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Cu(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}pu(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=i,Ge(a)||(t.sessionStartTimestamp=a),Ge(o)||(t.lastActivityTimestamp=o)}if(Oe!=null&&(e=Oe.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?As(Oe.location.href):Oe.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},mE={metrics:class{constructor(e){this.rt=Ht("[metrics]"),this._instance=e}initialize(){}gu(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.du&&this.mu===n||((t=this.du)==null||t.reset(),this.mu=n,this.du=new v3(this.fu(),(function(i){var a,o,u,f,h,p=i==null?void 0:i.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:i==null?void 0:i.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:p,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(f=i==null?void 0:i.flushIntervalMs)!==null&&f!==void 0?f:1e4,maxSeriesPerFlush:(h=i==null?void 0:i.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(n),this.rt)),this.du}count(e,t,n){t===void 0&&(t=1),this.gu().count(e,t,n)}gauge(e,t,n){this.gu().gauge(e,t,n)}histogram(e,t,n){this.gu().histogram(e,t,n)}flush(e){if(!this.du)return Promise.resolve();if(e){var t=this.du.drainWindow();return t&&this.Jt(t,e),Promise.resolve()}return this.du.flush().catch((n=>this.rt.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.du)==null||e.reset()}fu(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Jt:n=>t.Jt(n),getLibraryId:()=>Rt.LIB_NAME,getLibraryVersion:()=>Rt.LIB_VERSION}}Jt(e,t){return new Promise((n=>{var i=!1,a=u=>{i||(i=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(fe({method:"POST",url:this.Eu(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var f=u.statusCode;if(f>=200&&300>f)a({kind:"ok"});else if(f===413)a({kind:"too-large"});else if(f!==0&&f!==429&&500>f)a({kind:"fatal",error:new Error("metrics request failed with status "+f)});else{var h;a({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error("metrics request failed with status "+f)})}}}))}))}Eu(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},gE=fe({},Sf,iE,sE,aE,lE,oE,uE,cE,dE,fE,hE,pE,mE);mr.__defaultExtensionClasses=fe({},gE);var Ac=(function(){Rt.SDK_DIST_CHANNEL="npm";var e=gc[wl]=new mr;return(function(){function t(){t.done||(t.done=!0,y2=!1,Lt(gc,(function(n){n._dom_loaded()})))}ke!=null&&ke.addEventListener?ke.readyState==="complete"?t():Qt(ke,"DOMContentLoaded",t,{capture:!1}):re&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const xE="https://us.i.posthog.com",w2="cc-telemetry-enabled";let Tg=!1,Mc=!1;function vE(){return xE}function bE(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(w2);return e===null?!0:e==="true"}function S2(e){Tg&&(e?(Ac.opt_in_capturing({captureEventName:null}),Mc=!0):(Ac.opt_out_capturing(),Mc=!1))}function sz(e){typeof localStorage<"u"&&localStorage.setItem(w2,String(e)),S2(e)}function yE(){const e=void 0;return e?(Ac.init(e,{api_host:vE(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),Tg=!0,S2(bE()),!0):(Tg=!1,Mc=!1,!1)}function dx(e,t){Mc&&Ac.capture(e,t)}function Rs(e,t){Mc&&Ac.captureException(e,t)}function _E(e){dx("$pageview",{$current_url:e})}const di="/api",k2="companion_auth_token";function Ls(){if(typeof window>"u")return{};const e=localStorage.getItem(k2);return e?{Authorization:`Bearer ${e}`}:{}}function ka(e){e===401&&typeof window<"u"&&(localStorage.removeItem(k2),Dn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>BN);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function gn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Oc(e,t,n,i){dx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function fi(e,t,n,i,a){dx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),Rs(i,{method:e,path:t,status:a})}async function Ie(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!a.ok){ka(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("POST",e,gn()-n,u,a.status),i=!0,u}return Oc("POST",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("POST",e,gn()-n,a),a}}async function Me(e){const t=gn();let n=!1;try{const i=await fetch(`${di}${e}`,{headers:{...Ls()}});if(!i.ok){ka(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw fi("GET",e,gn()-t,o,i.status),n=!0,o}return Oc("GET",e,gn()-t,i.status),i.json()}catch(i){throw n||fi("GET",e,gn()-t,i),i}}async function zr(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!a.ok){ka(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("PUT",e,gn()-n,u,a.status),i=!0,u}return Oc("PUT",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("PUT",e,gn()-n,a),a}}async function wE(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ls()},body:t?JSON.stringify(t):void 0});if(!a.ok){ka(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("PATCH",e,gn()-n,u,a.status),i=!0,u}return Oc("PATCH",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("PATCH",e,gn()-n,a),a}}async function Or(e,t){const n=gn();let i=!1;try{const a=await fetch(`${di}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ls()},body:t?JSON.stringify(t):void 0});if(!a.ok){ka(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw fi("DELETE",e,gn()-n,u,a.status),i=!0,u}return Oc("DELETE",e,gn()-n,a.status),a.json()}catch(a){throw i||fi("DELETE",e,gn()-n,a),a}}async function SE(e,t){const n=await fetch(`${di}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ls()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const i=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;o+=a.decode(h,{stream:!0});const p=o.split(`
|
|
69
|
-
|
|
70
|
-
`);o=p.pop()||"";for(const m of p){if(!m.trim())continue;let x="",b="";for(const _ of m.split(`
|
|
71
|
-
`))_.startsWith("event:")?x=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(x==="progress")t(y);else if(x==="done")u=y;else if(x==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function kE(){try{const e=await fetch(`${di}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function l_(e){try{const t=await fetch(`${di}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const Ne={getAuthQr:()=>Me("/auth/qr"),getAuthToken:()=>Me("/auth/token"),regenerateAuthToken:()=>Ie("/auth/regenerate"),createSession:e=>Ie("/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)),i=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(i))}`)},killSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Or(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${di}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ls()}});if(!n.ok)throw ka(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Me(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>wE(`/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)=>Ie("/envs",{name:e,variables:t}),updateEnv:(e,t)=>zr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Or(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Me("/sandboxes"),getSandbox:e=>Me(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Ie("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>zr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Or(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Ie(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Ie("/docker/build-base"),getBaseImageStatus:()=>Me("/docker/base-image"),getSettings:()=>Me("/settings"),updateSettings:e=>zr("/settings",e),verifyAnthropicKey:e=>Ie("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>Me("/dashboard"),runDashboardUpdate:()=>Ie("/dashboard/run"),getDashboardRunStatus:()=>Me("/dashboard/run/status"),getTailscaleStatus:()=>Me("/tailscale/status"),startTailscaleFunnel:()=>Ie("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Ie("/tailscale/funnel/stop"),listLinearConnections:()=>Me("/linear/connections"),createLinearConnection:e=>Ie("/linear/connections",e),updateLinearConnection:(e,t)=>zr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Or(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Ie(`/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)=>Ie(`/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=>zr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Or("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>zr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Or(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Me(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Ie("/linear/issues",e),addLinearComment:(e,t,n)=>Ie(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Me(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Me(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Ie("/git/fetch",{repoRoot:e}),gitPull:e=>Ie("/git/pull",{cwd:e}),listWorktrees:e=>Me(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Ie("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Or("/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=>Ie(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Me(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Ie(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Me(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Me(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${di}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ls()}});if(!t.ok){ka(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>zr("/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)=>zr("/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,i)=>Ie("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Ie("/terminal/kill",{terminalId:e}),getTerminal:e=>Me(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Me("/update-check"),forceCheckForUpdate:()=>Ie("/update-check"),triggerUpdate:()=>Ie("/update"),getClaudeCompat:()=>Me("/claude-compat"),refreshClaudeCompat:()=>Ie("/claude-compat/refresh"),pinClaudeVersion:e=>Ie("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Ie("/claude-compat/patch"),unpatchClaudeBinary:()=>Ie("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Ie("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Me("/cron/jobs"),getCronJob:e=>Me(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Ie("/cron/jobs",e),updateCronJob:(e,t)=>zr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Or(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Ie(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Ie(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Me(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Me(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Me("/agents"),getAgent:e=>Me(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Ie("/agents",e),updateAgent:(e,t)=>zr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Or(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Ie(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Ie(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Me(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Ie("/agents/import",e),exportAgent:e=>Me(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Ie(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return 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 i=n.toString();return Me(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Ie("/linear/oauth/disconnect"),createLinearStaging:e=>Ie("/linear/oauth/staging",e),getLinearStagingStatus:e=>Me(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Or(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Me("/linear/oauth-connections"),createLinearOAuthConnection:e=>Ie("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>zr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Or(`/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)=>Ie(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return Me(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Ie("/prompts",e),updatePrompt:(e,t)=>zr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Or(`/prompts/${encodeURIComponent(e)}`)};let o_=!1;function c_(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function u_(){return new Promise(()=>{})}function jE(){if(o_||typeof window>"u")return;o_=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await c_(i)}catch{return u_()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await c_(n)}catch{return u_()}}}})}catch{}}const d_="#/session/",f_="#/agents/";let h_=!1;function fx(){h_||(jE(),h_=!0)}function hx(e){if(fx(),e==="#/dashboard")return{page:"dashboard"};if(e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(f_)){const n=e.slice(f_.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(d_)){const n=e.slice(d_.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function NE(e){return`#/session/${e}`}function px(e,t=!1){fx();const n=NE(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function gm(e=!1){fx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function CE(){const[e,t]=S.useState(""),[n,i]=S.useState(null),[a,o]=S.useState(!1),u=Y(m=>m.setAuthToken),f=S.useCallback(async m=>{m.preventDefault();const x=e.trim();if(!x){i("Please enter a token");return}o(!0),i(null),await l_(x)?u(x):i("Invalid token"),o(!1)},[e,u]);S.useEffect(()=>{kE().then(m=>{if(m){u(m);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),l_(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),o(!1)}))})},[u]);const[h,p]=S.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:m=>{t(m.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var $l=S5();function EE({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return $l.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:m=>m.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function TE(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function AE({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function ME({type:e}){return e==="codex"?l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function Bd({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:m,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:k}){const E=e.id.slice(0,8),C=i||e.model||E,O=b===e.id,[z,L]=S.useState(!1),V=S.useRef(null),F=S.useRef(null),Q=n?"exited":TE(e,a),D=e.cwd||"";S.useEffect(()=>{if(!z)return;function A(Z){var G;V.current&&!V.current.contains(Z.target)&&F.current&&!F.current.contains(Z.target)&&(L(!1),(G=F.current)==null||G.focus())}function se(Z){var G,P,$;if(Z.key==="Escape"){L(!1),(G=F.current)==null||G.focus();return}if(Z.key==="Tab"){L(!1);return}if((Z.key==="ArrowDown"||Z.key==="ArrowUp")&&((P=V.current)!=null&&P.contains(document.activeElement)||F.current===document.activeElement)){Z.preventDefault();const ie=($=V.current)==null?void 0:$.querySelectorAll("[role='menuitem']");if(!ie||ie.length===0)return;const ae=document.activeElement,R=Array.from(ie).indexOf(ae);Z.key==="ArrowDown"?ie[R<ie.length-1?R+1:0].focus():ie[R>0?R-1:ie.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",se),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",se)}},[z]),S.useEffect(()=>{z&&requestAnimationFrame(()=>{var A,se;(se=(A=V.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||se.focus()})},[z]);const I=S.useCallback(A=>{L(!1),A()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:A=>{A.preventDefault(),f(e.id,C)},onKeyDown:A=>{A.key==="F2"&&!O&&(A.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:[l.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!O&&l.jsx(AE,{status:Q}),O?l.jsx("input",{ref:k,value:y,onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),j()):A.key==="Escape"&&(A.preventDefault(),N()),A.stopPropagation()},onBlur:j,onClick:A=>A.stopPropagation(),onDoubleClick:A=>A.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:C}),D&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:D})]}),!O&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(ME,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!O&&!z&&l.jsx("button",{onClick:A=>{A.stopPropagation(),h(A,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:F,onClick:A=>{A.stopPropagation(),L(!z)},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":z,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),z&&l.jsxs("div",{ref:V,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>I(()=>p(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>I(()=>m(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>I(()=>h(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function RE({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:k,editInputRef:E,isFirst:C}){const O=t?e.sessions.slice(0,2).map(z=>a.get(z.id)||z.model||z.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&O&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:O}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(z=>{var V;const L=((V=o.get(z.id))==null?void 0:V.size)??0;return l.jsx(Bd,{session:z,isActive:i===z.id,sessionName:a.get(z.id),permCount:L,isRecentlyRenamed:u.has(z.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:k,editInputRef:E},z.id)})})]})}function LE(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function DE(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function zE(e){const t=new Map;for(const i of e){const a=LE(i.cwd,i.repoRoot||void 0,i.isContainerized),o=DE(a);t.has(a)||t.set(a,{key:a,label:o,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,a)=>i.label.localeCompare(a.label));for(const i of n)i.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const OE=[{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"}],BE=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],PE=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],$E=new Map(BE.map(e=>[e.id,e]));function FE(){var Fr,Ur;const[e,t]=S.useState(null),[n,i]=S.useState(""),[a,o]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[m,x]=S.useState(null),[b,y]=S.useState(!1),[_,j]=S.useState(null),[N,k]=S.useState(!1),[E,C]=S.useState(()=>typeof window<"u"?window.location.hash:""),O=S.useRef(null),z=S.useRef(null),L=Y(te=>te.sessions),V=Y(te=>te.sdkSessions),F=Y(te=>te.currentSessionId),Q=Y(te=>te.cliConnected),D=Y(te=>te.cliReconnecting),I=Y(te=>te.sessionStatus),A=Y(te=>te.removeSession),se=Y(te=>te.sessionNames),Z=Y(te=>te.recentlyRenamed),G=Y(te=>te.clearRecentlyRenamed),P=Y(te=>te.pendingPermissions),$=Y(te=>te.linkedLinearIssues),ie=Y(te=>te.collapsedProjects),ae=Y(te=>te.toggleProjectCollapse),R=hx(E);S.useEffect(()=>{let te=!0;async function ge(){try{const Xe=await Ne.listSessions();if(te){const $t=Y.getState();$t.setSdkSessions(Xe);const un=Y.getState(),Tn=new Set(Xe.map(Ft=>Ft.sessionId));for(const Ft of un.sessions.keys())!Tn.has(Ft)&&un.connectionStatus.get(Ft)!=="connected"&&un.removeSession(Ft);FC(Xe);for(const Ft of Xe)if(Ft.name&&(!$t.sessionNames.has(Ft.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test($t.sessionNames.get(Ft.sessionId)))){const On=$t.sessionNames.get(Ft.sessionId),yr=!!On&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(On);On!==Ft.name&&($t.setSessionName(Ft.sessionId,Ft.name),yr&&$t.markRecentlyRenamed(Ft.sessionId))}}}catch{}}ge();const be=setInterval(ge,5e3);return()=>{te=!1,clearInterval(be)}},[]),S.useEffect(()=>{const te=()=>C(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function B(te){px(te),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}function K(){gm(),Y.getState().newSession(),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&O.current&&(O.current.focus(),O.current.select())},[e]);function M(){e&&n.trim()&&(Y.getState().setSessionName(e,n.trim()),Ne.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function pe(){t(null),i("")}function _e(te,ge){t(te),i(ge)}const Ce=S.useCallback((te,ge)=>{te.stopPropagation(),j(ge)},[]),De=S.useCallback(async te=>{try{Gm(te),await Ne.deleteSession(te)}catch{}Y.getState().currentSessionId===te&&gm(),A(te)},[A]),Ee=S.useCallback(()=>{_&&(De(_),j(null))},[_,De]),Be=S.useCallback(()=>{j(null)},[]),Je=S.useCallback(()=>{k(!0)},[]),jt=S.useCallback(async()=>{k(!1);const te=Y.getState(),ge=new Set;for(const Xe of te.sessions.keys())ge.add(Xe);for(const Xe of te.sdkSessions)ge.add(Xe.sessionId);const be=Array.from(ge).filter(Xe=>{const $t=te.sdkSessions.find(un=>un.sessionId===Xe);return($t==null?void 0:$t.archived)??!1});for(const Xe of be)await De(Xe)},[De]),dt=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ge,be;(be=(ge=z.current)==null?void 0:ge.querySelector("button"))==null||be.focus()});function te(ge){var un;if(ge.key==="Escape"){N?dt():Be();return}if(ge.key!=="Tab")return;const be=(un=z.current)==null?void 0:un.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!be||be.length===0)return;const Xe=be[0],$t=be[be.length-1];ge.shiftKey&&document.activeElement===Xe?(ge.preventDefault(),$t.focus()):!ge.shiftKey&&document.activeElement===$t&&(ge.preventDefault(),Xe.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,N,Be,dt]);const gt=S.useCallback(async(te,ge)=>{te.stopPropagation();const be=V.find(On=>On.sessionId===ge),Xe=L.get(ge),$t=(Xe==null?void 0:Xe.is_containerized)||!!(be!=null&&be.containerId)||!1,un=$.get(ge),Tn=((un==null?void 0:un.stateType)||"").toLowerCase();if(un&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const On=await Ne.getArchiveInfo(ge);if(On.issueNotDone){p(ge),x(On),y($t);return}}catch{}if($t){f(ge);return}xt(ge)},[V,L,$]),xt=S.useCallback(async(te,ge,be)=>{try{Gm(te);const Xe={};ge&&(Xe.force=!0),be&&be!=="none"&&(Xe.linearTransition=be),await Ne.archiveSession(te,Object.keys(Xe).length>0?Xe:void 0)}catch{}Y.getState().currentSessionId===te&&(gm(),Y.getState().newSession());try{const Xe=await Ne.listSessions();Y.getState().setSdkSessions(Xe)}catch{}},[]),_t=S.useCallback(()=>{u&&(xt(u,!0),f(null))},[u,xt]),Nt=S.useCallback(()=>{f(null)},[]),ve=S.useCallback((te,ge)=>{h&&(xt(h,ge,te),p(null),x(null))},[h,xt]),$e=S.useCallback(()=>{p(null),x(null)},[]),nt=S.useCallback(async(te,ge)=>{te.stopPropagation();try{await Ne.unarchiveSession(ge)}catch{}try{const be=await Ne.listSessions();Y.getState().setSdkSessions(be)}catch{}},[]),nn=new Set;for(const te of L.keys())nn.add(te);for(const te of V)nn.add(te.sessionId);const je=Array.from(nn).map(te=>{var Xe;const ge=L.get(te),be=V.find($t=>$t.sessionId===te);return{id:te,model:(ge==null?void 0:ge.model)||(be==null?void 0:be.model)||"",cwd:(ge==null?void 0:ge.cwd)||(be==null?void 0:be.cwd)||"",gitBranch:(ge==null?void 0:ge.git_branch)||(be==null?void 0:be.gitBranch)||"",isContainerized:(ge==null?void 0:ge.is_containerized)||!!(be!=null&&be.containerId)||!1,gitAhead:(ge==null?void 0:ge.git_ahead)||(be==null?void 0:be.gitAhead)||0,gitBehind:(ge==null?void 0:ge.git_behind)||(be==null?void 0:be.gitBehind)||0,linesAdded:(ge==null?void 0:ge.total_lines_added)||(be==null?void 0:be.totalLinesAdded)||0,linesRemoved:(ge==null?void 0:ge.total_lines_removed)||(be==null?void 0:be.totalLinesRemoved)||0,isConnected:Q.get(te)??!1,isReconnecting:D.get(te)??!1,status:I.get(te)??null,sdkState:(be==null?void 0:be.state)??null,createdAt:(be==null?void 0:be.createdAt)??0,archived:(be==null?void 0:be.archived)??!1,backendType:(ge==null?void 0:ge.backend_type)||(be==null?void 0:be.backendType)||"claude",repoRoot:(ge==null?void 0:ge.repo_root)||"",permCount:((Xe=P.get(te))==null?void 0:Xe.size)??0,cronJobId:(ge==null?void 0:ge.cronJobId)||(be==null?void 0:be.cronJobId),cronJobName:(ge==null?void 0:ge.cronJobName)||(be==null?void 0:be.cronJobName),agentId:(ge==null?void 0:ge.agentId)||(be==null?void 0:be.agentId),agentName:(ge==null?void 0:ge.agentName)||(be==null?void 0:be.agentName),userName:be==null?void 0:be.userName}}).sort((te,ge)=>ge.createdAt-te.createdAt),ze=S.useMemo(()=>Array.from(new Set(je.map(te=>te.userName).filter(te=>!!te))).sort(),[je]),[ht,Te]=S.useState("__all__"),$r=te=>ht==="__all__"?!0:ht==="__none__"?!te.userName:te.userName===ht,oe=je.some(te=>!te.userName),we=je.filter($r),W=we.filter(te=>!te.archived&&!te.cronJobId&&!te.agentId),me=we.filter(te=>!te.archived&&!!te.cronJobId),Re=we.filter(te=>!te.archived&&!!te.agentId),We=we.filter(te=>te.archived),rt=F?je.find(te=>te.id===F):null,it=(rt==null?void 0:rt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[St,xn]=S.useState(!0),[et,ir]=S.useState(!0),En=S.useMemo(()=>zE(W),[W]),Wr={onSelect:B,onStartRename:_e,onArchive:gt,onUnarchive:nt,onDelete:Ce,onClearRecentlyRenamed:G,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:M,onCancelRename:pe,editInputRef:O};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:it,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),l.jsx("button",{onClick:K,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>Y.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),ze.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:ht,onChange:te=>Te(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:[l.jsx("option",{value:"__all__",children:"All users"}),ze.map(te=>l.jsx("option",{value:te,children:te},te)),oe&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:Nt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:_t,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:W.length===0&&me.length===0&&We.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[En.map((te,ge)=>l.jsx(RE,{group:te,isCollapsed:ie.has(te.key),onToggleCollapse:ae,currentSessionId:F,sessionNames:se,pendingPermissions:P,recentlyRenamed:Z,isFirst:ge===0,...Wr},te.key)),me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>xn(!St),"aria-expanded":St,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${St?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",me.length,")"]}),St&&l.jsx("div",{className:"mt-0.5",children:me.map(te=>{var ge;return l.jsx(Bd,{session:te,isActive:F===te.id,sessionName:se.get(te.id),permCount:((ge=P.get(te.id))==null?void 0:ge.size)??0,isRecentlyRenamed:Z.has(te.id),...Wr},te.id)})})]}),Re.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>ir(!et),"aria-expanded":et,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${et?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Re.length,")"]}),et&&l.jsx("div",{className:"mt-0.5",children:Re.map(te=>{var ge;return l.jsx(Bd,{session:te,isActive:F===te.id,sessionName:se.get(te.id),permCount:((ge=P.get(te.id))==null?void 0:ge.size)??0,isRecentlyRenamed:Z.has(te.id),...Wr},te.id)})})]}),We.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",We.length,")"]}),a&&We.length>1&&l.jsx("button",{onClick:Je,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:We.map(te=>{var ge;return l.jsx(Bd,{session:te,isActive:F===te.id,isArchived:!0,sessionName:se.get(te.id),permCount:((ge=P.get(te.id))==null?void 0:ge.size)??0,isRecentlyRenamed:Z.has(te.id),...Wr},te.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:K,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:PE.map(te=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),l.jsx("div",{className:"flex flex-col",children:te.itemIds.map(ge=>{const be=$E.get(ge);if(!be)return null;const Xe=be.activePages?be.activePages.some($t=>R.page===$t):R.page===be.id;return l.jsxs("button",{onClick:()=>{window.location.hash=be.hash,window.innerWidth<768&&Y.getState().setSidebarOpen(!1)},title:be.label,"aria-current":Xe?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Xe?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Xe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:be.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:be.iconPath,fillRule:be.fillRule,clipRule:be.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:be.label})]},be.id)})})]},te.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:OE.map(te=>l.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:l.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||N)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:N?dt:Be,children:l.jsxs("div",{ref:z,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:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${We.length} archived session${We.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?dt:Be,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:N?jt:Ee,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:N?"Delete all":"Delete"})]})]})}),h&&m&&l.jsx(EE,{issueIdentifier:((Fr=m.issue)==null?void 0:Fr.identifier)||"",issueStateName:((Ur=m.issue)==null?void 0:Ur.stateName)||"",isContainerized:b,archiveTransitionConfigured:m.archiveTransitionConfigured||!1,archiveTransitionStateName:m.archiveTransitionStateName,hasBacklogState:m.hasBacklogState||!1,onConfirm:ve,onCancel:$e})]})}function UE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const IE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qE={};function p_(e,t){return(qE.jsx?HE:IE).test(e)}const VE=/[ \t\n\f\r]/g;function GE(e){return typeof e=="object"?e.type==="text"?m_(e.value):!1:m_(e)}function m_(e){return e.replace(VE,"")===""}class Bc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Bc.prototype.normal={};Bc.prototype.property={};Bc.prototype.space=void 0;function j2(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Bc(n,i,t)}function Ag(e){return e.toLowerCase()}class rr{constructor(t,n){this.attribute=n,this.property=t}}rr.prototype.attribute="";rr.prototype.booleanish=!1;rr.prototype.boolean=!1;rr.prototype.commaOrSpaceSeparated=!1;rr.prototype.commaSeparated=!1;rr.prototype.defined=!1;rr.prototype.mustUseProperty=!1;rr.prototype.number=!1;rr.prototype.overloadedBoolean=!1;rr.prototype.property="";rr.prototype.spaceSeparated=!1;rr.prototype.space=void 0;let YE=0;const Ye=Ca(),mn=Ca(),Mg=Ca(),Se=Ca(),Ot=Ca(),wa=Ca(),hr=Ca();function Ca(){return 2**++YE}const Rg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:mn,commaOrSpaceSeparated:hr,commaSeparated:wa,number:Se,overloadedBoolean:Mg,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),xm=Object.keys(Rg);class mx extends rr{constructor(t,n,i,a){let o=-1;if(super(t,n),g_(this,"space",a),typeof i=="number")for(;++o<xm.length;){const u=xm[o];g_(this,xm[o],(i&Rg[u])===Rg[u])}}}mx.prototype.defined=!0;function g_(e,t,n){n&&(e[t]=n)}function Fl(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new mx(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[Ag(i)]=i,n[Ag(o.attribute)]=i}return new Bc(t,n,e.space)}const N2=Fl({properties:{ariaActiveDescendant:null,ariaAtomic:mn,ariaAutoComplete:null,ariaBusy:mn,ariaChecked:mn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:mn,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:mn,ariaFlowTo:Ot,ariaGrabbed:mn,ariaHasPopup:null,ariaHidden:mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:Se,ariaLive:null,ariaModal:mn,ariaMultiLine:mn,ariaMultiSelectable:mn,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:mn,ariaReadOnly:mn,ariaRelevant:null,ariaRequired:mn,ariaRoleDescription:Ot,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:mn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function C2(e,t){return t in e?e[t]:t}function E2(e,t){return C2(e,t.toLowerCase())}const QE=Fl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:wa,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alpha:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:Ot,autoFocus:Ye,autoPlay:Ye,blocking:Ot,capture:null,charSet:null,checked:Ye,cite:null,className:Ot,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:mn,controls:Ye,controlsList:Ot,coords:Se|wa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:Mg,draggable:mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:Ot,height:Se,hidden:Mg,high:Se,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:Ye,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:Se,pattern:null,ping:Ot,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:Ot,required:Ye,reversed:Ye,rows:Se,rowSpan:Se,sandbox:Ot,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootCustomElementRegistry:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shadowRootSerializable:Ye,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:mn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:mn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ye,disablePictureInPicture:Ye,disableRemotePlayback:Ye,exportParts:wa,part:Ot,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:E2}),WE=Fl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:hr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Ot,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:wa,g2:wa,glyphName:wa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:hr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hr,rev:hr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hr,requiredFeatures:hr,requiredFonts:hr,requiredFormats:hr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:hr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:C2}),T2=Fl({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()}}),A2=Fl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:E2}),M2=Fl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),XE={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"},KE=/[A-Z]/g,x_=/-[a-z]/g,ZE=/^data[-\w.:]+$/i;function JE(e,t){const n=Ag(t);let i=t,a=rr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZE.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(x_,t6);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!x_.test(o)){let u=o.replace(KE,e6);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=mx}return new a(i,t)}function e6(e){return"-"+e.toLowerCase()}function t6(e){return e.charAt(1).toUpperCase()}const n6=j2([N2,QE,T2,A2,M2],"html"),gx=j2([N2,WE,T2,A2,M2],"svg");function r6(e){return e.join(" ").trim()}var bl={},vm,v_;function i6(){if(v_)return vm;v_=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
72
|
-
`,p="/",m="*",x="",b="comment",y="declaration";function _(N,k){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];k=k||{};var E=1,C=1;function O(Z){var G=Z.match(t);G&&(E+=G.length);var P=Z.lastIndexOf(h);C=~P?Z.length-P:C+Z.length}function z(){var Z={line:E,column:C};return function(G){return G.position=new L(Z),Q(),G}}function L(Z){this.start=Z,this.end={line:E,column:C},this.source=k.source}L.prototype.content=N;function V(Z){var G=new Error(k.source+":"+E+":"+C+": "+Z);if(G.reason=Z,G.filename=k.source,G.line=E,G.column=C,G.source=N,!k.silent)throw G}function F(Z){var G=Z.exec(N);if(G){var P=G[0];return O(P),N=N.slice(P.length),G}}function Q(){F(n)}function D(Z){var G;for(Z=Z||[];G=I();)G!==!1&&Z.push(G);return Z}function I(){var Z=z();if(!(p!=N.charAt(0)||m!=N.charAt(1))){for(var G=2;x!=N.charAt(G)&&(m!=N.charAt(G)||p!=N.charAt(G+1));)++G;if(G+=2,x===N.charAt(G-1))return V("End of comment missing");var P=N.slice(2,G-2);return C+=2,O(P),N=N.slice(G),C+=2,Z({type:b,comment:P})}}function A(){var Z=z(),G=F(i);if(G){if(I(),!F(a))return V("property missing ':'");var P=F(o),$=Z({type:y,property:j(G[0].replace(e,x)),value:P?j(P[0].replace(e,x)):x});return F(u),$}}function se(){var Z=[];D(Z);for(var G;G=A();)G!==!1&&(Z.push(G),D(Z));return Z}return Q(),se()}function j(N){return N?N.replace(f,x):x}return vm=_,vm}var b_;function s6(){if(b_)return bl;b_=1;var e=bl&&bl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(bl,"__esModule",{value:!0}),bl.default=n;const t=e(i6());function n(i,a){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),f=typeof a=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:m}=h;f?a(p,m,h):m&&(o=o||{},o[p]=m)}),o}return bl}var Wo={},y_;function a6(){if(y_)return Wo;y_=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(p){return!p||n.test(p)||e.test(p)},u=function(p,m){return m.toUpperCase()},f=function(p,m){return"".concat(m,"-")},h=function(p,m){return m===void 0&&(m={}),o(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(a,f):p=p.replace(i,f),p.replace(t,u))};return Wo.camelCase=h,Wo}var Xo,__;function l6(){if(__)return Xo;__=1;var e=Xo&&Xo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(s6()),n=a6();function i(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(f,h){f&&h&&(u[(0,n.camelCase)(f,o)]=h)}),u}return i.default=i,Xo=i,Xo}var o6=l6();const c6=Vg(o6),R2=L2("end"),xx=L2("start");function L2(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function u6(e){const t=xx(e),n=R2(e);if(t&&n)return{start:t,end:n}}function xc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?w_(e.position):"start"in e||"end"in e?w_(e):"line"in e||"column"in e?Lg(e):""}function Lg(e){return S_(e&&e.line)+":"+S_(e&&e.column)}function w_(e){return Lg(e&&e.start)+"-"+Lg(e&&e.end)}function S_(e){return e&&typeof e=="number"?e:1}class zn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?o.ruleId=i:(o.source=i.slice(0,h),o.ruleId=i.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=xc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const vx={}.hasOwnProperty,d6=new Map,f6=/[A-Z]/g,h6=new Set(["table","tbody","thead","tfoot","tr"]),p6=new Set(["td","th"]),D2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m6(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=S6(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=w6(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?gx:n6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=z2(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function z2(e,t,n){if(t.type==="element")return g6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return x6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return b6(e,t,n);if(t.type==="mdxjsEsm")return v6(e,t);if(t.type==="root")return y6(e,t,n);if(t.type==="text")return _6(e,t)}function g6(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=gx,e.schema=a),e.ancestors.push(t);const o=B2(e,t.tagName,!1),u=k6(e,t);let f=yx(e,t);return h6.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!GE(h):!0})),O2(e,u,o,t),bx(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function x6(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Rc(e,t.position)}function v6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Rc(e,t.position)}function b6(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=gx,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:B2(e,t.name,!0),u=j6(e,t),f=yx(e,t);return O2(e,u,o,t),bx(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function y6(e,t,n){const i={};return bx(i,yx(e,t)),e.create(t,e.Fragment,i,n)}function _6(e,t){return t.value}function O2(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function bx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function w6(e,t,n){return i;function i(a,o,u,f){const p=Array.isArray(u.children)?n:t;return f?p(o,u,f):p(o,u)}}function S6(e,t){return n;function n(i,a,o,u){const f=Array.isArray(o.children),h=xx(i);return t(a,o,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function k6(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&vx.call(t.properties,a)){const o=N6(e,a,t.properties[a]);if(o){const[u,f]=o;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&p6.has(t.tagName)?i=f:n[u]=f}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function j6(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Rc(e,t.position);else{const a=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else Rc(e,t.position);else o=i.value===null?!0:i.value;n[a]=o}return n}function yx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:d6;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const p=a.get(h)||0;u=h+"-"+p,a.set(h,p+1)}}const f=z2(e,o,u);f!==void 0&&n.push(f)}return n}function N6(e,t,n){const i=JE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?UE(n):r6(n)),i.property==="style"){let a=typeof n=="object"?n:C6(e,String(n));return e.stylePropertyNameCase==="css"&&(a=E6(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?XE[i.property]||i.property:i.attribute,n]}}function C6(e,t){try{return c6(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=D2+"#cannot-parse-style-attribute",a}}function B2(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const f=p_(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}i=u}else i=p_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return vx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Rc(e)}function Rc(e,t){const n=new zn("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=D2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function E6(e){const t={};let n;for(n in e)vx.call(e,n)&&(t[T6(n)]=e[n]);return t}function T6(e){let t=e.replace(f6,A6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function A6(e){return"-"+e.toLowerCase()}const bm={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"]},M6={};function _x(e,t){const n=M6,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return P2(e,i,a)}function P2(e,t,n){if(R6(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 k_(e.children,t,n)}return Array.isArray(e)?k_(e,t,n):""}function k_(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=P2(e[a],t,n);return i.join("")}function R6(e){return!!(e&&typeof e=="object")}const j_=document.createElement("i");function wx(e){const t="&"+e+";";j_.innerHTML=t;const n=j_.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function br(e,t,n,i){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Br(e,t){return e.length>0?(br(e,e.length,0,t),e):t}const N_={}.hasOwnProperty;function $2(e){const t={};let n=-1;for(;++n<e.length;)L6(t,e[n]);return t}function L6(e,t){let n;for(n in t){const a=(N_.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){N_.call(a,u)||(a[u]=[]);const f=o[u];D6(a[u],Array.isArray(f)?f:f?[f]:[])}}}function D6(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);br(e,0,0,i)}function F2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const In=Ds(/[A-Za-z]/),Ln=Ds(/[\dA-Za-z]/),z6=Ds(/[#-'*+\--9=?A-Z^-~]/);function ff(e){return e!==null&&(e<32||e===127)}const Dg=Ds(/\d/),O6=Ds(/[\dA-Fa-f]/),B6=Ds(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const kf=Ds(new RegExp("\\p{P}|\\p{S}","u")),ja=Ds(/\s/);function Ds(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ul(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Ln(e.charCodeAt(n+1))&&Ln(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(u=String.fromCharCode(o,f),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function mt(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(h){return ot(h)?(e.enter(n),f(h)):t(h)}function f(h){return ot(h)&&o++<a?(e.consume(h),f):(e.exit(n),t(h))}}const P6={tokenize:$6};function $6(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),mt(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),u)}}const F6={tokenize:U6},C_={tokenize:I6};function U6(e){const t=this,n=[];let i=0,a,o,u;return f;function f(C){if(i<n.length){const O=n[i];return t.containerState=O[1],e.attempt(O[0].continuation,h,p)(C)}return p(C)}function h(C){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const O=t.events.length;let z=O,L;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){L=t.events[z][1].end;break}k(i);let V=O;for(;V<t.events.length;)t.events[V][1].end={...L},V++;return br(t.events,z+1,0,t.events.slice(O)),t.events.length=V,p(C)}return f(C)}function p(C){if(i===n.length){if(!a)return b(C);if(a.currentConstruct&&a.currentConstruct.concrete)return _(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(C_,m,x)(C)}function m(C){return a&&E(),k(i),b(C)}function x(C){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(C)}function b(C){return t.containerState={},e.attempt(C_,y,_)(C)}function y(C){return i++,n.push([t.currentConstruct,t.containerState]),b(C)}function _(C){if(C===null){a&&E(),k(0),e.consume(C);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(C)}function j(C){if(C===null){N(e.exit("chunkFlow"),!0),k(0),e.consume(C);return}return Fe(C)?(e.consume(C),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(C),j)}function N(C,O){const z=t.sliceStream(C);if(O&&z.push(null),C.previous=o,o&&(o.next=C),o=C,a.defineSkip(C.start),a.write(z),t.parser.lazy[C.start.line]){let L=a.events.length;for(;L--;)if(a.events[L][1].start.offset<u&&(!a.events[L][1].end||a.events[L][1].end.offset>u))return;const V=t.events.length;let F=V,Q,D;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(Q){D=t.events[F][1].end;break}Q=!0}for(k(i),L=V;L<t.events.length;)t.events[L][1].end={...D},L++;br(t.events,F+1,0,t.events.slice(V)),t.events.length=L}}function k(C){let O=n.length;for(;O-- >C;){const z=n[O];t.containerState=z[1],z[0].exit.call(t,e)}n.length=C}function E(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function I6(e,t,n){return mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ol(e){if(e===null||Pt(e)||ja(e))return 1;if(kf(e))return 2}function jf(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const zg={name:"attention",resolveAll:H6,tokenize:q6};function H6(e,t){let n=-1,i,a,o,u,f,h,p,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[i][1].end},b={...e[n][1].start};E_(x,-h),E_(b,h),u={type:h>1?"strongSequence":"emphasisSequence",start:x,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Br(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Br(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=Br(p,jf(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Br(p,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=Br(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,br(e,i-1,n-i+3,p),n=i+p.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function q6(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Ol(i);let o;return u;function u(h){return o=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===o)return e.consume(h),f;const p=e.exit("attentionSequence"),m=Ol(h),x=!m||m===2&&a||n.includes(h),b=!a||a===2&&m||n.includes(i);return p._open=!!(o===42?x:x&&(a||!b)),p._close=!!(o===42?b:b&&(m||!x)),t(h)}}function E_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const V6={name:"autolink",tokenize:G6};function G6(e,t,n){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return In(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Ln(y)?(i=1,f(y)):p(y)}function f(y){return y===58?(e.consume(y),i=0,h):(y===43||y===45||y===46||Ln(y))&&i++<32?(e.consume(y),f):(i=0,p(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||ff(y)?n(y):(e.consume(y),h)}function p(y){return y===64?(e.consume(y),m):z6(y)?(e.consume(y),p):n(y)}function m(y){return Ln(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),i=0,m):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Ln(y))&&i++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const Pc={partial:!0,tokenize:Y6};function Y6(e,t,n){return i;function i(o){return ot(o)?mt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Fe(o)?t(o):n(o)}}const U2={continuation:{tokenize:W6},exit:X6,name:"blockQuote",tokenize:Q6};function Q6(e,t,n){const i=this;return a;function a(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function W6(e,t,n){const i=this;return a;function a(u){return ot(u)?mt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(U2,t,n)(u)}}function X6(e){e.exit("blockQuote")}const I2={name:"characterEscape",tokenize:K6};function K6(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return B6(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const H2={name:"characterReference",tokenize:Z6};function Z6(e,t,n){const i=this;let a=0,o,u;return f;function f(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),h}function h(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Ln,m(x))}function p(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=O6,m):(e.enter("characterReferenceValue"),o=7,u=Dg,m(x))}function m(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Ln&&!wx(i.sliceSerialize(b))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(x)&&a++<o?(e.consume(x),m):n(x)}}const T_={partial:!0,tokenize:eT},A_={concrete:!0,name:"codeFenced",tokenize:J6};function J6(e,t,n){const i=this,a={partial:!0,tokenize:z};let o=0,u=0,f;return h;function h(L){return p(L)}function p(L){const V=i.events[i.events.length-1];return o=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(L)}function m(L){return L===f?(u++,e.consume(L),m):u<3?n(L):(e.exit("codeFencedFenceSequence"),ot(L)?mt(e,x,"whitespace")(L):x(L))}function x(L){return L===null||Fe(L)?(e.exit("codeFencedFence"),i.interrupt?t(L):e.check(T_,j,O)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||Fe(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(L)):ot(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mt(e,y,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),b)}function y(L){return L===null||Fe(L)?x(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(L))}function _(L){return L===null||Fe(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(L)):L===96&&L===f?n(L):(e.consume(L),_)}function j(L){return e.attempt(a,O,N)(L)}function N(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),k}function k(L){return o>0&&ot(L)?mt(e,E,"linePrefix",o+1)(L):E(L)}function E(L){return L===null||Fe(L)?e.check(T_,j,O)(L):(e.enter("codeFlowValue"),C(L))}function C(L){return L===null||Fe(L)?(e.exit("codeFlowValue"),E(L)):(e.consume(L),C)}function O(L){return e.exit("codeFenced"),t(L)}function z(L,V,F){let Q=0;return D;function D(G){return L.enter("lineEnding"),L.consume(G),L.exit("lineEnding"),I}function I(G){return L.enter("codeFencedFence"),ot(G)?mt(L,A,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):A(G)}function A(G){return G===f?(L.enter("codeFencedFenceSequence"),se(G)):F(G)}function se(G){return G===f?(Q++,L.consume(G),se):Q>=u?(L.exit("codeFencedFenceSequence"),ot(G)?mt(L,Z,"whitespace")(G):Z(G)):F(G)}function Z(G){return G===null||Fe(G)?(L.exit("codeFencedFence"),V(G)):F(G)}}}function eT(e,t,n){const i=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const ym={name:"codeIndented",tokenize:nT},tT={partial:!0,tokenize:rT};function nT(e,t,n){const i=this;return a;function a(p){return e.enter("codeIndented"),mt(e,o,"linePrefix",5)(p)}function o(p){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?h(p):Fe(p)?e.attempt(tT,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||Fe(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function rT(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):Fe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):mt(e,o,"linePrefix",5)(u)}function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Fe(u)?a(u):n(u)}}const iT={name:"codeText",previous:aT,resolve:sT,tokenize:lT};function sT(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function aT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lT(e,t,n){let i=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),f(x)}function f(x){return x===96?(e.consume(x),i++,f):(e.exit("codeTextSequence"),h(x))}function h(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),h):x===96?(o=e.enter("codeTextSequence"),a=0,m(x)):Fe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||Fe(x)?(e.exit("codeTextData"),h(x)):(e.consume(x),p)}function m(x){return x===96?(e.consume(x),a++,m):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(o.type="codeTextData",p(x))}}class oT{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Ko(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ko(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ko(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ko(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ko(this.left,n.reverse())}}}function Ko(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 q2(e){const t={};let n=-1,i,a,o,u,f,h,p;const m=new oT(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(i=m.get(n),n&&i[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,cT(m,n)),n=t[n],p=!0);else if(i[1]._container){for(o=n,a=void 0;o--;)if(u=m.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(m.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...m.get(a)[1].start},f=m.slice(a,n),f.unshift(i),m.splice(a,n-a+1,f))}}return br(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!p}function cT(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let m,x,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(m=i.sliceStream(y),y.next||m.push(null),x&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(m),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),x=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const k=f.slice(N[b],N[b+1]),E=o.pop();h.push([E,E+k.length-1]),e.splice(E,2,k)}for(h.reverse(),b=-1;++b<h.length;)p[_+h[b][0]]=_+h[b][1],_+=h[b][1]-h[b][0]-1;return p}const uT={resolve:fT,tokenize:hT},dT={partial:!0,tokenize:pT};function fT(e){return q2(e),e}function hT(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):Fe(f)?e.check(dT,u,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function pT(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),mt(e,o,"linePrefix")}function o(u){if(u===null||Fe(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function V2(e,t,n,i,a,o,u,f,h){const p=h||Number.POSITIVE_INFINITY;let m=0;return x;function x(k){return k===60?(e.enter(i),e.enter(a),e.enter(o),e.consume(k),e.exit(o),b):k===null||k===32||k===41||ff(k)?n(k):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(k))}function b(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(a),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(f),b(k)):k===null||k===60||Fe(k)?n(k):(e.consume(k),k===92?_:y)}function _(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function j(k){return!m&&(k===null||k===41||Pt(k))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(k)):m<p&&k===40?(e.consume(k),m++,j):k===41?(e.consume(k),m--,j):k===null||k===32||k===40||ff(k)?n(k):(e.consume(k),k===92?N:j)}function N(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function G2(e,t,n,i,a,o){const u=this;let f=0,h;return p;function p(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(o),m}function m(y){return f>999||y===null||y===91||y===93&&!h||y===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):Fe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||Fe(y)||f++>999?(e.exit("chunkString"),m(y)):(e.consume(y),h||(h=!ot(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,x):x(y)}}function Y2(e,t,n,i,a,o){let u;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,h):n(b)}function h(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),h(u)):b===null?n(b):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),mt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===u||b===null||Fe(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?x:m)}function x(b){return b===u||b===92?(e.consume(b),m):m(b)}}function vc(e,t){let n;return i;function i(a){return Fe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):ot(a)?mt(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const mT={name:"definition",tokenize:xT},gT={partial:!0,tokenize:vT};function xT(e,t,n){const i=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return G2.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=Qr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return Pt(y)?vc(e,p)(y):p(y)}function p(y){return V2(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(gT,x,x)(y)}function x(y){return ot(y)?mt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Fe(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function vT(e,t,n){return i;function i(f){return Pt(f)?vc(e,a)(f):n(f)}function a(f){return Y2(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ot(f)?mt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Fe(f)?t(f):n(f)}}const bT={name:"hardBreakEscape",tokenize:yT};function yT(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Fe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const _T={name:"headingAtx",resolve:wT,tokenize:ST};function wT(e,t){let n=e.length-2,i=3,a,o;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},br(e,i,n-i+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function ST(e,t,n){let i=0;return a;function a(m){return e.enter("atxHeading"),o(m)}function o(m){return e.enter("atxHeadingSequence"),u(m)}function u(m){return m===35&&i++<6?(e.consume(m),u):m===null||Pt(m)?(e.exit("atxHeadingSequence"),f(m)):n(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),h(m)):m===null||Fe(m)?(e.exit("atxHeading"),t(m)):ot(m)?mt(e,f,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function h(m){return m===35?(e.consume(m),h):(e.exit("atxHeadingSequence"),f(m))}function p(m){return m===null||m===35||Pt(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),p)}}const kT=["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"],M_=["pre","script","style","textarea"],jT={concrete:!0,name:"htmlFlow",resolveTo:ET,tokenize:TT},NT={partial:!0,tokenize:MT},CT={partial:!0,tokenize:AT};function ET(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 TT(e,t,n){const i=this;let a,o,u,f,h;return p;function p(M){return m(M)}function m(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),x}function x(M){return M===33?(e.consume(M),b):M===47?(e.consume(M),o=!0,j):M===63?(e.consume(M),a=3,i.interrupt?t:R):In(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function b(M){return M===45?(e.consume(M),a=2,y):M===91?(e.consume(M),a=5,f=0,_):In(M)?(e.consume(M),a=4,i.interrupt?t:R):n(M)}function y(M){return M===45?(e.consume(M),i.interrupt?t:R):n(M)}function _(M){const pe="CDATA[";return M===pe.charCodeAt(f++)?(e.consume(M),f===pe.length?i.interrupt?t:A:_):n(M)}function j(M){return In(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function N(M){if(M===null||M===47||M===62||Pt(M)){const pe=M===47,_e=u.toLowerCase();return!pe&&!o&&M_.includes(_e)?(a=1,i.interrupt?t(M):A(M)):kT.includes(u.toLowerCase())?(a=6,pe?(e.consume(M),k):i.interrupt?t(M):A(M)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(M):o?E(M):C(M))}return M===45||Ln(M)?(e.consume(M),u+=String.fromCharCode(M),N):n(M)}function k(M){return M===62?(e.consume(M),i.interrupt?t:A):n(M)}function E(M){return ot(M)?(e.consume(M),E):D(M)}function C(M){return M===47?(e.consume(M),D):M===58||M===95||In(M)?(e.consume(M),O):ot(M)?(e.consume(M),C):D(M)}function O(M){return M===45||M===46||M===58||M===95||Ln(M)?(e.consume(M),O):z(M)}function z(M){return M===61?(e.consume(M),L):ot(M)?(e.consume(M),z):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,V):ot(M)?(e.consume(M),L):F(M)}function V(M){return M===h?(e.consume(M),h=null,Q):M===null||Fe(M)?n(M):(e.consume(M),V)}function F(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Pt(M)?z(M):(e.consume(M),F)}function Q(M){return M===47||M===62||ot(M)?C(M):n(M)}function D(M){return M===62?(e.consume(M),I):n(M)}function I(M){return M===null||Fe(M)?A(M):ot(M)?(e.consume(M),I):n(M)}function A(M){return M===45&&a===2?(e.consume(M),P):M===60&&a===1?(e.consume(M),$):M===62&&a===4?(e.consume(M),B):M===63&&a===3?(e.consume(M),R):M===93&&a===5?(e.consume(M),ae):Fe(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(NT,K,se)(M)):M===null||Fe(M)?(e.exit("htmlFlowData"),se(M)):(e.consume(M),A)}function se(M){return e.check(CT,Z,K)(M)}function Z(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),G}function G(M){return M===null||Fe(M)?se(M):(e.enter("htmlFlowData"),A(M))}function P(M){return M===45?(e.consume(M),R):A(M)}function $(M){return M===47?(e.consume(M),u="",ie):A(M)}function ie(M){if(M===62){const pe=u.toLowerCase();return M_.includes(pe)?(e.consume(M),B):A(M)}return In(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),ie):A(M)}function ae(M){return M===93?(e.consume(M),R):A(M)}function R(M){return M===62?(e.consume(M),B):M===45&&a===2?(e.consume(M),R):A(M)}function B(M){return M===null||Fe(M)?(e.exit("htmlFlowData"),K(M)):(e.consume(M),B)}function K(M){return e.exit("htmlFlow"),t(M)}}function AT(e,t,n){const i=this;return a;function a(u){return Fe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function MT(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Pc,t,n)}}const RT={name:"htmlText",tokenize:LT};function LT(e,t,n){const i=this;let a,o,u;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),z):R===63?(e.consume(R),C):In(R)?(e.consume(R),F):n(R)}function p(R){return R===45?(e.consume(R),m):R===91?(e.consume(R),o=0,_):In(R)?(e.consume(R),E):n(R)}function m(R){return R===45?(e.consume(R),y):n(R)}function x(R){return R===null?n(R):R===45?(e.consume(R),b):Fe(R)?(u=x,$(R)):(e.consume(R),x)}function b(R){return R===45?(e.consume(R),y):x(R)}function y(R){return R===62?P(R):R===45?b(R):x(R)}function _(R){const B="CDATA[";return R===B.charCodeAt(o++)?(e.consume(R),o===B.length?j:_):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),N):Fe(R)?(u=j,$(R)):(e.consume(R),j)}function N(R){return R===93?(e.consume(R),k):j(R)}function k(R){return R===62?P(R):R===93?(e.consume(R),k):j(R)}function E(R){return R===null||R===62?P(R):Fe(R)?(u=E,$(R)):(e.consume(R),E)}function C(R){return R===null?n(R):R===63?(e.consume(R),O):Fe(R)?(u=C,$(R)):(e.consume(R),C)}function O(R){return R===62?P(R):C(R)}function z(R){return In(R)?(e.consume(R),L):n(R)}function L(R){return R===45||Ln(R)?(e.consume(R),L):V(R)}function V(R){return Fe(R)?(u=V,$(R)):ot(R)?(e.consume(R),V):P(R)}function F(R){return R===45||Ln(R)?(e.consume(R),F):R===47||R===62||Pt(R)?Q(R):n(R)}function Q(R){return R===47?(e.consume(R),P):R===58||R===95||In(R)?(e.consume(R),D):Fe(R)?(u=Q,$(R)):ot(R)?(e.consume(R),Q):P(R)}function D(R){return R===45||R===46||R===58||R===95||Ln(R)?(e.consume(R),D):I(R)}function I(R){return R===61?(e.consume(R),A):Fe(R)?(u=I,$(R)):ot(R)?(e.consume(R),I):Q(R)}function A(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,se):Fe(R)?(u=A,$(R)):ot(R)?(e.consume(R),A):(e.consume(R),Z)}function se(R){return R===a?(e.consume(R),a=void 0,G):R===null?n(R):Fe(R)?(u=se,$(R)):(e.consume(R),se)}function Z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Pt(R)?Q(R):(e.consume(R),Z)}function G(R){return R===47||R===62||Pt(R)?Q(R):n(R)}function P(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function $(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ie}function ie(R){return ot(R)?mt(e,ae,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ae(R)}function ae(R){return e.enter("htmlTextData"),u(R)}}const Sx={name:"labelEnd",resolveAll:BT,resolveTo:PT,tokenize:$T},DT={tokenize:FT},zT={tokenize:UT},OT={tokenize:IT};function BT(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&br(e,0,e.length,n),e}function PT(e,t){let n=e.length,i=0,a,o,u,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},m={type:"labelText",start:{...e[o+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=Br(f,e.slice(o+1,o+i+3)),f=Br(f,[["enter",m,t]]),f=Br(f,jf(t.parser.constructs.insideSpan.null,e.slice(o+i+4,u-3),t)),f=Br(f,[["exit",m,t],e[u-2],e[u-1],["exit",p,t]]),f=Br(f,e.slice(u+1)),f=Br(f,[["exit",h,t]]),br(e,o,e.length,f),e}function $T(e,t,n){const i=this;let a=i.events.length,o,u;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){o=i.events[a][1];break}return f;function f(b){return o?o._inactive?x(b):(u=i.parser.defined.includes(Qr(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):n(b)}function h(b){return b===40?e.attempt(DT,m,u?m:x)(b):b===91?e.attempt(zT,m,u?p:x)(b):u?m(b):x(b)}function p(b){return e.attempt(OT,m,x)(b)}function m(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function FT(e,t,n){return i;function i(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return Pt(x)?vc(e,o)(x):o(x)}function o(x){return x===41?m(x):V2(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return Pt(x)?vc(e,h)(x):m(x)}function f(x){return n(x)}function h(x){return x===34||x===39||x===40?Y2(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):m(x)}function p(x){return Pt(x)?vc(e,m)(x):m(x)}function m(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function UT(e,t,n){const i=this;return a;function a(f){return G2.call(i,e,o,u,"reference","referenceMarker","referenceString")(f)}function o(f){return i.parser.defined.includes(Qr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function IT(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const HT={name:"labelStartImage",resolveAll:Sx.resolveAll,tokenize:qT};function qT(e,t,n){const i=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):t(f)}}const VT={name:"labelStartLink",resolveAll:Sx.resolveAll,tokenize:GT};function GT(e,t,n){const i=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const _m={name:"lineEnding",tokenize:YT};function YT(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),mt(e,t,"linePrefix")}}const Pd={name:"thematicBreak",tokenize:QT};function QT(e,t,n){let i=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,f(p)}function f(p){return p===a?(e.enter("thematicBreakSequence"),h(p)):i>=3&&(p===null||Fe(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===a?(e.consume(p),i++,h):(e.exit("thematicBreakSequence"),ot(p)?mt(e,f,"whitespace")(p):f(p))}}const Jn={continuation:{tokenize:ZT},exit:eA,name:"list",tokenize:KT},WT={partial:!0,tokenize:tA},XT={partial:!0,tokenize:JT};function KT(e,t,n){const i=this,a=i.events[i.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return f;function f(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:Dg(y)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Pd,n,p)(y):p(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Dg(y)&&++u<10?(e.consume(y),h):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Pc,i.interrupt?n:m,e.attempt(WT,b,x))}function m(y){return i.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function ZT(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Pc,a,o);function a(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,mt(e,t,"listItemIndent",i.containerState.size+1)(f)}function o(f){return i.containerState.furtherBlankLines||!ot(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(XT,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,mt(e,e.attempt(Jn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function JT(e,t,n){const i=this;return mt(e,a,"listItemIndent",i.containerState.size+1);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(o):n(o)}}function eA(e){e.exit(this.containerState.type)}function tA(e,t,n){const i=this;return mt(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=i.events[i.events.length-1];return!ot(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const R_={name:"setextUnderline",resolveTo:nA,tokenize:rA};function nA(e,t){let n=e.length,i,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",u,t]),e.splice(o+1,0,["exit",e[i][1],t]),e[i][1].end={...e[o][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function rA(e,t,n){const i=this;let a;return o;function o(p){let m=i.events.length,x;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){x=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||x)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===a?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ot(p)?mt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||Fe(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const iA={tokenize:sA};function sA(e){const t=this,n=e.attempt(Pc,i,e.attempt(this.parser.constructs.flowInitial,a,mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(uT,a)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aA={resolveAll:W2()},lA=Q2("string"),oA=Q2("text");function Q2(e){return{resolveAll:W2(e==="text"?cA:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],o=n.attempt(a,u,f);return u;function u(m){return p(m)?o(m):f(m)}function f(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),h}function h(m){return p(m)?(n.exit("data"),o(m)):(n.consume(m),h)}function p(m){if(m===null)return!0;const x=a[m];let b=-1;if(x)for(;++b<x.length;){const y=x[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function W2(e){return t;function t(n,i){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,i):n}}function cA(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let o=a.length,u=-1,f=0,h;for(;o--;){const p=a[o];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(p===-2)h=!0,f++;else if(p!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:i.start._bufferIndex+u,_index:i.start._index+o,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const uA={42:Jn,43:Jn,45:Jn,48:Jn,49:Jn,50:Jn,51:Jn,52:Jn,53:Jn,54:Jn,55:Jn,56:Jn,57:Jn,62:U2},dA={91:mT},fA={[-2]:ym,[-1]:ym,32:ym},hA={35:_T,42:Pd,45:[R_,Pd],60:jT,61:R_,95:Pd,96:A_,126:A_},pA={38:H2,92:I2},mA={[-5]:_m,[-4]:_m,[-3]:_m,33:HT,38:H2,42:zg,60:[V6,RT],91:VT,92:[bT,I2],93:Sx,95:zg,96:iT},gA={null:[zg,aA]},xA={null:[42,95]},vA={null:[]},bA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xA,contentInitial:dA,disable:vA,document:uA,flow:hA,flowInitial:fA,insideSpan:gA,string:pA,text:mA},Symbol.toStringTag,{value:"Module"}));function yA(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],f=[];const h={attempt:V(z),check:V(L),consume:E,enter:C,exit:O,interrupt:V(L,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:x};let m=t.tokenize.call(p,h);return t.resolveAll&&o.push(t),p;function x(I){return u=Br(u,I),N(),u[u.length-1]!==null?[]:(F(t,0),p.events=jf(o,p.events,p),p.events)}function b(I,A){return wA(y(I),A)}function y(I){return _A(u,I)}function _(){const{_bufferIndex:I,_index:A,line:se,column:Z,offset:G}=i;return{_bufferIndex:I,_index:A,line:se,column:Z,offset:G}}function j(I){a[I.line]=I.column,D()}function N(){let I;for(;i._index<u.length;){const A=u[i._index];if(typeof A=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<A.length;)k(A.charCodeAt(i._bufferIndex));else k(A)}}function k(I){m=m(I)}function E(I){Fe(I)?(i.line++,i.column=1,i.offset+=I===-3?2:1,D()):I!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=I}function C(I,A){const se=A||{};return se.type=I,se.start=_(),p.events.push(["enter",se,p]),f.push(se),se}function O(I){const A=f.pop();return A.end=_(),p.events.push(["exit",A,p]),A}function z(I,A){F(I,A.from)}function L(I,A){A.restore()}function V(I,A){return se;function se(Z,G,P){let $,ie,ae,R;return Array.isArray(Z)?K(Z):"tokenize"in Z?K([Z]):B(Z);function B(Ce){return De;function De(Ee){const Be=Ee!==null&&Ce[Ee],Je=Ee!==null&&Ce.null,jt=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Je)?Je:Je?[Je]:[]];return K(jt)(Ee)}}function K(Ce){return $=Ce,ie=0,Ce.length===0?P:M(Ce[ie])}function M(Ce){return De;function De(Ee){return R=Q(),ae=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?_e():Ce.tokenize.call(A?Object.assign(Object.create(p),A):p,h,pe,_e)(Ee)}}function pe(Ce){return I(ae,R),G}function _e(Ce){return R.restore(),++ie<$.length?M($[ie]):P}}}function F(I,A){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&br(p.events,A,p.events.length-A,I.resolve(p.events.slice(A),p)),I.resolveTo&&(p.events=I.resolveTo(p.events,p))}function Q(){const I=_(),A=p.previous,se=p.currentConstruct,Z=p.events.length,G=Array.from(f);return{from:Z,restore:P};function P(){i=I,p.previous=A,p.currentConstruct=se,p.events.length=Z,f=G,D()}}function D(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function _A(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,o)];else{if(u=e.slice(n,a),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function wA(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
|
|
73
|
-
`;break}case-3:{u=`\r
|
|
74
|
-
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,i.push(u)}return i.join("")}function SA(e){const i={constructs:$2([bA,...(e||{}).extensions||[]]),content:a(P6),defined:[],document:a(F6),flow:a(iA),lazy:{},string:a(lA),text:a(oA)};return i;function a(o){return u;function u(f){return yA(i,o,f)}}}function kA(e){for(;!q2(e););return e}const L_=/[\0\t\n\r]/g;function jA(){let e=1,t="",n=!0,i;return a;function a(o,u,f){const h=[];let p,m,x,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),x=0,t="",n&&(o.charCodeAt(0)===65279&&x++,n=void 0);x<o.length;){if(L_.lastIndex=x,p=L_.exec(o),b=p&&p.index!==void 0?p.index:o.length,y=o.charCodeAt(b),!p){t=o.slice(x);break}if(y===10&&x===b&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),x<b&&(h.push(o.slice(x,b)),e+=b-x),y){case 0:{h.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,h.push(-2);e++<m;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}x=b+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const NA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function CA(e){return e.replace(NA,EA)}function EA(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return F2(n.slice(o?2:1),o?16:10)}return wx(n)||e}const X2={}.hasOwnProperty;function TA(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),AA(n)(kA(SA(n).document().write(jA()(e,t,!0))))}function AA(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(nt),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:o(_t),blockQuote:o(Je),characterEscape:Q,characterReference:Q,codeFenced:o(jt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(jt,u),codeText:o(dt,u),codeTextData:Q,data:Q,codeFlowValue:Q,definition:o(gt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(xt),hardBreakEscape:o(Nt),hardBreakTrailing:o(Nt),htmlFlow:o(ve,u),htmlFlowData:Q,htmlText:o(ve,u),htmlTextData:Q,image:o($e),label:u,link:o(nt),listItem:o(je),listItemValue:b,listOrdered:o(nn,x),listUnordered:o(nn),paragraph:o(ze),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(_t),strong:o(ht),thematicBreak:o($r)},exit:{atxHeading:h(),atxHeadingSequence:z,autolink:h(),autolinkEmail:Be,autolinkProtocol:Ee,blockQuote:h(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:De,codeFenced:h(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:D,codeIndented:h(k),codeText:h(G),codeTextData:D,data:D,definition:h(),definitionDestinationString:O,definitionLabelString:E,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(A),hardBreakTrailing:h(A),htmlFlow:h(se),htmlFlowData:D,htmlText:h(Z),htmlTextData:D,image:h($),label:ae,labelText:ie,lineEnding:I,link:h(P),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:R,resourceTitleString:B,resource:K,setextHeading:h(F),setextHeadingLineSequence:V,setextHeadingText:L,strong:h(),thematicBreak:h()}};K2(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(oe){let we={type:"root",children:[]};const W={stack:[we],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:m,data:n},me=[];let Re=-1;for(;++Re<oe.length;)if(oe[Re][1].type==="listOrdered"||oe[Re][1].type==="listUnordered")if(oe[Re][0]==="enter")me.push(Re);else{const We=me.pop();Re=a(oe,We,Re)}for(Re=-1;++Re<oe.length;){const We=t[oe[Re][0]];X2.call(We,oe[Re][1].type)&&We[oe[Re][1].type].call(Object.assign({sliceSerialize:oe[Re][2].sliceSerialize},W),oe[Re][1])}if(W.tokenStack.length>0){const We=W.tokenStack[W.tokenStack.length-1];(We[1]||D_).call(W,void 0,We[0])}for(we.position={start:Ns(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Ns(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Re=-1;++Re<t.transforms.length;)we=t.transforms[Re](we)||we;return we}function a(oe,we,W){let me=we-1,Re=-1,We=!1,rt,it,St,xn;for(;++me<=W;){const et=oe[me];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?Re++:Re--,xn=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(rt&&!xn&&!Re&&!St&&(St=me),xn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:xn=void 0}if(!Re&&et[0]==="enter"&&et[1].type==="listItemPrefix"||Re===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(rt){let ir=me;for(it=void 0;ir--;){const En=oe[ir];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;it&&(oe[it][1].type="lineEndingBlank",We=!0),En[1].type="lineEnding",it=ir}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}St&&(!it||St<it)&&(rt._spread=!0),rt.end=Object.assign({},it?oe[it][1].start:et[1].end),oe.splice(it||me,0,["exit",rt,et[2]]),me++,W++}if(et[1].type==="listItemPrefix"){const ir={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};rt=ir,oe.splice(me,0,["enter",ir,et[2]]),me++,W++,St=void 0,xn=!0}}}return oe[we][1]._spread=We,W}function o(oe,we){return W;function W(me){f.call(this,oe(me),me),we&&we.call(this,me)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(oe,we,W){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([we,W||void 0]),oe.position={start:Ns(we.start),end:void 0}}function h(oe){return we;function we(W){oe&&oe.call(this,W),p.call(this,W)}}function p(oe,we){const W=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==oe.type&&(we?we.call(this,oe,me[0]):(me[1]||D_).call(this,oe,me[0]));else throw new Error("Cannot close `"+oe.type+"` ("+xc({start:oe.start,end:oe.end})+"): it’s not open");W.position.end=Ns(oe.end)}function m(){return _x(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.lang=oe}function _(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/(\r?\n|\r)$/g,"")}function E(oe){const we=this.resume(),W=this.stack[this.stack.length-1];W.label=we,W.identifier=Qr(this.sliceSerialize(oe)).toLowerCase()}function C(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function O(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function z(oe){const we=this.stack[this.stack.length-1];if(!we.depth){const W=this.sliceSerialize(oe).length;we.depth=W}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function V(oe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(oe){const W=this.stack[this.stack.length-1].children;let me=W[W.length-1];(!me||me.type!=="text")&&(me=Te(),me.position={start:Ns(oe.start),end:void 0},W.push(me)),this.stack.push(me)}function D(oe){const we=this.stack.pop();we.value+=this.sliceSerialize(oe),we.position.end=Ns(oe.end)}function I(oe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=we.children[we.children.length-1];W.position.end=Ns(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(Q.call(this,oe),D.call(this,oe))}function A(){this.data.atHardBreak=!0}function se(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function Z(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function G(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function P(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function $(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ie(oe){const we=this.sliceSerialize(oe),W=this.stack[this.stack.length-2];W.label=CA(we),W.identifier=Qr(we).toLowerCase()}function ae(){const oe=this.stack[this.stack.length-1],we=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const me=oe.children;W.children=me}else W.alt=we}function R(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function B(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function K(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function pe(oe){const we=this.resume(),W=this.stack[this.stack.length-1];W.label=we,W.identifier=Qr(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function _e(oe){this.data.characterReferenceType=oe.type}function Ce(oe){const we=this.sliceSerialize(oe),W=this.data.characterReferenceType;let me;W?(me=F2(we,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=wx(we);const Re=this.stack[this.stack.length-1];Re.value+=me}function De(oe){const we=this.stack.pop();we.position.end=Ns(oe.end)}function Ee(oe){D.call(this,oe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(oe)}function Be(oe){D.call(this,oe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(oe)}function Je(){return{type:"blockquote",children:[]}}function jt(){return{type:"code",lang:null,meta:null,value:""}}function dt(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xt(){return{type:"emphasis",children:[]}}function _t(){return{type:"heading",depth:0,children:[]}}function Nt(){return{type:"break"}}function ve(){return{type:"html",value:""}}function $e(){return{type:"image",title:null,url:"",alt:null}}function nt(){return{type:"link",title:null,url:"",children:[]}}function nn(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function je(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function ht(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function $r(){return{type:"thematicBreak"}}}function Ns(e){return{line:e.line,column:e.column,offset:e.offset}}function K2(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?K2(e,i):MA(e,i)}}function MA(e,t){let n;for(n in t)if(X2.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function D_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xc({start:t.start,end:t.end})+") is still open")}function RA(e){const t=this;t.parser=n;function n(i){return TA(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function LA(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 DA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
-
`}]}function zA(e,t){const n=t.value?t.value+`
|
|
76
|
-
`:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function OA(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BA(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PA(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Ul(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let u,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=o+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const p={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,p),e.applyData(t,p)}function $A(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 FA(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Z2(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function UA(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Z2(e,t);const a={src:Ul(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function IA(e,t){const n={src:Ul(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function HA(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function qA(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Z2(e,t);const a={href:Ul(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function VA(e,t){const n={href:Ul(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function GA(e,t,n){const i=e.all(t),a=n?YA(n):J2(t),o={},u=[];if(typeof t.checked=="boolean"){const m=i[0];let x;m&&m.type==="element"&&m.tagName==="p"?x=m:(x={type:"element",tagName:"p",properties:{},children:[]},i.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const m=i[f];(a||f!==0||m.type!=="element"||m.tagName!=="p")&&u.push({type:"text",value:`
|
|
77
|
-
`}),m.type==="element"&&m.tagName==="p"&&!a?u.push(...m.children):u.push(m)}const h=i[i.length-1];h&&(a||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
|
|
78
|
-
`});const p={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,p),e.applyData(t,p)}function YA(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=J2(n[i])}return t}function J2(e){const t=e.spread;return t??e.children.length>1}function QA(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const u=i[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function WA(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XA(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function KA(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZA(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=xx(t.children[1]),h=R2(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function JA(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,f=u?u.length:t.children.length;let h=-1;const p=[];for(;++h<f;){const x=t.children[h],b={},y=u?u[h]:void 0;y&&(b.align=y);let _={type:"element",tagName:o,properties:b,children:[]};x&&(_.children=e.all(x),e.patch(x,_),_=e.applyData(x,_)),p.push(_)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,m),e.applyData(t,m)}function eM(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const z_=9,O_=32;function tM(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const o=[];for(;i;)o.push(B_(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return o.push(B_(t.slice(a),a>0,!1)),o.join("")}function B_(e,t,n){let i=0,a=e.length;if(t){let o=e.codePointAt(i);for(;o===z_||o===O_;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(a-1);for(;o===z_||o===O_;)a--,o=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function nM(e,t){const n={type:"text",value:tM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function rM(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const iM={blockquote:LA,break:DA,code:zA,delete:OA,emphasis:BA,footnoteReference:PA,heading:$A,html:FA,imageReference:UA,image:IA,inlineCode:HA,linkReference:qA,link:VA,listItem:GA,list:QA,paragraph:WA,root:XA,strong:KA,table:ZA,tableCell:eM,tableRow:JA,text:nM,thematicBreak:rM,toml:bd,yaml:bd,definition:bd,footnoteDefinition:bd};function bd(){}const eS=-1,Nf=0,bc=1,hf=2,kx=3,jx=4,Nx=5,Cx=6,tS=7,nS=8,rS=typeof self=="object"?self:globalThis,P_=(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 rS[e](t)},sM=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),i=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Nf:case eS:return n(u,a);case bc:{const f=n([],a);for(const h of u)f.push(i(h));return f}case hf:{const f=n({},a);for(const[h,p]of u)f[i(h)]=i(p);return f}case kx:return n(new Date(u),a);case jx:{const{source:f,flags:h}=u;return n(new RegExp(f,h),a)}case Nx:{const f=n(new Map,a);for(const[h,p]of u)f.set(i(h),i(p));return f}case Cx:{const f=n(new Set,a);for(const h of u)f.add(i(h));return f}case tS:{const{name:f,message:h}=u;return n(typeof rS[f]=="function"?P_(f,h):new Error(h),a)}case nS:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return n(new DataView(f),u)}}return n(P_(o,u),a)};return i},$_=e=>sM(new Map,e)(0),va="",{toString:aM}={},{keys:lM}=Object,Zo=e=>{const t=typeof e;if(t!=="object"||!e)return[Nf,t];const n=aM.call(e).slice(8,-1);switch(n){case"Array":return[bc,va];case"Object":return[hf,va];case"Date":return[kx,va];case"RegExp":return[jx,va];case"Map":return[Nx,va];case"Set":return[Cx,va];case"DataView":return[bc,n]}return n.includes("Array")?[bc,n]:e instanceof Error?[tS,e.name||"Error"]:[hf,n]},yd=([e,t])=>e===Nf&&(t==="function"||t==="symbol"),oM=(e,t,n,i)=>{const a=(u,f)=>{const h=i.push(u)-1;return n.set(f,h),h},o=u=>{if(n.has(u))return n.get(u);let[f,h]=Zo(u);switch(f){case Nf:{let m=u;switch(h){case"bigint":f=nS,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);m=null;break;case"undefined":return a([eS],u)}return a([f,m],u)}case bc:{if(h){let b=u;return h==="DataView"?b=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(u)),a([h,[...b]],u)}const m=[],x=a([f,m],u);for(const b of u)m.push(o(b));return x}case hf:{if(h)switch(h){case"BigInt":return a([h,u.toString()],u);case"Boolean":case"Number":case"String":return a([h,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const m=[],x=a([f,m],u);for(const b of lM(u))(e||!yd(Zo(u[b])))&&m.push([o(b),o(u[b])]);return x}case kx:return a([f,isNaN(u.getTime())?va:u.toISOString()],u);case jx:{const{source:m,flags:x}=u;return a([f,{source:m,flags:x}],u)}case Nx:{const m=[],x=a([f,m],u);for(const[b,y]of u)(e||!(yd(Zo(b))||yd(Zo(y))))&&m.push([o(b),o(y)]);return x}case Cx:{const m=[],x=a([f,m],u);for(const b of u)(e||!yd(Zo(b)))&&m.push(o(b));return x}}const{message:p}=u;return a([f,{name:h,message:p}],u)};return o},F_=(e,{json:t,lossy:n}={})=>{const i=[];return oM(!(t||n),!!t,new Map,i)(e),i},pf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?$_(F_(e,t)):structuredClone(e):(e,t)=>$_(F_(e,t));function cM(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 uM(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function dM(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||cM,i=e.options.footnoteBackLabel||uM,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let h=-1;for(;++h<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[h]);if(!p)continue;const m=e.all(p),x=String(p.identifier).toUpperCase(),b=Ul(x.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let E=typeof n=="string"?n:n(h,y);typeof E=="string"&&(E={type:"text",value:E}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(h,y),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const N=m[m.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const E=N.children[N.children.length-1];E&&E.type==="text"?E.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(..._)}else m.push(..._);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(m,!0)};e.patch(p,k),f.push(k)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...pf(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
79
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
80
|
-
`}]}}const Cf=(function(e){if(e==null)return mM;if(typeof e=="function")return Ef(e);if(typeof e=="object")return Array.isArray(e)?fM(e):hM(e);if(typeof e=="string")return pM(e);throw new Error("Expected function, string, or object as test")});function fM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Cf(e[n]);return Ef(i);function i(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function hM(e){const t=e;return Ef(n);function n(i){const a=i;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function pM(e){return Ef(t);function t(n){return n&&n.type===e}}function Ef(e){return t;function t(n,i,a){return!!(gM(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function mM(){return!0}function gM(e){return e!==null&&typeof e=="object"&&"type"in e}const iS=[],xM=!0,Og=!1,vM="skip";function sS(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const o=Cf(a),u=i?-1:1;f(e,void 0,[])();function f(h,p,m){const x=h&&typeof h=="object"?h:{};if(typeof x.type=="string"){const y=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=iS,_,j,N;if((!t||o(h,p,m[m.length-1]||void 0))&&(y=bM(n(h,m)),y[0]===Og))return y;if("children"in h&&h.children){const k=h;if(k.children&&y[0]!==vM)for(j=(i?k.children.length:-1)+u,N=m.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(_=f(E,j,N)(),_[0]===Og)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function bM(e){return Array.isArray(e)?e:typeof e=="number"?[xM,e]:e==null?iS:[e]}function Ex(e,t,n,i){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=i),sS(e,o,f,a);function f(h,p){const m=p[p.length-1],x=m?m.children.indexOf(h):void 0;return u(h,x,m)}}const Bg={}.hasOwnProperty,yM={};function _M(e,t){const n=t||yM,i=new Map,a=new Map,o=new Map,u={...iM,...n.handlers},f={all:p,applyData:SM,definitionById:i,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:h,options:n,patch:wM,wrap:jM};return Ex(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const x=m.type==="definition"?i:a,b=String(m.identifier).toUpperCase();x.has(b)||x.set(b,m)}}),f;function h(m,x){const b=m.type,y=f.handlers[b];if(Bg.call(f.handlers,b)&&y)return y(f,m,x);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in m){const{children:j,...N}=m,k=pf(N);return k.children=f.all(m),k}return pf(m)}return(f.options.unknownHandler||kM)(f,m,x)}function p(m){const x=[];if("children"in m){const b=m.children;let y=-1;for(;++y<b.length;){const _=f.one(b[y],m);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=U_(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=U_(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function wM(e,t){e.position&&(t.position=u6(e))}function SM(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,pf(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function kM(e,t){const n=t.data||{},i="value"in t&&!(Bg.call(n,"hProperties")||Bg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function jM(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
|
|
81
|
-
`});++i<e.length;)i&&n.push({type:"text",value:`
|
|
82
|
-
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
83
|
-
`}),n}function U_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function I_(e,t){const n=_M(e,t),i=n.one(e,void 0),a=dM(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
84
|
-
`},a),o}function NM(e,t){return e&&"run"in e?async function(n,i){const a=I_(n,{file:i,...t});await e.run(a,i)}:function(n,i){return I_(n,{file:i,...e||t})}}function H_(e){if(e)throw e}var wm,q_;function CM(){if(q_)return wm;q_=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},o=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var m=e.call(p,"constructor"),x=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!m&&!x)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},u=function(p,m){n&&m.name==="__proto__"?n(p,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):p[m.name]=m.newValue},f=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(i)return i(p,m).value}else return;return p[m]};return wm=function h(){var p,m,x,b,y,_,j=arguments[0],N=1,k=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<k;++N)if(p=arguments[N],p!=null)for(m in p)x=f(j,m),b=f(p,m),j!==b&&(E&&b&&(o(b)||(y=a(b)))?(y?(y=!1,_=x&&a(x)?x:[]):_=x&&o(x)?x:{},u(j,{name:m,newValue:h(E,_,b)})):typeof b<"u"&&u(j,{name:m,newValue:b}));return j},wm}var EM=CM();const Sm=Vg(EM);function Pg(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 TM(){const e=[],t={run:n,use:i};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...a);function f(h,...p){const m=e[++o];let x=-1;if(h){u(h);return}for(;++x<a.length;)(p[x]===null||p[x]===void 0)&&(p[x]=a[x]);a=p,m?AM(m,f)(...p):u(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function AM(e,t){let n;return i;function i(...u){const f=e.length>u.length;let h;f&&u.push(a);try{h=e.apply(this,u)}catch(p){const m=p;if(f&&n)throw m;return a(m)}f||(h&&h.then&&typeof h.then=="function"?h.then(o,a):h instanceof Error?a(h):o(h))}function a(u,...f){n||(n=!0,t(u,...f))}function o(u){a(null,u)}}const ci={basename:MM,dirname:RM,extname:LM,join:DM,sep:"/"};function MM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');$c(e);let n=0,i=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else i<0&&(o=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(i=a):(f=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function RM(e){if($c(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function LM(e){$c(e);let t=e.length,n=-1,i=0,a=-1,o=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function DM(...e){let t=-1,n;for(;++t<e.length;)$c(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":zM(n)}function zM(e){$c(e);const t=e.codePointAt(0)===47;let n=OM(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function OM(e,t){let n="",i=0,a=-1,o=0,u=-1,f,h;for(;++u<=e.length;){if(u<e.length)f=e.codePointAt(u);else{if(f===47)break;f=47}if(f===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",i=0):(n=n.slice(0,h),i=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",i=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),i=u-a-1;a=u,o=0}else f===46&&o>-1?o++:o=-1}return n}function $c(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const BM={cwd:PM};function PM(){return"/"}function $g(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $M(e){if(typeof e=="string")e=new URL(e);else if(!$g(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 FM(e)}function FM(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const km=["history","path","basename","stem","extname","dirname"];class aS{constructor(t){let n;t?$g(t)?n={path:t}:typeof t=="string"||UM(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":BM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<km.length;){const o=km[i];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)km.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ci.basename(this.path):void 0}set basename(t){Nm(t,"basename"),jm(t,"basename"),this.path=ci.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ci.dirname(this.path):void 0}set dirname(t){V_(this.basename,"dirname"),this.path=ci.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ci.extname(this.path):void 0}set extname(t){if(jm(t,"extname"),V_(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ci.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){$g(t)&&(t=$M(t)),Nm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ci.basename(this.path,this.extname):void 0}set stem(t){Nm(t,"stem"),jm(t,"stem"),this.path=ci.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new zn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function jm(e,t){if(e&&e.includes(ci.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ci.sep+"`")}function Nm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function V_(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function UM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const IM=(function(e){const i=this.constructor.prototype,a=i[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,i),o}),HM={}.hasOwnProperty;class Tx extends IM{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=TM()}copy(){const t=new Tx;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Sm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Tm("data",this.frozen),this.namespace[t]=n,this):HM.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Tm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=_d(t),i=this.parser||this.Parser;return Cm("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Cm("process",this.parser||this.Parser),Em("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const f=_d(t),h=i.parse(f);i.run(h,f,function(m,x,b){if(m||!x||!b)return p(m);const y=x,_=i.stringify(y,b);GM(_)?b.value=_:b.result=_,p(m,b)});function p(m,x){m||!x?u(m):o?o(x):n(void 0,x)}}}processSync(t){let n=!1,i;return this.freeze(),Cm("processSync",this.parser||this.Parser),Em("processSync",this.compiler||this.Compiler),this.process(t,a),Y_("processSync","process",n),i;function a(o,u){n=!0,H_(o),i=u}}run(t,n,i){G_(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?o(void 0,i):new Promise(o);function o(u,f){const h=_d(n);a.run(t,h,p);function p(m,x,b){const y=x||t;m?f(m):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,o),Y_("runSync","run",i),a;function o(u,f){H_(u),a=f,i=!0}}stringify(t,n){this.freeze();const i=_d(n),a=this.compiler||this.Compiler;return Em("stringify",a),G_(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(Tm("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...x]=p;h(m,x)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(p.plugins),p.settings&&(a.settings=Sm(!0,a.settings,p.settings))}function f(p){let m=-1;if(p!=null)if(Array.isArray(p))for(;++m<p.length;){const x=p[m];o(x)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,m){let x=-1,b=-1;for(;++x<i.length;)if(i[x][0]===p){b=x;break}if(b===-1)i.push([p,...m]);else if(m.length>0){let[y,..._]=m;const j=i[b][1];Pg(j)&&Pg(y)&&(y=Sm(!0,j,y)),i[b]=[p,y,..._]}}}}const qM=new Tx().freeze();function Cm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Em(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Tm(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 G_(e){if(!Pg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Y_(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function _d(e){return VM(e)?e:new aS(e)}function VM(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function GM(e){return typeof e=="string"||YM(e)}function YM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Q_=[],W_={allowDangerousHtml:!0},WM=/^(https?|ircs?|mailto|xmpp)$/i,XM=[{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 Ax(e){const t=KM(e),n=ZM(e);return JM(t.runSync(t.parse(n),n),e)}function KM(e){const t=e.rehypePlugins||Q_,n=e.remarkPlugins||Q_,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...W_}:W_;return qM().use(RA).use(n).use(NM,i).use(t)}function ZM(e){const t=e.children||"",n=new aS;return typeof t=="string"&&(n.value=t),n}function JM(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||e8;for(const m of XM)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+QM+m.id,void 0);return Ex(e,p),m6(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function p(m,x,b){if(m.type==="raw"&&b&&typeof x=="number")return u?b.children.splice(x,1):b.children[x]={type:"text",value:m.value},x;if(m.type==="element"){let y;for(y in bm)if(Object.hasOwn(bm,y)&&Object.hasOwn(m.properties,y)){const _=m.properties[y],j=bm[y];(j===null||j.includes(m.tagName))&&(m.properties[y]=h(String(_||""),y,m))}}if(m.type==="element"){let y=n?!n.includes(m.tagName):o?o.includes(m.tagName):!1;if(!y&&i&&typeof x=="number"&&(y=!i(m,x,b)),y&&b&&typeof x=="number")return f&&m.children?b.children.splice(x,1,...m.children):b.children.splice(x,1),x}}}function e8(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||WM.test(e.slice(0,t))?e:""}function X_(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function t8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function n8(e,t,n){const a=Cf((n||{}).ignore||[]),o=r8(t);let u=-1;for(;++u<o.length;)sS(e,"text",f);function f(p,m){let x=-1,b;for(;++x<m.length;){const y=m[x],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return h(p,m)}function h(p,m){const x=m[m.length-1],b=o[u][0],y=o[u][1];let _=0;const N=x.children.indexOf(p);let k=!1,E=[];b.lastIndex=0;let C=b.exec(p.value);for(;C;){const O=C.index,z={index:C.index,input:C.input,stack:[...m,p]};let L=y(...C,z);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?b.lastIndex=O+1:(_!==O&&E.push({type:"text",value:p.value.slice(_,O)}),Array.isArray(L)?E.push(...L):L&&E.push(L),_=O+C[0].length,k=!0),!b.global)break;C=b.exec(p.value)}return k?(_<p.value.length&&E.push({type:"text",value:p.value.slice(_)}),x.children.splice(N,1,...E)):E=[p],N+E.length}}function r8(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([i8(a[0]),s8(a[1])])}return t}function i8(e){return typeof e=="string"?new RegExp(t8(e),"g"):e}function s8(e){return typeof e=="function"?e:function(){return e}}const Am="phrasing",Mm=["autolink","link","image","label"];function a8(){return{transforms:[h8],enter:{literalAutolink:o8,literalAutolinkEmail:Rm,literalAutolinkHttp:Rm,literalAutolinkWww:Rm},exit:{literalAutolink:f8,literalAutolinkEmail:d8,literalAutolinkHttp:c8,literalAutolinkWww:u8}}}function l8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Am,notInConstruct:Mm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Am,notInConstruct:Mm},{character:":",before:"[ps]",after:"\\/",inConstruct:Am,notInConstruct:Mm}]}}function o8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Rm(e){this.config.enter.autolinkProtocol.call(this,e)}function c8(e){this.config.exit.autolinkProtocol.call(this,e)}function u8(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 d8(e){this.config.exit.autolinkEmail.call(this,e)}function f8(e){this.exit(e)}function h8(e){n8(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,p8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),m8]],{ignore:["link","linkReference"]})}function p8(e,t,n,i,a){let o="";if(!lS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!g8(n)))return!1;const u=x8(n+i);if(!u[0])return!1;const f={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function m8(e,t,n,i){return!lS(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function g8(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 x8(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=X_(e,"(");let o=X_(e,")");for(;i!==-1&&a>o;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),o++;return[e,n]}function lS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ja(n)||kf(n))&&(!t||n!==47)}oS.peek=N8;function v8(){this.buffer()}function b8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function y8(){this.buffer()}function _8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function w8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function S8(e){this.exit(e)}function k8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function j8(e){this.exit(e)}function N8(){return"["}function oS(e,t,n,i){const a=n.createTracker(i);let o=a.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),u(),o+=a.move("]"),o}function C8(){return{enter:{gfmFootnoteCallString:v8,gfmFootnoteCall:b8,gfmFootnoteDefinitionLabelString:y8,gfmFootnoteDefinition:_8},exit:{gfmFootnoteCallString:w8,gfmFootnoteCall:S8,gfmFootnoteDefinitionLabelString:k8,gfmFootnoteDefinition:j8}}}function E8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:oS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,o,u){const f=o.createTracker(u);let h=f.move("[^");const p=o.enter("footnoteDefinition"),m=o.enter("label");return h+=f.move(o.safe(o.associationId(i),{before:h,after:"]"})),m(),h+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),h+=f.move((t?`
|
|
85
|
-
`:" ")+o.indentLines(o.containerFlow(i,f.current()),t?cS:T8))),p(),h}}function T8(e,t,n){return t===0?e:cS(e,t,n)}function cS(e,t,n){return(n?"":" ")+e}const A8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];uS.peek=z8;function M8(){return{canContainEols:["delete"],enter:{strikethrough:L8},exit:{strikethrough:D8}}}function R8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:A8}],handlers:{delete:uS}}}function L8(e){this.enter({type:"delete",children:[]},e)}function D8(e){this.exit(e)}function uS(e,t,n,i){const a=n.createTracker(i),o=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),o(),u}function z8(){return"~"}function O8(e){return e.length}function B8(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||O8,o=[],u=[],f=[],h=[];let p=0,m=-1;for(;++m<e.length;){const j=[],N=[];let k=-1;for(e[m].length>p&&(p=e[m].length);++k<e[m].length;){const E=P8(e[m][k]);if(n.alignDelimiters!==!1){const C=a(E);N[k]=C,(h[k]===void 0||C>h[k])&&(h[k]=C)}j.push(E)}u[m]=j,f[m]=N}let x=-1;if(typeof i=="object"&&"length"in i)for(;++x<p;)o[x]=K_(i[x]);else{const j=K_(i);for(;++x<p;)o[x]=j}x=-1;const b=[],y=[];for(;++x<p;){const j=o[x];let N="",k="";j===99?(N=":",k=":"):j===108?N=":":j===114&&(k=":");let E=n.alignDelimiters===!1?1:Math.max(1,h[x]-N.length-k.length);const C=N+"-".repeat(E)+k;n.alignDelimiters!==!1&&(E=N.length+E+k.length,E>h[x]&&(h[x]=E),y[x]=E),b[x]=C}u.splice(1,0,b),f.splice(1,0,y),m=-1;const _=[];for(;++m<u.length;){const j=u[m],N=f[m];x=-1;const k=[];for(;++x<p;){const E=j[x]||"";let C="",O="";if(n.alignDelimiters!==!1){const z=h[x]-(N[x]||0),L=o[x];L===114?C=" ".repeat(z):L===99?z%2?(C=" ".repeat(z/2+.5),O=" ".repeat(z/2-.5)):(C=" ".repeat(z/2),O=C):O=" ".repeat(z)}n.delimiterStart!==!1&&!x&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||x)&&k.push(" "),n.alignDelimiters!==!1&&k.push(C),k.push(E),n.alignDelimiters!==!1&&k.push(O),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||x!==p-1)&&k.push("|")}_.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return _.join(`
|
|
86
|
-
`)}function P8(e){return e==null?"":String(e)}function K_(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 $8(e,t,n,i){const a=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),F8);return a(),u}function F8(e,t,n){return">"+(n?"":" ")+e}function U8(e,t){return Z_(e,t.inConstruct,!0)&&!Z_(e,t.notInConstruct,!1)}function Z_(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function J_(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
87
|
-
`&&U8(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
88
|
-
`}function I8(e,t){const n=String(e);let i=n.indexOf(t),a=i,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++o>u&&(u=o):o=1,a=i+t.length,i=n.indexOf(t,a);return u}function H8(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 q8(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 V8(e,t,n,i){const a=q8(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(H8(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(o,G8);return x(),b}const f=n.createTracker(i),h=a.repeat(Math.max(I8(o,a)+1,3)),p=n.enter("codeFenced");let m=f.move(h);if(e.lang){const x=n.enter(`codeFencedLang${u}`);m+=f.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...f.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);m+=f.move(" "),m+=f.move(n.safe(e.meta,{before:m,after:`
|
|
89
|
-
`,encode:["`"],...f.current()})),x()}return m+=f.move(`
|
|
90
|
-
`),o&&(m+=f.move(o+`
|
|
91
|
-
`)),m+=f.move(h),p(),m}function G8(e,t,n){return(n?"":" ")+e}function Mx(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 Y8(e,t,n,i){const a=Mx(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(i);let p=h.move("[");return p+=h.move(n.safe(n.associationId(e),{before:p,after:"]",...h.current()})),p+=h.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":`
|
|
92
|
-
`,...h.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=h.move(" "+a),p+=h.move(n.safe(e.title,{before:p,after:a,...h.current()})),p+=h.move(a),f()),u(),p}function Q8(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 Lc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function mf(e,t,n){const i=Ol(e),a=Ol(t);return i===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}dS.peek=W8;function dS(e,t,n,i){const a=Q8(n),o=n.enter("emphasis"),u=n.createTracker(i),f=u.move(a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const p=h.charCodeAt(0),m=mf(i.before.charCodeAt(i.before.length-1),p,a);m.inside&&(h=Lc(p)+h.slice(1));const x=h.charCodeAt(h.length-1),b=mf(i.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+Lc(x));const y=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},f+h+y}function W8(e,t,n){return n.options.emphasis||"*"}function X8(e,t){let n=!1;return Ex(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,Og}),!!((!e.depth||e.depth<3)&&_x(e)&&(t.options.setext||n))}function K8(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(X8(e,n)){const m=n.enter("headingSetext"),x=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
|
|
93
|
-
`,after:`
|
|
94
|
-
`});return x(),m(),b+`
|
|
95
|
-
`+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
96
|
-
`))+1))}const u="#".repeat(a),f=n.enter("headingAtx"),h=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
97
|
-
`,...o.current()});return/^[\t ]/.test(p)&&(p=Lc(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),h(),f(),p}fS.peek=Z8;function fS(e){return e.value||""}function Z8(){return"<"}hS.peek=J8;function hS(e,t,n,i){const a=Mx(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(i);let p=h.move("![");return p+=h.move(n.safe(e.alt,{before:p,after:"]",...h.current()})),p+=h.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":")",...h.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=h.move(" "+a),p+=h.move(n.safe(e.title,{before:p,after:a,...h.current()})),p+=h.move(a),f()),p+=h.move(")"),u(),p}function J8(){return"!"}pS.peek=e7;function pS(e,t,n,i){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("![");const p=n.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function e7(){return"!"}mS.peek=t7;function mS(e,t,n){let i=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const u=n.unsafe[o],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(i);){let p=h.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(h.index+1)}}return a+i+a}function t7(){return"`"}function gS(e,t){const n=_x(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))}xS.peek=n7;function xS(e,t,n,i){const a=Mx(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let f,h;if(gS(e,n)){const m=n.stack;n.stack=[],f=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),f(),n.stack=m,x}f=n.enter("link"),h=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(h=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),h()),p+=u.move(")"),f(),p}function n7(e,t,n){return gS(e,n)?"<":"["}vS.peek=r7;function vS(e,t,n,i){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("[");const p=n.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function r7(){return"["}function Rx(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 i7(e){const t=Rx(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 s7(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 bS(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 a7(e,t,n,i){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?s7(n):Rx(n);const f=e.ordered?u==="."?")":".":i7(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&m&&(!m.children||!m.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),bS(n)===u&&m){let x=-1;for(;++x<e.children.length;){const b=e.children[x];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const p=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function l7(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 o7(e,t,n,i){const a=l7(n);let o=n.bulletCurrent||Rx(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(i);f.move(o+" ".repeat(u-o.length)),f.shift(u);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,f.current()),m);return h(),p;function m(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?o:o+" ".repeat(u-o.length))+x}}function c7(e,t,n,i){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),a(),u}const u7=Cf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function d7(e,t,n,i){return(e.children.some(function(u){return u7(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function f7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}yS.peek=h7;function yS(e,t,n,i){const a=f7(n),o=n.enter("strong"),u=n.createTracker(i),f=u.move(a+a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const p=h.charCodeAt(0),m=mf(i.before.charCodeAt(i.before.length-1),p,a);m.inside&&(h=Lc(p)+h.slice(1));const x=h.charCodeAt(h.length-1),b=mf(i.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+Lc(x));const y=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},f+h+y}function h7(e,t,n){return n.options.strong||"*"}function p7(e,t,n,i){return n.safe(e.value,i)}function m7(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 g7(e,t,n){const i=(bS(n)+(n.options.ruleSpaces?" ":"")).repeat(m7(n));return n.options.ruleSpaces?i.slice(0,-1):i}const _S={blockquote:$8,break:J_,code:V8,definition:Y8,emphasis:dS,hardBreak:J_,heading:K8,html:fS,image:hS,imageReference:pS,inlineCode:mS,link:xS,linkReference:vS,list:a7,listItem:o7,paragraph:c7,root:d7,strong:yS,text:p7,thematicBreak:g7};function x7(){return{enter:{table:v7,tableData:e5,tableHeader:e5,tableRow:y7},exit:{codeText:_7,table:b7,tableData:Lm,tableHeader:Lm,tableRow:Lm}}}function v7(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 b7(e){this.exit(e),this.data.inTable=void 0}function y7(e){this.enter({type:"tableRow",children:[]},e)}function Lm(e){this.exit(e)}function e5(e){this.enter({type:"tableCell",children:[]},e)}function _7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,w7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function w7(e,t){return t==="|"?t:e}function S7(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
98
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:u,tableCell:h,tableRow:f}};function u(y,_,j,N){return p(m(y,j,N),y.align)}function f(y,_,j,N){const k=x(y,j,N),E=p([k]);return E.slice(0,E.indexOf(`
|
|
99
|
-
`))}function h(y,_,j,N){const k=j.enter("tableCell"),E=j.enter("phrasing"),C=j.containerPhrasing(y,{...N,before:o,after:o});return E(),k(),C}function p(y,_){return B8(y,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function m(y,_,j){const N=y.children;let k=-1;const E=[],C=_.enter("table");for(;++k<N.length;)E[k]=x(N[k],_,j);return C(),E}function x(y,_,j){const N=y.children;let k=-1;const E=[],C=_.enter("tableRow");for(;++k<N.length;)E[k]=h(N[k],y,_,j);return C(),E}function b(y,_,j){let N=_S.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function k7(){return{exit:{taskListCheckValueChecked:t5,taskListCheckValueUnchecked:t5,paragraph:N7}}}function j7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:C7}}}function t5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function N7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){u=f;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function C7(e,t,n,i){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(i);o&&f.move(u);let h=_S.listItem(e,t,n,{...i,...f.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(m){return m+u}}function E7(){return[a8(),C8(),M8(),x7(),k7()]}function T7(e){return{extensions:[l8(),E8(e),R8(),S7(e),j7()]}}const A7={tokenize:O7,partial:!0},wS={tokenize:B7,partial:!0},SS={tokenize:P7,partial:!0},kS={tokenize:$7,partial:!0},M7={tokenize:F7,partial:!0},jS={name:"wwwAutolink",tokenize:D7,previous:CS},NS={name:"protocolAutolink",tokenize:z7,previous:ES},Gi={name:"emailAutolink",tokenize:L7,previous:TS},hi={};function R7(){return{text:hi}}let da=48;for(;da<123;)hi[da]=Gi,da++,da===58?da=65:da===91&&(da=97);hi[43]=Gi;hi[45]=Gi;hi[46]=Gi;hi[95]=Gi;hi[72]=[Gi,NS];hi[104]=[Gi,NS];hi[87]=[Gi,jS];hi[119]=[Gi,jS];function L7(e,t,n){const i=this;let a,o;return u;function u(x){return!Fg(x)||!TS.call(i,i.previous)||Lx(i.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(x))}function f(x){return Fg(x)?(e.consume(x),f):x===64?(e.consume(x),h):n(x)}function h(x){return x===46?e.check(M7,m,p)(x):x===45||x===95||Ln(x)?(o=!0,e.consume(x),h):m(x)}function p(x){return e.consume(x),a=!0,h}function m(x){return o&&a&&In(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function D7(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!CS.call(i,i.previous)||Lx(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(A7,e.attempt(wS,e.attempt(SS,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function z7(e,t,n){const i=this;let a="",o=!1;return u;function u(x){return(x===72||x===104)&&ES.call(i,i.previous)&&!Lx(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),f):n(x)}function f(x){if(In(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),f;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),h}return n(x)}function h(x){return x===47?(e.consume(x),o?p:(o=!0,h)):n(x)}function p(x){return x===null||ff(x)||Pt(x)||ja(x)||kf(x)?n(x):e.attempt(wS,e.attempt(SS,m),n)(x)}function m(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function O7(e,t,n){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function B7(e,t,n){let i,a,o;return u;function u(p){return p===46||p===95?e.check(kS,h,f)(p):p===null||Pt(p)||ja(p)||p!==45&&kf(p)?h(p):(o=!0,e.consume(p),u)}function f(p){return p===95?i=!0:(a=i,i=void 0),e.consume(p),u}function h(p){return a||i||!o?n(p):t(p)}}function P7(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(kS,t,o)(u):u===null||Pt(u)||ja(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&i++,e.consume(u),a}}function $7(e,t,n){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||Pt(f)||ja(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Pt(f)||ja(f)?t(f):i(f)}function o(f){return In(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),i):In(f)?(e.consume(f),u):n(f)}}function F7(e,t,n){return i;function i(o){return e.consume(o),a}function a(o){return Ln(o)?n(o):t(o)}}function CS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function ES(e){return!In(e)}function TS(e){return!(e===47||Fg(e))}function Fg(e){return e===43||e===45||e===46||e===95||Ln(e)}function Lx(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const U7={tokenize:W7,partial:!0};function I7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:G7,continuation:{tokenize:Y7},exit:Q7}},text:{91:{name:"gfmFootnoteCall",tokenize:V7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:H7,resolveTo:q7}}}}function H7(e,t,n){const i=this;let a=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const h=i.events[a][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return f;function f(h){if(!u||!u._balanced)return n(h);const p=Qr(i.sliceSerialize({start:u.end,end:i.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function q7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...f),e}function V7(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,u;return f;function f(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),h}function h(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(x){if(o>999||x===93&&!u||x===null||x===91||Pt(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(Qr(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return Pt(x)||(u=!0),o++,e.consume(x),x===92?m:p}function m(x){return x===91||x===92||x===93?(e.consume(x),o++,p):p(x)}}function G7(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,u=0,f;return h;function h(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(_)}function m(_){if(u>999||_===93&&!f||_===null||_===91||Pt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=Qr(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Pt(_)||(f=!0),u++,e.consume(_),_===92?x:m}function x(_){return _===91||_===92||_===93?(e.consume(_),u++,m):m(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(o)||a.push(o),mt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function Y7(e,t,n){return e.check(Pc,t,e.attempt(U7,t,n))}function Q7(e){e.exit("gfmFootnoteDefinition")}function W7(e,t,n){const i=this;return mt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function X7(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,f){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let p=h;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[h][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[h][1].end)},x={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[h][1].start)},b=[["enter",m,f],["enter",u[p][1],f],["exit",u[p][1],f],["enter",x,f]],y=f.parser.constructs.insideSpan.null;y&&br(b,b.length,0,jf(y,u.slice(p+1,h),f)),br(b,b.length,0,[["exit",x,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",m,f]]),br(u,p-1,h-p+3,b),h=p+b.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function o(u,f,h){const p=this.previous,m=this.events;let x=0;return b;function b(_){return p===126&&m[m.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=Ol(p);if(_===126)return x>1?h(_):(u.consume(_),x++,y);if(x<2&&!n)return h(_);const N=u.exit("strikethroughSequenceTemporary"),k=Ol(_);return N._open=!k||k===2&&!!j,N._close=!j||j===2&&!!k,f(_)}}}class K7{constructor(){this.map=[]}add(t,n,i){Z7(this,t,n,i)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0}}function Z7(e,t,n,i){let a=0;if(!(n===0&&i.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...i);return}a+=1}e.map.push([t,n,i])}}function J7(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=i.length-1;i[o]=i[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function eR(){return{flow:{null:{name:"table",tokenize:tR,resolveAll:nR}}}}function tR(e,t,n){const i=this;let a=0,o=0,u;return f;function f(D){let I=i.events.length-1;for(;I>-1;){const Z=i.events[I][1].type;if(Z==="lineEnding"||Z==="linePrefix")I--;else break}const A=I>-1?i.events[I][1].type:null,se=A==="tableHead"||A==="tableRow"?L:h;return se===L&&i.parser.lazy[i.now().line]?n(D):se(D)}function h(D){return e.enter("tableHead"),e.enter("tableRow"),p(D)}function p(D){return D===124||(u=!0,o+=1),m(D)}function m(D){return D===null?n(D):Fe(D)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),y):n(D):ot(D)?mt(e,m,"whitespace")(D):(o+=1,u&&(u=!1,a+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),x(D)))}function x(D){return D===null||D===124||Pt(D)?(e.exit("data"),m(D)):(e.consume(D),D===92?b:x)}function b(D){return D===92||D===124?(e.consume(D),x):x(D)}function y(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(D):(e.enter("tableDelimiterRow"),u=!1,ot(D)?mt(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):_(D))}function _(D){return D===45||D===58?N(D):D===124?(u=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),j):z(D)}function j(D){return ot(D)?mt(e,N,"whitespace")(D):N(D)}function N(D){return D===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),k):D===45?(o+=1,k(D)):D===null||Fe(D)?O(D):z(D)}function k(D){return D===45?(e.enter("tableDelimiterFiller"),E(D)):z(D)}function E(D){return D===45?(e.consume(D),E):D===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(D))}function C(D){return ot(D)?mt(e,O,"whitespace")(D):O(D)}function O(D){return D===124?_(D):D===null||Fe(D)?!u||a!==o?z(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):z(D)}function z(D){return n(D)}function L(D){return e.enter("tableRow"),V(D)}function V(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),V):D===null||Fe(D)?(e.exit("tableRow"),t(D)):ot(D)?mt(e,V,"whitespace")(D):(e.enter("data"),F(D))}function F(D){return D===null||D===124||Pt(D)?(e.exit("data"),V(D)):(e.consume(D),D===92?Q:F)}function Q(D){return D===92||D===124?(e.consume(D),F):F(D)}}function nR(e,t){let n=-1,i=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,p,m,x;const b=new K7;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(n5(b,t,h,p,m),m=void 0,h=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,x=void 0,o=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,m={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",m,t]])),a=_.type==="tableDelimiterRow"?2:m?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],x=wd(b,t,o,a,void 0,x),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(o[1]!==0&&(u[0]=u[1],x=wd(b,t,o,a,void 0,x)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,o[1]!==0?(u[0]=u[1],x=wd(b,t,o,a,n,x)):u[1]!==0&&(x=wd(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&n5(b,t,h,p,m),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=J7(t.events,n))}return e}function wd(e,t,n,i,a,o){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Sl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=Sl(t.events,n[1]);if(o={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=Sl(t.events,n[2]),m=Sl(t.events,n[3]),x={type:f,start:Object.assign({},p),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",x,t]]),i!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return a!==void 0&&(o.end=Object.assign({},Sl(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function n5(e,t,n,i,a){const o=[],u=Sl(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),i.end=Object.assign({},u),o.push(["exit",i,t]),e.add(n+1,0,o)}function Sl(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const rR={name:"tasklistCheck",tokenize:sR};function iR(){return{text:{91:rR}}}function sR(e,t,n){const i=this;return a;function a(h){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),o)}function o(h){return Pt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(h)}function f(h){return Fe(h)?t(h):ot(h)?e.check({tokenize:aR},t,n)(h):n(h)}}function aR(e,t,n){return mt(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function lR(e){return $2([R7(),I7(),X7(e),eR(),iR()])}const oR={};function Dx(e){const t=this,n=e||oR,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(lR(n)),o.push(E7()),u.push(T7(n))}const cR=1500;async function uR(e){var i;try{if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function zx({text:e,label:t="Copy",className:n=""}){const[i,a]=S.useState(!1),o=S.useRef(null);S.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await uR(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),cR))},f=i?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":f,title:f,className:`inline-flex items-center justify-center w-6 h-6 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors ${n}`,children:i?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":"true",children:[l.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),l.jsx("path",{d:"M10.5 5V3.75A.75.75 0 009.75 3H3.75A.75.75 0 003 3.75v6a.75.75 0 00.75.75H5"})]})})}const gf=25*1024*1024,xf=100*1024*1024;function AS(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const o=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function Es(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 MS(e){return e.startsWith("image/")}function RS({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let i="FILE";return t==="application/pdf"||n==="pdf"?i="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?i="ZIP":["csv","tsv"].includes(n)?i="CSV":["json","yaml","yml","toml","xml"].includes(n)?i="DATA":["md","txt","log"].includes(n)?i="TXT":["doc","docx","rtf","odt"].includes(n)?i="DOC":["xls","xlsx","ods"].includes(n)?i="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?i="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?i="VID":n&&(i=n.slice(0,4).toUpperCase()),l.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[l.jsx("path",{d:"M3 1.75h6.5L13 5.25v9A1.25 1.25 0 0 1 11.75 15.5h-7.5A1.25 1.25 0 0 1 3 14.25V1.75z"}),l.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),l.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:i})]})}function LS({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:o="w-12 h-12"}){const u=MS(t);return l.jsxs("div",{className:"relative group",title:`${e} (${Es(i)})`,children:[l.jsx("div",{className:`${o} rounded-lg overflow-hidden border border-cc-border`,children:u?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):l.jsx(RS,{name:e,mediaType:t})}),a&&l.jsx("button",{onClick:a,"aria-label":`Remove ${e}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-cc-error text-white flex items-center justify-center text-[10px] opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function dR({name:e,mediaType:t,data:n,size:i}){return MS(t)?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e||"attachment",className:"max-w-[150px] sm:max-w-[200px] max-h-[120px] sm:max-h-[150px] rounded-xl object-cover border border-cc-border/30"}):l.jsxs("a",{href:`data:${t};base64,${n}`,download:e||"attachment",className:"inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-cc-border/40 bg-cc-hover/40 hover:bg-cc-hover transition-colors max-w-[260px] no-underline",children:[l.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:l.jsx(RS,{name:e,mediaType:t})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:Es(i)})]})]})}function Ug(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Ug).join(""):typeof e=="object"&&e!==null&&"props"in e?Ug((t=e.props)==null?void 0:t.children):""}function fR({message:e}){return e.role==="system"?l.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-0",children:[l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),l.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):e.role==="user"?l.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] px-3.5 sm:px-4 py-2.5 rounded-[16px] rounded-br-[6px] user-bubble-gradient text-cc-fg shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:[e.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>l.jsx(dR,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),l.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:l.jsx(Ox,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(xR,{message:e})})}function hR(e){const t=[];for(const n of e)if(n.type==="tool_use"){const i=t[t.length-1];(i==null?void 0:i.kind)==="tool_group"&&i.name===n.name?i.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function pR(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 mR(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function gR({streaming:e}){return l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 py-0.5 text-[11px] text-cc-muted/50 italic",children:[l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full bg-cc-muted/40 shrink-0 ${e?"animate-pulse":""}`}),l.jsx("span",{children:e?"Thinking…":"Thought"})]})}function xR({message:e}){var u;const t=e.contentBlocks||[],n=Pl(),i=S.useMemo(()=>hR(t),[t]),a=S.useMemo(()=>pR(t),[t]),o=S.useMemo(()=>n?i.filter(f=>!mR(f)):i,[i,n]);if(n&&o.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Dm,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(gR,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const f=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Dm,{}),l.jsx("div",{className:"flex-1 min-w-0",children:f?l.jsx(zS,{text:e.content}):l.jsx(Ox,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Dm,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((f,h)=>{if(f.kind==="content")return l.jsx(vR,{block:f.block,toolUseById:a},h);if(f.items.length===1){const p=f.items[0];return l.jsx(R5,{name:p.name,input:p.input,toolUseId:p.id},h)}return l.jsx(_R,{name:f.name,items:f.items},h)})})]})}function Dm(){return l.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function Ox({text:e,showCursor:t=!1}){return l.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[l.jsx(Ax,{remarkPlugins:[Dx],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof i=="string"&&i.includes(`
|
|
100
|
-
`)){const f=(o==null?void 0:o[1])||"",h=Ug(i);return l.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),f&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),l.jsx(zx,{text:h,label:"Copy code",className:"ml-auto -mr-1"})]}),l.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:l.jsx("code",{children:i})})]})}return l.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-[12.5px] font-mono-code text-cc-fg/80 border border-cc-border/40",children:i})},pre:({children:n})=>l.jsx(l.Fragment,{children:n}),table:({children:n})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>l.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>l.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>l.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&l.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function vR({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(Ox,{text:e.text});if(e.type==="thinking")return l.jsx(zS,{text:e.thinking});if(e.type==="tool_use")return l.jsx(R5,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),a=i==null?void 0:i.name,o=e.is_error??!1;return a==="Bash"?l.jsx(bR,{text:n,isError:o}):l.jsx(yR,{content:n,isError:o})}return null}function DS(e){return`${e} ${e===1?"line":"lines"}`}function bR({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,o]=S.useState(!1),u=Pl(),[f,h]=S.useState(!1),p=a||!i?e:n.slice(-20).join(`
|
|
101
|
-
`),m=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(zx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:p}),i&&l.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[l.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:a?`${n.length} lines`:`last 20 of ${n.length}`}),l.jsx("button",{onClick:()=>o(!a),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:a?"Show tail":"Show all"})]})]});return u?l.jsxs("div",{children:[l.jsx(bf,{open:f,onToggle:()=>h(!f),marker:"›",label:t?"Error output":"Output",meta:DS(n.length),labelClassName:t?"text-cc-error/70":""}),f&&l.jsx("div",{className:"mt-1",children:m})]}):m}function yR({content:e,isError:t}){const n=Pl(),[i,a]=S.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(zx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:e})]});return n?l.jsxs("div",{children:[l.jsx(bf,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:DS(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:o})]}):o}function _R({name:e,items:t}){const[n,i]=S.useState(!1),a=Dc(e),o=Ts(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(El,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:o}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=_c(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function zS({text:e}){const t=e.trim(),n=Pl(),[i,a]=S.useState(!1),o=t.split(`
|
|
102
|
-
`),u=n?2:8,f=n?200:600,h=o.length>u||t.length>f,p=h&&!i?o.slice(0,u).join(`
|
|
103
|
-
`):t;return n&&!t?null:l.jsxs("div",{children:[l.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:l.jsx(Ax,{remarkPlugins:[Dx],components:{p:({children:m})=>l.jsx("p",{className:"mb-2 last:mb-0",children:m}),ul:({children:m})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:m}),ol:({children:m})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:m}),li:({children:m})=>l.jsx("li",{children:m}),code:({children:m})=>l.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:m})},children:p||"No thinking text captured."})}),h&&!i&&l.jsx("button",{onClick:()=>a(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function oc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Jo(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function r5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":wR(t):"N/A"}catch{return"N/A"}}function Ig(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function i5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function wR(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function SR({tools:e}){return e.length===0?null:l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[l.jsx(El,{type:Dc(t.toolName)}),l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),l.jsx("span",{className:"text-cc-fg/70",children:Ts(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function kR({entries:e}){const[t,n]=S.useState(!1),i=S.useMemo(()=>{const a=e.reduce((h,p)=>h+p.elapsedSeconds,0),o=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:f}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${Ts(a.toolName)} ${a.elapsedSeconds}s`},a.toolUseId))})]}),t&&l.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(a=>l.jsx(jR,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function jR({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[l.jsx(El,{type:Dc(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Ts(e.toolName)})]}),l.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:l.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const Sd=100,NR=40,CR=120,s5=1e4,ER=15*6e4,zm=new Map,TR=[],AR=[];function MR(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function RR(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function a5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function LR(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 OS(e){const t=[];for(const n of e){const i=RR(n);if(i){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===i){a.items.push(...a5(n));continue}t.push({kind:"tool_msg_group",toolName:i,items:a5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function BS(e,t,n){const i=OS(e),a=[];for(const o of i){a.push(o);const u=LR(o);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},m=BS(h,t,n);a.push({kind:"subagent",taskToolUseId:f,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:m})}}}return a}function DR(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const o of a.contentBlocks)if(o.type==="tool_use"&&o.name==="Task"){const{input:u,id:f}=o,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,p=h&&h.length>0?h.length:void 0,m=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,x=typeof(u==null?void 0:u.codex_status)=="string"||m!==void 0||p!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:x?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:m,receiverThreadIds:h})}}if(t.size===0)return OS(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let o=n.get(a.parentToolUseId);o||(o=[],n.set(a.parentToolUseId,o)),o.push(a)}else i.push(a);return BS(i,t,n)}function zR({group:e}){const[t,n]=S.useState(!1),i=Dc(e.toolName),a=Ts(e.toolName),o=e.items.length;if(o===1){const u=e.items[0];return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(l5,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(El,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:_c(u.name,u.input)})]}),t&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:l.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(l5,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(El,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:o})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=_c(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function PS({entries:e,toolActivity:t}){return l.jsx(l.Fragment,{children:e.map((n,i)=>{if(n.kind==="tool_msg_group")return l.jsx(zR,{group:n},n.firstId||i);if(n.kind==="subagent")return l.jsx(PR,{group:n},n.taskToolUseId);const a=n.msg,o=OR(a),u=t&&o.length>0?t.filter(h=>o.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return l.jsxs("div",{children:[l.jsx(fR,{message:a}),f&&l.jsx(kR,{entries:u})]},a.id)})})}function OR(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function BR(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 PR({group:e}){const[t,n]=S.useState(!1),i=e.description||"Subagent",a=e.agentType,o=e.children.length,u=BR(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],m=e.backend||"claude",x=e.children[e.children.length-1],b=S.useMemo(()=>{var y,_;if(!x)return"";if(x.kind==="tool_msg_group")return`${Ts(x.toolName)}${x.items.length>1?` ×${x.items.length}`:""}`;if(x.kind==="message"&&x.msg.role==="assistant"){const j=(y=x.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const N=(_=x.msg.contentBlocks)==null?void 0:_.find(k=>k.type==="tool_use");if(N)return Ts(N.name)}return""},[x]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:m==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&b&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:b}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:o})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&l.jsxs("span",{children:["receivers: ",p.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(PS,{entries:e.children})]})]})})}function l5(){return l.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function $R({sessionId:e}){var Nt;const t=Y(ve=>ve.messages.get(e)??TR),n=Y(ve=>(ve.sdkSessions||AR).find($e=>$e.sessionId===e)),i=Y(ve=>ve.streamingStartedAt.get(e)),a=Y(ve=>ve.streamingOutputTokens.get(e)),o=Y(ve=>ve.sessionStatus.get(e)),u=Y(ve=>ve.lastActivityAt.get(e)),f=Y(ve=>ve.sessionProcesses.get(e)),h=Y(ve=>ve.toolProgress.get(e)),p=Y(ve=>ve.toolActivity.get(e)),m=S.useRef(null),x=S.useRef(null),b=S.useRef(!0),[y,_]=S.useState(0),[j,N]=S.useState(Sd),[k,E]=S.useState([]),[C,O]=S.useState(0),[z,L]=S.useState(!1),[V,F]=S.useState(!1),[Q,D]=S.useState(!1),[I,A]=S.useState(""),se=S.useRef(new Set),Z=Y(ve=>ve.chatTabReentryTickBySession.get(e)??0),G=S.useMemo(()=>t.some(ve=>ve.role==="assistant"&&ve.isStreaming),[t]),P=S.useMemo(()=>(f??[]).filter(ve=>ve.status==="running"),[f]),$=P.length>0,ie=S.useMemo(()=>{const ve=p??[];for(let $e=ve.length-1;$e>=0;$e--)if(!ve[$e].completedAt)return ve[$e]},[p]),ae=S.useMemo(()=>P.length>0?Math.min(...P.map(ve=>ve.startedAt)):null,[P]),R=S.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),B=R.length>0,K=n!=null&&n.forkSession?"Forked from":"Continuing from",M=S.useMemo(()=>{if(k.length===0)return t;const ve=[],$e=new Set;for(const nt of k)$e.has(nt.id)||($e.add(nt.id),ve.push(nt));for(const nt of t)$e.has(nt.id)||($e.add(nt.id),ve.push(nt));return ve},[k,t]),pe=S.useMemo(()=>DR(M),[M]);S.useEffect(()=>{N(Sd),E([]),O(0),L(!1),F(!1),D(!1),A(""),se.current=new Set},[e,R]);const _e=pe.length,Ce=_e>j,De=Ce?pe.slice(_e-j):pe,Ee=_e-De.length,Be=S.useCallback(()=>{const ve=x.current,$e=(ve==null?void 0:ve.scrollHeight)??0;N(nt=>nt+Sd),requestAnimationFrame(()=>{if(ve){const nt=ve.scrollHeight;ve.scrollTop+=nt-$e}})},[]),Je=S.useCallback(async(ve={})=>{if(!B||!R||Q)return;const $e=x.current,nt=($e==null?void 0:$e.scrollHeight)??0,nn=V?C:0;D(!0),A("");try{const je=await Ne.getClaudeSessionHistory(R,{cursor:nn,limit:NR}),ze=je.messages.map(Te=>({id:Te.id,role:Te.role,content:Te.content,contentBlocks:Te.role==="assistant"?Te.contentBlocks:void 0,timestamp:Te.timestamp||Date.now(),model:Te.role==="assistant"?Te.model:void 0,stopReason:Te.role==="assistant"?Te.stopReason:void 0})),ht=[];for(const Te of ze)se.current.has(Te.id)||(se.current.add(Te.id),ht.push(Te));E(Te=>[...ht,...Te]),O(je.nextCursor),L(je.hasMore),F(!0),ht.length>0&&N(Te=>Te+ht.length),ve.preserveScroll!==!1&&$e&&requestAnimationFrame(()=>{const Te=$e.scrollHeight;$e.scrollTop+=Te-nt})}catch(je){const ze=je instanceof Error?je.message:String(je);A(ze||"Failed to load previous history"),V||(E([]),O(0),L(!1))}finally{D(!1)}},[B,R,Q,V,C]);S.useEffect(()=>{if(!i&&o!=="running"&&!$){_(0);return}const ve=i||Date.now();_(Date.now()-ve);const $e=setInterval(()=>_(Date.now()-ve),1e3);return()=>clearInterval($e)},[i,o,$]);function jt(){const ve=x.current;if(!ve)return;b.current=ve.scrollHeight-ve.scrollTop-ve.clientHeight<120;const $e=Math.max(0,ve.scrollHeight-ve.clientHeight-ve.scrollTop);zm.set(e,$e),B&&V&&z&&!Q&&ve.scrollTop<=CR&&Je({preserveScroll:!0})}const dt=S.useCallback(()=>{const ve=x.current;if(!ve)return;const $e=ve.style.scrollBehavior;ve.style.scrollBehavior="auto",ve.scrollTop=ve.scrollHeight,ve.style.scrollBehavior=$e},[]),gt=S.useCallback(()=>{const ve=x.current;if(!ve)return;const $e=ve.style.scrollBehavior;ve.style.scrollBehavior="auto";const nt=zm.get(e);typeof nt=="number"?ve.scrollTop=Math.max(0,ve.scrollHeight-ve.clientHeight-nt):ve.scrollTop=ve.scrollHeight,ve.style.scrollBehavior=$e},[e]);if(S.useEffect(()=>{requestAnimationFrame(()=>gt())},[e,gt]),S.useEffect(()=>()=>{const ve=x.current;if(!ve)return;const $e=Math.max(0,ve.scrollHeight-ve.clientHeight-ve.scrollTop);zm.set(e,$e)},[e]),S.useEffect(()=>{Z&&requestAnimationFrame(()=>dt())},[Z,dt]),S.useEffect(()=>{var ve;b.current&&((ve=m.current)==null||ve.scrollIntoView({behavior:"smooth"}))},[t]),M.length===0)return l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[l.jsx("polyline",{points:"4 17 10 11 4 5"}),l.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),l.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),l.jsx("div",{className:"text-center max-w-xs",children:B?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),l.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[K," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:R.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void Je({preserveScroll:!1}),disabled:Q,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),Q?"Loading...":"Load previous history"]}),I&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const xt=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,_t=$&&(o!=="running"||xt>=s5)?"background":xt>=ER&&!ie?"stalled":xt>=s5?"quiet":"active";return l.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[l.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),l.jsx("div",{ref:x,onScroll:jt,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:l.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[B&&!V&&l.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[K," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[R," ",n!=null&&n.cwd?`· ${MR(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Je({preserveScroll:!0}),disabled:Q,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:Q?"Loading...":"Load previous history"})]}),I&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}),B&&V&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:z?Q?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),Ce&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Be,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(Sd,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(PS,{entries:De,toolActivity:p}),h&&h.size>0&&!G&&l.jsx(SR,{tools:Array.from(h.values())}),o==="compacting"&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),l.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),l.jsx("span",{children:"Compacting context..."})]}),(o==="running"||$)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":_t,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${_t==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${_t==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),_t==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:P.length===1?"Background process running":`${P.length} background processes running`}),ae!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:Jo(Math.max(0,Date.now()-ae))})]}),((Nt=P[0])==null?void 0:Nt.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:P[0].description})]})]}):_t==="stalled"?l.jsxs("span",{children:["No activity for ",Jo(xt)," — the agent may be stuck"]}):_t==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:ie?`Running ${ie.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:ie?Jo(Math.max(0,Date.now()-ie.startedAt)):`no update for ${Jo(xt)}`}),(ie==null?void 0:ie.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:ie.preview})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:Jo(y)}),(a??0)>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsxs("span",{className:"tabular-nums",children:[oc(a)," tokens"]})]})]})]}),l.jsx("div",{ref:m})]})})]})}const FR={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function UR(e,t){for(const[i,a]of Object.entries(FR))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function IR(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:UR(t.value,n)}))}const $S=[{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],FS=[{value:"gpt-5.5",label:"GPT-5.5",icon:"■"},{value:"gpt-5.4",label:"GPT-5.4",icon:"✳"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini",icon:"⚡"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],Bx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],Px=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],HR=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],US=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],IS=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function HS(e){return e==="codex"?FS:$S}function o5(e){return e==="codex"?Px:Bx}function az(e){return e==="codex"?IS:US}function c5(e){return e==="codex"?FS[0].value:$S[0].value}function u5(e){return e==="codex"?Px[0].value:Bx[0].value}function lz(e){return e==="codex"?IS[0].value:US[0].value}function qR(e){return e==="codex"?[]:HR}function d5({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=Y(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=Y(b=>b.sessions.get(e)),u=Y(b=>b.cliConnected.get(e)??!1),f=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",h=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=HS(f),m=p.find(b=>b.value===h)||(h?{label:h,icon:"?"}:null),x=S.useCallback(b=>{if(n(!1),b===h)return;Cn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=Y.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,h]);return S.useEffect(()=>{if(!t)return;const b=y=>{i.current&&!i.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),S.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),f==="codex"||!u||!m?null:l.jsxs("div",{ref:i,className:"relative shrink-0",children:[l.jsxs("button",{onClick:()=>n(b=>!b),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${m.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[m.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:m.icon}),l.jsx("span",{children:m.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(b=>l.jsxs("button",{onClick:()=>x(b.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${b.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":b.value===h,children:[b.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:b.icon}),l.jsx("span",{className:"flex-1 text-left",children:b.label}),b.value===h&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},b.value))})]})}function qS({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:o,className:u=""}){return e?l.jsx("div",{ref:o,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>l.jsxs("button",{"data-prompt-index":h,onClick:()=>a(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function VS({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,o]=S.useState(!1),[u,f]=S.useState(0),[h,p]=S.useState([]),[m,x]=S.useState(!1),b=S.useRef(null),y=S.useCallback(async()=>{x(!0);try{const k=await Ne.listPrompts(n);p(k.filter(E=>!!E.name.trim()))}catch{p([])}finally{x(!1)}},[n]);S.useEffect(()=>{y()},[y]);const _=S.useMemo(()=>{const k=e.slice(0,t),E=k.match(/(^|\s)@([^\s@]*)$/);if(!E||E.index===void 0)return null;const C=k.length-E[0].length+E[1].length;return{query:E[2]||"",start:C,end:t}},[e,t]),j=S.useMemo(()=>{if(!a||!_)return[];const k=_.query.toLowerCase();if(!k)return h;const E=h.filter(O=>O.name.toLowerCase().startsWith(k)),C=h.filter(O=>!O.name.toLowerCase().startsWith(k)&&O.name.toLowerCase().includes(k));return[...E,...C]},[a,_,h]);S.useEffect(()=>{const k=i&&!!_;k&&!a?(o(!0),f(0)):!k&&a&&o(!1)},[i,_,a]),S.useEffect(()=>{u>=j.length&&f(Math.max(0,j.length-1))},[j.length,u]),S.useEffect(()=>{if(!b.current||!a)return;const E=b.current.querySelectorAll("[data-prompt-index]")[u];E&&E.scrollIntoView({block:"nearest"})},[u,a]);const N=S.useCallback(k=>{if(!_)return{nextText:e,nextCursor:t};const E=`${k.content} `,C=`${e.slice(0,_.start)}${E}${e.slice(_.end)}`,O=_.start+E.length;return{nextText:C,nextCursor:O}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:j,promptsLoading:m,savedPrompts:h,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const VR=[];function f5({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",f=o?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",h=o?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?f:h:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:i})]})}function kd({onClick:e,disabled:t,active:n,title:i,children:a}){return l.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:a})}function h5(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}function p5({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",f=o?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?f:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function GR({sessionId:e}){var oe,we;const[t,n]=S.useState(""),[i,a]=S.useState([]),[o,u]=S.useState(null),[f,h]=S.useState(!1),[p,m]=S.useState(!1),[x,b]=S.useState(0),[y,_]=S.useState(!1),[j,N]=S.useState(""),[k,E]=S.useState("global"),[C,O]=S.useState(null),[z,L]=S.useState(0),V=S.useRef(null),F=S.useRef(null),Q=S.useRef(null),D=S.useRef(null),I=Y(W=>W.cliConnected),A=Y(W=>W.sessions.get(e)),se=Y(W=>W.previousPermissionMode.get(e)||"acceptEdits"),Z=I.get(e)??!1,G=(A==null?void 0:A.permissionMode)||"acceptEdits",P=G==="plan",$=(A==null?void 0:A.backend_type)==="codex",ae=((we=(oe=($?Px:Bx).find(W=>W.value===G))==null?void 0:oe.label)==null?void 0:we.toLowerCase())||G,R=VS({text:t,caretPos:z,cwd:A==null?void 0:A.cwd,enabled:!p}),B=S.useMemo(()=>{const W=[];if(A!=null&&A.slash_commands)for(const me of A.slash_commands)W.push({name:me,type:"command"});if(A!=null&&A.skills)for(const me of A.skills)W.push({name:me,type:"skill"});return W},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),K=S.useMemo(()=>{if(!p)return[];const W=t.match(/^\/(\S*)$/);if(!W)return[];const me=W[1].toLowerCase();return me===""?B:B.filter(Re=>Re.name.toLowerCase().includes(me))},[t,p,B]);S.useEffect(()=>{const W=t.startsWith("/")&&/^\/\S*$/.test(t)&&B.length>0;W&&!p?(m(!0),b(0)):!W&&p&&m(!1)},[t,B.length,p]),S.useEffect(()=>{x>=K.length&&b(Math.max(0,K.length-1))},[K.length,x]),S.useEffect(()=>{if(!Q.current||!p)return;const me=Q.current.querySelectorAll("[data-cmd-index]")[x];me&&me.scrollIntoView({block:"nearest"})},[x,p]),S.useEffect(()=>{if(D.current===null||!V.current)return;const W=D.current;V.current.setSelectionRange(W,W),D.current=null},[t]);const M=S.useCallback(W=>{var me;n(`/${W.name} `),m(!1),(me=V.current)==null||me.focus()},[]),pe=S.useCallback(W=>{var Re;const me=R.selectPrompt(W);D.current=me.nextCursor,n(me.nextText),R.setMentionMenuOpen(!1),L(me.nextCursor),(Re=V.current)==null||Re.focus(),V.current&&(V.current.style.height="auto",V.current.style.height=Math.min(V.current.scrollHeight,200)+"px")},[R]);function _e(){var rt;const W=t.trim();if(!W||!Z)return;const me=Hm(),Re=i.length>0?i.map(it=>({name:it.name,media_type:it.mediaType,data:it.base64,size:it.size})):void 0;Cn(e,{type:"user_message",content:W,session_id:e,attachments:Re,client_msg_id:me});const We=Y.getState();We.appendMessage(e,{id:me,role:"user",content:W,attachments:Re,timestamp:Date.now()}),We.setSessionStatus(e,"running"),We.setLastActivity(e,Date.now()),We.streamingStartedAt.has(e)||We.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),m(!1),R.setMentionMenuOpen(!1),V.current&&(V.current.style.height="auto"),(rt=V.current)==null||rt.focus()}function Ce(W){if(p&&K.length>0){if(W.key==="ArrowDown"){W.preventDefault(),b(me=>(me+1)%K.length);return}if(W.key==="ArrowUp"){W.preventDefault(),b(me=>(me-1+K.length)%K.length);return}if(W.key==="Tab"&&!W.shiftKey){W.preventDefault(),M(K[x]);return}if(W.key==="Enter"&&!W.shiftKey){W.preventDefault(),M(K[x]);return}if(W.key==="Escape"){W.preventDefault(),m(!1);return}}if(R.mentionMenuOpen&&W.key==="Escape"){W.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(W.key==="ArrowDown"){W.preventDefault(),R.setMentionMenuIndex(me=>(me+1)%R.filteredPrompts.length);return}if(W.key==="ArrowUp"){W.preventDefault(),R.setMentionMenuIndex(me=>(me-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(W.key==="Tab"&&!W.shiftKey||W.key==="Enter"&&!W.shiftKey){W.preventDefault(),pe(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(W.key==="Enter"&&!W.shiftKey||W.key==="Tab"&&!W.shiftKey)){W.preventDefault();return}if(W.key==="Tab"&&W.shiftKey){W.preventDefault(),$e();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),_e())}function De(W){n(W.target.value),L(W.target.selectionStart??W.target.value.length);const me=W.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,200)+"px"}function Ee(){V.current&&L(V.current.selectionStart??0)}function Be(){Cn(e,{type:"interrupt"})}async function Je(W){if(W.length===0)return;const me=[],Re=[];let We=i.reduce((rt,it)=>rt+it.size,0);for(const rt of W){if(rt.size>gf){Re.push(`${rt.name} is too large (${Es(rt.size)}, max ${Es(gf)})`);continue}if(We+rt.size>xf){Re.push(`${rt.name} would exceed the per-message limit (${Es(xf)})`);continue}const{base64:it,mediaType:St}=await AS(rt);me.push({name:rt.name,base64:it,mediaType:St,size:rt.size}),We+=rt.size}me.length>0&&a(rt=>[...rt,...me]),u(Re.length>0?Re.join("; "):null)}async function jt(W){const me=W.target.files;me&&(await Je(Array.from(me)),W.target.value="")}function dt(W){a(me=>me.filter((Re,We)=>We!==W))}async function gt(W){var We;const me=(We=W.clipboardData)==null?void 0:We.items;if(!me)return;const Re=[];for(const rt of Array.from(me)){if(rt.kind!=="file")continue;const it=rt.getAsFile();if(!it)continue;const St=it.name&&it.name.length>0?it.name:`pasted-${Date.now()}.${(it.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Re.push(new File([it],St,{type:it.type,lastModified:it.lastModified}))}Re.length>0&&(W.preventDefault(),await Je(Re))}function xt(W){W.dataTransfer.types.includes("Files")&&(W.preventDefault(),W.stopPropagation(),h(!0))}function _t(W){W.currentTarget===W.target&&h(!1)}async function Nt(W){if(!W.dataTransfer.types.includes("Files"))return;W.preventDefault(),W.stopPropagation(),h(!1);const me=Array.from(W.dataTransfer.files);me.length>0&&await Je(me)}function ve(){const W=t.trim().slice(0,32);N(W||""),O(null),_(me=>!me)}function $e(){if(!Z)return;const W=Y.getState();if(!P)W.setPreviousPermissionMode(e,G),Cn(e,{type:"set_permission_mode",mode:"plan"}),W.updateSession(e,{permissionMode:"plan"});else{const me=se||($?"bypassPermissions":"acceptEdits");Cn(e,{type:"set_permission_mode",mode:me}),W.updateSession(e,{permissionMode:me})}}async function nt(){const W=t.trim(),me=j.trim();if(!W||!me)return;if(k==="project"&&!(A!=null&&A.cwd)){O("No project folder available for this session");return}const Re={name:me,content:W,scope:k};k==="project"&&(Re.projectPaths=[A.cwd]);try{await Ne.createPrompt(Re),await R.refreshPrompts(),_(!1),N(""),E("global"),O(null)}catch(We){const rt=We instanceof Error&&We.message?We.message:"Could not save prompt.";O(rt)}}const je=Y(W=>W.promptSuggestions.get(e))??VR,ze=Y(W=>W.clearPromptSuggestions),Te=Y(W=>W.sessionStatus).get(e)==="running",$r=t.trim().length>0&&Z;return l.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${f?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:xt,onDragLeave:_t,onDrop:Nt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((W,me)=>l.jsx(LS,{name:W.name,mediaType:W.mediaType,base64:W.base64,size:W.size,onRemove:()=>dt(me)},me))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:F,type:"file",multiple:!0,onChange:jt,className:"hidden","aria-label":"Attach files"}),je.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:je.map((W,me)=>l.jsx("button",{onClick:()=>{if(!Z||Te)return;const Re=Hm();Cn(e,{type:"user_message",content:W,session_id:e,client_msg_id:Re}),Y.getState().appendMessage(e,{id:Re,role:"user",content:W,timestamp:Date.now()}),ze(e)},disabled:!Z||Te,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:W,children:W},me))}),l.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${P?"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&&K.length>0&&l.jsx("div",{ref:Q,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:K.map((W,me)=>l.jsxs("button",{"data-cmd-index":me,onClick:()=>M(W),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${me===x?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:W.type==="skill"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",W.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:W.type})]})]},`${W.type}-${W.name}`))}),l.jsx(qS,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:pe,menuRef:R.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),y&&l.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[l.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),l.jsx("input",{value:j,onChange:W=>{N(W.target.value),C&&O(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button","aria-pressed":k==="global",onClick:()=>E("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${k==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),l.jsx("button",{type:"button","aria-pressed":k==="project",onClick:()=>E("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${k==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),k==="project"&&(A==null?void 0:A.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:A.cwd,children:A.cwd}),C?l.jsx("div",{className:"text-[11px] text-cc-error",children:C}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),E("global"),O(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:nt,disabled:!j.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${j.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[l.jsx(f5,{isPlan:P,isConnected:Z,onToggle:$e,modeLabel:ae,size:"mobile"}),l.jsx(d5,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(kd,{onClick:ve,disabled:!Z||!t.trim(),active:Z&&!!t.trim(),title:"Save as prompt",children:l.jsx(h5,{})}),l.jsx(kd,{onClick:()=>{var W;return(W=F.current)==null?void 0:W.click()},disabled:!Z,active:Z,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:V,value:t,onChange:De,onKeyDown:Ce,onClick:Ee,onKeyUp:Ee,onPaste:gt,"aria-label":"Message input",placeholder:Z?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!Z,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),l.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:l.jsx(p5,{isRunning:Te,canSend:$r,onSend:_e,onInterrupt:Be,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(kd,{onClick:()=>{var W;return(W=F.current)==null?void 0:W.click()},disabled:!Z,active:Z,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx(kd,{onClick:ve,disabled:!Z||!t.trim(),active:Z&&!!t.trim(),title:"Save as prompt",children:l.jsx(h5,{})}),l.jsx(f5,{isPlan:P,isConnected:Z,onToggle:$e,modeLabel:ae,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(d5,{sessionId:e}),l.jsx(p5,{isRunning:Te,canSend:$r,onSend:_e,onInterrupt:Be,size:"desktop"})]})]})]})})}function YR(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function QR(e,t){const n={};for(const[i,a]of Object.entries(t)){const o=e[Number(i)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:i;n[u]=a}return n}function WR({permission:e,sessionId:t}){const[n,i]=S.useState(!1),a=Y(p=>p.removePermission);function o(p,m){i(!0),Cn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...m!=null&&m.length?{updated_permissions:m}:{}}),a(t,e.request_id)}function u(){i(!0),Cn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return l.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:l.jsx("div",{className:"max-w-3xl mx-auto",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:l.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&l.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&l.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?l.jsx(eL,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(ZR,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&l.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&l.jsx(KR,{validation:e.ai_validation}),!f&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,m)=>l.jsxs("button",{onClick:()=>o(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),YR(p)]},m)),l.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function XR(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 KR({validation:e}){const t=e.verdict==="uncertain"&&XR(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return l.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),l.jsx("span",{className:"font-medium",children:i}),l.jsx("span",{children:e.reason})]})}function ZR({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(JR,{input:t}):e==="Edit"?l.jsx(tL,{input:t}):e==="Write"?l.jsx(nL,{input:t}):e==="Read"?l.jsx(rL,{input:t}):e==="Glob"?l.jsx(iL,{input:t}):e==="Grep"?l.jsx(sL,{input:t}):e==="ExitPlanMode"?l.jsx(aL,{input:t}):l.jsx(GS,{input:t,description:n})}function JR({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsx("div",{className:"text-xs text-cc-muted",children:n}),l.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function eL({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,o]=S.useState({}),[u,f]=S.useState({}),[h,p]=S.useState({});function m(N){return QR(i,N)}function x(N,k){const E=String(N);o(C=>({...C,[E]:k})),p(C=>({...C,[E]:!1})),i.length<=1&&t(m({[E]:k}))}function b(N){var C;const k=String(N),E=(C=u[k])==null?void 0:C.trim();E&&(o(O=>({...O,[k]:E})),i.length<=1&&t(m({[k]:E})))}function y(N,k){const E=String(N);f(O=>({...O,[E]:k}));const C=k.trim();o(O=>{if(!C){const z={...O};return delete z[E],z}return{...O,[E]:C}})}function _(N){const k=String(N);p(E=>{const C=!!E[k],O={...E,[k]:!C};return C&&(o(z=>{const L={...z};return delete L[k],L}),f(z=>{const L={...z};return delete L[k],L})),O})}function j(){t(m(a))}if(i.length===0){const N=typeof e.question=="string"?e.question:"";return N?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:N}):l.jsx(GS,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((N,k)=>{const E=typeof N.header=="string"?N.header:"",C=typeof N.question=="string"?N.question:"",O=Array.isArray(N.options)?N.options:[],z=String(k),L=a[z],V=h[z];return l.jsxs("div",{className:"space-y-2",children:[E&&l.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:E}),C&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:C}),O.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[O.map((F,Q)=>{const D=typeof F.label=="string"?F.label:String(F),I=typeof F.description=="string"?F.description:"",A=L===D;return l.jsx("button",{onClick:()=>x(k,D),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${A?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${A?"border-cc-primary":"border-cc-muted/40"}`,children:A&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:D}),I&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:I})]})]})},Q)}),l.jsx("button",{onClick:()=>_(k),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${V?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${V?"border-cc-primary":"border-cc-muted/40"}`,children:V&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),V&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[z]||"",onChange:F=>y(k,F.target.value),onKeyDown:F=>{F.key==="Enter"&&b(k)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},k)}),i.length>1&&Object.keys(a).length>0&&l.jsx("button",{onClick:j,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function tL({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(Bl,{oldText:n,newText:i,fileName:t,mode:"compact"})}function nL({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Bl,{newText:n,fileName:t,mode:"compact"})}function rL({input:e}){const t=String(e.file_path||"");return l.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function iL({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n})]})}function sL({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n}),i&&l.jsx("div",{className:"text-cc-muted",children:i})]})}function aL({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return l.jsxs("div",{className:"space-y-2",children:[t&&l.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[l.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),l.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),l.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:l.jsx(Ax,{remarkPlugins:[Dx],components:{h1:({children:i})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>l.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>l.jsx("li",{children:i}),strong:({children:i})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:a})=>l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:i=>{const{children:a,className:o}=i;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
|
|
104
|
-
`)?l.jsx("pre",{className:"my-2 px-2.5 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto border border-cc-border",children:l.jsx("code",{children:a})}):l.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-cc-code-fg font-mono-code text-[12px]",children:a})},pre:({children:i})=>l.jsx(l.Fragment,{children:i}),blockquote:({children:i})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),l.jsx("div",{className:"space-y-1",children:n.map((i,a)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[l.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function GS({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,a])=>{const o=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},i)})})]})}function lL({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,o=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const f=n.input.command;u=f.length>60?f.slice(0,60)+"...":f}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${o?"text-cc-success":"text-cc-error"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),l.jsxs("span",{className:"flex-1",children:["AI auto-",o?"approved":"denied",":"," ",l.jsx("span",{className:"font-mono-code opacity-80",children:u}),a&&l.jsxs("span",{className:"text-cc-muted ml-1",children:["(",a,")"]})]}),t&&l.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const oL=[],cL=[],m5="activity-tray-panel";function uL(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),a=n%60;return`${i}m${a>0?` ${a}s`:""}`}function dL(e,t,n=4e3){const[i,a]=S.useState(!1),o=S.useRef(void 0),u=e.length+t.length,f=u>0&&e.every(h=>h.status==="completed")&&t.every(h=>h.status!=="running");return S.useEffect(()=>(clearTimeout(o.current),f?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[f,n]),S.useEffect(()=>{a(!1)},[u]),i}function fL(e){const[t,n]=S.useState(0);return S.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(i)},[e]),t}function hL({status:e}){return e==="running"||e==="in_progress"?l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function pL({agent:e,tick:t}){const[n,i]=S.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(hL,{status:e.status}),l.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&l.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:uL(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function mL({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[l.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug flex-1 truncate ${t?"text-cc-muted line-through":"text-cc-fg/80"}`,children:e.subject}),n&&e.activeForm&&l.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function gL({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=S.useRef(null),o=Y(C=>C.sessionTasks.get(e)??oL),u=Y(C=>C.sessionBackgroundAgents.get(e)??cL),f=dL(o,u),h=u.some(C=>C.status==="running"),p=fL(h),m=u.filter(C=>C.status==="running").length,x=o.length,b=o.filter(C=>C.status==="completed").length,y=o.filter(C=>C.status==="in_progress").length,_=o.length>0||u.length>0,j=m>0||y>0,N=S.useCallback(()=>n(!1),[]);S.useEffect(()=>{if(!t)return;const C=O=>{O.key==="Escape"&&(O.stopPropagation(),N())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,N]),S.useEffect(()=>{if(!t)return;const C=O=>{i.current&&!i.current.contains(O.target)&&N()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,N]),S.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[k,E]=S.useState(!1);return S.useEffect(()=>{_&&E(!1)},[_,o.length,u.length]),!_||k?null:l.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,style:f?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{f&&E(!0)},children:[t&&l.jsxs("div",{ref:a,id:m5,role:"dialog","aria-label":"Activity panel",tabIndex:-1,className:"mb-1.5 w-72 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto rounded-xl border border-cc-border/60 bg-cc-surface/95 backdrop-blur-xl shadow-lg shadow-black/20 outline-none",style:{animation:"fadeSlideIn 0.2s ease-out"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),l.jsx("button",{type:"button",onClick:N,className:"flex items-center justify-center w-7 h-7 -mr-1 rounded-md text-cc-muted/40 hover:text-cc-muted/70 hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-label":"Close activity tray",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),u.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(C=>l.jsx(pL,{agent:C,tick:p},C.toolUseId))]}),u.length>0&&o.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),o.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),o.map(C=>l.jsx(mL,{task:C},C.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":m5,className:`
|
|
105
|
-
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
106
|
-
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
107
|
-
shadow-md shadow-black/15
|
|
108
|
-
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
109
|
-
transition-all duration-200 cursor-pointer
|
|
110
|
-
${t?"ring-1 ring-cc-primary/30":""}
|
|
111
|
-
`,"aria-label":`Activity: ${m} agents running, ${b}/${x} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:m>0?`${m} agent${m!==1?"s":""}`:`${u.length} done`}),u.length>0&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",x]}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function xL({sessionId:e}){const t=Y(_=>_.pendingPermissions.get(e)),n=Y(_=>_.aiResolvedPermissions.get(e)),i=Y(_=>_.clearAiResolvedPermissions),a=Y(_=>_.connectionStatus.get(e)??"disconnected"),o=Y(_=>_.cliConnected.get(e)??!1),u=Y(_=>_.cliReconnecting.get(e)??!1),f=Y(_=>_.setCliReconnecting),[h,p]=S.useState(null),m=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(m.current)},[e,o]),S.useEffect(()=>()=>clearTimeout(m.current),[]);const x=S.useCallback(async()=>{p(null),clearTimeout(m.current),f(e,!0);try{await Ne.relaunchSession(e)}catch(_){Rs(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),m.current=setTimeout(()=>p(null),4e3)}},[e,f]),b=S.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx($R,{sessionId:e}),l.jsx(gL,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(lL,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(WR,{permission:_,sessionId:e},_.request_id))}),l.jsx(GR,{sessionId:e})]})}function vL({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=Y(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(m){i.current&&!i.current.contains(m.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,m){const x=!m,b={[p]:x};Y.getState().setSessionAiValidation(e,b),VC(e,b)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",o),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function bL({sessionId:e}){const[t,n]=S.useState(!1),[i,a]=S.useState(null),[o,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=x=>{f.current&&!f.current.contains(x.target)&&n(!1)},m=x=>{x.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",m),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",m)}},[t]);const h=S.useCallback(async p=>{a(p),u(!1);try{const{blob:m,filename:x}=await Ne.exportSession(e,p),b=URL.createObjectURL(m),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(m){Rs(m),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function yL({sessionId:e}){const t=Y(m=>m.density),n=Y(m=>m.magicUiAvailable),i=Y(m=>{var x;return!!e&&((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0}),a=S.useCallback(()=>{var x;if(!e)return;const m=Y.getState();((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0&&(m.setSessionMagicUi(e,!1),Gb(e,!1))},[e]),o=S.useCallback(()=>{Y.getState().setDensity("standard"),a()},[a]),u=S.useCallback(()=>{Y.getState().setDensity("compact"),a()},[a]),f=S.useCallback(()=>{e&&(Y.getState().setSessionMagicUi(e,!0),Gb(e,!0))},[e]);if(!n||!e)return l.jsx(_L,{});const h=t==="compact",p=[{key:"standard",label:"Standard view",active:!i&&!h,onClick:o,icon:l.jsx(YS,{})},{key:"compact",label:"Compact view",active:!i&&h,onClick:u,icon:l.jsx(QS,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:f,icon:l.jsx(wL,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:p.map(m=>l.jsx("button",{onClick:m.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${m.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:m.label,"aria-label":m.label,"aria-pressed":m.active,children:m.icon},m.key))})}function _L(){const e=Y(a=>a.density),t=S.useCallback(()=>Y.getState().toggleDensity(),[]),n=e==="compact",i=n?"Switch to standard density":"Switch to compact density";return l.jsx("button",{onClick:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${n?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:i,"aria-label":i,"aria-pressed":n,children:n?l.jsx(QS,{}):l.jsx(YS,{})})}function YS(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}function QS(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 7h16M4 11h16M4 15h16M4 19h16"})})}function wL(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:[l.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"}),l.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]})}function SL(){var V;const e=S.useSyncExternalStore(F=>(window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)),()=>window.location.hash),t=S.useMemo(()=>hx(e),[e]),n=t.page==="session"||t.page==="home",i=Y(F=>F.currentSessionId),a=Y(F=>F.cliConnected),o=Y(F=>F.sessionStatus),u=Y(F=>F.sessionNames),f=Y(F=>F.sdkSessions),h=Y(F=>F.sidebarOpen),p=Y(F=>F.setSidebarOpen),m=Y(F=>F.taskPanelOpen),x=Y(F=>F.setTaskPanelOpen),b=Y(F=>F.activeTab),y=Y(F=>F.setActiveTab),_=Y(F=>F.markChatTabReentry),j=Y(F=>i?F.gitChangedFilesCount.get(i)??0:0),N=i?o.get(i)??null:null,k=i?a.get(i)??!1:!1,E=i?(u==null?void 0:u.get(i))||((V=f.find(F=>F.sessionId===i))==null?void 0:V.name)||`Session ${i.slice(0,8)}`:null,C=!!(i&&n),O=t.page==="session"&&!!i,z=["chat","diff"],L=F=>{F==="chat"&&b!=="chat"&&i&&_(i),y(F)};return S.useEffect(()=>{const F=Q=>{if(!(Q.metaKey||Q.ctrlKey)||Q.key.toLowerCase()!=="j"||!C)return;const D=Q.target;if(D&&(D.tagName==="TEXTAREA"||D.tagName==="INPUT"||D.isContentEditable))return;Q.preventDefault();const I=Math.max(0,z.indexOf(b)),A=Q.shiftKey?-1:1,se=(I+A+z.length)%z.length;L(z[se])};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,z,b,y,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&l.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[l.jsxs("button",{onClick:()=>L("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:E||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>L("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&i&&l.jsx(vL,{sessionId:i}),C&&i&&l.jsx(bL,{sessionId:i}),C&&l.jsx(yL,{sessionId:i??null}),l.jsx(kL,{}),O&&l.jsx("button",{onClick:()=>x(!m),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${m?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function kL(){const e=Y(n=>n.darkMode),t=S.useCallback(()=>Y.getState().toggleDarkMode(),[]);return l.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const WS="cc-recent-dirs";function vf(){try{return JSON.parse(localStorage.getItem(WS)||"[]")}catch{return[]}}function XS(e){const t=vf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(WS,JSON.stringify(t.slice(0,5)))}function jL(){return!1}function KS({onClose:e,embedded:t=!1}){const[n,i]=S.useState([]),[a,o]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[m,x]=S.useState([]),[b,y]=S.useState(""),[_,j]=S.useState(!1),[N,k]=S.useState(""),[E,C]=S.useState([{key:"",value:""}]),[O,z]=S.useState(!1),L=S.useCallback(()=>{Ne.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);S.useEffect(()=>{L()},[L]);function V(G){f(G.slug),p(G.name);const P=Object.entries(G.variables).map(([$,ie])=>({key:$,value:ie}));P.length===0&&P.push({key:"",value:""}),x(P),y("")}function F(){f(null),y("")}async function Q(){if(!u)return;const G={};for(const P of m){const $=P.key.trim();$&&(G[$]=P.value)}try{await Ne.updateEnv(u,{name:h.trim()||void 0,variables:G}),f(null),y(""),L()}catch(P){y(P instanceof Error?P.message:String(P))}}async function D(G){try{await Ne.deleteEnv(G),u===G&&f(null),L()}catch(P){y(P instanceof Error?P.message:String(P))}}async function I(){const G=N.trim();if(!G)return;z(!0);const P={};for(const $ of E){const ie=$.key.trim();ie&&(P[ie]=$.value)}try{await Ne.createEnv(G,P),k(""),C([{key:"",value:""}]),j(!1),y(""),L()}catch($){y($ instanceof Error?$.message:String($))}finally{z(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:N,onChange:G=>k(G.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:G=>{G.key==="Enter"&&N.trim()&&I()}}),l.jsx(jd,{rows:E,onChange:C}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!N.trim()||O,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!O?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:O?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(G=>{const P=u===G.slug,$=Object.keys(G.variables).length;return P?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:ie=>p(ie.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(jd,{rows:m,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:F,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:()=>void Q(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},G.slug):l.jsx(NL,{env:G,varCount:$,onStartEdit:()=>V(G),onDelete:()=>void D(G.slug)},G.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const A=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:G=>k(G.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:G=>{G.key==="Enter"&&N.trim()&&I()}}),l.jsx(jd,{rows:E,onChange:C}),l.jsx("button",{onClick:I,disabled:!N.trim()||O,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!O?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:O?"Creating...":"Create"})]}),se=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(G=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:G.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(G.variables).length," var",Object.keys(G.variables).length!==1?"s":""]}),u===G.slug?l.jsx("button",{onClick:F,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>V(G),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>D(G.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===G.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:P=>p(P.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(jd,{rows:m,onChange:x})]})}),l.jsx("button",{onClick:Q,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==G.slug&&Object.keys(G.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(G.variables).map(([P,$])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:P}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:$})]},P))})]},G.slug))}),Z=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:G=>G.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),se,A]})]});return $l.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:Z}),document.body)}function NL({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function jd({rows:e,onChange:t}){function n(o,u,f){const h=[...e];h[o]={...h[o],[u]:f},t(h)}function i(o){const u=e.filter((f,h)=>h!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const CL=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:KS},Symbol.toStringTag,{value:"Module"}));function EL(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function TL({initialPath:e,onSelect:t,onClose:n}){const[i,a]=S.useState(""),[o,u]=S.useState([]),[f,h]=S.useState(!0),[p,m]=S.useState(""),[x,b]=S.useState(""),[y,_]=S.useState(!1),[j,N]=S.useState(""),[k,E]=S.useState(-1),[C,O]=S.useState(!1),[z,L]=S.useState(()=>vf()),V=S.useRef(null),F=S.useRef(null),Q=S.useRef(null),D=S.useRef(new Map),I=S.useMemo(()=>{if(!j)return o;const $=j.toLowerCase();return o.filter(ie=>ie.name.toLowerCase().includes($))},[o,j]),A=S.useCallback(async $=>{h(!0),m(""),N(""),E(-1);try{const ie=await Ne.listDirs($);a(ie.path),u(ie.dirs)}catch{m("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{A(e||void 0)},[]),S.useEffect(()=>{const $=V.current;if(!$)return;function ie(R){if(R.key!=="Tab")return;const B=$.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(B.length===0)return;const K=B[0],M=B[B.length-1];R.shiftKey&&document.activeElement===K?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),K.focus())}document.addEventListener("keydown",ie);const ae=setTimeout(()=>{var R;(R=Q.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",ie),clearTimeout(ae)}},[]);const se=S.useCallback(()=>{C||(O(!0),setTimeout(n,150))},[n,C]);S.useEffect(()=>{function $(ie){if(ie.key==="Escape"){if(y)return;se()}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,se]),S.useEffect(()=>{function $(ie){var R,B;if(y)return;if(ie.key==="Backspace"&&document.activeElement!==Q.current){if(i&&i!=="/"){ie.preventDefault();const K=i.split("/").slice(0,-1).join("/")||"/";A(K)}return}const ae=I.length;if(ae!==0){if(ie.key==="ArrowDown"){ie.preventDefault();const K=k<ae-1?k+1:0;E(K),(R=D.current.get(K))==null||R.focus()}else if(ie.key==="ArrowUp"){ie.preventDefault();const K=k>0?k-1:ae-1;E(K),(B=D.current.get(K))==null||B.focus()}}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,I.length,k,i,A]),S.useEffect(()=>{var $;k>=0&&(($=D.current.get(k))==null||$.scrollIntoView({block:"nearest"}))},[k]);function Z($){XS($),L(vf()),t($),n()}const G=EL(i),P=i.split("/").pop()||"/";return $l.createPortal(l.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:se,children:l.jsxs("div",{ref:V,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:$=>$.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:se,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),z.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:z.map($=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[l.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:$.split("/").pop()||$}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:$})]})},$))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:x,onChange:$=>b($.target.value),onKeyDown:$=>{$.key==="Enter"&&x.trim()&&Z(x.trim()),$.key==="Escape"&&($.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:G.map(($,ie)=>{const ae=ie===G.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[ie>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{ae||A($.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ae?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ae?"location":void 0,tabIndex:ae?-1:0,children:$.label})]},$.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:Q,type:"text","aria-label":"Filter directories",value:j,onChange:$=>{N($.target.value),E(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>Z(i),"aria-label":`Select ${P}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:P})]})]}),l.jsx("div",{ref:F,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map(($,ie)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+ie*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 ${ie*.1}s infinite`}})]},ie))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>A(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map(($,ie)=>l.jsxs("li",{className:`flex items-center transition-colors ${k===ie?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ae=>{ae?D.current.set(ie,ae):D.current.delete(ie)},onClick:()=>A($.path),onKeyDown:ae=>{ae.key==="Enter"&&(ae.preventDefault(),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:$.path,"aria-label":`Navigate into ${$.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"truncate",children:$.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>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 ${$.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},$.path))})}),l.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function AL(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function ML(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():AL(e.identifier,e.title)}function yc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),l.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),l.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),l.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function RL({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[m,x]=S.useState(0),[b,y]=S.useState(!0),[_,j]=S.useState([]),[N,k]=S.useState(""),[E,C]=S.useState(""),[O,z]=S.useState(!0),[L,V]=S.useState(!1),[F,Q]=S.useState("");S.useEffect(()=>{let I=!0;return Promise.all([Ne.getLinearStates(t),Ne.getLinearConnection(t)]).then(([A,se])=>{var G;if(!I)return;j(A.teams),k(se.viewerId);const Z=((G=A.teams[0])==null?void 0:G.id)||"";p(Z)}).catch(A=>{I&&Q(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{I&&z(!1)}),()=>{I=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){C("");return}const I=_.find(se=>se.id===h),A=I==null?void 0:I.states.find(se=>se.type==="backlog");C((A==null?void 0:A.id)||"")},[h,_]);async function D(){if(!(!a.trim()||!h)){V(!0),Q("");try{const I=await Ne.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:m,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:E||void 0,connectionId:t});n(I.issue)}catch(I){Q(I instanceof Error?I.message:"Failed to create issue")}finally{V(!1)}}}return $l.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),F&&l.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:F}),O?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>o(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&h&&!L&&D()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:m,onChange:I=>x(Number(I.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:I=>y(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:D,disabled:!a.trim()||!h||L,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:L?"Creating...":"Create Issue"})]})]})]})}),document.body)}function LL({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,m]=S.useState(null),[x,b]=S.useState(!1),[y,_]=S.useState(""),[j,N]=S.useState([]),[k,E]=S.useState(!1),[C,O]=S.useState(!1),[z,L]=S.useState(""),[V,F]=S.useState(!1),[Q,D]=S.useState(null),[I,A]=S.useState([]),[se,Z]=S.useState(!1),[G,P]=S.useState(""),[$,ie]=S.useState(!1),[ae,R]=S.useState([]),[B,K]=S.useState(!1),[M,pe]=S.useState(""),[_e,Ce]=S.useState(!1),[De,Ee]=S.useState([]),[Be,Je]=S.useState(!1),[jt,dt]=S.useState(!1),gt=S.useRef(null);S.useEffect(()=>{function je(ze){gt.current&&!gt.current.contains(ze.target)&&(E(!1),ie(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),S.useEffect(()=>{if(!n){h([]),m(null),b(!1),u(null);return}let je=!0;return Ne.listLinearConnections().then(({connections:ze})=>{je&&(h(ze),b(!0),ze.length>0?(m(ze[0].id),u(ze[0].id)):(m(null),u(null)))}).catch(()=>{je&&b(!0)}),()=>{je=!1}},[n]);const xt=S.useCallback(je=>{m(je),u(je),a(null),N([]),_(""),L(""),Ee([]),pe(""),R([]),Q&&(Z(!0),P(""),Ne.getLinearProjectIssues(Q.projectId,10,je).then(({issues:ze})=>{A(ze)}).catch(ze=>{P(ze instanceof Error?ze.message:String(ze))}).finally(()=>{Z(!1)}))},[Q,u,a]);S.useEffect(()=>{if(!t||!n){D(null),A([]);return}let je=!0;return Z(!0),P(""),(async()=>{try{const{mapping:ze}=await Ne.getLinearProjectMapping(t.repoRoot);if(!je)return;if(D(ze),ze){const{issues:ht}=await Ne.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!je)return;A(ht)}else A([])}catch(ze){if(!je)return;P(ze instanceof Error?ze.message:String(ze))}finally{je&&Z(!1)}})(),()=>{je=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const je=y.trim();if(je.length<2){N([]),L(""),O(!1);return}let ze=!0;O(!0),L("");const ht=setTimeout(()=>{Ne.searchLinearIssues(je,8,p??void 0).then(Te=>{ze&&N(Te.issues)}).catch(Te=>{ze&&(N([]),L(Te instanceof Error?Te.message:String(Te)))}).finally(()=>{ze&&O(!1)})},400);return()=>{ze=!1,clearTimeout(ht)}},[n,y,p]),S.useEffect(()=>{if(!n||!_e){Ee([]),Je(!1);return}const je=M.trim();if(je.length<2){Ee([]),Je(!1);return}let ze=!0;Je(!0);const ht=setTimeout(()=>{Ne.searchLinearIssues(je,10,p??void 0).then(Te=>{ze&&Ee(Te.issues)}).catch(()=>{ze&&Ee([])}).finally(()=>{ze&&Je(!1)})},400);return()=>{ze=!1,clearTimeout(ht)}},[n,_e,M,p]);function _t(je,ze=!1){a(je),_(`${je.identifier} - ${je.title}`);const ht=ML(je);o(ht,!0),ze&&E(!1)}function Nt(){a(null),_(""),N([]),L("")}async function ve(je){if(t)try{const{mapping:ze}=await Ne.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});D(ze),ie(!1),Z(!0),P("");const{issues:ht}=await Ne.getLinearProjectIssues(je.id,10,p??void 0);A(ht)}catch(ze){P(ze instanceof Error?ze.message:String(ze))}finally{Z(!1)}}async function $e(){if(t){try{await Ne.removeLinearProjectMapping(t.repoRoot)}catch{}D(null),A([]),a(null),_("")}}function nt(){if(!n){window.location.hash="#/integrations/linear";return}ie(!0),ae.length===0&&(K(!0),Ne.listLinearProjects(p??void 0).then(({projects:je})=>R(je)).catch(()=>{}).finally(()=>K(!1)))}function nn(je){dt(!1),_t(je),Q&&(Z(!0),Ne.getLinearProjectIssues(Q.projectId,10,p??void 0).then(({issues:ze})=>A(ze)).catch(()=>{}).finally(()=>Z(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:gt,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),x&&f.length>1&&l.jsx("select",{value:p??"",onChange:je=>xt(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=>l.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),Q?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[l.jsx(yc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Q.projectName}),l.jsx("button",{type:"button",onClick:$e,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsxs("button",{type:"button",onClick:()=>dt(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}E(!k)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(yc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:nt,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>dt(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),Q&&(()=>{const je=M.trim().toLowerCase(),ze=!_e&&je?I.filter(Te=>Te.identifier.toLowerCase().includes(je)||Te.title.toLowerCase().includes(je)):_e?[]:I,ht=_e?De:ze;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:Nt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:M,onChange:Te=>pe(Te.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"}),se?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):G?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:G}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&je.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):ht.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:je?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:ht.map(Te=>l.jsxs("button",{type:"button",onClick:()=>_t(Te),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Te.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:Te.identifier})," ",Te.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Te.stateName,Te.priorityLabel].filter(Boolean).join(" - ")})]},Te.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:_e,onChange:Te=>{Ce(Te.target.checked),Te.target.checked||Ee([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),$&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>ie(!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"})]})}),B?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ae.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:ae.map(je=>l.jsx("button",{type:"button",onClick:()=>ve(je),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:je.name})},je.id))})]}),k&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:je=>{_(je.target.value)},onFocus:()=>E(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),l.jsx("button",{type:"button",onClick:()=>{E(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&C&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!C&&z&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:z}),y.trim().length>=2&&!C&&!z&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!C&&!z&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>l.jsxs("button",{type:"button",onClick:()=>_t(je,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:je.identifier})," - ",je.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[je.stateName,je.teamName].filter(Boolean).join(" • ")})]},je.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),V&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{F(!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"})})]}),jt&&l.jsx(RL,{defaultProjectId:Q==null?void 0:Q.projectId,connectionId:p??void 0,onCreated:nn,onClose:()=>dt(!1)})]}):null}function DL({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[m,x]=S.useState(!1),[b,y]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":m,onClick:()=>{!m&&t&&Ne.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),x(!m),y("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),m&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=h.filter(O=>!O.isRemote&&(!j||O.name.toLowerCase().includes(j))),k=h.filter(O=>O.isRemote&&(!j||O.name.toLowerCase().includes(j))),E=h.some(O=>O.name.toLowerCase()===j),C=N.length>0||k.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(O=>l.jsxs("button",{onClick:()=>{o(O.name,!1),x(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${O.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:O.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[O.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[O.ahead,"↑"]}),O.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[O.behind,"↓"]}),O.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),O.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},O.name))]}),k.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(O=>l.jsxs("button",{onClick:()=>{o(O.name,!1),x(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${O.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:O.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${O.name}`))]}),!C&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!E&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),x(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:b.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const zL=336*60*60*1e3,fa=12,OL=24;function Hg(e){return e.split("/").filter(Boolean).pop()||e}function g5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Hg(e.cwd)}function BL(e){return e.length>8?e.slice(0,8):e}function PL(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function $L(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function FL(){var es;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,m]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=S.useState([]),[y,_]=S.useState(()=>c5(localStorage.getItem("cc-backend")||"claude")),[j,N]=S.useState(()=>u5(localStorage.getItem("cc-backend")||"claude")),[k,E]=S.useState(()=>localStorage.getItem("cc-effort")||""),[C,O]=S.useState(()=>vf()[0]||""),[z,L]=S.useState([]),[V,F]=S.useState(null),[Q,D]=S.useState(!1),[I,A]=S.useState(""),[se,Z]=S.useState(null),[G,P]=S.useState(!1),[$,ie]=S.useState(null),[ae,R]=S.useState(null),[B,K]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=se||HS(p),pe=o5(p),_e=qR(p),[Ce,De]=S.useState([]),[Ee,Be]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Je,jt]=S.useState(!1),[dt,gt]=S.useState(!1),xt=jL(),[_t,Nt]=S.useState(()=>xt),[ve,$e]=S.useState([]),[nt,nn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,ze]=S.useState(!1),ht=S.useRef(null),[Te,$r]=S.useState(null),oe=S.useRef(null),we=S.useRef(null),[W,me]=S.useState(!1),[Re,We]=S.useState(!1),[rt,it]=S.useState(!1),[St,xn]=S.useState(!1),[et,ir]=S.useState(!1),[En,Wr]=S.useState(""),[Fr,Ur]=S.useState(!0),[te,ge]=S.useState([]),[be,Xe]=S.useState(!1),[$t,un]=S.useState(""),[Tn,Ft]=S.useState(!1),[On,yr]=S.useState(fa),[Ea,Il]=S.useState(""),[Bn,zs]=S.useState(null),[Hl,ql]=S.useState(!1),[_r,Xt]=S.useState(""),[wn,sr]=S.useState(!1),[Vl,Tf]=S.useState([]),[Os,Bs]=S.useState(null),[Xr,Yi]=S.useState(!1),[pi,qn]=S.useState(""),[Ps,Kr]=S.useState(0),en=S.useRef(null),Vn=S.useRef(null),Ta=S.useRef(null),Ir=S.useRef(null),Zr=S.useRef(null),Gl=S.useRef(null),Yl=Y(H=>H.currentSessionId),tn=VS({text:e,caretPos:Ps,cwd:C||void 0});S.useEffect(()=>{if(en.current===null||!Vn.current)return;const H=en.current;Vn.current.setSelectionRange(H,H),en.current=null},[e]),S.useEffect(()=>{var he;window.matchMedia("(min-width: 640px)").matches&&((he=Vn.current)==null||he.focus())},[]),S.useEffect(()=>{Ne.getHome().then(({home:H,cwd:he})=>{C||O(he||H)}).catch(()=>{}),Ne.listEnvs().then(De).catch(()=>{}),Ne.listSandboxes().then($e).catch(()=>{}),Ne.getBackends().then(b).catch(()=>{}),Ne.getSettings().then(H=>{P(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function Af(H){m(H),localStorage.setItem("cc-backend",H),Z(null),_(c5(H)),N(u5(H)),H!=="claude"&&(ir(!1),ge([]),un(""),Xe(!1),Ft(!1),yr(fa),Il(""))}S.useEffect(()=>{if(p!=="codex"){Z(null);return}Ne.getBackendModels(p).then(H=>{if(H.length>0){const he=IR(H);Z(he),he.some(Ke=>Ke.value===y)||_(he[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(oe.current&&(clearInterval(oe.current),oe.current=null),$r(null),!_t)return;const H="the-companion:latest",he=()=>{Ne.getImageStatus(H).then(Ke=>{$r(Ke),Ke.status==="idle"&&Ne.pullImage(H).catch(()=>{}),(Ke.status==="ready"||Ke.status==="error")&&oe.current&&(clearInterval(oe.current),oe.current=null)}).catch(()=>{})};return he(),oe.current=setInterval(he,2e3),()=>{oe.current&&(clearInterval(oe.current),oe.current=null)}},[_t]),S.useEffect(()=>{function H(he){Ta.current&&!Ta.current.contains(he.target)&&me(!1),Ir.current&&!Ir.current.contains(he.target)&&We(!1),Zr.current&&!Zr.current.contains(he.target)&&it(!1),Gl.current&&!Gl.current.contains(he.target)&&jt(!1),ht.current&&!ht.current.contains(he.target)&&ze(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),S.useEffect(()=>{if(!C){zs(null);return}Ne.getRepoInfo(C).then(H=>{zs(H),Xt(H.currentBranch),sr(!1)}).catch(()=>{zs(null),Xt(""),sr(!1)})},[C]);const $s=M.find(H=>H.value===y)||M[0],Aa=pe.find(H=>H.value===j)||pe[0],Hr=_e.find(H=>H.value===k)||_e[0],Gn=p==="codex"?"/logo-codex.svg":"/logo.svg",Uc=C?C.split("/").pop()||C:"Select folder",Ql=S.useMemo(()=>En.trim(),[En]),Ma=p==="claude"&&et&&Ql.length>0,Jr=S.useMemo(()=>{const H=Date.now()-zL;return te.filter(he=>he.createdAt>=H)},[te]),Qi=S.useMemo(()=>Tn?te:Jr.length>0?Jr:te,[Tn,Jr,te]),wr=S.useMemo(()=>Ea.trim().toLowerCase(),[Ea]),ln=S.useMemo(()=>wr?Qi.filter(H=>{const he=g5(H).toLowerCase(),Ke=Hg(H.cwd).toLowerCase(),pt=(H.gitBranch||"").toLowerCase(),st=H.cwd.toLowerCase(),He=H.resumeSessionId.toLowerCase();return he.includes(wr)||Ke.includes(wr)||pt.includes(wr)||st.includes(wr)||He.includes(wr)}):Qi,[Qi,wr]),Fs=S.useMemo(()=>ln.slice(0,On),[ln,On]),Ic=On<ln.length,Ra=Math.max(0,te.length-Jr.length),Wi=!Tn&&Jr.length>0,La=S.useCallback(async()=>{if(p==="claude"){Xe(!0),un("");try{const[H,he]=await Promise.all([Ne.listSessions(),Ne.discoverClaudeSessions(400).then(He=>He.sessions)]),Ke=new Map,pt=He=>{const Pn=Ke.get(He.resumeSessionId);(!Pn||He.createdAt>Pn.createdAt)&&Ke.set(He.resumeSessionId,He)};for(const He of H)He.backendType!=="codex"&&He.cliSessionId&&pt({resumeSessionId:He.cliSessionId,sessionId:He.sessionId,name:He.name,model:He.model,createdAt:He.createdAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"companion"});for(const He of he)pt({resumeSessionId:He.sessionId,sessionId:He.sessionId,slug:He.slug,createdAt:He.lastActivityAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"claude_disk"});const st=Array.from(Ke.values()).sort((He,Pn)=>{const vn=C&&He.cwd===C?0:1,jr=C&&Pn.cwd===C?0:1;return vn!==jr?vn-jr:Pn.createdAt-He.createdAt});ge(st),Ft(!1),yr(fa)}catch(H){const he=H instanceof Error?H.message:String(H);un(he||"Failed to load existing sessions"),ge([]),yr(fa)}finally{Xe(!1)}}},[p,C]);S.useEffect(()=>{p==="claude"&&et&&La()},[p,et,La]),S.useEffect(()=>{yr(fa)},[wr,Tn]);async function Wl(H){if(H.length===0)return;const he=[],Ke=[];let pt=z.reduce((st,He)=>st+He.size,0);for(const st of H){if(st.size>gf){Ke.push(`${st.name} is too large (${Es(st.size)}, max ${Es(gf)})`);continue}if(pt+st.size>xf){Ke.push(`${st.name} would exceed the per-message limit (${Es(xf)})`);continue}const{base64:He,mediaType:Pn}=await AS(st);he.push({name:st.name,base64:He,mediaType:Pn,size:st.size}),pt+=st.size}he.length>0&&L(st=>[...st,...he]),F(Ke.length>0?Ke.join("; "):null)}async function Xi(H){const he=H.target.files;he&&(await Wl(Array.from(he)),H.target.value="")}function Mf(H){L(he=>he.filter((Ke,pt)=>pt!==H))}async function Hc(H){var pt;const he=(pt=H.clipboardData)==null?void 0:pt.items;if(!he)return;const Ke=[];for(const st of Array.from(he)){if(st.kind!=="file")continue;const He=st.getAsFile();if(!He)continue;const Pn=He.name&&He.name.length>0?He.name:`pasted-${Date.now()}.${(He.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ke.push(new File([He],Pn,{type:He.type,lastModified:He.lastModified}))}Ke.length>0&&(H.preventDefault(),await Wl(Ke))}function qc(H){t(H.target.value),Kr(H.target.selectionStart??H.target.value.length);const he=H.target;he.style.height="auto",he.style.height=Math.min(he.scrollHeight,200)+"px"}function Da(){Vn.current&&Kr(Vn.current.selectionStart??0)}function Vc(H){var Ke;const he=tn.selectPrompt(H);en.current=he.nextCursor,t(he.nextText),tn.setMentionMenuOpen(!1),Kr(he.nextCursor),(Ke=Vn.current)==null||Ke.focus(),Vn.current&&(Vn.current.style.height="auto",Vn.current.style.height=Math.min(Vn.current.scrollHeight,200)+"px")}function Rf(H){if(tn.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),tn.setMentionMenuOpen(!1);return}if(tn.mentionMenuOpen&&tn.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),tn.setMentionMenuIndex(he=>(he+1)%tn.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),tn.setMentionMenuIndex(he=>(he-1+tn.filteredPrompts.length)%tn.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),Vc(tn.filteredPrompts[tn.mentionMenuIndex]);return}}if(tn.mentionMenuOpen&&tn.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault();const he=o5(p),pt=(he.findIndex(st=>st.value===j)+1)%he.length;N(he[pt].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Sr())}function za(H){const he=i.trim(),Ke=he?`[${he}]: ${H}`:H;if(!$)return Ke;const pt=($.description??"").trim();return`${["Linear issue context:",`- Identifier: ${$.identifier}`,`- Title: ${$.title}`,$.stateName?`- State: ${$.stateName}`:"",$.priorityLabel?`- Priority: ${$.priorityLabel}`:"",$.teamName?`- Team: ${$.teamName}`:"",`- URL: ${$.url}`,pt?`- Description:
|
|
112
|
-
${pt}`:""].filter(Boolean).join(`
|
|
113
|
-
`)}
|
|
114
|
-
|
|
115
|
-
User request:
|
|
116
|
-
${Ke}`}async function Sr(){const H=e.trim();if(!(!H||Q)){if(n&&!i.trim()){A("Please enter your name before starting a session.");return}if(D(!0),A(""),qn(""),Bn){const he=_r||Bn.currentBranch;if(he&&he===Bn.currentBranch){const Ke=Vl.find(pt=>pt.name===he&&!pt.isRemote);if(Ke&&Ke.behind>0){Bs({behind:Ke.behind,branchName:he});return}}}await Ki(H)}}async function Ki(H,he){const Ke=Y.getState();Ke.clearCreation(),Ke.setSessionCreating(!0,p);try{Yl&&Gm(Yl);const pt=(he==null?void 0:he.resumeSessionAt)||(Ma?Ql:void 0),st=pt?(he==null?void 0:he.forkSession)??(Ma?Fr:void 0):void 0,He=(he==null?void 0:he.cwd)||C,Pn=(he==null?void 0:he.branch)!==void 0?he.branch.trim()||void 0:_r.trim()||void 0,vn=(he==null?void 0:he.useWorktree)!==void 0?he.useWorktree:Hl,jr=(he==null?void 0:he.createBranch)!==void 0?he.createBranch:!!(Pn&&wn),mi=await SE({model:y,permissionMode:j,effort:p==="claude"&&k?k:void 0,cwd:He||void 0,envSlug:Ee||void 0,sandboxEnabled:_t?!0:void 0,sandboxSlug:_t&&nt?nt:void 0,branch:Pn,createBranch:jr?!0:void 0,useWorktree:vn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:pt,forkSession:st,userName:i.trim()||void 0,linearConnectionId:$&&ae||void 0,linearIssue:$?{identifier:$.identifier,title:$.title,stateName:$.stateName,teamName:$.teamName,url:$.url}:void 0},ei=>{Y.getState().addCreationProgress(ei)}),bn=mi.sessionId,Qc=Y.getState(),Kl=Qc.sdkSessions.filter(ei=>ei.sessionId!==bn);Qc.setSdkSessions([...Kl,{sessionId:bn,state:mi.state,cwd:mi.cwd,createdAt:Date.now(),backendType:mi.backendType||p,model:y,permissionMode:j,userName:i.trim()||void 0,resumeSessionAt:pt,forkSession:pt?st===!0:void 0}]);const Zl=new Set(Y.getState().sessionNames.values()),Is=C5(Zl),Hs=o.trim()||i.trim(),Wc=f.trim()||Is,Xc=Hs?`${Hs}_${Wc}`:Wc;Y.getState().setSessionName(bn,Xc),Ne.renameSession(bn,Xc).catch(()=>{}),h(""),He&&XS(He),Y.getState().setPreviousPermissionMode(bn,j),px(bn,!0),zc(bn),await UC(bn);const Kc=H.trim();if(Kc.length>0){const ei=za(Kc),Zc=Hm(),Jc=z.length>0?z.map(Pa=>({name:Pa.name,media_type:Pa.mediaType,data:Pa.base64,size:Pa.size})):void 0;Cn(bn,{type:"user_message",content:ei,session_id:bn,attachments:Jc,client_msg_id:Zc}),Y.getState().appendMessage(bn,{id:Zc,role:"user",content:ei,attachments:Jc,timestamp:Date.now()})}$&&(Ne.linkLinearIssue(bn,$,ae||void 0).then(()=>Y.getState().setLinkedLinearIssue(bn,$)).catch(()=>{}),Ne.transitionLinearIssue($.id,ae||void 0).catch(()=>{})),Y.getState().clearCreation()}catch(pt){const st=pt instanceof Error?pt.message:String(pt);A(st),Y.getState().setCreationError(st),D(!1)}}async function Oa(H,he){Q||(D(!0),A(""),qn(""),O(H.cwd),ql(!1),sr(!1),Xt(H.gitBranch||""),Wr(H.resumeSessionId),Ur(he),await Ki("",{resumeSessionAt:H.resumeSessionId,forkSession:he,cwd:H.cwd,branch:H.gitBranch,useWorktree:!1,createBranch:!1}))}async function Zi(){if(Os){Yi(!0),qn("");try{const H=C||(Bn==null?void 0:Bn.repoRoot);if(!H)throw new Error("No working directory");const he=await Ne.gitPull(H);if(!he.success){qn(he.output||"Pull failed"),Yi(!1),D(!1);return}Bs(null),Yi(!1),await Ki(e.trim())}catch(H){qn(H instanceof Error?H.message:String(H)),Yi(!1)}}}function Ji(){const H=e.trim();Bs(null),qn(""),Ki(H)}function Gc(){Bs(null),qn(""),D(!1)}const Xl=S.useCallback((H,he)=>{Xt(H),sr(he)},[]),Yc=S.useCallback((H,he)=>{Xt(H),sr(he)},[]),Us=S.useCallback(H=>{Tf(H)},[]),kr=S.useCallback(H=>{ie(H),!H&&Bn&&(Xt(Bn.currentBranch),sr(!1))},[Bn]),Ba=e.trim().length>0&&!Q&&(!n||i.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:Gn,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:i,onChange:H=>{const he=H.target.value;a(he),localStorage.setItem("cc-user-name",he)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:o,onChange:H=>{const he=H.target.value;u(he),localStorage.setItem("cc-session-prefix",he)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:f,onChange:H=>h(H.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[o.trim()||i.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:we,type:"file",multiple:!0,onChange:Xi,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(qS,{open:tn.mentionMenuOpen,loading:tn.promptsLoading,prompts:tn.filteredPrompts,selectedIndex:tn.mentionMenuIndex,onSelect:Vc,menuRef:tn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),($||z.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[$&&l.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:$.identifier}),l.jsx("span",{className:"truncate",children:$.title}),l.jsx("button",{type:"button",onClick:()=>kr(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:"×"})]}),z.map((H,he)=>l.jsx(LS,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>Mf(he),className:"w-10 h-10"},he))]}),V&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:V}),l.jsx("textarea",{ref:Vn,value:e,onChange:qc,onKeyDown:Rf,onClick:Da,onKeyUp:Da,onPaste:Hc,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:Ta,children:[l.jsxs("button",{onClick:()=>me(!W),"aria-expanded":W,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:$s.icon}),l.jsx("span",{children:$s.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),W&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:M.map(H=>l.jsxs("button",{onClick:()=>{_(H.value),me(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${H.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:H.icon}),H.label]},H.value))})]}),_e.length>0&&l.jsxs("div",{className:"relative",ref:Zr,children:[l.jsxs("button",{onClick:()=>it(!rt),"aria-expanded":rt,"aria-label":"Reasoning effort",title:"Reasoning effort",className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:Hr.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),rt&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:_e.map(H=>l.jsx("button",{onClick:()=>{E(H.value),localStorage.setItem("cc-effort",H.value),it(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:Ir,children:[l.jsxs("button",{onClick:()=>We(!Re),"aria-expanded":Re,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Aa.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Re&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:pe.map(H=>l.jsx("button",{onClick:()=>{N(H.value),We(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>xn(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Uc})]}),St&&l.jsx(TL,{initialPath:C||"",onSelect:H=>{O(H)},onClose:()=>xn(!1)})]}),l.jsx(DL,{cwd:C,gitRepoInfo:Bn,selectedBranch:_r,isNewBranch:wn,useWorktree:Hl,onBranchChange:Xl,onWorktreeChange:ql,onBranchesLoaded:Us}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:Gl,children:[l.jsxs("button",{onClick:()=>{Je||Ne.listEnvs().then(De).catch(()=>{}),jt(!Je)},"aria-expanded":Je,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Ee?((es=Ce.find(H=>H.slug===Ee))==null?void 0:es.name)||"Env":"No env"})]}),Je&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{Be(""),localStorage.setItem("cc-selected-env",""),jt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ee?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),Ce.map(H=>l.jsxs("button",{onClick:()=>{Be(H.slug),localStorage.setItem("cc-selected-env",H.slug),jt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${H.slug===Ee?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:H.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(H.variables).length," var",Object.keys(H.variables).length!==1?"s":""]})]},H.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{gt(!0),jt(!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..."})})]})]}),xt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var H;return(H=we.current)==null?void 0:H.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:Sr,disabled:!Ba,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Ba?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[x.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:x.map(H=>l.jsxs("button",{onClick:()=>H.available&&Af(H.id),disabled:!H.available,title:H.available?H.name:`${H.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${H.available?p===H.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[H.name,!H.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},H.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>ir(H=>!H),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${et?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":et,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${et?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":et?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!et||void 0,children:l.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void La(),disabled:be,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:be?"Refreshing...":"Refresh detected sessions"}),te.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",Fs.length," of ",ln.length," ",wr?"matching":Wi?"recent":"detected"," Claude session",ln.length!==1?"s":"","."]}),!Tn&&Ra>0&&Jr.length>0&&l.jsxs("button",{type:"button",onClick:()=>{Ft(!0),yr(fa)},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 (",Ra,")"]}),Tn&&Jr.length>0&&l.jsx("button",{type:"button",onClick:()=>{Ft(!1),yr(fa)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:Ea,onChange:H=>Il(H.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),$t&&l.jsx("p",{className:"text-[11px] text-cc-error",children:$t}),!be&&!$t&&ln.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:wr?"No sessions match this search.":"No Claude sessions detected yet."}),Fs.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:Fs.map(H=>{const he=g5(H),Ke=Hg(H.cwd),pt=H.source==="companion"?"Companion":"Claude",st=Ql===H.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${st?"text-cc-primary font-medium":"text-cc-fg"}`,children:he}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:BL(H.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:pt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:H.cwd,children:[l.jsx("div",{className:"truncate",children:Ke}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:H.cwd,children:PL(H.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:H.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:$L(H.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{Wr(H.resumeSessionId),Ur(!0),Oa(H,!0)},"aria-label":`Fork and open ${he}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${st&&Fr?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
|
|
117
|
-
${H.cwd}${H.gitBranch?` (${H.gitBranch})`:""}
|
|
118
|
-
${H.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{Wr(H.resumeSessionId),Ur(!1),Oa(H,!1)},"aria-label":`Continue and open ${he}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${st&&!Fr?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
|
|
119
|
-
${H.resumeSessionId}`,children:"Continue"})]})]},`${H.resumeSessionId}-row-${H.sessionId}`)})}),Ic&&l.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:l.jsxs("button",{type:"button",onClick:()=>yr(H=>Math.min(H+OL,ln.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 (",ln.length-On," remaining)"]})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),B&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{K(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx(LL,{cwd:C,gitRepoInfo:Bn,linearConfigured:G,selectedLinearIssue:$,onIssueSelect:kr,onBranchFromIssue:Yc,onConnectionSelect:R})]}),Os&&l.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[l.jsx("span",{className:"font-mono-code font-medium",children:Os.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Os.behind," commit",Os.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),pi&&l.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:pi}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Gc,disabled:Xr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:Ji,disabled:Xr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),l.jsx("button",{onClick:Zi,disabled:Xr,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:Xr?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),I&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:I})]})]}),dt&&l.jsx(KS,{onClose:()=>{gt(!1),Ne.listEnvs().then(De).catch(()=>{})}})]})}const UL=[],IL=[],HL={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"}},qL={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function VL({server:e,sessionId:t}){var f,h;const[n,i]=S.useState(!1),a=HL[e.status]||qL,o=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>IC(t,e.name,!o),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${o?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:o?"Disable server":"Enable server",children:o?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>HC(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,m])=>m).map(([m])=>m).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function GL({sessionId:e,onDone:t}){const[n,i]=S.useState(""),[a,o]=S.useState("stdio"),[u,f]=S.useState(""),[h,p]=S.useState(""),[m,x]=S.useState(""),b=n.trim()&&(a==="stdio"?u.trim():m.trim());function y(_){if(_.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=m.trim(),qC(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:y,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>o(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.jsx("input",{type:"text",value:m,onChange:_=>x(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.jsx("button",{type:"submit",disabled:!b,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${b?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),l.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function YL({sessionId:e}){const t=Y(f=>f.mcpServers.get(e)||UL),n=Y(f=>f.cliConnected.get(e)??!1),[i,a]=S.useState(!1),o=Y(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??IL});S.useEffect(()=>{n&&Vb(e)},[e,n]);const u=t.length>0?t:o.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>Vb(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(GL,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>l.jsx(VL,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function QL({cwd:e,open:t,onClose:n}){var I;const[i,a]=S.useState([]),[o,u]=S.useState(!0),[f,h]=S.useState(0),[p,m]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(!1),[j,N]=S.useState(null),[k,E]=S.useState(null),C=S.useCallback(()=>{u(!0),N(null),Ne.getClaudeMdFiles(e).then(A=>{a(A.files),A.files.length>0&&(h(0),m(A.files[0].content)),E(null),b(!1),u(!1)}).catch(A=>{N(A.message),u(!1)})},[e]);S.useEffect(()=>{t&&C()},[t,C]);const O=A=>{x&&!confirm("Discard unsaved changes?")||(h(A),m(i[A].content),b(!1),E(null))},z=async()=>{var se;const A=k||((se=i[f])==null?void 0:se.path);if(A){_(!0),N(null);try{await Ne.saveClaudeMd(A,p),b(!1),k?C():a(Z=>Z.map((G,P)=>P===f?{...G,content:p}:G))}catch(Z){N(Z instanceof Error?Z.message:"Failed to save")}finally{_(!1)}}},L=A=>{const se=A==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;E(se),m(`# CLAUDE.md
|
|
120
|
-
|
|
121
|
-
`),b(!0)},V=()=>{x&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const F=A=>A.startsWith(e+"/")?A.slice(e.length+1):A,Q=i.some(A=>A.path===`${e}/CLAUDE.md`),D=i.some(A=>A.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:V}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),l.jsx("button",{onClick:V,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 flex min-h-0",children:o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((A,se)=>l.jsxs("button",{onClick:()=>O(se),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!k&&f===se?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})}),l.jsx("span",{className:"truncate font-mono-code",children:F(A.path)})]},A.path)),k&&l.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"truncate font-mono-code",children:F(k)})]})]}),(!Q||!D)&&!k&&l.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!Q&&l.jsxs("button",{onClick:()=>L("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!D&&l.jsxs("button",{onClick:()=>L("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!k?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>L("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),l.jsx("button",{onClick:()=>L("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:F(k||(((I=i[f])==null?void 0:I.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[x&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:z,disabled:!x||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${x&&!y?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:y?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:p,onChange:A=>{m(A.target.value),b(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),j&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:j})]})]})})]})]})}function x5({icon:e,title:t,expanded:n,onToggle:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function Li({label:e,sublabel:t,count:n,onClick:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&l.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function WL({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:l.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function XL({path:e,label:t,onClose:n}){const[i,a]=S.useState(""),[o,u]=S.useState(!0),[f,h]=S.useState(!1),[p,m]=S.useState(!1),[x,b]=S.useState(null);S.useEffect(()=>{Ne.readFile(e).then(j=>{a(j.content),u(!1)}).catch(j=>{b(j instanceof Error?j.message:"Failed to read file"),u(!1)})},[e]);const y=async()=>{m(!0),b(null);try{await Ne.writeFile(e,i),h(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{m(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[f&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!f||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${f&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:i,onChange:j=>{a(j.target.value),h(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),x&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:x})]})]})}function KL({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=S.useState(null),[o,u]=S.useState(!0);return S.useEffect(()=>{Ne.readFile(e.path).then(f=>{a(f.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(WL,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx(QL,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(XL,{path:e.path,label:e.label,onClose:n})}function ZL({sessionId:e}){const t=Y(k=>k.sessions.get(e)),n=Y(k=>k.sdkSessions.find(E=>E.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=S.useState(null),[u,f]=S.useState(!0),[h,p]=S.useState(!1),[m,x]=S.useState(!1),[b,y]=S.useState(null),_=S.useCallback(async()=>{if(i)try{const k=await Ne.getClaudeConfig(i);o(k)}catch{}finally{f(!1)}},[i]);if(S.useEffect(()=>{_()},[_]),!i)return null;if(u)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!a)return null;const j=a.project.claudeMd.length+(a.project.settings?1:0)+(a.project.settingsLocal?1:0)+a.project.commands.length,N=(a.user.claudeMd?1:0)+a.user.skills.length+a.user.agents.length+(a.user.settings?1:0)+a.user.commands.length;return l.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[l.jsx(x5,{icon:"project",title:`Project (${j})`,expanded:h,onToggle:()=>p(k=>!k)}),h&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(k=>l.jsx(Li,{label:k.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:k.path,kind:"claude-md"})},k.path)),a.project.settings&&l.jsx(Li,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(Li,{label:"settings.local.json",onClick:()=>y({label:"settings.local.json",path:a.project.settingsLocal.path,kind:"json"})}),a.project.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.project.commands.length,")"]}),a.project.commands.map(k=>l.jsx(Li,{label:`/${k.name}`,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),j===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(x5,{icon:"user",title:`User (${N})`,expanded:m,onToggle:()=>x(k=>!k)}),m&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(Li,{label:"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:a.user.claudeMd.path,kind:"claude-md",editorCwd:a.user.root})}),a.user.skills.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",a.user.skills.length,")"]}),a.user.skills.map(k=>l.jsx(Li,{label:k.name,sublabel:k.description?k.description.slice(0,40):void 0,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),a.user.agents.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",a.user.agents.length,")"]}),a.user.agents.map(k=>l.jsx(Li,{label:k.name,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),a.user.settings&&l.jsx(Li,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.user.settings.path,kind:"json"})}),a.user.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.user.commands.length,")"]}),a.user.commands.map(k=>l.jsx(Li,{label:`/${k.name}`,onClick:()=>y({label:k.name,path:k.path,kind:"md"})},k.path))]}),N===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),b&&$l.createPortal(l.jsx(KL,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function JL(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class eD extends S.Component{constructor(){super(...arguments);hb(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Rs(n,{section:this.props.label})}render(){return this.state.hasError?l.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),l.jsx("button",{className:"text-[10px] text-cc-muted hover:text-cc-fg px-2 py-0.5 rounded bg-cc-hover cursor-pointer",onClick:()=>this.setState({hasError:!1}),children:"Retry"})]})}):this.props.children}}const ZS=[],$x=3e4,tD=6e4;let v5=null,b5=new Map;function nD(e){return e!==v5&&(v5=e,b5=new Map(e.map(t=>[t.sessionId,t]))),b5}function Fc(e){return Y(S.useCallback(t=>nD(t.sdkSessions).get(e),[e]))}const JS="cc-panel-collapsed";function y5(){try{const e=localStorage.getItem(JS);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function rD(e){try{localStorage.setItem(JS,JSON.stringify([...e]))}catch{}}function ek({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[o,u]=S.useState(()=>y5().has(e)?!0:!i),f=S.useRef(!0);S.useEffect(()=>{if(f.current){f.current=!1;return}const p=y5();o?p.add(e):p.delete(e),rD(p)},[o,e]);const h=S.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:h,"aria-expanded":!o,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function iD(){const[e,t]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=S.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(ek,{id:"identity",label:"Identity",children:l.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),l.jsx("input",{type:"text",value:e,onChange:a=>{const o=a.target.value;t(o),localStorage.setItem("cc-user-name",o)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),l.jsx("input",{type:"text",value:n,onChange:a=>{const o=a.target.value;i(o),localStorage.setItem("cc-session-prefix",o)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",l.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",l.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function tk(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function nk(e){return e>80?"critical":e>50?"elevated":"normal"}function Na({label:e,pct:t,detail:n}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&l.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),l.jsx("div",{role:"meter","aria-label":`${e} usage — ${nk(t)}`,"aria-valuenow":Math.round(t),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${tk(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function sD({sessionId:e}){var h;const[t,n]=S.useState(null),i=S.useCallback(async()=>{try{const p=await Ne.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=S.useRef(0);if(S.useEffect(()=>{i();const p=setInterval(()=>{a.current+=1,a.current%2===0?i():n(m=>m?{...m}:null)},$x);return()=>clearInterval(p)},[i]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,f=!o&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!o&&!u&&!f?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(Na,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?r5(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(Na,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?r5(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&l.jsx("div",{role:"meter","aria-label":`Extra usage — ${nk(t.extra_usage.utilization)}`,"aria-valuenow":Math.round(t.extra_usage.utilization),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${tk(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function _5(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function aD(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await Ne.getSystemMemory();i||n(u)}catch{}};a();const o=setInterval(a,tD);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(Na,{label:"Memory",pct:t.used_percent,detail:`${_5(t.used_bytes)} / ${_5(t.total_bytes)}`})}):null}function lD({sessionId:e}){const t=Y(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=S.useState(0);if(S.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),$x);return()=>clearInterval(o)},[t]),!t)return null;const{primary:i,secondary:a}=t;return!i&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&l.jsx(Na,{label:`${i5(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?Ig(i.resetsAt):void 0}),a&&l.jsx(Na,{label:`${i5(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?Ig(a.resetsAt):void 0})]})}function oD({sessionId:e}){const t=Y(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=Y(i=>{var a;return((a=i.sessions.get(e))==null?void 0:a.context_used_percent)??0});return t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:oc(t.inputTokens)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:oc(t.outputTokens)})]}),t.cachedInputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:oc(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:oc(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(Na,{label:"Context",pct:n})]}):null}function cD(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 uD({pr:e}){const t=cD(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&l.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),l.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&l.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[l.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),l.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),l.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function dD({sessionId:e}){const t=Y(u=>u.sessions.get(e)),n=Fc(e),i=Y(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),o=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return S.useEffect(()=>{i||!a||!o||Ne.getPRStatus(a,o).then(u=>{Y.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(uD,{pr:i.pr})}const fD=6e4;function Om(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 hD({sessionId:e}){const t=Y(A=>A.linkedLinearIssues.get(e)),[n,i]=S.useState([]),[a,o]=S.useState(null),[u,f]=S.useState([]),[h,p]=S.useState(""),[m,x]=S.useState(!1),[b,y]=S.useState(!1),[_,j]=S.useState(!1),[N,k]=S.useState(""),[E,C]=S.useState([]),[O,z]=S.useState(!1),L=S.useRef(null);S.useEffect(()=>{Ne.getLinkedLinearIssue(e).then(A=>{A.issue&&Y.getState().setLinkedLinearIssue(e,A.issue)}).catch(()=>{})},[e]);const V=S.useCallback(async()=>{if(t)try{const A=await Ne.getLinkedLinearIssue(e,!0);A.issue&&(Y.getState().setLinkedLinearIssue(e,A.issue),A.issue.stateType==="completed"&&y(!0)),A.comments&&i(A.comments),A.assignee!==void 0&&o(A.assignee??null),A.labels&&f(A.labels)}catch{}},[e,t]);S.useEffect(()=>{if(!t)return;V();const A=setInterval(V,fD);return()=>clearInterval(A)},[V,t]),S.useEffect(()=>{if(!_)return;const A=N.trim();if(A.length<2){C([]);return}let se=!0;z(!0);const Z=setTimeout(()=>{Ne.searchLinearIssues(A,6).then(G=>{se&&C(G.issues)}).catch(()=>{se&&C([])}).finally(()=>{se&&z(!1)})},400);return()=>{se=!1,clearTimeout(Z)}},[N,_]),S.useEffect(()=>{_&&setTimeout(()=>{var A;return(A=L.current)==null?void 0:A.focus()},50)},[_]);async function F(){if(!(!t||!h.trim()||m)){x(!0);try{const A=await Ne.addLinearComment(t.id,h.trim());i(se=>[...se,A.comment]),p("")}catch{}finally{x(!1)}}}async function Q(){try{await Ne.unlinkLinearIssue(e),Y.getState().setLinkedLinearIssue(e,null),i([]),o(null),f([]),y(!1)}catch{}}async function D(A){try{await Ne.linkLinearIssue(e,A),Y.getState().setLinkedLinearIssue(e,A),j(!1),k(""),C([])}catch{}}if(!t)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(yc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:L,type:"text",value:N,onChange:A=>k(A.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),k(""),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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),O&&l.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),E.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:E.map(A=>l.jsxs("button",{onClick:()=>D(A),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:A.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${Om(A.stateType,A.stateName).cls}`,children:Om(A.stateType,A.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:A.title})]},A.id))}),N.trim().length>=2&&!O&&E.length===0&&l.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):l.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[l.jsx(yc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const I=Om(t.stateType,t.stateName);return l.jsxs("div",{className:"shrink-0",children:[l.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(yc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${I.cls}`,children:I.label}),l.jsx("button",{onClick:Q,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(A=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.id))})]}),b&&t.stateType==="completed"&&l.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:()=>y(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),l.jsx("button",{onClick:async()=>{try{await Ne.archiveSession(e),Y.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(A=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:A.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:JL(new Date(A.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:A.body})]},A.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:h,onChange:A=>p(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),F())},placeholder:"Add a comment...","aria-label":"Add a comment",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:F,disabled:!h.trim()||m,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function pD({sessionId:e}){const t=Y(u=>u.rateLimit.get(e)),[,n]=S.useState(0);if(S.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(f=>f+1),$x);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const i=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?Ig(t.resetsAt):void 0;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2","data-testid":"claude-rate-limit",children:[a!==void 0?l.jsx(Na,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:o}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${i?"text-cc-error":"text-cc-warning"}`,children:[i?"rate limited":t.status,o&&` · resets ${o}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function mD({sessionId:e}){const t=Y(a=>a.sessions.get(e)),n=Fc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(lD,{sessionId:e}),l.jsx(oD,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(pD,{sessionId:e}),l.jsx(sD,{sessionId:e})]})}function gD({sessionId:e}){const t=Y(p=>p.sessions.get(e)),n=Fc(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,o=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,f=(t==null?void 0:t.total_lines_removed)||0,h=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(a>0||o>0||u>0||f>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),o>0&&l.jsxs("span",{className:"text-cc-warning",children:[o,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&l.jsxs("span",{className:"text-cc-error",children:["-",f,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&h&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{Ne.gitPull(h).then(p=>{Y.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Rs(new Error(`git pull failed: ${p.output}`))}).catch(p=>Rs(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function xD({sessionId:e}){const t=Y(o=>o.sessionTasks.get(e)||ZS),n=Y(o=>o.sessions.get(e)),i=Fc(e),a=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||a?null:l.jsx("div",{className:"px-3 py-2",children:t.length===0?l.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):l.jsx("div",{className:"space-y-0.5",children:t.map(o=>l.jsx(SD,{task:o},o.id))})})}const vD={"usage-limits":mD,"server-memory":aD,"git-branch":gD,"github-pr":dD,"linear-issue":hD,"mcp-servers":YL,tasks:xD};function bD(e,t){const n=Y(i=>i.sessionTasks.get(t)||ZS);if(e==="tasks"&&n.length>0){const i=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function yD({isCodex:e}){const t=Y(p=>p.taskPanelConfig),n=Y(p=>p.toggleSectionEnabled),i=Y(p=>p.moveSectionUp),a=Y(p=>p.moveSectionDown),o=Y(p=>p.resetTaskPanelConfig),u=Y(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const m=Vi.find(x=>x.id===p);return!(!m||m.backends&&!m.backends.includes(f))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((p,m)=>{const x=Vi.find(j=>j.id===p),b=t.enabled[p]??!0,y=m===0,_=m===h.length-1;return l.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${b?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[l.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>i(p),disabled:y,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),l.jsx("button",{onClick:()=>a(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:x.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:x.description})]}),l.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${b?"bg-cc-primary":"bg-cc-hover"}`,title:b?"Hide section":"Show section",role:"switch","aria-checked":b,"data-testid":`toggle-${p}`,children:l.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${b?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),l.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[l.jsx("button",{onClick:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function _D({sectionId:e,sessionId:t,children:n}){var o;const i=((o=Vi.find(u=>u.id===e))==null?void 0:o.label)??e,a=bD(e,t);return l.jsx(ek,{id:e,label:i,badge:a,children:n})}function wD({sessionId:e}){const t=Y(m=>m.sessions.get(e)),n=Fc(e),i=Y(m=>m.taskPanelOpen),a=Y(m=>m.setTaskPanelOpen),o=Y(m=>m.taskPanelConfigMode),u=Y(m=>m.taskPanelConfig);if(!i)return null;const f=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",h=f?"codex":"claude",p=u.order.filter(m=>{const x=Vi.find(b=>b.id===m);return!(!x||x.backends&&!x.backends.includes(h))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:o?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{o?Y.getState().setTaskPanelConfigMode(!1):a(!1)},"aria-label":"Close panel",className:"flex items-center justify-center w-8 h-8 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),o?l.jsx(yD,{isCodex:f}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[l.jsx(iD,{}),l.jsx(ZL,{sessionId:e}),p.filter(m=>u.enabled[m]!==!1).map(m=>{var b;const x=vD[m];return x?l.jsx(_D,{sectionId:m,sessionId:e,children:l.jsx(eD,{label:(b=Vi.find(y=>y.id===m))==null?void 0:b.label,children:l.jsx(x,{sessionId:e})})},m):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>Y.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M7.429 1.525a6.593 6.593 0 011.142 0c.036.003.108.036.137.146l.289 1.105c.147.56.55.967.997 1.189.174.086.341.183.501.29.417.278.97.423 1.53.27l1.102-.303c.11-.03.175.016.195.046.219.31.41.641.573.989.014.031.022.11-.059.19l-.815.806c-.411.406-.562.957-.53 1.456a4.588 4.588 0 010 .582c-.032.499.119 1.05.53 1.456l.815.806c.08.08.073.159.059.19a6.494 6.494 0 01-.573.99c-.02.029-.086.074-.195.045l-1.103-.303c-.559-.153-1.112-.008-1.529.27-.16.107-.327.204-.5.29-.449.222-.851.628-.998 1.189l-.289 1.105c-.029.11-.101.143-.137.146a6.613 6.613 0 01-1.142 0c-.036-.003-.108-.037-.137-.146l-.289-1.105c-.147-.56-.55-.967-.997-1.189a4.502 4.502 0 01-.501-.29c-.417-.278-.97-.423-1.53-.27l-1.102.303c-.11.03-.175-.016-.195-.046a6.492 6.492 0 01-.573-.989c-.014-.031-.022-.11.059-.19l.815-.806c.411-.406.562-.957.53-1.456a4.587 4.587 0 010-.582c.032-.499-.119-1.05-.53-1.456l-.815-.806c-.08-.08-.073-.159-.059-.19a6.44 6.44 0 01.573-.99c.02-.029.086-.074.195-.045l1.103.303c.559.153 1.112.008 1.529-.27.16-.107.327-.204.5-.29.449-.222.851-.628.998-1.189l.289-1.105c.029-.11.101-.143.137-.146zM8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",clipRule:"evenodd"})}),"Customize panel"]})})]})]})}function SD({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?l.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),l.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),l.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&l.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&l.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),l.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function kD({status:e}){return e==="created"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-green-500/20 text-green-400",children:"A"}):e==="deleted"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-red-500/20 text-red-400",children:"D"}):l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-cc-warning/20 text-cc-warning",children:"M"})}function jD({sessionId:e}){const t=Y(z=>z.sessions.get(e)),n=Y(z=>z.sdkSessions.find(L=>L.sessionId===e)),i=Y(z=>z.diffPanelSelectedFile.get(e)??null),a=Y(z=>z.setDiffPanelSelectedFile),o=Y(z=>z.diffBase),u=Y(z=>z.setDiffBase),f=Y(z=>z.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,m]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=S.useState([]),k=Y(z=>z.setGitChangedFilesCount);S.useEffect(()=>{if(!h)return;let z=!1;return Ne.getChangedFiles(h,o).then(({files:L})=>{if(z)return;const V=`${h}/`,F=L.filter(Q=>Q.path===h||Q.path.startsWith(V)).map(Q=>({abs:Q.path,rel:Q.path.startsWith(V)?Q.path.slice(V.length):Q.path,status:Q.status==="A"||Q.status==="?"?"created":Q.status==="D"?"deleted":"updated"})).sort((Q,D)=>Q.rel.localeCompare(D.rel));N(F),k(e,F.length)}).catch(()=>{z||(N([]),k(e,0))}),()=>{z=!0}},[h,o,f,e,k]);const E=j;S.useEffect(()=>{!i&&E.length>0&&a(e,E[0].abs)},[i,E,e,a]),S.useEffect(()=>{var z;i&&(E.some(L=>L.abs===i)||a(e,((z=E[0])==null?void 0:z.abs)??null))},[i,E,e,a]),S.useEffect(()=>{if(!i){m("");return}let z=!1;return b(!0),Ne.getFileDiff(i,o).then(L=>{z||(m(L.diff),b(!1))}).catch(()=>{z||(m(""),b(!1))}),()=>{z=!0}},[i,o]);const C=S.useCallback(z=>{a(e,z),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),O=S.useMemo(()=>!i||!h?i:i.startsWith(h+"/")?i.slice(h.length+1):i,[i,h]);return h?E.length===0?l.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:l.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"File changes compared to the base will appear here once the agent edits files."})]})]}):l.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[y&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),l.jsxs("div",{className:`
|
|
122
|
-
${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
123
|
-
fixed sm:relative z-30 sm:z-auto
|
|
124
|
-
${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
125
|
-
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
126
|
-
`,children:[l.jsxs("div",{className:"w-[220px] px-4 py-3 text-[11px] font-semibold text-cc-fg uppercase tracking-wider border-b border-cc-border shrink-0 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),l.jsxs("span",{children:["Changed (",E.length,")"]})]}),l.jsx("button",{onClick:()=>_(!1),className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer sm:hidden",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:E.map(({abs:z,rel:L,status:V})=>l.jsxs("button",{onClick:()=>C(z),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 ${z===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(kD,{status:V}),l.jsx("span",{className:"truncate leading-snug",children:L})]},z))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&l.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!y&&l.jsx("button",{onClick:()=>_(!0),className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",title:"Show file list",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:O==null?void 0:O.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:O})]}),l.jsx("button",{onClick:()=>u(o==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${o==="last-commit"?"default branch":"last commit"} comparison`,children:o==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:x?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?l.jsx("div",{className:"p-4",children:l.jsx(Bl,{unifiedDiff:p,fileName:O||void 0,mode:"full"})}):l.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!y&&l.jsxs("button",{onClick:()=>_(!0),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),"Show file list"]}),l.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:l.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function ND(){const e=Y(h=>h.updateInfo),t=Y(h=>h.updateDismissedVersion),n=Y(h=>h.dismissUpdate),[i,a]=S.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const o=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await Ne.triggerUpdate(),Y.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),Rs(h),a(!1)}},u=()=>{n(e.latestVersion)},f=i||e.updateInProgress;return l.jsxs("div",{className:"px-4 py-1.5 bg-cc-primary/10 border-b border-cc-primary/20 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.2s_ease-out]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 2a.75.75 0 0 0-.75.75v3.69L5.78 6.15a.75.75 0 0 0-.96 1.15l2.5 2.08a.75.75 0 0 0 1.08-.12l2-2.5a.75.75 0 1 0-1.17-.94L8.75 6.5V3.75A.75.75 0 0 0 8 3z"})}),l.jsxs("span",{className:"text-xs text-cc-fg",children:[l.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",l.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?l.jsx("button",{onClick:o,disabled:f,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Updating...":"Update & Restart"}):l.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",l.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," ","for auto-updates"]}),l.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function CD({steps:e,error:t,backend:n,onCancel:i}){const a=n==="codex"?"/logo-codex.svg":"/logo.svg",o=e.some(x=>x.status==="in_progress"),u=e.length>0&&e.every(x=>x.status==="done"),f=e.some(x=>x.status==="error")||!!t,h=[...e].reverse().find(x=>x.status==="in_progress"),p=[...e].reverse().find(x=>x.status==="done"),m=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.label)||(p==null?void 0:p.label)||"Preparing...";return l.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-cc-bg/95 backdrop-blur-sm animate-fade-in",children:[l.jsxs("div",{className:"relative mb-8",children:[o&&!f&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:a,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${o&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),o&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:m}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((x,b)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${b*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[x.status==="in_progress"&&l.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),x.status==="done"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:l.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),x.status==="error"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.jsx("span",{className:`text-xs transition-colors duration-200 ${x.status==="in_progress"?"text-cc-fg font-medium":x.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:x.label}),x.detail&&x.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:x.detail})]},x.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(f||o)&&i&&l.jsx("button",{onClick:i,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:f?"Dismiss":"Cancel"}),!f&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(x=>x.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function ED(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const TD={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function AD(e){const[t,n]=S.useState("installing"),i=S.useRef(null),a=S.useRef(!0);return S.useEffect(()=>(a.current=!0,()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[]),S.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),f()},5e3);function f(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:ED()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(f,1500)})}return()=>{clearTimeout(o),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function rk({phase:e,className:t}){const n=e==="ready";return l.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[l.jsxs("div",{className:"relative mb-8",children:[!n&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),n&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),l.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:TD[e]}),l.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&l.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>l.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${i*.2}s`}},i))}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-1000 ease-out",style:{width:n?"100%":e==="waiting"?"75%":e==="restarting"?"40%":"15%"}})})]})}function MD({active:e}){const t=AD(e);return e?l.jsx(rk,{phase:t,className:"fixed inset-0 z-[100]"}):null}function oz({phase:e}){return l.jsx(rk,{phase:e,className:"absolute inset-0"})}function RD(){const e=Y(j=>j.dockerUpdateDialogOpen),t=Y(j=>j.setDockerUpdateDialogOpen),[n,i]=S.useState("prompt"),[a,o]=S.useState(!1),[u,f]=S.useState(null),h=S.useRef(null);if(S.useEffect(()=>{e&&Ne.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),S.useEffect(()=>{if(n!=="pulling"){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{Ne.getImageStatus("the-companion:latest").then(j=>{f(j),j.status==="ready"?i("done"):j.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function p(){i("pulling"),Ne.pullImage("the-companion:latest").then(j=>{j.state&&f(j.state)}).catch(()=>{i(j=>j==="pulling"?"error":j)})}function m(){p()}function x(){y()}function b(){y()}function y(){i("prompt"),f(null),t(!1)}async function _(){const j=!a;o(j);try{await Ne.updateSettings({dockerAutoUpdate:j})}catch{o(!j)}}return l.jsx("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-black/50 animate-fade-in","data-testid":"docker-update-dialog",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-md mx-4 overflow-hidden",children:[n==="prompt"&&l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("button",{type:"button",onClick:_,className:"w-full flex items-center justify-between px-3 py-3 rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer mb-5",children:[l.jsx("span",{children:"Always update Docker image automatically"}),l.jsx("span",{role:"switch","aria-checked":a,"aria-label":"Always update Docker image automatically",className:`relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ${a?"bg-cc-primary":"bg-cc-border"}`,children:l.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${a?"translate-x-4":"translate-x-0"}`})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:x,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),l.jsx("button",{type:"button",onClick:m,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-3",children:"Pulling the-companion:latest"}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[160px] overflow-auto whitespace-pre-wrap","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
|
|
127
|
-
`)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
|
|
128
|
-
`)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{type:"button",onClick:m,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 cz({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
|
|
129
|
-
Layer 1/5: abc123 downloading
|
|
130
|
-
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const Bm=["welcome","claude","codex","done"],w5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function qg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function LD({onComplete:e}){const[t,n]=S.useState("welcome"),[i,a]=S.useState(""),[o,u]=S.useState(""),[f,h]=S.useState(!1),[p,m]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(!1),[j,N]=S.useState(qg),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),S.useEffect(()=>{const I=k.current;if(!I)return;function A(Z){if(Z.key==="Escape"){Z.preventDefault();return}if(Z.key!=="Tab")return;const G=I.querySelectorAll(w5);if(G.length===0)return;const P=G[0],$=G[G.length-1];Z.shiftKey?document.activeElement===P&&(Z.preventDefault(),$.focus()):document.activeElement===$&&(Z.preventDefault(),P.focus())}document.addEventListener("keydown",A);const se=I.querySelector(w5);return se==null||se.focus(),()=>document.removeEventListener("keydown",A)},[t]);const E=S.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),m("");try{await Ne.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(I){m(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[i]),C=S.useCallback(async()=>{h(!0),m("");try{(await Ne.getSettings()).codexDeviceAuthConfigured?(_(!0),await z()):m("No Codex auth found. Run codex --login in your terminal first.")}catch(I){m(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),O=S.useCallback(async()=>{h(!0),m("");try{await Ne.updateSettings({openaiApiKey:o.trim()}),_(!0),await z()}catch(I){m(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[o]),z=S.useCallback(async()=>{try{await Ne.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=S.useCallback(()=>{e()},[e]),V=S.useCallback(async()=>{await z(),e()},[z,e]),F=S.useCallback(I=>{m(""),n(I)},[]),Q=Bm.indexOf(t),D=qg();return $l.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:j?1:0,transition:D?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:D?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${Q+1} of ${Bm.length-1}`,children:Bm.slice(0,3).map((I,A)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:A===Q?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:A<=Q?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:A<=Q?1:.5}},I))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(DD,{onSetupClaude:()=>F("claude"),onSetupCodex:()=>F("codex")}),t==="claude"&&l.jsx(zD,{token:i,onTokenChange:a,onSave:E,onSkip:()=>F("codex"),saving:f,error:p}),t==="codex"&&l.jsx(OD,{apiKey:o,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:O,onSkip:()=>z(),onBack:()=>F("claude"),saving:f,error:p}),t==="done"&&l.jsx(BD,{claudeConfigured:x,codexConfigured:y,onDone:L})]}),t==="welcome"&&l.jsx("button",{onClick:V,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 DD({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function zD({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(ik,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?f:void 0,"aria-invalid":o?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),o&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function OD({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:f}){const[h,p]=S.useState(!1),m="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(ik,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&l.jsxs("div",{id:m,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"sk-...","aria-describedby":f?m:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function BD({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=qg(),[o,u]=S.useState(a);return S.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function ik({text:e}){const[t,n]=S.useState(!1),i=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}function PD(e){return Y(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const $D=S.lazy(()=>Dn(()=>import("./Playground-BoyZfARc.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),FD=S.lazy(()=>Dn(()=>import("./SettingsPage-DBjt4SLp.js"),[]).then(e=>({default:e.SettingsPage}))),UD=S.lazy(()=>Dn(()=>import("./IntegrationsPage-DWrnBrBa.js"),[]).then(e=>({default:e.IntegrationsPage}))),ID=S.lazy(()=>Dn(()=>import("./LinearSettingsPage-CUV6wc7-.js"),[]).then(e=>({default:e.LinearSettingsPage}))),HD=S.lazy(()=>Dn(()=>import("./LinearOAuthSettingsPage-DZJpyUr3.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),qD=S.lazy(()=>Dn(()=>import("./TailscalePage-BaAGOCMu.js"),[]).then(e=>({default:e.TailscalePage}))),VD=S.lazy(()=>Dn(()=>import("./PromptsPage-D3aJBO9h.js"),[]).then(e=>({default:e.PromptsPage}))),GD=S.lazy(()=>Dn(()=>Promise.resolve().then(()=>CL),void 0).then(e=>({default:e.EnvManager}))),YD=S.lazy(()=>Dn(()=>import("./SandboxManager-_mggajaE.js"),[]).then(e=>({default:e.SandboxManager}))),QD=S.lazy(()=>Dn(()=>import("./CronManager-BxRWyTp3.js"),[]).then(e=>({default:e.CronManager}))),WD=S.lazy(()=>Dn(()=>import("./AgentsPage-DPt9YKyQ.js"),[]).then(e=>({default:e.AgentsPage}))),XD=S.lazy(()=>Dn(()=>import("./RunsPage-C6YY6SGq.js"),[]).then(e=>({default:e.RunsPage}))),KD=S.lazy(()=>Dn(()=>import("./DashboardPage-BSnJNNNL.js"),[]).then(e=>({default:e.DashboardPage}))),ZD=S.lazy(()=>Dn(()=>import("./MagicUIView-NSITfXce.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function Zn(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function JD(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function ez(){const e=Y(ae=>ae.isAuthenticated),t=Y(ae=>ae.darkMode),n=Y(ae=>ae.currentSessionId),i=Y(ae=>ae.sidebarOpen),a=Y(ae=>ae.taskPanelOpen),o=Y(ae=>ae.homeResetKey),u=Y(ae=>ae.activeTab),f=PD(n),h=Y(ae=>ae.sessionCreating),p=Y(ae=>ae.sessionCreatingBackend),m=Y(ae=>ae.creationProgress),x=Y(ae=>ae.creationError),b=Y(ae=>ae.updateOverlayActive),y=JD(),_=S.useMemo(()=>hx(y),[y]),j=_.page==="settings",N=_.page==="prompts",k=_.page==="integrations",E=_.page==="integration-linear",C=_.page==="integration-linear-oauth",O=_.page==="integration-tailscale",z=_.page==="environments",L=_.page==="sandboxes",V=_.page==="scheduled",F=_.page==="agents"||_.page==="agent-detail",Q=_.page==="runs",D=_.page==="dashboard",I=_.page==="session"||_.page==="home";S.useEffect(()=>{_E(y||"#/")},[y]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const A=S.useRef(Y.getState().currentSessionId);S.useEffect(()=>{if(A.current!==null&&_.page==="home"){px(A.current,!0),A.current=null;return}if(A.current=null,_.page==="session"){const ae=Y.getState();ae.currentSessionId!==_.sessionId&&ae.setCurrentSession(_.sessionId),zc(_.sessionId)}else if(_.page==="home"){const ae=Y.getState();ae.currentSessionId!==null&&ae.setCurrentSession(null)}},[_]);const se=Y(ae=>n?ae.changedFilesTick.get(n)??0:0),Z=Y(ae=>ae.diffBase),G=Y(ae=>ae.setGitChangedFilesCount),P=Y(ae=>{var R,B;return n&&(((R=ae.sessions.get(n))==null?void 0:R.cwd)||((B=ae.sdkSessions.find(K=>K.sessionId===n))==null?void 0:B.cwd))||null});S.useEffect(()=>{if(!n||!P)return;let ae=!1;return Ne.getChangedFiles(P,Z).then(({files:R})=>{if(ae)return;const B=`${P}/`,K=R.filter(M=>M.path===P||M.path.startsWith(B)).length;G(n,K)}).catch(()=>{}),()=>{ae=!0}},[n,P,Z,se,G]),S.useEffect(()=>{const ae=()=>{Ne.checkForUpdate().then(B=>{Y.getState().setUpdateInfo(B)}).catch(()=>{})};ae();const R=setInterval(ae,300*1e3);return()=>clearInterval(R)},[]),S.useEffect(()=>{const ae=()=>{Ne.getClaudeCompat().then(B=>{Y.getState().setClaudeCompatInfo(B)}).catch(()=>{})};ae();const R=setInterval(ae,300*1e3);return()=>clearInterval(R)},[]);const[$,ie]=S.useState(!1);return S.useEffect(()=>{e&&Ne.getSettings().then(ae=>{ae.publicUrl&&Y.getState().setPublicUrl(ae.publicUrl),Y.getState().setMagicUiAvailable(!!ae.magicUiEnabled&&!!ae.claudeCliAvailable),ae.onboardingCompleted||ie(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?_.page==="playground"?l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx($D,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>Y.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
131
|
-
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
132
|
-
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
133
|
-
${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
134
|
-
overflow-hidden
|
|
135
|
-
`,children:l.jsx(FE,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(SL,{}),l.jsx(ND,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[j&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(FD,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(VD,{embedded:!0})})}),k&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(UD,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(ID,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(HD,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(qD,{embedded:!0})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(GD,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(YD,{embedded:!0})})}),V&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(QD,{embedded:!0})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(WD,{route:_})})}),Q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(XD,{})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(KD,{})})}),I&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(jD,{sessionId:n}):f?l.jsx(S.Suspense,{fallback:l.jsx(Zn,{}),children:l.jsx(ZD,{sessionId:n})}):l.jsx(xL,{sessionId:n}):l.jsx(FL,{},o)}),h&&m&&m.length>0&&l.jsx(CD,{steps:m,error:x,backend:p??void 0,onCancel:()=>Y.getState().clearCreation()})]})]})]}),n&&I&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>Y.getState().setTaskPanelOpen(!0),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 z-30 items-center gap-1 rounded-l-lg border border-r-0 border-cc-border bg-cc-card/95 backdrop-blur px-2 py-2 text-[11px] text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Open context panel",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v11a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 13.5v-11zm2 .5v10h6V3H5z"})}),l.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),a&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>Y.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
|
|
136
|
-
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
137
|
-
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
138
|
-
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
139
|
-
overflow-hidden
|
|
140
|
-
`,children:l.jsx(wD,{sessionId:n})})]}),l.jsx(MD,{active:b}),l.jsx(RD,{}),$&&l.jsx(LD,{onComplete:()=>ie(!1)})]}):l.jsx(CE,{})}class tz extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Rs(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}yE();fN.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(tz,{children:l.jsx(ez,{})})}));Dn(()=>import("./sw-register-BH5kpgnP.js"),[]).catch(()=>{});export{lL as A,Bd as B,GR as C,rz as D,Dc as E,TL as F,uD as G,$l as H,c5 as I,HS as J,IR as K,yc as L,$R as M,QR as N,YR as O,WR as P,iz as Q,lz as R,CD as S,R5 as T,ND as U,az as V,Dn as _,Ne as a,gm as b,Cn as c,xL as d,DE as e,fR as f,bE as g,Bl as h,jL as i,l as j,oz as k,cz as l,SR as m,px as n,kR as o,vL as p,lD as q,S as r,sz as s,JL as t,Y as u,oD as v,Ts as w,El as x,_c as y,QL as z};
|