@hellcoder/companion 0.119.1 → 0.121.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-E73zA-6k.js → AgentsPage-ClW7bWRx.js} +5 -5
- package/dist/assets/{CronManager-Dbz9rad2.js → CronManager-CNRhJ7JU.js} +1 -1
- package/dist/assets/{DashboardPage-Dk4z826H.js → DashboardPage-Ch_HQGg0.js} +1 -1
- package/dist/assets/{IntegrationsPage-C7cQyPBt.js → IntegrationsPage-BHj_BEVr.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-BG4-JYjD.js → LinearOAuthSettingsPage-B5U70sHB.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CBbKNZVH.js → LinearSettingsPage-CVmZKj9l.js} +1 -1
- package/dist/assets/{MagicUIDashboard-DpxmzOIx.js → MagicUIDashboard-5nBMuLS8.js} +1 -1
- package/dist/assets/MagicUIView-CdHkHIEh.js +1 -0
- package/dist/assets/Playground-Dpfq4KMB.js +121 -0
- package/dist/assets/{PromptsPage-C7vU_XHW.js → PromptsPage-BHtp_9DW.js} +1 -1
- package/dist/assets/{RunsPage-BsIYybEZ.js → RunsPage-bbhhFNkd.js} +1 -1
- package/dist/assets/{SandboxManager-DKcCgC-r.js → SandboxManager-b3xCX8cU.js} +1 -1
- package/dist/assets/SettingsPage-CEOoHbQk.js +1 -0
- package/dist/assets/{TailscalePage-BhGXhs0h.js → TailscalePage-C1bGGkFU.js} +1 -1
- package/dist/assets/index-_VjPWGkx.js +141 -0
- package/dist/assets/{sw-register-CWqt9RnE.js → sw-register-2ITbAS9w.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/codex-app-server.ts +61 -0
- package/server/codex-auth.test.ts +254 -0
- package/server/codex-auth.ts +315 -0
- package/server/codex-models.ts +2 -43
- package/server/protocol/codex-upstream/ClientRequest.ts.txt +62 -17
- package/server/protocol/codex-upstream/README.md +1 -1
- package/server/protocol/codex-upstream/ServerNotification.ts.txt +52 -4
- package/server/protocol/codex-upstream/ServerRequest.ts.txt +4 -1
- package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +1 -1
- package/server/routes/codex-auth-routes.test.ts +115 -0
- package/server/routes/codex-auth-routes.ts +49 -0
- package/server/routes.ts +2 -0
- package/dist/assets/MagicUIView-wrboravS.js +0 -1
- package/dist/assets/Playground-BdB18EpN.js +0 -121
- package/dist/assets/SettingsPage-BIvJyPOd.js +0 -1
- package/dist/assets/index-C0oFg9YU.js +0 -140
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-BdB18EpN.js","assets/MagicUIDashboard-DpxmzOIx.js","assets/MagicUIView-wrboravS.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var XN=Object.defineProperty;var KN=(e,t,n)=>t in e?XN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Yb=(e,t,n)=>KN(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"]'))r(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"&&r(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 r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const ZN="modulepreload",JN=function(e){return"/"+e},Wb={},qn=function(t,n,r){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 h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=u(n.map(p=>{if(p=JN(p),p in Wb)return;Wb[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":ZN,m||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),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 h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};function Nx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={exports:{}},ic={};/**
|
|
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 Qb;function eC(){if(Qb)return ic;Qb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var h in a)h!=="key"&&(o[h]=a[h])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:o}}return ic.Fragment=t,ic.jsx=n,ic.jsxs=n,ic}var Xb;function tC(){return Xb||(Xb=1,tm.exports=eC()),tm.exports}var l=tC(),nm={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 Kb;function nC(){if(Kb)return Qe;Kb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=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 w(B,X,M){this.props=B,this.context=X,this.refs=N,this.updater=M||_}w.prototype.isReactComponent={},w.prototype.setState=function(B,X){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,X,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=w.prototype;function C(B,X,M){this.props=B,this.context=X,this.refs=N,this.updater=M||_}var L=C.prototype=new E;L.constructor=C,j(L,w.prototype),L.isPureReactComponent=!0;var O=Array.isArray;function D(){}var U={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function W(B,X,M){var me=M.ref;return{$$typeof:e,type:B,key:X,ref:me!==void 0?me:null,props:M}}function z(B,X){return W(B.type,X,B.props)}function q(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function T(B){var X={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(M){return X[M]})}var ie=/\/+/g;function Z(B,X){return typeof B=="object"&&B!==null&&B.key!=null?T(""+B.key):X.toString(36)}function Y(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(D,D):(B.status="pending",B.then(function(X){B.status==="pending"&&(B.status="fulfilled",B.value=X)},function(X){B.status==="pending"&&(B.status="rejected",B.reason=X)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function P(B,X,M,me,be){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),X,M,me,be)}}if(De)return be=be(B),De=me===""?"."+Z(B,0):me,O(be)?(M="",De!=null&&(M=De.replace(ie,"$&/")+"/"),P(be,X,M,"",function(Fe){return Fe})):be!=null&&(q(be)&&(be=z(be,M+(be.key==null||B&&B.key===be.key?"":(""+be.key).replace(ie,"$&/")+"/")+De)),X.push(be)),1;De=0;var Ee=me===""?".":me+":";if(O(B))for(var Ae=0;Ae<B.length;Ae++)me=B[Ae],Ce=Ee+Z(me,Ae),De+=P(me,X,M,Ce,be);else if(Ae=y(B),typeof Ae=="function")for(B=Ae.call(B),Ae=0;!(me=B.next()).done;)me=me.value,Ce=Ee+Z(me,Ae++),De+=P(me,X,M,Ce,be);else if(Ce==="object"){if(typeof B.then=="function")return P(Y(B),X,M,me,be);throw X=String(B),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return De}function $(B,X,M){if(B==null)return B;var me=[],be=0;return P(B,me,"","",function(Ce){return X.call(M,Ce,be++)}),me}function re(B){if(B._status===-1){var X=B._result;X=X(),X.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=X)}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 X=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(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},R={map:$,forEach:function(B,X,M){$(B,function(){X.apply(this,arguments)},M)},count:function(B){var X=0;return $(B,function(){X++}),X},toArray:function(B){return $(B,function(X){return X})||[]},only:function(B){if(!q(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=w,Qe.Fragment=n,Qe.Profiler=a,Qe.PureComponent=C,Qe.StrictMode=r,Qe.Suspense=f,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(B){return U.H.useMemoCache(B)}},Qe.cache=function(B){return function(){return B.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(B,X,M){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var me=j({},B.props),be=B.key;if(X!=null)for(Ce in X.key!==void 0&&(be=""+X.key),X)!I.call(X,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&X.ref===void 0||(me[Ce]=X[Ce]);var Ce=arguments.length-2;if(Ce===1)me.children=M;else if(1<Ce){for(var De=Array(Ce),Ee=0;Ee<Ce;Ee++)De[Ee]=arguments[Ee+2];me.children=De}return W(B.type,be,me)},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,X,M){var me,be={},Ce=null;if(X!=null)for(me in X.key!==void 0&&(Ce=""+X.key),X)I.call(X,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(be[me]=X[me]);var De=arguments.length-2;if(De===1)be.children=M;else if(1<De){for(var Ee=Array(De),Ae=0;Ae<De;Ae++)Ee[Ae]=arguments[Ae+2];be.children=Ee}if(B&&B.defaultProps)for(me in De=B.defaultProps,De)be[me]===void 0&&(be[me]=De[me]);return W(B,Ce,be)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(B){return{$$typeof:h,render:B}},Qe.isValidElement=q,Qe.lazy=function(B){return{$$typeof:m,_payload:{_status:-1,_result:B},_init:re}},Qe.memo=function(B,X){return{$$typeof:p,type:B,compare:X===void 0?null:X}},Qe.startTransition=function(B){var X=U.T,M={};U.T=M;try{var me=B(),be=U.S;be!==null&&be(M,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(D,ae)}catch(Ce){ae(Ce)}finally{X!==null&&M.types!==null&&(X.types=M.types),U.T=X}},Qe.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},Qe.use=function(B){return U.H.use(B)},Qe.useActionState=function(B,X,M){return U.H.useActionState(B,X,M)},Qe.useCallback=function(B,X){return U.H.useCallback(B,X)},Qe.useContext=function(B){return U.H.useContext(B)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(B,X){return U.H.useDeferredValue(B,X)},Qe.useEffect=function(B,X){return U.H.useEffect(B,X)},Qe.useEffectEvent=function(B){return U.H.useEffectEvent(B)},Qe.useId=function(){return U.H.useId()},Qe.useImperativeHandle=function(B,X,M){return U.H.useImperativeHandle(B,X,M)},Qe.useInsertionEffect=function(B,X){return U.H.useInsertionEffect(B,X)},Qe.useLayoutEffect=function(B,X){return U.H.useLayoutEffect(B,X)},Qe.useMemo=function(B,X){return U.H.useMemo(B,X)},Qe.useOptimistic=function(B,X){return U.H.useOptimistic(B,X)},Qe.useReducer=function(B,X,M){return U.H.useReducer(B,X,M)},Qe.useRef=function(B){return U.H.useRef(B)},Qe.useState=function(B){return U.H.useState(B)},Qe.useSyncExternalStore=function(B,X,M){return U.H.useSyncExternalStore(B,X,M)},Qe.useTransition=function(){return U.H.useTransition()},Qe.version="19.2.8",Qe}var Zb;function Cx(){return Zb||(Zb=1,nm.exports=nC()),nm.exports}var k=Cx();const jd=Nx(k);var rm={exports:{}},ac={},sm={exports:{}},im={};/**
|
|
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 Jb;function rC(){return Jb||(Jb=1,(function(e){function t(P,$){var re=P.length;P.push($);e:for(;0<re;){var ae=re-1>>>1,R=P[ae];if(0<a(R,$))P[ae]=$,P[re]=R,re=ae;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var $=P[0],re=P.pop();if(re!==$){P[0]=re;e:for(var ae=0,R=P.length,B=R>>>1;ae<B;){var X=2*(ae+1)-1,M=P[X],me=X+1,be=P[me];if(0>a(M,re))me<R&&0>a(be,M)?(P[ae]=be,P[me]=re,ae=me):(P[ae]=M,P[X]=re,ae=X);else if(me<R&&0>a(be,re))P[ae]=be,P[me]=re,ae=me;else break e}}return $}function a(P,$){var re=P.sortIndex-$.sortIndex;return re!==0?re: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,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],p=[],m=1,x=null,b=3,y=!1,_=!1,j=!1,N=!1,w=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function L(P){for(var $=n(p);$!==null;){if($.callback===null)r(p);else if($.startTime<=P)r(p),$.sortIndex=$.expirationTime,t(f,$);else break;$=n(p)}}function O(P){if(j=!1,L(P),!_)if(n(f)!==null)_=!0,D||(D=!0,T());else{var $=n(p);$!==null&&Y(O,$.startTime-P)}}var D=!1,U=-1,I=5,W=-1;function z(){return N?!0:!(e.unstable_now()-W<I)}function q(){if(N=!1,D){var P=e.unstable_now();W=P;var $=!0;try{e:{_=!1,j&&(j=!1,E(U),U=-1),y=!0;var re=b;try{t:{for(L(P),x=n(f);x!==null&&!(x.expirationTime>P&&z());){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,L(P),$=!0;break t}x===n(f)&&r(f),L(P)}else r(f);x=n(f)}if(x!==null)$=!0;else{var B=n(p);B!==null&&Y(O,B.startTime-P),$=!1}}break e}finally{x=null,b=re,y=!1}$=void 0}}finally{$?T():D=!1}}}var T;if(typeof C=="function")T=function(){C(q)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,Z=ie.port2;ie.port1.onmessage=q,T=function(){Z.postMessage(null)}}else T=function(){w(q,0)};function Y(P,$){U=w(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"):I=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 re=b;b=$;try{return P()}finally{b=re}},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 re=b;b=P;try{return $()}finally{b=re}},e.unstable_scheduleCallback=function(P,$,re){var ae=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?ae+re:ae):re=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=re+R,P={id:m++,callback:$,priorityLevel:P,startTime:re,expirationTime:R,sortIndex:-1},re>ae?(P.sortIndex=re,t(p,P),n(f)===null&&P===n(p)&&(j?(E(U),U=-1):j=!0,Y(O,re-ae))):(P.sortIndex=R,t(f,P),_||y||(_=!0,D||(D=!0,T()))),P},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(P){var $=b;return function(){var re=b;b=$;try{return P.apply(this,arguments)}finally{b=re}}}})(im)),im}var ey;function sC(){return ey||(ey=1,sm.exports=rC()),sm.exports}var am={exports:{}},$n={};/**
|
|
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 ty;function iC(){if(ty)return $n;ty=1;var e=Cx();function t(f){var p="https://react.dev/errors/"+f;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 #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(f,p,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:f,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return $n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,$n.createPortal=function(f,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(f,p,null,m)},$n.flushSync=function(f){var p=u.T,m=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=p,r.p=m,r.d.f()}},$n.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(f,p))},$n.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},$n.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,x=h(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?r.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:y}):m==="script"&&r.d.X(f,{crossOrigin:x,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},$n.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=h(p.as,p.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(f)},$n.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,x=h(m,p.crossOrigin);r.d.L(f,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})}},$n.preloadModule=function(f,p){if(typeof f=="string")if(p){var m=h(p.as,p.crossOrigin);r.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(f)},$n.requestFormReset=function(f){r.d.r(f)},$n.unstable_batchedUpdates=function(f,p){return f(p)},$n.useFormState=function(f,p,m){return u.H.useFormState(f,p,m)},$n.useFormStatus=function(){return u.H.useHostTransitionStatus()},$n.version="19.2.8",$n}var ny;function cw(){if(ny)return am.exports;ny=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(),am.exports=iC(),am.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 ry;function aC(){if(ry)return ac;ry=1;var e=sC(),t=Cx(),n=cw();function r(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var i=s,c=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(c=i.return),s=i.return;while(s)}return i.tag===3?c:null}function u(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function h(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(r(188))}function p(s){var i=s.alternate;if(!i){if(i=o(s),i===null)throw Error(r(188));return i!==s?null:s}for(var c=s,d=i;;){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 f(g),s;if(v===d)return f(g),i;v=v.sibling}throw Error(r(188))}if(c.return!==d.return)c=g,d=v;else{for(var S=!1,A=g.child;A;){if(A===c){S=!0,c=g,d=v;break}if(A===d){S=!0,d=g,c=v;break}A=A.sibling}if(!S){for(A=v.child;A;){if(A===c){S=!0,c=v,d=g;break}if(A===d){S=!0,d=v,c=g;break}A=A.sibling}if(!S)throw Error(r(189))}}if(c.alternate!==d)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:i}function m(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=m(s),i!==null)return i;s=s.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"),w=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),C=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function T(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var ie=Symbol.for("react.client.reference");function Z(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ie?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case w:return"Profiler";case N:return"StrictMode";case O:return"Suspense";case D:return"SuspenseList";case W:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case _:return"Portal";case C:return s.displayName||"Context";case E:return(s._context.displayName||"Context")+".Consumer";case L:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case U:return i=s.displayName||null,i!==null?i:Z(s.type)||"Memo";case I:i=s._payload,s=s._init;try{return Z(s(i))}catch{}}return null}var Y=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,re={pending:!1,data:null,method:null,action:null},ae=[],R=-1;function B(s){return{current:s}}function X(s){0>R||(s.current=ae[R],ae[R]=null,R--)}function M(s,i){R++,ae[R]=s.current,s.current=i}var me=B(null),be=B(null),Ce=B(null),De=B(null);function Ee(s,i){switch(M(Ce,i),M(be,s),M(me,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?gb(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=gb(i),s=xb(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}X(me),M(me,s)}function Ae(){X(me),X(be),X(Ce)}function Fe(s){s.memoizedState!==null&&M(De,s);var i=me.current,c=xb(i,s.type);i!==c&&(M(be,s),M(me,c))}function dt(s){be.current===s&&(X(me),X(be)),De.current===s&&(X(De),tc._currentValue=re)}var Je,At;function mt(s){if(Je===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);Je=i&&i[1]||"",At=-1<c.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+Je+s+At}var rt=!1;function Dt(s,i){if(!s||rt)return"";rt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var se=le}Reflect.construct(s,[],fe)}else{try{fe.call()}catch(le){se=le}s.call(fe.prototype)}}else{try{throw Error()}catch(le){se=le}(fe=s())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&se&&typeof le.stack=="string")return[le.stack,se.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(),S=v[0],A=v[1];if(S&&A){var F=S.split(`
|
|
45
|
-
`),ee=A.split(`
|
|
46
|
-
`);for(g=d=0;d<F.length&&!F[d].includes("DetermineComponentFrameRoot");)d++;for(;g<ee.length&&!ee[g].includes("DetermineComponentFrameRoot");)g++;if(d===F.length||g===ee.length)for(d=F.length-1,g=ee.length-1;1<=d&&0<=g&&F[d]!==ee[g];)g--;for(;1<=d&&0<=g;d--,g--)if(F[d]!==ee[g]){if(d!==1||g!==1)do if(d--,g--,0>g||F[d]!==ee[g]){var ce=`
|
|
47
|
-
`+F[d].replace(" at new "," at ");return s.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",s.displayName)),ce}while(1<=d&&0<=g);break}}}finally{rt=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?mt(c):""}function we(s,i){switch(s.tag){case 26:case 27:case 5:return mt(s.type);case 16:return mt("Lazy");case 13:return s.child!==i&&i!==null?mt("Suspense Fallback"):mt("Suspense");case 19:return mt("SuspenseList");case 0:case 15:return Dt(s.type,!1);case 11:return Dt(s.type.render,!1);case 1:return Dt(s.type,!0);case 31:return mt("Activity");default:return""}}function Ge(s){try{var i="",c=null;do i+=we(s,c),c=s,s=s.return;while(s);return i}catch(d){return`
|
|
48
|
-
Error generating stack: `+d.message+`
|
|
49
|
-
`+d.stack}}var gt=Object.prototype.hasOwnProperty,_n=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,Be=e.unstable_shouldYield,yt=e.unstable_requestPaint,Te=e.unstable_now,Xr=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,xe=e.unstable_LowPriority,Oe=e.unstable_IdlePriority,Xe=e.log,lt=e.unstable_setDisableYieldValue,ot=null,Et=null;function wn(s){if(typeof Xe=="function"&<(s),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(ot,s)}catch{}}var st=Math.clz32?Math.clz32:cs,fr=Math.log,Bn=Math.LN2;function cs(s){return s>>>=0,s===0?32:31-(fr(s)/Bn|0)|0}var Kr=256,Zr=262144,ne=4194304;function ve(s){var i=s&42;if(i!==0)return i;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function _e(s,i,c){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,S=s.pingedLanes;s=s.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?g=ve(d):(S&=A,S!==0?g=ve(S):c||(c=A&~s,c!==0&&(g=ve(c))))):(A=d&~v,A!==0?g=ve(A):S!==0?g=ve(S):c||(c=d&~s,c!==0&&(g=ve(c)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,c=i&-i,v>=c||v===32&&(c&4194048)!==0)?i:g}function Ke(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function qt(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function fn(){var s=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),s}function Pn(s){for(var i=[],c=0;31>c;c++)i.push(s);return i}function Vt(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Gn(s,i,c,d,g,v){var S=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var A=s.entanglements,F=s.expirationTimes,ee=s.hiddenUpdates;for(c=S&~c;0<c;){var ce=31-st(c),fe=1<<ce;A[ce]=0,F[ce]=-1;var se=ee[ce];if(se!==null)for(ee[ce]=null,ce=0;ce<se.length;ce++){var le=se[ce];le!==null&&(le.lane&=-536870913)}c&=~fe}d!==0&&Tr(s,d,0),v!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=v&~(S&~i))}function Tr(s,i,c){s.pendingLanes|=i,s.suspendedLanes&=~i;var d=31-st(i);s.entangledLanes|=i,s.entanglements[d]=s.entanglements[d]|1073741824|c&261930}function Ua(s,i){var c=s.entangledLanes|=i;for(s=s.entanglements;c;){var d=31-st(c),g=1<<d;g&i|s[d]&i&&(s[d]|=i),c&=~g}}function uo(s,i){var c=i&-i;return c=(c&42)!==0?1:Yn(c),(c&(s.suspendedLanes|i))!==0?0:c}function Yn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ji(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ho(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:Fb(s.type))}function fo(s,i){var c=$.p;try{return $.p=s,i()}finally{$.p=c}}var Mr=Math.random().toString(36).slice(2),en="__reactFiber$"+Mr,Tn="__reactProps$"+Mr,pr="__reactContainer$"+Mr,po="__reactEvents$"+Mr,ef="__reactListeners$"+Mr,ea="__reactHandles$"+Mr,ta="__reactResources$"+Mr,us="__reactMarker$"+Mr;function oi(s){delete s[en],delete s[Tn],delete s[po],delete s[ef],delete s[ea]}function As(s){var i=s[en];if(i)return i;for(var c=s.parentNode;c;){if(i=c[pr]||c[en]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(s=Sb(s);s!==null;){if(c=s[en])return c;s=Sb(s)}return i}s=c,c=s.parentNode}return null}function Jn(s){if(s=s[en]||s[pr]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function na(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(r(33))}function ds(s){var i=s[ta];return i||(i=s[ta]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function nn(s){s[us]=!0}var er=new Set,Ia={};function Jr(s,i){hs(s,i),hs(s+"Capture",i)}function hs(s,i){for(Ia[s]=i,s=0;s<i.length;s++)er.add(i[s])}var mo=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]*$"),go={},rn={};function tf(s){return gt.call(rn,s)?!0:gt.call(go,s)?!1:mo.test(s)?rn[s]=!0:(go[s]=!0,!1)}function ra(s,i,c){if(tf(i))if(c===null)s.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+c)}}function Ha(s,i,c){if(c===null)s.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+c)}}function es(s,i,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(i,c,""+d)}}function tr(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function cu(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function xo(s,i,c){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,v=d.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return g.call(this)},set:function(S){c=""+S,v.call(this,S)}}),Object.defineProperty(s,i,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function qa(s){if(!s._valueTracker){var i=cu(s)?"checked":"value";s._valueTracker=xo(s,i,""+s[i])}}function fs(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var c=i.getValue(),d="";return s&&(d=cu(s)?s.checked?"true":"false":s.value),s=d,s!==c?(i.setValue(s),!0):!1}function ci(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Rr=/[\n"\\]/g;function un(s){return s.replace(Rr,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function sa(s,i,c,d,g,v,S,A){s.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.type=S:s.removeAttribute("type"),i!=null?S==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+tr(i)):s.value!==""+tr(i)&&(s.value=""+tr(i)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),i!=null?Va(s,S,tr(i)):c!=null?Va(s,S,tr(c)):d!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?s.name=""+tr(A):s.removeAttribute("name")}function uu(s,i,c,d,g,v,S,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),i!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){qa(s);return}c=c!=null?""+tr(c):"",i=i!=null?""+tr(i):c,A||i===s.value||(s.value=i),s.defaultValue=i}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=A?s.checked:!!d,s.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.name=S),qa(s)}function Va(s,i,c){i==="number"&&ci(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function ui(s,i,c,d){if(s=s.options,i){i={};for(var g=0;g<c.length;g++)i["$"+c[g]]=!0;for(c=0;c<s.length;c++)g=i.hasOwnProperty("$"+s[c].value),s[c].selected!==g&&(s[c].selected=g),g&&d&&(s[c].defaultSelected=!0)}else{for(c=""+tr(c),i=null,g=0;g<s.length;g++){if(s[g].value===c){s[g].selected=!0,d&&(s[g].defaultSelected=!0);return}i!==null||s[g].disabled||(i=s[g])}i!==null&&(i.selected=!0)}}function Ga(s,i,c){if(i!=null&&(i=""+tr(i),i!==s.value&&(s.value=i),c==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=c!=null?""+tr(c):""}function vo(s,i,c,d){if(i==null){if(d!=null){if(c!=null)throw Error(r(92));if(Y(d)){if(1<d.length)throw Error(r(93));d=d[0]}c=d}c==null&&(c=""),i=c}c=tr(i),s.defaultValue=c,d=s.textContent,d===c&&d!==""&&d!==null&&(s.value=d),qa(s)}function di(s,i){if(i){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=i;return}}s.textContent=i}var nf=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 du(s,i,c){var d=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":d?s.setProperty(i,c):typeof c!="number"||c===0||nf.has(i)?i==="float"?s.cssFloat=c:s[i]=(""+c).trim():s[i]=c+"px"}function hu(s,i,c){if(i!=null&&typeof i!="object")throw Error(r(62));if(s=s.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var g in i)d=i[g],i.hasOwnProperty(g)&&c[g]!==d&&du(s,g,d)}else for(var v in i)i.hasOwnProperty(v)&&du(s,v,i[v])}function Ya(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var fu=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 Wa(s){return rf.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Lr(){}var hi=null;function Qa(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var fi=null,pi=null;function pu(s){var i=Jn(s);if(i&&(s=i.stateNode)){var c=s[Tn]||null;e:switch(s=i.stateNode,i.type){case"input":if(sa(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+un(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var d=c[i];if(d!==s&&d.form===s.form){var g=d[Tn]||null;if(!g)throw Error(r(90));sa(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<c.length;i++)d=c[i],d.form===s.form&&fs(d)}break e;case"textarea":Ga(s,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&ui(s,!!c.multiple,i,!1)}}}var bo=!1;function mu(s,i,c){if(bo)return s(i,c);bo=!0;try{var d=s(i);return d}finally{if(bo=!1,(fi!==null||pi!==null)&&(rd(),fi&&(i=fi,s=pi,pi=fi=null,pu(i),s)))for(i=0;i<s.length;i++)pu(s[i])}}function ia(s,i){var c=s.stateNode;if(c===null)return null;var d=c[Tn]||null;if(d===null)return null;c=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,i,typeof c));return c}var Dr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xa=!1;if(Dr)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){Xa=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{Xa=!1}var H=null,ge=null,Ze=null;function _t(){if(Ze)return Ze;var s,i=ge,c=i.length,d,g="value"in H?H.value:H.textContent,v=g.length;for(s=0;s<c&&i[s]===g[s];s++);var S=c-s;for(d=1;d<=S&&i[c-d]===g[v-d];d++);return Ze=g.slice(s,1<d?1-d:void 0)}function ct(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Ve(){return!0}function Wn(){return!1}function kn(s){function i(c,d,g,v,S){this._reactName=c,this._targetInst=g,this.type=d,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var A in s)s.hasOwnProperty(A)&&(c=s[A],this[A]=c?c(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ve:Wn,this.isPropagationStopped=Wn,this}return x(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ve)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ve)},persist:function(){},isPersistent:Ve}),i}var Or={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ts=kn(Or),Sn=x({},Or,{view:0,detail:0}),gu=kn(Sn),yo,_o,aa,la=x({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:af,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==aa&&(aa&&s.type==="mousemove"?(yo=s.screenX-aa.screenX,_o=s.screenY-aa.screenY):_o=yo=0,aa=s),yo)},movementY:function(s){return"movementY"in s?s.movementY:_o}}),sf=kn(la),xu=x({},la,{dataTransfer:0}),vu=kn(xu),bu=x({},Sn,{relatedTarget:0}),ps=kn(bu),yu=x({},Or,{animationName:0,elapsedTime:0,pseudoElement:0}),_u=kn(yu),Ka=x({},Or,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),tj=kn(Ka),nj=x({},Or,{data:0}),yv=kn(nj),rj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sj={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"},ij={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aj(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=ij[s])?!!i[s]:!1}function af(){return aj}var lj=x({},Sn,{key:function(s){if(s.key){var i=rj[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=ct(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?sj[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:af,charCode:function(s){return s.type==="keypress"?ct(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ct(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),oj=kn(lj),cj=x({},la,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_v=kn(cj),uj=x({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:af}),dj=kn(uj),hj=x({},Or,{propertyName:0,elapsedTime:0,pseudoElement:0}),fj=kn(hj),pj=x({},la,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),mj=kn(pj),gj=x({},Or,{newState:0,oldState:0}),xj=kn(gj),vj=[9,13,27,32],lf=Dr&&"CompositionEvent"in window,wo=null;Dr&&"documentMode"in document&&(wo=document.documentMode);var bj=Dr&&"TextEvent"in window&&!wo,wv=Dr&&(!lf||wo&&8<wo&&11>=wo),kv=" ",Sv=!1;function jv(s,i){switch(s){case"keyup":return vj.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Za=!1;function yj(s,i){switch(s){case"compositionend":return Nv(i);case"keypress":return i.which!==32?null:(Sv=!0,kv);case"textInput":return s=i.data,s===kv&&Sv?null:s;default:return null}}function _j(s,i){if(Za)return s==="compositionend"||!lf&&jv(s,i)?(s=_t(),Ze=ge=H=null,Za=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return wv&&i.locale!=="ko"?null:i.data;default:return null}}var wj={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 Cv(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!wj[s.type]:i==="textarea"}function Ev(s,i,c,d){fi?pi?pi.push(d):pi=[d]:fi=d,i=ud(i,"onChange"),0<i.length&&(c=new Ts("onChange","change",null,c,d),s.push({event:c,listeners:i}))}var ko=null,So=null;function kj(s){ub(s,0)}function wu(s){var i=na(s);if(fs(i))return s}function Av(s,i){if(s==="change")return i}var Tv=!1;if(Dr){var of;if(Dr){var cf="oninput"in document;if(!cf){var Mv=document.createElement("div");Mv.setAttribute("oninput","return;"),cf=typeof Mv.oninput=="function"}of=cf}else of=!1;Tv=of&&(!document.documentMode||9<document.documentMode)}function Rv(){ko&&(ko.detachEvent("onpropertychange",Lv),So=ko=null)}function Lv(s){if(s.propertyName==="value"&&wu(So)){var i=[];Ev(i,So,s,Qa(s)),mu(kj,i)}}function Sj(s,i,c){s==="focusin"?(Rv(),ko=i,So=c,ko.attachEvent("onpropertychange",Lv)):s==="focusout"&&Rv()}function jj(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return wu(So)}function Nj(s,i){if(s==="click")return wu(i)}function Cj(s,i){if(s==="input"||s==="change")return wu(i)}function Ej(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var mr=typeof Object.is=="function"?Object.is:Ej;function jo(s,i){if(mr(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var c=Object.keys(s),d=Object.keys(i);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var g=c[d];if(!gt.call(i,g)||!mr(s[g],i[g]))return!1}return!0}function Dv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ov(s,i){var c=Dv(s);s=0;for(var d;c;){if(c.nodeType===3){if(d=s+c.textContent.length,s<=i&&d>=i)return{node:c,offset:i-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Dv(c)}}function zv(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?zv(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Bv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=ci(s.document);i instanceof s.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)s=i.contentWindow;else break;i=ci(s.document)}return i}function uf(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var Aj=Dr&&"documentMode"in document&&11>=document.documentMode,Ja=null,df=null,No=null,hf=!1;function Pv(s,i,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;hf||Ja==null||Ja!==ci(d)||(d=Ja,"selectionStart"in d&&uf(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}),No&&jo(No,d)||(No=d,d=ud(df,"onSelect"),0<d.length&&(i=new Ts("onSelect","select",null,i,c),s.push({event:i,listeners:d}),i.target=Ja)))}function oa(s,i){var c={};return c[s.toLowerCase()]=i.toLowerCase(),c["Webkit"+s]="webkit"+i,c["Moz"+s]="moz"+i,c}var el={animationend:oa("Animation","AnimationEnd"),animationiteration:oa("Animation","AnimationIteration"),animationstart:oa("Animation","AnimationStart"),transitionrun:oa("Transition","TransitionRun"),transitionstart:oa("Transition","TransitionStart"),transitioncancel:oa("Transition","TransitionCancel"),transitionend:oa("Transition","TransitionEnd")},ff={},$v={};Dr&&($v=document.createElement("div").style,"AnimationEvent"in window||(delete el.animationend.animation,delete el.animationiteration.animation,delete el.animationstart.animation),"TransitionEvent"in window||delete el.transitionend.transition);function ca(s){if(ff[s])return ff[s];if(!el[s])return s;var i=el[s],c;for(c in i)if(i.hasOwnProperty(c)&&c in $v)return ff[s]=i[c];return s}var Fv=ca("animationend"),Uv=ca("animationiteration"),Iv=ca("animationstart"),Tj=ca("transitionrun"),Mj=ca("transitionstart"),Rj=ca("transitioncancel"),Hv=ca("transitionend"),qv=new Map,pf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");pf.push("scrollEnd");function ts(s,i){qv.set(s,i),Jr(i,[s])}var ku=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},zr=[],tl=0,mf=0;function Su(){for(var s=tl,i=mf=tl=0;i<s;){var c=zr[i];zr[i++]=null;var d=zr[i];zr[i++]=null;var g=zr[i];zr[i++]=null;var v=zr[i];if(zr[i++]=null,d!==null&&g!==null){var S=d.pending;S===null?g.next=g:(g.next=S.next,S.next=g),d.pending=g}v!==0&&Vv(c,g,v)}}function ju(s,i,c,d){zr[tl++]=s,zr[tl++]=i,zr[tl++]=c,zr[tl++]=d,mf|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function gf(s,i,c,d){return ju(s,i,c,d),Nu(s)}function ua(s,i){return ju(s,null,null,i),Nu(s)}function Vv(s,i,c){s.lanes|=c;var d=s.alternate;d!==null&&(d.lanes|=c);for(var g=!1,v=s.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(g=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,g&&i!==null&&(g=31-st(c),s=v.hiddenUpdates,d=s[g],d===null?s[g]=[i]:d.push(i),i.lane=c|536870912),v):null}function Nu(s){if(50<Wo)throw Wo=0,jp=null,Error(r(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var nl={};function Lj(s,i,c,d){this.tag=s,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=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gr(s,i,c,d){return new Lj(s,i,c,d)}function xf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ms(s,i){var c=s.alternate;return c===null?(c=gr(s.tag,i,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=i,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,i=s.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Gv(s,i){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,i=c.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Cu(s,i,c,d,g,v){var S=0;if(d=s,typeof s=="function")xf(s)&&(S=1);else if(typeof s=="string")S=PN(s,c,me.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case W:return s=gr(31,c,i,g),s.elementType=W,s.lanes=v,s;case j:return da(c.children,g,v,i);case N:S=8,g|=24;break;case w:return s=gr(12,c,i,g|2),s.elementType=w,s.lanes=v,s;case O:return s=gr(13,c,i,g),s.elementType=O,s.lanes=v,s;case D:return s=gr(19,c,i,g),s.elementType=D,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case C:S=10;break e;case E:S=9;break e;case L:S=11;break e;case U:S=14;break e;case I:S=16,d=null;break e}S=29,c=Error(r(130,s===null?"null":typeof s,"")),d=null}return i=gr(S,c,i,g),i.elementType=s,i.type=d,i.lanes=v,i}function da(s,i,c,d){return s=gr(7,s,d,i),s.lanes=c,s}function vf(s,i,c){return s=gr(6,s,null,i),s.lanes=c,s}function Yv(s){var i=gr(18,null,null,0);return i.stateNode=s,i}function bf(s,i,c){return i=gr(4,s.children!==null?s.children:[],s.key,i),i.lanes=c,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var Wv=new WeakMap;function Br(s,i){if(typeof s=="object"&&s!==null){var c=Wv.get(s);return c!==void 0?c:(i={value:s,source:i,stack:Ge(i)},Wv.set(s,i),i)}return{value:s,source:i,stack:Ge(i)}}var rl=[],sl=0,Eu=null,Co=0,Pr=[],$r=0,gi=null,ms=1,gs="";function Rs(s,i){rl[sl++]=Co,rl[sl++]=Eu,Eu=s,Co=i}function Qv(s,i,c){Pr[$r++]=ms,Pr[$r++]=gs,Pr[$r++]=gi,gi=s;var d=ms;s=gs;var g=32-st(d)-1;d&=~(1<<g),c+=1;var v=32-st(i)+g;if(30<v){var S=g-g%5;v=(d&(1<<S)-1).toString(32),d>>=S,g-=S,ms=1<<32-st(i)+g|c<<g|d,gs=v+s}else ms=1<<v|c<<g|d,gs=s}function yf(s){s.return!==null&&(Rs(s,1),Qv(s,1,0))}function _f(s){for(;s===Eu;)Eu=rl[--sl],rl[sl]=null,Co=rl[--sl],rl[sl]=null;for(;s===gi;)gi=Pr[--$r],Pr[$r]=null,gs=Pr[--$r],Pr[$r]=null,ms=Pr[--$r],Pr[$r]=null}function Xv(s,i){Pr[$r++]=ms,Pr[$r++]=gs,Pr[$r++]=gi,ms=i.id,gs=i.overflow,gi=s}var Mn=null,Yt=null,bt=!1,xi=null,Fr=!1,wf=Error(r(519));function vi(s){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(Br(i,s)),wf}function Kv(s){var i=s.stateNode,c=s.type,d=s.memoizedProps;switch(i[en]=s,i[Tn]=d,c){case"dialog":ft("cancel",i),ft("close",i);break;case"iframe":case"object":case"embed":ft("load",i);break;case"video":case"audio":for(c=0;c<Xo.length;c++)ft(Xo[c],i);break;case"source":ft("error",i);break;case"img":case"image":case"link":ft("error",i),ft("load",i);break;case"details":ft("toggle",i);break;case"input":ft("invalid",i),uu(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ft("invalid",i);break;case"textarea":ft("invalid",i),vo(i,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||d.suppressHydrationWarning===!0||pb(i.textContent,c)?(d.popover!=null&&(ft("beforetoggle",i),ft("toggle",i)),d.onScroll!=null&&ft("scroll",i),d.onScrollEnd!=null&&ft("scrollend",i),d.onClick!=null&&(i.onclick=Lr),i=!0):i=!1,i||vi(s,!0)}function Zv(s){for(Mn=s.return;Mn;)switch(Mn.tag){case 5:case 31:case 13:Fr=!1;return;case 27:case 3:Fr=!0;return;default:Mn=Mn.return}}function il(s){if(s!==Mn)return!1;if(!bt)return Zv(s),bt=!0,!1;var i=s.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Fp(s.type,s.memoizedProps)),c=!c),c&&Yt&&vi(s),Zv(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Yt=kb(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Yt=kb(s)}else i===27?(i=Yt,Ri(s.type)?(s=Vp,Vp=null,Yt=s):Yt=i):Yt=Mn?Ir(s.stateNode.nextSibling):null;return!0}function ha(){Yt=Mn=null,bt=!1}function kf(){var s=xi;return s!==null&&(ir===null?ir=s:ir.push.apply(ir,s),xi=null),s}function Eo(s){xi===null?xi=[s]:xi.push(s)}var Sf=B(null),fa=null,Ls=null;function bi(s,i,c){M(Sf,i._currentValue),i._currentValue=c}function Ds(s){s._currentValue=Sf.current,X(Sf)}function jf(s,i,c){for(;s!==null;){var d=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),s===c)break;s=s.return}}function Nf(s,i,c,d){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var v=g.dependencies;if(v!==null){var S=g.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=g;for(var F=0;F<i.length;F++)if(A.context===i[F]){v.lanes|=c,A=v.alternate,A!==null&&(A.lanes|=c),jf(v.return,c,s),d||(S=null);break e}v=A.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(r(341));S.lanes|=c,v=S.alternate,v!==null&&(v.lanes|=c),jf(S,c,s),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===s){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function al(s,i,c,d){s=null;for(var g=i,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 S=g.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var A=g.type;mr(g.pendingProps.value,S.value)||(s!==null?s.push(A):s=[A])}}else if(g===De.current){if(S=g.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(tc):s=[tc])}g=g.return}s!==null&&Nf(i,s,c,d),i.flags|=262144}function Au(s){for(s=s.firstContext;s!==null;){if(!mr(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function pa(s){fa=s,Ls=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Rn(s){return Jv(fa,s)}function Tu(s,i){return fa===null&&pa(s),Jv(s,i)}function Jv(s,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},Ls===null){if(s===null)throw Error(r(308));Ls=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Ls=Ls.next=i;return c}var Dj=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){i.aborted=!0,s.forEach(function(c){return c()})}},Oj=e.unstable_scheduleCallback,zj=e.unstable_NormalPriority,pn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cf(){return{controller:new Dj,data:new Map,refCount:0}}function Ao(s){s.refCount--,s.refCount===0&&Oj(zj,function(){s.controller.abort()})}var To=null,Ef=0,ll=0,ol=null;function Bj(s,i){if(To===null){var c=To=[];Ef=0,ll=Mp(),ol={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Ef++,i.then(e0,e0),i}function e0(){if(--Ef===0&&To!==null){ol!==null&&(ol.status="fulfilled");var s=To;To=null,ll=0,ol=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function Pj(s,i){var c=[],d={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return s.then(function(){d.status="fulfilled",d.value=i;for(var g=0;g<c.length;g++)(0,c[g])(i)},function(g){for(d.status="rejected",d.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),d}var t0=P.S;P.S=function(s,i){P1=Te(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Bj(s,i),t0!==null&&t0(s,i)};var ma=B(null);function Af(){var s=ma.current;return s!==null?s:Ut.pooledCache}function Mu(s,i){i===null?M(ma,ma.current):M(ma,i.pool)}function n0(){var s=Af();return s===null?null:{parent:pn._currentValue,pool:s}}var cl=Error(r(460)),Tf=Error(r(474)),Ru=Error(r(542)),Lu={then:function(){}};function r0(s){return s=s.status,s==="fulfilled"||s==="rejected"}function s0(s,i,c){switch(c=s[c],c===void 0?s.push(i):c!==i&&(i.then(Lr,Lr),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,a0(s),s;default:if(typeof i.status=="string")i.then(Lr,Lr);else{if(s=Ut,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=i,s.status="pending",s.then(function(d){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=d}},function(d){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,a0(s),s}throw xa=i,cl}}function ga(s){try{var i=s._init;return i(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(xa=c,cl):c}}var xa=null;function i0(){if(xa===null)throw Error(r(459));var s=xa;return xa=null,s}function a0(s){if(s===cl||s===Ru)throw Error(r(483))}var ul=null,Mo=0;function Du(s){var i=Mo;return Mo+=1,ul===null&&(ul=[]),s0(ul,s,i)}function Ro(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function Ou(s,i){throw i.$$typeof===b?Error(r(525)):(s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function l0(s){function i(K,V){if(s){var J=K.deletions;J===null?(K.deletions=[V],K.flags|=16):J.push(V)}}function c(K,V){if(!s)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function g(K,V){return K=Ms(K,V),K.index=0,K.sibling=null,K}function v(K,V,J){return K.index=J,s?(J=K.alternate,J!==null?(J=J.index,J<V?(K.flags|=67108866,V):J):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function S(K){return s&&K.alternate===null&&(K.flags|=67108866),K}function A(K,V,J,he){return V===null||V.tag!==6?(V=vf(J,K.mode,he),V.return=K,V):(V=g(V,J),V.return=K,V)}function F(K,V,J,he){var $e=J.type;return $e===j?ce(K,V,J.props.children,he,J.key):V!==null&&(V.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===I&&ga($e)===V.type)?(V=g(V,J.props),Ro(V,J),V.return=K,V):(V=Cu(J.type,J.key,J.props,null,K.mode,he),Ro(V,J),V.return=K,V)}function ee(K,V,J,he){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=bf(J,K.mode,he),V.return=K,V):(V=g(V,J.children||[]),V.return=K,V)}function ce(K,V,J,he,$e){return V===null||V.tag!==7?(V=da(J,K.mode,he,$e),V.return=K,V):(V=g(V,J),V.return=K,V)}function fe(K,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=vf(""+V,K.mode,J),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return J=Cu(V.type,V.key,V.props,null,K.mode,J),Ro(J,V),J.return=K,J;case _:return V=bf(V,K.mode,J),V.return=K,V;case I:return V=ga(V),fe(K,V,J)}if(Y(V)||T(V))return V=da(V,K.mode,J,null),V.return=K,V;if(typeof V.then=="function")return fe(K,Du(V),J);if(V.$$typeof===C)return fe(K,Tu(K,V),J);Ou(K,V)}return null}function se(K,V,J,he){var $e=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $e!==null?null:A(K,V,""+J,he);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case y:return J.key===$e?F(K,V,J,he):null;case _:return J.key===$e?ee(K,V,J,he):null;case I:return J=ga(J),se(K,V,J,he)}if(Y(J)||T(J))return $e!==null?null:ce(K,V,J,he,null);if(typeof J.then=="function")return se(K,V,Du(J),he);if(J.$$typeof===C)return se(K,V,Tu(K,J),he);Ou(K,J)}return null}function le(K,V,J,he,$e){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return K=K.get(J)||null,A(V,K,""+he,$e);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return K=K.get(he.key===null?J:he.key)||null,F(V,K,he,$e);case _:return K=K.get(he.key===null?J:he.key)||null,ee(V,K,he,$e);case I:return he=ga(he),le(K,V,J,he,$e)}if(Y(he)||T(he))return K=K.get(J)||null,ce(V,K,he,$e,null);if(typeof he.then=="function")return le(K,V,J,Du(he),$e);if(he.$$typeof===C)return le(K,V,J,Tu(V,he),$e);Ou(V,he)}return null}function Me(K,V,J,he){for(var $e=null,St=null,ze=V,it=V=0,vt=null;ze!==null&&it<J.length;it++){ze.index>it?(vt=ze,ze=null):vt=ze.sibling;var jt=se(K,ze,J[it],he);if(jt===null){ze===null&&(ze=vt);break}s&&ze&&jt.alternate===null&&i(K,ze),V=v(jt,V,it),St===null?$e=jt:St.sibling=jt,St=jt,ze=vt}if(it===J.length)return c(K,ze),bt&&Rs(K,it),$e;if(ze===null){for(;it<J.length;it++)ze=fe(K,J[it],he),ze!==null&&(V=v(ze,V,it),St===null?$e=ze:St.sibling=ze,St=ze);return bt&&Rs(K,it),$e}for(ze=d(ze);it<J.length;it++)vt=le(ze,K,it,J[it],he),vt!==null&&(s&&vt.alternate!==null&&ze.delete(vt.key===null?it:vt.key),V=v(vt,V,it),St===null?$e=vt:St.sibling=vt,St=vt);return s&&ze.forEach(function(Bi){return i(K,Bi)}),bt&&Rs(K,it),$e}function He(K,V,J,he){if(J==null)throw Error(r(151));for(var $e=null,St=null,ze=V,it=V=0,vt=null,jt=J.next();ze!==null&&!jt.done;it++,jt=J.next()){ze.index>it?(vt=ze,ze=null):vt=ze.sibling;var Bi=se(K,ze,jt.value,he);if(Bi===null){ze===null&&(ze=vt);break}s&&ze&&Bi.alternate===null&&i(K,ze),V=v(Bi,V,it),St===null?$e=Bi:St.sibling=Bi,St=Bi,ze=vt}if(jt.done)return c(K,ze),bt&&Rs(K,it),$e;if(ze===null){for(;!jt.done;it++,jt=J.next())jt=fe(K,jt.value,he),jt!==null&&(V=v(jt,V,it),St===null?$e=jt:St.sibling=jt,St=jt);return bt&&Rs(K,it),$e}for(ze=d(ze);!jt.done;it++,jt=J.next())jt=le(ze,K,it,jt.value,he),jt!==null&&(s&&jt.alternate!==null&&ze.delete(jt.key===null?it:jt.key),V=v(jt,V,it),St===null?$e=jt:St.sibling=jt,St=jt);return s&&ze.forEach(function(QN){return i(K,QN)}),bt&&Rs(K,it),$e}function Bt(K,V,J,he){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 $e=J.key;V!==null;){if(V.key===$e){if($e=J.type,$e===j){if(V.tag===7){c(K,V.sibling),he=g(V,J.props.children),he.return=K,K=he;break e}}else if(V.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===I&&ga($e)===V.type){c(K,V.sibling),he=g(V,J.props),Ro(he,J),he.return=K,K=he;break e}c(K,V);break}else i(K,V);V=V.sibling}J.type===j?(he=da(J.props.children,K.mode,he,J.key),he.return=K,K=he):(he=Cu(J.type,J.key,J.props,null,K.mode,he),Ro(he,J),he.return=K,K=he)}return S(K);case _:e:{for($e=J.key;V!==null;){if(V.key===$e)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){c(K,V.sibling),he=g(V,J.children||[]),he.return=K,K=he;break e}else{c(K,V);break}else i(K,V);V=V.sibling}he=bf(J,K.mode,he),he.return=K,K=he}return S(K);case I:return J=ga(J),Bt(K,V,J,he)}if(Y(J))return Me(K,V,J,he);if(T(J)){if($e=T(J),typeof $e!="function")throw Error(r(150));return J=$e.call(J),He(K,V,J,he)}if(typeof J.then=="function")return Bt(K,V,Du(J),he);if(J.$$typeof===C)return Bt(K,V,Tu(K,J),he);Ou(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(c(K,V.sibling),he=g(V,J),he.return=K,K=he):(c(K,V),he=vf(J,K.mode,he),he.return=K,K=he),S(K)):c(K,V)}return function(K,V,J,he){try{Mo=0;var $e=Bt(K,V,J,he);return ul=null,$e}catch(ze){if(ze===cl||ze===Ru)throw ze;var St=gr(29,ze,null,K.mode);return St.lanes=he,St.return=K,St}finally{}}}var va=l0(!0),o0=l0(!1),yi=!1;function Mf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rf(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function _i(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function wi(s,i,c){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Ct&2)!==0){var g=d.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),d.pending=i,i=Nu(s),Vv(s,null,c),i}return ju(s,d,i,c),Nu(s)}function Lo(s,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var d=i.lanes;d&=s.pendingLanes,c|=d,i.lanes=c,Ua(s,c)}}function Lf(s,i){var c=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=S:v=v.next=S,c=c.next}while(c!==null);v===null?g=v=i:v=v.next=i}else g=v=i;c={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=i:s.next=i,c.lastBaseUpdate=i}var Df=!1;function Do(){if(Df){var s=ol;if(s!==null)throw s}}function Oo(s,i,c,d){Df=!1;var g=s.updateQueue;yi=!1;var v=g.firstBaseUpdate,S=g.lastBaseUpdate,A=g.shared.pending;if(A!==null){g.shared.pending=null;var F=A,ee=F.next;F.next=null,S===null?v=ee:S.next=ee,S=F;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==S&&(A===null?ce.firstBaseUpdate=ee:A.next=ee,ce.lastBaseUpdate=F))}if(v!==null){var fe=g.baseState;S=0,ce=ee=F=null,A=v;do{var se=A.lane&-536870913,le=se!==A.lane;if(le?(xt&se)===se:(d&se)===se){se!==0&&se===ll&&(Df=!0),ce!==null&&(ce=ce.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Me=s,He=A;se=i;var Bt=c;switch(He.tag){case 1:if(Me=He.payload,typeof Me=="function"){fe=Me.call(Bt,fe,se);break e}fe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=He.payload,se=typeof Me=="function"?Me.call(Bt,fe,se):Me,se==null)break e;fe=x({},fe,se);break e;case 2:yi=!0}}se=A.callback,se!==null&&(s.flags|=64,le&&(s.flags|=8192),le=g.callbacks,le===null?g.callbacks=[se]:le.push(se))}else le={lane:se,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ce===null?(ee=ce=le,F=fe):ce=ce.next=le,S|=se;if(A=A.next,A===null){if(A=g.shared.pending,A===null)break;le=A,A=le.next,le.next=null,g.lastBaseUpdate=le,g.shared.pending=null}}while(!0);ce===null&&(F=fe),g.baseState=F,g.firstBaseUpdate=ee,g.lastBaseUpdate=ce,v===null&&(g.shared.lanes=0),Ci|=S,s.lanes=S,s.memoizedState=fe}}function c0(s,i){if(typeof s!="function")throw Error(r(191,s));s.call(i)}function u0(s,i){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)c0(c[s],i)}var dl=B(null),zu=B(0);function d0(s,i){s=Hs,M(zu,s),M(dl,i),Hs=s|i.baseLanes}function Of(){M(zu,Hs),M(dl,dl.current)}function zf(){Hs=zu.current,X(dl),X(zu)}var xr=B(null),Ur=null;function ki(s){var i=s.alternate;M(dn,dn.current&1),M(xr,s),Ur===null&&(i===null||dl.current!==null||i.memoizedState!==null)&&(Ur=s)}function Bf(s){M(dn,dn.current),M(xr,s),Ur===null&&(Ur=s)}function h0(s){s.tag===22?(M(dn,dn.current),M(xr,s),Ur===null&&(Ur=s)):Si()}function Si(){M(dn,dn.current),M(xr,xr.current)}function vr(s){X(xr),Ur===s&&(Ur=null),X(dn)}var dn=B(0);function Bu(s){for(var i=s;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Hp(c)||qp(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Os=0,et=null,Ot=null,mn=null,Pu=!1,hl=!1,ba=!1,$u=0,zo=0,fl=null,$j=0;function ln(){throw Error(r(321))}function Pf(s,i){if(i===null)return!1;for(var c=0;c<i.length&&c<s.length;c++)if(!mr(s[c],i[c]))return!1;return!0}function $f(s,i,c,d,g,v){return Os=v,et=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,P.H=s===null||s.memoizedState===null?Q0:ep,ba=!1,v=c(d,g),ba=!1,hl&&(v=p0(i,c,d,g)),f0(s),v}function f0(s){P.H=$o;var i=Ot!==null&&Ot.next!==null;if(Os=0,mn=Ot=et=null,Pu=!1,zo=0,fl=null,i)throw Error(r(300));s===null||gn||(s=s.dependencies,s!==null&&Au(s)&&(gn=!0))}function p0(s,i,c,d){et=s;var g=0;do{if(hl&&(fl=null),zo=0,hl=!1,25<=g)throw Error(r(301));if(g+=1,mn=Ot=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}P.H=X0,v=i(c,d)}while(hl);return v}function Fj(){var s=P.H,i=s.useState()[0];return i=typeof i.then=="function"?Bo(i):i,s=s.useState()[0],(Ot!==null?Ot.memoizedState:null)!==s&&(et.flags|=1024),i}function Ff(){var s=$u!==0;return $u=0,s}function Uf(s,i,c){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~c}function If(s){if(Pu){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Pu=!1}Os=0,mn=Ot=et=null,hl=!1,zo=$u=0,fl=null}function Qn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?et.memoizedState=mn=s:mn=mn.next=s,mn}function hn(){if(Ot===null){var s=et.alternate;s=s!==null?s.memoizedState:null}else s=Ot.next;var i=mn===null?et.memoizedState:mn.next;if(i!==null)mn=i,Ot=s;else{if(s===null)throw et.alternate===null?Error(r(467)):Error(r(310));Ot=s,s={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},mn===null?et.memoizedState=mn=s:mn=mn.next=s}return mn}function Fu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bo(s){var i=zo;return zo+=1,fl===null&&(fl=[]),s=s0(fl,s,i),i=et,(mn===null?i.memoizedState:mn.next)===null&&(i=i.alternate,P.H=i===null||i.memoizedState===null?Q0:ep),s}function Uu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Bo(s);if(s.$$typeof===C)return Rn(s)}throw Error(r(438,String(s)))}function Hf(s){var i=null,c=et.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var d=et.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Fu(),et.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(s),d=0;d<s;d++)c[d]=z;return i.index++,c}function zs(s,i){return typeof i=="function"?i(s):i}function Iu(s){var i=hn();return qf(i,Ot,s)}function qf(s,i,c){var d=s.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=c;var g=s.baseQueue,v=d.pending;if(v!==null){if(g!==null){var S=g.next;g.next=v.next,v.next=S}i.baseQueue=g=v,d.pending=null}if(v=s.baseState,g===null)s.memoizedState=v;else{i=g.next;var A=S=null,F=null,ee=i,ce=!1;do{var fe=ee.lane&-536870913;if(fe!==ee.lane?(xt&fe)===fe:(Os&fe)===fe){var se=ee.revertLane;if(se===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),fe===ll&&(ce=!0);else if((Os&se)===se){ee=ee.next,se===ll&&(ce=!0);continue}else fe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(A=F=fe,S=v):F=F.next=fe,et.lanes|=se,Ci|=se;fe=ee.action,ba&&c(v,fe),v=ee.hasEagerState?ee.eagerState:c(v,fe)}else se={lane:fe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(A=F=se,S=v):F=F.next=se,et.lanes|=fe,Ci|=fe;ee=ee.next}while(ee!==null&&ee!==i);if(F===null?S=v:F.next=A,!mr(v,s.memoizedState)&&(gn=!0,ce&&(c=ol,c!==null)))throw c;s.memoizedState=v,s.baseState=S,s.baseQueue=F,d.lastRenderedState=v}return g===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Vf(s){var i=hn(),c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var d=c.dispatch,g=c.pending,v=i.memoizedState;if(g!==null){c.pending=null;var S=g=g.next;do v=s(v,S.action),S=S.next;while(S!==g);mr(v,i.memoizedState)||(gn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),c.lastRenderedState=v}return[v,d]}function m0(s,i,c){var d=et,g=hn(),v=bt;if(v){if(c===void 0)throw Error(r(407));c=c()}else c=i();var S=!mr((Ot||g).memoizedState,c);if(S&&(g.memoizedState=c,gn=!0),g=g.queue,Wf(v0.bind(null,d,g,s),[s]),g.getSnapshot!==i||S||mn!==null&&mn.memoizedState.tag&1){if(d.flags|=2048,pl(9,{destroy:void 0},x0.bind(null,d,g,c,i),null),Ut===null)throw Error(r(349));v||(Os&127)!==0||g0(d,i,c)}return c}function g0(s,i,c){s.flags|=16384,s={getSnapshot:i,value:c},i=et.updateQueue,i===null?(i=Fu(),et.updateQueue=i,i.stores=[s]):(c=i.stores,c===null?i.stores=[s]:c.push(s))}function x0(s,i,c,d){i.value=c,i.getSnapshot=d,b0(i)&&y0(s)}function v0(s,i,c){return c(function(){b0(i)&&y0(s)})}function b0(s){var i=s.getSnapshot;s=s.value;try{var c=i();return!mr(s,c)}catch{return!0}}function y0(s){var i=ua(s,2);i!==null&&ar(i,s,2)}function Gf(s){var i=Qn();if(typeof s=="function"){var c=s;if(s=c(),ba){wn(!0);try{c()}finally{wn(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:s},i}function _0(s,i,c,d){return s.baseState=c,qf(s,Ot,typeof d=="function"?d:zs)}function Uj(s,i,c,d,g){if(Vu(s))throw Error(r(485));if(s=i.action,s!==null){var v={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};P.T!==null?c(!0):v.isTransition=!1,d(v),c=i.pending,c===null?(v.next=i.pending=v,w0(i,v)):(v.next=c.next,i.pending=c.next=v)}}function w0(s,i){var c=i.action,d=i.payload,g=s.state;if(i.isTransition){var v=P.T,S={};P.T=S;try{var A=c(g,d),F=P.S;F!==null&&F(S,A),k0(s,i,A)}catch(ee){Yf(s,i,ee)}finally{v!==null&&S.types!==null&&(v.types=S.types),P.T=v}}else try{v=c(g,d),k0(s,i,v)}catch(ee){Yf(s,i,ee)}}function k0(s,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){S0(s,i,d)},function(d){return Yf(s,i,d)}):S0(s,i,c)}function S0(s,i,c){i.status="fulfilled",i.value=c,j0(i),s.state=c,i=s.pending,i!==null&&(c=i.next,c===i?s.pending=null:(c=c.next,i.next=c,w0(s,c)))}function Yf(s,i,c){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=c,j0(i),i=i.next;while(i!==d)}s.action=null}function j0(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function N0(s,i){return i}function C0(s,i){if(bt){var c=Ut.formState;if(c!==null){e:{var d=et;if(bt){if(Yt){t:{for(var g=Yt,v=Fr;g.nodeType!==8;){if(!v){g=null;break t}if(g=Ir(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){Yt=Ir(g.nextSibling),d=g.data==="F!";break e}}vi(d)}d=!1}d&&(i=c[0])}}return c=Qn(),c.memoizedState=c.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:N0,lastRenderedState:i},c.queue=d,c=G0.bind(null,et,d),d.dispatch=c,d=Gf(!1),v=Jf.bind(null,et,!1,d.queue),d=Qn(),g={state:i,dispatch:null,action:s,pending:null},d.queue=g,c=Uj.bind(null,et,g,v,c),g.dispatch=c,d.memoizedState=s,[i,c,!1]}function E0(s){var i=hn();return A0(i,Ot,s)}function A0(s,i,c){if(i=qf(s,i,N0)[0],s=Iu(zs)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=Bo(i)}catch(S){throw S===cl?Ru:S}else d=i;i=hn();var g=i.queue,v=g.dispatch;return c!==i.memoizedState&&(et.flags|=2048,pl(9,{destroy:void 0},Ij.bind(null,g,c),null)),[d,v,s]}function Ij(s,i){s.action=i}function T0(s){var i=hn(),c=Ot;if(c!==null)return A0(i,c,s);hn(),i=i.memoizedState,c=hn();var d=c.queue.dispatch;return c.memoizedState=s,[i,d,!1]}function pl(s,i,c,d){return s={tag:s,create:c,deps:d,inst:i,next:null},i=et.updateQueue,i===null&&(i=Fu(),et.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=s.next=s:(d=c.next,c.next=s,s.next=d,i.lastEffect=s),s}function M0(){return hn().memoizedState}function Hu(s,i,c,d){var g=Qn();et.flags|=s,g.memoizedState=pl(1|i,{destroy:void 0},c,d===void 0?null:d)}function qu(s,i,c,d){var g=hn();d=d===void 0?null:d;var v=g.memoizedState.inst;Ot!==null&&d!==null&&Pf(d,Ot.memoizedState.deps)?g.memoizedState=pl(i,v,c,d):(et.flags|=s,g.memoizedState=pl(1|i,v,c,d))}function R0(s,i){Hu(8390656,8,s,i)}function Wf(s,i){qu(2048,8,s,i)}function Hj(s){et.flags|=4;var i=et.updateQueue;if(i===null)i=Fu(),et.updateQueue=i,i.events=[s];else{var c=i.events;c===null?i.events=[s]:c.push(s)}}function L0(s){var i=hn().memoizedState;return Hj({ref:i,nextImpl:s}),function(){if((Ct&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function D0(s,i){return qu(4,2,s,i)}function O0(s,i){return qu(4,4,s,i)}function z0(s,i){if(typeof i=="function"){s=s();var c=i(s);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function B0(s,i,c){c=c!=null?c.concat([s]):null,qu(4,4,z0.bind(null,i,s),c)}function Qf(){}function P0(s,i){var c=hn();i=i===void 0?null:i;var d=c.memoizedState;return i!==null&&Pf(i,d[1])?d[0]:(c.memoizedState=[s,i],s)}function $0(s,i){var c=hn();i=i===void 0?null:i;var d=c.memoizedState;if(i!==null&&Pf(i,d[1]))return d[0];if(d=s(),ba){wn(!0);try{s()}finally{wn(!1)}}return c.memoizedState=[d,i],d}function Xf(s,i,c){return c===void 0||(Os&1073741824)!==0&&(xt&261930)===0?s.memoizedState=i:(s.memoizedState=c,s=F1(),et.lanes|=s,Ci|=s,c)}function F0(s,i,c,d){return mr(c,i)?c:dl.current!==null?(s=Xf(s,c,d),mr(s,i)||(gn=!0),s):(Os&42)===0||(Os&1073741824)!==0&&(xt&261930)===0?(gn=!0,s.memoizedState=c):(s=F1(),et.lanes|=s,Ci|=s,i)}function U0(s,i,c,d,g){var v=$.p;$.p=v!==0&&8>v?v:8;var S=P.T,A={};P.T=A,Jf(s,!1,i,c);try{var F=g(),ee=P.S;if(ee!==null&&ee(A,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var ce=Pj(F,d);Po(s,i,ce,_r(s))}else Po(s,i,d,_r(s))}catch(fe){Po(s,i,{then:function(){},status:"rejected",reason:fe},_r())}finally{$.p=v,S!==null&&A.types!==null&&(S.types=A.types),P.T=S}}function qj(){}function Kf(s,i,c,d){if(s.tag!==5)throw Error(r(476));var g=I0(s).queue;U0(s,g,i,re,c===null?qj:function(){return H0(s),c(d)})}function I0(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:re},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:c},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function H0(s){var i=I0(s);i.next===null&&(i=s.alternate.memoizedState),Po(s,i.next.queue,{},_r())}function Zf(){return Rn(tc)}function q0(){return hn().memoizedState}function V0(){return hn().memoizedState}function Vj(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var c=_r();s=_i(c);var d=wi(i,s,c);d!==null&&(ar(d,i,c),Lo(d,i,c)),i={cache:Cf()},s.payload=i;return}i=i.return}}function Gj(s,i,c){var d=_r();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Vu(s)?Y0(i,c):(c=gf(s,i,c,d),c!==null&&(ar(c,s,d),W0(c,i,d)))}function G0(s,i,c){var d=_r();Po(s,i,c,d)}function Po(s,i,c,d){var g={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Vu(s))Y0(i,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,A=v(S,c);if(g.hasEagerState=!0,g.eagerState=A,mr(A,S))return ju(s,i,g,0),Ut===null&&Su(),!1}catch{}finally{}if(c=gf(s,i,g,d),c!==null)return ar(c,s,d),W0(c,i,d),!0}return!1}function Jf(s,i,c,d){if(d={lane:2,revertLane:Mp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Vu(s)){if(i)throw Error(r(479))}else i=gf(s,c,d,2),i!==null&&ar(i,s,2)}function Vu(s){var i=s.alternate;return s===et||i!==null&&i===et}function Y0(s,i){hl=Pu=!0;var c=s.pending;c===null?i.next=i:(i.next=c.next,c.next=i),s.pending=i}function W0(s,i,c){if((c&4194048)!==0){var d=i.lanes;d&=s.pendingLanes,c|=d,i.lanes=c,Ua(s,c)}}var $o={readContext:Rn,use:Uu,useCallback:ln,useContext:ln,useEffect:ln,useImperativeHandle:ln,useLayoutEffect:ln,useInsertionEffect:ln,useMemo:ln,useReducer:ln,useRef:ln,useState:ln,useDebugValue:ln,useDeferredValue:ln,useTransition:ln,useSyncExternalStore:ln,useId:ln,useHostTransitionStatus:ln,useFormState:ln,useActionState:ln,useOptimistic:ln,useMemoCache:ln,useCacheRefresh:ln};$o.useEffectEvent=ln;var Q0={readContext:Rn,use:Uu,useCallback:function(s,i){return Qn().memoizedState=[s,i===void 0?null:i],s},useContext:Rn,useEffect:R0,useImperativeHandle:function(s,i,c){c=c!=null?c.concat([s]):null,Hu(4194308,4,z0.bind(null,i,s),c)},useLayoutEffect:function(s,i){return Hu(4194308,4,s,i)},useInsertionEffect:function(s,i){Hu(4,2,s,i)},useMemo:function(s,i){var c=Qn();i=i===void 0?null:i;var d=s();if(ba){wn(!0);try{s()}finally{wn(!1)}}return c.memoizedState=[d,i],d},useReducer:function(s,i,c){var d=Qn();if(c!==void 0){var g=c(i);if(ba){wn(!0);try{c(i)}finally{wn(!1)}}}else g=i;return d.memoizedState=d.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},d.queue=s,s=s.dispatch=Gj.bind(null,et,s),[d.memoizedState,s]},useRef:function(s){var i=Qn();return s={current:s},i.memoizedState=s},useState:function(s){s=Gf(s);var i=s.queue,c=G0.bind(null,et,i);return i.dispatch=c,[s.memoizedState,c]},useDebugValue:Qf,useDeferredValue:function(s,i){var c=Qn();return Xf(c,s,i)},useTransition:function(){var s=Gf(!1);return s=U0.bind(null,et,s.queue,!0,!1),Qn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,c){var d=et,g=Qn();if(bt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=i(),Ut===null)throw Error(r(349));(xt&127)!==0||g0(d,i,c)}g.memoizedState=c;var v={value:c,getSnapshot:i};return g.queue=v,R0(v0.bind(null,d,v,s),[s]),d.flags|=2048,pl(9,{destroy:void 0},x0.bind(null,d,v,c,i),null),c},useId:function(){var s=Qn(),i=Ut.identifierPrefix;if(bt){var c=gs,d=ms;c=(d&~(1<<32-st(d)-1)).toString(32)+c,i="_"+i+"R_"+c,c=$u++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=$j++,i="_"+i+"r_"+c.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:Zf,useFormState:C0,useActionState:C0,useOptimistic:function(s){var i=Qn();i.memoizedState=i.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=Jf.bind(null,et,!0,c),c.dispatch=i,[s,i]},useMemoCache:Hf,useCacheRefresh:function(){return Qn().memoizedState=Vj.bind(null,et)},useEffectEvent:function(s){var i=Qn(),c={impl:s};return i.memoizedState=c,function(){if((Ct&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},ep={readContext:Rn,use:Uu,useCallback:P0,useContext:Rn,useEffect:Wf,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:O0,useMemo:$0,useReducer:Iu,useRef:M0,useState:function(){return Iu(zs)},useDebugValue:Qf,useDeferredValue:function(s,i){var c=hn();return F0(c,Ot.memoizedState,s,i)},useTransition:function(){var s=Iu(zs)[0],i=hn().memoizedState;return[typeof s=="boolean"?s:Bo(s),i]},useSyncExternalStore:m0,useId:q0,useHostTransitionStatus:Zf,useFormState:E0,useActionState:E0,useOptimistic:function(s,i){var c=hn();return _0(c,Ot,s,i)},useMemoCache:Hf,useCacheRefresh:V0};ep.useEffectEvent=L0;var X0={readContext:Rn,use:Uu,useCallback:P0,useContext:Rn,useEffect:Wf,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:O0,useMemo:$0,useReducer:Vf,useRef:M0,useState:function(){return Vf(zs)},useDebugValue:Qf,useDeferredValue:function(s,i){var c=hn();return Ot===null?Xf(c,s,i):F0(c,Ot.memoizedState,s,i)},useTransition:function(){var s=Vf(zs)[0],i=hn().memoizedState;return[typeof s=="boolean"?s:Bo(s),i]},useSyncExternalStore:m0,useId:q0,useHostTransitionStatus:Zf,useFormState:T0,useActionState:T0,useOptimistic:function(s,i){var c=hn();return Ot!==null?_0(c,Ot,s,i):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Hf,useCacheRefresh:V0};X0.useEffectEvent=L0;function tp(s,i,c,d){i=s.memoizedState,c=c(d,i),c=c==null?i:x({},i,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var np={enqueueSetState:function(s,i,c){s=s._reactInternals;var d=_r(),g=_i(d);g.payload=i,c!=null&&(g.callback=c),i=wi(s,g,d),i!==null&&(ar(i,s,d),Lo(i,s,d))},enqueueReplaceState:function(s,i,c){s=s._reactInternals;var d=_r(),g=_i(d);g.tag=1,g.payload=i,c!=null&&(g.callback=c),i=wi(s,g,d),i!==null&&(ar(i,s,d),Lo(i,s,d))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var c=_r(),d=_i(c);d.tag=2,i!=null&&(d.callback=i),i=wi(s,d,c),i!==null&&(ar(i,s,c),Lo(i,s,c))}};function K0(s,i,c,d,g,v,S){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,v,S):i.prototype&&i.prototype.isPureReactComponent?!jo(c,d)||!jo(g,v):!0}function Z0(s,i,c,d){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,d),i.state!==s&&np.enqueueReplaceState(i,i.state,null)}function ya(s,i){var c=i;if("ref"in i){c={};for(var d in i)d!=="ref"&&(c[d]=i[d])}if(s=s.defaultProps){c===i&&(c=x({},c));for(var g in s)c[g]===void 0&&(c[g]=s[g])}return c}function J0(s){ku(s)}function e1(s){console.error(s)}function t1(s){ku(s)}function Gu(s,i){try{var c=s.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function n1(s,i,c){try{var d=s.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function rp(s,i,c){return c=_i(c),c.tag=3,c.payload={element:null},c.callback=function(){Gu(s,i)},c}function r1(s){return s=_i(s),s.tag=3,s}function s1(s,i,c,d){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=d.value;s.payload=function(){return g(v)},s.callback=function(){n1(i,c,d)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){n1(i,c,d),typeof g!="function"&&(Ei===null?Ei=new Set([this]):Ei.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function Yj(s,i,c,d,g){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=c.alternate,i!==null&&al(i,c,g,!0),c=xr.current,c!==null){switch(c.tag){case 31:case 13:return Ur===null?sd():c.alternate===null&&on===0&&(on=3),c.flags&=-257,c.flags|=65536,c.lanes=g,d===Lu?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([d]):i.add(d),Ep(s,d,g)),!1;case 22:return c.flags|=65536,d===Lu?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([d]):c.add(d)),Ep(s,d,g)),!1}throw Error(r(435,c.tag))}return Ep(s,d,g),sd(),!1}if(bt)return i=xr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,d!==wf&&(s=Error(r(422),{cause:d}),Eo(Br(s,c)))):(d!==wf&&(i=Error(r(423),{cause:d}),Eo(Br(i,c))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,d=Br(d,c),g=rp(s.stateNode,d,g),Lf(s,g),on!==4&&(on=2)),!1;var v=Error(r(520),{cause:d});if(v=Br(v,c),Yo===null?Yo=[v]:Yo.push(v),on!==4&&(on=2),i===null)return!0;d=Br(d,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,s=g&-g,c.lanes|=s,s=rp(c.stateNode,d,s),Lf(c,s),!1;case 1:if(i=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ei===null||!Ei.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=r1(g),s1(g,s,c,d),Lf(c,g),!1}c=c.return}while(c!==null);return!1}var sp=Error(r(461)),gn=!1;function Ln(s,i,c,d){i.child=s===null?o0(i,null,c,d):va(i,s.child,c,d)}function i1(s,i,c,d,g){c=c.render;var v=i.ref;if("ref"in d){var S={};for(var A in d)A!=="ref"&&(S[A]=d[A])}else S=d;return pa(i),d=$f(s,i,c,S,v,g),A=Ff(),s!==null&&!gn?(Uf(s,i,g),Bs(s,i,g)):(bt&&A&&yf(i),i.flags|=1,Ln(s,i,d,g),i.child)}function a1(s,i,c,d,g){if(s===null){var v=c.type;return typeof v=="function"&&!xf(v)&&v.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=v,l1(s,i,v,d,g)):(s=Cu(c.type,null,d,i,i.mode,g),s.ref=i.ref,s.return=i,i.child=s)}if(v=s.child,!hp(s,g)){var S=v.memoizedProps;if(c=c.compare,c=c!==null?c:jo,c(S,d)&&s.ref===i.ref)return Bs(s,i,g)}return i.flags|=1,s=Ms(v,d),s.ref=i.ref,s.return=i,i.child=s}function l1(s,i,c,d,g){if(s!==null){var v=s.memoizedProps;if(jo(v,d)&&s.ref===i.ref)if(gn=!1,i.pendingProps=d=v,hp(s,g))(s.flags&131072)!==0&&(gn=!0);else return i.lanes=s.lanes,Bs(s,i,g)}return ip(s,i,c,d,g)}function o1(s,i,c,d){var g=d.children,v=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,s!==null){for(d=i.child=s.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~v}else d=0,i.child=null;return c1(s,i,v,c,d)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Mu(i,v!==null?v.cachePool:null),v!==null?d0(i,v):Of(),h0(i);else return d=i.lanes=536870912,c1(s,i,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(Mu(i,v.cachePool),d0(i,v),Si(),i.memoizedState=null):(s!==null&&Mu(i,null),Of(),Si());return Ln(s,i,g,c),i.child}function Fo(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function c1(s,i,c,d,g){var v=Af();return v=v===null?null:{parent:pn._currentValue,pool:v},i.memoizedState={baseLanes:c,cachePool:v},s!==null&&Mu(i,null),Of(),h0(i),s!==null&&al(s,i,d,!0),i.childLanes=g,null}function Yu(s,i){return i=Qu({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function u1(s,i,c){return va(i,s.child,null,c),s=Yu(i,i.pendingProps),s.flags|=2,vr(i),i.memoizedState=null,s}function Wj(s,i,c){var d=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(bt){if(d.mode==="hidden")return s=Yu(i,d),i.lanes=536870912,Fo(null,s);if(Bf(i),(s=Yt)?(s=wb(s,Fr),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:gi!==null?{id:ms,overflow:gs}:null,retryLane:536870912,hydrationErrors:null},c=Yv(s),c.return=i,i.child=c,Mn=i,Yt=null)):s=null,s===null)throw vi(i);return i.lanes=536870912,null}return Yu(i,d)}var v=s.memoizedState;if(v!==null){var S=v.dehydrated;if(Bf(i),g)if(i.flags&256)i.flags&=-257,i=u1(s,i,c);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(r(558));else if(gn||al(s,i,c,!1),g=(c&s.childLanes)!==0,gn||g){if(d=Ut,d!==null&&(S=uo(d,c),S!==0&&S!==v.retryLane))throw v.retryLane=S,ua(s,S),ar(d,s,S),sp;sd(),i=u1(s,i,c)}else s=v.treeContext,Yt=Ir(S.nextSibling),Mn=i,bt=!0,xi=null,Fr=!1,s!==null&&Xv(i,s),i=Yu(i,d),i.flags|=4096;return i}return s=Ms(s.child,{mode:d.mode,children:d.children}),s.ref=i.ref,i.child=s,s.return=i,s}function Wu(s,i){var c=i.ref;if(c===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(s===null||s.ref!==c)&&(i.flags|=4194816)}}function ip(s,i,c,d,g){return pa(i),c=$f(s,i,c,d,void 0,g),d=Ff(),s!==null&&!gn?(Uf(s,i,g),Bs(s,i,g)):(bt&&d&&yf(i),i.flags|=1,Ln(s,i,c,g),i.child)}function d1(s,i,c,d,g,v){return pa(i),i.updateQueue=null,c=p0(i,d,c,g),f0(s),d=Ff(),s!==null&&!gn?(Uf(s,i,v),Bs(s,i,v)):(bt&&d&&yf(i),i.flags|=1,Ln(s,i,c,v),i.child)}function h1(s,i,c,d,g){if(pa(i),i.stateNode===null){var v=nl,S=c.contextType;typeof S=="object"&&S!==null&&(v=Rn(S)),v=new c(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=np,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Mf(i),S=c.contextType,v.context=typeof S=="object"&&S!==null?Rn(S):nl,v.state=i.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(tp(i,c,S,d),v.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&np.enqueueReplaceState(v,v.state,null),Oo(i,d,v,g),Do(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(s===null){v=i.stateNode;var A=i.memoizedProps,F=ya(c,A);v.props=F;var ee=v.context,ce=c.contextType;S=nl,typeof ce=="object"&&ce!==null&&(S=Rn(ce));var fe=c.getDerivedStateFromProps;ce=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||ee!==S)&&Z0(i,v,d,S),yi=!1;var se=i.memoizedState;v.state=se,Oo(i,d,v,g),Do(),ee=i.memoizedState,A||se!==ee||yi?(typeof fe=="function"&&(tp(i,c,fe,d),ee=i.memoizedState),(F=yi||K0(i,c,F,d,se,ee,S))?(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"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),v.props=d,v.state=ee,v.context=S,d=F):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,Rf(s,i),S=i.memoizedProps,ce=ya(c,S),v.props=ce,fe=i.pendingProps,se=v.context,ee=c.contextType,F=nl,typeof ee=="object"&&ee!==null&&(F=Rn(ee)),A=c.getDerivedStateFromProps,(ee=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==fe||se!==F)&&Z0(i,v,d,F),yi=!1,se=i.memoizedState,v.state=se,Oo(i,d,v,g),Do();var le=i.memoizedState;S!==fe||se!==le||yi||s!==null&&s.dependencies!==null&&Au(s.dependencies)?(typeof A=="function"&&(tp(i,c,A,d),le=i.memoizedState),(ce=yi||K0(i,c,ce,d,se,le,F)||s!==null&&s.dependencies!==null&&Au(s.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,F),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,F)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=le),v.props=d,v.state=le,v.context=F,d=ce):(typeof v.componentDidUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=1024),d=!1)}return v=d,Wu(s,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,s!==null&&d?(i.child=va(i,s.child,null,g),i.child=va(i,null,c,g)):Ln(s,i,c,g),i.memoizedState=v.state,s=i.child):s=Bs(s,i,g),s}function f1(s,i,c,d){return ha(),i.flags|=256,Ln(s,i,c,d),i.child}var ap={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lp(s){return{baseLanes:s,cachePool:n0()}}function op(s,i,c){return s=s!==null?s.childLanes&~c:0,i&&(s|=yr),s}function p1(s,i,c){var d=i.pendingProps,g=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=s!==null&&s.memoizedState===null?!1:(dn.current&2)!==0),S&&(g=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,s===null){if(bt){if(g?ki(i):Si(),(s=Yt)?(s=wb(s,Fr),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:gi!==null?{id:ms,overflow:gs}:null,retryLane:536870912,hydrationErrors:null},c=Yv(s),c.return=i,i.child=c,Mn=i,Yt=null)):s=null,s===null)throw vi(i);return qp(s)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,g?(Si(),g=i.mode,A=Qu({mode:"hidden",children:A},g),d=da(d,g,c,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=lp(c),d.childLanes=op(s,S,c),i.memoizedState=ap,Fo(null,d)):(ki(i),cp(i,A))}var F=s.memoizedState;if(F!==null&&(A=F.dehydrated,A!==null)){if(v)i.flags&256?(ki(i),i.flags&=-257,i=up(s,i,c)):i.memoizedState!==null?(Si(),i.child=s.child,i.flags|=128,i=null):(Si(),A=d.fallback,g=i.mode,d=Qu({mode:"visible",children:d.children},g),A=da(A,g,c,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,va(i,s.child,null,c),d=i.child,d.memoizedState=lp(c),d.childLanes=op(s,S,c),i.memoizedState=ap,i=Fo(null,d));else if(ki(i),qp(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var ee=S.dgst;S=ee,d=Error(r(419)),d.stack="",d.digest=S,Eo({value:d,source:null,stack:null}),i=up(s,i,c)}else if(gn||al(s,i,c,!1),S=(c&s.childLanes)!==0,gn||S){if(S=Ut,S!==null&&(d=uo(S,c),d!==0&&d!==F.retryLane))throw F.retryLane=d,ua(s,d),ar(S,s,d),sp;Hp(A)||sd(),i=up(s,i,c)}else Hp(A)?(i.flags|=192,i.child=s.child,i=null):(s=F.treeContext,Yt=Ir(A.nextSibling),Mn=i,bt=!0,xi=null,Fr=!1,s!==null&&Xv(i,s),i=cp(i,d.children),i.flags|=4096);return i}return g?(Si(),A=d.fallback,g=i.mode,F=s.child,ee=F.sibling,d=Ms(F,{mode:"hidden",children:d.children}),d.subtreeFlags=F.subtreeFlags&65011712,ee!==null?A=Ms(ee,A):(A=da(A,g,c,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,Fo(null,d),d=i.child,A=s.child.memoizedState,A===null?A=lp(c):(g=A.cachePool,g!==null?(F=pn._currentValue,g=g.parent!==F?{parent:F,pool:F}:g):g=n0(),A={baseLanes:A.baseLanes|c,cachePool:g}),d.memoizedState=A,d.childLanes=op(s,S,c),i.memoizedState=ap,Fo(s.child,d)):(ki(i),c=s.child,s=c.sibling,c=Ms(c,{mode:"visible",children:d.children}),c.return=i,c.sibling=null,s!==null&&(S=i.deletions,S===null?(i.deletions=[s],i.flags|=16):S.push(s)),i.child=c,i.memoizedState=null,c)}function cp(s,i){return i=Qu({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function Qu(s,i){return s=gr(22,s,null,i),s.lanes=0,s}function up(s,i,c){return va(i,s.child,null,c),s=cp(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function m1(s,i,c){s.lanes|=i;var d=s.alternate;d!==null&&(d.lanes|=i),jf(s.return,i,c)}function dp(s,i,c,d,g,v){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:g,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=c,S.tailMode=g,S.treeForkCount=v)}function g1(s,i,c){var d=i.pendingProps,g=d.revealOrder,v=d.tail;d=d.children;var S=dn.current,A=(S&2)!==0;if(A?(S=S&1|2,i.flags|=128):S&=1,M(dn,S),Ln(s,i,d,c),d=bt?Co:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&m1(s,c,i);else if(s.tag===19)m1(s,c,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(g){case"forwards":for(c=i.child,g=null;c!==null;)s=c.alternate,s!==null&&Bu(s)===null&&(g=c),c=c.sibling;c=g,c===null?(g=i.child,i.child=null):(g=c.sibling,c.sibling=null),dp(i,!1,g,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=i.child,i.child=null;g!==null;){if(s=g.alternate,s!==null&&Bu(s)===null){i.child=g;break}s=g.sibling,g.sibling=c,c=g,g=s}dp(i,!0,c,null,v,d);break;case"together":dp(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Bs(s,i,c){if(s!==null&&(i.dependencies=s.dependencies),Ci|=i.lanes,(c&i.childLanes)===0)if(s!==null){if(al(s,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,c=Ms(s,s.pendingProps),i.child=c,c.return=i;s.sibling!==null;)s=s.sibling,c=c.sibling=Ms(s,s.pendingProps),c.return=i;c.sibling=null}return i.child}function hp(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&Au(s)))}function Qj(s,i,c){switch(i.tag){case 3:Ee(i,i.stateNode.containerInfo),bi(i,pn,s.memoizedState.cache),ha();break;case 27:case 5:Fe(i);break;case 4:Ee(i,i.stateNode.containerInfo);break;case 10:bi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Bf(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(ki(i),i.flags|=128,null):(c&i.child.childLanes)!==0?p1(s,i,c):(ki(i),s=Bs(s,i,c),s!==null?s.sibling:null);ki(i);break;case 19:var g=(s.flags&128)!==0;if(d=(c&i.childLanes)!==0,d||(al(s,i,c,!1),d=(c&i.childLanes)!==0),g){if(d)return g1(s,i,c);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),M(dn,dn.current),d)break;return null;case 22:return i.lanes=0,o1(s,i,c,i.pendingProps);case 24:bi(i,pn,s.memoizedState.cache)}return Bs(s,i,c)}function x1(s,i,c){if(s!==null)if(s.memoizedProps!==i.pendingProps)gn=!0;else{if(!hp(s,c)&&(i.flags&128)===0)return gn=!1,Qj(s,i,c);gn=(s.flags&131072)!==0}else gn=!1,bt&&(i.flags&1048576)!==0&&Qv(i,Co,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(s=ga(i.elementType),i.type=s,typeof s=="function")xf(s)?(d=ya(s,d),i.tag=1,i=h1(null,i,s,d,c)):(i.tag=0,i=ip(null,i,s,d,c));else{if(s!=null){var g=s.$$typeof;if(g===L){i.tag=11,i=i1(null,i,s,d,c);break e}else if(g===U){i.tag=14,i=a1(null,i,s,d,c);break e}}throw i=Z(s)||s,Error(r(306,i,""))}}return i;case 0:return ip(s,i,i.type,i.pendingProps,c);case 1:return d=i.type,g=ya(d,i.pendingProps),h1(s,i,d,g,c);case 3:e:{if(Ee(i,i.stateNode.containerInfo),s===null)throw Error(r(387));d=i.pendingProps;var v=i.memoizedState;g=v.element,Rf(s,i),Oo(i,d,null,c);var S=i.memoizedState;if(d=S.cache,bi(i,pn,d),d!==v.cache&&Nf(i,[pn],c,!0),Do(),d=S.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=f1(s,i,d,c);break e}else if(d!==g){g=Br(Error(r(424)),i),Eo(g),i=f1(s,i,d,c);break e}else{switch(s=i.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Yt=Ir(s.firstChild),Mn=i,bt=!0,xi=null,Fr=!0,c=o0(i,null,d,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ha(),d===g){i=Bs(s,i,c);break e}Ln(s,i,d,c)}i=i.child}return i;case 26:return Wu(s,i),s===null?(c=Eb(i.type,null,i.pendingProps,null))?i.memoizedState=c:bt||(c=i.type,s=i.pendingProps,d=dd(Ce.current).createElement(c),d[en]=i,d[Tn]=s,Dn(d,c,s),nn(d),i.stateNode=d):i.memoizedState=Eb(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return Fe(i),s===null&&bt&&(d=i.stateNode=jb(i.type,i.pendingProps,Ce.current),Mn=i,Fr=!0,g=Yt,Ri(i.type)?(Vp=g,Yt=Ir(d.firstChild)):Yt=g),Ln(s,i,i.pendingProps.children,c),Wu(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&bt&&((g=d=Yt)&&(d=jN(d,i.type,i.pendingProps,Fr),d!==null?(i.stateNode=d,Mn=i,Yt=Ir(d.firstChild),Fr=!1,g=!0):g=!1),g||vi(i)),Fe(i),g=i.type,v=i.pendingProps,S=s!==null?s.memoizedProps:null,d=v.children,Fp(g,v)?d=null:S!==null&&Fp(g,S)&&(i.flags|=32),i.memoizedState!==null&&(g=$f(s,i,Fj,null,null,c),tc._currentValue=g),Wu(s,i),Ln(s,i,d,c),i.child;case 6:return s===null&&bt&&((s=c=Yt)&&(c=NN(c,i.pendingProps,Fr),c!==null?(i.stateNode=c,Mn=i,Yt=null,s=!0):s=!1),s||vi(i)),null;case 13:return p1(s,i,c);case 4:return Ee(i,i.stateNode.containerInfo),d=i.pendingProps,s===null?i.child=va(i,null,d,c):Ln(s,i,d,c),i.child;case 11:return i1(s,i,i.type,i.pendingProps,c);case 7:return Ln(s,i,i.pendingProps,c),i.child;case 8:return Ln(s,i,i.pendingProps.children,c),i.child;case 12:return Ln(s,i,i.pendingProps.children,c),i.child;case 10:return d=i.pendingProps,bi(i,i.type,d.value),Ln(s,i,d.children,c),i.child;case 9:return g=i.type._context,d=i.pendingProps.children,pa(i),g=Rn(g),d=d(g),i.flags|=1,Ln(s,i,d,c),i.child;case 14:return a1(s,i,i.type,i.pendingProps,c);case 15:return l1(s,i,i.type,i.pendingProps,c);case 19:return g1(s,i,c);case 31:return Wj(s,i,c);case 22:return o1(s,i,c,i.pendingProps);case 24:return pa(i),d=Rn(pn),s===null?(g=Af(),g===null&&(g=Ut,v=Cf(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),i.memoizedState={parent:d,cache:g},Mf(i),bi(i,pn,g)):((s.lanes&c)!==0&&(Rf(s,i),Oo(i,null,null,c),Do()),g=s.memoizedState,v=i.memoizedState,g.parent!==d?(g={parent:d,cache:d},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),bi(i,pn,d)):(d=v.cache,bi(i,pn,d),d!==g.cache&&Nf(i,[pn],c,!0))),Ln(s,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Ps(s){s.flags|=4}function fp(s,i,c,d,g){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(q1())s.flags|=8192;else throw xa=Lu,Tf}else s.flags&=-16777217}function v1(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Lb(i))if(q1())s.flags|=8192;else throw xa=Lu,Tf}function Xu(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?fn():536870912,s.lanes|=i,vl|=i)}function Uo(s,i){if(!bt)switch(s.tailMode){case"hidden":i=s.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Wt(s){var i=s.alternate!==null&&s.alternate.child===s.child,c=0,d=0;if(i)for(var g=s.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=d,s.childLanes=c,i}function Xj(s,i,c){var d=i.pendingProps;switch(_f(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(i),null;case 1:return Wt(i),null;case 3:return c=i.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Ds(pn),Ae(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(il(i)?Ps(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,kf())),Wt(i),null;case 26:var g=i.type,v=i.memoizedState;return s===null?(Ps(i),v!==null?(Wt(i),v1(i,v)):(Wt(i),fp(i,g,null,d,c))):v?v!==s.memoizedState?(Ps(i),Wt(i),v1(i,v)):(Wt(i),i.flags&=-16777217):(s=s.memoizedProps,s!==d&&Ps(i),Wt(i),fp(i,g,s,d,c)),null;case 27:if(dt(i),c=Ce.current,g=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&Ps(i);else{if(!d){if(i.stateNode===null)throw Error(r(166));return Wt(i),null}s=me.current,il(i)?Kv(i):(s=jb(g,d,c),i.stateNode=s,Ps(i))}return Wt(i),null;case 5:if(dt(i),g=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&Ps(i);else{if(!d){if(i.stateNode===null)throw Error(r(166));return Wt(i),null}if(v=me.current,il(i))Kv(i);else{var S=dd(Ce.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?S.createElement(g,{is:d.is}):S.createElement(g)}}v[en]=i,v[Tn]=d;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===i)break e;for(;S.sibling===null;){if(S.return===null||S.return===i)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}i.stateNode=v;e:switch(Dn(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&&Ps(i)}}return Wt(i),fp(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,c),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==d&&Ps(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(r(166));if(s=Ce.current,il(i)){if(s=i.stateNode,c=i.memoizedProps,d=null,g=Mn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}s[en]=i,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||pb(s.nodeValue,c)),s||vi(i,!0)}else s=dd(s).createTextNode(d),s[en]=i,i.stateNode=s}return Wt(i),null;case 31:if(c=i.memoizedState,s===null||s.memoizedState!==null){if(d=il(i),c!==null){if(s===null){if(!d)throw Error(r(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[en]=i}else ha(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Wt(i),s=!1}else c=kf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return i.flags&256?(vr(i),i):(vr(i),null);if((i.flags&128)!==0)throw Error(r(558))}return Wt(i),null;case 13:if(d=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=il(i),d!==null&&d.dehydrated!==null){if(s===null){if(!g)throw Error(r(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[en]=i}else ha(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Wt(i),g=!1}else g=kf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(vr(i),i):(vr(i),null)}return vr(i),(i.flags&128)!==0?(i.lanes=c,i):(c=d!==null,s=s!==null&&s.memoizedState!==null,c&&(d=i.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!==s&&c&&(i.child.flags|=8192),Xu(i,i.updateQueue),Wt(i),null);case 4:return Ae(),s===null&&Op(i.stateNode.containerInfo),Wt(i),null;case 10:return Ds(i.type),Wt(i),null;case 19:if(X(dn),d=i.memoizedState,d===null)return Wt(i),null;if(g=(i.flags&128)!==0,v=d.rendering,v===null)if(g)Uo(d,!1);else{if(on!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(v=Bu(s),v!==null){for(i.flags|=128,Uo(d,!1),s=v.updateQueue,i.updateQueue=s,Xu(i,s),i.subtreeFlags=0,s=c,c=i.child;c!==null;)Gv(c,s),c=c.sibling;return M(dn,dn.current&1|2),bt&&Rs(i,d.treeForkCount),i.child}s=s.sibling}d.tail!==null&&Te()>td&&(i.flags|=128,g=!0,Uo(d,!1),i.lanes=4194304)}else{if(!g)if(s=Bu(v),s!==null){if(i.flags|=128,g=!0,s=s.updateQueue,i.updateQueue=s,Xu(i,s),Uo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!bt)return Wt(i),null}else 2*Te()-d.renderingStartTime>td&&c!==536870912&&(i.flags|=128,g=!0,Uo(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(s=d.last,s!==null?s.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Te(),s.sibling=null,c=dn.current,M(dn,g?c&1|2:c&1),bt&&Rs(i,d.treeForkCount),s):(Wt(i),null);case 22:case 23:return vr(i),zf(),d=i.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(c&536870912)!==0&&(i.flags&128)===0&&(Wt(i),i.subtreeFlags&6&&(i.flags|=8192)):Wt(i),c=i.updateQueue,c!==null&&Xu(i,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==c&&(i.flags|=2048),s!==null&&X(ma),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),Ds(pn),Wt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function Kj(s,i){switch(_f(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ds(pn),Ae(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return dt(i),null;case 31:if(i.memoizedState!==null){if(vr(i),i.alternate===null)throw Error(r(340));ha()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(vr(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ha()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return X(dn),null;case 4:return Ae(),null;case 10:return Ds(i.type),null;case 22:case 23:return vr(i),zf(),s!==null&&X(ma),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Ds(pn),null;case 25:return null;default:return null}}function b1(s,i){switch(_f(i),i.tag){case 3:Ds(pn),Ae();break;case 26:case 27:case 5:dt(i);break;case 4:Ae();break;case 31:i.memoizedState!==null&&vr(i);break;case 13:vr(i);break;case 19:X(dn);break;case 10:Ds(i.type);break;case 22:case 23:vr(i),zf(),s!==null&&X(ma);break;case 24:Ds(pn)}}function Io(s,i){try{var c=i.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var g=d.next;c=g;do{if((c.tag&s)===s){d=void 0;var v=c.create,S=c.inst;d=v(),S.destroy=d}c=c.next}while(c!==g)}}catch(A){Mt(i,i.return,A)}}function ji(s,i,c){try{var d=i.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var v=g.next;d=v;do{if((d.tag&s)===s){var S=d.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,g=i;var F=c,ee=A;try{ee()}catch(ce){Mt(g,F,ce)}}}d=d.next}while(d!==v)}}catch(ce){Mt(i,i.return,ce)}}function y1(s){var i=s.updateQueue;if(i!==null){var c=s.stateNode;try{u0(i,c)}catch(d){Mt(s,s.return,d)}}}function _1(s,i,c){c.props=ya(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(d){Mt(s,i,d)}}function Ho(s,i){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof c=="function"?s.refCleanup=c(d):c.current=d}}catch(g){Mt(s,i,g)}}function xs(s,i){var c=s.ref,d=s.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(g){Mt(s,i,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Mt(s,i,g)}else c.current=null}function w1(s){var i=s.type,c=s.memoizedProps,d=s.stateNode;try{e:switch(i){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){Mt(s,s.return,g)}}function pp(s,i,c){try{var d=s.stateNode;bN(d,s.type,c,i),d[Tn]=i}catch(g){Mt(s,s.return,g)}}function k1(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ri(s.type)||s.tag===4}function mp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||k1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ri(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function gp(s,i,c){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(s),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=Lr));else if(d!==4&&(d===27&&Ri(s.type)&&(c=s.stateNode,i=null),s=s.child,s!==null))for(gp(s,i,c),s=s.sibling;s!==null;)gp(s,i,c),s=s.sibling}function Ku(s,i,c){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?c.insertBefore(s,i):c.appendChild(s);else if(d!==4&&(d===27&&Ri(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Ku(s,i,c),s=s.sibling;s!==null;)Ku(s,i,c),s=s.sibling}function S1(s){var i=s.stateNode,c=s.memoizedProps;try{for(var d=s.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Dn(i,d,c),i[en]=s,i[Tn]=c}catch(v){Mt(s,s.return,v)}}var $s=!1,xn=!1,xp=!1,j1=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function Zj(s,i){if(s=s.containerInfo,Pp=vd,s=Bv(s),uf(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.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 S=0,A=-1,F=-1,ee=0,ce=0,fe=s,se=null;t:for(;;){for(var le;fe!==c||g!==0&&fe.nodeType!==3||(A=S+g),fe!==v||d!==0&&fe.nodeType!==3||(F=S+d),fe.nodeType===3&&(S+=fe.nodeValue.length),(le=fe.firstChild)!==null;)se=fe,fe=le;for(;;){if(fe===s)break t;if(se===c&&++ee===g&&(A=S),se===v&&++ce===d&&(F=S),(le=fe.nextSibling)!==null)break;fe=se,se=fe.parentNode}fe=le}c=A===-1||F===-1?null:{start:A,end:F}}else c=null}c=c||{start:0,end:0}}else c=null;for($p={focusedElem:s,selectionRange:c},vd=!1,Cn=i;Cn!==null;)if(i=Cn,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Cn=s;else for(;Cn!==null;){switch(i=Cn,v=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)g=s[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,c=i,g=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Me=ya(c.type,g);s=d.getSnapshotBeforeUpdate(Me,v),d.__reactInternalSnapshotBeforeUpdate=s}catch(He){Mt(c,c.return,He)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,c=s.nodeType,c===9)Ip(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Ip(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,Cn=s;break}Cn=i.return}}function N1(s,i,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Us(s,c),d&4&&Io(5,c);break;case 1:if(Us(s,c),d&4)if(s=c.stateNode,i===null)try{s.componentDidMount()}catch(S){Mt(c,c.return,S)}else{var g=ya(c.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(g,i,s.__reactInternalSnapshotBeforeUpdate)}catch(S){Mt(c,c.return,S)}}d&64&&y1(c),d&512&&Ho(c,c.return);break;case 3:if(Us(s,c),d&64&&(s=c.updateQueue,s!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{u0(s,i)}catch(S){Mt(c,c.return,S)}}break;case 27:i===null&&d&4&&S1(c);case 26:case 5:Us(s,c),i===null&&d&4&&w1(c),d&512&&Ho(c,c.return);break;case 12:Us(s,c);break;case 31:Us(s,c),d&4&&A1(s,c);break;case 13:Us(s,c),d&4&&T1(s,c),d&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=lN.bind(null,c),CN(s,c))));break;case 22:if(d=c.memoizedState!==null||$s,!d){i=i!==null&&i.memoizedState!==null||xn,g=$s;var v=xn;$s=d,(xn=i)&&!v?Is(s,c,(c.subtreeFlags&8772)!==0):Us(s,c),$s=g,xn=v}break;case 30:break;default:Us(s,c)}}function C1(s){var i=s.alternate;i!==null&&(s.alternate=null,C1(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&oi(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var tn=null,nr=!1;function Fs(s,i,c){for(c=c.child;c!==null;)E1(s,i,c),c=c.sibling}function E1(s,i,c){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(ot,c)}catch{}switch(c.tag){case 26:xn||xs(c,i),Fs(s,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:xn||xs(c,i);var d=tn,g=nr;Ri(c.type)&&(tn=c.stateNode,nr=!1),Fs(s,i,c),Zo(c.stateNode),tn=d,nr=g;break;case 5:xn||xs(c,i);case 6:if(d=tn,g=nr,tn=null,Fs(s,i,c),tn=d,nr=g,tn!==null)if(nr)try{(tn.nodeType===9?tn.body:tn.nodeName==="HTML"?tn.ownerDocument.body:tn).removeChild(c.stateNode)}catch(v){Mt(c,i,v)}else try{tn.removeChild(c.stateNode)}catch(v){Mt(c,i,v)}break;case 18:tn!==null&&(nr?(s=tn,yb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Nl(s)):yb(tn,c.stateNode));break;case 4:d=tn,g=nr,tn=c.stateNode.containerInfo,nr=!0,Fs(s,i,c),tn=d,nr=g;break;case 0:case 11:case 14:case 15:ji(2,c,i),xn||ji(4,c,i),Fs(s,i,c);break;case 1:xn||(xs(c,i),d=c.stateNode,typeof d.componentWillUnmount=="function"&&_1(c,i,d)),Fs(s,i,c);break;case 21:Fs(s,i,c);break;case 22:xn=(d=xn)||c.memoizedState!==null,Fs(s,i,c),xn=d;break;default:Fs(s,i,c)}}function A1(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Nl(s)}catch(c){Mt(i,i.return,c)}}}function T1(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Nl(s)}catch(c){Mt(i,i.return,c)}}function Jj(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new j1),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new j1),i;default:throw Error(r(435,s.tag))}}function Zu(s,i){var c=Jj(s);i.forEach(function(d){if(!c.has(d)){c.add(d);var g=oN.bind(null,s,d);d.then(g,g)}})}function rr(s,i){var c=i.deletions;if(c!==null)for(var d=0;d<c.length;d++){var g=c[d],v=s,S=i,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(Ri(A.type)){tn=A.stateNode,nr=!1;break e}break;case 5:tn=A.stateNode,nr=!1;break e;case 3:case 4:tn=A.stateNode.containerInfo,nr=!0;break e}A=A.return}if(tn===null)throw Error(r(160));E1(v,S,g),tn=null,nr=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)M1(i,s),i=i.sibling}var ns=null;function M1(s,i){var c=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:rr(i,s),sr(s),d&4&&(ji(3,s,s.return),Io(3,s),ji(5,s,s.return));break;case 1:rr(i,s),sr(s),d&512&&(xn||c===null||xs(c,c.return)),d&64&&$s&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var g=ns;if(rr(i,s),sr(s),d&512&&(xn||c===null||xs(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=s.memoizedState,c===null)if(d===null)if(s.stateNode===null){e:{d=s.type,c=s.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":v=g.getElementsByTagName("title")[0],(!v||v[us]||v[en]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(d),g.head.insertBefore(v,g.querySelector("head > title"))),Dn(v,d,c),v[en]=s,nn(v),d=v;break e;case"link":var S=Mb("link","href",g).get(d+(c.href||""));if(S){for(var A=0;A<S.length;A++)if(v=S[A],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)){S.splice(A,1);break t}}v=g.createElement(d),Dn(v,d,c),g.head.appendChild(v);break;case"meta":if(S=Mb("meta","content",g).get(d+(c.content||""))){for(A=0;A<S.length;A++)if(v=S[A],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)){S.splice(A,1);break t}}v=g.createElement(d),Dn(v,d,c),g.head.appendChild(v);break;default:throw Error(r(468,d))}v[en]=s,nn(v),d=v}s.stateNode=d}else Rb(g,s.type,s.stateNode);else s.stateNode=Tb(g,d,s.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?Rb(g,s.type,s.stateNode):Tb(g,d,s.memoizedProps)):d===null&&s.stateNode!==null&&pp(s,s.memoizedProps,c.memoizedProps)}break;case 27:rr(i,s),sr(s),d&512&&(xn||c===null||xs(c,c.return)),c!==null&&d&4&&pp(s,s.memoizedProps,c.memoizedProps);break;case 5:if(rr(i,s),sr(s),d&512&&(xn||c===null||xs(c,c.return)),s.flags&32){g=s.stateNode;try{di(g,"")}catch(Me){Mt(s,s.return,Me)}}d&4&&s.stateNode!=null&&(g=s.memoizedProps,pp(s,g,c!==null?c.memoizedProps:g)),d&1024&&(xp=!0);break;case 6:if(rr(i,s),sr(s),d&4){if(s.stateNode===null)throw Error(r(162));d=s.memoizedProps,c=s.stateNode;try{c.nodeValue=d}catch(Me){Mt(s,s.return,Me)}}break;case 3:if(pd=null,g=ns,ns=hd(i.containerInfo),rr(i,s),ns=g,sr(s),d&4&&c!==null&&c.memoizedState.isDehydrated)try{Nl(i.containerInfo)}catch(Me){Mt(s,s.return,Me)}xp&&(xp=!1,R1(s));break;case 4:d=ns,ns=hd(s.stateNode.containerInfo),rr(i,s),sr(s),ns=d;break;case 12:rr(i,s),sr(s);break;case 31:rr(i,s),sr(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Zu(s,d)));break;case 13:rr(i,s),sr(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ed=Te()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Zu(s,d)));break;case 22:g=s.memoizedState!==null;var F=c!==null&&c.memoizedState!==null,ee=$s,ce=xn;if($s=ee||g,xn=ce||F,rr(i,s),xn=ce,$s=ee,sr(s),d&8192)e:for(i=s.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(c===null||F||$s||xn||_a(s)),c=null,i=s;;){if(i.tag===5||i.tag===26){if(c===null){F=c=i;try{if(v=F.stateNode,g)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=F.stateNode;var fe=F.memoizedProps.style,se=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Me){Mt(F,F.return,Me)}}}else if(i.tag===6){if(c===null){F=i;try{F.stateNode.nodeValue=g?"":F.memoizedProps}catch(Me){Mt(F,F.return,Me)}}}else if(i.tag===18){if(c===null){F=i;try{var le=F.stateNode;g?_b(le,!0):_b(F.stateNode,!1)}catch(Me){Mt(F,F.return,Me)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=s.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Zu(s,c))));break;case 19:rr(i,s),sr(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Zu(s,d)));break;case 30:break;case 21:break;default:rr(i,s),sr(s)}}function sr(s){var i=s.flags;if(i&2){try{for(var c,d=s.return;d!==null;){if(k1(d)){c=d;break}d=d.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var g=c.stateNode,v=mp(s);Ku(s,v,g);break;case 5:var S=c.stateNode;c.flags&32&&(di(S,""),c.flags&=-33);var A=mp(s);Ku(s,A,S);break;case 3:case 4:var F=c.stateNode.containerInfo,ee=mp(s);gp(s,ee,F);break;default:throw Error(r(161))}}catch(ce){Mt(s,s.return,ce)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function R1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;R1(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Us(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)N1(s,i.alternate,i),i=i.sibling}function _a(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:ji(4,i,i.return),_a(i);break;case 1:xs(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&_1(i,i.return,c),_a(i);break;case 27:Zo(i.stateNode);case 26:case 5:xs(i,i.return),_a(i);break;case 22:i.memoizedState===null&&_a(i);break;case 30:_a(i);break;default:_a(i)}s=s.sibling}}function Is(s,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,g=s,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:Is(g,v,c),Io(4,v);break;case 1:if(Is(g,v,c),d=v,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ee){Mt(d,d.return,ee)}if(d=v,g=d.updateQueue,g!==null){var A=d.stateNode;try{var F=g.shared.hiddenCallbacks;if(F!==null)for(g.shared.hiddenCallbacks=null,g=0;g<F.length;g++)c0(F[g],A)}catch(ee){Mt(d,d.return,ee)}}c&&S&64&&y1(v),Ho(v,v.return);break;case 27:S1(v);case 26:case 5:Is(g,v,c),c&&d===null&&S&4&&w1(v),Ho(v,v.return);break;case 12:Is(g,v,c);break;case 31:Is(g,v,c),c&&S&4&&A1(g,v);break;case 13:Is(g,v,c),c&&S&4&&T1(g,v);break;case 22:v.memoizedState===null&&Is(g,v,c),Ho(v,v.return);break;case 30:break;default:Is(g,v,c)}i=i.sibling}}function vp(s,i){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&Ao(c))}function bp(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&Ao(s))}function rs(s,i,c,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)L1(s,i,c,d),i=i.sibling}function L1(s,i,c,d){var g=i.flags;switch(i.tag){case 0:case 11:case 15:rs(s,i,c,d),g&2048&&Io(9,i);break;case 1:rs(s,i,c,d);break;case 3:rs(s,i,c,d),g&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&Ao(s)));break;case 12:if(g&2048){rs(s,i,c,d),s=i.stateNode;try{var v=i.memoizedProps,S=v.id,A=v.onPostCommit;typeof A=="function"&&A(S,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(F){Mt(i,i.return,F)}}else rs(s,i,c,d);break;case 31:rs(s,i,c,d);break;case 13:rs(s,i,c,d);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?rs(s,i,c,d):qo(s,i):v._visibility&2?rs(s,i,c,d):(v._visibility|=2,ml(s,i,c,d,(i.subtreeFlags&10256)!==0||!1)),g&2048&&vp(S,i);break;case 24:rs(s,i,c,d),g&2048&&bp(i.alternate,i);break;default:rs(s,i,c,d)}}function ml(s,i,c,d,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=s,S=i,A=c,F=d,ee=S.flags;switch(S.tag){case 0:case 11:case 15:ml(v,S,A,F,g),Io(8,S);break;case 23:break;case 22:var ce=S.stateNode;S.memoizedState!==null?ce._visibility&2?ml(v,S,A,F,g):qo(v,S):(ce._visibility|=2,ml(v,S,A,F,g)),g&&ee&2048&&vp(S.alternate,S);break;case 24:ml(v,S,A,F,g),g&&ee&2048&&bp(S.alternate,S);break;default:ml(v,S,A,F,g)}i=i.sibling}}function qo(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=s,d=i,g=d.flags;switch(d.tag){case 22:qo(c,d),g&2048&&vp(d.alternate,d);break;case 24:qo(c,d),g&2048&&bp(d.alternate,d);break;default:qo(c,d)}i=i.sibling}}var Vo=8192;function gl(s,i,c){if(s.subtreeFlags&Vo)for(s=s.child;s!==null;)D1(s,i,c),s=s.sibling}function D1(s,i,c){switch(s.tag){case 26:gl(s,i,c),s.flags&Vo&&s.memoizedState!==null&&$N(c,ns,s.memoizedState,s.memoizedProps);break;case 5:gl(s,i,c);break;case 3:case 4:var d=ns;ns=hd(s.stateNode.containerInfo),gl(s,i,c),ns=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Vo,Vo=16777216,gl(s,i,c),Vo=d):gl(s,i,c));break;default:gl(s,i,c)}}function O1(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Go(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];Cn=d,B1(d,s)}O1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)z1(s),s=s.sibling}function z1(s){switch(s.tag){case 0:case 11:case 15:Go(s),s.flags&2048&&ji(9,s,s.return);break;case 3:Go(s);break;case 12:Go(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,Ju(s)):Go(s);break;default:Go(s)}}function Ju(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];Cn=d,B1(d,s)}O1(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:ji(8,i,i.return),Ju(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Ju(i));break;default:Ju(i)}s=s.sibling}}function B1(s,i){for(;Cn!==null;){var c=Cn;switch(c.tag){case 0:case 11:case 15:ji(8,c,i);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,Cn=d;else e:for(c=s;Cn!==null;){d=Cn;var g=d.sibling,v=d.return;if(C1(d),d===c){Cn=null;break e}if(g!==null){g.return=v,Cn=g;break e}Cn=v}}}var eN={getCacheForType:function(s){var i=Rn(pn),c=i.data.get(s);return c===void 0&&(c=s(),i.data.set(s,c)),c},cacheSignal:function(){return Rn(pn).controller.signal}},tN=typeof WeakMap=="function"?WeakMap:Map,Ct=0,Ut=null,ht=null,xt=0,Tt=0,br=null,Ni=!1,xl=!1,yp=!1,Hs=0,on=0,Ci=0,wa=0,_p=0,yr=0,vl=0,Yo=null,ir=null,wp=!1,ed=0,P1=0,td=1/0,nd=null,Ei=null,jn=0,Ai=null,bl=null,qs=0,kp=0,Sp=null,$1=null,Wo=0,jp=null;function _r(){return(Ct&2)!==0&&xt!==0?xt&-xt:P.T!==null?Mp():ho()}function F1(){if(yr===0)if((xt&536870912)===0||bt){var s=Zr;Zr<<=1,(Zr&3932160)===0&&(Zr=262144),yr=s}else yr=536870912;return s=xr.current,s!==null&&(s.flags|=32),yr}function ar(s,i,c){(s===Ut&&(Tt===2||Tt===9)||s.cancelPendingCommit!==null)&&(yl(s,0),Ti(s,xt,yr,!1)),Vt(s,c),((Ct&2)===0||s!==Ut)&&(s===Ut&&((Ct&2)===0&&(wa|=c),on===4&&Ti(s,xt,yr,!1)),vs(s))}function U1(s,i,c){if((Ct&6)!==0)throw Error(r(327));var d=!c&&(i&127)===0&&(i&s.expiredLanes)===0||Ke(s,i),g=d?sN(s,i):Cp(s,i,!0),v=d;do{if(g===0){xl&&!d&&Ti(s,i,0,!1);break}else{if(c=s.current.alternate,v&&!nN(c)){g=Cp(s,i,!1),v=!1;continue}if(g===2){if(v=i,s.errorRecoveryDisabledLanes&v)var S=0;else S=s.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var A=s;g=Yo;var F=A.current.memoizedState.isDehydrated;if(F&&(yl(A,S).flags|=256),S=Cp(A,S,!1),S!==2){if(yp&&!F){A.errorRecoveryDisabledLanes|=v,wa|=v,g=4;break e}v=ir,ir=g,v!==null&&(ir===null?ir=v:ir.push.apply(ir,v))}g=S}if(v=!1,g!==2)continue}}if(g===1){yl(s,0),Ti(s,i,0,!0);break}e:{switch(d=s,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Ti(d,i,yr,!Ni);break e;case 2:ir=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(g=ed+300-Te(),10<g)){if(Ti(d,i,yr,!Ni),_e(d,0,!0)!==0)break e;qs=i,d.timeoutHandle=vb(I1.bind(null,d,c,ir,nd,wp,i,yr,wa,vl,Ni,v,"Throttled",-0,0),g);break e}I1(d,c,ir,nd,wp,i,yr,wa,vl,Ni,v,null,-0,0)}}break}while(!0);vs(s)}function I1(s,i,c,d,g,v,S,A,F,ee,ce,fe,se,le){if(s.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Lr},D1(i,v,fe);var Me=(v&62914560)===v?ed-Te():(v&4194048)===v?P1-Te():0;if(Me=FN(fe,Me),Me!==null){qs=v,s.cancelPendingCommit=Me(X1.bind(null,s,i,v,c,d,g,S,A,F,ce,fe,null,se,le)),Ti(s,v,S,!ee);return}}X1(s,i,v,c,d,g,S,A,F)}function nN(s){for(var i=s;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.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(!mr(v(),g))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ti(s,i,c,d){i&=~_p,i&=~wa,s.suspendedLanes|=i,s.pingedLanes&=~i,d&&(s.warmLanes|=i),d=s.expirationTimes;for(var g=i;0<g;){var v=31-st(g),S=1<<v;d[v]=-1,g&=~S}c!==0&&Tr(s,c,i)}function rd(){return(Ct&6)===0?(Qo(0),!1):!0}function Np(){if(ht!==null){if(Tt===0)var s=ht.return;else s=ht,Ls=fa=null,If(s),ul=null,Mo=0,s=ht;for(;s!==null;)b1(s.alternate,s),s=s.return;ht=null}}function yl(s,i){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,wN(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),qs=0,Np(),Ut=s,ht=c=Ms(s.current,null),xt=i,Tt=0,br=null,Ni=!1,xl=Ke(s,i),yp=!1,vl=yr=_p=wa=Ci=on=0,ir=Yo=null,wp=!1,(i&8)!==0&&(i|=i&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=i;0<d;){var g=31-st(d),v=1<<g;i|=s[g],d&=~v}return Hs=i,Su(),c}function H1(s,i){et=null,P.H=$o,i===cl||i===Ru?(i=i0(),Tt=3):i===Tf?(i=i0(),Tt=4):Tt=i===sp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,br=i,ht===null&&(on=1,Gu(s,Br(i,s.current)))}function q1(){var s=xr.current;return s===null?!0:(xt&4194048)===xt?Ur===null:(xt&62914560)===xt||(xt&536870912)!==0?s===Ur:!1}function V1(){var s=P.H;return P.H=$o,s===null?$o:s}function G1(){var s=P.A;return P.A=eN,s}function sd(){on=4,Ni||(xt&4194048)!==xt&&xr.current!==null||(xl=!0),(Ci&134217727)===0&&(wa&134217727)===0||Ut===null||Ti(Ut,xt,yr,!1)}function Cp(s,i,c){var d=Ct;Ct|=2;var g=V1(),v=G1();(Ut!==s||xt!==i)&&(nd=null,yl(s,i)),i=!1;var S=on;e:do try{if(Tt!==0&&ht!==null){var A=ht,F=br;switch(Tt){case 8:Np(),S=6;break e;case 3:case 2:case 9:case 6:xr.current===null&&(i=!0);var ee=Tt;if(Tt=0,br=null,_l(s,A,F,ee),c&&xl){S=0;break e}break;default:ee=Tt,Tt=0,br=null,_l(s,A,F,ee)}}rN(),S=on;break}catch(ce){H1(s,ce)}while(!0);return i&&s.shellSuspendCounter++,Ls=fa=null,Ct=d,P.H=g,P.A=v,ht===null&&(Ut=null,xt=0,Su()),S}function rN(){for(;ht!==null;)Y1(ht)}function sN(s,i){var c=Ct;Ct|=2;var d=V1(),g=G1();Ut!==s||xt!==i?(nd=null,td=Te()+500,yl(s,i)):xl=Ke(s,i);e:do try{if(Tt!==0&&ht!==null){i=ht;var v=br;t:switch(Tt){case 1:Tt=0,br=null,_l(s,i,v,1);break;case 2:case 9:if(r0(v)){Tt=0,br=null,W1(i);break}i=function(){Tt!==2&&Tt!==9||Ut!==s||(Tt=7),vs(s)},v.then(i,i);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:r0(v)?(Tt=0,br=null,W1(i)):(Tt=0,br=null,_l(s,i,v,7));break;case 5:var S=null;switch(ht.tag){case 26:S=ht.memoizedState;case 5:case 27:var A=ht;if(S?Lb(S):A.stateNode.complete){Tt=0,br=null;var F=A.sibling;if(F!==null)ht=F;else{var ee=A.return;ee!==null?(ht=ee,id(ee)):ht=null}break t}}Tt=0,br=null,_l(s,i,v,5);break;case 6:Tt=0,br=null,_l(s,i,v,6);break;case 8:Np(),on=6;break e;default:throw Error(r(462))}}iN();break}catch(ce){H1(s,ce)}while(!0);return Ls=fa=null,P.H=d,P.A=g,Ct=c,ht!==null?0:(Ut=null,xt=0,Su(),on)}function iN(){for(;ht!==null&&!Be();)Y1(ht)}function Y1(s){var i=x1(s.alternate,s,Hs);s.memoizedProps=s.pendingProps,i===null?id(s):ht=i}function W1(s){var i=s,c=i.alternate;switch(i.tag){case 15:case 0:i=d1(c,i,i.pendingProps,i.type,void 0,xt);break;case 11:i=d1(c,i,i.pendingProps,i.type.render,i.ref,xt);break;case 5:If(i);default:b1(c,i),i=ht=Gv(i,Hs),i=x1(c,i,Hs)}s.memoizedProps=s.pendingProps,i===null?id(s):ht=i}function _l(s,i,c,d){Ls=fa=null,If(i),ul=null,Mo=0;var g=i.return;try{if(Yj(s,g,i,c,xt)){on=1,Gu(s,Br(c,s.current)),ht=null;return}}catch(v){if(g!==null)throw ht=g,v;on=1,Gu(s,Br(c,s.current)),ht=null;return}i.flags&32768?(bt||d===1?s=!0:xl||(xt&536870912)!==0?s=!1:(Ni=s=!0,(d===2||d===9||d===3||d===6)&&(d=xr.current,d!==null&&d.tag===13&&(d.flags|=16384))),Q1(i,s)):id(i)}function id(s){var i=s;do{if((i.flags&32768)!==0){Q1(i,Ni);return}s=i.return;var c=Xj(i.alternate,i,Hs);if(c!==null){ht=c;return}if(i=i.sibling,i!==null){ht=i;return}ht=i=s}while(i!==null);on===0&&(on=5)}function Q1(s,i){do{var c=Kj(s.alternate,s);if(c!==null){c.flags&=32767,ht=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(s=s.sibling,s!==null)){ht=s;return}ht=s=c}while(s!==null);on=6,ht=null}function X1(s,i,c,d,g,v,S,A,F){s.cancelPendingCommit=null;do ad();while(jn!==0);if((Ct&6)!==0)throw Error(r(327));if(i!==null){if(i===s.current)throw Error(r(177));if(v=i.lanes|i.childLanes,v|=mf,Gn(s,c,v,S,A,F),s===Ut&&(ht=Ut=null,xt=0),bl=i,Ai=s,qs=c,kp=v,Sp=g,$1=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,cN(Q,function(){return tb(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=P.T,P.T=null,g=$.p,$.p=2,S=Ct,Ct|=4;try{Zj(s,i,c)}finally{Ct=S,$.p=g,P.T=d}}jn=1,K1(),Z1(),J1()}}function K1(){if(jn===1){jn=0;var s=Ai,i=bl,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var d=$.p;$.p=2;var g=Ct;Ct|=4;try{M1(i,s);var v=$p,S=Bv(s.containerInfo),A=v.focusedElem,F=v.selectionRange;if(S!==A&&A&&A.ownerDocument&&zv(A.ownerDocument.documentElement,A)){if(F!==null&&uf(A)){var ee=F.start,ce=F.end;if(ce===void 0&&(ce=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(ce,A.value.length);else{var fe=A.ownerDocument||document,se=fe&&fe.defaultView||window;if(se.getSelection){var le=se.getSelection(),Me=A.textContent.length,He=Math.min(F.start,Me),Bt=F.end===void 0?He:Math.min(F.end,Me);!le.extend&&He>Bt&&(S=Bt,Bt=He,He=S);var K=Ov(A,He),V=Ov(A,Bt);if(K&&V&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==V.node||le.focusOffset!==V.offset)){var J=fe.createRange();J.setStart(K.node,K.offset),le.removeAllRanges(),He>Bt?(le.addRange(J),le.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),le.addRange(J))}}}}for(fe=[],le=A;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var he=fe[A];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}vd=!!Pp,$p=Pp=null}finally{Ct=g,$.p=d,P.T=c}}s.current=i,jn=2}}function Z1(){if(jn===2){jn=0;var s=Ai,i=bl,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var d=$.p;$.p=2;var g=Ct;Ct|=4;try{N1(s,i.alternate,i)}finally{Ct=g,$.p=d,P.T=c}}jn=3}}function J1(){if(jn===4||jn===3){jn=0,yt();var s=Ai,i=bl,c=qs,d=$1;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?jn=5:(jn=0,bl=Ai=null,eb(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(Ei=null),Ji(c),i=i.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(ot,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=P.T,g=$.p,$.p=2,P.T=null;try{for(var v=s.onRecoverableError,S=0;S<d.length;S++){var A=d[S];v(A.value,{componentStack:A.stack})}}finally{P.T=i,$.p=g}}(qs&3)!==0&&ad(),vs(s),g=s.pendingLanes,(c&261930)!==0&&(g&42)!==0?s===jp?Wo++:(Wo=0,jp=s):Wo=0,Qo(0)}}function eb(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,Ao(i)))}function ad(){return K1(),Z1(),J1(),tb()}function tb(){if(jn!==5)return!1;var s=Ai,i=kp;kp=0;var c=Ji(qs),d=P.T,g=$.p;try{$.p=32>c?32:c,P.T=null,c=Sp,Sp=null;var v=Ai,S=qs;if(jn=0,bl=Ai=null,qs=0,(Ct&6)!==0)throw Error(r(331));var A=Ct;if(Ct|=4,z1(v.current),L1(v,v.current,S,c),Ct=A,Qo(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(ot,v)}catch{}return!0}finally{$.p=g,P.T=d,eb(s,i)}}function nb(s,i,c){i=Br(c,i),i=rp(s.stateNode,i,2),s=wi(s,i,2),s!==null&&(Vt(s,2),vs(s))}function Mt(s,i,c){if(s.tag===3)nb(s,s,c);else for(;i!==null;){if(i.tag===3){nb(i,s,c);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ei===null||!Ei.has(d))){s=Br(c,s),c=r1(2),d=wi(i,c,2),d!==null&&(s1(c,d,i,s),Vt(d,2),vs(d));break}}i=i.return}}function Ep(s,i,c){var d=s.pingCache;if(d===null){d=s.pingCache=new tN;var g=new Set;d.set(i,g)}else g=d.get(i),g===void 0&&(g=new Set,d.set(i,g));g.has(c)||(yp=!0,g.add(c),s=aN.bind(null,s,i,c),i.then(s,s))}function aN(s,i,c){var d=s.pingCache;d!==null&&d.delete(i),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Ut===s&&(xt&c)===c&&(on===4||on===3&&(xt&62914560)===xt&&300>Te()-ed?(Ct&2)===0&&yl(s,0):_p|=c,vl===xt&&(vl=0)),vs(s)}function rb(s,i){i===0&&(i=fn()),s=ua(s,i),s!==null&&(Vt(s,i),vs(s))}function lN(s){var i=s.memoizedState,c=0;i!==null&&(c=i.retryLane),rb(s,c)}function oN(s,i){var c=0;switch(s.tag){case 31:case 13:var d=s.stateNode,g=s.memoizedState;g!==null&&(c=g.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(i),rb(s,c)}function cN(s,i){return _n(s,i)}var ld=null,wl=null,Ap=!1,od=!1,Tp=!1,Mi=0;function vs(s){s!==wl&&s.next===null&&(wl===null?ld=wl=s:wl=wl.next=s),od=!0,Ap||(Ap=!0,dN())}function Qo(s,i){if(!Tp&&od){Tp=!0;do for(var c=!1,d=ld;d!==null;){if(s!==0){var g=d.pendingLanes;if(g===0)var v=0;else{var S=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-st(42|s)+1)-1,v&=g&~(S&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,lb(d,v))}else v=xt,v=_e(d,d===Ut?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Ke(d,v)||(c=!0,lb(d,v));d=d.next}while(c);Tp=!1}}function uN(){sb()}function sb(){od=Ap=!1;var s=0;Mi!==0&&_N()&&(s=Mi);for(var i=Te(),c=null,d=ld;d!==null;){var g=d.next,v=ib(d,i);v===0?(d.next=null,c===null?ld=g:c.next=g,g===null&&(wl=c)):(c=d,(s!==0||(v&3)!==0)&&(od=!0)),d=g}jn!==0&&jn!==5||Qo(s),Mi!==0&&(Mi=0)}function ib(s,i){for(var c=s.suspendedLanes,d=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var S=31-st(v),A=1<<S,F=g[S];F===-1?((A&c)===0||(A&d)!==0)&&(g[S]=qt(A,i)):F<=i&&(s.expiredLanes|=A),v&=~A}if(i=Ut,c=xt,c=_e(s,s===i?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,c===0||s===i&&(Tt===2||Tt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Ke(s,c)){if(i=c&-c,i===s.callbackPriority)return i;switch(d!==null&&je(d),Ji(c)){case 2:case 8:c=ke;break;case 32:c=Q;break;case 268435456:c=Oe;break;default:c=Q}return d=ab.bind(null,s),c=_n(c,d),s.callbackPriority=i,s.callbackNode=c,i}return d!==null&&d!==null&&je(d),s.callbackPriority=2,s.callbackNode=null,2}function ab(s,i){if(jn!==0&&jn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(ad()&&s.callbackNode!==c)return null;var d=xt;return d=_e(s,s===Ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(U1(s,d,i),ib(s,Te()),s.callbackNode!=null&&s.callbackNode===c?ab.bind(null,s):null)}function lb(s,i){if(ad())return null;U1(s,i,!0)}function dN(){kN(function(){(Ct&6)!==0?_n(oe,uN):sb()})}function Mp(){if(Mi===0){var s=ll;s===0&&(s=Kr,Kr<<=1,(Kr&261888)===0&&(Kr=256)),Mi=s}return Mi}function ob(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Wa(""+s)}function cb(s,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,s.id&&c.setAttribute("form",s.id),i.parentNode.insertBefore(c,i),s=new FormData(s),c.parentNode.removeChild(c),s}function hN(s,i,c,d,g){if(i==="submit"&&c&&c.stateNode===g){var v=ob((g[Tn]||null).action),S=d.submitter;S&&(i=(i=S[Tn]||null)?ob(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var A=new Ts("action","action",null,d,g);s.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Mi!==0){var F=S?cb(g,S):new FormData(g);Kf(c,{pending:!0,data:F,method:g.method,action:v},null,F)}}else typeof v=="function"&&(A.preventDefault(),F=S?cb(g,S):new FormData(g),Kf(c,{pending:!0,data:F,method:g.method,action:v},v,F))},currentTarget:g}]})}}for(var Rp=0;Rp<pf.length;Rp++){var Lp=pf[Rp],fN=Lp.toLowerCase(),pN=Lp[0].toUpperCase()+Lp.slice(1);ts(fN,"on"+pN)}ts(Fv,"onAnimationEnd"),ts(Uv,"onAnimationIteration"),ts(Iv,"onAnimationStart"),ts("dblclick","onDoubleClick"),ts("focusin","onFocus"),ts("focusout","onBlur"),ts(Tj,"onTransitionRun"),ts(Mj,"onTransitionStart"),ts(Rj,"onTransitionCancel"),ts(Hv,"onTransitionEnd"),hs("onMouseEnter",["mouseout","mouseover"]),hs("onMouseLeave",["mouseout","mouseover"]),hs("onPointerEnter",["pointerout","pointerover"]),hs("onPointerLeave",["pointerout","pointerover"]),Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xo="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(" "),mN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xo));function ub(s,i){i=(i&4)!==0;for(var c=0;c<s.length;c++){var d=s[c],g=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var S=d.length-1;0<=S;S--){var A=d[S],F=A.instance,ee=A.currentTarget;if(A=A.listener,F!==v&&g.isPropagationStopped())break e;v=A,g.currentTarget=ee;try{v(g)}catch(ce){ku(ce)}g.currentTarget=null,v=F}else for(S=0;S<d.length;S++){if(A=d[S],F=A.instance,ee=A.currentTarget,A=A.listener,F!==v&&g.isPropagationStopped())break e;v=A,g.currentTarget=ee;try{v(g)}catch(ce){ku(ce)}g.currentTarget=null,v=F}}}}function ft(s,i){var c=i[po];c===void 0&&(c=i[po]=new Set);var d=s+"__bubble";c.has(d)||(db(i,s,2,!1),c.add(d))}function Dp(s,i,c){var d=0;i&&(d|=4),db(c,s,d,i)}var cd="_reactListening"+Math.random().toString(36).slice(2);function Op(s){if(!s[cd]){s[cd]=!0,er.forEach(function(c){c!=="selectionchange"&&(mN.has(c)||Dp(c,!1,s),Dp(c,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[cd]||(i[cd]=!0,Dp("selectionchange",!1,i))}}function db(s,i,c,d){switch(Fb(i)){case 2:var g=HN;break;case 8:g=qN;break;default:g=Xp}c=g.bind(null,i,c,s),g=void 0,!Xa||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),d?g!==void 0?s.addEventListener(i,c,{capture:!0,passive:g}):s.addEventListener(i,c,!0):g!==void 0?s.addEventListener(i,c,{passive:g}):s.addEventListener(i,c,!1)}function zp(s,i,c,d,g){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var A=d.stateNode.containerInfo;if(A===g)break;if(S===4)for(S=d.return;S!==null;){var F=S.tag;if((F===3||F===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;A!==null;){if(S=As(A),S===null)return;if(F=S.tag,F===5||F===6||F===26||F===27){d=v=S;continue e}A=A.parentNode}}d=d.return}mu(function(){var ee=v,ce=Qa(c),fe=[];e:{var se=qv.get(s);if(se!==void 0){var le=Ts,Me=s;switch(s){case"keypress":if(ct(c)===0)break e;case"keydown":case"keyup":le=oj;break;case"focusin":Me="focus",le=ps;break;case"focusout":Me="blur",le=ps;break;case"beforeblur":case"afterblur":le=ps;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=sf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=vu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=dj;break;case Fv:case Uv:case Iv:le=_u;break;case Hv:le=fj;break;case"scroll":case"scrollend":le=gu;break;case"wheel":le=mj;break;case"copy":case"cut":case"paste":le=tj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=_v;break;case"toggle":case"beforetoggle":le=xj}var He=(i&4)!==0,Bt=!He&&(s==="scroll"||s==="scrollend"),K=He?se!==null?se+"Capture":null:se;He=[];for(var V=ee,J;V!==null;){var he=V;if(J=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||J===null||K===null||(he=ia(V,K),he!=null&&He.push(Ko(V,he,J))),Bt)break;V=V.return}0<He.length&&(se=new le(se,Me,null,c,ce),fe.push({event:se,listeners:He}))}}if((i&7)===0){e:{if(se=s==="mouseover"||s==="pointerover",le=s==="mouseout"||s==="pointerout",se&&c!==hi&&(Me=c.relatedTarget||c.fromElement)&&(As(Me)||Me[pr]))break e;if((le||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,le?(Me=c.relatedTarget||c.toElement,le=ee,Me=Me?As(Me):null,Me!==null&&(Bt=o(Me),He=Me.tag,Me!==Bt||He!==5&&He!==27&&He!==6)&&(Me=null)):(le=null,Me=ee),le!==Me)){if(He=sf,he="onMouseLeave",K="onMouseEnter",V="mouse",(s==="pointerout"||s==="pointerover")&&(He=_v,he="onPointerLeave",K="onPointerEnter",V="pointer"),Bt=le==null?se:na(le),J=Me==null?se:na(Me),se=new He(he,V+"leave",le,c,ce),se.target=Bt,se.relatedTarget=J,he=null,As(ce)===ee&&(He=new He(K,V+"enter",Me,c,ce),He.target=J,He.relatedTarget=Bt,he=He),Bt=he,le&&Me)t:{for(He=gN,K=le,V=Me,J=0,he=K;he;he=He(he))J++;he=0;for(var $e=V;$e;$e=He($e))he++;for(;0<J-he;)K=He(K),J--;for(;0<he-J;)V=He(V),he--;for(;J--;){if(K===V||V!==null&&K===V.alternate){He=K;break t}K=He(K),V=He(V)}He=null}else He=null;le!==null&&hb(fe,se,le,He,!1),Me!==null&&Bt!==null&&hb(fe,Bt,Me,He,!0)}}e:{if(se=ee?na(ee):window,le=se.nodeName&&se.nodeName.toLowerCase(),le==="select"||le==="input"&&se.type==="file")var St=Av;else if(Cv(se))if(Tv)St=Cj;else{St=jj;var ze=Sj}else le=se.nodeName,!le||le.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ee&&Ya(ee.elementType)&&(St=Av):St=Nj;if(St&&(St=St(s,ee))){Ev(fe,St,c,ce);break e}ze&&ze(s,se,ee),s==="focusout"&&ee&&se.type==="number"&&ee.memoizedProps.value!=null&&Va(se,"number",se.value)}switch(ze=ee?na(ee):window,s){case"focusin":(Cv(ze)||ze.contentEditable==="true")&&(Ja=ze,df=ee,No=null);break;case"focusout":No=df=Ja=null;break;case"mousedown":hf=!0;break;case"contextmenu":case"mouseup":case"dragend":hf=!1,Pv(fe,c,ce);break;case"selectionchange":if(Aj)break;case"keydown":case"keyup":Pv(fe,c,ce)}var it;if(lf)e:{switch(s){case"compositionstart":var vt="onCompositionStart";break e;case"compositionend":vt="onCompositionEnd";break e;case"compositionupdate":vt="onCompositionUpdate";break e}vt=void 0}else Za?jv(s,c)&&(vt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(vt="onCompositionStart");vt&&(wv&&c.locale!=="ko"&&(Za||vt!=="onCompositionStart"?vt==="onCompositionEnd"&&Za&&(it=_t()):(H=ce,ge="value"in H?H.value:H.textContent,Za=!0)),ze=ud(ee,vt),0<ze.length&&(vt=new yv(vt,s,null,c,ce),fe.push({event:vt,listeners:ze}),it?vt.data=it:(it=Nv(c),it!==null&&(vt.data=it)))),(it=bj?yj(s,c):_j(s,c))&&(vt=ud(ee,"onBeforeInput"),0<vt.length&&(ze=new yv("onBeforeInput","beforeinput",null,c,ce),fe.push({event:ze,listeners:vt}),ze.data=it)),hN(fe,s,ee,c,ce)}ub(fe,i)})}function Ko(s,i,c){return{instance:s,listener:i,currentTarget:c}}function ud(s,i){for(var c=i+"Capture",d=[];s!==null;){var g=s,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=ia(s,c),g!=null&&d.unshift(Ko(s,g,v)),g=ia(s,i),g!=null&&d.push(Ko(s,g,v))),s.tag===3)return d;s=s.return}return[]}function gN(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function hb(s,i,c,d,g){for(var v=i._reactName,S=[];c!==null&&c!==d;){var A=c,F=A.alternate,ee=A.stateNode;if(A=A.tag,F!==null&&F===d)break;A!==5&&A!==26&&A!==27||ee===null||(F=ee,g?(ee=ia(c,v),ee!=null&&S.unshift(Ko(c,ee,F))):g||(ee=ia(c,v),ee!=null&&S.push(Ko(c,ee,F)))),c=c.return}S.length!==0&&s.push({event:i,listeners:S})}var xN=/\r\n?/g,vN=/\u0000|\uFFFD/g;function fb(s){return(typeof s=="string"?s:""+s).replace(xN,`
|
|
50
|
-
`).replace(vN,"")}function pb(s,i){return i=fb(i),fb(s)===i}function zt(s,i,c,d,g,v){switch(c){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||di(s,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&di(s,""+d);break;case"className":Ha(s,"class",d);break;case"tabIndex":Ha(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ha(s,c,d);break;case"style":hu(s,d,v);break;case"data":if(i!=="object"){Ha(s,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||c!=="href")){s.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Wa(""+d),s.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){s.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"?(i!=="input"&&zt(s,i,"name",g.name,g,null),zt(s,i,"formEncType",g.formEncType,g,null),zt(s,i,"formMethod",g.formMethod,g,null),zt(s,i,"formTarget",g.formTarget,g,null)):(zt(s,i,"encType",g.encType,g,null),zt(s,i,"method",g.method,g,null),zt(s,i,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Wa(""+d),s.setAttribute(c,d);break;case"onClick":d!=null&&(s.onclick=Lr);break;case"onScroll":d!=null&&ft("scroll",s);break;case"onScrollEnd":d!=null&&ft("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.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"){s.removeAttribute("xlink:href");break}c=Wa(""+d),s.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"?s.setAttribute(c,""+d):s.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"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":d===!0?s.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(c,d):s.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(c):s.setAttribute(c,d);break;case"popover":ft("beforetoggle",s),ft("toggle",s),ra(s,"popover",d);break;case"xlinkActuate":es(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":es(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":es(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":es(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":es(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":es(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":es(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":es(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":es(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ra(s,"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=fu.get(c)||c,ra(s,c,d))}}function Bp(s,i,c,d,g,v){switch(c){case"style":hu(s,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"children":typeof d=="string"?di(s,d):(typeof d=="number"||typeof d=="bigint")&&di(s,""+d);break;case"onScroll":d!=null&&ft("scroll",s);break;case"onScrollEnd":d!=null&&ft("scrollend",s);break;case"onClick":d!=null&&(s.onclick=Lr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ia.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),i=c.slice(2,g?c.length-7:void 0),v=s[Tn]||null,v=v!=null?v[c]:null,typeof v=="function"&&s.removeEventListener(i,v,g),typeof d=="function")){typeof v!="function"&&v!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(i,d,g);break e}c in s?s[c]=d:d===!0?s.setAttribute(c,""):ra(s,c,d)}}}function Dn(s,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",s),ft("load",s);var d=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var S=c[v];if(S!=null)switch(v){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:zt(s,i,v,S,c,null)}}g&&zt(s,i,"srcSet",c.srcSet,c,null),d&&zt(s,i,"src",c.src,c,null);return;case"input":ft("invalid",s);var A=v=S=g=null,F=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":S=ce;break;case"checked":F=ce;break;case"defaultChecked":ee=ce;break;case"value":v=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,i));break;default:zt(s,i,d,ce,c,null)}}uu(s,v,A,F,ee,S,g,!1);return;case"select":ft("invalid",s),d=S=v=null;for(g in c)if(c.hasOwnProperty(g)&&(A=c[g],A!=null))switch(g){case"value":v=A;break;case"defaultValue":S=A;break;case"multiple":d=A;default:zt(s,i,g,A,c,null)}i=v,c=S,s.multiple=!!d,i!=null?ui(s,!!d,i,!1):c!=null&&ui(s,!!d,c,!0);return;case"textarea":ft("invalid",s),v=g=d=null;for(S in c)if(c.hasOwnProperty(S)&&(A=c[S],A!=null))switch(S){case"value":d=A;break;case"defaultValue":g=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:zt(s,i,S,A,c,null)}vo(s,d,g,v);return;case"option":for(F in c)if(c.hasOwnProperty(F)&&(d=c[F],d!=null))switch(F){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:zt(s,i,F,d,c,null)}return;case"dialog":ft("beforetoggle",s),ft("toggle",s),ft("cancel",s),ft("close",s);break;case"iframe":case"object":ft("load",s);break;case"video":case"audio":for(d=0;d<Xo.length;d++)ft(Xo[d],s);break;case"image":ft("error",s),ft("load",s);break;case"details":ft("toggle",s);break;case"embed":case"source":case"link":ft("error",s),ft("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in c)if(c.hasOwnProperty(ee)&&(d=c[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:zt(s,i,ee,d,c,null)}return;default:if(Ya(i)){for(ce in c)c.hasOwnProperty(ce)&&(d=c[ce],d!==void 0&&Bp(s,i,ce,d,c,void 0));return}}for(A in c)c.hasOwnProperty(A)&&(d=c[A],d!=null&&zt(s,i,A,d,c,null))}function bN(s,i,c,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,S=null,A=null,F=null,ee=null,ce=null;for(le in c){var fe=c[le];if(c.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":F=fe;default:d.hasOwnProperty(le)||zt(s,i,le,null,d,fe)}}for(var se in d){var le=d[se];if(fe=c[se],d.hasOwnProperty(se)&&(le!=null||fe!=null))switch(se){case"type":v=le;break;case"name":g=le;break;case"checked":ee=le;break;case"defaultChecked":ce=le;break;case"value":S=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,i));break;default:le!==fe&&zt(s,i,se,le,d,fe)}}sa(s,S,A,F,ee,ce,v,g);return;case"select":le=S=A=se=null;for(v in c)if(F=c[v],c.hasOwnProperty(v)&&F!=null)switch(v){case"value":break;case"multiple":le=F;default:d.hasOwnProperty(v)||zt(s,i,v,null,d,F)}for(g in d)if(v=d[g],F=c[g],d.hasOwnProperty(g)&&(v!=null||F!=null))switch(g){case"value":se=v;break;case"defaultValue":A=v;break;case"multiple":S=v;default:v!==F&&zt(s,i,g,v,d,F)}i=A,c=S,d=le,se!=null?ui(s,!!c,se,!1):!!d!=!!c&&(i!=null?ui(s,!!c,i,!0):ui(s,!!c,c?[]:"",!1));return;case"textarea":le=se=null;for(A in c)if(g=c[A],c.hasOwnProperty(A)&&g!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:zt(s,i,A,null,d,g)}for(S in d)if(g=d[S],v=c[S],d.hasOwnProperty(S)&&(g!=null||v!=null))switch(S){case"value":se=g;break;case"defaultValue":le=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&zt(s,i,S,g,d,v)}Ga(s,se,le);return;case"option":for(var Me in c)if(se=c[Me],c.hasOwnProperty(Me)&&se!=null&&!d.hasOwnProperty(Me))switch(Me){case"selected":s.selected=!1;break;default:zt(s,i,Me,null,d,se)}for(F in d)if(se=d[F],le=c[F],d.hasOwnProperty(F)&&se!==le&&(se!=null||le!=null))switch(F){case"selected":s.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:zt(s,i,F,se,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 He in c)se=c[He],c.hasOwnProperty(He)&&se!=null&&!d.hasOwnProperty(He)&&zt(s,i,He,null,d,se);for(ee in d)if(se=d[ee],le=c[ee],d.hasOwnProperty(ee)&&se!==le&&(se!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,i));break;default:zt(s,i,ee,se,d,le)}return;default:if(Ya(i)){for(var Bt in c)se=c[Bt],c.hasOwnProperty(Bt)&&se!==void 0&&!d.hasOwnProperty(Bt)&&Bp(s,i,Bt,void 0,d,se);for(ce in d)se=d[ce],le=c[ce],!d.hasOwnProperty(ce)||se===le||se===void 0&&le===void 0||Bp(s,i,ce,se,d,le);return}}for(var K in c)se=c[K],c.hasOwnProperty(K)&&se!=null&&!d.hasOwnProperty(K)&&zt(s,i,K,null,d,se);for(fe in d)se=d[fe],le=c[fe],!d.hasOwnProperty(fe)||se===le||se==null&&le==null||zt(s,i,fe,se,d,le)}function mb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yN(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var g=c[d],v=g.transferSize,S=g.initiatorType,A=g.duration;if(v&&A&&mb(S)){for(S=0,A=g.responseEnd,d+=1;d<c.length;d++){var F=c[d],ee=F.startTime;if(ee>A)break;var ce=F.transferSize,fe=F.initiatorType;ce&&mb(fe)&&(F=F.responseEnd,S+=ce*(F<A?1:(A-ee)/(F-ee)))}if(--d,i+=8*(v+S)/(g.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Pp=null,$p=null;function dd(s){return s.nodeType===9?s:s.ownerDocument}function gb(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function xb(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function Fp(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Up=null;function _N(){var s=window.event;return s&&s.type==="popstate"?s===Up?!1:(Up=s,!0):(Up=null,!1)}var vb=typeof setTimeout=="function"?setTimeout:void 0,wN=typeof clearTimeout=="function"?clearTimeout:void 0,bb=typeof Promise=="function"?Promise:void 0,kN=typeof queueMicrotask=="function"?queueMicrotask:typeof bb<"u"?function(s){return bb.resolve(null).then(s).catch(SN)}:vb;function SN(s){setTimeout(function(){throw s})}function Ri(s){return s==="head"}function yb(s,i){var c=i,d=0;do{var g=c.nextSibling;if(s.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(d===0){s.removeChild(g),Nl(i);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Zo(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Zo(c);for(var v=c.firstChild;v;){var S=v.nextSibling,A=v.nodeName;v[us]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=S}}else c==="body"&&Zo(s.ownerDocument.body);c=g}while(c);Nl(i)}function _b(s,i){var c=s;s=0;do{var d=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=d}while(c)}function Ip(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Ip(c),oi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function jN(s,i,c,d){for(;s.nodeType===1;){var g=c;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[us])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=Ir(s.nextSibling),s===null)break}return null}function NN(s,i,c){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Ir(s.nextSibling),s===null))return null;return s}function wb(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=Ir(s.nextSibling),s===null))return null;return s}function Hp(s){return s.data==="$?"||s.data==="$~"}function qp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function CN(s,i){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||c.readyState!=="loading")i();else{var d=function(){i(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Ir(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var Vp=null;function kb(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(i===0)return Ir(s.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}s=s.nextSibling}return null}function Sb(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return s;i--}else c!=="/$"&&c!=="/&"||i++}s=s.previousSibling}return null}function jb(s,i,c){switch(i=dd(c),s){case"html":if(s=i.documentElement,!s)throw Error(r(452));return s;case"head":if(s=i.head,!s)throw Error(r(453));return s;case"body":if(s=i.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Zo(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);oi(s)}var Hr=new Map,Nb=new Set;function hd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Vs=$.d;$.d={f:EN,r:AN,D:TN,C:MN,L:RN,m:LN,X:ON,S:DN,M:zN};function EN(){var s=Vs.f(),i=rd();return s||i}function AN(s){var i=Jn(s);i!==null&&i.tag===5&&i.type==="form"?H0(i):Vs.r(s)}var kl=typeof document>"u"?null:document;function Cb(s,i,c){var d=kl;if(d&&typeof i=="string"&&i){var g=un(i);g='link[rel="'+s+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),Nb.has(g)||(Nb.add(g),s={rel:s,crossOrigin:c,href:i},d.querySelector(g)===null&&(i=d.createElement("link"),Dn(i,"link",s),nn(i),d.head.appendChild(i)))}}function TN(s){Vs.D(s),Cb("dns-prefetch",s,null)}function MN(s,i){Vs.C(s,i),Cb("preconnect",s,i)}function RN(s,i,c){Vs.L(s,i,c);var d=kl;if(d&&s&&i){var g='link[rel="preload"][as="'+un(i)+'"]';i==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+un(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+un(c.imageSizes)+'"]')):g+='[href="'+un(s)+'"]';var v=g;switch(i){case"style":v=Sl(s);break;case"script":v=jl(s)}Hr.has(v)||(s=x({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:s,as:i},c),Hr.set(v,s),d.querySelector(g)!==null||i==="style"&&d.querySelector(Jo(v))||i==="script"&&d.querySelector(ec(v))||(i=d.createElement("link"),Dn(i,"link",s),nn(i),d.head.appendChild(i)))}}function LN(s,i){Vs.m(s,i);var c=kl;if(c&&s){var d=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+un(d)+'"][href="'+un(s)+'"]',v=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=jl(s)}if(!Hr.has(v)&&(s=x({rel:"modulepreload",href:s},i),Hr.set(v,s),c.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ec(v)))return}d=c.createElement("link"),Dn(d,"link",s),nn(d),c.head.appendChild(d)}}}function DN(s,i,c){Vs.S(s,i,c);var d=kl;if(d&&s){var g=ds(d).hoistableStyles,v=Sl(s);i=i||"default";var S=g.get(v);if(!S){var A={loading:0,preload:null};if(S=d.querySelector(Jo(v)))A.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":i},c),(c=Hr.get(v))&&Gp(s,c);var F=S=d.createElement("link");nn(F),Dn(F,"link",s),F._p=new Promise(function(ee,ce){F.onload=ee,F.onerror=ce}),F.addEventListener("load",function(){A.loading|=1}),F.addEventListener("error",function(){A.loading|=2}),A.loading|=4,fd(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:A},g.set(v,S)}}}function ON(s,i){Vs.X(s,i);var c=kl;if(c&&s){var d=ds(c).hoistableScripts,g=jl(s),v=d.get(g);v||(v=c.querySelector(ec(g)),v||(s=x({src:s,async:!0},i),(i=Hr.get(g))&&Yp(s,i),v=c.createElement("script"),nn(v),Dn(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function zN(s,i){Vs.M(s,i);var c=kl;if(c&&s){var d=ds(c).hoistableScripts,g=jl(s),v=d.get(g);v||(v=c.querySelector(ec(g)),v||(s=x({src:s,async:!0,type:"module"},i),(i=Hr.get(g))&&Yp(s,i),v=c.createElement("script"),nn(v),Dn(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function Eb(s,i,c,d){var g=(g=Ce.current)?hd(g):null;if(!g)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=Sl(c.href),c=ds(g).hoistableStyles,d=c.get(i),d||(d={type:"style",instance:null,count:0,state:null},c.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Sl(c.href);var v=ds(g).hoistableStyles,S=v.get(s);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,S),(v=g.querySelector(Jo(s)))&&!v._p&&(S.instance=v,S.state.loading=5),Hr.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Hr.set(s,c),v||BN(g,s,c,S.state))),i&&d===null)throw Error(r(528,""));return S}if(i&&d!==null)throw Error(r(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=jl(c),c=ds(g).hoistableScripts,d=c.get(i),d||(d={type:"script",instance:null,count:0,state:null},c.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Sl(s){return'href="'+un(s)+'"'}function Jo(s){return'link[rel="stylesheet"]['+s+"]"}function Ab(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function BN(s,i,c,d){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=s.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Dn(i,"link",c),nn(i),s.head.appendChild(i))}function jl(s){return'[src="'+un(s)+'"]'}function ec(s){return"script[async]"+s}function Tb(s,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var d=s.querySelector('style[data-href~="'+un(c.href)+'"]');if(d)return i.instance=d,nn(d),d;var g=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),nn(d),Dn(d,"style",g),fd(d,c.precedence,s),i.instance=d;case"stylesheet":g=Sl(c.href);var v=s.querySelector(Jo(g));if(v)return i.state.loading|=4,i.instance=v,nn(v),v;d=Ab(c),(g=Hr.get(g))&&Gp(d,g),v=(s.ownerDocument||s).createElement("link"),nn(v);var S=v;return S._p=new Promise(function(A,F){S.onload=A,S.onerror=F}),Dn(v,"link",d),i.state.loading|=4,fd(v,c.precedence,s),i.instance=v;case"script":return v=jl(c.src),(g=s.querySelector(ec(v)))?(i.instance=g,nn(g),g):(d=c,(g=Hr.get(v))&&(d=x({},c),Yp(d,g)),s=s.ownerDocument||s,g=s.createElement("script"),nn(g),Dn(g,"link",d),s.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,fd(d,c.precedence,s));return i.instance}function fd(s,i,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,v=g,S=0;S<d.length;S++){var A=d[S];if(A.dataset.precedence===i)v=A;else if(v!==g)break}v?v.parentNode.insertBefore(s,v.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(s,i.firstChild))}function Gp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function Yp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var pd=null;function Mb(s,i,c){if(pd===null){var d=new Map,g=pd=new Map;g.set(c,d)}else g=pd,d=g.get(c),d||(d=new Map,g.set(c,d));if(d.has(s))return d;for(d.set(s,null),c=c.getElementsByTagName(s),g=0;g<c.length;g++){var v=c[g];if(!(v[us]||v[en]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=s+S;var A=d.get(S);A?A.push(v):d.set(S,[v])}}return d}function Rb(s,i,c){s=s.ownerDocument||s,s.head.insertBefore(c,i==="title"?s.querySelector("head > title"):null)}function PN(s,i,c){if(c===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Lb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function $N(s,i,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=Sl(d.href),v=i.querySelector(Jo(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=md.bind(s),i.then(s,s)),c.state.loading|=4,c.instance=v,nn(v);return}v=i.ownerDocument||i,d=Ab(d),(g=Hr.get(g))&&Gp(d,g),v=v.createElement("link"),nn(v);var S=v;S._p=new Promise(function(A,F){S.onload=A,S.onerror=F}),Dn(v,"link",d),c.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=md.bind(s),i.addEventListener("load",c),i.addEventListener("error",c))}}var Wp=0;function FN(s,i){return s.stylesheets&&s.count===0&&xd(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var d=setTimeout(function(){if(s.stylesheets&&xd(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+i);0<s.imgBytes&&Wp===0&&(Wp=62500*yN());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&xd(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>Wp?50:800)+i);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function md(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var gd=null;function xd(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,gd=new Map,i.forEach(UN,s),gd=null,md.call(s))}function UN(s,i){if(!(i.state.loading&4)){var c=gd.get(s);if(c)var d=c.get(null);else{c=new Map,gd.set(s,c);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var S=g[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),d=S)}d&&c.set(null,d)}g=i.instance,S=g.getAttribute("data-precedence"),v=c.get(S)||d,v===d&&c.set(null,g),c.set(S,g),this.count++,d=md.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),v?v.parentNode.insertBefore(g,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),i.state.loading|=4}}var tc={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function IN(s,i,c,d,g,v,S,A,F){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Pn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pn(0),this.hiddenUpdates=Pn(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function Db(s,i,c,d,g,v,S,A,F,ee,ce,fe){return s=new IN(s,i,c,S,F,ee,ce,fe,A),i=1,v===!0&&(i|=24),v=gr(3,null,null,i),s.current=v,v.stateNode=s,i=Cf(),i.refCount++,s.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:i},Mf(v),s}function Ob(s){return s?(s=nl,s):nl}function zb(s,i,c,d,g,v){g=Ob(g),d.context===null?d.context=g:d.pendingContext=g,d=_i(i),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=wi(s,d,i),c!==null&&(ar(c,s,i),Lo(c,s,i))}function Bb(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<i?c:i}}function Qp(s,i){Bb(s,i),(s=s.alternate)&&Bb(s,i)}function Pb(s){if(s.tag===13||s.tag===31){var i=ua(s,67108864);i!==null&&ar(i,s,67108864),Qp(s,67108864)}}function $b(s){if(s.tag===13||s.tag===31){var i=_r();i=Yn(i);var c=ua(s,i);c!==null&&ar(c,s,i),Qp(s,i)}}var vd=!0;function HN(s,i,c,d){var g=P.T;P.T=null;var v=$.p;try{$.p=2,Xp(s,i,c,d)}finally{$.p=v,P.T=g}}function qN(s,i,c,d){var g=P.T;P.T=null;var v=$.p;try{$.p=8,Xp(s,i,c,d)}finally{$.p=v,P.T=g}}function Xp(s,i,c,d){if(vd){var g=Kp(d);if(g===null)zp(s,i,d,bd,c),Ub(s,d);else if(GN(g,s,i,c,d))d.stopPropagation();else if(Ub(s,d),i&4&&-1<VN.indexOf(s)){for(;g!==null;){var v=Jn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=ve(v.pendingLanes);if(S!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var F=1<<31-st(S);A.entanglements[1]|=F,S&=~F}vs(v),(Ct&6)===0&&(td=Te()+500,Qo(0))}}break;case 31:case 13:A=ua(v,2),A!==null&&ar(A,v,2),rd(),Qp(v,2)}if(v=Kp(d),v===null&&zp(s,i,d,bd,c),v===g)break;g=v}g!==null&&d.stopPropagation()}else zp(s,i,d,null,c)}}function Kp(s){return s=Qa(s),Zp(s)}var bd=null;function Zp(s){if(bd=null,s=As(s),s!==null){var i=o(s);if(i===null)s=null;else{var c=i.tag;if(c===13){if(s=u(i),s!==null)return s;s=null}else if(c===31){if(s=h(i),s!==null)return s;s=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return bd=s,null}function Fb(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Xr()){case oe:return 2;case ke:return 8;case Q:case xe:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var Jp=!1,Li=null,Di=null,Oi=null,nc=new Map,rc=new Map,zi=[],VN="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 Ub(s,i){switch(s){case"focusin":case"focusout":Li=null;break;case"dragenter":case"dragleave":Di=null;break;case"mouseover":case"mouseout":Oi=null;break;case"pointerover":case"pointerout":nc.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":rc.delete(i.pointerId)}}function sc(s,i,c,d,g,v){return s===null||s.nativeEvent!==v?(s={blockedOn:i,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[g]},i!==null&&(i=Jn(i),i!==null&&Pb(i)),s):(s.eventSystemFlags|=d,i=s.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),s)}function GN(s,i,c,d,g){switch(i){case"focusin":return Li=sc(Li,s,i,c,d,g),!0;case"dragenter":return Di=sc(Di,s,i,c,d,g),!0;case"mouseover":return Oi=sc(Oi,s,i,c,d,g),!0;case"pointerover":var v=g.pointerId;return nc.set(v,sc(nc.get(v)||null,s,i,c,d,g)),!0;case"gotpointercapture":return v=g.pointerId,rc.set(v,sc(rc.get(v)||null,s,i,c,d,g)),!0}return!1}function Ib(s){var i=As(s.target);if(i!==null){var c=o(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){s.blockedOn=i,fo(s.priority,function(){$b(c)});return}}else if(i===31){if(i=h(c),i!==null){s.blockedOn=i,fo(s.priority,function(){$b(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function yd(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var c=Kp(s.nativeEvent);if(c===null){c=s.nativeEvent;var d=new c.constructor(c.type,c);hi=d,c.target.dispatchEvent(d),hi=null}else return i=Jn(c),i!==null&&Pb(i),s.blockedOn=c,!1;i.shift()}return!0}function Hb(s,i,c){yd(s)&&c.delete(i)}function YN(){Jp=!1,Li!==null&&yd(Li)&&(Li=null),Di!==null&&yd(Di)&&(Di=null),Oi!==null&&yd(Oi)&&(Oi=null),nc.forEach(Hb),rc.forEach(Hb)}function _d(s,i){s.blockedOn===i&&(s.blockedOn=null,Jp||(Jp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,YN)))}var wd=null;function qb(s){wd!==s&&(wd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){wd===s&&(wd=null);for(var i=0;i<s.length;i+=3){var c=s[i],d=s[i+1],g=s[i+2];if(typeof d!="function"){if(Zp(d||c)===null)continue;break}var v=Jn(c);v!==null&&(s.splice(i,3),i-=3,Kf(v,{pending:!0,data:g,method:c.method,action:d},d,g))}}))}function Nl(s){function i(F){return _d(F,s)}Li!==null&&_d(Li,s),Di!==null&&_d(Di,s),Oi!==null&&_d(Oi,s),nc.forEach(i),rc.forEach(i);for(var c=0;c<zi.length;c++){var d=zi[c];d.blockedOn===s&&(d.blockedOn=null)}for(;0<zi.length&&(c=zi[0],c.blockedOn===null);)Ib(c),c.blockedOn===null&&zi.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var g=c[d],v=c[d+1],S=g[Tn]||null;if(typeof v=="function")S||qb(c);else if(S){var A=null;if(v&&v.hasAttribute("formAction")){if(g=v,S=v[Tn]||null)A=S.formAction;else if(Zp(g)!==null)continue}else A=S.action;typeof A=="function"?c[d+1]=A:(c.splice(d,3),d-=3),qb(c)}}}function Vb(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function i(){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",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function em(s){this._internalRoot=s}kd.prototype.render=em.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));var c=i.current,d=_r();zb(c,d,s,i,null,null)},kd.prototype.unmount=em.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;zb(s.current,2,null,s,null,null),rd(),i[pr]=null}};function kd(s){this._internalRoot=s}kd.prototype.unstable_scheduleHydration=function(s){if(s){var i=ho();s={blockedOn:null,target:s,priority:i};for(var c=0;c<zi.length&&i!==0&&i<zi[c].priority;c++);zi.splice(c,0,s),c===0&&Ib(s)}};var Gb=t.version;if(Gb!=="19.2.8")throw Error(r(527,Gb,"19.2.8"));$.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=p(i),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var WN={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sd.isDisabled&&Sd.supportsFiber)try{ot=Sd.inject(WN),Et=Sd}catch{}}return ac.createRoot=function(s,i){if(!a(s))throw Error(r(299));var c=!1,d="",g=J0,v=e1,S=t1;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=Db(s,1,!1,null,null,c,d,null,g,v,S,Vb),s[pr]=i.current,Op(s),new em(i)},ac.hydrateRoot=function(s,i,c){if(!a(s))throw Error(r(299));var d=!1,g="",v=J0,S=e1,A=t1,F=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&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(A=c.onRecoverableError),c.formState!==void 0&&(F=c.formState)),i=Db(s,1,!0,i,c??null,d,g,F,v,S,A,Vb),i.context=Ob(null),c=i.current,d=_r(),d=Yn(d),g=_i(d),g.callback=null,wi(c,g,d),c=d,i.current.lanes=c,Vt(i,c),vs(i),s[pr]=i.current,Op(s),new kd(i)},ac.version="19.2.8",ac}var sy;function lC(){if(sy)return rm.exports;sy=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(),rm.exports=aC(),rm.exports}var oC=lC();const iy=e=>{let t;const n=new Set,r=(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,h={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(r,a,h);return h},cC=(e=>e?iy(e):iy),uC=e=>e;function dC(e,t=uC){const n=jd.useSyncExternalStore(e.subscribe,jd.useCallback(()=>t(e.getState()),[e,t]),jd.useCallback(()=>t(e.getInitialState()),[e,t]));return jd.useDebugValue(n),n}const ay=e=>{const t=cC(e),n=r=>dC(t,r);return Object.assign(n,t),n},hC=(e=>e?ay(e):ay),fg="companion_auth_token";function ly(){return typeof window>"u"?null:localStorage.getItem(fg)||null}const fC=e=>({authToken:ly(),isAuthenticated:ly()!==null,setAuthToken:t=>{localStorage.setItem(fg,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(fg),e({authToken:null,isAuthenticated:!1})}});function Qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function pC(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function mC(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function gC(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function xC(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const vC=e=>({sessions:new Map,sdkSessions:[],currentSessionId:gC(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:mC(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:xC(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const r=new Map(n.sessions);r.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:r,messages:a}}),updateSession:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const r=Qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(r.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Qt(n.sessions,t),connectionStatus:Qt(n.connectionStatus,t),cliConnected:Qt(n.cliConnected,t),cliReconnecting:Qt(n.cliReconnecting,t),sessionStatus:Qt(n.sessionStatus,t),previousPermissionMode:Qt(n.previousPermissionMode,t),sessionNames:r,recentlyRenamed:pC(n.recentlyRenamed,t),mcpServers:Qt(n.mcpServers,t),rateLimit:Qt(n.rateLimit,t),prStatus:Qt(n.prStatus,t),linkedLinearIssues:Qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Qt(n.messages,t),streaming:Qt(n.streaming,t),streamingStartedAt:Qt(n.streamingStartedAt,t),streamingOutputTokens:Qt(n.streamingOutputTokens,t),pendingPermissions:Qt(n.pendingPermissions,t),aiResolvedPermissions:Qt(n.aiResolvedPermissions,t),sessionTasks:Qt(n.sessionTasks,t),changedFilesTick:Qt(n.changedFilesTick,t),gitChangedFilesCount:Qt(n.gitChangedFilesCount,t),sessionProcesses:Qt(n.sessionProcesses,t),toolProgress:Qt(n.toolProgress,t),toolActivity:Qt(n.toolActivity,t),diffPanelSelectedFile:Qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(r=>{const a=new Map(r.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(r=>{const a=new Map(r.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(r=>{const a=new Map(r.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(r=>{const a=new Map(r.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(r=>{const a=new Map(r.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(r=>{const a=new Map(r.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const r=new Set(n.recentlyRenamed);return r.add(t),{recentlyRenamed:r}}),clearRecentlyRenamed:t=>e(n=>{const r=new Set(n.recentlyRenamed);return r.delete(t),{recentlyRenamed:r}}),setPRStatus:(t,n)=>e(r=>{const a=new Map(r.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(r=>{const a=new Map(r.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(r=>{const a=new Map(r.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(r=>{const a=new Map(r.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const r=new Set(n.collapsedProjects);return r.has(t)?r.delete(t):r.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(r))),{collapsedProjects:r}}),setSessionAiValidation:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),bC=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(r=>{const a=r.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return r;const o=new Map(r.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(r=>{const a=new Map(r.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(r=>{const a=new Map(r.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(r=>{const a=new Map(r.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(r=>{const a=new Map(r.streamingStartedAt),o=new Map(r.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(r=>{const a=new Map(r.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(r=>{const a=new Map(r.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const r=new Map(n.promptSuggestions);return r.delete(t),{promptSuggestions:r}})}),yC=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(r=>{const a=new Map(r.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(r=>{const a=new Map(r.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(r=>{const a=new Map(r.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 r=new Map(n.aiResolvedPermissions);return r.delete(t),{aiResolvedPermissions:r}})}),_C=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(r=>{const a=new Map(r.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(r=>{const a=new Map(r.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,r)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(h=>h.id===n?{...h,...r}:h)),{sessionTasks:o}}),addProcess:(t,n)=>e(r=>{const a=new Map(r.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,r)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.taskId===n?{...h,...r}:h)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,r)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...r}:h)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(r=>{const a=new Map(r.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,r)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...r}:h)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const r=new Map(n.changedFilesTick);return r.set(t,(r.get(t)??0)+1),{changedFilesTick:r}}),setGitChangedFilesCount:(t,n)=>e(r=>{const a=new Map(r.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,r)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,r),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(r=>{const a=new Map(r.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(r=>{const a=new Map(r.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(r=>{const a=new Map(r.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(h=>h.toolUseId===n.toolUseId);if(u>=0){const h=o[u];o[u]={...h,...n,startedAt:h.startedAt,completedAt:n.completedAt??h.completedAt,elapsedSeconds:Math.max(h.elapsedSeconds,n.elapsedSeconds),isError:h.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,r)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...r}:h)),{toolActivity:o}})}),ii=[{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:"server-disk",label:"Server Disk",description:"Free space on the Companion data volume",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"]}],wC=ii.map(e=>e.id),uw="cc-task-panel-config";function pg(){return{order:[...wC],enabled:Object.fromEntries(ii.map(e=>[e.id,!0]))}}function kC(){if(typeof window>"u")return pg();try{const e=localStorage.getItem(uw);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of ii)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const r=new Set(ii.map(a=>a.id));return t.order=t.order.filter(a=>r.has(a)),t}}catch{}return pg()}function Nd(e){try{localStorage.setItem(uw,JSON.stringify(e))}catch{}}function SC(){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 jC(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function NC(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function dw(){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 CC(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const EC=e=>({darkMode:SC(),notificationSound:jC(),notificationDesktop:NC(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:kC(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:dw(),density:CC(),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 r={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Nd(r),{taskPanelConfig:r}}),moveSectionUp:t=>e(n=>{const r=[...n.taskPanelConfig.order],a=r.indexOf(t);if(a<=0)return n;[r[a-1],r[a]]=[r[a],r[a-1]];const o={...n.taskPanelConfig,order:r};return Nd(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const r=[...n.taskPanelConfig.order],a=r.indexOf(t);if(a<0||a>=r.length-1)return n;[r[a],r[a+1]]=[r[a+1],r[a]];const o={...n.taskPanelConfig,order:r};return Nd(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=pg();Nd(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 r=new Map(n.chatTabReentryTickBySession),a=(r.get(t)??0)+1;return r.set(t,a),{chatTabReentryTickBySession:r}}),setDiffPanelSelectedFile:(t,n)=>e(r=>{const a=new Map(r.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 hw(){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 AC=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:hw(),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 r=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=r?a:a+1,h=r?o+1:o,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:r?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,f],activeQuickTerminalTabId:f.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:h}}),closeQuickTerminalTab:t=>e(n=>{var o;const r=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=r[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:r,activeQuickTerminalTabId:a,quickTerminalOpen:r.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 TC(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const MC=e=>({updateInfo:null,updateDismissedVersion:TC(),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 r=n.creationProgress||[],a=r.findIndex(o=>o.step===t.step);if(a>=0){const o=[...r];return o[a]=t,{creationProgress:o}}return{creationProgress:[...r,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})}),RC=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(r=>{const a=r.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(r.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const r=new Map(n.magicUiState);return r.delete(t),{magicUiState:r}})}),G=hC((...e)=>({...fC(...e),...vC(...e),...bC(...e),...yC(...e),..._C(...e),...EC(...e),...AC(...e),...MC(...e),...RC(...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:dw(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:hw(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),LC=Object.freeze(Object.defineProperty({__proto__:null,useStore:G},Symbol.toStringTag,{value:"Module"})),DC="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",OC=/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 zC(e){return OC.test(e)}function BC(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:zC(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const oy=["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"],cy=["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 uy(){const e=oy[Math.floor(Math.random()*oy.length)],t=cy[Math.floor(Math.random()*cy.length)];return`${e} ${t}`}function fw(e){for(let t=0;t<100;t++){const n=uy();if(!e.has(n))return n}return uy()}let lm=null;function PC(){return lm||(lm=new AudioContext),lm}function $C(){try{const e=PC();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),r.gain.setValueAtTime(.3,t),r.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(r),r.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 pw{diff(t,n,r={}){let a;typeof r=="function"?(a=r,r={}):"callback"in r&&(a=r.callback);const o=this.castInput(t,r),u=this.castInput(n,r),h=this.removeEmpty(this.tokenize(o,r)),f=this.removeEmpty(this.tokenize(u,r));return this.diffWithOptionsObj(h,f,r,a)}diffWithOptionsObj(t,n,r,a){var o;const u=E=>{if(E=this.postProcess(E,r),a){setTimeout(function(){a(E)},0);return}else return E},h=n.length,f=t.length;let p=1,m=h+f;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const x=(o=r.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,r);if(y[0].oldPos+1>=f&&_+1>=h)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const w=()=>{for(let E=Math.max(j,-p);E<=Math.min(N,p);E+=2){let C;const L=y[E-1],O=y[E+1];L&&(y[E-1]=void 0);let D=!1;if(O){const I=O.oldPos-E;D=O&&0<=I&&I<h}const U=L&&L.oldPos+1<f;if(!D&&!U){y[E]=void 0;continue}if(!U||D&&L.oldPos<O.oldPos?C=this.addToPath(O,!0,!1,0,r):C=this.addToPath(L,!1,!0,1,r),_=this.extractCommon(C,n,t,E,r),C.oldPos+1>=f&&_+1>=h)return u(this.buildValues(C.lastComponent,n,t))||!0;y[E]=C,C.oldPos+1>=f&&(N=Math.min(N,E-1)),_+1>=h&&(j=Math.max(j,E+1))}p++};if(a)(function E(){setTimeout(function(){if(p>m||Date.now()>b)return a(void 0);w()||E()},0)})();else for(;p<=m&&Date.now()<=b;){const E=w();if(E)return E}}addToPath(t,n,r,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===r?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:r,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:r,previousComponent:u}}}extractCommon(t,n,r,a,o){const u=n.length,h=r.length;let f=t.oldPos,p=f-a,m=0;for(;p+1<u&&f+1<h&&this.equals(r[f+1],n[p+1],o);)p++,f++,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=f,p}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);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,r){const a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let h=0,f=0,p=0;for(;h<u;h++){const m=a[h];if(m.removed)m.value=this.join(r.slice(p,p+m.count)),p+=m.count;else{if(!m.added&&this.useLongestToken){let x=n.slice(f,f+m.count);x=x.map(function(b,y){const _=r[p+y];return _.length>b.length?_:b}),m.value=this.join(x)}else m.value=this.join(n.slice(f,f+m.count));f+=m.count,m.added||(p+=m.count)}}return a}}function dy(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 hy(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 mg(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 gg(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 lc(e,t){return mg(e,t,"")}function Cd(e,t){return gg(e,t,"")}function fy(e,t){return t.slice(0,FC(e,t))}function FC(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);const a=Array(r);let o=0;a[0]=0;for(let u=1;u<r;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 mw(e,t){const n=[];for(const r of Array.from(t.segment(e))){const a=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function xg(e,t){if(t)return Ac(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Bl(e,t){if(t)return Ac(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Ac(e,t){if(!t)return[Bl(e),xg(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=mw(e,t),r=n[0],a=n[n.length-1],o=/\s/.test(r)?r:"",u=/\s/.test(a)?a:"";return[o,u]}const py="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}",UC=new RegExp(`[${py}]+|\\s+|[^${py}]`,"ug");class IC extends pw{equals(t,n,r){return r.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let r;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=mw(t,u)}else r=t.match(UC)||[];const a=[];let o=null;return r.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,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let r=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&my(r,o,a,u,n.intlSegmenter),r=u,a=null,o=null)}),(a||o)&&my(r,o,a,null,n.intlSegmenter),t}}const HC=new IC;function qC(e,t,n){return HC.diff(e,t,n)}function my(e,t,n,r,a){if(t&&n){const[o,u]=Ac(t.value,a),[h,f]=Ac(n.value,a);if(e){const p=dy(o,h);e.value=gg(e.value,h,p),t.value=lc(t.value,p),n.value=lc(n.value,p)}if(r){const p=hy(u,f);r.value=mg(r.value,f,p),t.value=Cd(t.value,p),n.value=Cd(n.value,p)}}else if(n){if(e){const o=Bl(n.value,a);n.value=n.value.substring(o.length)}if(r){const o=Bl(r.value,a);r.value=r.value.substring(o.length)}}else if(e&&r){const o=Bl(r.value,a),[u,h]=Ac(t.value,a),f=dy(o,u);t.value=lc(t.value,f);const p=hy(lc(o,f),h);t.value=Cd(t.value,p),r.value=mg(r.value,o,p),e.value=gg(e.value,o,o.slice(0,o.length-p.length))}else if(r){const o=Bl(r.value,a),u=xg(t.value,a),h=fy(u,o);t.value=Cd(t.value,h)}else if(e){const o=xg(e.value,a),u=Bl(t.value,a),h=fy(o,u);t.value=lc(t.value,h)}}class VC extends pw{constructor(){super(...arguments),this.tokenize=YC}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
51
|
-
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
52
|
-
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
53
|
-
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
54
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const GC=new VC;function gy(e,t,n){return GC.diff(e,t,n)}function YC(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
55
|
-
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let a=0;a<r.length;a++){const o=r[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function WC(e,t,n,r,a,o,u){let h;u?typeof u=="function"?h={callback:u}:h=u:h={},typeof h.context>"u"&&(h.context=4);const f=h.context;if(h.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(h.callback){const{callback:m}=h;gy(n,r,Object.assign(Object.assign({},h),{callback:x=>{const b=p(x);m(b)}}))}else return p(gy(n,r,h));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,w=1;for(let E=0;E<m.length;E++){const C=m[E],L=C.lines||QC(C.value);if(C.lines=L,C.added||C.removed){if(!y){const O=m[E-1];y=N,_=w,O&&(j=f>0?x(O.lines.slice(-f)):[],y-=j.length,_-=j.length)}for(const O of L)j.push((C.added?"+":"-")+O);C.added?w+=L.length:N+=L.length}else{if(y)if(L.length<=f*2&&E<m.length-2)for(const O of x(L))j.push(O);else{const O=Math.min(L.length,f);for(const U of x(L.slice(0,O)))j.push(U);const D={oldStart:y,oldLines:N-y+O,newStart:_,newLines:w-_+O,lines:j};b.push(D),y=0,_=0,j=[]}N+=L.length,w+=L.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 QC(e){const t=e.endsWith(`
|
|
57
|
-
`),n=e.split(`
|
|
58
|
-
`).map(r=>r+`
|
|
59
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function XC(e,t){return WC("","",e,t,"","",{context:3}).hunks.map(r=>{const a=`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`,o=[];let u=r.oldStart,h=r.newStart;for(const f of r.lines){const p=f[0],m=f.slice(1);p==="-"?o.push({type:"del",content:m,oldLineNo:u++}):p==="+"?o.push({type:"add",content:m,newLineNo:h++}):o.push({type:"context",content:m,oldLineNo:u++,newLineNo:h++})}return gw(o),{header:a,lines:o}})}function KC(e){const t=[],n=e.split(`
|
|
60
|
-
`);let r=null,a=null,o=0,u=0;for(const h of n){if(h.startsWith("diff --git")||h.startsWith("diff --cc")){a&&r&&r.hunks.push(a),r&&t.push(r),r={fileName:"",hunks:[]},a=null;continue}if(h.startsWith("--- a/")||h.startsWith("--- /dev/null"))continue;if(h.startsWith("+++ b/")){r&&(r.fileName=h.slice(6));continue}if(h.startsWith("+++ /dev/null")||h.startsWith("index ")||h.startsWith("new file")||h.startsWith("deleted file")||h.startsWith("old mode")||h.startsWith("new mode")||h.startsWith("rename from")||h.startsWith("rename to")||h.startsWith("similarity index")||h.startsWith("Binary files"))continue;const f=h.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(f){a&&r&&r.hunks.push(a),o=parseInt(f[1],10),u=parseInt(f[2],10),a={header:h,lines:[]};continue}a&&(h.startsWith("+")?a.lines.push({type:"add",content:h.slice(1),newLineNo:u++}):h.startsWith("-")?a.lines.push({type:"del",content:h.slice(1),oldLineNo:o++}):h.startsWith(" ")&&a.lines.push({type:"context",content:h.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&r&&r.hunks.push(a),r&&t.push(r);for(const h of t)for(const f of h.hunks)gw(f.lines);return t}function gw(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const r=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=r-n,h=o-a;if(u>0&&h>0){const f=Math.min(u,h);for(let p=0;p<f;p++){const m=e[n+p],x=e[a+p],b=qC(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 ZC({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 JC({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,r)=>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(ZC,{line:n}),!n.content&&" "]})]},r))]})}function e3({fileName:e}){const t=e.split("/"),n=t.pop()||e,r=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"})]}),r&&l.jsxs("span",{className:"text-cc-muted",children:[r,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function ao({oldText:e,newText:t,unifiedDiff:n,fileName:r,mode:a="compact"}){const o=a==="compact",u=!o,h=k.useMemo(()=>{if(n)return KC(n);const f=e??"",p=t??"";if(!f&&!p)return[];const m=XC(f,p);return[{fileName:r||"",hunks:m}]},[e,t,n,r]);return h.length===0||h.every(f=>f.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:h.map((f,p)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||r)&&l.jsx(e3,{fileName:f.fileName||r||""}),f.hunks.map((m,x)=>l.jsx(JC,{hunk:m,showLineNumbers:u},x))]},p))})}const xw=k.createContext(null);function Ez({value:e,children:t}){return l.jsx(xw.Provider,{value:e,children:t})}function t3(){const e=k.useContext(xw),t=G(n=>n.density);return e??t}function $a(){return t3()==="compact"}function Hh({open:e,onToggle:t,marker:n,label:r,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:r}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const n3={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 tu(e){return n3[e]||"tool"}function Yi(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 vw({name:e,input:t,toolUseId:n}){const[r,a]=k.useState(e==="Edit"),o=tu(e),u=Yi(e),h=Ic(e,t);return e==="Edit"?l.jsx(r3,{input:t,toolUseId:n}):e==="Bash"?l.jsx(s3,{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(!r),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 ${r?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Xl,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),h&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:h})]}),r&&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(i3,{name:e,input:t})})})]})}function r3({input:e,toolUseId:t}){const n=$a(),[r,a]=k.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",h=String(e.old_string||""),f=String(e.new_string||""),p=!!(h||f),m=!!e.replace_all,[x,b]=k.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=(h+f).split(`
|
|
61
|
-
`).length,N=j>15,w=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(ao,{oldText:h,newText:f,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 L=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:L})]},`${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(Hh,{open:r,onToggle:()=>a(!r),marker:"±",label:`Edit ${u||"file"}${m?" (all)":""}`,meta:p?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),r&&l.jsx("div",{className:"mt-0.5",children:w})]}):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"})]}),w]})}function s3({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",r=typeof e.description=="string"?e.description:"",a=$a(),[o,u]=k.useState(!1);if(a){const h=n.split(`
|
|
62
|
-
`)[0]||"",f=r||h||"Command",p=n?n.split(`
|
|
63
|
-
`).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(Hh,{open:o,onToggle:()=>u(!o),marker:"$",label:f,meta:!o&&p>0?`+${p}`:void 0,labelClassName:r?"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:[r&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:r}),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 i3({name:e,input:t}){switch(e){case"Bash":return l.jsx(a3,{input:t});case"Edit":return l.jsx(l3,{input:t});case"Write":return l.jsx(o3,{input:t});case"Read":return l.jsx(c3,{input:t});case"Glob":return l.jsx(u3,{input:t});case"Grep":return l.jsx(d3,{input:t});case"WebSearch":case"web_search":return l.jsx(h3,{input:t});case"WebFetch":return l.jsx(f3,{input:t});case"Task":return l.jsx(p3,{input:t});case"TodoWrite":return l.jsx(m3,{input:t});case"NotebookEdit":return l.jsx(g3,{input:t});case"SendMessage":return l.jsx(x3,{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 a3({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 l3({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=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||r?l.jsx(ao,{oldText:n,newText:r,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,h)=>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}-${h}`))]}):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 o3({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(ao,{newText:n,fileName:t,mode:"compact"})}function c3({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,r=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||r!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),r!=null&&l.jsxs("span",{children:["limit: ",r]})]})]})}function u3({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 d3({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 h3({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 f3({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 p3({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 m3({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,r)=>{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"})]},r)})}):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 g3({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,r=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]}),r&&l.jsxs("span",{children:["mode: ",r]}),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 x3({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 Ic(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),r=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+r;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 Xl({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 v3=2e3,b3=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"]),ls=new Map,si=new Map,oh=new Map,Kd=new Map,Ii=new Map,Tc=new Map,Hc=new Map,ch=new Map;function bw(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function yw(e){const t=G.getState(),n=t.sdkSessions.find(r=>r.sessionId===e);return n?!n.archived:t.currentSessionId===e}function y3(){const e=G.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 qc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){qc=!0;for(const[e,t]of si)clearTimeout(t),si.delete(e)}else{qc=!1;for(const e of y3()){if(!yw(e))continue;const t=ls.get(e);if(!bw(t)){if(t){try{t.close()}catch{}ls.delete(e)}nu(e)}}}});function Zd(e){const t=e.startsWith("/"),n=e.split("/"),r=[];for(const a of n)if(!(!a||a===".")){if(a===".."){r.length>0&&r.pop();continue}r.push(a)}return`${t?"/":""}${r.join("/")}`}function _3(e,t){return e.startsWith("/")||!t?Zd(e):Zd(`${t}/${e}`)}function w3(e,t){if(!t)return!0;const n=Zd(t);return e===n||e.startsWith(`${n}/`)}function k3(e){let t=ch.get(e);return t||(t=new Set,ch.set(e,t)),t}function om(e,t){const n=G.getState(),r=k3(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:h}=a;if(h){if(r.has(h))continue;r.add(h)}if(o==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const p=f.map((m,x)=>({id:String(x+1),subject:m.content||"Task",description:"",activeForm:m.activeForm,status:m.status||"pending"}));n.setTasks(e,p),Kd.set(e,p.length)}continue}if(o==="TaskCreate"){const f=(Kd.get(e)||0)+1;Kd.set(e,f);const p={id:String(f),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const f=u.taskId;if(f){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,f,p)}}}}function cm(e,t){var o,u;const n=G.getState(),r=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(h=>h.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const h of t){if(h.type!=="tool_use")continue;const{name:f,input:p}=h;if((f==="Edit"||f==="Write")&&typeof p.file_path=="string"){const m=_3(p.file_path,r);w3(m,r)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const kc=new Map,S3=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function um(e,t){const n=G.getState();for(const r of t){if(r.type==="tool_use"&&r.name==="Bash"){const a=r.input;if(a.run_in_background===!0){let o=kc.get(e);o||(o=new Map,kc.set(e,o)),o.set(r.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(r.type==="tool_result"){const a=r.tool_use_id,o=kc.get(e),u=o==null?void 0:o.get(a);if(o&&u){const f=(typeof r.content=="string"?r.content:Array.isArray(r.content)?r.content.map(p=>"text"in p?p.text:"").join(""):"").match(S3);if(f){const p={taskId:f[1],toolUseId:a,command:u.command,description:u.description,outputFile:f[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&kc.delete(e)}}}}const Ed=new Map,uh=new Map;function dm(e,t){const n=G.getState();let r=uh.get(e);r||(r=new Set,uh.set(e,r));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&r.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&r.add(a.id);let u=Ed.get(e);u||(u=new Map,Ed.set(e,u));const h={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:h.name,description:h.description,agentType:h.agentType,startedAt:h.startedAt}),n.addBackgroundAgent(e,h)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=Ed.get(e),h=u==null?void 0:u.get(o);if(u&&h){const f=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:f.length>200?f.slice(0,200)+"...":f}),u.delete(o),u.size===0&&Ed.delete(e)}}}}function xy(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function vy(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function by(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")return`Task ${e.status}: ${e.task_id}.`;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 j3=0,N3=0;function ys(){return`msg-${Date.now()}-${++j3}`}function yy(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 BC(e)?`${DC}
|
|
64
|
-
|
|
65
|
-
Details: ${t}`:`Error: ${t}`}function C3(e,t){const n=Hc.get(e)||[];n.push(t),Hc.set(e,n)}function E3(e,t){const n=Hc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){Hc.delete(e);for(const r of n)t.send(JSON.stringify(r))}}const Xs=new Map;function _y(e,t,n){const r=G.getState(),a=r.messages.get(e)||[],o=Tc.get(e);let u=a.filter(f=>!f.isStreaming||f.id===o),h=-1;if(o&&(h=u.findIndex(f=>f.id===o),h===-1&&Tc.delete(e)),h===-1){const f=`stream-${e}-${ys()}`;Tc.set(e,f),u=[...u,{id:f,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const f=u[h];u[h]={...f,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}r.setMessages(e,u)}function Pi(e){Tc.delete(e);const t=G.getState(),n=t.messages.get(e)||[],r=n.filter(a=>!a.isStreaming);return r.length!==n.length?(t.setMessages(e,r),!0):!1}const wy=new Map,A3=8e3;function Cl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const r=Date.now(),a=wy.get(e);a&&a.code===t&&r-a.at<A3||(wy.set(e,{code:t,at:r}),G.getState().appendMessage(e,{id:`companion-notice-${t}-${r}`,role:"system",content:n.userText,timestamp:r,meta:!0,metaCode:t}))}function _w(){return`cmsg-${Date.now()}-${++N3}`}function vg(){return _w()}const T3=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 M3(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 ww(e){return`companion:last-seq:${e}`}function bg(e){const t=oh.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(ww(e)),r=n?Number(n):0,a=Number.isFinite(r)?Math.max(0,Math.floor(r)):0;return oh.set(e,a),a}catch{return 0}}function ky(e,t){const n=Math.max(0,Math.floor(t));oh.set(e,n);try{localStorage.setItem(ww(e),String(n))}catch{}}function Sy(e,t){zn(e,{type:"session_ack",last_seq:t})}function Jd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
-
`)}function hm(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 R3(e,t){const n=e||[],r=t||[];if(n.length===0&&r.length===0)return;const a=new Map;for(const h of r)a.set(hm(h),h);const o=[],u=new Set;for(const h of n){const f=hm(h);u.has(f)||(u.add(f),o.push(a.get(f)||h))}for(const h of r){const f=hm(h);u.has(f)||(u.add(f),o.push(h))}return o}function jy(e,t,n,r,a){return{toolUseId:e,toolName:t,preview:Ic(t,n),startedAt:r,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function yg(e,t){const n=R3(e.contentBlocks,t.contentBlocks),r=n&&n.length>0?Jd(n):t.content||e.content;return{...e,...t,content:r,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function L3(e,t){const n=G.getState(),r=n.messages.get(e)||[],a=r.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...r];o[a]=yg(o[a],t),n.setMessages(e,o)}function D3(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 r=G.getState();r.connectionStatus.get(e)==="connecting"&&r.setConnectionStatus(e,"connected"),kw(e,n)}function kw(e,t,n={}){var u,h,f,p,m,x;const{processSeq:r=!0,ackSeqMessage:a=!0}=n,o=G.getState();if(r&&typeof t.seq=="number"){const b=bg(e);if(t.seq<=b)return;ky(e,t.seq),a&&Sy(e,t.seq)}switch(b3.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()),_=fw(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Pi(e),o.setStreaming(e,null),Cl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Jd(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=Jd(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(Pi(e),L3(e,_),o.setStreaming(e,null),Ii.delete(e),Xs.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()}),(h=b.content)!=null&&h.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,jy(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})}(f=b.content)!=null&&f.length&&(om(e,b.content),cm(e,b.content),um(e,b.content),dm(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(Ii.delete(e),Xs.delete(e),Pi(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 _=Xs.get(e)||{thinking:"",text:""};Ii.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Xs.set(e,_),Ii.set(e,"text"),o.setStreaming(e,_.text),_y(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Xs.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Xs.set(e,_),Ii.set(e,"thinking"),o.setStreaming(e,_.thinking),_y(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":{ch.delete(e),uh.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),Pi(e),o.setStreaming(e,null),Ii.delete(e),Xs.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&$C(),!document.hasFocus()&&o.notificationDesktop&&xy("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:ys(),role:"system",content:yy(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;xy("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}];om(e,y),cm(e,y),um(e,y),dm(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:ys(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||ys(),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=by(t.event);if(!b)break;o.appendMessage(e,{id:ys(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...vy(t.event)});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:ys(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:ys(),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),Pi(e)?Cl(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."}):Cl(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),Pi(e)&&Cl(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),Pi(e)?Cl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):Cl(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||ys(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const w=N.message,E=Jd(w.content),C={id:w.id,role:"assistant",content:E,contentBlocks:w.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:w.model,stopReason:w.stop_reason},L=b.findIndex(O=>O.role==="assistant"&&O.id===C.id);if(L===-1?b.push(C):b[L]=yg(b[L],C),(x=w.content)!=null&&x.length){om(e,w.content),cm(e,w.content),um(e,w.content),dm(e,w.content);const O=N.timestamp||Date.now();for(const D of w.content){if(D.type==="tool_use"){const U=D.input||{},I=y.get(D.id);y.set(D.id,I??jy(D.id,D.name,U,O,N.parent_tool_use_id))}if(D.type==="tool_result"){const U=y.get(D.tool_use_id);U&&y.set(D.tool_use_id,{...U,completedAt:O,isError:U.isError||!!D.is_error,elapsedSeconds:Math.max(U.elapsedSeconds,U.completedAt?U.elapsedSeconds:Math.max(0,(O-U.startedAt)/1e3))})}}}}else if(N.type==="result"){const w=N.data;w.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:yy(w),timestamp:Date.now()});const E={total_cost_usd:w.total_cost_usd,num_turns:w.num_turns};if(typeof w.total_lines_added=="number"&&(E.total_lines_added=w.total_lines_added),typeof w.total_lines_removed=="number"&&(E.total_lines_removed=w.total_lines_removed),w.modelUsage){for(const C of Object.values(w.modelUsage))if(C.contextWindow>0){const L=C,O=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);E.context_used_percent=Math.max(0,Math.min(O,100))}}o.updateSession(e,E)}else if(N.type==="system_event"){const w=by(N.event);if(!w)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:w,timestamp:N.timestamp||Date.now(),...vy(N.event)})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const w of b){const E=N.findIndex(L=>L.id===w.id);if(E===-1){N.push(w);continue}const C=N[E];C.role==="assistant"&&w.role==="assistant"?N[E]=yg(C,w):N[E]=w}N.sort((w,E)=>(w.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"&&(Pi(e),o.setStreaming(e,null),Ii.delete(e),Xs.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 _=bg(e);y.seq<=_||(ky(e,y.seq),b=y.seq,kw(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&Sy(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:ys(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:ys(),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 nu(e){const t=ls.get(e);if(bw(t))return;if(t){try{t.close()}catch{}ls.delete(e)}G.getState().setConnectionStatus(e,"connecting");const r=new WebSocket(M3(e));ls.set(e,r),r.onopen=()=>{const a=bg(e);r.send(JSON.stringify({type:"session_subscribe",last_seq:a})),E3(e,r);const o=si.get(e);o&&(clearTimeout(o),si.delete(e))},r.onmessage=a=>D3(e,a),r.onclose=()=>{ls.get(e)===r&&(ls.delete(e),G.getState().setConnectionStatus(e,"disconnected"),O3(e))},r.onerror=()=>{r.close()}}function O3(e){if(si.has(e)||qc)return;const t=setTimeout(()=>{si.delete(e),!qc&&yw(e)&&nu(e)},v3);si.set(e,t)}function _g(e){const t=si.get(e);t&&(clearTimeout(t),si.delete(e));const n=ls.get(e);n&&(n.close(),ls.delete(e)),G.getState().setConnectionStatus(e,"disconnected"),ch.delete(e),uh.delete(e),kc.delete(e),Kd.delete(e),Ii.delete(e),Tc.delete(e),Xs.delete(e),oh.delete(e),Hc.delete(e)}function z3(e){if(!qc)for(const t of e)t.archived||nu(t.sessionId)}function B3(e){return new Promise((t,n)=>{const r=setInterval(()=>{const o=ls.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(r),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(r),n(new Error("Connection timeout"))},1e4)})}function zn(e,t){const n=ls.get(e);let r=t;const a=T3.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||(r={...t,client_msg_id:_w()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(r));return}a&&C3(e,r)}function Ny(e){zn(e,{type:"mcp_get_status"})}function P3(e,t,n){zn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function $3(e,t){zn(e,{type:"mcp_reconnect",serverName:t})}function F3(e,t){zn(e,{type:"mcp_set_servers",servers:t})}function Cy(e,t){zn(e,{type:"set_magic_ui",magicUiActive:t})}function Az(e){zn(e,{type:"magic_ui_sync"})}function U3(e,t){zn(e,{type:"set_ai_validation",...t})}var te="u">typeof window?window:void 0,In="u">typeof globalThis?globalThis:te,Nn=In==null?void 0:In.navigator,pe=In==null?void 0:In.document,Zt=In==null?void 0:In.location,Ex=In==null?void 0:In.fetch,wg=In!=null&&In.XMLHttpRequest&&"withCredentials"in new In.XMLHttpRequest?In.XMLHttpRequest:void 0,Ey=In==null?void 0:In.AbortController,I3=In==null?void 0:In.CompressionStream,cr=Nn==null?void 0:Nn.userAgent;function Sw(){return!(!te||te.navigator.onLine===!1)}var oc=typeof globalThis<"u"?globalThis:te;oc&&typeof self>"u"&&(oc.self=oc),oc&&typeof File>"u"&&(oc.File=function(){});var Re=te??{},Pt={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};function Ay(e,t,n,r,a,o,u){try{var h=e[o](u),f=h.value}catch(p){return void n(p)}h.done?t(f):Promise.resolve(f).then(r,a)}function Ft(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function u(f){Ay(o,r,a,u,h,"next",f)}function h(f){Ay(o,r,a,u,h,"throw",f)}u(void 0)}))}}function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(null,arguments)}function jw(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var H3=["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","pinterestbot","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 H3.concat(t).some((r=>{var a=r.toLowerCase();return n.indexOf(a)!==-1}))};function Ue(e,t){return e.indexOf(t)!==-1}var qh=function(e){return e.trim()},kg=function(e){return e.replace(/^\$/,"")};function Nw(e){var t,n=[];return(t=JSON.stringify(e,(function(r,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 ws=(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})({}),Sg=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),q3=["$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"],V3=["token"],Cw=Object.prototype,Ew=Cw.hasOwnProperty,Vh=Cw.toString,Pe=Array.isArray||function(e){return Vh.call(e)==="[object Array]"},Un=e=>typeof e=="function",nt=e=>e===Object(e)&&!Pe(e),Nr=e=>{if(nt(e)){for(var t in e)if(Ew.call(e,t))return!1;return!0}return!1},ue=e=>e===void 0,at=e=>Vh.call(e)=="[object String]",Mc=e=>at(e)&&e.trim().length===0,sn=e=>e===null,Ye=e=>ue(e)||sn(e),an=e=>Vh.call(e)=="[object Number]"&&e==e,Ks=e=>an(e)&&e>0,Kn=e=>Vh.call(e)==="[object Boolean]",G3=e=>e instanceof FormData,Y3=e=>Ue(q3,e),W3=e=>Ue(V3,e);function Aw(e){return e===null||typeof e!="object"}function dh(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Tw(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Mw(e,Error)}}function Ax(e){return"u">typeof Event&&Mw(e,Event)}function Mw(e,t){try{return e instanceof t}catch{return!1}}var Q3=[!0,"true",1,"1","yes"],fm=e=>Ue(Q3,e),X3=[!1,"false",0,"0","no"];function js(e,t,n,r,a){return t>n&&(r.warn("min cannot be greater than max."),t=n),an(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),js(a??n,t,n,r))}class K3{constructor(t){this.C={},this.I=t.I,this.R=js(t.bucketSize,0,100,t.A),this.O=js(t.refillRate,0,this.R,t.A),this.N=js(t.refillInterval,0,864e5,t.A)}F(t,n){var r=Math.floor((n-t.lastAccess)/this.N);r>0&&(t.tokens=Math.min(t.tokens+r*this.O,this.R),t.lastAccess=t.lastAccess+r*this.N)}consumeRateLimit(t){var n,r=Date.now(),a=String(t),o=this.C[a];return o?this.F(o,r):this.C[a]=o={tokens:this.R,lastAccess:r},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.I)==null||n.call(this,t)),o.tokens===0)}stop(){this.C={}}}var Er="Mobile",hh="iOS",ni="Android",Kl="Tablet",Rw=ni+" "+Kl,Lw="iPad",Dw="Apple",Ow=Dw+" Watch",Rc="Safari",Zl="BlackBerry",zw="Samsung",Bw=zw+"Browser",Pw=zw+" Internet",Da="Chrome",Z3=Da+" OS",$w=Da+" "+hh,Tx="Internet Explorer",Fw=Tx+" "+Er,Mx="Opera",J3=Mx+" Mini",Rx="Edge",Uw="Microsoft "+Rx,Vl="Firefox",Iw=Vl+" "+hh,Vc="Nintendo",Gc="PlayStation",Gl="Xbox",Hw=ni+" "+Er,qw=Er+" "+Rc,Sc="Windows",jg=Sc+" Phone",My="Nokia",Ng="Ouya",Vw="Generic",e4=Vw+" "+Er.toLowerCase(),Gw=Vw+" "+Kl.toLowerCase(),Cg="Konqueror",Yw="Oculus Browser",fh="Vivaldi",Ww="Yandex",ph="Whale",Eg="DuckDuckGo",Qw="Pale Moon",mh="Waterfox",Lc="Brave",gh="Claude",xh="Codex",vh="ChatGPT",Xw="Google Search App",Xt="(\\d+(\\.\\d+)?)",pm=new RegExp("Version/"+Xt),mm=new RegExp("("+gh+"|"+xh+"|"+vh+")\\/"+Xt),t4=new RegExp(Gl,"i"),n4=new RegExp(Gc+" \\w+","i"),r4=new RegExp(Vc+" \\w+","i"),Lx=new RegExp(Zl+"|PlayBook|BB10","i"),s4={"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"},Kw=function(e,t,n,r){t=t||"";var a=(function(o){return o!=null&&o.brave?Lc:null})(n);return a||(r!=null&&r.detectGoogleSearchApp&&Ue(e,"GSA/")?Xw:Ue(e," OPR/")&&Ue(e,"Mini")?J3:Ue(e," OPR/")?Mx:Lx.test(e)?Zl:Ue(e,"IE"+Er)||Ue(e,"WPDesktop")?Fw:Ue(e,"OculusBrowser")?Yw:Ue(e,Bw)?Pw:Ue(e,Rx)||Ue(e,"Edg/")?Uw:Ue(e,fh+"/")?fh:Ue(e,"YaBrowser/")?Ww:Ue(e,ph+"/")?ph:Ue(e,Eg+"/")||Ue(e,"Ddg/")?Eg:Ue(e,gh+"/")?gh:Ue(e,xh+"/")?xh:Ue(e,vh+"/")?vh:Ue(e,"FBIOS")?"Facebook "+Er:Ue(e,"UCWEB")||Ue(e,"UCBrowser")?"UC Browser":Ue(e,"CriOS")?$w:Ue(e,"CrMo")||Ue(e,Da)?Da:Ue(e,ni)&&Ue(e,Rc)?Hw:Ue(e,"FxiOS")?Iw:Ue(e.toLowerCase(),Cg.toLowerCase())?Cg:Ue(e,Lc+"/")?Lc:((o,u)=>u&&Ue(u,Dw)||(function(h){return Ue(h,Rc)&&!Ue(h,Da)&&!Ue(h,ni)})(o))(e,t)?Ue(e,Er)?qw:Rc:Ue(e,"PaleMoon/")?Qw:Ue(e,mh+"/")?mh:Ue(e,Vl)?Vl:Ue(e,"MSIE")||Ue(e,"Trident/")?Tx:Ue(e,"Gecko")?Vl:"")},i4={[Fw]:[new RegExp("rv:"+Xt)],[Uw]:[new RegExp(Rx+"?\\/"+Xt)],[Da]:[new RegExp("("+Da+"|CrMo)\\/"+Xt)],[$w]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[Rc]:[pm],[qw]:[pm],[Mx]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Vl]:[new RegExp(Vl+"\\/"+Xt)],[Iw]:[new RegExp("FxiOS\\/"+Xt)],[Cg]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[Zl]:[new RegExp(Zl+" "+Xt),pm],[Hw]:[new RegExp("android\\s"+Xt,"i")],[Pw]:[new RegExp(Bw+"\\/"+Xt)],[Yw]:[new RegExp("OculusBrowser\\/"+Xt)],[fh]:[new RegExp(fh+"\\/"+Xt)],[Ww]:[new RegExp("YaBrowser\\/"+Xt)],[ph]:[new RegExp(ph+"\\/"+Xt)],[Lc]:[new RegExp(Lc+"\\/"+Xt)],[gh]:[mm],[xh]:[mm],[vh]:[mm],[Eg]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Xt)],[Qw]:[new RegExp("PaleMoon\\/"+Xt)],[mh]:[new RegExp(mh+"\\/"+Xt)],[Xw]:[new RegExp("GSA\\/"+Xt)],[Tx]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},a4=function(e,t,n,r){var a=Kw(e,t,n,r),o=i4[a];if(ue(o))return null;for(var u=0;o.length>u;u++){var h=e.match(o[u]);if(h)return parseFloat(h[h.length-2])}return null},Ry=[[new RegExp(Gl+"; "+Gl+" (.*?)[);]","i"),e=>[Gl,e&&e[1]||""]],[new RegExp(Vc,"i"),[Vc,""]],[new RegExp(Gc,"i"),[Gc,""]],[Lx,[Zl,""]],[new RegExp(Sc,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[jg,""];if(new RegExp(Er).test(t)&&!/IEMobile\b/.test(t))return[Sc+" "+Er,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=s4[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[Sc,r]}return[Sc,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[hh,[e[3],e[4],e[5]||"0"].join(".")]:[hh,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ue(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ni+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ni+")","i"),e=>e&&e[2]?[ni,[e[2],e[3],e[4]||"0"].join(".")]:[ni,""]],[/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/,[Z3,""]],[/Linux|debian/i,["Linux",""]]],Zw=function(e){for(var t=0;Ry.length>t;t++){var n=Ry[t],r=n[1],a=n[0].exec(e),o=a&&(Un(r)?r(a,e):r);if(o)return o}return["",""]},Ly=function(e){return r4.test(e)?Vc:n4.test(e)?Gc:t4.test(e)?Gl:new RegExp(Ng,"i").test(e)?Ng:new RegExp("("+jg+"|WPDesktop)","i").test(e)?jg:/iPad/.test(e)?Lw:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ow:Lx.test(e)?Zl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(My,"i").test(e)?My:/(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(Er).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)?ni:Rw:new RegExp("(pda|"+Er+")","i").test(e)?e4:new RegExp(Kl,"i").test(e)&&!new RegExp(Kl+" pc","i").test(e)?Gw:""},l4=20,Jw=1e3,o4=1e4,c4="[Circular]",Ag="[Truncated]",Gh="[Unserializable]",u4="[Function]";function Yl(e){for(var t="",n=0;e.length>n;n++){var r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:"�";else{var a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}var Ad,Dy,gm,d4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Oy(e,t){return typeof(n=e)=="string"&&d4.test(n)?e:t();var n}function e2(e,t){var n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Wi(e){return e&&e.split("#")[0]}function Dx(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function zy(e,t,n){return t2.apply(this,arguments)}function t2(){return(t2=Ft((function*(e,t,n){var r;try{return yield Promise.race([e,new Promise(((a,o)=>{r=Dx((()=>{try{n==null||n(),a()}catch(u){o(u)}}),t)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}function h4(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return gm&&n.length===Dy||(Dy=n.length,gm=n.reduce(((r,a)=>{Ad||(Ad={});var o=Ad[a];if(o)r[o[0]]=o[1];else for(var u=e(a),h=u.length-1;h>=0;h--){var f=u[h],p=f==null?void 0:f.filename,m=t[a];if(p&&m){r[p]=m,Ad[a]=[p,m];break}}return r}),{})),gm}}class f4{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(r,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,r),$exception_level:"error"}}modifyFrames(t){var n=this;return Ft((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Pe(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,a;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),de({},t,{cause:r,stack:a})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Ft((function*(){var r=t;for(var a of n.modifiers)r=yield a(r);return r}))()}convertToExceptionList(t,n){var r,a,o,u={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"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 h=[u];return t.cause!=null&&h.push(...this.convertToExceptionList(t.cause,de({},n,{handled:!0}))),h}buildParsingContext(t){var n;return{chunkIdMap:h4(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var a=(o,u)=>{if(4>=u){var h=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,h)}};return de({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,r),next:o=>a(o,r+1)})}}var Jl="?";function Tg(e,t,n,r,a){var o={platform:e,filename:t,function:n==="<anonymous>"?Jl:n,in_app:!(t!=null&&t.startsWith("webkit-masked-url://"))&&t!=="<anonymous>"};return ue(r)||(o.lineno=r),ue(a)||(o.colno=a),o}var n2=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Jl,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},p4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,m4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,g4=/\((\S*)(?::(\d+))(?::(\d+))\)/,x4=(e,t)=>{var n=p4.exec(e);if(n)return Tg(t,n[1],Jl,+n[2],+n[3]);var r=m4.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var a=g4.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}var o=n2(r[1]||Jl,r[2]);return Tg(t,o[1],o[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},v4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,b4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,y4=(e,t)=>{var n=v4.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=b4.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var a=n[3],o=n[1]||Jl,u=n2(o,a);return Tg(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},By=/\(error: (.*)\)/;class _4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=at(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return dh(t,"DOMException")}isDOMError(t){return dh(t,"DOMError")}}class w4{match(t){return Tw(t)}coerce(t,n){var r,a=this.getStack(t),o=a===void 0;return{type:this.getType(t),value:this.getMessage(t,n),stack:a??((r=n.syntheticException)==null?void 0:r.stack),cause:t.cause?n.next(t.cause):void 0,synthetic:o}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class k4{match(t){return!!dh(t,"ErrorEvent")&&(t.error!=null||this.Vi(t))}coerce(t,n){var r;if(t.error!=null)return n.apply(t.error);var a=n.apply(t.message);return de({},a,{stack:(r=this.Zi(t))!==null&&r!==void 0?r:a.stack,synthetic:!0})}Vi(t){return at(t.message)&&t.message.length>0}Zi(t){var n,r,a=t,o=(n=a.lineno)!==null&&n!==void 0?n:0,u=(r=a.colno)!==null&&r!==void 0?r:0;if(at(a.filename)&&a.filename.length!==0&&o!==0)return`Error
|
|
67
|
-
at `+a.filename+":"+o+":"+u}}var S4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class j4{match(t){return typeof t=="string"}coerce(t,n){var r,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,a=t.match(S4);return a&&(n=a[1],r=a[2]),[n,r]}}var N4=["fatal","error","warning","log","info","debug"];function r2(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var a=n.slice(0,r).join(", ");if(t>=a.length)return r===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class C4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,a,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=this.getStack(t))!==null&&r!==void 0?r:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Ax(t))return t.constructor.name;var n="name"in t?t.name:void 0;return at(n)&&!Mc(n)?n:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+r2(t)}isSeverityLevel(t){return at(t)&&!Mc(t)&&N4.indexOf(t)>=0}getStack(t){try{return at(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:at(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 r=t[n];if(Tw(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class E4{match(t){return Ax(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+r2(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class A4{match(t){return Aw(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class T4{match(t){return dh(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ax(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,a=this.getUnhandledRejectionReason(t);return Aw(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(r=n.syntheticException)==null?void 0:r.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 bh="$message",yh="$timestamp",M4=new Set([bh,yh]),xm={enabled:!0,max_bytes:32768};function _h(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:xm.enabled,max_bytes:L4(e.max_bytes,xm.max_bytes)}:de({},xm)}class R4{constructor(t){this.Pn=[],this.Fn=0,this.mn=_h(t)}setConfig(t){this.mn=_h(t),this.$n()}add(t){var n=(function(a){var o;try{o=Nw(a)}catch{return}try{var u=JSON.parse(o);if(!nt(u))return;var h=u,f=h[bh],p=h[yh];return!at(f)||f.trim().length===0||!at(p)&&!an(p)?void 0:{step:h,json:o}}catch{return}})(t);if(n){var r=(function(a){if("u">typeof TextEncoder)return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,h=0;o.length>h;h++)o[h]==="%"?(u+=1,h+=2):u+=1;return u})(n.json);r>this.mn.max_bytes||(this.Pn.push({step:n.step,bytes:r}),this.Fn+=r,this.$n())}}getAttachable(){return this.Pn.map((t=>t.step))}clear(){this.Pn=[],this.Fn=0}size(){return this.Pn.length}$n(){for(;this.Fn>this.mn.max_bytes&&this.Pn.length>0;){var t=this.Pn.shift();t&&(this.Fn-=t.bytes)}}}function L4(e,t){if(!an(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var Py=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function $y(e){return typeof e=="string"||e}function Fy(e){return typeof e=="string"?e:void 0}var cc,D4=["$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"],s2="NativeGzipValidationError",Mg=e=>e.length>=2&&e[0]===31&&e[1]===139,Uy=(e,t)=>e===Sg.GZipJS||t===Sg.GZipJS||t==="gzip",Iy=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Td=e=>{throw e2(s2,"Native gzip produced invalid output: "+e)},O4=(function(){var e=Ft((function*(t,n){18>t.size&&Td("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Mg(r)&&r[2]===8||Td("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var h=(()=>{if(cc)return cc;cc=[];for(var m=0;256>m;m++){for(var x=m,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;cc[m]=x>>>0}return cc})(),f=4294967295,p=0;u.length>p;p++)f=h[255&(f^u[p])]^f>>>8;return(4294967295^f)>>>0})(n)&&Td("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&Td("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Rg(){return Rg=Ft((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(r).then((()=>o.close())).catch((function(){var p=Ft((function*(m){try{yield o.abort(m)}catch{}throw m}));return function(m){return p.apply(this,arguments)}})()),h=new Response(a.readable).blob(),f=(yield Promise.all([h,u]))[0];return yield O4(f,r),f}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Rg.apply(this,arguments)}var Hy=9223372036854776e3,z4="9223372036854775808",B4={}.propertyIsEnumerable;function wh(e,t){try{return i2(e,t,{ancestors:new WeakSet,remainingNodes:o4},0)}catch{return[]}}function Ox(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:Ag};if(n.remainingNodes--,Kn(e))return{boolValue:e};if(typeof e=="bigint")return(function(f,p){var m=f.toString(),x=BigInt(z4);return f>=x||-x>f?(p==null||p.debug("Attribute "+m+" is outside the int64 range; encoding it as a string"),{stringValue:m}):{intValue:m}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};var a=BigInt(e).toString();return e>=Hy||-Hy>e?(t==null||t.debug("Attribute "+a+" is outside the int64 range; encoding it as a string"),{stringValue:a}):{intValue:a}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Yl(e)};if(typeof e=="function")return{stringValue:u4};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:c4};if(r>=l4)return{stringValue:Ag};if(e instanceof Date){var o=e.getTime(),u=Number.isFinite(o)?e.toISOString():String(e);return{stringValue:typeof u=="string"?Yl(u):String(u)}}n.ancestors.add(e);try{try{var h=e.toJSON;if(typeof h=="function")return Ox(h.call(e),t,n,r+1)}catch{}return Pe(e)?{arrayValue:{values:P4(e,t,n,r+1)}}:{kvlistValue:{values:i2(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:Yl(String(e))}}function P4(e,t,n,r){for(var a=[],o=Math.min(e.length,Jw),u=0;o>u&&n.remainingNodes>0;u++)try{var h=u in e?e[u]:void 0;if(Ye(h))continue;a.push(Ox(h,t,n,r))}catch{a.push({stringValue:Gh})}return e.length>u&&a.push({stringValue:Ag}),a}function i2(e,t,n,r){var a=[];for(var o in e)if(B4.call(e,o)){if(!o){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=Jw||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var u=e[o];if(sn(u)||ue(u))continue;a.push({key:Yl(o),value:Ox(u,t,n,r)})}catch{a.push({key:Yl(o),value:{stringValue:Gh}})}}return a}function a2(e,t,n){return de({},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})}var qy={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"},l2={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}},$4=l2.info;function F4(e){try{return Yl(String(e))}catch{return Gh}}function U4(e,t,n,r){var a,o=l2[e.level||"info"]||$4,u=o.text,h=o.number,f=((a=an(r)?r:void 0)===void 0&&(a=Date.now()),String(a)+"000000"),p={};t.distinctId&&(p.posthogDistinctId=t.distinctId),t.sessionId&&(p.sessionId=t.sessionId),t.windowId&&(p["window.id"]=t.windowId),Ye(t.sessionStartTimestamp)||(p.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ye(t.lastActivityTimestamp)||(p.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(p["url.full"]=t.currentUrl),t.screenName&&(p["screen.name"]=t.screenName),t.appState&&(p["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(p.feature_flags=t.activeFeatureFlags);var m=de({},p),x=e.attributes;if(x){var b=[];try{b=Object.keys(x)}catch{b=[]}for(var y of b){var _=void 0;try{_=x[y]}catch{_=Gh}Object.defineProperty(m,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}var j={timeUnixNano:f,observedTimeUnixNano:f,severityNumber:h,severityText:u,body:{stringValue:F4(e.body)},attributes:wh(m,n)};return e.trace_id&&(j.traceId=e.trace_id),e.span_id&&(j.spanId=e.span_id),ue(e.trace_flags)||(j.flags=e.trace_flags),j}function o2(e,t,n){return a2(e,t,n)}function c2(e,t,n,r){return{resourceLogs:[{resource:{attributes:wh(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let I4=class{constructor(e,t,n,r,a,o,u){var h;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.mn=t,this.A=n,this.Nn=r,this.qn=a,this.jn=o,this.Bn=u,this.Hn=null,this.zn=0,this.Un=0,this.Wn=0,this.Vn=0,this.Gn=0,this.Zn=!1,this.Qn=t.maxBufferSize,this.Jn=Math.max((h=t.maxQueueSize)!==null&&h!==void 0?h:t.maxBufferSize,t.maxBufferSize),this.Kn=t.flushIntervalMs,this.Yn=t.maxBatchRecordsPerPost,this.Xn=t.rateCapWindowMs,this.ts=t.maxLogsPerInterval}clearQueue(){this.Un++,this._instance.setPersistedProperty(ws.LogsQueue,[])}reset(){this.es(),this.Vn=0,this.Gn=0,this.Zn=!1,this.Wn=0,this.Yn=this.mn.maxBatchRecordsPerPost}onReconnect(){this.Wn=0,this.rs()}captureLog(e,t){var n;if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var r=this.ns(e);if(r!==null)if(r.body){if(this.ss()){var a={record:U4(r,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.Nn(),this.A,t==null?void 0:t.occurredAtMs)};this.qn((()=>this.os(a)))}}else this.A.info("Log was rejected in beforeSend function")}}ns(e){var t=this.mn.beforeSend;if(!t)return e;var n=Pe(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.A.info("Log was rejected in beforeSend function"),null;r=o}catch(u){return this.A.error("Error in beforeSend function for log:",u),null}return r}ss(){if(this.ts===void 0)return!0;var e=Date.now(),t=e-this.Vn;return this.Xn>t&&t>=0||(this.Vn=e,this.Gn=0,this.Zn=!1),this.ts>this.Gn?(this.Gn++,!0):(this.Zn||(this.A.warn("captureLog dropping logs: exceeded "+this.ts+" logs per "+this.Xn+"ms"),this.Zn=!0),!1)}flush(){var e=this;return Ft((function*(){if(!e._instance.isDisabled)return e.Hn||(e.Hn=e.ls().finally((()=>{e.Hn=null}))),e.Hn}))()}ls(){var e=this;return Ft((function*(){var t;e.es();var n=(t=e._instance.getPersistedProperty(ws.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,a=0;n.length>0&&r>a;){var o,u,h=e.Un;e.zn=0;var f=Math.min(n.length,e.Yn),p=n.slice(0,f),m=c2(p.map((b=>b.record)),e.us(),(o=e.Bn)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),x=yield e._instance.hs(m);if(e.Un!==h)return;if(x.kind==="too-large"&&p.length>1)e.Yn=Math.max(1,Math.floor(p.length/2)),e.A.warn("Received 413 when sending logs batch of size "+p.length+", reducing batch size to "+e.Yn);else if(x.kind==="retry-later"||(x.kind==="too-large"?e.A.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."):x.kind==="ok"&&e.mn.maxBatchRecordsPerPost>e.Yn&&(e.Yn=Math.min(e.mn.maxBatchRecordsPerPost,e.Yn+1)),yield e.ds(p.length),n=(u=e._instance.getPersistedProperty(ws.LogsQueue))!==null&&u!==void 0?u:[],a+=p.length,x.kind==="fatal"))throw x.error}}))()}ds(e){var t=this;return Ft((function*(){var n,r=Math.max(0,e-t.zn),a=(n=t._instance.getPersistedProperty(ws.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(ws.LogsQueue,a.slice(r)),yield t.jn()}))()}us(){return o2(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}os(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(ws.LogsQueue))!==null&&t!==void 0?t:[];this.Jn>n.length||(n.shift(),this.zn++,this.A.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(ws.LogsQueue,n),this.Qn>n.length?this.vs():this.rs()}}vs(e){e===void 0&&(e=this.Kn),this.cs||(this.cs=Dx((()=>{this.cs=void 0,this.rs()}),e))}fs(){var e=Math.min(Math.max(0,this.Wn-1),6);return this.Kn*Math.pow(2,e)}ps(){var e=this._instance.getPersistedProperty(ws.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ft((function*(){t.es();var n=t.flush().catch((()=>{}));e!==void 0?yield zy(n,e):yield n}))()}flushWithTimeout(e){var t=this;return Ft((function*(){var n=t.flush();yield zy(n,e,(()=>{n.catch((()=>{}))}))}))()}rs(){this.flush().then((()=>{this.Wn=0}),(e=>{this.Wn++,this.A.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.ps()&&this.vs(this.fs())}))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};var vm=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Vy(e){return String(e)+"000000"}function Gy(e,t,n,r){var a="";return r&&(a=Object.keys(r).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(r[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let H4=class{constructor(e,t,n){this._instance=e,this.mn=t,this.A=n,this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set,this.ws=0}count(e,t,n){t===void 0&&(t=1),this.ks({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.ks({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.ks({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.Hn,n=(function(){var a=Ft((function*(){t&&(yield t.catch((()=>{}))),yield e.Ss()}));return function(){return a.apply(this,arguments)}})(),r=n().finally((()=>{this.Hn===r&&(this.Hn=null)}));return this.Hn=r,r}drainWindow(){if(this.gs.size===0)return null;var e=this.gs;return this.gs=new Map,this.ys=!1,this.bs=new Map,this._s=new Set,this.xs(e)}reset(){this.ws++,this.es(),this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set}ks(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.ns(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.A.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?de({},t.attributes):void 0,r=Gy(t.type,t.name,t.unit,n)}catch(u){return void this.A.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.gs.get(r);if(!a){if(!this.Cs())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.gs.set(r,a)}var o=this.bs.get(t.name);o===void 0?this.bs.set(t.name,t.type):o===t.type||this._s.has(t.name)||(this._s.add(t.name),this.A.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.Ts(a,t.value),this.vs()}else this.A.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Cs(){return this.mn.maxSeriesPerFlush>this.gs.size||(this.ys||(this.ys=!0,this.A.warn("Metric series cap reached ("+this.mn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ts(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(vm.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,vm)]+=1}}ns(e){var t=this.mn.beforeSend;if(!t)return e;var n=Pe(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.A.info("Metric was rejected in beforeSend function"),null;r=o}catch(u){return this.A.error("Error in beforeSend function for metric:",u),null}return r}vs(){this.cs||(this.cs=Dx((()=>{this.cs=void 0,this.flush().catch((e=>{this.A.error("Metrics flush failed:",e)}))}),this.mn.flushIntervalMs))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}Ss(){var e=this;return Ft((function*(){if(e.gs.size!==0){var t=e.gs;e.gs=new Map,e.ys=!1,e.bs=new Map,e._s=new Set;var n=e.ws,r=yield e._instance.Ms(e.xs(t));if(n===e.ws)switch(r.kind){case"ok":return;case"retry-later":return e.Is(t),void e.vs();case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",r.error)}}}))()}xs(e){return t=this.Es(e),n=(function(o,u,h){return a2(o,u,h)})(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:wh(n)},scopeMetrics:[{scope:{name:r,version:a},metrics:t}]}]};var t,n,r,a}Es(e){var t=Vy(Date.now()),n=new Map;for(var r of e.values()){var a,o=Gy(r.type,r.name,r.unit,void 0),u=n.get(o);u||(u=de({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var h=wh((a=r.attributes)!==null&&a!==void 0?a:{},this.A),f=Vy(r.windowStartMs);if(r.type==="count"){var p,m={attributes:h,startTimeUnixNano:f,timeUnixNano:t,asDouble:(p=r.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(m)}else if(r.type==="gauge"){var x,b={attributes:h,timeUnixNano:t,asDouble:(x=r.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else r.hist&&u.histogram.dataPoints.push({attributes:h,startTimeUnixNano:f,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:vm})}return Array.from(n.values())}Is(e){var t,n;for(var r of e){var a=r[0],o=r[1],u=this.gs.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 h=0;u.hist.bucketCounts.length>h;h++)u.hist.bucketCounts[h]+=o.hist.bucketCounts[h]}else u.hist=o.hist}else this.Cs()&&this.gs.set(a,o)}}};var u2=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={q(a){if(te&&(Pt.DEBUG||te.POSTHOG_DEBUG||n)&&!ue(te.console)&&te.console){for(var o=("__rrweb_original__"in te.console[a])?te.console[a].__rrweb_original__:te.console[a],u=arguments.length,h=new Array(u>1?u-1:0),f=1;u>f;f++)h[f-1]=arguments[f];o(e,...h)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("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){r.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>u2(e+" "+a,o)};return r},ye=u2("[PostHog.js]"),Gt=ye.createLogger,q4=Gt("[ExternalScriptsLoader]"),kh=e=>{var t=pe==null?void 0:pe.querySelectorAll("script");if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Aa=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return q4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=kh(t);if(r){if(r.__posthog_loading_callback_fired)return n();var a=r.__posthog_loading_error;return a?n(a):(r.addEventListener("load",(u=>{r.__posthog_loading_callback_fired=!0,n(void 0,u)})),void r.addEventListener("error",(u=>{r.__posthog_loading_error=u,n(u)})))}var o=()=>{if(!pe)return n("document not found");if(kh(t))return Aa(e,t,n);var u=pe.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")pe.head.appendChild(u);else{var h,f=pe.querySelectorAll("body > script");f.length>0?(h=f[0].parentNode)==null||h.insertBefore(u,f[0]):pe.body.appendChild(u)}};pe!=null&&pe.body?o():pe==null||pe.addEventListener("DOMContentLoaded",o)},bm={},Yy=(e,t)=>{var n="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}return e.requestRouter.endpointFor("assets",n)};Re.__PosthogExtensions__=Re.__PosthogExtensions__||{},Re.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r=e.config.strict_script_versioning;if(r){var a=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),o=bm[a];if(r==="fallback"&&o){if(kh(o))return void Aa(e,o,n);delete bm[a]}Aa(e,a,r==="fallback"?(h,f)=>{if(h)if(typeof h=="string")n(h);else{var p,m=Yy(e,t);bm[a]=m;var x=kh(a);x==null||(p=x.parentNode)==null||p.removeChild(x),Aa(e,m,n)}else n(void 0,f)}:n)}else Aa(e,Yy(e,t),n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Aa(e,u,n)}},Re.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Aa(e,r,n)};Pt.DEBUG=!1,Pt.LIB_VERSION="1.426.2",Pt.LIB_NAME="web";var d2="$people_distinct_id",En="distinct_id",Yc="$device_id",ym="$device_model",Fl="__alias",Gs="$fbc",ur="$fbc_persistence",jc="__timers",Lg="$autocapture_disabled_server_side",Dg="$heatmaps_enabled_server_side",Og="$exception_capture_enabled_server_side",zg="$error_tracking_suppression_rules",Bg="$error_tracking_capture_extension_exceptions",Pg="$web_vitals_enabled_server_side",zx="$dead_clicks_enabled_server_side",Bx="$product_tours_enabled_server_side",$g="$logs_capture_enabled_server_side",Fg="$web_vitals_allowed_metrics",La="$session_recording_remote_config",h2="$replay_sample_rate",f2="$replay_override_sampling",p2="$replay_override_linked_flag",m2="$replay_override_url_trigger",g2="$replay_override_event_trigger",Ul="$sesid",Px="$session_is_sampled",Xn="$enabled_feature_flags",Yr="$active_feature_flags",eh="$early_access_features",qi="$feature_flag_details",is="$feature_flag_payloads",Vi="$feature_flag_request_id",Wl="$minimal_flag_called_events",_s="$override_feature_flags",Ta="$override_feature_flag_payloads",kr="$stored_person_properties",Ss="$stored_group_properties",x2="$groups",Ug="$surveys",Sh="$surveys_loaded_at",Ig="$surveys_activated",th="$surveys_activated_session",nh="$surveys_activated_timestamps",Nc="ph_product_tours",Js="$flag_call_reported",Cc="$flag_call_reported_session_id",Ql="$feature_flag_errors",ri="$feature_flag_evaluated_at",tt="$user_state",Hg="$client_session_props",qg="$capture_rate_limit",Vg="$initial_campaign_params",Gg="$initial_referrer_info",Il="$initial_person_info",jh="$epp",El="$posthog_cookieless",v2="$cookieless_mode",b2="$sdk_debug_extensions_init_method",y2="$sdk_debug_extensions_init_time_ms",Yg="$sdk_debug_recording_script_not_loaded",$x="PostHog loadExternalDependency extension not found.",Hi="on_reject",ei="always",cn="anonymous",On="identified",Wg="identified_only",eo="visibilitychange",Nh="beforeunload",Hl="$pageview",_m="$pageleave",Qg="$identify",Wy="$groupidentify";function Md(e,t){Pe(e)&&e.forEach(t)}function Nt(e,t){if(!Ye(e))if(Pe(e))e.forEach(t);else if(G3(e))e.forEach(((r,a)=>t(r,a)));else for(var n in e)Ew.call(e,n)&&t(e[n],n)}var $t=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function rh(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Qy=function(e){try{return e()}catch{return}},V4=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(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)}}},Fx=function(e){var t={};return Nt(e,(function(n,r){(at(n)&&n.length>0||an(n))&&(t[r]=n)})),t},G4=["herokuapp.com","vercel.app","netlify.app"];function Y4(e){var t=e==null?void 0:e.hostname;if(!at(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of G4)if(n===r)return!1;return!0}function Lt(e,t,n,r){var a=r??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function Xg(e){return e.name==="ph_toolbar_internal"}var Kg=e=>{if(pe){try{for(var t=e+"=",n=pe.cookie.split(";").filter((o=>o.length)),r=0;n.length>r;r++){for(var a=n[r];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 Ch{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(a)||0>t||0>n||0>r||0>a||t>0xffffffffffff||n>4095||r>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|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new Ch(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 Ch(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class W4{generate(){var t=this.generateOrAbort();if(!ue(t))return t;this.Kr=0;var n=this.generateOrAbort();if(ue(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ei++,this.ei>4398046511103&&(this.Kr++,this.Xr())}return Ch.fromFieldsV7(this.Kr,Math.trunc(this.ei/Math.pow(2,30)),this.ei&Math.pow(2,30)-1,this.ti.nextUint32())}Xr(){this.ei=1024*this.ti.nextUint32()+(1023&this.ti.nextUint32())}constructor(){this.Kr=0,this.ei=0,this.ti=new Q4}}var Xy,_2=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&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};te&&!ue(te.crypto)&&crypto.getRandomValues&&(_2=e=>crypto.getRandomValues(e));class Q4{nextUint32(){return this.Pt.length>this.ri||(_2(this.Pt),this.ri=0),this.Pt[this.ri++]}constructor(){this.Pt=new Uint32Array(8),this.ri=1/0}}var as=()=>X4().toString(),X4=()=>(Xy||(Xy=new W4)).generate(),uc="",K4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Al=null,Kt={ii(){if(!sn(Al))return Al;if(Al=!1,pe)try{var e="__ph_cookie_support_"+as();Kt.ni(e,"xyz"),Al=Kg(e)==='"xyz"',Kt.oi(e)}catch{Al=!1}return Al},si(e){ye.error("cookieStore error: "+e)},ai:Kg,ui(e){var t;try{t=JSON.parse(Kt.ai(e))||{}}catch{}return t},ni(e,t,n,r,a){if(!pe)return!1;try{var o="",u="",h=(function(m,x){if(x){var b=(function(_,j){if(j===void 0&&(j=pe),uc)return uc;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),w=Math.min(N.length,8),E="dmn_chk_"+as();!uc&&w--;){var C=N.slice(w).join("."),L=E+"=1;domain=."+C+";path=/";j.cookie=L+";max-age=3",j.cookie.includes(E)&&(j.cookie=L+";max-age=0",uc=C)}return uc})(m);if(!b){var y=(_=>{var j=_.match(K4);return j?j[0]:""})(m);y!==b&&ye.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(pe.location.hostname,r);if(n){var f=new Date;f.setTime(f.getTime()+864e5*n),o="; expires="+f.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+h+u;return p.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+p.length),pe.cookie=p,!0}catch{return!1}},oi(e,t){if(pe!=null&&pe.cookie)try{Kt.ni(e,"",-1,t)}catch{return}}},wm=null,ut={ii(){if(!sn(wm))return wm;var e=!0;if(ue(te))e=!1;else try{var t="__mplssupport__";ut.ni(t,"xyz"),ut.ai(t)!=='"xyz"'&&(e=!1),ut.oi(t)}catch{e=!1}return e||ye.error("localStorage unsupported; falling back to cookie store"),wm=e,e},si(e){ye.error("localStorage error: "+e)},ai(e){try{return te==null?void 0:te.localStorage.getItem(e)}catch(t){ut.si(t)}return null},ui(e){try{return JSON.parse(ut.ai(e))||{}}catch{}return null},ni(e,t){try{return te==null||te.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ut.si(n)}return!1},oi(e){try{te==null||te.localStorage.removeItem(e)}catch(t){ut.si(t)}}},km=[kr,Yr,Xn,qi,is,Vi,ri,Ql,Js],Ma=[Yc,En,Ul,Px,jh,Il,ur,tt],Eh=e=>e+"_cpm",Z4=["__proto__","constructor","prototype"],Sm=e=>{if(!nt(e))return{};var t={};return Object.keys(e).forEach((n=>{Z4.indexOf(n)===-1&&(t[n]=e[n])})),t},jm=function(e,t){t===void 0&&(t=[]);var n={};return[...Ma,...t].forEach((r=>{var a=e[r];ue(a)||sn(a)||a===""||(n[r]=a)})),n},w2=e=>{for(var t=5381,n=2166136261,r=0;e.length>r;r++){var a=e.charCodeAt(r);t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Ky=(e,t)=>({p:t,f:w2(JSON.stringify(e))}),Zy=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=Kt.ui(Eh(e)),r=(n==null?void 0:n.f)===w2(t)&&Pe(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Nm=(e,t)=>t+"|"+(Kt.ai(Eh(e))||""),Tl={},Zg={ii:()=>!0,si(e){ye.error("memoryStorage error: "+e)},ai:e=>e in Tl?Tl[e]:null,ui:e=>e in Tl?Tl[e]:null,ni:(e,t)=>(Tl[e]=t,!0),oi(e){delete Tl[e]}},ka=null,Rt={ii(){if(!sn(ka))return ka;if(ka=!0,ue(te))ka=!1;else try{var e="__support__";Rt.ni(e,"xyz"),Rt.ai(e)!=='"xyz"'&&(ka=!1),Rt.oi(e)}catch{ka=!1}return ka},si(e){ye.error("sessionStorage error: ",e)},ai(e){try{return te==null?void 0:te.sessionStorage.getItem(e)}catch(t){Rt.si(t)}return null},ui(e){try{return JSON.parse(Rt.ai(e))||null}catch{}return null},ni(e,t){try{return te==null||te.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Rt.si(n)}return!1},oi(e){try{te==null||te.sessionStorage.removeItem(e)}catch(t){Rt.si(t)}}};class J4{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===ei||this.isRejected()||this.consent===-1&&this.mn.cookieless_mode===Hi}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Gs(){var t=this.Zs.ai(this.Qs);return fm(t)?1:Ue(X3,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,n=t==="localStorage"?ut:Kt,r=n.ii()?n:Zg;if(!this.Js||this.Js!==r){this.Js=r;var a=t==="localStorage"?Kt:ut;a.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(fm(a.ai(this.Qs))),a.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[Nn==null?void 0:Nn.doNotTrack,Nn==null?void 0:Nn.msDoNotTrack,Re.doNotTrack,Nn==null?void 0:Nn.globalPrivacyControl].some((t=>fm(t)))}}function k2(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Un(r))return t;try{var a=r(t);return at(a)&&a?a:t}catch(o){return ye.error("Error in get_current_url, falling back to window.location.href",o),t}}var S2="__POSTHOG_TOOLBAR__",eE=1,tE=3,nE=11;function Jy(e){return e instanceof Element&&(e.id===S2||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Qi(e){return!!e&&e.nodeType===eE}function Cr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function j2(e){return!!e&&e.nodeType===tE}function N2(e){return!!e&&e.nodeType===nE&&Qi(e.host)}var C2=1e3;function Ux(e){return e?qh(e).split(/\s+/):[]}function e_(e,t){var n=(function(r){var a,o=te==null||(a=te.location)==null?void 0:a.href;return ue(o)?void 0:k2(r,o)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function Ah(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 Ux(t)}function E2(e){return Ye(e)?null:qh(e).split(/(\s+)/).filter((t=>Dc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Wc(e){var t="";return tx(e)&&!L2(e)&&e.childNodes&&e.childNodes.length&&Nt(e.childNodes,(function(n){var r;j2(n)&&n.textContent&&(t+=(r=E2(n.textContent))!==null&&r!==void 0?r:"")})),qh(t)}function Jg(e){var t;return ue(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Ix=["a","button","form","input","select","textarea","label"];function ex(e,t){if(ue(t))return!0;var n,r=function(o){if(t.some((u=>(function(h,f){var p=h.matches||h.matchesSelector||h.msMatchesSelector||h.mozMatchesSelector||h.webkitMatchesSelector||h.oMatchesSelector;try{return!!p&&p.call(h,f)}catch{return!1}})(o,u))))return{v:!0}};for(var a of e)if(n=r(a))return n.v;return!1}function A2(e){var t=e.parentNode;return!(!t||!Qi(t))&&t}var rE=[".ph-no-autocapture","[data-ph-no-autocapture]"],T2=["next","previous","prev",">","<"],sE=[...T2,"+","-","−","–"],t_=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,n_=[".ph-no-rageclick",".ph-no-capture"],iE=["","text","search","email","password","url","tel","number"];function M2(e,t){if(!te||Hx(e))return!1;var n,r,a,o,u;if(Kn(t)?(n=!!t&&n_,r=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:n_,r=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(f){return!(!f||!Qi(f))&&(!!Cr(f,"textarea")||(Cr(f,"input")?Ue(iE,(f.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var m=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return m==="true"||m===""})(f)))})(e))return!1;var h=R2(e,!1).targetElementList;return!(function(f,p){if(f===!1||ue(f))return!1;var m;if(f===!0)m=T2;else{if(!Pe(f))return!1;if(f.length>10)return ye.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;m=f.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return m.some((_=>t_(b,_)||t_(y,_)))}))})(r,h.map((f=>{var p;return{safeText:Wc(f).toLowerCase(),ariaLabel:((p=f.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!ex(h,n)}var Hx=e=>!e||Cr(e,"html")||!Qi(e),R2=(e,t)=>{if(!te||Hx(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!Cr(a,"body");)if(N2(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var o=A2(a);if(!o)break;if(t||Ix.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=te.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:r}};function tx(e){for(var t=new Set,n=0,r=e;r.parentNode&&!Cr(r,"body");r=r.parentNode){if(n++>=C2||t.has(r))return!1;t.add(r);var a=Ah(r);if(Ue(a,"ph-sensitive")||Ue(a,"ph-no-capture"))return!1}if(Ue(Ah(e),"ph-include"))return!0;var o=e.type||"";if(at(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!at(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 L2(e){return!!(Cr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Cr(e,"select")||Cr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var r_=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}))$"),s_=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,aE=[16,15,14,13],lE=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),i_=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),a_=/[0-9A-Za-z_]/;function oE(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var a=e.charCodeAt(r)-48;n&&(a*=2)>9&&(a-=9),t+=a,n=!n}return t%10==0}function Dc(e,t){if(t===void 0&&(t=!0),Ye(e))return!1;if(at(e)){e=qh(e);var n=t?r_.test((e||"").replace(/[- ]/g,"")):(function(a){var o;for(s_.lastIndex=0;o=s_.exec(a);){var u=o[2];if(u)for(var h=u.replace(/[- ]/g,""),f=0;h.length>f;f++)for(var p of aE){var m=f+p;if(h.length>=m){var x=h.slice(f,m);if(r_.test(x)&&oE(x))return!0}}}return!1})(e);if(n)return!1;var r=t?lE.test(e):(function(a){var o;for(i_.lastIndex=0;o=i_.exec(a);){var u=o[1],h=o[3];if(!(u&&h&&a_.test(u)&&a_.test(h)))return!0}return!1})(e);if(r)return!1}return!0}function l_(e){var t=Wc(e);return Dc(t=(t+" "+D2(e)).trim())?t:""}function D2(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Nt(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=Wc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+D2(n)).trim())}catch(o){ye.error("[AutoCapture]",o)}})),t}function o_(e){return e.replace(/"|\\"/g,'\\"')}function cE(e){var t=e.attr__class;if(t)return Pe(t)?t:Ux(t)}var Rd=Gt("[Dead Clicks]"),uE=()=>!0,dE=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(zx)),r=e.instance.config.capture_dead_clicks;return Kn(r)?r:!!nt(r)||n};class c_{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[zx]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys((()=>{this.Xs()})):this.stop()}Ys(t){var n,r;(n=Re.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Re.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?Rd.error("failed to load script",a):t()}))}Xs(){var t;if(pe){if(!this.Ks&&(t=Re.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=nt(this.instance.config.capture_dead_clicks)?de({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ks=Re.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ks.start(pe),Rd.info("starting...")}}else Rd.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,Rd.info("stopping..."))}}var Ld=Gt("[SegmentIntegration]");function u_(e,t,n){n===void 0&&(n=!0);var r=e.config.segment;if(!r)return t();(function(a,o,u){var h=a.config.segment;if(!h)return o();var f=m=>{var x=()=>m.anonymousId()||as();a.config.get_device_id=x,u&&m.id()&&(a.register({distinct_id:m.id(),$device_id:x()}),a.persistence.set_property(tt,On)),o(u?void 0:m.anonymousId()||void 0)},p=h.user();"then"in p&&Un(p.then)?p.then(f):f(p)})(e,(a=>{r.register(((o,u)=>{typeof Promise<"u"&&Promise.resolve||Ld.warn("This browser does not have Promise support, and can not use the segment integration");var h=(f,p)=>{if(!p)return f;var m=!!u&&f.event.anonymousId===u&&!f.event.userId;m||f.event.userId||f.event.anonymousId===o.get_distinct_id()||(Ld.info("No userId set, resetting PostHog"),o.reset()),m||(u=void 0),f.event.userId&&f.event.userId!==o.get_distinct_id()&&(Ld.info("UserId set, identifying with PostHog"),o.identify(f.event.userId));var x=o.calculateEventProperties(p,f.event.properties);return f.event.properties=Object.assign({},x,f.event.properties),f};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(f){return h(f,f.event.event)},page(f){return h(f,Hl)},identify(f){return h(f,Qg)},screen(f){return h(f,"$screen")}}})(e,a)).then((()=>{t()}),(o=>{Ld.error("Failed to register the Segment integration",o),t()}))}),n)}var O2="posthog-js";function z2(e,t){var n=t===void 0?{}:t,r=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,h=u===void 0?["error"]:u,f=n.sendExceptionsToPostHog,p=f===void 0||f;return m=>{var x,b,y,_,j;if(h!=="*"&&!h.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 w,E=((x=m.exception)==null?void 0:x.values)||[],C=E.map((O=>de({},O,{stacktrace:O.stacktrace?de({},O.stacktrace,{type:"raw",frames:(O.stacktrace.frames||[]).map((D=>de({},D,{platform:"web:javascript"})))}):void 0}))),L={$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 r&&a&&(L.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+a+"&query="+m.event_id),p&&((w=e.exceptions)==null||w.sendExceptionEvent(L)),m}}class hE{constructor(t,n,r,a,o,u){this.name=O2,this.setupOnce=function(h){h(z2(t,{organization:n,projectId:r,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class d_{constructor(t){this.ta=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(ye.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.ea=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ia()}ia(){var t;this.ra=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.ta)}destroy(){var t;(t=this.ra)==null||t.call(this),this.ra=void 0}doPageView(t,n){var r,a=this.na(t,n);return this.ea={pathname:(r=te==null?void 0:te.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.na(t,(n=this.ea)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ea)==null?void 0:t.pageViewId}}na(t,n){var r=this.ea;if(!r)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:r.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,h=o.lastScrollY,f=o.maxScrollY,p=o.maxContentHeight,m=o.lastContentY,x=o.maxContentY;if(!(ue(u)||ue(h)||ue(f)||ue(p)||ue(m)||ue(x))){u=Math.ceil(u),h=Math.ceil(h),f=Math.ceil(f),p=Math.ceil(p),m=Math.ceil(m),x=Math.ceil(x);var b=u>1?js(h/u,0,1,ye):1,y=u>1?js(f/u,0,1,ye):1,_=p>1?js(m/p,0,1,ye):1,j=p>1?js(x/p,0,1,ye):1;a=$t(a,{$prev_pageview_last_scroll:h,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:f,$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 r.pathname&&(a.$prev_pageview_pathname=r.pathname),r.timestamp&&(a.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),a}}var dc=["flags","surveys"],fE={[d2]:{exposure:"hidden"},[Fl]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[jc]:{exposure:"hidden"},[ur]:{exposure:"hidden"},[Lg]:{exposure:"event"},[Dg]:{exposure:"hidden"},[$g]:{exposure:"hidden"},[Og]:{exposure:"event"},[zg]:{exposure:"hidden"},[Bg]:{exposure:"event"},[Pg]:{exposure:"event"},[zx]:{exposure:"event"},[Bx]:{exposure:"hidden"},[Fg]:{exposure:"event"},[La]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ul]:{exposure:"hidden"},[Px]:{exposure:"event"},[h2]:{exposure:"event",shouldSkipFromEventProperties:e=>sn(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"},[Xn]:{exposure:"hidden",storageGroup:"flags"},[Yr]:{exposure:"hidden",storageGroup:"flags"},[eh]:{exposure:"hidden"},[qi]:{exposure:"hidden",storageGroup:"flags"},[is]:{exposure:"hidden",storageGroup:"flags"},[Vi]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Wl]:{exposure:"hidden",storageGroup:"flags"},[_s]:{exposure:"hidden"},[Ta]:{exposure:"hidden"},[kr]:{exposure:"hidden"},[Ss]:{exposure:"hidden"},[Ug]:{exposure:"hidden",storageGroup:"surveys"},[Sh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ig]:{exposure:"event"},[th]:{exposure:"hidden"},[nh]:{exposure:"hidden"},[Nc]:{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"},[Js]:{exposure:"hidden"},[Cc]:{exposure:"hidden"},[x2]:{exposure:"event"},[Ql]:{exposure:"hidden"},[ri]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[tt]:{exposure:"hidden"},[Hg]:{exposure:"hidden"},[qg]:{exposure:"hidden"},[Vg]:{exposure:"hidden"},[Gg]:{exposure:"hidden"},[Il]:{exposure:"hidden"},[jh]:{exposure:"hidden"},[f2]:{exposure:"event"},[p2]:{exposure:"event"},[m2]:{exposure:"event"},[g2]:{exposure:"event"},[b2]:{exposure:"event"},[y2]:{exposure:"event"},[Yg]:{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_pending_trigger_conditions:{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"}},pE=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{var t=fE[e];if(t)return t;for(var n of pE){var r=n[1];if(e.indexOf(n[0])===0)return r}},ql=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return Nw(e)}},to=e=>{var t=pe==null?void 0:pe.createElement("a");return ue(t)?null:(t.href=e,t)},no=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;r.length>a;a++){var o=r[a].split("=");if(o[0]===t){n=o;break}}if(!Pe(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," ")},Qc=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),a=r[1],o=(r[0]||"").split("?"),u=o[1],h=o[0],f=(u||"").split("&"),p=[],m=0;f.length>m;m++){var x=f[m].split("=");Pe(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(f[m]))}var b=h;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},Th=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},B2=(e,t)=>e>=t&&Sw(),P2=(e,t,n,r)=>{if(e===0){if(Sw()){var a=t+1;return a===n&&r(),a}return t}return 0},Dd="https?://(.*)",ro=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],mE=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ro],Xc="<masked>",gE=["li_fat_id"];function $2(e,t,n){if(!pe)return{};var r,a=t?[...ro,...n||[]]:[],o=F2(Qc(pe.URL,a,Xc),e),u=(r={},Nt(gE,(function(h){var f=Kg(h);r[h]=f||null})),r);return $t(u,o)}function F2(e,t){var n=mE.concat(t||[]),r={};return Nt(n,(function(a){var o=no(e,a);r[a]=o||null})),r}function U2(e){var t=(function(o){return o?o.search(Dd+"google.([^/?]*)")===0?"google":o.search(Dd+"bing.com")===0?"bing":o.search(Dd+"yahoo.com")===0?"yahoo":o.search(Dd+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!sn(t)){r.$search_engine=t;var a=pe?no(pe.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function h_(){return navigator.language||navigator.userLanguage}var Mh="$direct";function I2(){return(pe==null?void 0:pe.referrer)||Mh}function H2(e,t,n){n===void 0&&(n=!1);var r=e?[...ro,...t||[]]:[],a=n?Wi(Zt==null?void 0:Zt.href):Zt==null?void 0:Zt.href,o=a==null?void 0:a.substring(0,1e3);return{r:I2().substring(0,1e3),u:o?Qc(o,r,Xc):void 0}}function q2(e,t){var n;t===void 0&&(t=!1);var r=e.r,a=e.u,o=t?Wi(a):a,u={$referrer:r,$referring_domain:r==null?void 0:r==Mh?Mh:(n=to(r))==null?void 0:n.host};if(o){u.$current_url=o;var h=to(o);u.$host=h==null?void 0:h.host,u.$pathname=h==null?void 0:h.pathname;var f=F2(o);$t(u,f)}if(r){var p=U2(r);$t(u,p)}return u}function V2(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function xE(){try{return new Date().getTimezoneOffset()}catch{return}}var vE={flags:ri,surveys:Sh},bE=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Od=e=>e+"_cookie_identity_change_pending",zd=e=>{var t="",n=0;for(var r of e){var a=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+a>1e3)break;t+=r,n+=a}return t},vn="main",Zs=[Xn,Yr,qi,is,Vi,ri,Wl,kr],Cm=e=>Zs.indexOf(e)!==-1,$i=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Ml=e=>{if(!e)return{};var t=JSON.parse(e);return nt(t)?t:{}},f_=(e,t)=>{Nt(e,((n,r)=>{var a=An(r);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]}))};class Em{constructor(t,n,r){if(r===void 0&&(r=!0),this.sa={},this.aa=!1,this.oa=!1,this.la=!1,this.ua=!1,this.ha=!1,this.da=new Map,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.ga=new Set,this.mn=t,this.ma=r,this.props={},this.ya=void 0,this.ba=(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.Zs=this._a(t),this.la=this.wa(t),this.load(),this.ka(),t.debug&&ye.info("Persistence loaded",t.persistence,de({},this.props)),this.update_config(t,t,n),this.save(),te){var a=()=>this.flush();Lt(te,"beforeunload",a,{capture:!1}),Lt(te,"pagehide",a,{capture:!1}),this.Sa=o=>{if(this.aa&&(!o.storageArea||o.storageArea===(te==null?void 0:te.localStorage))&&o.key)if(o.key!==this.ba){if(this.la){var u=dc.find((h=>o.key===this.xa(h)));u&&this.Ca(o.key,u)}}else this.Ca(o.key,vn)},Lt(te,"storage",this.Sa)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((n=>{var r=n[0],a=n[1],o=this.da.get(r);if(Cm(r)&&o!==!0)if(a!==!0){var u=new Set(o||[]);a.forEach((h=>u.add(h))),u.size&&this.Ta(r,u)}else this.Ta(r,!0)}))}onCrossTabFeatureFlagChange(t){return this.ga.add(t),()=>this.ga.delete(t)}destroy(){this.Sa&&te&&(te.removeEventListener("storage",this.Sa),this.Sa=void 0),this.ga.clear()}Ca(t,n,r){if(r===void 0&&(r=!0),this.Ma)return!1;var a,o;try{if(o=ut.ai(t),sn(o)){var u=this.Ia(n);return u.storageValue=null,n!==vn&&(u.persisted=!1),!1}a=Ml(o)}catch{return!1}var h=n===vn?a:ut.ui(this.ba);if(h&&this.Ea(h))return!1;var f=this.Ra(a,n,r);return n===vn&&this.la&&!$i(this.Pa().main,a)||this.Aa(a,n,!0,o),f}Ea(t){var n=this.props[En],r=t[En];return!ue(n)&&!ue(r)&&n!==r}Aa(t,n,r,a){var o=this.Ia(n);o.storageValue=a,n!==vn&&(o.persisted=r);try{o.fingerprint=this.Fa(t,n)}catch{o.fingerprint=void 0}}Ra(t,n,r){var a=!1;return Zs.forEach((o=>{var u,h=(u=An(o))==null?void 0:u.storageGroup;if(!(n===vn&&this.la&&h||n!==vn&&h!==n)){var f=o in t,p=this.Oa(o,f?t[o]:void 0),m=this.da.has(o)?o in this.props:f;m===o in this.props&&$i(p,this.props[o])||(m?this.La(o,p,!1):this.Da(o,!1),a=!0)}})),a&&r&&this.ga.forEach((o=>o())),a}$a(){if(!this.aa)return!1;try{this.fa=!1;var t,n=ut.ai(this.ba),r=this.Ia(vn),a=!1,o=!1;if(n!==r.storageValue)if(sn(n))r.storageValue=null;else{if(t=Ml(n),this.fa=!this.ca&&this.Ea(t),this.fa)return!1;o=this.Ra(t,vn,!1),!this.la||$i(this.Pa().main,t)?this.Aa(t,vn,!0,n):r.storageValue=n,a=!0}return this.la&&dc.forEach((u=>{var h=ut.ai(this.xa(u)),f=this.Ia(u),p=t||{},m=a&&Zs.some((b=>{var y;return((y=An(b))==null?void 0:y.storageGroup)===u&&b in p}));if(h!==f.storageValue||m){if(sn(h))return f.storageValue=null,f.persisted=!1,void(m&&(o=this.Ra(p,u,!1)||o));var x=Ml(h);o=this.Ra(x,u,!1)||o,this.Aa(x,u,!0,h)}})),o}catch{return!1}}Ta(t,n){this.da.set(t,n);var r=An(t);r!=null&&r.volatile||(this.Ia((this.la?r==null?void 0:r.storageGroup:void 0)||vn).fingerprint=void 0,this.Na(t))}qa(){Zs.forEach((t=>this.da.set(t,!0)))}ka(){if(this.aa)try{var t=ut.ai(this.ba),n=Ml(t);this.Ia(vn).storageValue=t,Zs.forEach((r=>{var a,o=this.la?(a=An(r))==null?void 0:a.storageGroup:void 0,u=o?ut.ai(this.xa(o)):null;if(o){var h=this.Ia(o);h.storageValue=u,h.persisted=!sn(u)}var f=o&&!sn(u)?Ml(u):n;r in this.props?this.ja(r,f[r],this.props[r]):r in f&&this.Ta(r,!0)}))}catch{}}Oa(t,n){var r=this.da.get(t);if(!r)return n;if(r===!0)return this.props[t];if(t===Yr){var a=new Set(Pe(n)?n:[]),o=new Set(Pe(this.props[t])?this.props[t]:[]);return r.forEach((f=>o.has(f)?a.add(f):a.delete(f))),Array.from(a)}var u=nt(n)?de({},n):{},h=nt(this.props[t])?this.props[t]:{};return r.forEach((f=>{f in h?u[f]=h[f]:delete u[f]})),u}ja(t,n,r){if(Cm(t)){var a=this.da.get(t);if(a!==!0){var o=n;if(this.aa)try{var u,h=this.la?(u=An(t))==null?void 0:u.storageGroup:void 0,f=h?this.xa(h):this.ba;o=Ml(ut.ai(f))[t]}catch{}var p=new Set(a||[]);if(t===Yr){if(!ue(n)&&!Pe(n)||!ue(o)&&!Pe(o)||!Pe(r))return void this.Ta(t,!0);var m=new Set(n||[]),x=new Set(o||[]),b=new Set(r);new Set([...m,...b]).forEach((j=>{m.has(j)!==b.has(j)&&p.add(j)})),p.forEach((j=>{x.has(j)===b.has(j)&&p.delete(j)}))}else{if(!nt(r))return void($i(o,r)?this.da.delete(t):this.Ta(t,!0));if(!ue(n)&&!nt(n)||ue(n)&&Nr(r)&&ue(o))return void this.Ta(t,!0);var y=nt(n)?n:{},_=nt(o)?o:{};new Set([...Object.keys(y),...Object.keys(r)]).forEach((j=>{j in y==j in r&&$i(y[j],r[j])||p.add(j)})),p.forEach((j=>{j in _==j in r&&$i(_[j],r[j])&&p.delete(j)}))}p.size?this.Ta(t,p):this.da.delete(t)}}}Ba(){var t,n=(t=this.mn)==null?void 0:t.persistence_save_debounce_ms;return an(n)&&n>0?n:0}Ha(t){if(this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie")if(t)try{var n=jm(t,this.mn.cookie_persisted_properties||[]),r=Ky(n,this.mn.cookie_persisted_properties||[]),a=JSON.stringify(n)+"|"+JSON.stringify(r),o=Kt.ai(this.ba)||void 0;o&&Nm(this.ba,o)===a&&(this.za=a,this.Ua=o)}catch{}else try{var u=Kt.ai(this.ba)||void 0;this.za=u?Nm(this.ba,u):void 0,this.Ua=u}catch{}}syncCookieProperties(){return this.Wa(this.mn)}Wa(t,n){if(n===void 0&&(n=!1),this.Ma&&!n||this.ha||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=Kt.ai(this.ba)||void 0}catch{}if(!r||r===this.Ua)return!1;var a,o=Nm(this.ba,r);try{a=Sm(JSON.parse(r))}catch{return!1}if((Kt.ai(this.ba)||void 0)!==r)return!1;this.za=o,this.Ua=r;var u=Zy(this.ba,r),h=[...Ma,...u.properties],f={};if(Object.keys(a).forEach((N=>{var w=a[N];(ue(w)||sn(w)||w===""||N===tt&&w!==cn&&w!==On)&&(f[N]=!0,delete a[N])})),Nr(a))return!1;var p=En in a||a[tt]===cn||a[tt]===On,m=this.props,x=m[En],b=m[tt],y=$t({},m);[...Ma,...t.cookie_persisted_properties||[]].forEach((N=>{if(h.indexOf(N)!==-1&&!(N in a)&&!f[N]&&(p||N!==En&&N!==tt)){var w=y[N];!u.isValid&&Ma.indexOf(N)!==-1&&(w===!1||w===0)||delete y[N]}})),this.props=$t(y,a),Zs.forEach((N=>{var w=N in this.props;N in m===w&&$i(m[N],this.props[N])||(w?this.ja(N,m[N],this.props[N]):this.Ta(N,!0))})),!p||tt in a||tt in this.props||this.La(tt,cn);var _=this.props[En],j=this.props[tt];return!p||_===x&&j===b||(this.ca=!0,this.ua=!0,Rt.ni(Od(this.ba),!0),this.Da(kr),this.Da(Yr),this.Da(Xn),this.Da(qi),this.Da(is),this.Da(Vi),this.Da(ri),this.Da(Ql),this.Da(Js),j===cn&&(b===On||a[tt]===cn||!ue(x)&&_!==x)&&(f_(this.props,a),this.Da(Ss)),j===On?this.props.$user_id=_:delete this.props.$user_id,this.Da(Fl)),!0}consumeCookieIdentityChange(){var t=Od(this.ba),n=this.ua||!!Rt.ai(t);return this.ua=!1,n&&Rt.oi(t),n}Va(t){return t===void 0&&(t=!1),!(this.ha||this.Ma&&!t||!this.mn.cookieWinsOnConflict||this.mn.persistence.toLowerCase()!=="localstorage+cookie"||(this.ha=!0,0))}Ga(){this.ha&&(ue(this.Za)||(clearTimeout(this.Za),this.Za=void 0),delete this.sa[vn],this.Qa(!0))}Ja(t){if(t===void 0&&(t=!0),this.ha)try{t?this.Ga():ue(this.Za)||(clearTimeout(this.Za),this.Za=void 0)}finally{this.ha=!1}}isDisabled(){return!!this.Ma}_a(t){bE.indexOf(t.persistence.toLowerCase())===-1&&(ye.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(h,f){h===void 0&&(h=[]),f===void 0&&(f=!1);var p=[...Ma,...h];return de({},ut,{ui(m){try{var x,b={};try{x=Kt.ai(m)||void 0,b=x?Sm(JSON.parse(x)):{}}catch{}var y,_=JSON.parse(ut.ai(m)||"{}");if(f){var j=Zy(m,x),N=[...Ma,...j.properties],w={};Object.keys(b).forEach((D=>{var U=b[D];sn(U)||U===""||D===tt&&U!==cn&&U!==On||(w[D]=U)}));var E=En in w||w[tt]===cn||w[tt]===On;if(Object.keys(w).length>0){var C,L=_[En],O=(C=_[tt])!==null&&C!==void 0?C:cn;p.forEach((D=>{if(N.indexOf(D)!==-1&&!(D in b)&&(E||D!==En&&D!==tt)){var U=_[D];!j.isValid&&Ma.indexOf(D)!==-1&&(U===!1||U===0)||delete _[D]}})),!E||tt in b||tt in _||(_[tt]=cn),!E||(En in w?w[En]:_[En])===L&&(tt in w?w[tt]:_[tt])===O||(km.forEach((D=>delete _[D])),w[tt]===On&&En in w?_.$user_id=w[En]:delete _.$user_id,w[tt]!==On&&(delete _[x2],delete _[Ss]),delete _.__alias)}y=$t(_,w)}else y=$t(b,_);return ut.ni(m,y),y}catch{}return null},ni(m,x,b,y,_,j){var N=ut.ni(m,x,void 0,void 0,j);try{var w=jm(x,h);if(Object.keys(w).length){if(f){var E=Eh(m),C=Ky(w,h);if(Kt.ni(E,C,b,y,_,j),Kt.ai(E)!==JSON.stringify(C)){Kt.oi(E,y);var L=jm(x);return Kt.ni(m,L,b,y,_,j),N}}Kt.ni(m,w,b,y,_,j)}}catch(O){ut.si(O)}return N},oi(m,x){try{te==null||te.localStorage.removeItem(m),Kt.oi(m,x),Kt.oi(Eh(m),x)}catch(b){ut.si(b)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),a=!1,o=!1,u=t.persistence.toLowerCase();return u==="localstorage"&&ut.ii()?(n=ut,o=!0):u==="localstorage+cookie"&&r.ii()?(n=r,o=!0,a=!0):u==="sessionstorage"&&Rt.ii()?n=Rt:u==="memory"?n=Zg:u==="cookie"&&Kt.ii()?(n=Kt,a=!0):r.ii()?(n=r,o=!0,a=!0):Kt.ii()?(n=Kt,a=!0):n=Zg,this.aa=o,this.oa=a,n}xa(t){return this.ba+"__"+t}wa(t){return this.aa&&!!t.split_storage}properties(){var t={};return Nt(this.props,((n,r)=>{var a=An(r);if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n))return;t[r]=n}})),t}load(t){if(t===void 0&&(t=!1),!this.Ma||t){var n=this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie",r=n?ut.ui(this.ba):null,a={};if(n)try{Nt(a=Sm(Kt.ui(this.ba)),((_,j)=>{(ue(_)||sn(_)||_==="")&&delete a[j]}))}catch{}var o=this.Zs.ui(this.ba);if(o&&(this.props=$t({},o)),this.la&&this.Ka(),n&&o){var u,h,f=r==null?void 0:r[En],p=(u=r==null?void 0:r[tt])!==null&&u!==void 0?u:cn,m=o[En],x=(h=o[tt])!==null&&h!==void 0?h:cn;if(m!==f||x!==p){this.ua=!0,Rt.ni(Od(this.ba),!0);var b=$t({},this.props);km.forEach((_=>delete b[_])),x===cn&&(p===On||a[tt]===cn||!ue(f)&&m!==f)&&(f_(b,a),delete b[Ss]),this.props=b;var y=new Set;km.forEach((_=>{var j,N=(j=An(_))==null?void 0:j.storageGroup;N&&y.add(N)})),y.forEach((_=>{var j={};Nt(this.props,((N,w)=>{var E;((E=An(w))==null?void 0:E.storageGroup)===_&&(j[w]=N)})),Nr(j)?(ut.oi(this.xa(_)),this.sa[_]={}):ut.ni(this.xa(_),j)&&(this.sa[_]={persisted:!0,fingerprint:this.Fa(j,_)})}))}}Rt.ai(Od(this.ba))&&(this.ua=!0)}}Ka(){for(var t of dc){var n=ut.ui(this.xa(t));if(n&&!Nr(n)){var r=this.Ia(t);r.persisted=!0,this.Ya(t)||(r.fingerprint=this.Fa(n,t)),this.Xa(t,n)||$t(this.props,n)}}}Ya(t){return Object.keys(this.props).some((n=>{var r;return((r=An(n))==null?void 0:r.storageGroup)===t}))}Xa(t,n){var r=vE[t];if(!r)return!1;var a=n[r],o=this.props[r];return an(a)&&an(o)&&o>a}refreshKey(t){var n;if(!(this.Ma||t===ur&&this.pa)){var r=this.la?(n=An(t))==null?void 0:n.storageGroup:void 0,a=r?ut.ui(this.xa(r)):this.Zs.ui(this.ba);if(a&&t in a)this.La(t,a[t],!1);else{if(r){var o=this.Zs.ui(this.ba);if(o&&t in o)return void this.La(t,o[t],!1)}this.Da(t,!1)}}}save(){if(!this.Ma){var t=this.Ba();t>0?ue(this.Za)&&(this.Za=setTimeout((()=>{this.Za=void 0,this.Qa()}),t)):this.Qa()}}flush(){ue(this.Za)||(clearTimeout(this.Za),this.Za=void 0,this.Qa())}Qa(t){if(t===void 0&&(t=!1),!(this.Ma||this.ha&&!t)){t||(this.syncCookieProperties(),this.pa||this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(ur));var n=!t&&!this.va;n||(this.fa=!1);var r=!!n&&this.$a();if(this.fa)this.mn.debug&&ye.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.la)return this.eo(),void(r&&this.ga.forEach((o=>o())));var a=this.io(this.Zs,this.ba,this.props,vn);a==="written"&&this.Ha(this.props),a!=="failed"&&(this.da.clear(),this.ca=!1,this.pa=!1),r&&this.ga.forEach((o=>o()))}}}eo(){var t=this,n=this.Pa(),r=n.main,a=n.groups,o=this.io(this.Zs,this.ba,r,vn);o==="written"&&this.Ha(r),o!=="failed"&&(this.ca=!1,this.pa=!1,Zs.forEach((f=>{var p;(p=An(f))!=null&&p.storageGroup||this.da.delete(f)})));var u=function(f){var p,m=a[f];if(Nr(m)&&((p=t.sa[f])==null||!p.persisted))return Zs.forEach((b=>{var y;((y=An(b))==null?void 0:y.storageGroup)===f&&t.da.delete(b)})),1;var x=t.io(ut,t.xa(f),m,f);x!=="failed"&&Zs.forEach((b=>{var y=An(b);(y==null?void 0:y.storageGroup)!==f||x!=="written"&&y.volatile||t.da.delete(b)}))};for(var h of dc)u(h)}Pa(){var t={},n={flags:{},surveys:{}};return Nt(this.props,((r,a)=>{var o,u=(o=An(a))==null?void 0:o.storageGroup;u?n[u][a]=r:t[a]=r})),{main:t,groups:n}}Fa(t,n){if(n===vn)return JSON.stringify(t)+"|"+this.ro+"|"+this.no+"|"+this.so;var r={};return Nt(t,((a,o)=>{var u;r[o]=(u=An(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(r)}io(t,n,r,a){var o,u=this.Ia(a);if(a!==vn&&!u.dirty&&!ue(u.fingerprint))return"skipped";try{if((o=this.Fa(r,a))===u.fingerprint)return u.dirty=!1,"skipped"}catch{o=void 0}return t.ni(n,r,this.ro,this.no,this.so,this.mn.debug)?(u.dirty=!1,a!==vn&&(u.persisted=!0),ue(o)||(u.fingerprint=o),this.aa&&(u.storageValue=ut.ai(n)),"written"):(this.mn.debug&&ye.warn('failed to persist storage entry "'+n+'"; will retry on next save'),"failed")}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(this.qa(),ue(this.Za)||(clearTimeout(this.Za),this.Za=void 0),this.Zs.oi(this.ba,!1),this.Zs.oi(this.ba,!0),!r&&this.ma)for(var a of dc)ut.oi(this.xa(a));r?delete this.sa[vn]:this.sa={},this.za=void 0,this.Ua=void 0}clear(){this.remove(),this.props={}}register_once(t,n,r){if(nt(t)){this.syncCookieProperties(),ue(n)&&(n="None"),this.ro=ue(r)?this.ao:r;var a=!1;if(Nt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.La(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(nt(t)){this.syncCookieProperties(),this.ro=ue(n)?this.ao:n;var r=!1;if(Nt(t,((a,o)=>{t.hasOwnProperty(o)&&(this.props[o]!==a||nt(a)||Pe(a))&&(this.La(o,a),r=!0)})),r)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var n=typeof t=="string"?[t]:t,r=!1;for(var a of n)a in this.props&&(this.Da(a),r=!0);r&&this.save()}update_campaign_params(){var t=pe==null?void 0:pe.URL;if(t!==this.ya){var n=$2(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),r=!Nr(Fx(n));return r&&this.register(n),this.ya=t,r?n:void 0}}update_search_keyword(){var t;this.register((t=pe==null?void 0:pe.referrer)?U2(t):{})}update_referrer_info(){var t;this.register_once({$referrer:I2(),$referring_domain:pe!=null&&pe.referrer&&((t=to(pe.referrer))==null?void 0:t.host)||Mh},void 0)}set_initial_person_info(){if(!this.props[Vg]&&!this.props[Gg]){var t=H2(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[Il]:this.oa?{r:zd(t.r),u:t.u?zd(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};Nt([Gg,Vg],(a=>{var o=this.props[a];o&&Nt(o,(function(u,h){t["$initial_"+kg(h)]=u}))}));var n=this.props[Il];if(n){var r=(function(a,o){o===void 0&&(o=!1);var u=q2(a,o),h={};return Nt(u,(function(f,p){h["$initial_"+kg(p)]=f})),h})(n,this.mn.disable_capture_url_hashes);$t(t,r)}return t}safe_merge(t){return Nt(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){var a=t.persistence!==n.persistence,o=!((j,N)=>{if(j.length!==N.length)return!1;var w=[...j].sort(),E=[...N].sort();return w.every(((C,L)=>C===E[L]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),u=a||o,h=t.cookieWinsOnConflict!==n.cookieWinsOnConflict,f=t.disable_persistence||!!r,p=!!this.Ma&&!f;f||this.Wa(n,p),this.mn=t,!f&&(a||o||h)&&(this.za=void 0,this.Ua=void 0,this.Wa(de({},t,{cookie_persisted_properties:n.cookie_persisted_properties}),p));var m=u||h?this._a(t):this.Zs;this.oo();var x=this.wa(t),b=u||x!==this.la,y=!f&&(b||t.cross_subdomain_cookie!==this.no||t.secure_cookie!==this.so)&&this.Va(p);this.va=b;try{if(this.ao=this.ro=t.cookie_expiration,this.set_disabled(f),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),b){var _=this.props;this.clear(),this.Zs=m,this.la=x,this.props=_,this.save()}else h&&(this.Zs=m,f||(delete this.sa[vn],this.Qa()))}finally{this.va=!1,y&&this.Ja()}}oo(){var t=this.props[Il];if(this.oa&&nt(t)&&typeof t.r=="string"){var n=zd(t.r),r=typeof t.u=="string"?zd(t.u):t.u;n===t.r&&r===t.u||this.La(Il,de({},t,{r:n,u:r}))}}set_disabled(t){this.Ma=t,this.Ma?this.remove():this.save()}set_cross_subdomain(t){t!==this.no&&(this.no=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.so&&(this.so=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[jc]||{};r[t]=n,this.La(jc,r),this.save()}remove_event_timer(t){var n=this.props[jc]||{},r=n[t];return ue(r)||(delete n[t],this.La(jc,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.La(t,n),this.save()}La(t,n,r){var a;r===void 0&&(r=!0);var o=this.props[t];this.props[t]=n,r&&(t!==En&&t!==tt||o===n||(this.ca=!0),t!==ur||$i(o,n)||(this.pa=!0),this.ja(t,o,n),(a=An(t))!=null&&a.volatile||this.Na(t))}Da(t,n){n===void 0&&(n=!0),delete this.props[t],n&&(Cm(t)&&this.Ta(t,!0),t===ur&&(this.pa=!0),this.Na(t))}Na(t){var n,r=(n=An(t))==null?void 0:n.storageGroup;r&&(this.Ia(r).dirty=!0)}Ia(t){return this.sa[t]||(this.sa[t]={})}}var Sr={GZipJS:"gzip-js",Base64:"base64"},hc={Activation:"events",Cancellation:"cancelEvents"},Am={Popover:"popover",API:"api",Widget:"widget"},ti={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Tm={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},nx={Popover:"popover",Inline:"inline"};function Bd(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Un(n.then)&&n.then(void 0,(()=>{}))}}}}var yE={SHOWN:"product tour shown"},p_={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},m_=Gt("[RateLimiter]");class _E{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((a=>{m_.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void m_.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,h=new Date().getTime(),f=(n=(r=this.instance.persistence)==null?void 0:r.get_property(qg))!==null&&n!==void 0?n:{tokens:o,last:h};f.tokens+=(h-f.last)/1e3*u,f.last=h,f.tokens>o&&(f.tokens=o);var p=1>f.tokens;if(p||t||(f.tokens=Math.max(0,f.tokens-1)),p&&!t){var m=(an(f.dropped)?f.dropped:0)+1;f.dropped=m,!this.lastEventRateLimited&&this.lo(m)&&(f.dropped=0)}return this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(qg,f),{isRateLimited:p,remainingTokens:f.tokens}}uo(t){var n=this.instance.config.property_denylist;return!Pe(n)||!n.includes(t)}ho(){var t;if(this.uo("$current_url")&&this.uo("$pathname")&&Zt!=null&&Zt.pathname)return""+((t=Zt.origin)!==null&&t!==void 0?t:"")+Zt.pathname}lo(t){var n,r,a=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,u=this.ho(),h=this.uo("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,f=[t+" event(s) dropped since the last warning",u?"triggered on "+u:void 0,h?"session "+h:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+f+". 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 Fi=Gt("[RemoteConfig]");class G2{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Re._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}do(t){var n,r;(n=Re.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Re.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vo(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 Fi.info("Using preloaded remote config",this.remoteConfig),void this.co(this.remoteConfig);if(this._instance.fo())return void Fi.warn("Remote config is disabled. Falling back to local config.");this.do((t=>{if(!t)return Fi.info("No config found after loading remote JS config. Falling back to JSON."),void this.vo((n=>{this.co(n.json,n)}));this.co(t)}))}catch(t){Fi.error("Error loading remote config",t),this.co()}}co(t,n){!t&&n&&(n.statusCode===0?n.error||Fi.warn("Failed to fetch remote config from PostHog."):Fi.error("Failed to fetch remote config from PostHog."));try{this._instance.co(t?{ok:!0,config:t}:{ok:!1})}catch(a){Fi.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 r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(a){Fi.error("Error loading feature flags",a)}}}var Qr=Uint8Array,dr=Uint16Array,so=Uint32Array,qx=new Qr([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]),Vx=new Qr([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]),g_=new Qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Y2=function(e,t){for(var n=new dr(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var a=new so(n[30]);for(r=1;30>r;++r)for(var o=n[r];n[r+1]>o;++o)a[o]=o-n[r]<<5|r;return[n,a]},W2=Y2(qx,2),rx=W2[1];W2[0][28]=258,rx[258]=28;for(var x_=Y2(Vx,0)[1],Q2=new dr(32768),Jt=0;32768>Jt;++Jt){var Rl=(43690&Jt)>>>1|(21845&Jt)<<1;Q2[Jt]=((65280&(Rl=(61680&(Rl=(52428&Rl)>>>2|(13107&Rl)<<2))>>>4|(3855&Rl)<<4))>>>8|(255&Rl)<<8)>>>1}var Oc=function(e,t,n){for(var r=e.length,a=0,o=new dr(t);r>a;++a)++o[e[a]-1];var u,h=new dr(t);for(a=0;t>a;++a)h[a]=h[a-1]+o[a-1]<<1;for(u=new dr(r),a=0;r>a;++a)u[a]=Q2[h[e[a]-1]++]>>>15-e[a];return u},za=new Qr(288);for(Jt=0;144>Jt;++Jt)za[Jt]=8;for(Jt=144;256>Jt;++Jt)za[Jt]=9;for(Jt=256;280>Jt;++Jt)za[Jt]=7;for(Jt=280;288>Jt;++Jt)za[Jt]=8;var Rh=new Qr(32);for(Jt=0;32>Jt;++Jt)Rh[Jt]=5;var wE=Oc(za,9),kE=Oc(Rh,5),X2=function(e){return(e/8>>0)+(7&e&&1)},K2=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof dr?dr:e instanceof so?so:Qr)(n-t);return r.set(e.subarray(t,n)),r},Ys=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},fc=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Mm=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var a=n.length,o=n.slice();if(!a)return[new Qr(0),0];if(a==1){var u=new Qr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(O,D){return O.f-D.f})),n.push({s:-1,f:25001});var h=n[0],f=n[1],p=0,m=1,x=2;for(n[0]={s:-1,f:h.f+f.f,l:h,r:f};m!=a-1;)h=n[n[x].f>n[p].f?p++:x++],f=n[p!=m&&n[x].f>n[p].f?p++:x++],n[m++]={s:-1,f:h.f+f.f,l:h,r:f};var b=o[0].s;for(r=1;a>r;++r)o[r].s>b&&(b=o[r].s);var y=new dr(b+1),_=sx(n[m-1],y,0);if(_>t){r=0;var j=0,N=_-t,w=1<<N;for(o.sort((function(O,D){return y[D.s]-y[O.s]||O.f-D.f}));a>r;++r){var E=o[r].s;if(t>=y[E])break;j+=w-(1<<_-y[E]),y[E]=t}for(j>>>=N;j>0;){var C=o[r].s;t>y[C]?j-=1<<t-y[C]++-1:++r}for(;r>=0&&j;--r){var L=o[r].s;y[L]==t&&(--y[L],++j)}_=t}return[new Qr(y),_]},sx=function(e,t,n){return e.s==-1?Math.max(sx(e.l,t,n+1),sx(e.r,t,n+1)):t[e.s]=n},v_=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new dr(++t),r=0,a=e[0],o=1,u=function(f){n[r++]=f},h=1;t>=h;++h)if(e[h]==a&&h!=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[h]}return[n.subarray(0,r),t]},pc=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},ix=function(e,t,n){var r=n.length,a=X2(t+2);e[a]=255&r,e[a+1]=r>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;r>o;++o)e[a+o+4]=n[o];return 8*(a+4+r)},b_=function(e,t,n,r,a,o,u,h,f,p,m){Ys(t,m++,n),++a[256];for(var x=Mm(a,15),b=x[0],y=x[1],_=Mm(o,15),j=_[0],N=_[1],w=v_(b),E=w[0],C=w[1],L=v_(j),O=L[0],D=L[1],U=new dr(19),I=0;E.length>I;++I)U[31&E[I]]++;for(I=0;O.length>I;++I)U[31&O[I]]++;for(var W=Mm(U,7),z=W[0],q=W[1],T=19;T>4&&!z[g_[T-1]];--T);var ie,Z,Y,P,$=p+5<<3,re=pc(a,za)+pc(o,Rh)+u,ae=pc(a,b)+pc(o,j)+u+14+3*T+pc(U,z)+(2*U[16]+3*U[17]+7*U[18]);if(re>=$&&ae>=$)return ix(t,m,e.subarray(f,f+p));if(Ys(t,m,1+(re>ae)),m+=2,re>ae){ie=Oc(b,y),Z=b,Y=Oc(j,N),P=j;var R=Oc(z,q);for(Ys(t,m,C-257),Ys(t,m+5,D-1),Ys(t,m+10,T-4),m+=14,I=0;T>I;++I)Ys(t,m+3*I,z[g_[I]]);m+=3*T;for(var B=[E,O],X=0;2>X;++X){var M=B[X];for(I=0;M.length>I;++I)Ys(t,m,R[me=31&M[I]]),m+=z[me],me>15&&(Ys(t,m,M[I]>>>5&127),m+=M[I]>>>12)}}else ie=wE,Z=za,Y=kE,P=Rh;for(I=0;h>I;++I)if(r[I]>255){var me;fc(t,m,ie[257+(me=r[I]>>>18&31)]),m+=Z[me+257],me>7&&(Ys(t,m,r[I]>>>23&31),m+=qx[me]);var be=31&r[I];fc(t,m,Y[be]),m+=P[be],be>3&&(fc(t,m,r[I]>>>5&8191),m+=Vx[be])}else fc(t,m,ie[r[I]]),m+=Z[r[I]];return fc(t,m,ie[256]),m+Z[256]},SE=new so([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),jE=(function(){for(var e=new so(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Rm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function NE(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=jE[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),r=e.length;n.p(e);var a,o,u,h,f,p=(h=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(x,b,y,_,j,N){var w=x.length,E=new Qr(_+w+5*(1+Math.floor(w/7e3))+j),C=E.subarray(_,E.length-j),L=0;if(!b||8>w)for(var O=0;w>=O;O+=65535){var D=O+65535;w>D?L=ix(C,L,x.subarray(O,D)):(C[O]=!0,L=ix(C,L,x.subarray(O,w)))}else{for(var U=SE[b-1],I=U>>>13,W=8191&U,z=(1<<y)-1,q=new dr(32768),T=new dr(z+1),ie=Math.ceil(y/3),Z=2*ie,Y=function(yt){return(x[yt]^x[yt+1]<<ie^x[yt+2]<<Z)&z},P=new so(25e3),$=new dr(288),re=new dr(32),ae=0,R=0,B=(O=0,0),X=0,M=0;w>O;++O){var me=Y(O),be=32767&O,Ce=T[me];if(q[be]=Ce,T[me]=be,O>=X){var De=w-O;if((ae>7e3||B>24576)&&De>423){L=b_(x,C,0,P,$,re,R,B,M,O-M,L),B=ae=R=0,M=O;for(var Ee=0;286>Ee;++Ee)$[Ee]=0;for(Ee=0;30>Ee;++Ee)re[Ee]=0}var Ae=2,Fe=0,dt=W,Je=be-Ce&32767;if(De>2&&me==Y(O-Je))for(var At=Math.min(I,De)-1,mt=Math.min(32767,O),rt=Math.min(258,De);mt>=Je&&--dt&&be!=Ce;){if(x[O+Ae]==x[O+Ae-Je]){for(var Dt=0;rt>Dt&&x[O+Dt]==x[O+Dt-Je];++Dt);if(Dt>Ae){if(Ae=Dt,Fe=Je,Dt>At)break;var we=Math.min(Je,Dt-2),Ge=0;for(Ee=0;we>Ee;++Ee){var gt=O-Je+Ee+32768&32767,_n=gt-q[gt]+32768&32767;_n>Ge&&(Ge=_n,Ce=gt)}}}Je+=(be=Ce)-(Ce=q[be])+32768&32767}if(Fe){P[B++]=268435456|rx[Ae]<<18|x_[Fe];var je=31&rx[Ae],Be=31&x_[Fe];R+=qx[je]+Vx[Be],++$[257+je],++re[Be],X=O+Ae,++ae}else P[B++]=x[O],++$[x[O]]}}L=b_(x,C,!0,P,$,re,R,B,M,O-M,L)}return K2(E,0,_+X2(L)+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,h,f)),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&&Rm(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),Rm(p,m-8,n.d()),Rm(p,m-4,r),p}var CE=!!wg||!!Ex,Z2="text/plain",sh=!1,J2=(e,t)=>{var n=e.split("#"),r=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var h=u.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return o+(h?"?"+h:"")+(r?"#"+r:"")},ru=function(e,t,n){var r;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],h=de({},t),f=(r=u==null?void 0:u.split("&").map((m=>{var x,b=m.split("="),y=b[0],_=n&&(x=h[y])!==null&&x!==void 0?x:b[1];return delete h[y],y+"="+_})))!==null&&r!==void 0?r:[],p=(function(m,x){var b,y;x===void 0&&(x="&");var _=[];return Nt(m,(function(j,N){ue(j)||ue(N)||N==="undefined"||(b=encodeURIComponent((w=>w instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(h);return p&&f.push(p),f.length>0?o+"?"+f.join("&"):o},Lm=e=>{if(e.po)return e.po;var t=e.data,n=e.compression;if(t){if(n===Sr.GZipJS){var r=NE((function(h,f){var p=h.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(h);for(var m=new Qr(h.length+(h.length>>>1)),x=0,b=function(N){m[x++]=N},y=0;p>y;++y){if(x+5>m.length){var _=new Qr(x+8+(p-y<<1));_.set(m),m=_}var j=h.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&h.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 K2(m,0,x)})(ql(t)),{mtime:0});return{contentType:Z2,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Sr.Base64){var a=(function(h){return h&&btoa(encodeURIComponent(h).replace(/%([0-9A-F]{2})/g,((f,p)=>String.fromCharCode(parseInt(p,16)))))})(ql(t)),o=(h=>"data="+encodeURIComponent(typeof h=="string"?h:ql(h)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=ql(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},ek=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:ru(e.url,{compression:Sr.Base64}),encodedBody:Lm(de({},e,{compression:Sr.Base64,po:void 0}))}:{url:J2(e.url,"compression"),encodedBody:Lm(de({},e,{compression:void 0,po:void 0}))};try{t=Lm(e)}catch(a){if(Uy(e.compression,no(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),r();throw a}return t&&Uy(e.compression,no(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Mg(new Uint8Array(n)):ArrayBuffer.isView(n)&&Mg(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(sh=!0,r()):{url:e.url,encodedBody:t}},tk=e=>{try{return ek(e)}catch(t){return ye.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},EE=(function(){var e=Ft((function*(t){var n=ql(t.data),r=yield(function(o,u,h){return Rg.apply(this,arguments)})(n,Pt.DEBUG,{rethrow:!0});if(!r)return t;var a=yield r.arrayBuffer();return de({},t,{po:{contentType:Z2,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),AE=/Failed to fetch|NetworkError|Load failed/i,nk=e=>(e==null?void 0:e.name)==="TypeError"&&AE.test((e==null?void 0:e.message)||""),rk=e=>{var t=tk(e);if(t){var n=t.url,r=t.encodedBody,a=r??{},o=a.contentType,u=a.body,h=a.estimatedSize,f=new Headers;Nt(e.headers,(function(_,j){f.append(j,_)})),o&&f.append("Content-Type",o);var p=null,m=!1;if(Ey){var x=new Ey;p={signal:x.signal,timeout:setTimeout((()=>{var _;m=!0,x.abort(e2("AbortError","PostHog request timed out"+((_=e.timeout)?" after "+_+"ms":"")))}),e.timeout)}}var b=_=>{m&&(_==null?void 0:_.name)==="AbortError"||nk(_)?ye.warn(_):ye.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;Ex(n,de({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&!e.mo&&52428.8>(h||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(w){ye.error(w)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},ax=e=>{try{var t,n=ek(e),r=n.url,a=n.encodedBody,o=a??{},u=o.body,h=o.estimatedSize;if(!u)return;var f=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Nn.sendBeacon(r,f))return;var p=Pe(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Pe(p)&&p.length>1&&(h??0)>16384){var m=Math.ceil(p.length/2),x=b=>Pe(e.data)?b:de({},e.data,{batch:b});return ax(de({},e,{data:x(p.slice(0,m))})),void ax(de({},e,{data:x(p.slice(m))}))}ye.warn("Beacon of ~"+(h??0)+" bytes was rejected by the browser, falling back to fetch"),rk(de({},e,{mo:!0}))}catch(b){ye.warn("Beacon send failed",b)}},y_=(e,t,n,r)=>{var a=r==="query"?t==="POST"?"sent_at":"_":void 0;return ru(n===Sr.GZipJS?J2(e,"compression"):e,de({},a?{[a]:Date.now().toString()}:{},n===Sr.GZipJS?{}:{compression:n}))},ih=[];Ex&&ih.push({transport:"fetch",method:rk}),wg&&ih.push({transport:"XHR",method(e){var t=tk(e);if(t){var n=new wg,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=r??{},o=a.contentType,u=a.body;Nt(e.headers,(function(h,f){n.setRequestHeader(f,h)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var h={statusCode:n.status,text:n.responseText};if(n.status===200)try{h.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(h)}},n.send(u)}}}),Nn!=null&&Nn.sendBeacon&&ih.push({transport:"sendBeacon",method:ax});var lx=3e3;class TE{constructor(t,n){this.yo=!0,this.bo=[],this._o=js((n==null?void 0:n.flush_interval_ms)||lx,250,5e3,ye.createLogger("flush interval"),lx),this.wo=t}enqueue(t){this.bo.push(t),this.ko||this.So()}unload(){this.xo();var t=this.bo.length>0?this.Co():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.To(de({},r,{transport:"sendBeacon"}))}))}enable(){this.yo=!1,this.So()}So(){var t=this;this.yo||(this.ko=setTimeout((()=>{if(this.xo(),this.bo.length>0){var n=this.Co(),r=function(){var o=n[a],u=new Date().getTime();o.data&&Pe(o.data)&&Nt(o.data,(h=>{h.offset=Math.abs(h.timestamp-u),delete h.timestamp})),t.To(o)};for(var a in n)r()}}),this._o))}To(t){try{this.wo(t)}catch(n){ye.error(n)}}xo(){clearTimeout(this.ko),this.ko=void 0}Co(){var t={};return Nt(this.bo,(n=>{var r,a=n,o=(a?a.batchKey:null)||a.url;ue(t[o])&&(t[o]=de({},a,{data:[]})),(r=t[o].data)==null||r.push(a.data)})),this.bo=[],t}}var ME=["retriesPerformedSoFar"];class RE{constructor(t){this.Mo=!1,this.Io=3e3,this.bo=[],this._instance=t,this.bo=[],this.Eo=!0,!ue(te)&&"onLine"in te.navigator&&(this.Eo=te.navigator.onLine,this.Ro=()=>{this.Eo=!0,this.Po()},this.Ao=()=>{this.Eo=!1},Lt(te,"online",this.Ro),Lt(te,"offline",this.Ao))}get length(){return this.bo.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=jw(t,ME);Ks(n)&&(r.url=ru(r.url,{retry_count:n})),this._instance._send_request(de({},r,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.os(de({retriesPerformedSoFar:n},r));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.")}r.callback==null||r.callback(a)}}))}os(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(u){var h=3e3*Math.pow(2,u),f=h/2,p=Math.min(18e5,h),m=Math.random()-.5;return Math.ceil(p+m*(p-f))})(n),a=Date.now()+r;this.bo.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),ye.warn(o),this.Mo||(this.Mo=!0,this.Fo())}Fo(){if(this.Oo&&clearTimeout(this.Oo),this.bo.length===0)return this.Mo=!1,void(this.Oo=void 0);this.Oo=setTimeout((()=>{this.Eo&&this.bo.length>0&&this.Po(),this.Fo()}),this.Io)}Po(){var t=Date.now(),n=[],r=this.bo.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.bo=n,r.length>0)for(var a of r)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.Oo&&(clearTimeout(this.Oo),this.Oo=void 0),this.Mo=!1,ue(te)||(this.Ro&&(te.removeEventListener("online",this.Ro),this.Ro=void 0),this.Ao&&(te.removeEventListener("offline",this.Ao),this.Ao=void 0)),this.bo)){var n=t.requestOptions;try{this._instance._send_request(de({},n,{transport:"sendBeacon"}))}catch(r){ye.error(r)}}this.bo=[]}}class LE{constructor(t){this.Lo=()=>{var n,r,a,o;this.Do||(this.Do={});var u=this.scrollElement(),h=this.scrollY(),f=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=h+((u==null?void 0:u.clientHeight)||0),m=(u==null?void 0:u.scrollHeight)||0;this.Do.lastScrollY=Math.ceil(h),this.Do.maxScrollY=Math.max(h,(n=this.Do.maxScrollY)!==null&&n!==void 0?n:0),this.Do.maxScrollHeight=Math.max(f,(r=this.Do.maxScrollHeight)!==null&&r!==void 0?r:0),this.Do.lastContentY=p,this.Do.maxContentY=Math.max(p,(a=this.Do.maxContentY)!==null&&a!==void 0?a:0),this.Do.maxContentHeight=Math.max(m,(o=this.Do.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get $o(){return this._instance.config.scroll_root_selector}getContext(){return this.Do}resetContext(){var t=this.Do;return setTimeout(this.Lo,0),t}startMeasuringScrollPosition(){Lt(te,"scroll",this.Lo,{capture:!0}),Lt(te,"scrollend",this.Lo,{capture:!0}),Lt(te,"resize",this.Lo)}scrollElement(){var t;if(!this.$o)return te==null||(t=te.document)==null?void 0:t.documentElement;var n=Pe(this.$o)?this.$o:[this.$o];for(var r of n){var a,o=te==null||(a=te.document)==null?void 0:a.querySelector(r);if(o)return o}}No(t){var n,r,a=t==="y"?"scrollTop":"scrollLeft";if(this.$o){var o=this.scrollElement();return o&&o[a]||0}return te?t==="y"?te.scrollY||te.pageYOffset||((n=te.document)==null||(n=n.documentElement)==null?void 0:n.scrollTop)||0:te.scrollX||te.pageXOffset||((r=te.document)==null||(r=r.documentElement)==null?void 0:r.scrollLeft)||0:0}scrollY(){return this.No("y")}scrollX(){return this.No("x")}}var DE=e=>H2(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 __{constructor(t,n,r,a){this.Tt=o=>{var u=this.qo();if(!u||u.sessionId!==o){var h={sessionId:o,props:this.jo(this._instance)};this.Bo.register({[Hg]:h})}},this._instance=t,this.Ho=n,this.Bo=r,this.jo=a||DE,this.Ho.onSessionId(this.Tt)}qo(){return this.Bo.props[Hg]}getSetOnceProps(){var t,n=(t=this.qo())==null?void 0:t.props;return n?"r"in n?q2(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 Nt(Fx(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+kg(r)]=n})),t}}class Lh{on(t,n){return this.zo[t]||(this.zo[t]=[]),this.zo[t].push(n),()=>{this.zo[t]=this.zo[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.zo[t]||[])r(n);for(var a of this.zo["*"]||[])a(t,n)}constructor(){this.zo={}}}var Ll=Gt("[SessionId]"),w_=864e5;class k_{on(t,n){return this.Uo.on(t,n)}constructor(t,n,r){var a;if(this.Wo=null,this.Vo=null,this.Go=[],this.Zo=void 0,this.Qo=!1,this.Uo=new Lh,this.Jo=(f,p)=>!(!Ks(f)||!Ks(p))&&Math.abs(f-p)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ei)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.Bo=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Ko=void 0,this._sessionActivityTimestamp=null,this.Yo=n||as,this.Xo=r||as;var o=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*js(this.mn.session_idle_timeout_seconds||1800,60,36e3,Ll.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+o+"_window_id",this.il="ph_"+o+"_primary_window_exists",this.rl()){var u=Rt.ui(this.el),h=Rt.ui(this.il);u&&!h?this.It=u:Rt.oi(this.el),Rt.ni(this.il,!0)}(a=this.mn.bootstrap)!=null&&a.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ue(this.Go)&&(this.Go=[]),this.Go.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.Go=this.Go.filter((n=>n!==t))}}rl(){return this.mn.persistence!=="memory"&&!this.Bo.Ma&&Rt.ii()}sl(t){t!==this.It&&(this.It=t,this.rl()&&Rt.ni(this.el,t))}al(){return this.It?this.It:this.rl()?Rt.ui(this.el):null}ol(t){var n=this.Wo;return!sn(n)&&!sn(t)&&5e3>Math.abs(t-n)}ll(t,n,r){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Pe||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Pe=t,o&&!a||o&&this.ol(n)||(this.Wo=n,this.Bo.register({[Ul]:[n,t,r]}))}ul(){var t,n=(t=this.mn)==null?void 0:t.persistence_save_debounce_ms;return Ks(n)&&n>0}hl(){this.ul()?this.Bo.refreshKey(Ul):(this.Bo.flush(),this.Bo.load())}dl(){var t;if(!sn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wo){this.hl();var n=this.vl();n[1]===this.Pe&&n[2]===this._sessionStartTimestamp&&(this.Wo=this._sessionActivityTimestamp,this.Bo.register({[Ul]:[this._sessionActivityTimestamp,(t=this.Pe)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Bo.flush())}}cl(){var t=this.vl()[0],n=Ks(t)?t:0,r=Ks(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}fl(t){return this.hl(),this.Jo(t,this.cl())}vl(){var t=this.Bo.props[Ul];return Pe(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Wo=null,this.Ko=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(t,n){n===void 0&&(n=!1);var r=(function(a,o){o===void 0&&(o=new Date().getTime());try{var u=(h=>{var f=h.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(a);return u>o+6e4?void Ll.error("Bootstrap sessionID cannot be in the future"):u}catch(h){return void Ll.error("Invalid sessionID in bootstrap",h)}})(t);return!ue(r)&&(n?this.Ko={sessionId:t,sessionStartTimestamp:r}:this.ll(t,new Date().getTime(),r),!0)}destroy(){this.Qo=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Zo&&te&&(te.removeEventListener(Nh,this.Zo,{capture:!1}),this.Zo=void 0),this.Go=[]}nl(){this.Zo=()=>{this.dl(),this.rl()&&Rt.oi(this.il)},Lt(te,Nh,this.Zo,{capture:!1})}checkAndGetSessionAndWindowId(t,n,r){if(t===void 0&&(t=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.mn.cookieless_mode===ei)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),o=this.Pe;if(r)this.Vo=a;else if(sn(this.Vo)||this.Vo>a||a-this.Vo>=1e3){var u,h;(u=(h=this.Bo).syncCookieProperties)==null||u.call(h),this.Vo=a}var f=this.vl(),p=f[1],m=f[2],x=!ue(o)&&p!==o,b=this.cl(),y=this.al(),_=this.Ko,j=!!_&&(_.sessionStartTimestamp>a+6e4||a-_.sessionStartTimestamp>w_),N=_?j:Ks(m)&&Math.abs(a-m)>w_,w=!1,E=x,C=!p||!!_,L=p,O=!C&&!t&&this.Jo(a,b);if(O){(O=this.fl(a))||Ll.info("cross-tab refresh kept the session alive",{sessionId:p});var D=this.vl();p=D[1],m=D[2]}if(C||O||N){E=!1;var U=_&&!j;p=U?_.sessionId:this.Yo(),y=this.Xo(),Ll.info("new session ID assigned",{sessionId:p,windowId:y,bootstrapped:!!U,changeReason:{noSessionId:C,activityTimeout:O,sessionPastMaximumLength:N}}),m=U?_.sessionStartTimestamp:a,this.Ko=void 0,w=!0}else y||(y=this.Xo(),w=!0),(E=E||p!==L)&&(Ll.info("adopted cross-tab session id",{sessionId:p,windowId:y}),w=!0);var I=Ks(b)&&t&&!N?b:a,W=Ks(m)?m:new Date().getTime();this.sl(y),this.ll(p,I,W),t||this.tl();var z={noSessionId:C,activityTimeout:O,sessionPastMaximumLength:N,crossTabAdoption:E};return w&&this.Go.forEach((q=>q(p,y,z))),{sessionId:p,windowId:y,sessionStartTimestamp:W,changeReason:w?z:void 0,lastActivityTimestamp:b}}tl(){this.Qo||(clearTimeout(this.pl),this.pl=setTimeout((()=>{if(!this.Qo)if(this.fl(new Date().getTime())){var t=this.Pe;this.resetSessionId(),this.Uo.emit("forcedIdleReset",{idleSessionId:t})}else this.tl()}),1.1*this.sessionTimeoutMs))}}var sk=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Ty(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>Ty(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function ik(){return(ik=Ft((function*(){var e=Nn==null?void 0:Nn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return at(n)&&n.length>0?n:void 0}catch(r){return void ye.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}function ak(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Dh=(e,t)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Pd=e=>e.toLowerCase(),lk={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>Dh(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Dh(n,r))))),icontains:(e,t)=>t.map(Pd).some((n=>e.map(Pd).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(Pd).every((n=>e.map(Pd).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r<parseFloat(a)))}))};function ok(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],a=t==null?void 0:t[n[0]];if(a==null)return!1;var o=lk[r.operator];return!!o&&o(r.values,[String(a)])}))}function Dm(e,t,n){return ql({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ox="custom",S_="i.posthog.com",OE=/^\/static\//,zE=["/s/","/e/","/i/"];class BE{constructor(t){this.gl={},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("."+S_,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.gl[this.apiHost]||(this.gl[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":ox),this.gl[this.apiHost]}ml(t){if(OE.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}yl(t){var n=to(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}bl(t,n,r){if(t==="ui")return r;var a=r,o=this.instance.config.rewriteRequestPath;if(o){var u,h=((u=to(r))==null?void 0:u.href)||r;a=o(new URL(h)).toString()}if(o&&t==="api"&&zE.some((b=>n.indexOf(b)===0))){var f=this.yl(a);if(f){var p,m=this.apiHost,x=this._l;((p=x)==null?void 0:p.apiHost)===m&&x.rewriteRequestPath===o||(x={apiHost:m,rewriteRequestPath:o,urls:new Set},this._l=x),x.urls.add(f)}}return a}isIngestionEndpoint(t){var n=this._l,r=this.yl(t);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&n.urls.has(r)}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.bl(t,n,this.uiHost+n);if(t==="flags")return this.bl(t,n,this.flagsApiHost+n);if(t==="assets"){var r=this.ml(n);if(r)return this.bl(t,n,""+r+n)}if(this.region===ox)return this.bl(t,n,this.apiHost+n);var a=S_+n;switch(t){case"assets":return this.bl(t,n,"https://"+this.region+"-assets."+a);case"api":return this.bl(t,n,"https://"+this.region+"."+a)}}}var kt=Gt("[Surveys]"),ck="seenSurvey_",uk=e=>{try{var t=(n=>((r,a)=>""+ck+(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)}},PE=[Am.Popover,Am.Widget,Am.API],$E={ignoreConditions:!1,ignoreDelay:!1,displayType:nx.Popover},FE=Gt("[PostHog ExternalIntegrations]"),UE={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class IE{constructor(t){this._instance=t}Ys(t,n){var r;(r=Re.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return FE.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,h,f=r[0],p=r[1];!p||(o=Re.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[f]||t.Ys(UE[f],(()=>{var m;(m=Re.__PosthogExtensions__)==null||(m=m.integrations)==null||(m=m[f])==null||m.start(t._instance)})),!p&&(u=Re.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[f]&&((h=Re.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[f])==null||h.stop())};for(var r of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class HE{constructor(t,n){this.A=t,this.Ns=n,this.wl=new Map,this.Os=!1}add(t){var n=this;return Ft((function*(){if(n.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.wl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.wl.set(t.name,t);try{var r=t.setup(n.Ns);r&&(yield r)}catch(o){var a=n.wl.get(t.name)===t;a&&n.wl.delete(t.name),n.A.error('Failed to set up browser extension "'+t.name+'"',o),a&&n.kl(t)}}))()}getExtension(t){return this.wl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.wl.values()).reverse();for(var n of(this.wl.clear(),t))this.kl(n)}}kl(t){try{var n=t.dispose==null?void 0:t.dispose();n&&Un(n.then)&&n.then(void 0,(r=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class qE{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 r={};for(var a of t){var o=n==null?void 0:n.get_property(a);ue(o)||(r[a]=o)}return r}set(t,n){var r;(r=this._instance.persistence)==null||r.register(typeof t=="string"?{[t]:n}:t)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var j_="extensionsRemoteConfig";class VE{constructor(t){this.Os=!1,this.instance=t,this.A=ye,this.Sl=t.xl,this.kv=new qE(t),this.onEvent=n=>Bd(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(a){this.A.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.Os)return Bd((()=>{}));var r=o=>{try{n(o)}catch(u){this.A.error("Browser extension remote config listener failed",u)}},a=this.instance.Cl.on(j_,r);return this.Sl&&r(this.Sl),Bd(a)},this.Tl=new HE(ye.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Yc))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Yc);return typeof t=="string"?t:void 0}get library(){return{name:Pt.LIB_NAME,version:Pt.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,r,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:(r=o==null?void 0:o.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(a=o==null?void 0:o.sessionStartTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Tl.add(t)}getExtension(t){return this.Tl.getExtension(t)}capture(t,n,r){var a=this;return Ft((function*(){r?a.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):a.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return Bd(this.instance.Ml(t))}handleRemoteConfig(t){this.Os||(this.Sl=t,this.instance.Cl.emit(j_,t))}sendRequest(t,n){var r=this;return Ft((function*(){var a;n===void 0&&(n={});var o=r.instance.requestRouter.endpointFor((a=n.target)!==null&&a!==void 0?a:"api",t),u={method:n.method,url:n.query?ru(o,n.query):o,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target==="flags"&&n.compression==="best-available"?Sg.Base64:void 0,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(u),{statusCode:202}):new Promise((h=>{u.callback=h,r.instance._send_request(u)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var zc={},Om=0,Bc=()=>{},N_='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mc="Surveys module not available",C_="sanitize_properties is deprecated. Use before_send instead",dk="Invalid value for property_denylist config: ",GE=/^[A-Za-z0-9_-]{1,400}$/,zm=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,YE=["token","distinct_id",v2],Pl="posthog",hk=!CE&&(cr==null?void 0:cr.indexOf("MSIE"))===-1&&(cr==null?void 0:cr.indexOf("Mozilla"))===-1,WE=e=>{var t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Bm=e=>{var t;return de({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Y4(pe==null?void 0:pe.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Bc,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:Zt&&at(Zt==null?void 0:Zt.search)&&Zt.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:(te==null||(t=te.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:Wg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:lx},error_tracking:{},_onCapture:Bc},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:sE,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:WE(n),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),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},QE=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],E_=e=>{var t={};for(var n of QE){var r=n[0],a=n[1];ue(e[r])||(t[a]=e[r])}var o=$t({},t,e),u=e.__preview_external_dependency_versioned_paths;return ue(u)||(ue(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),at(u)&&ue(e.asset_host)&&(o.asset_host=u)),Pe(e.property_blacklist)&&(ue(e.property_denylist)?o.property_denylist=e.property_blacklist:Pe(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(dk+e.property_denylist)),o};class XE{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(t){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class jr{El(t){if(t){var n=this.wl.indexOf(t);n!==-1&&this.wl.splice(n,1)}}Rl(t,n){return this.El(t),this.wl.push(n),n.initialize==null||n.initialize(),n}Pl(){return this.config.cookieless_mode===ei||this.config.cookieless_mode===Hi&&this.consent.isRejected()}Al(){if(!this.Fl&&!this.config.segment&&!this.Pl()){var t,n,r,a=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";(a||this.config.disable_persistence)&&(this.Ol||(a?(t="persistence is set to '"+this.config.persistence+"'",n=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",n="on every page load",r="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Fl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+n+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+r)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===El){var t=this.persistence;if(t){this.Dl()||t.load(!0);var n=this.get_distinct_id();if(!n||n===El){var r=this.config.get_device_id(as());this.register({distinct_id:r,$device_id:r}),t.set_property(tt,cn)}this.$l()}}}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 XE,this.Nl=!1,this.version=Pt.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new Lh,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Bm(),this.SentryIntegration=hE,this.sentryIntegration=r=>(function(a,o){var u=z2(a,o);return{name:O2,processEvent:h=>u(h)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new LE(this),this.pageViewManager=new d_(this),this.rateLimiter=new _E(this),this.requestRouter=new BE(this),this.consent=new J4(this),this.externalIntegrations=new IE(this);var n=(t=jr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,a,o)=>{var u=at(r)?{[r]:a}:r;this.setPersonProperties(u),o==null||o({})},set_once:(r,a,o)=>{var u=at(r)?{[r]:a}:r;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(r=>ye.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==Pl){var a,o=(a=zc[r])!==null&&a!==void 0?a:new jr;return o._init(t,n,r),zc[r]=o,zc[Pl][r]=o,o}return this._init(t,n,r)}_init(t,n,r){var a,o,u;n===void 0&&(n={});var h,f=at(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!==((h=this.config)==null?void 0:h.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=Bm(n.defaults),n.debug=this.Vl(n.debug),this.Gl=n,this.Zl=[],n.person_profiles?this.Ul=n.person_profiles:n.process_person&&(this.Ul=n.process_person);var p=Bm(n.defaults),m=E_(n),x=$t({},p,m,{name:r,token:f});nt(p.rageclick)&&nt(m.rageclick)&&(x.rageclick=$t({},p.rageclick,m.rageclick)),nt(p.session_recording)&&nt(m.session_recording)&&(x.session_recording=$t({},p.session_recording,m.session_recording)),this.set_config(x),this.config.on_xhr_error&&ye.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Sr.GZipJS;var b=this.Dl();if(this.persistence=new Em(this.config,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Em(de({},this.config,{persistence:"sessionStorage"}),b,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&Rt.ii()){var y=Rt.ui(this.jl);Pe(y)&&y.forEach((I=>{at(I)&&this.ql.add(I)}))}else Rt.oi(this.jl);var _=de({},this.persistence.props),j=de({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ql=new TE((I=>this.Jl(I)),this.config.request_queue_config),this.Kl=new RE(this),this.__request_queue=[];var N=this.Pl();N||(this.sessionManager=new k_(this),this.sessionPropsManager=new __(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((I,W,z)=>{(z!=null&&z.activityTimeout||z!=null&&z.sessionPastMaximumLength||z!=null&&z.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(N)}),0)):(ye.info("Initializing extensions synchronously"),this.tu(N)),Pt.DEBUG=Pt.DEBUG||this.config.debug,Pt.DEBUG&&ye.info("Starting in debug mode",{this:this,config:n,thisC:de({},this.config),p:_,s:j}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=de({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=(o=n.bootstrap)==null?void 0:o.distinctID;if(this.Ol=!!w&&!Mc(w),((u=n.bootstrap)==null?void 0:u.distinctID)!==void 0){var E=n.bootstrap.distinctID,C=this.get_distinct_id(),L=this.persistence.get_property(tt);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==E&&L===cn)this.identify(E);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==E&&L===On)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 O=this.config.get_device_id(as()),D=n.bootstrap.isIdentifiedID?O:E;this.persistence.set_property(tt,n.bootstrap.isIdentifiedID?On:cn),this.register({distinct_id:E,$device_id:D})}}if(N)this.register_once({distinct_id:El,$device_id:null},"");else if(!this.get_distinct_id()){var U=this.config.get_device_id(as());this.register_once({distinct_id:U,$device_id:U},""),this.persistence.set_property(tt,cn)}return Lt(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?u_(this,(()=>this.eu())):this.eu(),Un(this.config._onCapture)&&this.config._onCapture!==Bc&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(I=>this.config._onCapture(I.event,I)))),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 ik.apply(this,arguments)})().then((I=>{I&&this.register({[ym]:I})})).catch(Bc),this}iu(t){var n=t;return at(n.name)&&Un(n.setup)}ru(t,n){this.iu(t)?n.push((()=>{this.nu().add(t).catch((()=>t.dispose==null?void 0:t.dispose())).catch((r=>{ye.error('Failed to dispose browser extension "'+t.name+'"',r)}))})):this.wl.push(t)}Xl(){var t,n,r,a,o,u,h=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=jr.__defaultExtensionClasses)==null?void 0:r.featureFlags;h&&(this.featureFlags&&this.featureFlags instanceof h||((a=this.su)==null||a.call(this),this.su=void 0,this.featureFlags=new h(this)),Un(this.featureFlags.onReloading)&&Un(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):(o=(u=this.featureFlags).initialize)==null||o.call(u))}tu(t){var n,r,a,o,u,h,f,p=performance.now(),m=de({},jr.__defaultExtensionClasses,this.config.__extensionClasses),x=[];m.exceptions&&this.wl.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new m.exceptions(this)),m.historyAutocapture&&this.wl.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.wl.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.wl.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!t&&this.wl.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||x.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.ru(this.autocapture=new m.autocapture(this),x),m.surveys&&this.ru(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new m.surveys(this),x),m.logs&&this.ru(this.logs=(a=this.logs)!==null&&a!==void 0?a:new m.logs(this),x),m.metrics&&this.wl.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new m.metrics(this)),m.conversations&&this.wl.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new m.conversations(this)),m.productTours&&this.wl.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.wl.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.wl.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.wl.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.wl.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,dE)),m.toolbar&&this.wl.push(this.toolbar=(h=this.toolbar)!==null&&h!==void 0?h:new m.toolbar(this)),m.experiments&&this.wl.push(this.experiments=(f=this.experiments)!==null&&f!==void 0?f:new m.experiments(this)),this.wl.forEach((b=>{b.initialize&&x.push((()=>{b.initialize==null||b.initialize()}))})),x.push((()=>{if(this.au){var b=this.au;this.au=void 0,this.wl.forEach((y=>y.onRemoteConfig==null?void 0:y.onRemoteConfig(b)))}})),this.ou(x,p)}ou(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.ou(t,n)}),0);var r=t.shift();if(r)try{r()}catch(o){ye.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[b2]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[y2]:a}),this.config.__preview_deferred_init_extensions&&ye.info("PostHog extensions initialized ("+a+"ms)")}co(t){var n;if(!pe||!pe.body)return ye.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.co(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.au=t),this.xl=t,this.compression=void 0,t.ok){var r,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Ue(a.supportedCompression,Sr.GZipJS)?Sr.GZipJS:Ue(a.supportedCompression,Sr.Base64)?Sr.Base64:void 0),(r=a.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:Wg}),(n=this.lu)==null||n.handleRemoteConfig(t),this.wl.forEach((o=>o.onRemoteConfig==null?void 0:o.onRemoteConfig(t)))}eu(){try{this.config.loaded(this)}catch(r){ye.critical("`loaded` function failed",r)}if(this.uu(),this.config.internal_or_test_user_hostname&&Zt!=null&&Zt.hostname){var t=Zt.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.Pl())&&this.hu()}),1),this.du=new G2(this),this.du.load()}uu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ql)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Md(this.__request_queue,(t=>this.Jl(t))),this.__request_queue=[],this.uu()}_handle_unload(){var t,n,r,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(_m),(r=this.logs)==null||r.flushLogs("sendBeacon"),(a=this.Ql)==null||a.unload(),(o=this.Kl)==null||o.unload()):this.vu()&&this.capture(_m,null,{transport:"sendBeacon"})}_send_request(t){var n;this.__loaded?hk?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=de({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?(n=this.compression)!==null&&n!==void 0?n:t.compressionFallback:t.compression,(ue(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(r=>{var a,o,u,h=de({},r);h.timeout=h.timeout||6e4;var f,p,m,x,b,y=(a=h.transport)!==null&&a!==void 0?a:"fetch";y==="sendBeacon"&&ue(h.compression)&&h.data&&(h.compression=Sr.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data={api_key:(p=(b=(x=(Pe(f=h.data)?f:[f]).map((w=>de({},w,w.timestamp instanceof Date&&!isNaN(w.timestamp.getTime())?{timestamp:w.timestamp.toISOString()}:{}))))[0])==null||(m=b.properties)==null?void 0:m.token)!==null&&p!==void 0?p:b==null?void 0:b.token,batch:x,sent_at:new Date().toISOString()}:h.timestampMode==="body"&&(h.data=(function(w,E){return E===void 0&&(E=new Date().toISOString()),Pe(w)?w.map((C=>de({},C,{sent_at:E}))):de({},w,{sent_at:E})})(h.data))),h.url=y_(h.url,h.method,h.compression,h.timestampMode);var _=ih.filter((w=>!h.disableTransport||!w.transport||!h.disableTransport.includes(w.transport))),j=(o=(u=(function(w,E){for(var C=0;w.length>C;C++)if(w[C].transport===y)return w[C]})(_))==null?void 0:u.method)!==null&&o!==void 0?o:_[0].method;if(!j)throw new Error("No available transport method");var N=w=>{try{j(w)}catch(E){nk(E)?ye.warn(E):ye.error(E),h.callback==null||h.callback({statusCode:0,error:E})}};y!=="sendBeacon"&&h.data&&h.compression===Sr.GZipJS&&I3&&typeof Promise<"u"&&!sh?EE(h).then((w=>{N(w)})).catch((w=>{if(Iy(w))return sh=!0,void N(de({},h,{compression:void 0,url:y_(r.url,r.method,void 0,r.timestampMode)}));(E=>{if(!E||typeof E!="object")return!1;var C="name"in E?String(E.name):"";return Iy(E)||C===s2})(w)&&(sh=!0),N(h)})):j(h)})(de({},t,{callback:r=>{var a,o;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(a=(o=this.config).on_request_error)==null||a.call(o,r),t.callback==null||t.callback(r)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Jl(t){this.Kl?this.Kl.retriableRequest(t):this._send_request(t)}_execute_array(t){Om++;try{var n,r=[],a=[],o=[];Md(t,(h=>{if(h)if(Pe(n=h[0]))o.push(h);else if(Un(h))try{h.call(this)}catch(f){ye.error("Error executing queued PostHog call",h,f)}else Pe(h)&&n==="alias"?r.push(h):Pe(h)&&n.indexOf("capture")!==-1&&Un(this[n])?o.push(h):a.push(h)}));var u=function(h,f){Md(h,(function(p){try{if(Pe(p[0])){var m=f;Nt(p,(function(x){m=m[x[0]].apply(m,x.slice(1))}))}else f[p[0]].apply(f,p.slice(1))}catch(x){ye.error("Error executing queued PostHog call",p,x)}}))};u(r,this),u(a,this),u(o,this)}finally{Om--}}push(t){if(Om>0&&Pe(t)&&at(t[0])){var n=jr.prototype[t[0]];Un(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}cu(){var t,n=(t=this.persistence)==null?void 0:t.get_property(ur);return at(n)&&zm.test(n)?{value:n,delivered:!1}:nt(n)&&at(n.value)&&zm.test(n.value)?{value:n.value,delivered:n.delivered===!0}:void 0}fu(t,n,r,a){if(this.persistence){this.persistence.refreshKey(ur);var o=this.cu();if(!a){if(r)return at(n)&&zm.test(n)?(n!==(o==null?void 0:o.value)&&this.persistence.register({[ur]:{value:n,delivered:!1}}),{value:n,pending:n!==(o==null?void 0:o.value)||!o.delivered}):void this.persistence.unregister(ur);if(at(t)&&GE.test(t)){if((o==null?void 0:o.value.split(".")[3])===t)return{value:o.value,pending:!o.delivered};var u="fb.1."+Date.now()+"."+t;return this.persistence.register({[ur]:{value:u,delivered:!1}}),{value:u,pending:!0}}return o?{value:o.value,pending:!o.delivered}:void 0}this.persistence.unregister(ur)}}pu(t){if(this.persistence){this.persistence.refreshKey(ur);var n=this.cu();(n==null?void 0:n.value)!==t||n.delivered||this.persistence.register({[ur]:{value:t,delivered:!0}})}}capture(t,n,r){var a,o,u,h,f,p,m,x,b,y;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!ue(t)&&at(t)){this.Ll();var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var j=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(j==null||!j.isRateLimited){var N;n!=null&&n.$current_url&&!at(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"||r!=null&&r.gu||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&&(N=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 w=new Date,E=(r==null?void 0:r.timestamp)||w,C=Oy(r==null?void 0:r.uuid,as),L={uuid:C,event:t,properties:this.calculateEventProperties(t,n||{},E,C)};t===Hl&&this.config.__preview_capture_bot_pageviews&&_&&(L.event="$bot_pageview",L.properties.$browser_type="bot"),j&&(L.properties.$lib_rate_limit_remaining_tokens=j.remainingTokens);var O=t==="$feature_flag_called"&&L.properties.$feature_flag_has_experiment===!1&&this.get_property(Wl)===!0;r!=null&&r.$set&&!O&&(L.$set=r==null?void 0:r.$set);var D=nt(n==null?void 0:n.$set)?n.$set:void 0,U=!(r==null||!r.$set)&&Gs in r.$set,I=U||!!D&&Gs in D,W=U?r==null||(a=r.$set)==null?void 0:a[Gs]:D==null?void 0:D[Gs],z=Pe(n==null?void 0:n.$unset)?n.$unset:[],q=(r==null?void 0:r.$unset)||[],T=z.indexOf(Gs)!==-1||q.indexOf(Gs)!==-1,ie=this.fu((o=N)==null?void 0:o.fbclid,W,I,T);ie&&L.properties.$process_person_profile===!0&&ie.pending&&!I&&!O&&(L.$set=de({[Gs]:ie.value},L.$set));var Z=r==null?void 0:r.$unset;Z&&(L.$unset=Z);var Y,P,$,re=O?void 0:this.mu(r==null?void 0:r.$set_once,t!==Wy,t===Qg);if(re&&(L.$set_once=re),r!=null&&r._noTruncate||(m=this.config.properties_string_max_length,x=L,b=Ee=>at(Ee)?Ee.slice(0,m):Ee,y=new Set,L=(function Ee(Ae,Fe){if(Ae!==Object(Ae))return b?b(Ae):Ae;if(!y.has(Ae)){var dt;if(y.add(Ae),Pe(Ae))dt=[],Md(Ae,(At=>{dt.push(Ee(At))}));else{var Je={};Nt(Ae,((At,mt)=>{y.has(At)||(Je[mt]=Ee(At))})),dt=Je}return dt}})(x)),L.timestamp=E,ue(r==null?void 0:r.timestamp)||(L.properties.$event_time_override_provided=!0,L.properties.$event_time_override_system_time=w),O&&(L.properties=(function(Ee,Ae){Ae===void 0&&(Ae=[]);var Fe={},dt=Je=>{Ee[Je]!==void 0&&(Fe[Je]=Ee[Je])};return D4.forEach(dt),Ae.forEach(dt),Fe})(L.properties,YE)),t===ti.DISMISSED||t===ti.SENT){var ae=n==null?void 0:n[Tm.SURVEY_ID],R=n==null?void 0:n[Tm.SURVEY_ITERATION];uk({id:ae,current_iteration:R}),L.$set=de({},L.$set,{[(Y={id:ae,current_iteration:R},P=t===ti.SENT?"responded":"dismissed",$="$survey_"+P+"/"+Y.id,Y.current_iteration&&Y.current_iteration>0&&($="$survey_"+P+"/"+Y.id+"/"+Y.current_iteration),$)]:!0})}else t===ti.SHOWN&&(L.$set=de({},L.$set,{[Tm.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===yE.SHOWN){var B=n==null?void 0:n[p_.TOUR_TYPE];B&&(L.$set=de({},L.$set,{[p_.TOUR_LAST_SEEN_DATE+"/"+B]:new Date().toISOString()}))}var X=de({},L.properties.$set,L.$set);if(Nr(X)||this.setPersonPropertiesForFlags(X),!Ye(this.config.before_send)){var M=this.ns(L);if(!M)return;(L=M).uuid=Oy(L.uuid,as)}var me=(u=(h=L.$set)==null?void 0:h[Gs])!==null&&u!==void 0?u:nt((f=L.properties)==null?void 0:f.$set)?L.properties.$set[Gs]:void 0,be=ie!=null&&ie.pending&&me===ie.value?ie.value:void 0;this.Cl.emit("eventCaptured",L);var Ce=(p=r==null?void 0:r._url)!==null&&p!==void 0?p:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),De=de({method:"POST",url:Ce,data:L,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(Ce)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey},r!=null&&r.transport?{transport:r.transport}:{},be?{fireCallbackOnDrop:!0,callback:Ee=>{Ee.statusCode>=200&&300>Ee.statusCode&&this.pu(be)}}:{});return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly||be?this.Jl(De):this.Ql.enqueue(De),L}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)))}getExtension(t){var n;return(n=this.lu)==null?void 0:n.getExtension(t)}nu(){var t;return(t=this.lu)!==null&&t!==void 0?t:this.lu=new VE(this)}Ml(t){this.Bl.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.Bl.indexOf(t);r!==-1&&this.Bl.splice(r,1)}}}yu(t){var n,r,a;return t===void 0&&(t=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(tt)===cn&&((a=this.sessionPersistence)==null||a.clear(),this.ql.clear(),this.bu()),(r=this.featureFlags)==null||r.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,r,a,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.yu();var u=o?void 0:this.persistence.remove_event_timer(t),h=de({},n);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Pl()&&(h[v2]=!0),t==="$snapshot"){var f=de({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=f.distinct_id,(!at(h.distinct_id)&&!an(h.distinct_id)||Mc(h.distinct_id))&&ye.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var p,m=(function(U,I,W,z){var q,T,ie,Z;if(z===void 0&&(z=!1),!cr)return{};var Y,P=U?[...ro,...I||[]]:[],$=Zw(cr),re=$[0],ae=$[1],R=(Y="u">typeof navigator?navigator:void 0)!=null&&Y.brave?{brave:!0}:{},B={};ue(W)||(B.detectGoogleSearchApp=W);var X={},M=(q=navigator)==null||(q=q.userAgentData)==null?void 0:q.platform,me=(T=navigator)==null?void 0:T.maxTouchPoints,be=te==null||(ie=te.screen)==null?void 0:ie.width,Ce=te==null||(Z=te.screen)==null?void 0:Z.height,De=te==null?void 0:te.devicePixelRatio;ue(M)||(X.userAgentDataPlatform=M),ue(me)||(X.maxTouchPoints=me),ue(be)||(X.screenWidth=be),ue(Ce)||(X.screenHeight=Ce),ue(De)||(X.devicePixelRatio=De);var Ee,Ae,Fe,dt,Je,At,mt,rt,Dt=$t(Fx({$os:re,$os_version:ae,$browser:Kw(cr,navigator.vendor,R,B),$device:Ly(cr),$device_type:(Ae=cr,Fe=X,rt=Ly(Ae),rt===Lw||rt===Rw||rt==="Kobo"||rt==="Kindle Fire"||rt===Gw?Kl:rt===Vc||rt===Gl||rt===Gc||rt===Ng?"Console":rt===Ow?"Wearable":rt?Er:(Fe==null?void 0:Fe.userAgentDataPlatform)==="Android"&&((dt=Fe==null?void 0:Fe.maxTouchPoints)!==null&&dt!==void 0?dt:0)>0?600>Math.min((Je=Fe==null?void 0:Fe.screenWidth)!==null&&Je!==void 0?Je:0,(At=Fe==null?void 0:Fe.screenHeight)!==null&&At!==void 0?At:0)/((mt=Fe==null?void 0:Fe.devicePixelRatio)!==null&&mt!==void 0?mt:1)?Er:Kl:"Desktop"),$timezone:V2(),$timezone_offset:xE()}),{$current_url:Qc(z?Wi(Zt==null?void 0:Zt.href):Zt==null?void 0:Zt.href,P,Xc),$host:Zt==null?void 0:Zt.host,$pathname:Zt==null?void 0:Zt.pathname,$raw_user_agent:cr.length>1e3?cr.substring(0,997)+"...":cr,$browser_version:a4(cr,navigator.vendor,R,B),$browser_language:h_(),$browser_language_prefix:(Ee=h_(),typeof Ee=="string"?Ee.split("-")[0]:void 0),$screen_height:te==null?void 0:te.screen.height,$screen_width:te==null?void 0:te.screen.width,$viewport_height:te==null?void 0:te.innerHeight,$viewport_width:te==null?void 0:te.innerWidth,$lib:Pt.LIB_NAME,$lib_version:Pt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Pt.SDK_DIST_CHANNEL&&(Dt.$sdk_dist_channel=Pt.SDK_DIST_CHANNEL),Dt})(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,r.getTime(),!0),b=x.windowId;h.$session_id=x.sessionId,h.$window_id=b}this.sessionPropsManager&&$t(h,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&$t(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=(y=this.Kl)==null?void 0:y.length}catch(U){h.$sdk_debug_error_capturing_properties=String(U)}if(this.requestRouter.region===ox&&(h.$lib_custom_api_host=this.config.api_host),p=t!==Hl||o?t!==_m||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),h=$t(h,p),t===Hl&&pe&&(h.title=pe.title),!ue(u)){var _=r.getTime()-u;h.$duration=parseFloat((_/1e3).toFixed(3))}cr&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties(),w=h.$groups,E=j.$groups;nt(w)&&!Nr(w)&&(h.$groups=de({},nt(E)?E:{},w)),Nt(["$referrer","$referring_domain"],(U=>{U in j&&delete N[U]}));var C={};if(this.Bl.length>0)for(var L of this.Bl.slice())try{$t(C,L())}catch(U){ye.error("Failed to produce browser extension event properties",U)}(h=$t({},m,j,N,de({},C,h))).$is_identified=this._isIdentified(),Pe(this.config.property_denylist)?Nt(this.config.property_denylist,(function(U){delete h[U]})):ye.error(dk+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var O=this.config.sanitize_properties;O&&(ye.error(C_),h=O(h,t));var D=this._u();return h.$process_person_profile=D,D&&!o&&this.wu("_calculate_event_properties"),h}mu(t,n,r){var a;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this._u()||this.Nl&&!r)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),h=$t({},o,u||{},t||{}),f=this.config.sanitize_properties;return f&&(ye.error(C_),h=f(h,"$set_once")),n&&(this.Nl=!0),Nr(h)?void 0:h}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var a;(a=this.persistence)==null||a.register_once(t,n,r)}register_for_session(t){var n,r;(n=this.persistence)==null||n.syncCookieProperties(),this.yu(),(r=this.sessionPersistence)==null||r.register(t),Object.keys(t).forEach((a=>this.ql.add(a))),this.bu()}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.ql.delete(t),this.bu()}ku(t,n){this.register({[t]:n})}Yl(){this.ql.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.ql.clear(),this.bu()}bu(){var t;if(this.jl)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.Ma||!Rt.ii())Rt.oi(this.jl);else{var n=[];this.ql.forEach((r=>n.push(r))),n.length>0?Rt.ni(this.jl,n):Rt.oi(this.jl)}}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,a;return(r=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.Cl.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:mc}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:mc})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:mc})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=$E),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:mc}}canRenderSurveyAsync(t,n){var r,a;return n===void 0&&(n=!1),(r=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:mc})}Su(t){return!t||Mc(t)?(ye.critical("Unique user id has not been set in posthog.identify"),!1):t===El?(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,r){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.Su(t)&&this.wu("posthog.identify")){this.Ll();var a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.yu(!1),h=this.persistence.Va(),f=!1;try{var p=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Yc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:p},""),t!==p&&t!==this.get_property(Fl)&&(this.unregister(Fl),this.register({distinct_id:t}));var m,x=(this.persistence.get_property(tt)||cn)===cn,b=t!==p,y=!b&&x;if(b&&x)this.persistence.set_property(tt,On),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ga(),this.capture(Qg,{distinct_id:t,$anon_distinct_id:p},{$set:n||{},$set_once:r||{}}),this.Wl=Dm(t,n,r),(m=this.featureFlags)==null||m.setAnonymousDistinctId(p);else if(y){this.persistence.set_property(tt,On);var _=n||{},j=r||{};this.setPersonPropertiesForFlags({$set:_,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.Ga(),this.capture("$set",{$set:_,$set_once:j}),this.Wl=Dm(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);b||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Js)):y&&(n||r)&&this.reloadFeatureFlags(),f=!0}finally{h&&this.persistence.Ja(f)}}}setPersonProperties(t,n){if((t||n)&&this.wu("posthog.setPersonProperties")){var r=Dm(this.get_distinct_id(),t,n);this.Wl!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Wl=r):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Pe(t)?t:[t]).filter((a=>at(a)&&a.length>0));r.length!==0&&this.wu("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Wl=null)}group(t,n,r){var a;if(t&&n){(a=this.persistence)==null||a.syncCookieProperties(),this.yu();var o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:de({},o,{[t]:n})}),(u||r)&&this._u()){var h={$group_type:t,$group_key:n};r&&(h.$group_set=r),this.capture(Wy,h)}r&&this.setGroupPropertiesForFlags({[t]:r}),u&&!r&&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 r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.wu("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n=Kn(t)?t:t==null?void 0:t.resetDeviceID,r=Kn(t)||t==null?void 0:t.bootstrap;this.xu(n,!1,r)}xu(t,n,r){var a,o,u;if(n===void 0&&(n=!1),ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");var h=r==null?void 0:r.sessionID;this.config.bootstrap=r||((a=this.Gl)==null?void 0:a.bootstrap)||{},(o=this.featureFlags)==null||o.updateConfig==null||o.updateConfig(this.config,this.fo());var f=this.get_property(Yc),p=this.get_property(ym),m=this.get_property(La),x=this.is_capturing();this.consent.reset(),n||!x||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.");var b=(u=this.persistence)==null||u.Va==null?void 0:u.Va(),y=!1;try{var _,j,N,w,E,C,L,O,D,U,I,W,z;if((_=this.persistence)==null||_.clear(),(j=this.sessionPersistence)==null||j.clear(),this.ql.clear(),this.bu(),ue(m)||(U=this.persistence)==null||U.register({[La]:m}),(N=this.surveys)==null||N.reset(),(w=this.featureFlags)==null||w.reset(),(E=this.conversations)==null||E.reset(),(C=this.logs)==null||C.reset(),(L=this.metrics)==null||L.reset(),(O=this.persistence)==null||O.set_property(tt,cn),(D=this.sessionManager)==null||D.resetSessionId(),this.Wl=null,this.config.cookieless_mode===ei)this.register_once({distinct_id:El,$device_id:null},"");else{var q=this.config.get_device_id(as());this.register_once({distinct_id:q,$device_id:t?q:f},""),t||ue(p)||this.register({[ym]:p})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Pl()||((z=this.persistence)==null||z.set_property(tt,r.isIdentifiedID?On:cn),this.register({distinct_id:r.distinctID})),(I=this.featureFlags)==null||I.initialize(),!(ue(h)||(W=this.sessionManager)!=null&&W.setBootstrapSessionId(h,!0)))){var T=de({},r);delete T.sessionID,this.config.bootstrap=T}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,y=!0}finally{var ie;b&&((ie=this.persistence)==null||ie.Ja==null||ie.Ja(y))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Ft((function*(){var r,a,o,u,h,f,p;if(n.__loaded){n.nu().dispose(),(r=n.sessionRecording)==null||r.dispose(),(a=n.logs)==null||a.flushLogs("sendBeacon"),(o=n.metrics)==null||o.flush("sendBeacon"),(u=n.Ql)==null||u.unload(),(h=n.Kl)==null||h.unload();try{var m;(m=n.featureFlags)==null||m.destroy()}catch(x){ye.error("Error while destroying feature flags",x)}(f=n.persistence)==null||f.destroy(),(p=n.sessionPersistence)==null||p.destroy()}else ye.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Cu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)==null||t.Tu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(d2)?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this.ku(Fl,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=de({},this.config);if(nt(t)){var r,a,o,u,h,f,p,m,x,b,y,_;$t(this.config,E_(t));var j=this.Dl();(r=this.persistence)==null||r.update_config(this.config,n,j),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Em(de({},this.config,{persistence:"sessionStorage"}),j,!1);var N,w=this.Vl(this.config.debug);Kn(w)&&(this.config.debug=w),Kn(this.config.debug)&&(this.config.debug?(Pt.DEBUG=!0,ut.ii()&&ut.ni("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:de({},this.config)})):(Pt.DEBUG=!1,ut.ii()&&ut.oi("ph_debug"))),(a=this.featureFlags)==null||a.updateConfig==null||a.updateConfig(this.config,this.fo()),(o=this.exceptionObserver)==null||o.onConfigChange(),(u=this.exceptions)==null||u.onConfigChange(),(h=this.sessionRecording)==null||h.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(p=this.autocapture)==null||p.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((N=this.historyAutocapture)==null||N.startIfEnabledOrStop()),(x=this.exceptionObserver)==null||x.startIfEnabledOrStop(),(b=this.deadClicksAutocapture)==null||b.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.$l(),(_=this.externalIntegrations)==null||_.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&u_(this,Bc,!1)}}_overrideSDKInfo(t,n){Pt.LIB_NAME=t,Pt.LIB_VERSION=n}startSessionRecording(t){var n,r,a,o,u,h=t===!0,f={sampling:h||!(t==null||!t.sampling),linked_flag:h||!(t==null||!t.linked_flag),url_trigger:h||!(t==null||!t.url_trigger),event_trigger:h||!(t==null||!t.event_trigger)};Object.values(f).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),f.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),f.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),f.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),f.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 r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(de({},a,n))}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:jr.Mu}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Pl;return n!==Pl&&(n=Pl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(tt))===On||((n=this.sessionPersistence)==null?void 0:n.get_property(tt))===On}_u(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Wg&&!this._isIdentified()&&Nr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Fl])&&((n=this.persistence)==null||(n=n.props)==null||!n[jh]))}vu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this._u()||this.wu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.wu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}wu(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.Al(),this.ku(jh,!0),!0)}Dl(){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!==Hi)}$l(){var t,n,r,a,o,u=this.Dl();return this.is_capturing()||(r=this.logs)==null||r.Iu(),((t=this.persistence)==null?void 0:t.Ma)!==u&&((a=this.persistence)==null||a.set_disabled(u)),((n=this.sessionPersistence)==null?void 0:n.Ma)!==u&&((o=this.sessionPersistence)==null||o.set_disabled(u)),u&&(this.ql.clear(),this.bu()),u}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==ei){if(this.Pl()){var r,a,o,u,h,f;(r=this.sessionRecording)==null||r.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),(a=this.sessionManager)==null||a.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new k_(this),this.pageViewManager=new d_(this),this.persistence&&(this.sessionPropsManager=new __(this,this.sessionManager,this.persistence));var p,m=(u=(h=this.config.__extensionClasses)==null?void 0:h.sessionRecording)!==null&&u!==void 0?u:(f=jr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;m&&(this.sessionRecording=this.Rl(this.sessionRecording,new m(this)),this.xl&&((p=this.sessionRecording)==null||p.onRemoteConfig==null||p.onRemoteConfig(this.xl)))}var x,b;this.consent.optInOut(!0),this.$l(),this.uu(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Hi&&((x=this.surveys)==null||x.loadIfEnabled()),(ue(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((b=t==null?void 0:t.captureEventName)!==null&&b!==void 0?b:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hu()}else ye.warn(N_)}opt_out_capturing(){if(this.config.cookieless_mode!==ei){var t,n,r=this.config.cookieless_mode===Hi?this.sessionRecording:void 0;r==null||r.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Hi&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===Hi&&(this.register({distinct_id:El,$device_id:null}),this.El(r),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else ye.warn(N_)}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===ei||(this.config.cookieless_mode===Hi?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return Nn?sk(Nn,this.config.custom_blocked_useragents):void 0}hu(){pe&&(pe.visibilityState==="visible"?this.Hl||(this.Hl=!0,this.capture(Hl,{title:pe.title},{send_instantly:!0}),this.zl&&(pe.removeEventListener(eo,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),Lt(pe,eo,this.zl)))}debug(t){t===!1?(te==null||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(te==null||te.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}))}fo(){var t=this.Gl||{};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,r,a,o,u){var h=r in n&&!Ye(n[r]),f=a in n&&!Ye(n[a]);return h?n[r]:!!f&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,ye)}ns(t){var n;if(Ye(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(W3),a=Pe(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a)try{if(o=u(o),Ye(o)){var h="Event '"+t.event+"' was rejected in beforeSend function";return Y3(t.event)?ye.warn(h+". This can cause unexpected behavior."):ye.info(h),null}o.properties&&!Nr(o.properties)||ye.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(p){return ye.error("Error in beforeSend function for event '"+t.event+"':",p),null}for(var f of r)if(o.properties&&Ye(o.properties[f]))return ye.warn("Event '"+t.event+"' had its '"+f+"' 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.ea)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Vl(t){var n=Kn(t)&&!t,r=ut.ii()&&ut.ai("ph_debug")==="true";return!n&&(!!r||t)}}jr.__defaultExtensionClasses={},jr.Mu=(()=>{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]]=V4(e.prototype[t[n]])})(jr,["identify"]);class fk{constructor(t){this.disabled=t===!1;var n=nt(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>r-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Pm="$copy_autocapture",$d=Gt("[AutoCapture]");function $m(e,t){return t.length>e?t.slice(0,e)+"...":t}function KE(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Qi(t));return t}function ZE(e,t){var n,r,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,h=t.elementAttributeIgnoreList,f=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!Qi(e))return{props:{}};for(var m=[e],x=new Set([e]),b=e;b.parentNode&&!Cr(b,"body")&&C2>m.length;)if(N2(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),m.push(y),b=y}else{if(!Qi(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),m.push(b.parentNode),b=b.parentNode}var _,j,N=[],w={},E=!1,C=!1;if(Nt(m,(I=>{var W=tx(I);if(Cr(I,"a")){var z=I.getAttribute("href");E=!!(W&&z&&Dc(z))&&(p?Wi(z):z)}Ue(Ah(I),"ph-no-capture")&&(C=!0),N.push((function(T,ie,Z,Y,P){P===void 0&&(P=!1);var $=T.tagName.toLowerCase(),re={tag_name:$};Ix.indexOf($)>-1&&!Z&&(re.$el_text=$.toLowerCase()==="a"||$.toLowerCase()==="button"?$m(1024,l_(T)):$m(1024,Wc(T)));var ae=Ah(T);ae.length>0&&(re.classes=ae.filter((function(M){return M!==""}))),Nt(T.attributes,(function(M){var me;if((!L2(T)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(Y==null||!Y.includes(M.name))&&!ie&&Dc(M.value)&&(!at(me=M.name)||me.substring(0,10)!=="_ngcontent"&&me.substring(0,7)!=="_nghost")){var be=M.value;M.name==="class"&&(be=Ux(be).join(" ")),re["attr__"+M.name]=$m(1024,M.name==="href"&&P?Wi(be):be)}}));for(var R=1,B=1,X=T;X=KE(X);)R++,X.tagName===T.tagName&&B++;return re.nth_child=R,re.nth_of_type=B,re})(I,o,u,h,p));var q=(function(T){if(!tx(T))return{};var ie={};return Nt(T.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var Y=Z.name.replace("data-ph-capture-attribute-",""),P=Z.value;Y&&P&&Dc(P)&&(ie[Y]=P)}})),ie})(I);Nt(q,((T,ie)=>{({}).hasOwnProperty.call(w,ie)||(w[ie]=T)}))})),C)return{props:{},explicitNoCapture:C};if(u||(N[0].$el_text=Cr(e,"a")||Cr(e,"button")?l_(e):Wc(e)),E){var L,O;N[0].attr__href=E;var D=(L=to(E))==null?void 0:L.host,U=te==null||(O=te.location)==null?void 0:O.host;D&&U&&D!==U&&(_=E)}return{props:$t({$event_type:a.type,$ce_version:1},f?{}:{$elements:N},{$elements_chain:(j=N,Pe(j)?(function(I){return I.map((W=>{var z,q,T="";if(W.tag_name&&(T+=W.tag_name),W.attr_class)for(var ie of(W.attr_class.sort(),W.attr_class))T+="."+ie.replace(/"/g,"");var Z=de({},W.text?{text:W.text}:{},{"nth-child":(z=W.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(q=W.nth_of_type)!==null&&q!==void 0?q:0},W.href?{href:W.href}:{},W.attr_id?{attr_id:W.attr_id}:{},W.attributes),Y={};return rh(Z).sort(((P,$)=>{return(ae=$[0])>(re=P[0])?-1:re>ae?1:0;var re,ae})).forEach((P=>{var $=P[1];return Y[o_(P[0].toString())]=o_($.toString())})),(T+=":")+rh(Y).map((P=>P[0]+'="'+P[1]+'"')).join("")})).join(";")})((function(I){return I.map((W=>{var z,q,T={text:(z=W.$el_text)==null?void 0:z.slice(0,400),tag_name:W.tag_name,href:(q=W.attr__href)==null?void 0:q.slice(0,2048),attr_class:cE(W),attr_id:W.attr__id,nth_child:W.nth_child,nth_of_type:W.nth_of_type,attributes:{}};return rh(W).filter((ie=>ie[0].indexOf("attr__")===0)).forEach((ie=>T.attributes[ie[0]]=ie[1])),T}))})(j)):"")},(n=N[0])!=null&&n.$el_text?{$el_text:(r=N[0])==null?void 0:r.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},w)}}class JE{constructor(t){this.name="autocapture",this.Rs=!1,this.Ps=null,this.As=!1,this.Fs=!1,this.mn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Os=!1,this.Ls=t,this.Ls.refresh(this.mn),this.rageclicks=new fk(this.mn.rageclick),this.Ds=null}setup(t){this.$s(),this.Ns=t;var n=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?n.dispose():(this.qs=n,this.startIfEnabled())}dispose(){var t;this.Os||(this.Os=!0,this.Ns=void 0,(t=this.qs)==null||t.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var t,n;return this.Bs(),this.mn.url_allowlist=(t=this.mn.url_allowlist)==null?void 0:t.map((r=>new RegExp(r))),this.mn.url_ignorelist=(n=this.mn.url_ignorelist)==null?void 0:n.map((r=>new RegExp(r))),this.mn}Hs(){if(this.isBrowserSupported()){if(te&&pe){var t=this.zs=r=>{r=r||(te==null?void 0:te.event);try{this.Us(r)}catch(a){$d.error("Failed to capture event",a)}};if(Lt(pe,"submit",t,{capture:!0}),Lt(pe,"change",t,{capture:!0}),Lt(pe,"click",t,{capture:!0}),this.Bs().capture_copied_text){var n=this.Ws=r=>{r=r||(te==null?void 0:te.event);try{this.Us(r,Pm)}catch(a){$d.error("Failed to capture clipboard event",a)}};Lt(pe,"copy",n,{capture:!0}),Lt(pe,"cut",n,{capture:!0}),Lt(pe,"paste",n,{capture:!0})}}}else $d.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(pe==null||pe.removeEventListener("submit",this.zs,!0),pe==null||pe.removeEventListener("change",this.zs,!0),pe==null||pe.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(pe==null||pe.removeEventListener("copy",this.Ws,!0),pe==null||pe.removeEventListener("cut",this.Ws,!0),pe==null||pe.removeEventListener("paste",this.Ws,!0),this.Ws=void 0),this.Rs=!1}startIfEnabled(){!this.Os&&this.Ns&&this.isEnabled&&!this.Rs&&(this.Hs(),this.Rs=!0)}onRemoteConfig(t){if(!this.Os)if(this.As=!0,t.ok){var n=t.config;n.elementsChainAsString&&(this.Fs=n.elementsChainAsString);var r,a=n.autocapture_opt_out;Kn(a)&&((r=this.Ns)==null||r.kv.set(Lg,a),this.Ps=a),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var n,r=[];return(n=this.Ds)==null||n.forEach((a=>{var o=pe==null?void 0:pe.querySelectorAll(a);o==null||o.forEach((u=>{t===u&&r.push(a)}))})),r}get isEnabled(){var t,n;if(this.Os)return!1;var r=(t=this.Ns)==null?void 0:t.kv.get(Lg),a=this.Ps,o=this.Bs(),u=o.remoteRequestsDisabled&&!this.As;if(sn(a)&&!Kn(r)&&!u)return!1;var h=(n=this.Ps)!==null&&n!==void 0?n:!!r;return!!o.enabled&&!h}Us(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r=Jg(t);j2(r)&&(r=r.parentNode||null);var a,o=this.$s();n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&o.rageclick&&(a=this.rageclicks)!=null&&a.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&M2(r,o.rageclick)&&this.Us(t,"$rageclick");var u=n===Pm,h=u?de({},o,{dom_event_allowlist:void 0}):o;if(r&&(function(w,E,C,L,O,D){var U;if(!te||Hx(w)||C!=null&&C.url_allowlist&&!e_(C.url_allowlist,D)||C!=null&&C.url_ignorelist&&e_(C.url_ignorelist,D))return!1;if(C!=null&&C.dom_event_allowlist){var I=C.dom_event_allowlist;if(I&&!I.some((Z=>E.type===Z)))return!1}var W=R2(w,L),z=W.parentIsUsefulElement,q=W.targetElementList;if(!(function(Z,Y){var P=Y==null?void 0:Y.element_allowlist;if(ue(P))return!0;var $,re=function(R){if(P.some((B=>R.tagName.toLowerCase()===B)))return{v:!0}};for(var ae of Z)if($=re(ae))return $.v;return!1})(q,C)||!ex(q,C==null?void 0:C.css_selector_allowlist)||ex(q,(U=C==null?void 0:C.css_selector_ignorelist)!==null&&U!==void 0?U:rE))return!1;try{var T=te.getComputedStyle(w);if(T&&T.getPropertyValue("cursor")==="pointer"&&E.type==="click")return!0}catch{}var ie=w.tagName.toLowerCase();switch(ie){case"html":return!1;case"form":return(O||["submit"]).indexOf(E.type)>=0;case"input":case"select":case"textarea":return(O||["change","click"]).indexOf(E.type)>=0;default:return z?(O||["click"]).indexOf(E.type)>=0:(O||["click"]).indexOf(E.type)>=0&&(Ix.indexOf(ie)>-1||w.getAttribute("contenteditable")==="true")}})(r,t,h,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var f,p=ZE(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.Fs,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),m=p.props;if(p.explicitNoCapture)return!1;var x=this.getElementSelectors(r);if(x&&x.length>0&&(m.$element_selectors=x),n===Pm){var b=t.type||"clipboard";if(b!=="paste"){var y,_,j=te==null||(y=te.getSelection())==null?void 0:y.toString(),N=E2(j);if(!N)return!1;m.$selected_content=N,m.$clipboard_text_length=(_=j==null?void 0:j.length)!==null&&_!==void 0?_:0}m.$copy_type=b}return(f=this.Ns)==null||f.capture(n,m).catch((w=>$d.error("Failed to capture event",w))),!0}}}isBrowserSupported(){return Un(pe==null?void 0:pe.querySelectorAll)}}class e6{constructor(t){this._instance=t}refresh(t){var n=this._instance.config,r=nt(n.autocapture)?n.autocapture:void 0;t.enabled=!!n.autocapture,t.rageclick=n.rageclick,t.maskAllElementAttributes=n.mask_all_element_attributes,t.maskAllText=n.mask_all_text,t.disableCaptureUrlHashes=n.disable_capture_url_hashes,t.getCurrentUrl=n.get_current_url,t.remoteRequestsDisabled=this._instance.fo(),t.url_allowlist=r==null?void 0:r.url_allowlist,t.url_ignorelist=r==null?void 0:r.url_ignorelist,t.dom_event_allowlist=r==null?void 0:r.dom_event_allowlist,t.element_allowlist=r==null?void 0:r.element_allowlist,t.css_selector_allowlist=r==null?void 0:r.css_selector_allowlist,t.css_selector_ignorelist=r==null?void 0:r.css_selector_ignorelist,t.element_attribute_ignorelist=r==null?void 0:r.element_attribute_ignorelist,t.capture_copied_text=r==null?void 0:r.capture_copied_text}}var gc=Gt("[ExceptionAutocapture]"),A_=()=>{},T_=e=>{var t;if(Un(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function pk(e,t,n){try{if(!(t in e))return A_;var r={next:e[t]},a=n((function(){for(var o=arguments.length,u=new Array(o),h=0;o>h;h++)u[h]=arguments[h];return r.next.apply(this,u)}));return Un(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=a,()=>{if(e[t]!==a)for(var o=e[t],u=T_(o);u;){if(u.next===a)return void(u.next=r.next);u=T_(o=u.next)}else e[t]=r.next}}catch{return A_}}var t6=Gt("[TracingHeaders]"),Sa=Gt("[Web Vitals]"),M_=9e5,R_=["CLS","FCP","INP","LCP"],n6=["INP","LCP"],r6=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Fd="disabled",L_="lazy_loading",xc="awaiting_config",Ud="missing_config";Gt("[SessionRecording]"),Gt("[SessionRecording]");var cx="[SessionRecording]",Ws=Gt(cx),s6=Gt("[Heatmaps]");function Fm(e){return nt(e)&&"clientX"in e&&"clientY"in e&&an(e.clientX)&&an(e.clientY)}var Id=Gt("[Product Tours]"),Um=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Bx))},i6=["$set_once","$set"],bs=Gt("[SiteApps]"),D_="Error while initializing PostHog app with config id ",mk=(e,t)=>e!=null&&e.then?e.then(t):t(e),Dl="SDK is not enabled or survey functionality is not yet loaded",O_="Disabled. Not loading surveys.";class a6{constructor(t,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Eu=!1,this.Ru=[],this.Pu=null,this.Au=null,this.Os=!1,this.Fu=new Set,this.onRemoteConfig=r=>{if(!this.Os&&!this.mn.disableSurveys){if(!r.ok)return kt.warn("Remote config unavailable. Not loading surveys.");var a=r.config.surveys;if(Ye(a))return kt.warn("Flags not loaded yet. Not loading surveys.");this.Ou=Kn(a)?a:a.length>0,kt.info("flags response received, isSurveysEnabled: "+this.Ou),this.loadIfEnabled()}},this.Ls=t,this.Lu=n}setup(t){if(!this.Os)return this.Du=t,mk(t.kv.initialize(),(()=>{if(this.Du===t&&!this.Os){this.Du=void 0,this.Ns=t;var n=t.onRemoteConfig(this.onRemoteConfig);this.Os?n.dispose():(this.qs=n,this.loadIfEnabled())}}))}dispose(){var t,n,r;this.Os||(this.Os=!0,this.Du=void 0,this.Ns=void 0,(t=this.qs)==null||t.dispose(),this.qs=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)==null||r.dispose==null||r.dispose(),this._surveyManager=null,this.Ru=[],this.Pu=null,this.Fu.forEach((a=>clearTimeout(a))),this.Fu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],r=0;r<localStorage.length;r++){var a=localStorage.key(r);(a!=null&&a.startsWith(ck)||a!=null&&a.startsWith("inProgressSurvey_"))&&n.push(a)}n.forEach((o=>localStorage.removeItem(o)))}catch{}}loadIfEnabled(){if(!this.Os&&this.Ns){var t=this.mn;if(!this._surveyManager)if(this.Eu)kt.info("Already initializing surveys, skipping...");else if(t.disableSurveys)kt.info(O_);else if(t.cookielessMode&&this.Ls.isOptedOut())kt.info("Not loading surveys in cookieless mode without consent.");else{var n=this.Ls.getExtensions();if(n){if(!ue(this.Ou)||t.advancedEnableSurveys){var r=this.Ou||t.advancedEnableSurveys;this.Eu=!0;try{var a=n.generateSurveys;if(a)return this.$u(a,r),void(this.Eu=!1);var o=n.loadExternalDependency;if(!o)return this.Nu($x),void(this.Eu=!1);o((u=>{try{if(this.Os)return;var h=this.Ls.getExtensions();u||h==null||!h.generateSurveys?this.Nu("Could not load surveys script",u):this.$u(h.generateSurveys,r)}finally{this.Eu=!1}}))}catch(u){throw this.Eu=!1,this.Nu("Error initializing surveys",u),u}}}else kt.error("PostHog Extensions not found.")}}}$u(t,n){this.Os||(this._surveyManager=t(n),this._surveyEventReceiver=this.Ls.createEventReceiver(),kt.info("Surveys loaded successfully"),this.qu({isLoaded:!0}))}Nu(t,n){kt.error(t,n),this.qu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ru.push(t),this._surveyManager&&this.qu({isLoaded:!0}),()=>{this.Ru=this.Ru.filter((n=>n!==t))}}getSurveys(t,n){var r;n===void 0&&(n=!1);var a=(r=this.Ns)!==null&&r!==void 0?r:this.Lu;if(a&&!this.Os){if(this.mn.disableSurveys)return kt.info(O_),t([]);var o=a.kv.get(Ug);if(o&&!n)return t(o,{isLoaded:!0}),void(this.ju()&&this.getSurveys((()=>{}),!0));if(this.Pu)this.Pu.then((f=>{this.Os||t(f.surveys,f.context)})).catch((f=>kt.error("Error in survey callback",f)));else{var u=this.Bu("/api/surveys/",{method:"GET",query:{token:a.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then((f=>{try{return this.Hu(a,f)}catch(p){return kt.error("Error processing surveys response",p),this.Hu(a,{statusCode:0,error:p})}}),(f=>this.Hu(a,{statusCode:0,error:f})));this.Pu=u;var h=()=>{this.Pu===u&&(this.Pu=null)};u.then((f=>{h(),this.Os||t(f.surveys,f.context)}),h).catch((f=>kt.error("Error in survey callback",f)))}}}Bu(t,n){var r=this.Ns;return r?r.sendRequest(t,n):new Promise((a=>a({statusCode:0,error:new Error(Dl)})))}Hu(t,n){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:Dl}};var r=n.statusCode;if(r!==200||!n.json){var a="Surveys API could not be loaded, status: "+r;return r!==0?kt.error(a):n.error||kt.warn(a),this.Au=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Au=null;var o,u=n.json.surveys||[],h=u.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(ak(f)||(function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(f))));return h.length>0&&((o=this._surveyEventReceiver)==null||o.register(h)),t.kv.set({[Ug]:u,[Sh]:Date.now()}),{surveys:u,context:{isLoaded:!0}}}ju(){return this.zu()&&!this.Pu&&!this.Uu()}zu(){var t,n,r=(t=(n=this.Ns)!==null&&n!==void 0?n:this.Lu)==null?void 0:t.kv.get(Sh);return an(r)&&Date.now()-r>3e5}Uu(){return an(this.Au)&&3e5>Date.now()-this.Au}markSurveyAsSeen(t,n){var r,a={id:t,current_iteration:(r=n==null?void 0:n.iteration)!==null&&r!==void 0?r:null};uk(a);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}qu(t){for(var n of this.Ru)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){kt.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!Ye(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);kt.warn("init was not called")}Wu(t){var n=null;return this.getSurveys((r=>{var a;n=(a=r.find((o=>o.id===t)))!==null&&a!==void 0?a:null})),n}Vu(t){if(Ye(this._surveyManager))return{eligible:!1,reason:Dl};var n=typeof t=="string"?this.Wu(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Gu(t){if(Ye(this._surveyManager))return{eligible:!1,reason:Dl};var n=typeof t=="string"?this.Wu(t):t;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ye(this._surveyManager))return kt.warn("init was not called"),{visible:!1,disabledReason:Dl};var n=this.Gu(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return Ye(this._surveyManager)?(kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Dl})):new Promise((r=>{this.getSurveys((a=>{var o,u=(o=a.find((f=>f.id===t)))!==null&&o!==void 0?o:null;if(u){var h=this.Gu(u);r({visible:h.eligible,disabledReason:h.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(t,n,r){var a;if(Ye(this._surveyManager))kt.warn("init was not called");else{var o=typeof t=="string"?this.Wu(t):t;if(o!=null&&o.id)if(PE.includes(o.type)){var u=pe==null?void 0:pe.querySelector(n);if(u)if((a=o.appearance)!=null&&a.surveyPopupDelaySeconds){kt.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds");var h=setTimeout((()=>{var f,p;this.Fu.delete(h),this.Os||(kt.info("Rendering survey "+o.id+" with delay of "+((f=o.appearance)==null?void 0:f.surveyPopupDelaySeconds)+" seconds"),(p=this._surveyManager)==null||p.renderSurvey(o,u,r),kt.info("Survey "+o.id+" rendered"))}),1e3*o.appearance.surveyPopupDelaySeconds);this.Fu.add(h)}else this._surveyManager.renderSurvey(o,u,r);else kt.warn("Survey element not found")}else kt.warn("Surveys of type "+o.type+" cannot be rendered in the app");else kt.warn("Survey not found")}}displaySurvey(t,n){var r;if(Ye(this._surveyManager))kt.warn("init was not called");else{var a=this.Wu(t);if(a){var o=a;if((r=a.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(o=de({},a,{appearance:de({},a.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==nx.Popover&&n.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var u=this.Vu(a);if(!u.eligible)return void kt.warn("Survey is not eligible to be displayed: ",u.reason)}n.displayType!==nx.Inline?this._surveyManager.handlePopoverSurvey(o,n):this.renderSurvey(o,n.selector,n.properties)}else kt.warn("Survey not found")}}cancelPendingSurvey(t){Ye(this._surveyManager)?kt.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}function Ol(e,t,n){if(Ye(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class l6{constructor(t){this.Zu=new Set,this.Qu=new Set,this.Ju=new Lh,this.Ku=(n,r)=>this.Yu(n,r)&&this.Xu(n,r)&&this.th(n,r)&&this.eh(n,r),this.Yu=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t}init(){var t,n;ue((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ih=(n=this._instance)==null?void 0:n._addCaptureHook(((r,a)=>{this.on(r,a)})))}dispose(){var t;(t=this.ih)==null||t.call(this),this.ih=void 0,this.Ju=new Lh}register(t){var n,r;if(!ue((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((o=>{var u;this.Zu.add(o),(u=o.steps)==null||u.forEach((h=>{this.Qu.add((h==null?void 0:h.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a=new Set;this.Zu.forEach((o=>{var u;(u=o.steps)==null||u.forEach((h=>{h!=null&&h.selector&&a.add(h.selector)}))})),this._instance.autocapture.setElementSelectors(a)}}replace(t){this.Zu.clear(),this.Qu.clear(),this.register(t)}on(t,n){n!=null&&t.length!=0&&(this.Qu.has(t)||this.Qu.has(n.event))&&this.Zu.forEach((r=>{this.rh(n,r)&&this.Ju.emit("actionCaptured",r.name)}))}nh(t){this.onAction("actionCaptured",(n=>t(n)))}rh(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ku(t,r))return!0;return!1}onAction(t,n){return this.Ju.on(t,n)}Xu(t,n){if(n!=null&&n.url){var r,a=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!a||typeof a!="string"||!Ol(a,n.url,n.url_matching||"contains"))return!1}return!0}th(t,n){return!!this.sh(t,n)&&!!this.ah(t,n)&&!!this.oh(t,n)}sh(t,n){var r;if(n==null||!n.href)return!0;var a=this.lh(t);if(a.length>0)return a.some((h=>Ol(h.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!u&&Ol((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}ah(t,n){var r;if(n==null||!n.text)return!0;var a=this.lh(t);if(a.length>0)return a.some((p=>Ol(p.text,n.text,n.text_matching||"exact")||Ol(p.$el_text,n.text,n.text_matching||"exact")));var o,u,h,f=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!f&&(o=(function(p){for(var m,x=[],b=/(?::|")text="(.*?)"/g;!Ye(m=b.exec(p));)x.includes(m[1])||x.push(m[1]);return x})(f),u=n.text,h=n.text_matching||"exact",o.some((p=>Ol(p,u,h))))}oh(t,n){var r,a;if(n==null||!n.selector)return!0;var o=t==null||(r=t.properties)==null?void 0:r.$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}lh(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}eh(t,n){return n==null||!n.properties||n.properties.length===0||ok(n.properties.reduce(((r,a)=>{var o=Pe(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return r[a.key]={values:o,operator:a.operator||"exact"},r}),{}),t==null?void 0:t.properties)}}class o6{constructor(t){var n;this.uh=[],this._instance=t,this.hh=new Map,this.dh=new Map,this.fh=new Map,this.ph=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId((r=>this.gh(r)))}mh(t){return!1}yh(){return null}bh(t){}_h(){}wh(t,n){return!!t&&ok(t.propertyFilters,n==null?void 0:n.properties)}kh(t,n){var r=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 h=r.get(u.name)||[];h.push(a.id),r.set(u.name,h)}}))})),r}Sh(t,n,r){var a=(r===hc.Activation?this.hh:this.dh).get(t),o=[];return this.xh((u=>{o=u.filter((h=>a==null?void 0:a.includes(h.id)))})),o.filter((u=>{var h,f=(h=u.conditions)==null||(h=h[r])==null||(h=h.values)==null?void 0:h.find((p=>p.name===t));return this.wh(f,n)}))}register(t){this.Ch(t,!1)}replace(t){this.Ch(t,!0)}Ch(t,n){var r;ue((r=this._instance)==null?void 0:r._addCaptureHook)||(this.Th(t,n),this.Mh(t,n))}Mh(t,n){var r=t.filter((u=>{var h;return(h=u.conditions)==null||(h=h.actions)==null||(h=h.values)==null?void 0:h.length}));if(n&&this.fh.clear(),r.length!==0){this.Ih||(this.Ih=new l6(this._instance),this.Ih.init(),this.Ih.nh((u=>this.onAction(u))));var a=[];r.forEach((u=>{var h;(h=u.conditions)==null||(h=h.actions)==null||h.values.forEach((f=>{if(a.push(f),f.name){var p,m=(p=this.fh.get(f.name))!==null&&p!==void 0?p:[];m.includes(u.id)||m.push(u.id),this.fh.set(f.name,m)}}))})),n?this.Ih.replace(a):this.Ih.register(a)}else{var o;n&&((o=this.Ih)==null||o.replace([]))}}Eh(t,n){n.forEach(((r,a)=>{var o,u=(o=t.get(a))!==null&&o!==void 0?o:[];r.forEach((h=>{u.includes(h)||u.push(h)})),t.set(a,u)}))}Th(t,n){var r,a,o=t.filter((p=>{var m,x;return((m=p.conditions)==null?void 0:m.events)&&((x=p.conditions)==null||(x=x.events)==null||(x=x.values)==null?void 0:x.length)>0})),u=t.filter((p=>{var m,x;return((m=p.conditions)==null?void 0:m.cancelEvents)&&((x=p.conditions)==null||(x=x.cancelEvents)==null||(x=x.values)==null?void 0:x.length)>0})),h=this.kh(t,hc.Activation),f=this.kh(t,hc.Cancellation);n?(this.hh=h,this.dh=f):(this.Eh(this.hh,h),this.Eh(this.dh,f)),(o.length!==0||u.length!==0)&&((r=this.ih)!==null&&r!==void 0||(this.ih=(a=this._instance)==null?void 0:a._addCaptureHook(((p,m)=>{this.onEvent(p,m)}))))}onEvent(t,n){var r,a,o=this.Rh(),u=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var h=this.Ph(t,u);if(h==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.Ah([u]);if(h==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),this.Fh(u),void this.Oh([u])}if(this.dh.has(t)){var f=this.Sh(t,n,hc.Cancellation);f.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:f.map((m=>m.id))}),this.Ah(f.map((m=>m.id))),f.forEach((m=>this.Lh(m.id))))}if(this.hh.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.hh.get(t)});var p=this.Sh(t,n,hc.Activation);this.Dh(p.map((m=>m.id)))}}onAction(t){this.fh.has(t)&&this.Dh(this.fh.get(t)||[])}Dh(t){var n;if(t.length!==0){var r=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),a=[];for(var o of t)r&&this.mh(o)?this.Fh(o)&&this.$h(o):a.push(o);a.length>0&&(this.uh=[...new Set([...this.uh,...a])]),this.Rh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Fh(t){this.uh=this.uh.filter((r=>r!==t));var n=this.Nh();return!n.includes(t)&&(this.qh([...n,t]),this.jh(),!0)}Ah(t){var n=new Set(t);this.uh=this.uh.filter((o=>!n.has(o)));var r=this.Bh(),a=r.filter((o=>!n.has(o)));a.length!==r.length&&(this.qh(a),a.length===0&&this.Hh()),this.Oh(t)}zh(){var t,n=this.yh();if(!n)return{};var r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r&&typeof r=="object"?r:{}}$h(t){if(this.yh()){var n=this.zh();this.bh(de({},n,{[t]:Date.now()}))}}Oh(t){if(this.yh()){var n=this.zh(),r={},a=!1;for(var o of Object.entries(n)){var u=o[0],h=o[1];t.includes(u)?a=!0:r[u]=h}a&&(Nr(r)?this._h():this.bh(r))}}Uh(){this.yh()&&this._h()}getActivationTimestamp(t){if(this.Nh().includes(t)){var n=this.zh()[t];return an(n)?n:void 0}}Bh(){var t,n=this.Wh();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Nh(){var t,n,r=this.Bh();if(r.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Vh()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?r:[]}jh(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Gh(n)}Hh(){this.Zh()}gh(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Vh()];if(r&&r!==t){var a=this.Bh(),o=this.zh();a.length>0&&(this.qh([]),a.filter((u=>an(o[u]))).forEach((u=>this.Lh(u)))),this.Hh(),this.Uh()}}getActivatedIds(){return[...new Set([...this.Nh(),...this.uh])].filter((t=>!this.Qh(t)))}dispose(){var t,n,r;(t=this.ph)==null||t.call(this),this.ph=void 0,(n=this.ih)==null||n.call(this),this.ih=void 0,(r=this.Ih)==null||r.dispose(),this.Ih=void 0}reset(){this.uh=[],this.Bh().length>0&&this.qh([]),this.Hh(),this.Uh()}getEventToItemsMap(){return this.hh}Jh(){return this.Ih}}class c6 extends o6{constructor(t){super(t)}Wh(){return Ig}Vh(){return th}yh(){return nh}bh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[nh]:t})}_h(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(nh)}mh(t){var n,r;this.xh((o=>{r=o.find((u=>u.id===t))}));var a=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return an(a)&&a>0}Kh(){return ti.SHOWN}xh(t){var n;(n=this._instance)==null||n.getSurveys(t)}Lh(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Rh(){return kt}qh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Ig]:t})}Gh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[th]:t})}Zh(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(th)}Qh(){return!1}Ph(t,n){var r;this.xh((o=>{r=o.find((u=>u.id===n))}));var a=!r||(function(o){var u;return ak(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(r);return a?t===ti.SHOWN?"consume":"ignore":t===ti.SHOWN?"persist":t===ti.DISMISSED||t===ti.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class u6{constructor(t){this._instance=t}initialize(){}get(t){if(typeof t=="string")return this._instance.get_property(t);var n={};for(var r of t){var a=this._instance.get_property(r);ue(a)||(n[r]=a)}return n}set(t,n){this._instance.register(typeof t=="string"?{[t]:n}:t)}remove(t){typeof t!="string"?t.forEach((n=>this._instance.unregister(n))):this._instance.unregister(t)}}class d6{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=Re==null?void 0:Re.__PosthogExtensions__;if(t){var n=t.generateSurveys,r=t.loadExternalDependency;return{generateSurveys:n?a=>n(this._instance,a):void 0,loadExternalDependency:r?a=>r(this._instance,"surveys",a):void 0}}}createEventReceiver(){return new c6(this._instance)}}var h6=te!=null&&te.location?Th(te.location.hash,"__posthog")||Th(location.hash,"state"):null,z_="_postHogToolbarParams",B_=Gt("[Toolbar]"),P_=Gt("[FeatureFlags]");class f6{constructor(t,n){n===void 0&&(n=!1),this.Yh=!1,this.update(t,n)}update(t,n){this.Xh=((r,a)=>{var o,u,h,f,p;return{bootstrap:{featureFlags:(o=r.bootstrap)==null?void 0:o.featureFlags,featureFlagPayloads:(u=r.bootstrap)==null?void 0:u.featureFlagPayloads},remoteRequestsDisabled:a,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(h=r.remote_config_refresh_interval_ms)!==null&&h!==void 0?h:3e5,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?void 0:"best-available",evaluationContexts:(f=(p=r.evaluation_contexts)!==null&&p!==void 0?p:r.evaluation_environments)!==null&&f!==void 0?f:[],flagKeys:Pe(r.flag_keys)?r.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.Yh||(P_.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yh=!0),ue(t.flag_keys)||Pe(t.flag_keys)||P_.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Xh}}var $_=Gt("[FeatureFlags]"),ja=Gt("[FeatureFlags]",{debugEnabled:!0}),Im=`" failed. Feature flags didn't load in time.`,F_="connection_error",U_=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},I_=e=>{var t={};for(var n of rh(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},ss=Gt("[Error tracking]"),ux="webkit-masked-url:",p6=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ux],m6=["__firefox__","__gCrWeb"],H_="Refusing to render web experiment since the viewer is a likely bot",g6={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Dh(t,e),not_regex:(e,t)=>!Dh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Fn{get mn(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Fn.td("retrieved web experiments from the server"),n.ed=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.ed&&(Fn.td("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.ed)==null||u.set(o.feature_flag_key,o));var h=n._instance.getFeatureFlag(o.feature_flag_key);at(h)&&o.variants[h]&&n.rd(o.name,h,o.variants[h].transforms)}else if(o.variants)for(var f in o.variants){var p=o.variants[f];Fn.nd(p,n._instance)&&n.rd(o.name,f,p.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Fn.td(H_);else if(!this.mn.disable_web_experiments){if(Ye(this.ed))return this.ed=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Fn.td("applying feature flags",t),t.forEach((n=>{var r;if(this.ed&&(r=this.ed)!=null&&r.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.ed)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.rd(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Fn.getWindowLocation();if(t!=null&&t.search){var n=no(t==null?void 0:t.search,"__experiment_id"),r=no(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Fn.td("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.sd(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.mn.disable_web_experiments&&!r)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.mn.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}sd(t,n,r){var a=r.filter((o=>o.id===t));a&&a.length>0&&(Fn.td("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.rd(a[0].name,n,a[0].variants[n].transforms))}static nd(t,n){return!Ye(t.conditions)&&Fn.ad(t,n)&&Fn.od(t)}static ad(t,n){var r;if(Ye(t.conditions)||Ye((r=t.conditions)==null?void 0:r.url))return!0;var a=Fn.getWindowLocation();if(a){var o,u,h,f=k2(n,a.href);return(o=t.conditions)==null||!o.url||g6[(u=(h=t.conditions)==null?void 0:h.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,f)}return!1}static getWindowLocation(){return te==null?void 0:te.location}static od(t){var n;if(Ye(t.conditions)||Ye((n=t.conditions)==null?void 0:n.utm))return!0;var r=$2();if(r.utm_source){var a,o,u,h,f,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)==r.utm_campaign,y=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_source)==r.utm_source,_=(f=t.conditions)==null||(f=f.utm)==null||!f.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==r.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)==r.utm_term;return b&&_&&j&&y}return!1}static td(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];ye.info("[WebExperiments] "+t,r)}rd(t,n,r){this._is_bot()?Fn.td(H_):n!=="control"?r.forEach((a=>{if(a.selector){var o;Fn.td("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((h=>{var f=h;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)}))}})):Fn.td("Control variants leave the page unmodified.")}_is_bot(){return Nn&&this._instance?sk(Nn,this.mn.custom_blocked_useragents):void 0}}var qr=Gt("[Conversations]"),Na="Conversations not available yet.";function q_(e,t){var n,r,a,o,u,h,f,p=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,m=(r=e==null?void 0:e.maxBufferSize)!==null&&r!==void 0?r:100,x=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=ue(x)?Math.max(m,2048):Math.max(m,x),y=de({},(function(){var _="",j="";try{var N=Nn==null?void 0:Nn.userAgent;if(N){var w=Zw(N);_=w[0],j=w[1]}}catch{}return(function(E,C){var L=(function(O){if(O)return{}.hasOwnProperty.call(qy,O)?qy[O]:O})(E);return de({},L?{"os.name":L}:{},C?{"os.version":C}:{})})(_,j)})(),e==null?void 0:e.resourceAttributes);return{serviceName:(o=(u=y==null?void 0:y["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&o!==void 0?o:t==null?void 0:t.serviceNameDefault,serviceVersion:(h=y==null?void 0:y["service.version"])!==null&&h!==void 0?h:e==null?void 0:e.serviceVersion,environment:(f=y==null?void 0:y["deployment.environment"])!==null&&f!==void 0?f:e==null?void 0:e.environment,resourceAttributes:y,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:p,maxBufferSize:m,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:x,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var x6=["debug","log","warn","error","info"],V_="console",gk="__posthogHandledLogsRequestError",Hm=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[gk]=!0,n},G_=e=>!!e&&typeof e=="object"&&e[gk]===!0,Yh={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=$_,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.Wt=()=>{var t=this.wd();this._d=0,t&&this.reloadFeatureFlags()},this.kd=()=>{var t,n=this.Sd;ue(n)||this.mn.remoteRequestsDisabled||!pe||pe.visibilityState==="hidden"||Date.now()-((t=this.xd)!==null&&t!==void 0?t:0)<n||(this.reloadFeatureFlags(),this.Cd())},this.Vt=()=>{(pe==null?void 0:pe.visibilityState)==="visible"&&this.kd()},"get"in e?this.Ls=e:(this._instance=e,this.Td=new f6(e.config,e.fo()),this.Ls=this.Td)}updateConfig(e,t){var n;(n=this.Td)==null||n.update(e,t),this.Ns&&this.Md()}setup(e){return this.Du=e,this.A=e.logger.createLogger("[FeatureFlags]"),mk(e.kv.initialize(),(()=>{this.Du===e&&(this.Du=void 0,this.Ns=e,this.Id(e))}))}Id(e){var t;if(this.Ns===e)return te&&Lt(te,"online",this.Wt),this.Md(),this.Ed=e.registerDynamicEventProperties((()=>this.Rd()?this.ud:this.hd)),this.Pd=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.onCrossTabFeatureFlagChange((()=>{this.Ad(),this.Fd()})),this.Ad(),this.initialize()}Md(){var e=this.mn.refreshIntervalMs,t=!this.mn.remoteRequestsDisabled&&pe&&!ue(e)&&e>0?e:void 0;t!==this.Sd&&(this.Od(),ue(t)||(this.Sd=t,this.Cd(),pe!=null&&pe.addEventListener&&Lt(pe,eo,this.Vt)))}Cd(){ue(this.Sd)||(ue(this.Ld)||clearInterval(this.Ld),this.xd=Date.now(),this.Ld=setInterval(this.kd,this.Sd))}Od(){ue(this.Ld)||(clearInterval(this.Ld),this.Ld=void 0,pe==null||pe.removeEventListener==null||pe.removeEventListener(eo,this.Vt)),this.Sd=void 0,this.xd=void 0}destroy(){this.Dd()}dispose(){this.Dd()}Dd(){var e,t;this.Od(),this.pd++,this.md=!1,this.Du=void 0,this.Ns&&(this.$d(),(e=this.Ed)==null||e.dispose(),this.Ed=void 0,(t=this.Pd)==null||t.call(this),this.Pd=void 0,this.dd=[],te==null||te.removeEventListener("online",this.Wt),this.Ns=void 0)}get mn(){return this.Ls.get()}Nd(e){var t;return(t=this.Ns)==null?void 0:t.kv.get(e)}ni(e){this.qd((()=>{var t;return(t=this.Ns)==null?void 0:t.kv.set(e)}))}jd(e,t,n){var r;if((r=this._instance)!=null&&r.persistence&&e[Xn]){var a=this.Nd(Xn)||{},o=e[Xn]||{},u=t.flags||t.featureFlags,h=t.flags?Object.entries(t.flags).filter((w=>{var E=w[1];return!(E!=null&&E.failed)})).map((w=>w[0])):[],f=!!t.errorsWhileComputingFlags&&!!t.flags,p=f?h:n&&!Pe(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(o)])),m=this.Nd(is)||{},x=e[is]||{},b=f||n?p:Array.from(new Set([...Object.keys(m),...Object.keys(x)])),y=!f&&!n,_=!!y||p,j={[Yr]:_,[Xn]:_,[is]:!!y||b};for(var N of(e[qi]&&(j[qi]=_),[Vi,ri,Wl]))ue(e[N])||(j[N]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(j)}}oi(e){this.qd((()=>{var t;return(t=this.Ns)==null?void 0:t.kv.remove(e)}))}qd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Ad(){var e={};for(var t of[Yr,is,Vi,_s]){var n=this.Nd(t);ue(n)||(e[t]=n)}this.ud=e;var r=de({},e),a=this.Nd(Xn);if(a)for(var o of Object.entries(a))r["$feature/"+o[0]]=o[1];this.hd=r}Rd(){var e=this.mn.cacheTtlMs;if(!e||0>=e)return!1;var t=this.Nd(ri);return typeof t!="number"||Date.now()-t>e}Bd(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Hd(){var e=this.mn.evaluationContexts;return e!=null&&e.length?e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n})):[]}zd(){var e=this.mn.flagKeys;if(!ue(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n}))}initialize(){var e,t,n=this.mn,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},h=Object.keys(r).filter((p=>!ue(r[p]))).reduce(((p,m)=>(p[m]=r[m],p)),{}),f=Object.keys(u).filter((p=>h[p])).reduce(((p,m)=>(p[m]=u[m],p)),{});return this.Ud({featureFlags:h,featureFlagPayloads:f})}}updateFlags(e,t,n){var r,a,o=n!=null&&n.merge&&(r=this.Nd(Xn))!==null&&r!==void 0?r:{},u=n!=null&&n.merge&&(a=this.Nd(is))!==null&&a!==void 0?a:{},h=de({},o,e),f=de({},u,t),p={};for(var m of Object.entries(h)){var x=m[0],b=m[1];p[x]={key:x,enabled:$y(b),variant:Fy(b),reason:void 0,metadata:ue(f==null?void 0:f[x])?void 0:{id:0,version:void 0,description:void 0,payload:f[x]}}}this.Ud({flags:p})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Nd(qi),t=this.Nd(_s),n=this.Nd(Ta);if(!n&&!t)return e||{};var r=$t({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,h,f=r[o],p=t==null?void 0:t[o],m=ue(p)?(u=f==null?void 0:f.enabled)!==null&&u!==void 0&&u:!!p,x=ue(p)?f==null?void 0:f.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=de({},f,{enabled:m,variant:m?x??(f==null?void 0:f.variant):void 0});m!==(f==null?void 0:f.enabled)&&(y.original_enabled=f==null?void 0:f.enabled),x!==(f==null?void 0:f.variant)&&(y.original_variant=f==null?void 0:f.variant),b&&(y.metadata=de({},f==null?void 0:f.metadata,{payload:b,original_payload:f==null||(h=f.metadata)==null?void 0:h.payload})),r[o]=y}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ld=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:$y(r),variant:Fy(r),payload:Py(t[n])}}))}getFlagVariants(){var e=this.Nd(Xn),t=this.Nd(_s);if(!t)return e||{};for(var n=$t({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){var e=this.Nd(is),t=this.Nd(Ta);if(!t)return e||{};for(var n=$t({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.gd||this.mn.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Wd||(this.dd.slice().forEach((e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Wd=setTimeout((()=>{this.Vd()}),5)))}$d(){clearTimeout(this.Wd),this.Wd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter((t=>t!==e))}}ensureFlagsLoaded(){this.vd||this.fd||this.Wd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.oi(Js)}Vd(e){this.$d();var t=this.Ns;if(t&&!this.mn.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:de({},t.initialPersonProperties,this.Nd(kr)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Nd(Ss),timezone:V2()};ue(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.mn.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.Hd();r.length&&(n.evaluation_contexts=r);var a=this.zd();ue(a)||(n.flag_keys=a);var o=this.mn.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),h=this.pd;this.fd=!0;var f=()=>{this.md&&(this.md=!1,this.Vd())},p=m=>{this.fd=!1,h===this.pd&&(this.ni({[Ql]:[F_]}),this.A.error("Feature flag request failed",m)),f()};try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then((m=>{var x,b,y=(x=m.json)!==null&&x!==void 0?x:{},_=m.statusCode!==200;if(this.fd=!1,h===this.pd){if(this.Gd(m.statusCode),_||this.md||(this.$anon_distinct_id=void 0),!n.disable_flags||this.md){this.yd=!_;var j=[];m.error?j.push(m.error instanceof Error&&m.error.name==="AbortError"?"timeout":m.error instanceof Error?F_:"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.ni({[Ql]:j}),N?this.A.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.Ud(y,_,{partialResponse:o}),f()}}else f()})).catch(p)}catch(m){p(m)}}}wd(){return B2(this._d,3)}Gd(e){this._d=P2(e,this._d,3,(()=>this.A.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.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Bd()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+e+Im)}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.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Bd()){var n,r=this.getFlagVariants(),a=e in r,o=r[e],u=this.getFlagPayloads()[e],h=String(o),f=this.Nd(Vi)||void 0,p=this.Nd(ri)||void 0,m=this.Nd(Js)||{};if(this.mn.deduplicateCallsPerSession){var x,b=(x=this.Ns)==null?void 0:x.session.sessionId,y=this.Nd(Cc);b&&b!==y&&(m={},n=b)}if(t.send_event||!("send_event"in t))if(e in m&&m[e].includes(h))n&&this.ni({[Js]:m,[Cc]:n});else{var _,j,N,w,E,C,L,O,D,U,I,W;Pe(m[e])?m[e].push(h):m[e]=[h],this.ni(de({[Js]:m},n?{[Cc]:n}:{}));var z=this.getFeatureFlagDetails(e),q=[...(_=this.Nd(Ql))!==null&&_!==void 0?_:[]];ue(o)&&q.push("flag_missing");var T={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:u??null,$feature_flag_request_id:f,$feature_flag_evaluated_at:p,$feature_flag_bootstrapped_response:(j=(N=this.mn.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[e])!==null&&j!==void 0?j:null,$feature_flag_bootstrapped_payload:(w=(E=this.mn.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])!==null&&w!==void 0?w:null,$used_bootstrap_value:!this.yd};ue(z==null||(C=z.metadata)==null?void 0:C.has_experiment)||(T.$feature_flag_has_experiment=z.metadata.has_experiment),ue(z==null||(L=z.metadata)==null?void 0:L.version)||(T.$feature_flag_version=z.metadata.version);var ie,Z=(O=z==null||(D=z.reason)==null?void 0:D.description)!==null&&O!==void 0?O:z==null||(U=z.reason)==null?void 0:U.code;Z&&(T.$feature_flag_reason=Z),z!=null&&(I=z.metadata)!=null&&I.id&&(T.$feature_flag_id=z.metadata.id),ue(z==null?void 0:z.original_variant)&&ue(z==null?void 0:z.original_enabled)||(T.$feature_flag_original_response=ue(z.original_variant)?z.original_enabled:z.original_variant),z!=null&&(W=z.metadata)!=null&&W.original_payload&&(T.$feature_flag_original_payload=z==null||(ie=z.metadata)==null?void 0:ie.original_payload),q.length&&(T.$feature_flag_error=q.join(",")),this.Zd(T)}else n&&this.ni({[Js]:m,[Cc]:n});if(a)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:Py(u)}}}else this.A.warn('getFeatureFlagResult for key "'+e+Im)}Zd(e){try{var t;(t=this.Ns)==null||t.capture("$feature_flag_called",e).catch((n=>{this.A.error("Failed to capture feature flag call",n)}))}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Qd(e,t)}Qd(e,t){var n=this;return Ft((function*(){var r=n.Ns;if(r){var a={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},o=n.Hd();o.length&&(a.evaluation_contexts=o);var u,h=n.zd();ue(h)||(a.flag_keys=h);try{var f,p=(f=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.mn.compression,sentAt:"body",timeoutMs:n.mn.requestTimeoutMs})).json)==null?void 0:f.featureFlagPayloads;u=(p==null?void 0:p[e])||void 0}catch(m){return void n.A.error("Remote config feature flag request failed",m)}try{t(u)}catch(m){n.A.error("Remote config feature flag callback failed",m)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+Im),t.defaultValue;var n=this.getFeatureFlag(e,t);return ue(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.Ud(e,t,n)}Ud(e,t,n){if(this.Ns){this.vd=!0;var r=(function(a,o,u,h,f,p){o===void 0&&(o={}),u===void 0&&(u={}),h===void 0&&(h={}),p===void 0&&(p=$_);var m=((W,z)=>{var q=W.flags;return q?de({},W,{featureFlags:Object.fromEntries(Object.keys(q).map((T=>{var ie;return[T,(ie=q[T].variant)!==null&&ie!==void 0?ie:q[T].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(q).filter((T=>q[T].enabled)).filter((T=>{var ie;return!ue((ie=q[T].metadata)==null?void 0:ie.payload)})).map((T=>{var ie;return[T,(ie=q[T].metadata)==null?void 0:ie.payload]})))}):(W.featureFlags&&z.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),W)})(a,p),x=m.flags,b=m.featureFlags,y=m.featureFlagPayloads;if(b){var _=a.requestId,j=a.evaluatedAt;if(Pe(b)){p.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var N={};if(b)for(var w=0;b.length>w;w++)N[b[w]]=!0;return{[Yr]:b,[Xn]:N,[Wl]:!1}}var E=b,C=y,L=x;if(f!=null&&f.partialResponse){var O=Object.keys(E),D=C||{};E=de({},o,E),C=de({},u,D),O.forEach((W=>{var z;W in D||(z=C)==null||delete z[W]})),L=de({},h,L)}else if(a.errorsWhileComputingFlags)if(x){var U=new Set(Object.keys(x).filter((W=>{var z;return!((z=x[W])!=null&&z.failed)})));E=de({},o,Object.fromEntries(Object.entries(E).filter((W=>U.has(W[0])))));var I=Object.fromEntries(Object.entries(C||{}).filter((W=>U.has(W[0]))));C=de({},u,I),U.forEach((W=>{var z;W in I||(z=C)==null||delete z[W]})),L=de({},h,Object.fromEntries(Object.entries(L||{}).filter((W=>U.has(W[0])))))}else E=de({},o,E),C=de({},u,C),L=de({},h,L);return de({[Yr]:Object.keys(I_(E)),[Xn]:E||{},[is]:C||{},[qi]:L||{},[Wl]:a.minimalFlagCalledEvents===!0},_?{[Vi]:_}:{},j?{[ri]:j}:{})}})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);r&&(this.jd(r,e,!(n==null||!n.partialResponse)),this.ni(r)),t||(this.bd=!1),this.Fd(t)}}override(e,t){t===void 0&&(t=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Jd(e)}Jd(e){if(this.Ns){if(e===!1)return this.oi([_s,Ta]),this.Fd(),void ja.info("All overrides cleared");if(Pe(e))return this.ni({[_s]:U_(e)}),this.Fd(),void ja.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.ld=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var r={},a=n.flags,o=n.payloads;return a&&(r[_s]=Pe(a)?U_(a):a),o&&(r[Ta]=o),Object.keys(r).length&&this.ni(r),a===!1&&o===!1?this.oi([_s,Ta]):a===!1?this.oi(_s):o===!1&&this.oi(Ta),this.Fd(),a===!1?ja.info("Flag overrides cleared"):a&&ja.info("Flag overrides set",{flags:a}),void(o===!1?ja.info("Payload overrides cleared"):o&&ja.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.ni({[_s]:e}),this.Fd(),void ja.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){var t=this.Kd(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(a){this.A.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,a=(this.Nd(eh)||[]).find((p=>p.flagKey===e)),o={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);var h=de({},this.getFlagVariants(),{[e]:t});(r=this._instance)==null||(r=r.persistence)==null||r.markCrossTabFeatureFlagChanges({[Yr]:[e],[Xn]:[e],[kr]:Object.keys(o)}),this.ni({[Yr]:Object.keys(I_(h)),[Xn]:h,[kr]:de({},this.Nd(kr)||{},o)}),this.Fd();try{var f;(f=this.Ns)==null||f.capture("$feature_enrollment_update",u).catch((p=>{this.A.error("Failed to capture early access feature enrollment",p)}))}catch(p){this.A.error("Failed to capture early access feature enrollment",p)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Nd(eh);!r||t?this.Yd(e,n):e(r)}Yd(e,t){var n=this;return Ft((function*(){var r=n.Ns;if(r){var a,o=t?"&"+t.map((h=>"stage="+h)).join("&"):"";try{var u=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+o,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;n.ni({[eh]:a=u.json.earlyAccessFeatures})}catch(h){return void n.A.error("Early access feature request failed",h)}try{e(a)}catch(h){n.A.error("Early access feature callback failed",h)}}}))()}Kd(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}Fd(e){this.Ad();var t=this.Kd(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,r,{errorsLoading:e})}catch(o){this.A.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Xd(e,t)}Xd(e,t){t===void 0&&(t=!0);var n=this.Nd(kr)||{},r=(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.ni({[kr]:de({},n,o,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=de({},this.Nd(kr)||{});e.forEach((r=>{delete n[r]})),this.ni({[kr]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.oi(kr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Nd(Ss)||{},r=de({},n);for(var a of Object.keys(e))r[a]=de({},n[a],e[a]);this.ni({[Ss]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Nd(Ss)||{};this.ni({[Ss]:de({},t,{[e]:{}})})}else this.oi(Ss)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.$d(),this.ld=!1,this._d=0}}},v6={sessionRecording:class{get mn(){return this._instance.config}get Bo(){return this._instance.persistence}get started(){var e;return!((e=this.tv)==null||!e.isStarted)}get status(){var e,t;return this.ev===xc||this.ev===Ud?this.ev:(e=(t=this.tv)==null?void 0:t.status)!==null&&e!==void 0?e:this.ev}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ev=Fd,this.iv=void 0,this.rv=!1,this.jt=(()=>{var t;if(pe==null||!pe.visibilityState||pe.visibilityState==="visible")return!0;var n=te==null||(t=te.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((r=>r.name==="visible"))})(),this.Vt=()=>{var t;(pe==null?void 0:pe.visibilityState)==="visible"&&(this.jt=!0,(t=this.tv)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Ws.error("started without valid sessionManager"),new Error(cx+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===ei)throw new Error(cx+' cannot be used with cookieless_mode="always"');pe!=null&&pe.addEventListener&&Lt(pe,"visibilitychange",this.Vt)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(e===void 0?{}:e).discardBufferedEvents,n=t!==void 0&&t;this.rv=!0,pe==null||pe.removeEventListener==null||pe.removeEventListener("visibilitychange",this.Vt),n?this.nv(!0):this.stopRecording()}get sv(){var e,t=!((e=this._instance.get_property(La))==null||!e.enabled),n=!this.mn.disable_session_recording,r=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return te&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.rv||this.sv&&(t=this.tv)!=null&&t.isStarted)){var n=!ue(Object.assign)&&!ue(Array.from);this.sv&&n?(this.av(e),Ws.info("starting")):(this.ev=Fd,this.stopRecording())}}av(e){var t,n;if(this.sv)if(this.ev!==xc&&this.ev!==Ud&&(this.ev=L_),Re!=null&&(t=Re.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Re.__PosthogExtensions__)!=null&&n.initSessionRecording)this.ov(e);else{var r,a=this._instance.sessionManager;(r=Re.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.lv,(o=>{if(!this.rv&&this.sv&&this._instance.sessionManager===a)return o?(this._instance.register_for_session({[Yg]:!0}),Ws.error("could not load recorder",o)):void this.ov(e);this.ev=Fd}))}}stopRecording(){var e,t;(e=this.iv)==null||e.call(this),this.iv=void 0,(t=this.tv)==null||t.stop()}nv(e){var t,n;e===void 0&&(e=!1),(t=this.iv)==null||t.call(this),this.iv=void 0,(n=this.tv)==null||n.discard({discardProducerEvents:e})}uv(){var e,t;(e=this.Bo)==null||e.unregister(Px),(t=this.Bo)==null||t.unregister(h2)}hv(e,t){if(Ye(e))return null;var n,r=an(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Ws.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}dv(e){if(this.Bo){var t,n,r=this.Bo,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,h=this.hv((o=this.mn.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),f=this.hv(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=h??f;Ye(p)&&this.uv();var m=u==null?void 0:u.minimumDurationMilliseconds;r.register({[La]:de({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:de({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:ue(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.iv)==null||t.call(this),this.iv=(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.dv(t),void this.nv()):(this.dv(t),void this.startIfEnabledOrStop()):(this.ev===xc&&(this.ev=Ud,Ws.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.tv)!=null&&n.log?this.tv.log(e,t):Ws.warn("log called before recorder was ready")}get lv(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(La);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}vv(){var e,t=this._instance.get_property(La);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Ws.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ye(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}ov(e){var t,n,r;if(!this.rv&&this.sv&&this._instance.sessionManager){if((t=Re.__PosthogExtensions__)==null||!t.initSessionRecording)return Ws.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Yg]:!0});var a;if(this.tv||(this.tv=(a=Re.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.jt),this.tv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.vv())return this.ev===Ud||this.ev===xc?void 0:(this.ev=xc,Ws.info("persisted remote config is stale, requesting fresh config before starting"),void new G2(this._instance).load());this.ev=L_,(n=(r=this.tv).setDocumentWasEverVisible)==null||n.call(r,this.jt),this.tv.start(e)}else this.ev=Fd}onRRwebEmit(e){var t;(t=this.tv)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.tv||(t=this.Bo)==null||t.register({[p2]:!0}),(e=this.tv)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.tv||(t=this.Bo)==null||t.register({[f2]:!0}),(e=this.tv)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.tv||(n=this.Bo)==null||n.register({[e==="url"?m2:g2]:!0}),(t=this.tv)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.tv)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.tv)==null||!n.tryAddCustomEvent(e,t))}}},b6={autocapture:class extends JE{constructor(e){super(new e6(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.fv=this.pv()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.gv();return!!(e.path||e.search||this.mv(e))}startIfEnabled(){this.isEnabled&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.fv=this.pv(),this.startIfEnabled()}stop(){this.yv&&this.yv(),this.yv=void 0,this.bv&&this.bv(),this.bv=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this._v("pushState"),this._v("replaceState"),this.wv(),this.mv()&&this.Sv())}_v(e){var t;if(te&&((t=te.history[e])==null||!t.__posthog_wrapped__)){var n=this;pk(te.history,e,(r=>function(a,o,u){r.call(this,a,o,u),n.xv(e)}))}}pv(){var e=te==null?void 0:te.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}gv(){var e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:nt(e)?e:{}}mv(e){return e===void 0&&(e=this.gv()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}Cv(e){var t=this.gv(),n=this.fv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.mv(t)&&e.hash!==n.hash))}xv(e){try{var t=this.pv();if(!t)return;this.Cv(t)&&this._instance.capture(Hl,{navigation_type:e}),this.fv=t}catch(n){ye.error("Error capturing "+e+" pageview",n)}}wv(){if(!this.yv){var e=()=>{this.xv("popstate")};Lt(te,"popstate",e),this.yv=()=>{te&&te.removeEventListener("popstate",e)}}}Sv(){if(!this.bv){var e=()=>{this.xv("hashchange")};Lt(te,"hashchange",e),this.bv=()=>{te&&te.removeEventListener("hashchange",e)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(e){var t;this.Tv=!1,this.Rs=!1,this.Mv=null,this.instance=e,this.Tv=!((t=this.instance.persistence)==null||!t.props[Dg]),this.rageclicks=new fk(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return nt(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(e=this.mn.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ye(this.mn.capture_heatmaps)?Ye(this.mn.enable_heatmaps)?this.Tv:this.mn.enable_heatmaps:this.mn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;s6.info("starting..."),this.Iv(),this.Vt()}else{var e;clearInterval((e=this.Mv)!==null&&e!==void 0?e:void 0),this.Ev(),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({[Dg]:n}),this.Tv=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.Pt;return this.Pt=void 0,e}Rv(e){Fm(e.originalEvent)&&this.Xi(e.originalEvent,"deadclick")}Vt(){this.Mv&&clearInterval(this.Mv),this.Mv=(pe==null?void 0:pe.visibilityState)==="visible"?setInterval(this.Po.bind(this),this.flushIntervalMilliseconds):null}Iv(){te&&pe&&(this.Pv=this.Po.bind(this),Lt(te,Nh,this.Pv),this.Av=e=>this.Xi(e||(te==null?void 0:te.event)),Lt(pe,"click",this.Av,{capture:!0}),this.Fv=e=>this.Ov(e||(te==null?void 0:te.event)),Lt(pe,"mousemove",this.Fv,{capture:!0}),this.Lv=new c_(this.instance,uE,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Dv=this.Vt.bind(this),Lt(pe,eo,this.Dv),this.Rs=!0)}Ev(){var e;te&&pe&&(this.Pv&&te.removeEventListener(Nh,this.Pv),this.Av&&pe.removeEventListener("click",this.Av,{capture:!0}),this.Fv&&pe.removeEventListener("mousemove",this.Fv,{capture:!0}),this.Dv&&pe.removeEventListener(eo,this.Dv),clearTimeout(this.$v),(e=this.Lv)==null||e.stop(),this.Rs=!1)}Nv(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,h,f){for(var p=u;p&&Qi(p)&&!Cr(p,"body");){if(p===f)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:te)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(Ue(h,m))return!0;p=A2(p)}return!1})(Jg(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Xi(e,t){var n;if(t===void 0&&(t="click"),!Jy(e.target)&&Fm(e)){var r=this.Nv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&M2(Jg(e),this.instance.config.rageclick)&&this.ks(de({},r,{type:"rageclick"})),this.ks(r)}}Ov(e){!Jy(e.target)&&Fm(e)&&(clearTimeout(this.$v),this.$v=setTimeout((()=>{this.ks(this.Nv(e,"mousemove"))}),500))}ks(e){if(te){var t=this.mn.disable_capture_url_hashes?Wi(te.location.href):te.location.href,n=this.mn.custom_personal_data_properties,r=this.mn.mask_personal_data_properties?[...ro,...n||[]]:[],a=Qc(t,r,Xc);this.Pt=this.Pt||{},this.Pt[a]||(this.Pt[a]=[]),this.Pt[a].push(e)}}Po(){this.Pt&&!Nr(this.Pt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:c_,webVitalsAutocapture:class{constructor(e){var t;this.Tv=!1,this.Rs=!1,this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.qv=()=>{clearTimeout(this.jv),this.jv=void 0,this.Pt.metrics.length!==0&&(this._instance.capture("$web_vitals",de({$current_url:this.Pt.url},this.Pt.metrics.reduce(((n,r)=>de({},n,{["$web_vitals_"+r.name+"_event"]:de({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{}))),this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Bv=n=>{var r;if(this.Pt=this.Pt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ye(n==null?void 0:n.name)||Ye(n==null?void 0:n.value))Sa.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.Hv(a);if(!ue(o)){var u=an(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+o;if(!this.zv||this.zv>n.value){this.Pt.navigationKey!==u&&(this.qv(),this.jv=setTimeout(this.qv,this.flushToCaptureTimeoutMs)),ue(this.Pt.navigationKey)&&(this.Pt.navigationKey=u,this.Pt.url=o),this.Pt.firstMetricTimestamp=ue(this.Pt.firstMetricTimestamp)?Date.now():this.Pt.firstMetricTimestamp;var h=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),f=de({},n,a?{navigationURL:o}:{},{$current_url:o,timestamp:Date.now()});if(delete f.entries,nt(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){var p={};for(var m of r6){var x=m==="url"&&typeof n.attribution[m]=="string"?this.Hv(n.attribution[m]):n.attribution[m];ue(x)||(p[m]=x)}f.attribution=p}else delete f.attribution;ue(h)||(f.$session_id=h.sessionId,f.$window_id=h.windowId),this.Pt.metrics.push(f),this.Pt.metrics.length===this.allowedMetrics.length&&this.qv()}else Sa.error("Ignoring metric with value >= "+this.zv,n)}}},this.Uv=()=>{if(!this.Rs){var n,r,a,o,u=!1,h=Re.__PosthogExtensions__,f=h==null?void 0:h.postHogWebVitalsCallbacksByFlavor,p=(f==null?void 0:f[this.Wv])||(this.Wv==="web-vitals"&&ue(f)?h==null?void 0:h.postHogWebVitalsCallbacks:void 0);if(!ue(p)){var m=p.withoutAttribution,x=this.attributionMetrics;u=!ue(m),n=x.indexOf("LCP")>-1?p.onLCP:(m==null?void 0:m.onLCP)||p.onLCP,r=x.indexOf("CLS")>-1?p.onCLS:(m==null?void 0:m.onCLS)||p.onCLS,a=x.indexOf("FCP")>-1?p.onFCP:(m==null?void 0:m.onFCP)||p.onFCP,o=x.indexOf("INP")>-1?p.onINP:(m==null?void 0:m.onINP)||p.onINP}if(n&&r&&a&&o){var b={reportSoftNavs:this.useSoftNavs},y=u&&this.attributionMetrics.indexOf("INP")>-1?de({},b,{includeProcessedEventEntries:!1}):b;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Bv.bind(this),b),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Bv.bind(this),b),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Bv.bind(this),b),this.allowedMetrics.indexOf("INP")>-1&&o(this.Bv.bind(this),y),this.Rs=!0}else Sa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Tv=!((t=this._instance.persistence)==null||!t.props[Pg]),this.startIfEnabled()}get Vv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=nt(this.Vv)?(e=this.Vv)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Ye(n)?((t=this._instance.persistence)==null?void 0:t.props[Fg])||R_:n}get flushToCaptureTimeoutMs(){return(nt(this.Vv)?this.Vv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=nt(this.Vv)?this.Vv.web_vitals_attribution:void 0;return Kn(e)?e?R_:[]:Pe(e)?e:n6}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=nt(this.Vv)?this.Vv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get zv(){var e=nt(this.Vv)&&an(this.Vv.__web_vitals_max_value)?this.Vv.__web_vitals_max_value:M_;return e>0&&6e4>=e?M_:e}get isEnabled(){var e=Zt==null?void 0:Zt.protocol;if(e!=="http:"&&e!=="https:")return Sa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=nt(this.Vv)?this.Vv.web_vitals:Kn(this.Vv)?this.Vv:void 0;return Kn(t)?t:this.Tv}startIfEnabled(){this.isEnabled&&!this.Rs&&(Sa.info("enabled, starting..."),this.Ys(this.Uv))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=nt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=nt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Pg]:n}),this._instance.persistence.register({[Fg]:r})),this.Tv=n,this.startIfEnabled()}}}get Wv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ys(e){var t=Re.__PosthogExtensions__,n=this.Wv,r=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&ue(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?Sa.error("failed to load script",a):e()}))}Hv(e){var t=e||(te==null?void 0:te.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?Wi(t):t,r=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...ro,...r||[]]:[];return Qc(n,a,Xc)}Sa.error("Could not determine current URL")}}},y6={exceptionObserver:class{constructor(e){var t;this.Uv=()=>{var n;if(te&&this.isEnabled&&(n=Re.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Re.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Re.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Re.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gv&&this.mn.capture_unhandled_errors&&(this.Gv=r(this.captureException.bind(this))),!this.Zv&&this.mn.capture_unhandled_rejections&&(this.Zv=a(this.captureException.bind(this))),!this.Qv&&this.mn.capture_console_errors&&(this.Qv=o(this.captureException.bind(this)))}catch(u){gc.error("failed to start",u),this.Jv()}}},this._instance=e,this.Kv=!((t=this._instance.persistence)==null||!t.props[Og]),this.pe=new K3(de({},(function(n){var r,a,o,u;return n===void 0&&(n={}),{refillRate:(r=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r: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,A:gc})),this.mn=this.Yv(),this.startIfEnabledOrStop()}Yv(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return nt(e)?t=de({},t,e):(ue(e)?this.Kv:e)&&(t=de({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gc.info("enabled"),this.Jv(),this.Ys(this.Uv)):this.Jv()}Ys(e){var t,n;(t=Re.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return gc.error("failed to load script",r);e()}))}Jv(){var e,t,n;(e=this.Gv)==null||e.call(this),this.Gv=void 0,(t=this.Zv)==null||t.call(this),this.Zv=void 0,(n=this.Qv)==null||n.call(this),this.Qv=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Kv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Og]:this.Kv}),this.mn=this.Yv(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.Yv()}captureException(e){var t,n,r,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.pe.consumeRateLimit(a)?gc.info("Skipping exception capture because of client rate limiting.",{exception:a}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.Xv=[],this.tc=new f4([new _4,new T4,new k4,new w4,new E4,new C4,new j4,new A4],(function(r){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(h,f){f===void 0&&(f=0);for(var p=[],m=h.split(`
|
|
68
|
-
`),x=f;m.length>x;x++){var b=m[x];if(1024>=b.length){var y=By.test(b)?b.replace(By,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,r);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(N){if(!N.length)return[];var w=Array.from(N);return w.reverse(),w.slice(0,50).map((E=>{return de({},E,{filename:E.filename||(C=w,C[C.length-1]||{}).filename,function:E.function||Jl});var C}))})(p)}})("web:javascript",x4,y4)),this._instance=e,this.Xv=(t=(n=this._instance.persistence)==null?void 0:n.get_property(zg))!==null&&t!==void 0?t:[],this.ec=_h(this.ic()),this.rc=new R4(this.ec)}onConfigChange(){this.ec=_h(this.ic()),this.rc.setConfig(this.ec)}onRemoteConfig(e){var t,n,r;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=(r=a.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Xv=o,this._instance.persistence&&this._instance.persistence.register({[zg]:this.Xv,[Bg]:u})}}}get nc(){var e,t=!!this._instance.get_property(Bg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.tc.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ec.enabled)try{if(!at(e)||e.trim().length===0)return void ss.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(((h,f)=>M4.has(f)?(u.push(f),h):(h[f]=o[f],h)),{}),droppedKeys:u}})(this.sc(t)),r=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&ss.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.rc.add(de({[bh]:e,[yh]:new Date().toISOString()},r))}catch(o){ss.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.ac(t)){if(this.oc(t))return this.lc("Exception dropped: matched a suppression rule"),void ss.info("Skipping exception capture because a suppression rule matched");if(!this.nc&&this.uc(t))return this.lc("Exception dropped: thrown by a browser extension"),void ss.info("Skipping exception capture because it was thrown by an extension");if(!this.nc&&this.hc(t))return this.lc("Exception dropped: thrown by an injected browser script"),void ss.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.dc(t))return this.lc("Exception dropped: thrown by the PostHog SDK"),void ss.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ec.enabled&&Ye(e.$exception_steps)?this.vc(e):e,r=typeof(o=globalThis._posthogReleaseId)=="string"&&o.length>0?o:void 0;r&&(n.$release_id=r);try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",gu:!0});return a&&this.rc.clear(),a}catch(u){return ss.error("Failed to capture exception event. Dropping this exception.",u),void this.rc.clear()}}catch(u){return void ss.error("Failed to process exception event. Ignoring this exception.",u)}var o}vc(e){try{var t=this.rc.getAttachable();return t.length===0?e:de({},e,{$exception_steps:t})}catch(n){return ss.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}lc(e){this.ec.enabled&&this.rc.add({[bh]:e,[yh]:new Date().toISOString()})}sc(e){return nt(e)?de({},e):{}}ic(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}oc(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var a=r.type,o=r.value;return at(a)&&a.length>0&&n.$exception_types.push(a),at(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Xv.some((n=>{var r=n.values.map((a=>{var o=lk[a.operator],u=t[a.key];if(!o||!u)return!1;var h=Pe(a.value)?a.value:[a.value];return h.length>0&&o(h,u)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return ss.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}uc(e){var t=e.flatMap((r=>{var a,o;return(a=(o=r.stacktrace)==null?void 0:o.frames)!==null&&a!==void 0?a:[]})),n=t.filter((r=>{var a=r.filename;return!!a&&p6.some((o=>a.startsWith(o)))}));return n.length!==0&&(!n.every((r=>{var a=r.filename;return!!a&&a.startsWith(ux)}))||e.some((r=>{var a=r.value;return at(a)&&a.includes("isolatedAPI.contexts.topHostname")}))&&!t.some((r=>{var a=r.filename;return r.in_app&&!(a!=null&&a.startsWith(ux))})))}hc(e){return e.some((t=>{var n=t.value;return at(n)&&m6.some((r=>n.includes(r)))}))}dc(e){if(e.length>0){var t,n,r,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(r=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ac(e){return!Ye(e)&&Pe(e)}}},_6=de({productTours:class{get Bo(){return this._instance.persistence}constructor(e){this.cc=null,this.fc=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.Bo&&this.Bo.register({[Bx]:!!t.productTours}),!Um(this._instance))return!this.cc&&Ye((n=this.Bo)==null?void 0:n.props[Nc])||Id.info("product tours disabled; stopping and clearing cached tours"),(r=this.cc)==null||r.stop(),this.cc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.cc&&Um(this._instance)&&this.Ys((()=>this.gc()))}Ys(e){var t,n;(t=Re.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Id.error("Could not load product tours script",r):e()}))}gc(){var e;!this.cc&&(e=Re.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.cc=Re.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Pe(this.fc)||t){var n=this.Bo;if(n){var r=n.props[Nc];if(Pe(r)&&!t)return this.fc=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:a=>{if(Um(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||Id.warn(u):Id.error(u),void e([],{isLoaded:!1,error:u})}var h=Pe(a.json.product_tours)?a.json.product_tours:[];this.fc=h,n&&n.register({[Nc]:h}),e(h,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.fc,{isLoaded:!0})}getActiveProductTours(e){Ye(this.cc)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.cc.getActiveProductTours(e)}showProductTour(e){var t;(t=this.cc)==null||t.showTourById(e)}previewTour(e){this.cc?this.cc.previewTour(e):this.Ys((()=>{var t;this.gc(),(t=this.cc)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.cc)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.cc)==null||e.nextStep()}previousStep(){var e;(e=this.cc)==null||e.previousStep()}clearCache(){var e;this.fc=null,(e=this.Bo)==null||e.unregister(Nc)}resetTour(e){var t;(t=this.cc)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.cc)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.cc)==null||t.cancelPendingTour(e)}}},Yh),w6={siteApps:class{constructor(e){this.mc=0,this._instance=e,this.yc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}bc(e,t){if(t){var n=this.globalsForEvent(t);this.yc.push(n),this.yc.length>1e3&&(this.yc=this.yc.slice(10))}}get siteAppLoaders(){var e;return(e=Re._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.bc.bind(this));this._c=()=>{e(),this.yc=[],this._c=void 0}}}globalsForEvent(e){var t,n,r,a,o,u,h;if(!e)throw new Error("Event payload is required");var f={},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];f[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:de({},jw(e,i6),{properties:de({},e.properties,_?{$set:de({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:de({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(h=e.properties)==null?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:f}}wc(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)||(bs.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)||(bs.error("prepare_external_dependency_script returned null"),null):e}kc(){var e,t,n,r,a,o,u,h;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var f=pe==null?void 0:pe.defaultView,p=f==null||(e=f.Node)==null?void 0:e.prototype;if(!f||!p)return()=>{};if(this.mc++,this.Sc)return this.xc();var m=[],x=this,b=new WeakSet,y=(N,w,E)=>{if(N!=null&&N[w]){var C=N[w];N[w]=E(C),m.push((()=>{N[w]=C}))}},_=N=>{if(b.has(N))return N;var w=x.wc(N);return w&&b.add(w),w},j=N=>N.map((w=>typeof w=="string"?w:_(w))).filter((w=>!sn(w)));return y(p,"appendChild",(N=>function(w){var E=_(w);return E?N.call(this,E):w})),y(p,"insertBefore",(N=>function(w,E){var C=_(w);return C?N.call(this,C,E):w})),y(p,"replaceChild",(N=>function(w,E){var C=_(w);return C?N.call(this,C,E):E})),[(t=f.Element)==null?void 0:t.prototype,(n=f.Document)==null?void 0:n.prototype,(r=f.DocumentFragment)==null?void 0:r.prototype].forEach((N=>{y(N,"append",(w=>function(){for(var E=arguments.length,C=new Array(E),L=0;E>L;L++)C[L]=arguments[L];return w.apply(this,j(C))})),y(N,"prepend",(w=>function(){for(var E=arguments.length,C=new Array(E),L=0;E>L;L++)C[L]=arguments[L];return w.apply(this,j(C))}))})),[(a=f.Element)==null?void 0:a.prototype,(o=f.CharacterData)==null?void 0:o.prototype,(u=f.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(w=>function(){for(var E=arguments.length,C=new Array(E),L=0;E>L;L++)C[L]=arguments[L];return w.apply(this,j(C))})),y(N,"after",(w=>function(){for(var E=arguments.length,C=new Array(E),L=0;E>L;L++)C[L]=arguments[L];return w.apply(this,j(C))})),y(N,"replaceWith",(w=>function(){for(var E=arguments.length,C=new Array(E),L=0;E>L;L++)C[L]=arguments[L];var O=j(C);return C.length&&!O.length?void 0:w.apply(this,O)}))})),y((h=f.Element)==null?void 0:h.prototype,"insertAdjacentElement",(N=>function(w,E){var C=_(E);return C?N.call(this,w,C):null})),this.Sc=()=>{m.forEach((N=>N())),this.Sc=void 0},this.xc()}xc(){var e=!1;return()=>{var t;e||(e=!0,this.mc--,this.mc===0&&((t=this.Sc)==null||t.call(this)))}}Cc(e,t){t===void 0&&(t=!0);var n=this.kc();try{var r=e(n);return t&&n(),r}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.yc.length&&(bs.info("Processing "+this.yc.length+" events for site app with id "+e.id),this.yc.forEach((h=>this.Cc((()=>t.processEvent==null?void 0:t.processEvent(h))))),t.processedBuffer=!0),Object.values(this.apps).every((h=>h.processedBuffer||h.errored))&&((u=this._c)==null||u.call(this))},r=!1,a=u=>{t.errored=!u,t.loaded=!0,bs.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),r&&n()};try{var o=this.Cc((u=>e.init({posthog:this._instance,callback(h){u(),a(h)}})),!1).processEvent;o&&(t.processEvent=o),r=!0}catch(u){bs.error(D_+e.id,u),a(!1)}if(r&&t.loaded)try{n()}catch(u){bs.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Tc(){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)}Mc(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(o){try{t.Cc((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){bs.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))r(a)}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Tc(),void this._instance.on("eventCaptured",(f=>this.Mc(f)))):void bs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this._c)==null||n.call(this),e.ok){var o=e.config;if((r=o.siteApps)!=null&&r.length)if(this.isEnabled){var u=function(){var f,p=h.id,m=h.url;Re["__$$ph_site_app_"+p]=a._instance,(f=Re.__PosthogExtensions__)==null||f.loadSiteApp==null||f.loadSiteApp(a._instance,m,(x=>{if(x)return bs.error(D_+p,x)}))};for(var h of o.siteApps)u()}else bs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},k6={tracingHeaders:class{constructor(e){this.Ic=void 0,this.Ec=void 0,this.Rc=void 0,this.Uv=()=>{var t,n,r=this.Pc();r?(ue(this.Ic)&&(this.Ic=(t=Re.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ue(this.Ec)&&(this.Ec=(n=Re.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Jv()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Ys(e){var t,n;(t=Re.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Re.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return t6.error("failed to load script",r);e()}))}Ac(){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}Pc(){var e=this.Ac();return Pe(e)?(Pe(this.Rc)?this.Rc.splice(0,this.Rc.length,...e):this.Rc=[...e],e.length>0?this.Rc:void 0):(Pe(this.Rc)&&this.Rc.splice(0),this.Rc=e||void 0,this.Rc)}Jv(){var e,t;(e=this.Ic)==null||e.call(this),(t=this.Ec)==null||t.call(this),this.Ic=void 0,this.Ec=void 0}startIfEnabledOrStop(){this.Pc()?this.Ys(this.Uv):this.Jv()}}},S6=de({surveys:class extends a6{constructor(e){var t;super(new d6(e),{get projectToken(){return t.config.token},kv:new u6(t=e)}),this._instance=e}Bu(e,t){var n=t.query?ru(e,t.query):e;return new Promise((r=>{var a;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((a=t.target)!==null&&a!==void 0?a:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:r})}))}}},Yh),j6={toolbar:class{constructor(e){this.instance=e}Fc(e){Re.ph_toolbar_state=e}Oc(){var e;return(e=Re.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),Xg(this.instance.config)||!te||!pe)return!1;e=e??te.location,n=n??te.history;try{if(!t){try{te.localStorage.setItem("test","test"),te.localStorage.removeItem("test")}catch{return!1}t=te==null?void 0:te.localStorage}var r,a=h6||Th(e.hash,"__posthog")||Th(e.hash,"state"),o=a?Qy((()=>JSON.parse(atob(decodeURIComponent(a)))))||Qy((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(z_)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Lc(e){var t=Re.ph_load_toolbar||Re.ph_load_editor;!Ye(t)&&Un(t)?t(e,this.instance):B_.warn("No toolbar load function found")}loadToolbar(e){var t=!(pe==null||!pe.getElementById(S2));if(!te||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=de({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(te.localStorage.setItem(z_,JSON.stringify(de({},r,{source:void 0}))),this.Oc()===2)this.Lc(r);else if(this.Oc()===0){var a;this.Fc(1),(a=Re.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return B_.error("[Toolbar] Failed to load",o),void this.Fc(0);this.Fc(2),this.Lc(r)})),Lt(te,"turbolinks:load",(()=>{this.Fc(0),this.loadToolbar(r)}))}return!0}Dc(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)}}},N6=de({experiments:Fn},Yh),C6={conversations:class{constructor(e){this.$c=void 0,this._conversationsManager=null,this.Nc=!1,this.je=null,this.qc=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.jc=e.ok,e.ok)){var t=e.config.conversations;Ye(t)||(Kn(t)?this.$c=t:(this.$c=t.enabled,this.je=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.$c=void 0,this.je=null,this.jc=void 0,this.qc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Nc||this._instance.config.disable_conversations||Xg(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Re==null?void 0:Re.__PosthogExtensions__;if(e&&!ue(this.$c)&&this.$c)if(this.je&&this.je.token){this.Nc=!0;try{var t=e.initConversations;if(t)return this.Bc(t),void(this.Nc=!1);var n=e.loadExternalDependency;if(!n)return void this.Hc($x);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.Hc("Could not load conversations script",r):this.Bc(e.initConversations),this.Nc=!1}))}catch(r){this.Hc("Error initializing conversations",r),this.Nc=!1}}else qr.error("Conversations enabled but missing token in remote config.")}}Bc(e){if(this.je)try{this._conversationsManager=e(this.je,this._instance),this.qc=!1,qr.info("Conversations loaded successfully")}catch(t){this.Hc("Error completing conversations initialization",t)}else qr.error("Cannot complete initialization: remote config is null")}Hc(e,t){qr.error(e,t),this._conversationsManager=null,this.Nc=!1,this.qc=!0}show(){this._conversationsManager?this._conversationsManager.show():qr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.$c===!0&&!sn(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Xg(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.jc===!1?"remote_config_failed":ue(this.$c)?this.jc?"disabled_in_project":"remote_config_pending":this.$c?Ye(this.je)||!this.je.token?"missing_token":Re!=null&&Re.__PosthogExtensions__?this.Nc?"initializing":this.qc?"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 r=this;return Ft((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(qr.warn(Na),null)}))()}getMessages(e,t){var n=this;return Ft((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(qr.warn(Na),null)}))()}markAsRead(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(qr.warn(Na),null)}))()}getTickets(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(qr.warn(Na),null)}))()}requestRestoreLink(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(qr.warn(Na),null)}))()}restoreFromToken(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(qr.warn(Na),null)}))()}restoreFromUrlToken(){var e=this;return Ft((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qr.warn(Na),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}Cu(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Tu(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},E6={logs:class{constructor(e){var t,n=this;this.name="logs",this.zc=!1,this.Uc=!1,this.Wc=!1,this.A=Gt("[logs]"),this.Vc=de({},this.A,{error(){for(var r=arguments.length,a=new Array(r),o=0;r>o;o++)a[o]=arguments[o];a.some(G_)||n.A.error(...a)}}),this.bo=[],this.Gc=[],this._d=0,this.Os=!1,this.Zc=[],this.Qc=[],this.Jc=!1,this.Kc=!1,this.Yc=()=>{var r,a;this.Os||(this._d=0,(r=this.Xc)==null||r.onReconnect(),(a=this.tf)==null||a.onReconnect())},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.zc=!0),te&&Lt(te,"online",this.Yc)}ef(e,t,n,r){var a,o=q_((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new I4(this.if(e,t),o,this.Vc,(()=>this.rf()),(u=>u()),void 0,r),o]}nf(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Xc||this.sf!==t){var n;(n=this.Xc)==null||n.reset(),this.sf=t;var r=this.ef((()=>this.bo),(a=>{this.bo=a}));this.Xc=r[0],this.af=r[1]}return this.Xc}lf(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.tf||this.uf!==t){var n;(n=this.tf)==null||n.reset(),this.uf=t;var r=this.ef((()=>this.Gc),(a=>{this.Gc=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},V_);this.tf=r[0],this.hf=r[1]}return this.tf}setup(e){var t;if(!this.Os){this.Ns=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.zc=!0),(this.zc||this.df()&&this.vf())&&this.cf();var n=!1,r=e.onRemoteConfig((a=>{var o;n=a.ok&&((o=a.config.logs)==null?void 0:o.captureConsoleLogs)===!0,this.onRemoteConfig(a)}));this.Os?r.dispose():(this.qs=r,n||this.loadIfEnabled())}}dispose(){var e,t,n,r;this.Os||(this.Os=!0,this.ff(),(e=this.qs)==null||e.dispose(),this.qs=void 0,this.Ns=void 0,this.Wc=!1,te==null||te.removeEventListener("online",this.Yc),(t=this.pf)==null||t.call(this),this.pf=void 0,(n=this.Xc)==null||n.reset(),(r=this.tf)==null||r.reset())}onRemoteConfig(e){var t,n;if(!this.Os){var r=e.ok?(t=e.config.logs)==null?void 0:t.captureConsoleLogs:void 0;Ye(r)?this.gf():((n=this._instance)==null||(n=n.persistence)==null||n.register({[$g]:!!r}),r?(this.zc=!0,this.Uc||this.cf(),this.loadIfEnabled()):this.gf())}}reset(){var e,t,n,r;this.ff(),(e=this.Xc)==null||e.clearQueue(),this.bo=[],(t=this.Xc)==null||t.reset(),(n=this.tf)==null||n.clearQueue(),this.Gc=[],(r=this.tf)==null||r.reset(),this._d=0}captureLog(e){this.Os||this.nf().captureLog(e)}captureConsoleLog(e){this.Os||this.lf().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Os||this.lf().captureLog(e,{context:t,occurredAtMs:n})}vf(){var e;return!((e=this._instance)==null||(e=e.persistence)==null||(e=e.props)==null||!e[$g])}df(){var e,t;return(e=this._instance)==null||e.fo==null||!e.fo()||!((t=Re._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null||!t.config)}Iu(){var e;this.ff(),(e=this.tf)==null||e.clearQueue(),this.Gc=[]}gf(){this.zc||this.ff()}cf(){var e,t=this;if(!this.Jc&&Re!=null&&Re.console){var n=q_((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,r=function(o){var u;try{u=(h=>{for(;(f=h)!=null&&f.__rrweb_original__;){var f;h=h.__rrweb_original__}return h})(Re.console[o])}catch{return 0}if(!u)return 0;t.Qc.push(pk(Re.console,o,(h=>{var f=function(){for(var p=arguments.length,m=new Array(p),x=0;p>x;x++)m[x]=arguments[x];try{t.mf(o,m,n)}catch{}return h.apply(Re.console,m)};return f.__rrweb_original__=u,f})))};for(var a of x6)r(a);this.Jc=!0,this.yf=setTimeout((()=>{this.ff()}),3e4)}}mf(e,t,n){var r;if(this.Jc&&!this.Kc&&t.length!==0)if((r=this._instance)!=null&&r.is_capturing()){if(n>this.Zc.length){this.Kc=!0;try{this.Zc.push({level:e,args:t,occurredAtMs:Date.now(),context:this.rf()})}finally{this.Kc=!1}}}else this.ff()}ff(){if(this.Zc=[],this.Jc){for(var e of(this.Jc=!1,this.yf&&(clearTimeout(this.yf),this.yf=void 0),this.Qc))e();this.Qc=[]}}bf(){var e=this.Zc;return this.ff(),e}get logger(){return this._f||(this._f={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._f}flushLogs(e){e?this.wf(e):(this.Xc&&this.Xc.flush().catch((t=>this.kf(t))),this.tf&&this.tf.flush().catch((t=>this.kf(t))))}kf(e){G_(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this.Os&&this.zc&&!this.Uc&&!this.Wc){var e=Re==null?void 0:Re.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.ff();var t=e.loadExternalDependency;if(!t)return this.A.error($x),void this.ff();this.Wc=!0;try{t(this._instance,"logs",(n=>{if(this.Wc=!1,!this.Os&&this.zc){var r=e.logs;if(n||r==null||!r.initializeLogs)this.A.error("Could not load logs script",n),this.ff();else{var a,o,u=this.bf();this.pf=r.initializeLogs((a=this.Ns)!==null&&a!==void 0?a:this._instance),this.Uc=!0,u.length>0&&(r.replayConsoleBuffer==null||r.replayConsoleBuffer((o=this.Ns)!==null&&o!==void 0?o:this._instance,u))}}}))}catch(n){throw this.Wc=!1,n}}}if(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===ws.LogsQueue?e():void 0,setPersistedProperty(r,a){var o;r===ws.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},hs:r=>this.hs(r),getLibraryId:()=>Pt.LIB_NAME,getLibraryVersion:()=>Pt.LIB_VERSION}}hs(e){return new Promise((t=>{if(B2(this._d,3))t({kind:"fatal",error:Hm(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Hm(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Sf(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this.xf(u),u>=200&&300>u)r({kind:"ok"});else if(u===413)r({kind:"too-large"});else if(u!==0&&u!==408&&u!==429&&500>u)r({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var h;u===0?(o.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Hm(o.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(h=o.error)!==null&&h!==void 0?h:new Error("logs request failed with status "+u)})}}})}}))}xf(e){(e!==0||this._instance.__loaded)&&(this._d=P2(e,this._d,3,(()=>this.A.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."))))}wf(e){this.bo.length>0&&this.Cf(e,this.bo,this.af,Pt.LIB_NAME,(t=>{this.bo=t})),this.Gc.length>0&&this.Cf(e,this.Gc,this.hf,V_,(t=>{this.Gc=t}))}Cf(e,t,n,r,a){if(t.length!==0){var o=t.map((h=>h.record));a([]);var u=c2(o,o2(n,Pt.LIB_NAME,Pt.LIB_VERSION),r,Pt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Sf(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Sf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}rf(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,Ye(a)||(t.sessionStartTimestamp=a),Ye(o)||(t.lastActivityTimestamp=o)}if(Re!=null&&(e=Re.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Wi(Re.location.href):Re.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},A6={metrics:class{constructor(e){this.A=Gt("[metrics]"),this._instance=e}initialize(){}nf(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.Xc&&this.sf===n||((t=this.Xc)==null||t.reset(),this.sf=n,this.Xc=new H4(this.if(),(function(r){var a,o,u,h,f,p=r==null?void 0:r.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:r==null?void 0:r.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:r==null?void 0:r.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:r==null?void 0:r.environment,resourceAttributes:p,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(h=r==null?void 0:r.flushIntervalMs)!==null&&h!==void 0?h:1e4,maxSeriesPerFlush:(f=r==null?void 0:r.maxSeriesPerFlush)!==null&&f!==void 0?f:1e3}})(n),this.A)),this.Xc}count(e,t,n){t===void 0&&(t=1),this.nf().count(e,t,n)}gauge(e,t,n){this.nf().gauge(e,t,n)}histogram(e,t,n){this.nf().histogram(e,t,n)}flush(e){if(!this.Xc)return Promise.resolve();if(e){var t=this.Xc.drainWindow();return t&&this.Ms(t,e),Promise.resolve()}return this.Xc.flush().catch((n=>this.A.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.Xc)==null||e.reset()}if(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ms:n=>t.Ms(n),getLibraryId:()=>Pt.LIB_NAME,getLibraryVersion:()=>Pt.LIB_VERSION}}Ms(e,t){return new Promise((n=>{var r=!1,a=u=>{r||(r=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(de({method:"POST",url:this.Tf(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var h=u.statusCode;if(h>=200&&300>h)a({kind:"ok"});else if(h===413)a({kind:"too-large"});else if(h!==0&&h!==408&&h!==429&&500>h)a({kind:"fatal",error:new Error("metrics request failed with status "+h)});else{var f;a({kind:"retry-later",error:(f=u.error)!==null&&f!==void 0?f:new Error("metrics request failed with status "+h)})}}}))}))}Tf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},T6=de({},Yh,v6,b6,y6,_6,w6,S6,k6,j6,N6,C6,E6,A6);jr.__defaultExtensionClasses=de({},T6);var Kc=(function(){Pt.SDK_DIST_CHANNEL="npm";var e=zc[Pl]=new jr;return(function(){function t(){t.done||(t.done=!0,hk=!1,Nt(zc,(function(n){n._dom_loaded()})))}pe!=null&&pe.addEventListener?pe.readyState==="complete"?t():Lt(pe,"DOMContentLoaded",t,{capture:!1}):te&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const M6="https://us.i.posthog.com",xk="cc-telemetry-enabled";let dx=!1,Zc=!1;function R6(){return M6}function L6(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(xk);return e===null?!0:e==="true"}function vk(e){dx&&(e?(Kc.opt_in_capturing({captureEventName:null}),Zc=!0):(Kc.opt_out_capturing(),Zc=!1))}function Tz(e){typeof localStorage<"u"&&localStorage.setItem(xk,String(e)),vk(e)}function D6(){const e=void 0;return e?(Kc.init(e,{api_host:R6(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),dx=!0,vk(L6()),!0):(dx=!1,Zc=!1,!1)}function Gx(e,t){Zc&&Kc.capture(e,t)}function Xi(e,t){Zc&&Kc.captureException(e,t)}function O6(e){Gx("$pageview",{$current_url:e})}const Ns="/api",bk="companion_auth_token";function Ki(){if(typeof window>"u")return{};const e=localStorage.getItem(bk);return e?{Authorization:`Bearer ${e}`}:{}}function Ba(e){e===401&&typeof window<"u"&&(localStorage.removeItem(bk),qn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>LC);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function yn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function su(e,t,n,r){Gx("api_request_succeeded",{method:e,path:t,status:r,duration_ms:Math.round(n)})}function Cs(e,t,n,r,a){Gx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:r instanceof Error?r.message:String(r)}),Xi(r,{method:e,path:t,status:a})}async function qe(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("POST",e,yn()-n,u,a.status),r=!0,u}return su("POST",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("POST",e,yn()-n,a),a}}async function Le(e){const t=yn();let n=!1;try{const r=await fetch(`${Ns}${e}`,{headers:{...Ki()}});if(!r.ok){Ba(r.status);const a=await r.json().catch(()=>({error:r.statusText})),o=new Error(a.error||r.statusText);throw Cs("GET",e,yn()-t,o,r.status),n=!0,o}return su("GET",e,yn()-t,r.status),r.json()}catch(r){throw n||Cs("GET",e,yn()-t,r),r}}async function Vr(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("PUT",e,yn()-n,u,a.status),r=!0,u}return su("PUT",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("PUT",e,yn()-n,a),a}}async function z6(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("PATCH",e,yn()-n,u,a.status),r=!0,u}return su("PATCH",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("PATCH",e,yn()-n,a),a}}async function Gr(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("DELETE",e,yn()-n,u,a.status),r=!0,u}return su("DELETE",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("DELETE",e,yn()-n,a),a}}async function B6(e,t){const n=await fetch(`${Ns}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ki()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const h=await n.json().catch(()=>({error:n.statusText}));throw new Error(h.error||n.statusText)}const r=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:h,value:f}=await r.read();if(h)break;o+=a.decode(f,{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 P6(){try{const e=await fetch(`${Ns}/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 Y_(e){try{const t=await fetch(`${Ns}/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:()=>Le("/auth/qr"),getAuthToken:()=>Le("/auth/token"),regenerateAuthToken:()=>qe("/auth/regenerate"),createSession:e=>qe("/sessions/create",e),listSessions:()=>Le("/sessions"),discoverClaudeSessions:(e=200)=>Le(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),r=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Le(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(r))}`)},killSession:e=>qe(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Gr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>qe(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${Ns}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ki()}});if(!n.ok)throw Ba(n.status),new Error(`Export failed (${n.status})`);const r=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:r,filename:u}},archiveSession:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Le(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>qe(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>z6(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Le(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Le("/fs/home"),listEnvs:()=>Le("/envs"),getEnv:e=>Le(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>qe("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Vr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Gr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Le("/sandboxes"),getSandbox:e=>Le(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>qe("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Vr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Gr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>qe(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>qe("/docker/build-base"),getBaseImageStatus:()=>Le("/docker/base-image"),getSettings:()=>Le("/settings"),updateSettings:e=>Vr("/settings",e),verifyAnthropicKey:e=>qe("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>Le("/dashboard"),runDashboardUpdate:()=>qe("/dashboard/run"),getDashboardRunStatus:()=>Le("/dashboard/run/status"),getTailscaleStatus:()=>Le("/tailscale/status"),startTailscaleFunnel:()=>qe("/tailscale/funnel/start"),stopTailscaleFunnel:()=>qe("/tailscale/funnel/stop"),listLinearConnections:()=>Le("/linear/connections"),createLinearConnection:e=>qe("/linear/connections",e),updateLinearConnection:(e,t)=>Vr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Gr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>qe(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Le(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Le(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Le(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>qe(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Le(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Le(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Le(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Vr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Gr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Vr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Gr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Le(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>qe("/linear/issues",e),addLinearComment:(e,t,n)=>qe(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Le(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Le(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>qe("/git/fetch",{repoRoot:e}),gitPull:e=>qe("/git/pull",{cwd:e}),listWorktrees:e=>Le(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>qe("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Gr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Le(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Le("/backends"),getBackendModels:e=>Le(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Le("/containers/status"),getContainerImages:()=>Le("/containers/images"),getImageStatus:e=>Le(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>qe(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Le(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>qe(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Le(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Le(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${Ns}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ki()}});if(!t.ok){Ba(t.status);const r=await t.json().catch(()=>({error:t.statusText}));throw new Error(r.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Vr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Le(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Le(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Le(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Vr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Le(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Le("/usage-limits"),getSessionUsageLimits:e=>Le(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Le("/system/memory"),getSystemDisk:()=>Le("/system/disk"),spawnTerminal:(e,t,n,r)=>qe("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:r==null?void 0:r.containerId}),killTerminal:e=>qe("/terminal/kill",{terminalId:e}),getTerminal:e=>Le(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Le("/update-check"),forceCheckForUpdate:()=>qe("/update-check"),triggerUpdate:()=>qe("/update"),getClaudeCompat:()=>Le("/claude-compat"),refreshClaudeCompat:()=>qe("/claude-compat/refresh"),pinClaudeVersion:e=>qe("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>qe("/claude-compat/patch"),unpatchClaudeBinary:()=>qe("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>qe("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Le("/cron/jobs"),getCronJob:e=>Le(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>qe("/cron/jobs",e),updateCronJob:(e,t)=>Vr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Gr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>qe(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>qe(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Le(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Le(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Le("/agents"),getAgent:e=>Le(`/agents/${encodeURIComponent(e)}`),createAgent:e=>qe("/agents",e),updateAgent:(e,t)=>Vr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Gr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>qe(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>qe(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Le(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>qe("/agents/import",e),exportAgent:e=>Le(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>qe(`/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 Le(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Le(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const r=n.toString();return Le(`/linear/oauth/authorize-url${r?`?${r}`:""}`)},disconnectLinearOAuth:()=>qe("/linear/oauth/disconnect"),createLinearStaging:e=>qe("/linear/oauth/staging",e),getLinearStagingStatus:e=>Le(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Gr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Le("/linear/oauth-connections"),createLinearOAuthConnection:e=>qe("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Vr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Gr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Le(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Le("/skills"),sendSessionMessage:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const r=n.toString();return Le(`/prompts${r?`?${r}`:""}`)},createPrompt:e=>qe("/prompts",e),updatePrompt:(e,t)=>Vr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Gr(`/prompts/${encodeURIComponent(e)}`)};let W_=!1;function Q_(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select();const a=document.execCommand("copy");if(document.body.removeChild(r),!a){n(new Error("Copy command was rejected"));return}t()}catch(r){n(r instanceof Error?r:new Error("Clipboard copy failed"))}})}function X_(){return new Promise(()=>{})}function $6(){if(W_||typeof window>"u")return;W_=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async r=>{try{await n(r)}catch{try{await Q_(r)}catch{return X_()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Q_(n)}catch{return X_()}}}})}catch{}}const K_="#/session/",Z_="#/agents/";let J_=!1;function Yx(){J_||($6(),J_=!0)}function Wx(e){if(Yx(),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(Z_)){const n=e.slice(Z_.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(K_)){const n=e.slice(K_.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function F6(e){return`#/session/${e}`}function Qx(e,t=!1){Yx();const n=F6(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function qm(e=!1){Yx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function U6(){const[e,t]=k.useState(""),[n,r]=k.useState(null),[a,o]=k.useState(!1),u=G(m=>m.setAuthToken),h=k.useCallback(async m=>{m.preventDefault();const x=e.trim();if(!x){r("Please enter a token");return}o(!0),r(null),await Y_(x)?u(x):r("Invalid token"),o(!1)},[e,u]);k.useEffect(()=>{P6().then(m=>{if(m){u(m);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),Y_(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else r("Invalid token from URL"),o(!1)}))})},[u]);const[f,p]=k.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:h,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:f?"text":"password",value:e,onChange:m=>{t(m.target.value),r(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(!f),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:f?"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 lo=cw();function I6({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:r,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:h}){const[f,p]=k.useState("none");return lo.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:h,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:h,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:f==="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:f==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),r&&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:f==="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:h,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(f,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 H6(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function q6({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 V6({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 ah({session:e,isActive:t,isArchived:n,sessionName:r,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:h,onArchive:f,onUnarchive:p,onDelete:m,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:w}){const E=e.id.slice(0,8),C=r||e.model||E,L=b===e.id,[O,D]=k.useState(!1),U=k.useRef(null),I=k.useRef(null),W=n?"exited":H6(e,a),z=e.cwd||"";k.useEffect(()=>{if(!O)return;function T(Z){var Y;U.current&&!U.current.contains(Z.target)&&I.current&&!I.current.contains(Z.target)&&(D(!1),(Y=I.current)==null||Y.focus())}function ie(Z){var Y,P,$;if(Z.key==="Escape"){D(!1),(Y=I.current)==null||Y.focus();return}if(Z.key==="Tab"){D(!1);return}if((Z.key==="ArrowDown"||Z.key==="ArrowUp")&&((P=U.current)!=null&&P.contains(document.activeElement)||I.current===document.activeElement)){Z.preventDefault();const re=($=U.current)==null?void 0:$.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const ae=document.activeElement,R=Array.from(re).indexOf(ae);Z.key==="ArrowDown"?re[R<re.length-1?R+1:0].focus():re[R>0?R-1:re.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",ie),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",ie)}},[O]),k.useEffect(()=>{O&&requestAnimationFrame(()=>{var T,ie;(ie=(T=U.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||ie.focus()})},[O]);const q=k.useCallback(T=>{D(!1),T()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),h(e.id,C)},onKeyDown:T=>{T.key==="F2"&&!L&&(T.preventDefault(),h(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"}`}),!L&&l.jsx(q6,{status:W}),L?l.jsx("input",{ref:w,value:y,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),N()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):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}),z&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:z})]}),!L&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(V6,{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&&!L&&!O&&l.jsx("button",{onClick:T=>{T.stopPropagation(),f(T,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children: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:I,onClick:T=>{T.stopPropagation(),D(!O)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":O,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),O&&l.jsxs("div",{ref:U,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:()=>q(()=>h(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:T=>q(()=>p(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[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:T=>q(()=>m(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[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:T=>q(()=>f(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[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 G6({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:r,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:h,onStartRename:f,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:E,isFirst:C}){const L=t?e.sessions.slice(0,2).map(O=>a.get(O.id)||O.model||O.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className: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&&L&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:L}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(O=>{var U;const D=((U=o.get(O.id))==null?void 0:U.size)??0;return l.jsx(ah,{session:O,isActive:r===O.id,sessionName:a.get(O.id),permCount:D,isRecentlyRenamed:u.has(O.id),onSelect:h,onStartRename:f,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:E},O.id)})})]})}function Y6(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function W6(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function Q6(e){const t=new Map;for(const r of e){const a=Y6(r.cwd,r.repoRoot||void 0,r.isContainerized),o=W6(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(r),r.status==="running"&&u.runningCount++,u.permCount+=r.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,r.createdAt)}const n=Array.from(t.values()).sort((r,a)=>r.label.localeCompare(a.label));for(const r of n)r.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const X6=[{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"}],K6=[{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"}],Z6=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],J6=new Map(K6.map(e=>[e.id,e]));function eA(){var Kr,Zr;const[e,t]=k.useState(null),[n,r]=k.useState(""),[a,o]=k.useState(!1),[u,h]=k.useState(null),[f,p]=k.useState(null),[m,x]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,w]=k.useState(!1),[E,C]=k.useState(()=>typeof window<"u"?window.location.hash:""),L=k.useRef(null),O=k.useRef(null),D=G(ne=>ne.sessions),U=G(ne=>ne.sdkSessions),I=G(ne=>ne.currentSessionId),W=G(ne=>ne.cliConnected),z=G(ne=>ne.cliReconnecting),q=G(ne=>ne.sessionStatus),T=G(ne=>ne.removeSession),ie=G(ne=>ne.sessionNames),Z=G(ne=>ne.recentlyRenamed),Y=G(ne=>ne.clearRecentlyRenamed),P=G(ne=>ne.pendingPermissions),$=G(ne=>ne.linkedLinearIssues),re=G(ne=>ne.collapsedProjects),ae=G(ne=>ne.toggleProjectCollapse),R=Wx(E);k.useEffect(()=>{let ne=!0;async function ve(){try{const Ke=await Ne.listSessions();if(ne){const qt=G.getState();qt.setSdkSessions(Ke);const fn=G.getState(),Pn=new Set(Ke.map(Vt=>Vt.sessionId));for(const Vt of fn.sessions.keys())!Pn.has(Vt)&&fn.connectionStatus.get(Vt)!=="connected"&&fn.removeSession(Vt);z3(Ke);for(const Vt of Ke)if(Vt.name&&(!qt.sessionNames.has(Vt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(qt.sessionNames.get(Vt.sessionId)))){const Gn=qt.sessionNames.get(Vt.sessionId),Tr=!!Gn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Gn);Gn!==Vt.name&&(qt.setSessionName(Vt.sessionId,Vt.name),Tr&&qt.markRecentlyRenamed(Vt.sessionId))}}}catch{}}ve();const _e=setInterval(ve,5e3);return()=>{ne=!1,clearInterval(_e)}},[]),k.useEffect(()=>{const ne=()=>C(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function B(ne){Qx(ne),window.innerWidth<768&&G.getState().setSidebarOpen(!1)}function X(){qm(),G.getState().newSession(),window.innerWidth<768&&G.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function M(){e&&n.trim()&&(G.getState().setSessionName(e,n.trim()),Ne.renameSession(e,n.trim()).catch(()=>{})),t(null),r("")}function me(){t(null),r("")}function be(ne,ve){t(ne),r(ve)}const Ce=k.useCallback((ne,ve)=>{ne.stopPropagation(),j(ve)},[]),De=k.useCallback(async ne=>{try{_g(ne),await Ne.deleteSession(ne)}catch{}G.getState().currentSessionId===ne&&qm(),T(ne)},[T]),Ee=k.useCallback(()=>{_&&(De(_),j(null))},[_,De]),Ae=k.useCallback(()=>{j(null)},[]),Fe=k.useCallback(()=>{w(!0)},[]),dt=k.useCallback(async()=>{w(!1);const ne=G.getState(),ve=new Set;for(const Ke of ne.sessions.keys())ve.add(Ke);for(const Ke of ne.sdkSessions)ve.add(Ke.sessionId);const _e=Array.from(ve).filter(Ke=>{const qt=ne.sdkSessions.find(fn=>fn.sessionId===Ke);return(qt==null?void 0:qt.archived)??!1});for(const Ke of _e)await De(Ke)},[De]),Je=k.useCallback(()=>{w(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ve,_e;(_e=(ve=O.current)==null?void 0:ve.querySelector("button"))==null||_e.focus()});function ne(ve){var fn;if(ve.key==="Escape"){N?Je():Ae();return}if(ve.key!=="Tab")return;const _e=(fn=O.current)==null?void 0:fn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!_e||_e.length===0)return;const Ke=_e[0],qt=_e[_e.length-1];ve.shiftKey&&document.activeElement===Ke?(ve.preventDefault(),qt.focus()):!ve.shiftKey&&document.activeElement===qt&&(ve.preventDefault(),Ke.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,N,Ae,Je]);const At=k.useCallback(async(ne,ve)=>{ne.stopPropagation();const _e=U.find(Gn=>Gn.sessionId===ve),Ke=D.get(ve),qt=(Ke==null?void 0:Ke.is_containerized)||!!(_e!=null&&_e.containerId)||!1,fn=$.get(ve),Pn=((fn==null?void 0:fn.stateType)||"").toLowerCase();if(fn&&!(Pn==="completed"||Pn==="canceled"||Pn==="cancelled"))try{const Gn=await Ne.getArchiveInfo(ve);if(Gn.issueNotDone){p(ve),x(Gn),y(qt);return}}catch{}if(qt){h(ve);return}mt(ve)},[U,D,$]),mt=k.useCallback(async(ne,ve,_e)=>{try{_g(ne);const Ke={};ve&&(Ke.force=!0),_e&&_e!=="none"&&(Ke.linearTransition=_e),await Ne.archiveSession(ne,Object.keys(Ke).length>0?Ke:void 0)}catch{}G.getState().currentSessionId===ne&&(qm(),G.getState().newSession());try{const Ke=await Ne.listSessions();G.getState().setSdkSessions(Ke)}catch{}},[]),rt=k.useCallback(()=>{u&&(mt(u,!0),h(null))},[u,mt]),Dt=k.useCallback(()=>{h(null)},[]),we=k.useCallback((ne,ve)=>{f&&(mt(f,ve,ne),p(null),x(null))},[f,mt]),Ge=k.useCallback(()=>{p(null),x(null)},[]),gt=k.useCallback(async(ne,ve)=>{ne.stopPropagation();try{await Ne.unarchiveSession(ve)}catch{}try{const _e=await Ne.listSessions();G.getState().setSdkSessions(_e)}catch{}},[]),_n=new Set;for(const ne of D.keys())_n.add(ne);for(const ne of U)_n.add(ne.sessionId);const je=Array.from(_n).map(ne=>{var Ke;const ve=D.get(ne),_e=U.find(qt=>qt.sessionId===ne);return{id:ne,model:(ve==null?void 0:ve.model)||(_e==null?void 0:_e.model)||"",cwd:(ve==null?void 0:ve.cwd)||(_e==null?void 0:_e.cwd)||"",gitBranch:(ve==null?void 0:ve.git_branch)||(_e==null?void 0:_e.gitBranch)||"",isContainerized:(ve==null?void 0:ve.is_containerized)||!!(_e!=null&&_e.containerId)||!1,gitAhead:(ve==null?void 0:ve.git_ahead)||(_e==null?void 0:_e.gitAhead)||0,gitBehind:(ve==null?void 0:ve.git_behind)||(_e==null?void 0:_e.gitBehind)||0,linesAdded:(ve==null?void 0:ve.total_lines_added)||(_e==null?void 0:_e.totalLinesAdded)||0,linesRemoved:(ve==null?void 0:ve.total_lines_removed)||(_e==null?void 0:_e.totalLinesRemoved)||0,isConnected:W.get(ne)??!1,isReconnecting:z.get(ne)??!1,status:q.get(ne)??null,sdkState:(_e==null?void 0:_e.state)??null,createdAt:(_e==null?void 0:_e.createdAt)??0,archived:(_e==null?void 0:_e.archived)??!1,backendType:(ve==null?void 0:ve.backend_type)||(_e==null?void 0:_e.backendType)||"claude",repoRoot:(ve==null?void 0:ve.repo_root)||"",permCount:((Ke=P.get(ne))==null?void 0:Ke.size)??0,cronJobId:(ve==null?void 0:ve.cronJobId)||(_e==null?void 0:_e.cronJobId),cronJobName:(ve==null?void 0:ve.cronJobName)||(_e==null?void 0:_e.cronJobName),agentId:(ve==null?void 0:ve.agentId)||(_e==null?void 0:_e.agentId),agentName:(ve==null?void 0:ve.agentName)||(_e==null?void 0:_e.agentName),userName:_e==null?void 0:_e.userName}}).sort((ne,ve)=>ve.createdAt-ne.createdAt),Be=k.useMemo(()=>Array.from(new Set(je.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[je]),[yt,Te]=k.useState("__all__"),Xr=ne=>yt==="__all__"?!0:yt==="__none__"?!ne.userName:ne.userName===yt,oe=je.some(ne=>!ne.userName),ke=je.filter(Xr),Q=ke.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),xe=ke.filter(ne=>!ne.archived&&!!ne.cronJobId),Oe=ke.filter(ne=>!ne.archived&&!!ne.agentId),Xe=ke.filter(ne=>ne.archived),lt=I?je.find(ne=>ne.id===I):null,ot=(lt==null?void 0:lt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[Et,wn]=k.useState(!0),[st,fr]=k.useState(!0),Bn=k.useMemo(()=>Q6(Q),[Q]),cs={onSelect:B,onStartRename:be,onArchive:At,onUnarchive:gt,onDelete:Ce,onClearRecentlyRenamed:Y,editingSessionId:e,editingName:n,setEditingName:r,onConfirmRename:M,onCancelRename:me,editInputRef:L};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:ot,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:X,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:()=>G.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"})})})]})}),Be.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:yt,onChange:ne=>Te(ne.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),Be.map(ne=>l.jsx("option",{value:ne,children:ne},ne)),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:Dt,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:rt,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:Q.length===0&&xe.length===0&&Xe.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:[Bn.map((ne,ve)=>l.jsx(G6,{group:ne,isCollapsed:re.has(ne.key),onToggleCollapse:ae,currentSessionId:I,sessionNames:ie,pendingPermissions:P,recentlyRenamed:Z,isFirst:ve===0,...cs},ne.key)),xe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>wn(!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"})}),"Scheduled Runs (",xe.length,")"]}),Et&&l.jsx("div",{className:"mt-0.5",children:xe.map(ne=>{var ve;return l.jsx(ah,{session:ne,isActive:I===ne.id,sessionName:ie.get(ne.id),permCount:((ve=P.get(ne.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Z.has(ne.id),...cs},ne.id)})})]}),Oe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>fr(!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"})}),"Agent Runs (",Oe.length,")"]}),st&&l.jsx("div",{className:"mt-0.5",children:Oe.map(ne=>{var ve;return l.jsx(ah,{session:ne,isActive:I===ne.id,sessionName:ie.get(ne.id),permCount:((ve=P.get(ne.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Z.has(ne.id),...cs},ne.id)})})]}),Xe.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 (",Xe.length,")"]}),a&&Xe.length>1&&l.jsx("button",{onClick:Fe,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:Xe.map(ne=>{var ve;return l.jsx(ah,{session:ne,isActive:I===ne.id,isArchived:!0,sessionName:ie.get(ne.id),permCount:((ve=P.get(ne.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Z.has(ne.id),...cs},ne.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:X,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:Z6.map(ne=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:ne.label}),l.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(ve=>{const _e=J6.get(ve);if(!_e)return null;const Ke=_e.activePages?_e.activePages.some(qt=>R.page===qt):R.page===_e.id;return l.jsxs("button",{onClick:()=>{window.location.hash=_e.hash,window.innerWidth<768&&G.getState().setSidebarOpen(!1)},title:_e.label,"aria-current":Ke?"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 ${Ke?"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 ${Ke?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:_e.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:_e.iconPath,fillRule:_e.fillRule,clipRule:_e.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:_e.label})]},_e.id)})})]},ne.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:X6.map(ne=>l.jsx("a",{href:ne.url,target:"_blank",rel:"noopener noreferrer",title:ne.label,"aria-label":`Open ${ne.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:ne.iconPath})})},ne.label))})]})})]}),(_||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?Je:Ae,children:l.jsxs("div",{ref:O,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:ne=>ne.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children: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 ${Xe.length} archived session${Xe.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?Je:Ae,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?dt: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"})]})]})}),f&&m&&l.jsx(I6,{issueIdentifier:((Kr=m.issue)==null?void 0:Kr.identifier)||"",issueStateName:((Zr=m.issue)==null?void 0:Zr.stateName)||"",isContainerized:b,archiveTransitionConfigured:m.archiveTransitionConfigured||!1,archiveTransitionStateName:m.archiveTransitionStateName,hasBacklogState:m.hasBacklogState||!1,onConfirm:we,onCancel:Ge})]})}function tA(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sA={};function e5(e,t){return(sA.jsx?rA:nA).test(e)}const iA=/[ \t\n\f\r]/g;function aA(e){return typeof e=="object"?e.type==="text"?t5(e.value):!1:t5(e)}function t5(e){return e.replace(iA,"")===""}class iu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}iu.prototype.normal={};iu.prototype.property={};iu.prototype.space=void 0;function yk(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new iu(n,r,t)}function hx(e){return e.toLowerCase()}class hr{constructor(t,n){this.attribute=n,this.property=t}}hr.prototype.attribute="";hr.prototype.booleanish=!1;hr.prototype.boolean=!1;hr.prototype.commaOrSpaceSeparated=!1;hr.prototype.commaSeparated=!1;hr.prototype.defined=!1;hr.prototype.mustUseProperty=!1;hr.prototype.number=!1;hr.prototype.overloadedBoolean=!1;hr.prototype.property="";hr.prototype.spaceSeparated=!1;hr.prototype.space=void 0;let lA=0;const We=Fa(),bn=Fa(),fx=Fa(),Se=Fa(),It=Fa(),Oa=Fa(),wr=Fa();function Fa(){return 2**++lA}const px=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:bn,commaOrSpaceSeparated:wr,commaSeparated:Oa,number:Se,overloadedBoolean:fx,spaceSeparated:It},Symbol.toStringTag,{value:"Module"})),Vm=Object.keys(px);class Xx extends hr{constructor(t,n,r,a){let o=-1;if(super(t,n),n5(this,"space",a),typeof r=="number")for(;++o<Vm.length;){const u=Vm[o];n5(this,Vm[o],(r&px[u])===px[u])}}}Xx.prototype.defined=!0;function n5(e,t,n){n&&(e[t]=n)}function oo(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new Xx(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[hx(r)]=r,n[hx(o.attribute)]=r}return new iu(t,n,e.space)}const _k=oo({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:It,ariaCurrent:null,ariaDescribedBy:It,ariaDetails:null,ariaDisabled:bn,ariaDropEffect:It,ariaErrorMessage:null,ariaExpanded:bn,ariaFlowTo:It,ariaGrabbed:bn,ariaHasPopup:null,ariaHidden:bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:It,ariaLevel:Se,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:It,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:It,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:bn,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 wk(e,t){return t in e?e[t]:t}function kk(e,t){return wk(e,t.toLowerCase())}const oA=oo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oa,acceptCharset:It,accessKey:It,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alpha:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:It,autoFocus:We,autoPlay:We,blocking:It,capture:null,charSet:null,checked:We,cite:null,className:It,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:bn,controls:We,controlsList:It,coords:Se|Oa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:fx,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:It,height:Se,hidden:fx,high:Se,href:null,hrefLang:null,htmlFor:It,httpEquiv:It,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:It,itemRef:It,itemScope:We,itemType:It,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,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:We,optimum:Se,pattern:null,ping:It,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:It,required:We,reversed:We,rows:Se,rowSpan:Se,sandbox:It,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootCustomElementRegistry:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shadowRootSerializable:We,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:bn,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:We,useMap:null,value:bn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:It,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:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:bn,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:We,disablePictureInPicture:We,disableRemotePlayback:We,exportParts:Oa,part:It,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:kk}),cA=oo({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:wr,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:It,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:We,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:Oa,g2:Oa,glyphName:Oa,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:wr,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:It,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wr,rev:wr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wr,requiredFeatures:wr,requiredFonts:wr,requiredFormats:wr,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:wr,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:wr,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:wr,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:wk}),Sk=oo({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()}}),jk=oo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:kk}),Nk=oo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),uA={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"},dA=/[A-Z]/g,r5=/-[a-z]/g,hA=/^data[-\w.:]+$/i;function fA(e,t){const n=hx(t);let r=t,a=hr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hA.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(r5,mA);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!r5.test(o)){let u=o.replace(dA,pA);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Xx}return new a(r,t)}function pA(e){return"-"+e.toLowerCase()}function mA(e){return e.charAt(1).toUpperCase()}const gA=yk([_k,oA,Sk,jk,Nk],"html"),Kx=yk([_k,cA,Sk,jk,Nk],"svg");function xA(e){return e.join(" ").trim()}var zl={},Gm,s5;function vA(){if(s5)return Gm;s5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
|
|
72
|
-
`,p="/",m="*",x="",b="comment",y="declaration";function _(N,w){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];w=w||{};var E=1,C=1;function L(Z){var Y=Z.match(t);Y&&(E+=Y.length);var P=Z.lastIndexOf(f);C=~P?Z.length-P:C+Z.length}function O(){var Z={line:E,column:C};return function(Y){return Y.position=new D(Z),W(),Y}}function D(Z){this.start=Z,this.end={line:E,column:C},this.source=w.source}D.prototype.content=N;function U(Z){var Y=new Error(w.source+":"+E+":"+C+": "+Z);if(Y.reason=Z,Y.filename=w.source,Y.line=E,Y.column=C,Y.source=N,!w.silent)throw Y}function I(Z){var Y=Z.exec(N);if(Y){var P=Y[0];return L(P),N=N.slice(P.length),Y}}function W(){I(n)}function z(Z){var Y;for(Z=Z||[];Y=q();)Y!==!1&&Z.push(Y);return Z}function q(){var Z=O();if(!(p!=N.charAt(0)||m!=N.charAt(1))){for(var Y=2;x!=N.charAt(Y)&&(m!=N.charAt(Y)||p!=N.charAt(Y+1));)++Y;if(Y+=2,x===N.charAt(Y-1))return U("End of comment missing");var P=N.slice(2,Y-2);return C+=2,L(P),N=N.slice(Y),C+=2,Z({type:b,comment:P})}}function T(){var Z=O(),Y=I(r);if(Y){if(q(),!I(a))return U("property missing ':'");var P=I(o),$=Z({type:y,property:j(Y[0].replace(e,x)),value:P?j(P[0].replace(e,x)):x});return I(u),$}}function ie(){var Z=[];z(Z);for(var Y;Y=T();)Y!==!1&&(Z.push(Y),z(Z));return Z}return W(),ie()}function j(N){return N?N.replace(h,x):x}return Gm=_,Gm}var i5;function bA(){if(i5)return zl;i5=1;var e=zl&&zl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(zl,"__esModule",{value:!0}),zl.default=n;const t=e(vA());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const u=(0,t.default)(r),h=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:m}=f;h?a(p,m,f):m&&(o=o||{},o[p]=m)}),o}return zl}var vc={},a5;function yA(){if(a5)return vc;a5=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(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()},h=function(p,m){return"".concat(m,"-")},f=function(p,m){return m===void 0&&(m={}),o(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(a,h):p=p.replace(r,h),p.replace(t,u))};return vc.camelCase=f,vc}var bc,l5;function _A(){if(l5)return bc;l5=1;var e=bc&&bc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(bA()),n=yA();function r(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(u[(0,n.camelCase)(h,o)]=f)}),u}return r.default=r,bc=r,bc}var wA=_A();const kA=Nx(wA),Ck=Ek("end"),Zx=Ek("start");function Ek(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function SA(e){const t=Zx(e),n=Ck(e);if(t&&n)return{start:t,end:n}}function Pc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?o5(e.position):"start"in e||"end"in e?o5(e):"line"in e||"column"in e?mx(e):""}function mx(e){return c5(e&&e.line)+":"+c5(e&&e.column)}function o5(e){return mx(e&&e.start)+"-"+mx(e&&e.end)}function c5(e){return e&&typeof e=="number"?e:1}class Vn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=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 r=="string"){const f=r.indexOf(":");f===-1?o.ruleId=r:(o.source=r.slice(0,f),o.ruleId=r.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const h=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=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=Pc(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}}Vn.prototype.file="";Vn.prototype.name="";Vn.prototype.reason="";Vn.prototype.message="";Vn.prototype.stack="";Vn.prototype.column=void 0;Vn.prototype.line=void 0;Vn.prototype.ancestors=void 0;Vn.prototype.cause=void 0;Vn.prototype.fatal=void 0;Vn.prototype.place=void 0;Vn.prototype.ruleId=void 0;Vn.prototype.source=void 0;const Jx={}.hasOwnProperty,jA=new Map,NA=/[A-Z]/g,CA=new Set(["table","tbody","thead","tfoot","tr"]),EA=new Set(["td","th"]),Ak="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function AA(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=BA(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");r=zA(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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"?Kx:gA,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Tk(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function Tk(e,t,n){if(t.type==="element")return TA(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return MA(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return LA(e,t,n);if(t.type==="mdxjsEsm")return RA(e,t);if(t.type==="root")return DA(e,t,n);if(t.type==="text")return OA(e,t)}function TA(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Kx,e.schema=a),e.ancestors.push(t);const o=Rk(e,t.tagName,!1),u=PA(e,t);let h=tv(e,t);return CA.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!aA(f):!0})),Mk(e,u,o,t),ev(u,h),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function MA(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jc(e,t.position)}function RA(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jc(e,t.position)}function LA(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Kx,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:Rk(e,t.name,!0),u=$A(e,t),h=tv(e,t);return Mk(e,u,o,t),ev(u,h),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function DA(e,t,n){const r={};return ev(r,tv(e,t)),e.create(t,e.Fragment,r,n)}function OA(e,t){return t.value}function Mk(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ev(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function zA(e,t,n){return r;function r(a,o,u,h){const p=Array.isArray(u.children)?n:t;return h?p(o,u,h):p(o,u)}}function BA(e,t){return n;function n(r,a,o,u){const h=Array.isArray(o.children),f=Zx(r);return t(a,o,u,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function PA(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Jx.call(t.properties,a)){const o=FA(e,a,t.properties[a]);if(o){const[u,h]=o;e.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&EA.has(t.tagName)?r=h:n[u]=h}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function $A(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const u=o.expression;u.type;const h=u.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Jc(e,t.position);else{const a=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const h=r.value.data.estree.body[0];h.type,o=e.evaluater.evaluateExpression(h.expression)}else Jc(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function tv(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:jA;for(;++r<t.children.length;){const o=t.children[r];let u;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const p=a.get(f)||0;u=f+"-"+p,a.set(f,p+1)}}const h=Tk(e,o,u);h!==void 0&&n.push(h)}return n}function FA(e,t,n){const r=fA(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?tA(n):xA(n)),r.property==="style"){let a=typeof n=="object"?n:UA(e,String(n));return e.stylePropertyNameCase==="css"&&(a=IA(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?uA[r.property]||r.property:r.attribute,n]}}function UA(e,t){try{return kA(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Vn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Ak+"#cannot-parse-style-attribute",a}}function Rk(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const h=e5(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(o&&h.type==="Literal"),optional:!1}:h}r=u}else r=e5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Jx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jc(e)}function Jc(e,t){const n=new Vn("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=Ak+"#cannot-handle-mdx-estrees-without-createevaluater",n}function IA(e){const t={};let n;for(n in e)Jx.call(e,n)&&(t[HA(n)]=e[n]);return t}function HA(e){let t=e.replace(NA,qA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function qA(e){return"-"+e.toLowerCase()}const Ym={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"]},VA={};function nv(e,t){const n=VA,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Lk(e,r,a)}function Lk(e,t,n){if(GA(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 u5(e.children,t,n)}return Array.isArray(e)?u5(e,t,n):""}function u5(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Lk(e[a],t,n);return r.join("")}function GA(e){return!!(e&&typeof e=="object")}const d5=document.createElement("i");function rv(e){const t="&"+e+";";d5.innerHTML=t;const n=d5.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ar(e,t,n,r){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,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<r.length;)u=r.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Wr(e,t){return e.length>0?(Ar(e,e.length,0,t),e):t}const h5={}.hasOwnProperty;function Dk(e){const t={};let n=-1;for(;++n<e.length;)YA(t,e[n]);return t}function YA(e,t){let n;for(n in t){const a=(h5.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){h5.call(a,u)||(a[u]=[]);const h=o[u];WA(a[u],Array.isArray(h)?h:h?[h]:[])}}}function WA(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ar(e,0,0,r)}function Ok(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 os(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zn=Zi(/[A-Za-z]/),Hn=Zi(/[\dA-Za-z]/),QA=Zi(/[#-'*+\--9=?A-Z^-~]/);function Oh(e){return e!==null&&(e<32||e===127)}const gx=Zi(/\d/),XA=Zi(/[\dA-Fa-f]/),KA=Zi(/[!-/:-@[-`{-~]/);function Ie(e){return e!==null&&e<-2}function Ht(e){return e!==null&&(e<0||e===32)}function pt(e){return e===-2||e===-1||e===32}const Wh=Zi(new RegExp("\\p{P}|\\p{S}","u")),Pa=Zi(/\s/);function Zi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function co(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Hn(e.charCodeAt(n+1))&&Hn(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 h=e.charCodeAt(n+1);o<56320&&h>56319&&h<57344?(u=String.fromCharCode(o,h),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function wt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(f){return pt(f)?(e.enter(n),h(f)):t(f)}function h(f){return pt(f)&&o++<a?(e.consume(f),h):(e.exit(n),t(f))}}const ZA={tokenize:JA};function JA(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),wt(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),o(h)}function o(h){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(h)}function u(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ie(h)?(e.consume(h),e.exit("chunkText"),o):(e.consume(h),u)}}const eT={tokenize:tT},f5={tokenize:nT};function tT(e){const t=this,n=[];let r=0,a,o,u;return h;function h(C){if(r<n.length){const L=n[r];return t.containerState=L[1],e.attempt(L[0].continuation,f,p)(C)}return p(C)}function f(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const L=t.events.length;let O=L,D;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){D=t.events[O][1].end;break}w(r);let U=L;for(;U<t.events.length;)t.events[U][1].end={...D},U++;return Ar(t.events,O+1,0,t.events.slice(L)),t.events.length=U,p(C)}return h(C)}function p(C){if(r===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(f5,m,x)(C)}function m(C){return a&&E(),w(r),b(C)}function x(C){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,_(C)}function b(C){return t.containerState={},e.attempt(f5,y,_)(C)}function y(C){return r++,n.push([t.currentConstruct,t.containerState]),b(C)}function _(C){if(C===null){a&&E(),w(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),w(0),e.consume(C);return}return Ie(C)?(e.consume(C),N(e.exit("chunkFlow")),r=0,t.interrupt=void 0,h):(e.consume(C),j)}function N(C,L){const O=t.sliceStream(C);if(L&&O.push(null),C.previous=o,o&&(o.next=C),o=C,a.defineSkip(C.start),a.write(O),t.parser.lazy[C.start.line]){let D=a.events.length;for(;D--;)if(a.events[D][1].start.offset<u&&(!a.events[D][1].end||a.events[D][1].end.offset>u))return;const U=t.events.length;let I=U,W,z;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(W){z=t.events[I][1].end;break}W=!0}for(w(r),D=U;D<t.events.length;)t.events[D][1].end={...z},D++;Ar(t.events,I+1,0,t.events.slice(U)),t.events.length=D}}function w(C){let L=n.length;for(;L-- >C;){const O=n[L];t.containerState=O[1],O[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 nT(e,t,n){return wt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function io(e){if(e===null||Ht(e)||Pa(e))return 1;if(Wh(e))return 2}function Qh(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const xx={name:"attention",resolveAll:rT,tokenize:sT};function rT(e,t){let n=-1,r,a,o,u,h,f,p,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[r][1].end},b={...e[n][1].start};p5(x,-f),p5(b,f),u={type:f>1?"strongSequence":"emphasisSequence",start:x,end:{...e[r][1].end}},h={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...u.start},end:{...h.end}},e[r][1].end={...u.start},e[n][1].start={...h.end},p=[],e[r][1].end.offset-e[r][1].start.offset&&(p=Wr(p,[["enter",e[r][1],t],["exit",e[r][1],t]])),p=Wr(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=Wr(p,Qh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),p=Wr(p,[["exit",o,t],["enter",h,t],["exit",h,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=Wr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Ar(e,r-1,n-r+3,p),n=r+p.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function sT(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=io(r);let o;return u;function u(f){return o=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===o)return e.consume(f),h;const p=e.exit("attentionSequence"),m=io(f),x=!m||m===2&&a||n.includes(f),b=!a||a===2&&m||n.includes(r);return p._open=!!(o===42?x:x&&(a||!b)),p._close=!!(o===42?b:b&&(m||!x)),t(f)}}function p5(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iT={name:"autolink",tokenize:aT};function aT(e,t,n){let r=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 Zn(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Hn(y)?(r=1,h(y)):p(y)}function h(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||Hn(y))&&r++<32?(e.consume(y),h):(r=0,p(y))}function f(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||Oh(y)?n(y):(e.consume(y),f)}function p(y){return y===64?(e.consume(y),m):QA(y)?(e.consume(y),p):n(y)}function m(y){return Hn(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),r=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||Hn(y))&&r++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const au={partial:!0,tokenize:lT};function lT(e,t,n){return r;function r(o){return pt(o)?wt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Ie(o)?t(o):n(o)}}const zk={continuation:{tokenize:cT},exit:uT,name:"blockQuote",tokenize:oT};function oT(e,t,n){const r=this;return a;function a(u){if(u===62){const h=r.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return pt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function cT(e,t,n){const r=this;return a;function a(u){return pt(u)?wt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(zk,t,n)(u)}}function uT(e){e.exit("blockQuote")}const Bk={name:"characterEscape",tokenize:dT};function dT(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return KA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Pk={name:"characterReference",tokenize:hT};function hT(e,t,n){const r=this;let a=0,o,u;return h;function h(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),f}function f(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Hn,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=XA,m):(e.enter("characterReferenceValue"),o=7,u=gx,m(x))}function m(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Hn&&!rv(r.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 m5={partial:!0,tokenize:pT},g5={concrete:!0,name:"codeFenced",tokenize:fT};function fT(e,t,n){const r=this,a={partial:!0,tokenize:O};let o=0,u=0,h;return f;function f(D){return p(D)}function p(D){const U=r.events[r.events.length-1];return o=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,h=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(D)}function m(D){return D===h?(u++,e.consume(D),m):u<3?n(D):(e.exit("codeFencedFenceSequence"),pt(D)?wt(e,x,"whitespace")(D):x(D))}function x(D){return D===null||Ie(D)?(e.exit("codeFencedFence"),r.interrupt?t(D):e.check(m5,j,L)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(D))}function b(D){return D===null||Ie(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(D)):pt(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wt(e,y,"whitespace")(D)):D===96&&D===h?n(D):(e.consume(D),b)}function y(D){return D===null||Ie(D)?x(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(D))}function _(D){return D===null||Ie(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(D)):D===96&&D===h?n(D):(e.consume(D),_)}function j(D){return e.attempt(a,L,N)(D)}function N(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w}function w(D){return o>0&&pt(D)?wt(e,E,"linePrefix",o+1)(D):E(D)}function E(D){return D===null||Ie(D)?e.check(m5,j,L)(D):(e.enter("codeFlowValue"),C(D))}function C(D){return D===null||Ie(D)?(e.exit("codeFlowValue"),E(D)):(e.consume(D),C)}function L(D){return e.exit("codeFenced"),t(D)}function O(D,U,I){let W=0;return z;function z(Y){return D.enter("lineEnding"),D.consume(Y),D.exit("lineEnding"),q}function q(Y){return D.enter("codeFencedFence"),pt(Y)?wt(D,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):T(Y)}function T(Y){return Y===h?(D.enter("codeFencedFenceSequence"),ie(Y)):I(Y)}function ie(Y){return Y===h?(W++,D.consume(Y),ie):W>=u?(D.exit("codeFencedFenceSequence"),pt(Y)?wt(D,Z,"whitespace")(Y):Z(Y)):I(Y)}function Z(Y){return Y===null||Ie(Y)?(D.exit("codeFencedFence"),U(Y)):I(Y)}}}function pT(e,t,n){const r=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 r.parser.lazy[r.now().line]?n(u):t(u)}}const Wm={name:"codeIndented",tokenize:gT},mT={partial:!0,tokenize:xT};function gT(e,t,n){const r=this;return a;function a(p){return e.enter("codeIndented"),wt(e,o,"linePrefix",5)(p)}function o(p){const m=r.events[r.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?f(p):Ie(p)?e.attempt(mT,u,f)(p):(e.enter("codeFlowValue"),h(p))}function h(p){return p===null||Ie(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),h)}function f(p){return e.exit("codeIndented"),t(p)}}function xT(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):Ie(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):wt(e,o,"linePrefix",5)(u)}function o(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):Ie(u)?a(u):n(u)}}const vT={name:"codeText",previous:yT,resolve:bT,tokenize:_T};function bT(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function yT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _T(e,t,n){let r=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),h(x)}function h(x){return x===96?(e.consume(x),r++,h):(e.exit("codeTextSequence"),f(x))}function f(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),f):x===96?(o=e.enter("codeTextSequence"),a=0,m(x)):Ie(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||Ie(x)?(e.exit("codeTextData"),f(x)):(e.consume(x),p)}function m(x){return x===96?(e.consume(x),a++,m):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(o.type="codeTextData",p(x))}}class wT{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 r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&yc(this.left,r),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),yc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yc(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);yc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yc(this.left,n.reverse())}}}function yc(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 $k(e){const t={};let n=-1,r,a,o,u,h,f,p;const m=new wT(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,o=0,o<f.length&&f[o][1].type==="lineEndingBlank"&&(o+=2),o<f.length&&f[o][1].type==="content"))for(;++o<f.length&&f[o][1].type!=="content";)f[o][1].type==="chunkText"&&(f[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,kT(m,n)),n=t[n],p=!0);else if(r[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&&(r[1].end={...m.get(a)[1].start},h=m.slice(a,n),h.unshift(r),m.splice(a,n-a+1,h))}}return Ar(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!p}function kT(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,f=[],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=r.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<h.length;)h[b][0]==="exit"&&h[b-1][0]==="enter"&&h[b][1].type===h[b-1][1].type&&h[b][1].start.line!==h[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 w=h.slice(N[b],N[b+1]),E=o.pop();f.push([E,E+w.length-1]),e.splice(E,2,w)}for(f.reverse(),b=-1;++b<f.length;)p[_+f[b][0]]=_+f[b][1],_+=f[b][1]-f[b][0]-1;return p}const ST={resolve:NT,tokenize:CT},jT={partial:!0,tokenize:ET};function NT(e){return $k(e),e}function CT(e,t){let n;return r;function r(h){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(h)}function a(h){return h===null?o(h):Ie(h)?e.check(jT,u,o)(h):(e.consume(h),a)}function o(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function u(h){return e.consume(h),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function ET(e,t,n){const r=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),wt(e,o,"linePrefix")}function o(u){if(u===null||Ie(u))return n(u);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Fk(e,t,n,r,a,o,u,h,f){const p=f||Number.POSITIVE_INFINITY;let m=0;return x;function x(w){return w===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(w),e.exit(o),b):w===null||w===32||w===41||Oh(w)?n(w):(e.enter(r),e.enter(u),e.enter(h),e.enter("chunkString",{contentType:"string"}),j(w))}function b(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(a),e.exit(r),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(h),b(w)):w===null||w===60||Ie(w)?n(w):(e.consume(w),w===92?_:y)}function _(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function j(w){return!m&&(w===null||w===41||Ht(w))?(e.exit("chunkString"),e.exit(h),e.exit(u),e.exit(r),t(w)):m<p&&w===40?(e.consume(w),m++,j):w===41?(e.consume(w),m--,j):w===null||w===32||w===40||Oh(w)?n(w):(e.consume(w),w===92?N:j)}function N(w){return w===40||w===41||w===92?(e.consume(w),j):j(w)}}function Uk(e,t,n,r,a,o){const u=this;let h=0,f;return p;function p(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(o),m}function m(y){return h>999||y===null||y===91||y===93&&!f||y===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):Ie(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||Ie(y)||h++>999?(e.exit("chunkString"),m(y)):(e.consume(y),f||(f=!pt(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),h++,x):x(y)}}function Ik(e,t,n,r,a,o){let u;return h;function h(b){return b===34||b===39||b===40?(e.enter(r),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,f):n(b)}function f(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(r),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),f(u)):b===null?n(b):Ie(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),wt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===u||b===null||Ie(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 $c(e,t){let n;return r;function r(a){return Ie(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):pt(a)?wt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const AT={name:"definition",tokenize:MT},TT={partial:!0,tokenize:RT};function MT(e,t,n){const r=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return Uk.call(r,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return a=os(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Ht(y)?$c(e,p)(y):p(y)}function p(y){return Fk(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(TT,x,x)(y)}function x(y){return pt(y)?wt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Ie(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function RT(e,t,n){return r;function r(h){return Ht(h)?$c(e,a)(h):n(h)}function a(h){return Ik(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function o(h){return pt(h)?wt(e,u,"whitespace")(h):u(h)}function u(h){return h===null||Ie(h)?t(h):n(h)}}const LT={name:"hardBreakEscape",tokenize:DT};function DT(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Ie(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const OT={name:"headingAtx",resolve:zT,tokenize:BT};function zT(e,t){let n=e.length-2,r=3,a,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ar(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function BT(e,t,n){let r=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&&r++<6?(e.consume(m),u):m===null||Ht(m)?(e.exit("atxHeadingSequence"),h(m)):n(m)}function h(m){return m===35?(e.enter("atxHeadingSequence"),f(m)):m===null||Ie(m)?(e.exit("atxHeading"),t(m)):pt(m)?wt(e,h,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function f(m){return m===35?(e.consume(m),f):(e.exit("atxHeadingSequence"),h(m))}function p(m){return m===null||m===35||Ht(m)?(e.exit("atxHeadingText"),h(m)):(e.consume(m),p)}}const PT=["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"],x5=["pre","script","style","textarea"],$T={concrete:!0,name:"htmlFlow",resolveTo:IT,tokenize:HT},FT={partial:!0,tokenize:VT},UT={partial:!0,tokenize:qT};function IT(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 HT(e,t,n){const r=this;let a,o,u,h,f;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,r.interrupt?t:R):Zn(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,h=0,_):Zn(M)?(e.consume(M),a=4,r.interrupt?t:R):n(M)}function y(M){return M===45?(e.consume(M),r.interrupt?t:R):n(M)}function _(M){const me="CDATA[";return M===me.charCodeAt(h++)?(e.consume(M),h===me.length?r.interrupt?t:T:_):n(M)}function j(M){return Zn(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function N(M){if(M===null||M===47||M===62||Ht(M)){const me=M===47,be=u.toLowerCase();return!me&&!o&&x5.includes(be)?(a=1,r.interrupt?t(M):T(M)):PT.includes(u.toLowerCase())?(a=6,me?(e.consume(M),w):r.interrupt?t(M):T(M)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):o?E(M):C(M))}return M===45||Hn(M)?(e.consume(M),u+=String.fromCharCode(M),N):n(M)}function w(M){return M===62?(e.consume(M),r.interrupt?t:T):n(M)}function E(M){return pt(M)?(e.consume(M),E):z(M)}function C(M){return M===47?(e.consume(M),z):M===58||M===95||Zn(M)?(e.consume(M),L):pt(M)?(e.consume(M),C):z(M)}function L(M){return M===45||M===46||M===58||M===95||Hn(M)?(e.consume(M),L):O(M)}function O(M){return M===61?(e.consume(M),D):pt(M)?(e.consume(M),O):C(M)}function D(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),f=M,U):pt(M)?(e.consume(M),D):I(M)}function U(M){return M===f?(e.consume(M),f=null,W):M===null||Ie(M)?n(M):(e.consume(M),U)}function I(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Ht(M)?O(M):(e.consume(M),I)}function W(M){return M===47||M===62||pt(M)?C(M):n(M)}function z(M){return M===62?(e.consume(M),q):n(M)}function q(M){return M===null||Ie(M)?T(M):pt(M)?(e.consume(M),q):n(M)}function T(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):Ie(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(FT,X,ie)(M)):M===null||Ie(M)?(e.exit("htmlFlowData"),ie(M)):(e.consume(M),T)}function ie(M){return e.check(UT,Z,X)(M)}function Z(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),Y}function Y(M){return M===null||Ie(M)?ie(M):(e.enter("htmlFlowData"),T(M))}function P(M){return M===45?(e.consume(M),R):T(M)}function $(M){return M===47?(e.consume(M),u="",re):T(M)}function re(M){if(M===62){const me=u.toLowerCase();return x5.includes(me)?(e.consume(M),B):T(M)}return Zn(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),re):T(M)}function ae(M){return M===93?(e.consume(M),R):T(M)}function R(M){return M===62?(e.consume(M),B):M===45&&a===2?(e.consume(M),R):T(M)}function B(M){return M===null||Ie(M)?(e.exit("htmlFlowData"),X(M)):(e.consume(M),B)}function X(M){return e.exit("htmlFlow"),t(M)}}function qT(e,t,n){const r=this;return a;function a(u){return Ie(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function VT(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(au,t,n)}}const GT={name:"htmlText",tokenize:YT};function YT(e,t,n){const r=this;let a,o,u;return h;function h(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),f}function f(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),O):R===63?(e.consume(R),C):Zn(R)?(e.consume(R),I):n(R)}function p(R){return R===45?(e.consume(R),m):R===91?(e.consume(R),o=0,_):Zn(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):Ie(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):Ie(R)?(u=j,$(R)):(e.consume(R),j)}function N(R){return R===93?(e.consume(R),w):j(R)}function w(R){return R===62?P(R):R===93?(e.consume(R),w):j(R)}function E(R){return R===null||R===62?P(R):Ie(R)?(u=E,$(R)):(e.consume(R),E)}function C(R){return R===null?n(R):R===63?(e.consume(R),L):Ie(R)?(u=C,$(R)):(e.consume(R),C)}function L(R){return R===62?P(R):C(R)}function O(R){return Zn(R)?(e.consume(R),D):n(R)}function D(R){return R===45||Hn(R)?(e.consume(R),D):U(R)}function U(R){return Ie(R)?(u=U,$(R)):pt(R)?(e.consume(R),U):P(R)}function I(R){return R===45||Hn(R)?(e.consume(R),I):R===47||R===62||Ht(R)?W(R):n(R)}function W(R){return R===47?(e.consume(R),P):R===58||R===95||Zn(R)?(e.consume(R),z):Ie(R)?(u=W,$(R)):pt(R)?(e.consume(R),W):P(R)}function z(R){return R===45||R===46||R===58||R===95||Hn(R)?(e.consume(R),z):q(R)}function q(R){return R===61?(e.consume(R),T):Ie(R)?(u=q,$(R)):pt(R)?(e.consume(R),q):W(R)}function T(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,ie):Ie(R)?(u=T,$(R)):pt(R)?(e.consume(R),T):(e.consume(R),Z)}function ie(R){return R===a?(e.consume(R),a=void 0,Y):R===null?n(R):Ie(R)?(u=ie,$(R)):(e.consume(R),ie)}function Z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Ht(R)?W(R):(e.consume(R),Z)}function Y(R){return R===47||R===62||Ht(R)?W(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"),re}function re(R){return pt(R)?wt(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ae(R)}function ae(R){return e.enter("htmlTextData"),u(R)}}const sv={name:"labelEnd",resolveAll:KT,resolveTo:ZT,tokenize:JT},WT={tokenize:eM},QT={tokenize:tM},XT={tokenize:nM};function KT(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Ar(e,0,e.length,n),e}function ZT(e,t){let n=e.length,r=0,a,o,u,h;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")){r=2;break}}else a.type==="labelEnd"&&(u=n);const f={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+r+2][1].end},end:{...e[u-2][1].start}};return h=[["enter",f,t],["enter",p,t]],h=Wr(h,e.slice(o+1,o+r+3)),h=Wr(h,[["enter",m,t]]),h=Wr(h,Qh(t.parser.constructs.insideSpan.null,e.slice(o+r+4,u-3),t)),h=Wr(h,[["exit",m,t],e[u-2],e[u-1],["exit",p,t]]),h=Wr(h,e.slice(u+1)),h=Wr(h,[["exit",f,t]]),Ar(e,o,e.length,h),e}function JT(e,t,n){const r=this;let a=r.events.length,o,u;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){o=r.events[a][1];break}return h;function h(b){return o?o._inactive?x(b):(u=r.parser.defined.includes(os(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),f):n(b)}function f(b){return b===40?e.attempt(WT,m,u?m:x)(b):b===91?e.attempt(QT,m,u?p:x)(b):u?m(b):x(b)}function p(b){return e.attempt(XT,m,x)(b)}function m(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function eM(e,t,n){return r;function r(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return Ht(x)?$c(e,o)(x):o(x)}function o(x){return x===41?m(x):Fk(e,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return Ht(x)?$c(e,f)(x):m(x)}function h(x){return n(x)}function f(x){return x===34||x===39||x===40?Ik(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):m(x)}function p(x){return Ht(x)?$c(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 tM(e,t,n){const r=this;return a;function a(h){return Uk.call(r,e,o,u,"reference","referenceMarker","referenceString")(h)}function o(h){return r.parser.defined.includes(os(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function u(h){return n(h)}}function nM(e,t,n){return r;function r(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 rM={name:"labelStartImage",resolveAll:sv.resolveAll,tokenize:sM};function sM(e,t,n){const r=this;return a;function a(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),o}function o(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),u):n(h)}function u(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(h):t(h)}}const iM={name:"labelStartLink",resolveAll:sv.resolveAll,tokenize:aM};function aM(e,t,n){const r=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 r.parser.constructs?n(u):t(u)}}const Qm={name:"lineEnding",tokenize:lM};function lM(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),wt(e,t,"linePrefix")}}const lh={name:"thematicBreak",tokenize:oM};function oM(e,t,n){let r=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,h(p)}function h(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):r>=3&&(p===null||Ie(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),r++,f):(e.exit("thematicBreakSequence"),pt(p)?wt(e,h,"whitespace")(p):h(p))}}const or={continuation:{tokenize:hM},exit:pM,name:"list",tokenize:dM},cM={partial:!0,tokenize:mM},uM={partial:!0,tokenize:fM};function dM(e,t,n){const r=this,a=r.events[r.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return h;function h(y){const _=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:gx(y)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(lh,n,p)(y):p(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return gx(y)&&++u<10?(e.consume(y),f):(!r.interrupt||u<2)&&(r.containerState.marker?y===r.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"),r.containerState.marker=r.containerState.marker||y,e.check(au,r.interrupt?n:m,e.attempt(cM,b,x))}function m(y){return r.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return pt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function hM(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(au,a,o);function a(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,wt(e,t,"listItemIndent",r.containerState.size+1)(h)}function o(h){return r.containerState.furtherBlankLines||!pt(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(uM,t,u)(h))}function u(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,wt(e,e.attempt(or,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function fM(e,t,n){const r=this;return wt(e,a,"listItemIndent",r.containerState.size+1);function a(o){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(o):n(o)}}function pM(e){e.exit(this.containerState.type)}function mM(e,t,n){const r=this;return wt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=r.events[r.events.length-1];return!pt(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const v5={name:"setextUnderline",resolveTo:gM,tokenize:xM};function gM(e,t){let n=e.length,r,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=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[r][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[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function xM(e,t,n){const r=this;let a;return o;function o(p){let m=r.events.length,x;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){x=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||x)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===a?(e.consume(p),h):(e.exit("setextHeadingLineSequence"),pt(p)?wt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Ie(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const vM={tokenize:bM};function bM(e){const t=this,n=e.attempt(au,r,e.attempt(this.parser.constructs.flowInitial,a,wt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(ST,a)),"linePrefix")));return n;function r(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 yM={resolveAll:qk()},_M=Hk("string"),wM=Hk("text");function Hk(e){return{resolveAll:qk(e==="text"?kM:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,u,h);return u;function u(m){return p(m)?o(m):h(m)}function h(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),f}function f(m){return p(m)?(n.exit("data"),o(m)):(n.consume(m),f)}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(r,r.previous))return!0}return!1}}}function qk(e){return t;function t(n,r){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,r):n}}function kM(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 r=e[n-1][1],a=t.sliceStream(r);let o=a.length,u=-1,h=0,f;for(;o--;){const p=a[o];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)h++,u--;if(u)break;u=-1}else if(p===-2)f=!0,h++;else if(p!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(h=0),h){const p={type:n===e.length||f||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:r.start._bufferIndex+u,_index:r.start._index+o,line:r.end.line,column:r.end.column-h,offset:r.end.offset-h},end:{...r.end}};r.end={...p.start},r.start.offset===r.end.offset?Object.assign(r,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const SM={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:zk},jM={91:AT},NM={[-2]:Wm,[-1]:Wm,32:Wm},CM={35:OT,42:lh,45:[v5,lh],60:$T,61:v5,95:lh,96:g5,126:g5},EM={38:Pk,92:Bk},AM={[-5]:Qm,[-4]:Qm,[-3]:Qm,33:rM,38:Pk,42:xx,60:[iT,GT],91:iM,92:[LT,Bk],93:sv,95:xx,96:vT},TM={null:[xx,yM]},MM={null:[42,95]},RM={null:[]},LM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:MM,contentInitial:jM,disable:RM,document:SM,flow:CM,flowInitial:NM,insideSpan:TM,string:EM,text:AM},Symbol.toStringTag,{value:"Module"}));function DM(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],h=[];const f={attempt:U(O),check:U(D),consume:E,enter:C,exit:L,interrupt:U(D,{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,f);return t.resolveAll&&o.push(t),p;function x(q){return u=Wr(u,q),N(),u[u.length-1]!==null?[]:(I(t,0),p.events=Qh(o,p.events,p),p.events)}function b(q,T){return zM(y(q),T)}function y(q){return OM(u,q)}function _(){const{_bufferIndex:q,_index:T,line:ie,column:Z,offset:Y}=r;return{_bufferIndex:q,_index:T,line:ie,column:Z,offset:Y}}function j(q){a[q.line]=q.column,z()}function N(){let q;for(;r._index<u.length;){const T=u[r._index];if(typeof T=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<T.length;)w(T.charCodeAt(r._bufferIndex));else w(T)}}function w(q){m=m(q)}function E(q){Ie(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,z()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=q}function C(q,T){const ie=T||{};return ie.type=q,ie.start=_(),p.events.push(["enter",ie,p]),h.push(ie),ie}function L(q){const T=h.pop();return T.end=_(),p.events.push(["exit",T,p]),T}function O(q,T){I(q,T.from)}function D(q,T){T.restore()}function U(q,T){return ie;function ie(Z,Y,P){let $,re,ae,R;return Array.isArray(Z)?X(Z):"tokenize"in Z?X([Z]):B(Z);function B(Ce){return De;function De(Ee){const Ae=Ee!==null&&Ce[Ee],Fe=Ee!==null&&Ce.null,dt=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return X(dt)(Ee)}}function X(Ce){return $=Ce,re=0,Ce.length===0?P:M(Ce[re])}function M(Ce){return De;function De(Ee){return R=W(),ae=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?be():Ce.tokenize.call(T?Object.assign(Object.create(p),T):p,f,me,be)(Ee)}}function me(Ce){return q(ae,R),Y}function be(Ce){return R.restore(),++re<$.length?M($[re]):P}}}function I(q,T){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&Ar(p.events,T,p.events.length-T,q.resolve(p.events.slice(T),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function W(){const q=_(),T=p.previous,ie=p.currentConstruct,Z=p.events.length,Y=Array.from(h);return{from:Z,restore:P};function P(){r=q,p.previous=T,p.currentConstruct=ie,p.events.length=Z,h=Y,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function OM(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(r,o)];else{if(u=e.slice(n,a),r>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(r):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function zM(e,t){let n=-1;const r=[];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,r.push(u)}return r.join("")}function BM(e){const r={constructs:Dk([LM,...(e||{}).extensions||[]]),content:a(ZA),defined:[],document:a(eT),flow:a(vM),lazy:{},string:a(_M),text:a(wM)};return r;function a(o){return u;function u(h){return DM(r,o,h)}}}function PM(e){for(;!$k(e););return e}const b5=/[\0\t\n\r]/g;function $M(){let e=1,t="",n=!0,r;return a;function a(o,u,h){const f=[];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(b5.lastIndex=x,p=b5.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&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),x<b&&(f.push(o.slice(x,b)),e+=b-x),y){case 0:{f.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,f.push(-2);e++<m;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}x=b+1}return h&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const FM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function UM(e){return e.replace(FM,IM)}function IM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return Ok(n.slice(o?2:1),o?16:10)}return rv(n)||e}const Vk={}.hasOwnProperty;function HM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),qM(n)(PM(BM(n).document().write($M()(e,t,!0))))}function qM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(gt),autolinkProtocol:W,autolinkEmail:W,atxHeading:o(rt),blockQuote:o(Fe),characterEscape:W,characterReference:W,codeFenced:o(dt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(dt,u),codeText:o(Je,u),codeTextData:W,data:W,codeFlowValue:W,definition:o(At),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(mt),hardBreakEscape:o(Dt),hardBreakTrailing:o(Dt),htmlFlow:o(we,u),htmlFlowData:W,htmlText:o(we,u),htmlTextData:W,image:o(Ge),label:u,link:o(gt),listItem:o(je),listItemValue:b,listOrdered:o(_n,x),listUnordered:o(_n),paragraph:o(Be),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(rt),strong:o(yt),thematicBreak:o(Xr)},exit:{atxHeading:f(),atxHeadingSequence:O,autolink:f(),autolinkEmail:Ae,autolinkProtocol:Ee,blockQuote:f(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:Ce,characterReference:De,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:z,codeIndented:f(w),codeText:f(Y),codeTextData:z,data:z,definition:f(),definitionDestinationString:L,definitionLabelString:E,definitionTitleString:C,emphasis:f(),hardBreakEscape:f(T),hardBreakTrailing:f(T),htmlFlow:f(ie),htmlFlowData:z,htmlText:f(Z),htmlTextData:z,image:f($),label:ae,labelText:re,lineEnding:q,link:f(P),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:me,resourceDestinationString:R,resourceTitleString:B,resource:X,setextHeading:f(I),setextHeadingLineSequence:U,setextHeadingText:D,strong:f(),thematicBreak:f()}};Gk(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ke={type:"root",children:[]};const Q={stack:[ke],tokenStack:[],config:t,enter:h,exit:p,buffer:u,resume:m,data:n},xe=[];let Oe=-1;for(;++Oe<oe.length;)if(oe[Oe][1].type==="listOrdered"||oe[Oe][1].type==="listUnordered")if(oe[Oe][0]==="enter")xe.push(Oe);else{const Xe=xe.pop();Oe=a(oe,Xe,Oe)}for(Oe=-1;++Oe<oe.length;){const Xe=t[oe[Oe][0]];Vk.call(Xe,oe[Oe][1].type)&&Xe[oe[Oe][1].type].call(Object.assign({sliceSerialize:oe[Oe][2].sliceSerialize},Q),oe[Oe][1])}if(Q.tokenStack.length>0){const Xe=Q.tokenStack[Q.tokenStack.length-1];(Xe[1]||y5).call(Q,void 0,Xe[0])}for(ke.position={start:Ui(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Ui(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe<t.transforms.length;)ke=t.transforms[Oe](ke)||ke;return ke}function a(oe,ke,Q){let xe=ke-1,Oe=-1,Xe=!1,lt,ot,Et,wn;for(;++xe<=Q;){const st=oe[xe];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?Oe++:Oe--,wn=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(lt&&!wn&&!Oe&&!Et&&(Et=xe),wn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wn=void 0}if(!Oe&&st[0]==="enter"&&st[1].type==="listItemPrefix"||Oe===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(lt){let fr=xe;for(ot=void 0;fr--;){const Bn=oe[fr];if(Bn[1].type==="lineEnding"||Bn[1].type==="lineEndingBlank"){if(Bn[0]==="exit")continue;ot&&(oe[ot][1].type="lineEndingBlank",Xe=!0),Bn[1].type="lineEnding",ot=fr}else if(!(Bn[1].type==="linePrefix"||Bn[1].type==="blockQuotePrefix"||Bn[1].type==="blockQuotePrefixWhitespace"||Bn[1].type==="blockQuoteMarker"||Bn[1].type==="listItemIndent"))break}Et&&(!ot||Et<ot)&&(lt._spread=!0),lt.end=Object.assign({},ot?oe[ot][1].start:st[1].end),oe.splice(ot||xe,0,["exit",lt,st[2]]),xe++,Q++}if(st[1].type==="listItemPrefix"){const fr={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};lt=fr,oe.splice(xe,0,["enter",fr,st[2]]),xe++,Q++,Et=void 0,wn=!0}}}return oe[ke][1]._spread=Xe,Q}function o(oe,ke){return Q;function Q(xe){h.call(this,oe(xe),xe),ke&&ke.call(this,xe)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(oe,ke,Q){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ke,Q||void 0]),oe.position={start:Ui(ke.start),end:void 0}}function f(oe){return ke;function ke(Q){oe&&oe.call(this,Q),p.call(this,Q)}}function p(oe,ke){const Q=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==oe.type&&(ke?ke.call(this,oe,xe[0]):(xe[1]||y5).call(this,oe,xe[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Pc({start:oe.start,end:oe.end})+"): it’s not open");Q.position.end=Ui(oe.end)}function m(){return nv(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=oe}function _(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe.replace(/(\r?\n|\r)$/g,"")}function E(oe){const ke=this.resume(),Q=this.stack[this.stack.length-1];Q.label=ke,Q.identifier=os(this.sliceSerialize(oe)).toLowerCase()}function C(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=oe}function L(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=oe}function O(oe){const ke=this.stack[this.stack.length-1];if(!ke.depth){const Q=this.sliceSerialize(oe).length;ke.depth=Q}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function U(oe){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function W(oe){const Q=this.stack[this.stack.length-1].children;let xe=Q[Q.length-1];(!xe||xe.type!=="text")&&(xe=Te(),xe.position={start:Ui(oe.start),end:void 0},Q.push(xe)),this.stack.push(xe)}function z(oe){const ke=this.stack.pop();ke.value+=this.sliceSerialize(oe),ke.position.end=Ui(oe.end)}function q(oe){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=ke.children[ke.children.length-1];Q.position.end=Ui(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(W.call(this,oe),z.call(this,oe))}function T(){this.data.atHardBreak=!0}function ie(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function Z(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function Y(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function P(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ke,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 ke=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ke,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function re(oe){const ke=this.sliceSerialize(oe),Q=this.stack[this.stack.length-2];Q.label=UM(ke),Q.identifier=os(ke).toLowerCase()}function ae(){const oe=this.stack[this.stack.length-1],ke=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const xe=oe.children;Q.children=xe}else Q.alt=ke}function R(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=oe}function B(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=oe}function X(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function me(oe){const ke=this.resume(),Q=this.stack[this.stack.length-1];Q.label=ke,Q.identifier=os(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function be(oe){this.data.characterReferenceType=oe.type}function Ce(oe){const ke=this.sliceSerialize(oe),Q=this.data.characterReferenceType;let xe;Q?(xe=Ok(ke,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=rv(ke);const Oe=this.stack[this.stack.length-1];Oe.value+=xe}function De(oe){const ke=this.stack.pop();ke.position.end=Ui(oe.end)}function Ee(oe){z.call(this,oe);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(oe)}function Ae(oe){z.call(this,oe);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(oe)}function Fe(){return{type:"blockquote",children:[]}}function dt(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function At(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function mt(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function Dt(){return{type:"break"}}function we(){return{type:"html",value:""}}function Ge(){return{type:"image",title:null,url:"",alt:null}}function gt(){return{type:"link",title:null,url:"",children:[]}}function _n(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 Be(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function Xr(){return{type:"thematicBreak"}}}function Ui(e){return{line:e.line,column:e.column,offset:e.offset}}function Gk(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Gk(e,r):VM(e,r)}}function VM(e,t){let n;for(n in t)if(Vk.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function y5(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Pc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Pc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Pc({start:t.start,end:t.end})+") is still open")}function GM(e){const t=this;t.parser=n;function n(r){return HM(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function YM(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 WM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
-
`}]}function QM(e,t){const n=t.value?t.value+`
|
|
76
|
-
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:r,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 XM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=co(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let u,h=e.footnoteCounts.get(r);h===void 0?(h=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=o+1,h+=1,e.footnoteCounts.set(r,h);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function JM(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 e8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Yk(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];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+=r:a.push({type:"text",value:r}),a}function t8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Yk(e,t);const a={src:co(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function n8(e,t){const n={src:co(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 r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function r8(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function s8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Yk(e,t);const a={href:co(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function i8(e,t){const n={href:co(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function a8(e,t,n){const r=e.all(t),a=n?l8(n):Wk(t),o={},u=[];if(typeof t.checked=="boolean"){const m=r[0];let x;m&&m.type==="element"&&m.tagName==="p"?x=m:(x={type:"element",tagName:"p",properties:{},children:[]},r.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 h=-1;for(;++h<r.length;){const m=r[h];(a||h!==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 f=r[r.length-1];f&&(a||f.type!=="element"||f.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 l8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Wk(n[r])}return t}function Wk(e){const t=e.spread;return t??e.children.length>1}function o8(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const u=r[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(r,!0)};return e.patch(t,o),e.applyData(t,o)}function c8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function d8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function h8(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!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)},h=Zx(t.children[1]),f=Ck(t.children[t.children.length-1]);h&&f&&(u.position={start:h,end:f}),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 f8(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,h=u?u.length:t.children.length;let f=-1;const p=[];for(;++f<h;){const x=t.children[f],b={},y=u?u[f]: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 p8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const _5=9,w5=32;function m8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(k5(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(k5(t.slice(a),a>0,!1)),o.join("")}function k5(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===_5||o===w5;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===_5||o===w5;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function g8(e,t){const n={type:"text",value:m8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function x8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const v8={blockquote:YM,break:WM,code:QM,delete:XM,emphasis:KM,footnoteReference:ZM,heading:JM,html:e8,imageReference:t8,image:n8,inlineCode:r8,linkReference:s8,link:i8,listItem:a8,list:o8,paragraph:c8,root:u8,strong:d8,table:h8,tableCell:p8,tableRow:f8,text:g8,thematicBreak:x8,toml:Hd,yaml:Hd,definition:Hd,footnoteDefinition:Hd};function Hd(){}const Qk=-1,Xh=0,Fc=1,zh=2,iv=3,av=4,lv=5,ov=6,Xk=7,Kk=8,{defineProperty:b8}=Object,Zk=typeof self=="object"?self:globalThis,S5=(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 Zk[e](t)},y8=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),r=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Xh:case Qk:return n(u,a);case Fc:{const h=n([],a);for(const f of u)h.push(r(f));return h}case zh:{const h=n({},a);for(const[f,p]of u){const m=r(f),x=r(p);m==="__proto__"?b8(h,m,{value:x,configurable:!0,enumerable:!0,writable:!0}):h[m]=x}return h}case iv:return n(new Date(u),a);case av:{const{source:h,flags:f}=u;return n(new RegExp(h,f),a)}case lv:{const h=n(new Map,a);for(const[f,p]of u)h.set(r(f),r(p));return h}case ov:{const h=n(new Set,a);for(const f of u)h.add(r(f));return h}case Xk:{const{name:h,message:f}=u;return n(typeof Zk[h]=="function"?S5(h,f):new Error(f),a)}case Kk: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:h}=new Uint8Array(u);return n(new DataView(h),u)}case"-0":return-0}return n(S5(o,u),a)};return r},j5=e=>y8(new Map,e)(0),Ra="",{toString:_8}={},{keys:w8,is:k8}=Object,_c=e=>{const t=typeof e;if(t!=="object"||!e)return[Xh,t];const n=_8.call(e).slice(8,-1);switch(n){case"Array":return[Fc,Ra];case"Object":return[zh,Ra];case"Date":return[iv,Ra];case"RegExp":return[av,Ra];case"Map":return[lv,Ra];case"Set":return[ov,Ra];case"DataView":return[Fc,n]}return n.includes("Array")?[Fc,n]:e instanceof Error?[Xk,e.name||"Error"]:[zh,n]},qd=([e,t])=>e===Xh&&(t==="function"||t==="symbol"),S8=(e,t,n,r)=>{const a=(u,h)=>{const f=r.push(u)-1;return n.set(h,f),f},o=u=>{if(n.has(u))return n.get(u);let[h,f]=_c(u);switch(h){case Xh:{let m=u;switch(f){case"bigint":h=Kk,m=u.toString();break;case"number":if(!u&&k8(u,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return a([Qk],u)}return a([h,m],u)}case Fc:{if(f){let b=u;return f==="DataView"?b=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(u)),a([f,[...b]],u)}const m=[],x=a([h,m],u);for(const b of u)m.push(o(b));return x}case zh:{if(f)switch(f){case"BigInt":return a([f,u.toString()],u);case"Boolean":case"Number":case"String":return a([f,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const m=[],x=a([h,m],u);for(const b of w8(u))(e||!qd(_c(u[b])))&&m.push([o(b),o(u[b])]);return x}case iv:return a([h,isNaN(u.getTime())?Ra:u.toISOString()],u);case av:{const{source:m,flags:x}=u;return a([h,{source:m,flags:x}],u)}case lv:{const m=[],x=a([h,m],u);for(const[b,y]of u)(e||!(qd(_c(b))||qd(_c(y))))&&m.push([o(b),o(y)]);return x}case ov:{const m=[],x=a([h,m],u);for(const b of u)(e||!qd(_c(b)))&&m.push(o(b));return x}}const{message:p}=u;return a([h,{name:f,message:p}],u)};return o},N5=(e,{json:t,lossy:n}={})=>{const r=[];return S8(!(t||n),!!t,new Map,r)(e),r},Bh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?j5(N5(e,t)):structuredClone(e):(e,t)=>j5(N5(e,t));function j8(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 N8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function C8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||j8,r=e.options.footnoteBackLabel||N8,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const m=e.all(p),x=String(p.identifier).toUpperCase(),b=co(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(f,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 r=="string"?r:r(f,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 w={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(m,!0)};e.patch(p,w),h.push(w)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Bh(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
79
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
80
|
-
`}]}}const Kh=(function(e){if(e==null)return M8;if(typeof e=="function")return Zh(e);if(typeof e=="object")return Array.isArray(e)?E8(e):A8(e);if(typeof e=="string")return T8(e);throw new Error("Expected function, string, or object as test")});function E8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Kh(e[n]);return Zh(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function A8(e){const t=e;return Zh(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function T8(e){return Zh(t);function t(n){return n&&n.type===e}}function Zh(e){return t;function t(n,r,a){return!!(R8(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function M8(){return!0}function R8(e){return e!==null&&typeof e=="object"&&"type"in e}const Jk=[],L8=!0,vx=!1,D8="skip";function eS(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const o=Kh(a),u=r?-1:1;h(e,void 0,[])();function h(f,p,m){const x=f&&typeof f=="object"?f:{};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 ("+(f.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=Jk,_,j,N;if((!t||o(f,p,m[m.length-1]||void 0))&&(y=O8(n(f,m)),y[0]===vx))return y;if("children"in f&&f.children){const w=f;if(w.children&&y[0]!==D8)for(j=(r?w.children.length:-1)+u,N=m.concat(w);j>-1&&j<w.children.length;){const E=w.children[j];if(_=h(E,j,N)(),_[0]===vx)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function O8(e){return Array.isArray(e)?e:typeof e=="number"?[L8,e]:e==null?Jk:[e]}function cv(e,t,n,r){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=r),eS(e,o,h,a);function h(f,p){const m=p[p.length-1],x=m?m.children.indexOf(f):void 0;return u(f,x,m)}}const bx={}.hasOwnProperty,z8={};function B8(e,t){const n=t||z8,r=new Map,a=new Map,o=new Map,u={...v8,...n.handlers},h={all:p,applyData:$8,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:f,options:n,patch:P8,wrap:U8};return cv(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const x=m.type==="definition"?r:a,b=String(m.identifier).toUpperCase();x.has(b)||x.set(b,m)}}),h;function f(m,x){const b=m.type,y=h.handlers[b];if(bx.call(h.handlers,b)&&y)return y(h,m,x);if(h.options.passThrough&&h.options.passThrough.includes(b)){if("children"in m){const{children:j,...N}=m,w=Bh(N);return w.children=h.all(m),w}return Bh(m)}return(h.options.unknownHandler||F8)(h,m,x)}function p(m){const x=[];if("children"in m){const b=m.children;let y=-1;for(;++y<b.length;){const _=h.one(b[y],m);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=C5(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=C5(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function P8(e,t){e.position&&(t.position=SA(e))}function $8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,Bh(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function F8(e,t){const n=t.data||{},r="value"in t&&!(bx.call(n,"hProperties")||bx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function U8(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
81
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
82
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
83
|
-
`}),n}function C5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function E5(e,t){const n=B8(e,t),r=n.one(e,void 0),a=C8(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
84
|
-
`},a),o}function I8(e,t){return e&&"run"in e?async function(n,r){const a=E5(n,{file:r,...t});await e.run(a,r)}:function(n,r){return E5(n,{file:r,...e||t})}}function A5(e){if(e)throw e}var Xm,T5;function H8(){if(T5)return Xm;T5=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=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},h=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(r)return r(p,m).value}else return;return p[m]};return Xm=function f(){var p,m,x,b,y,_,j=arguments[0],N=1,w=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<w;++N)if(p=arguments[N],p!=null)for(m in p)x=h(j,m),b=h(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:f(E,_,b)})):typeof b<"u"&&u(j,{name:m,newValue:b}));return j},Xm}var q8=H8();const Km=Nx(q8);function yx(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 V8(){const e=[],t={run:n,use:r};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);h(null,...a);function h(f,...p){const m=e[++o];let x=-1;if(f){u(f);return}for(;++x<a.length;)(p[x]===null||p[x]===void 0)&&(p[x]=a[x]);a=p,m?G8(m,h)(...p):u(null,...p)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function G8(e,t){let n;return r;function r(...u){const h=e.length>u.length;let f;h&&u.push(a);try{f=e.apply(this,u)}catch(p){const m=p;if(h&&n)throw m;return a(m)}h||(f&&f.then&&typeof f.then=="function"?f.then(o,a):f instanceof Error?a(f):o(f))}function a(u,...h){n||(n=!0,t(u,...h))}function o(u){a(null,u)}}const ks={basename:Y8,dirname:W8,extname:Q8,join:X8,sep:"/"};function Y8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');lu(e);let n=0,r=-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 r<0&&(o=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,h=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),h>-1&&(e.codePointAt(a)===t.codePointAt(h--)?h<0&&(r=a):(h=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function W8(e){if(lu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Q8(e){lu(e);let t=e.length,n=-1,r=0,a=-1,o=0,u;for(;t--;){const h=e.codePointAt(t);if(h===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),h===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===r+1?"":e.slice(a,n)}function X8(...e){let t=-1,n;for(;++t<e.length;)lu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":K8(n)}function K8(e){lu(e);const t=e.codePointAt(0)===47;let n=Z8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Z8(e,t){let n="",r=0,a=-1,o=0,u=-1,h,f;for(;++u<=e.length;){if(u<e.length)h=e.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",r=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,o=0}else h===46&&o>-1?o++:o=-1}return n}function lu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const J8={cwd:e7};function e7(){return"/"}function _x(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function t7(e){if(typeof e=="string")e=new URL(e);else if(!_x(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 n7(e)}function n7(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===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 Zm=["history","path","basename","stem","extname","dirname"];class tS{constructor(t){let n;t?_x(t)?n={path:t}:typeof t=="string"||r7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":J8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Zm.length;){const o=Zm[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Zm.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ks.basename(this.path):void 0}set basename(t){eg(t,"basename"),Jm(t,"basename"),this.path=ks.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ks.dirname(this.path):void 0}set dirname(t){M5(this.basename,"dirname"),this.path=ks.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ks.extname(this.path):void 0}set extname(t){if(Jm(t,"extname"),M5(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=ks.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_x(t)&&(t=t7(t)),eg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ks.basename(this.path,this.extname):void 0}set stem(t){eg(t,"stem"),Jm(t,"stem"),this.path=ks.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Vn(t,n,r);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(ks.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ks.sep+"`")}function eg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function M5(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function r7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s7=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),i7={}.hasOwnProperty;class uv extends s7{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=V8()}copy(){const t=new uv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Km(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rg("data",this.frozen),this.namespace[t]=n,this):i7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rg("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,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Vd(t),r=this.parser||this.Parser;return tg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),tg("process",this.parser||this.Parser),ng("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const h=Vd(t),f=r.parse(h);r.run(f,h,function(m,x,b){if(m||!x||!b)return p(m);const y=x,_=r.stringify(y,b);o7(_)?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,r;return this.freeze(),tg("processSync",this.parser||this.Parser),ng("processSync",this.compiler||this.Compiler),this.process(t,a),L5("processSync","process",n),r;function a(o,u){n=!0,A5(o),r=u}}run(t,n,r){R5(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(u,h){const f=Vd(n);a.run(t,f,p);function p(m,x,b){const y=x||t;m?h(m):u?u(y):r(void 0,y,b)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),L5("runSync","run",r),a;function o(u,h){A5(u),a=h,r=!0}}stringify(t,n){this.freeze();const r=Vd(n),a=this.compiler||this.Compiler;return ng("stringify",a),R5(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(rg("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?h(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...x]=p;f(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");h(p.plugins),p.settings&&(a.settings=Km(!0,a.settings,p.settings))}function h(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 f(p,m){let x=-1,b=-1;for(;++x<r.length;)if(r[x][0]===p){b=x;break}if(b===-1)r.push([p,...m]);else if(m.length>0){let[y,..._]=m;const j=r[b][1];yx(j)&&yx(y)&&(y=Km(!0,j,y)),r[b]=[p,y,..._]}}}}const a7=new uv().freeze();function tg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rg(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 R5(e){if(!yx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function L5(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Vd(e){return l7(e)?e:new tS(e)}function l7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function o7(e){return typeof e=="string"||c7(e)}function c7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const u7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",D5=[],O5={allowDangerousHtml:!0},d7=/^(https?|ircs?|mailto|xmpp)$/i,h7=[{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 dv(e){const t=f7(e),n=p7(e);return m7(t.runSync(t.parse(n),n),e)}function f7(e){const t=e.rehypePlugins||D5,n=e.remarkPlugins||D5,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...O5}:O5;return a7().use(GM).use(n).use(I8,r).use(t)}function p7(e){const t=e.children||"",n=new tS;return typeof t=="string"&&(n.value=t),n}function m7(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||g7;for(const m of h7)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+u7+m.id,void 0);return cv(e,p),AA(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 Ym)if(Object.hasOwn(Ym,y)&&Object.hasOwn(m.properties,y)){const _=m.properties[y],j=Ym[y];(j===null||j.includes(m.tagName))&&(m.properties[y]=f(String(_||""),y,m))}}if(m.type==="element"){let y=n?!n.includes(m.tagName):o?o.includes(m.tagName):!1;if(!y&&r&&typeof x=="number"&&(y=!r(m,x,b)),y&&b&&typeof x=="number")return h&&m.children?b.children.splice(x,1,...m.children):b.children.splice(x,1),x}}}function g7(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||d7.test(e.slice(0,t))?e:""}function z5(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function x7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function v7(e,t,n){const a=Kh((n||{}).ignore||[]),o=b7(t);let u=-1;for(;++u<o.length;)eS(e,"text",h);function h(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 f(p,m)}function f(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 w=!1,E=[];b.lastIndex=0;let C=b.exec(p.value);for(;C;){const L=C.index,O={index:C.index,input:C.input,stack:[...m,p]};let D=y(...C,O);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?b.lastIndex=L+1:(_!==L&&E.push({type:"text",value:p.value.slice(_,L)}),Array.isArray(D)?E.push(...D):D&&E.push(D),_=L+C[0].length,w=!0),!b.global)break;C=b.exec(p.value)}return w?(_<p.value.length&&E.push({type:"text",value:p.value.slice(_)}),x.children.splice(N,1,...E)):E=[p],N+E.length}}function b7(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 r=-1;for(;++r<n.length;){const a=n[r];t.push([y7(a[0]),_7(a[1])])}return t}function y7(e){return typeof e=="string"?new RegExp(x7(e),"g"):e}function _7(e){return typeof e=="function"?e:function(){return e}}const sg="phrasing",ig=["autolink","link","image","label"];function w7(){return{transforms:[A7],enter:{literalAutolink:S7,literalAutolinkEmail:ag,literalAutolinkHttp:ag,literalAutolinkWww:ag},exit:{literalAutolink:E7,literalAutolinkEmail:C7,literalAutolinkHttp:j7,literalAutolinkWww:N7}}}function k7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sg,notInConstruct:ig},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sg,notInConstruct:ig},{character:":",before:"[ps]",after:"\\/",inConstruct:sg,notInConstruct:ig}]}}function S7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ag(e){this.config.enter.autolinkProtocol.call(this,e)}function j7(e){this.config.exit.autolinkProtocol.call(this,e)}function N7(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 C7(e){this.config.exit.autolinkEmail.call(this,e)}function E7(e){this.exit(e)}function A7(e){v7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,T7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),M7]],{ignore:["link","linkReference"]})}function T7(e,t,n,r,a){let o="";if(!nS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!R7(n)))return!1;const u=L7(n+r);if(!u[0])return!1;const h={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function M7(e,t,n,r){return!nS(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function R7(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 L7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=z5(e,"(");let o=z5(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function nS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Pa(n)||Wh(n))&&(!t||n!==47)}rS.peek=I7;function D7(){this.buffer()}function O7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function z7(){this.buffer()}function B7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function P7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=os(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $7(e){this.exit(e)}function F7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=os(this.sliceSerialize(e)).toLowerCase(),n.label=t}function U7(e){this.exit(e)}function I7(){return"["}function rS(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const u=n.enter("footnoteReference"),h=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),h(),u(),o+=a.move("]"),o}function H7(){return{enter:{gfmFootnoteCallString:D7,gfmFootnoteCall:O7,gfmFootnoteDefinitionLabelString:z7,gfmFootnoteDefinition:B7},exit:{gfmFootnoteCallString:P7,gfmFootnoteCall:$7,gfmFootnoteDefinitionLabelString:F7,gfmFootnoteDefinition:U7}}}function q7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:rS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,u){const h=o.createTracker(u);let f=h.move("[^");const p=o.enter("footnoteDefinition"),m=o.enter("label");return f+=h.move(o.safe(o.associationId(r),{before:f,after:"]"})),m(),f+=h.move("]:"),r.children&&r.children.length>0&&(h.shift(4),f+=h.move((t?`
|
|
85
|
-
`:" ")+o.indentLines(o.containerFlow(r,h.current()),t?sS:V7))),p(),f}}function V7(e,t,n){return t===0?e:sS(e,t,n)}function sS(e,t,n){return(n?"":" ")+e}const G7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];iS.peek=K7;function Y7(){return{canContainEols:["delete"],enter:{strikethrough:Q7},exit:{strikethrough:X7}}}function W7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G7}],handlers:{delete:iS}}}function Q7(e){this.enter({type:"delete",children:[]},e)}function X7(e){this.exit(e)}function iS(e,t,n,r){const a=n.createTracker(r),o=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),o(),u}function K7(){return"~"}function Z7(e){return e.length}function J7(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||Z7,o=[],u=[],h=[],f=[];let p=0,m=-1;for(;++m<e.length;){const j=[],N=[];let w=-1;for(e[m].length>p&&(p=e[m].length);++w<e[m].length;){const E=eR(e[m][w]);if(n.alignDelimiters!==!1){const C=a(E);N[w]=C,(f[w]===void 0||C>f[w])&&(f[w]=C)}j.push(E)}u[m]=j,h[m]=N}let x=-1;if(typeof r=="object"&&"length"in r)for(;++x<p;)o[x]=B5(r[x]);else{const j=B5(r);for(;++x<p;)o[x]=j}x=-1;const b=[],y=[];for(;++x<p;){const j=o[x];let N="",w="";j===99?(N=":",w=":"):j===108?N=":":j===114&&(w=":");let E=n.alignDelimiters===!1?1:Math.max(1,f[x]-N.length-w.length);const C=N+"-".repeat(E)+w;n.alignDelimiters!==!1&&(E=N.length+E+w.length,E>f[x]&&(f[x]=E),y[x]=E),b[x]=C}u.splice(1,0,b),h.splice(1,0,y),m=-1;const _=[];for(;++m<u.length;){const j=u[m],N=h[m];x=-1;const w=[];for(;++x<p;){const E=j[x]||"";let C="",L="";if(n.alignDelimiters!==!1){const O=f[x]-(N[x]||0),D=o[x];D===114?C=" ".repeat(O):D===99?O%2?(C=" ".repeat(O/2+.5),L=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),L=C):L=" ".repeat(O)}n.delimiterStart!==!1&&!x&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||x)&&w.push(" "),n.alignDelimiters!==!1&&w.push(C),w.push(E),n.alignDelimiters!==!1&&w.push(L),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||x!==p-1)&&w.push("|")}_.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return _.join(`
|
|
86
|
-
`)}function eR(e){return e==null?"":String(e)}function B5(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 tR(e,t,n,r){const a=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),nR);return a(),u}function nR(e,t,n){return">"+(n?"":" ")+e}function rR(e,t){return P5(e,t.inConstruct,!0)&&!P5(e,t.notInConstruct,!1)}function P5(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function $5(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
87
|
-
`&&rR(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
88
|
-
`}function sR(e,t){const n=String(e);let r=n.indexOf(t),a=r,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++o>u&&(u=o):o=1,a=r+t.length,r=n.indexOf(t,a);return u}function iR(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 aR(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 lR(e,t,n,r){const a=aR(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(iR(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(o,oR);return x(),b}const h=n.createTracker(r),f=a.repeat(Math.max(sR(o,a)+1,3)),p=n.enter("codeFenced");let m=h.move(f);if(e.lang){const x=n.enter(`codeFencedLang${u}`);m+=h.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...h.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);m+=h.move(" "),m+=h.move(n.safe(e.meta,{before:m,after:`
|
|
89
|
-
`,encode:["`"],...h.current()})),x()}return m+=h.move(`
|
|
90
|
-
`),o&&(m+=h.move(o+`
|
|
91
|
-
`)),m+=h.move(f),p(),m}function oR(e,t,n){return(n?"":" ")+e}function hv(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 cR(e,t,n,r){const a=hv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let h=n.enter("label");const f=n.createTracker(r);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
|
|
92
|
-
`,...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),u(),p}function uR(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 eu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ph(e,t,n){const r=io(e),a=io(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===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}}aS.peek=dR;function aS(e,t,n,r){const a=uR(n),o=n.enter("emphasis"),u=n.createTracker(r),h=u.move(a);let f=u.move(n.containerPhrasing(e,{after:a,before:h,...u.current()}));const p=f.charCodeAt(0),m=Ph(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(f=eu(p)+f.slice(1));const x=f.charCodeAt(f.length-1),b=Ph(r.after.charCodeAt(0),x,a);b.inside&&(f=f.slice(0,-1)+eu(x));const y=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},h+f+y}function dR(e,t,n){return n.options.emphasis||"*"}function hR(e,t){let n=!1;return cv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,vx}),!!((!e.depth||e.depth<3)&&nv(e)&&(t.options.setext||n))}function fR(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(hR(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),h=n.enter("headingAtx"),f=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
97
|
-
`,...o.current()});return/^[\t ]/.test(p)&&(p=eu(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),f(),h(),p}lS.peek=pR;function lS(e){return e.value||""}function pR(){return"<"}oS.peek=mR;function oS(e,t,n,r){const a=hv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let h=n.enter("label");const f=n.createTracker(r);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),p+=f.move(")"),u(),p}function mR(){return"!"}cS.peek=gR;function cS(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const h=n.createTracker(r);let f=h.move("![");const p=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?f+=h.move(x+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function gR(){return"!"}uS.peek=xR;function uS(e,t,n){let r=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const u=n.unsafe[o],h=n.compilePattern(u);let f;if(u.atBreak)for(;f=h.exec(r);){let p=f.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(f.index+1)}}return a+r+a}function xR(){return"`"}function dS(e,t){const n=nv(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))}hS.peek=vR;function hS(e,t,n,r){const a=hv(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let h,f;if(dS(e,n)){const m=n.stack;n.stack=[],h=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),h(),n.stack=m,x}h=n.enter("link"),f=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(f=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=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),f()),p+=u.move(")"),h(),p}function vR(e,t,n){return dS(e,n)?"<":"["}fS.peek=bR;function fS(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const h=n.createTracker(r);let f=h.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?f+=h.move(x+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function bR(){return"["}function fv(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 yR(e){const t=fv(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 _R(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 pS(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 wR(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?_R(n):fv(n);const h=e.ordered?u==="."?")":".":yR(n);let f=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&&(f=!0),pS(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"){f=!0;break}}}}f&&(u=h),n.bulletCurrent=u;const p=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function kR(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 SR(e,t,n,r){const a=kR(n);let o=n.bulletCurrent||fv(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 h=n.createTracker(r);h.move(o+" ".repeat(u-o.length)),h.shift(u);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,h.current()),m);return f(),p;function m(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?o:o+" ".repeat(u-o.length))+x}}function jR(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,r);return o(),a(),u}const NR=Kh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CR(e,t,n,r){return(e.children.some(function(u){return NR(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function ER(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}mS.peek=AR;function mS(e,t,n,r){const a=ER(n),o=n.enter("strong"),u=n.createTracker(r),h=u.move(a+a);let f=u.move(n.containerPhrasing(e,{after:a,before:h,...u.current()}));const p=f.charCodeAt(0),m=Ph(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(f=eu(p)+f.slice(1));const x=f.charCodeAt(f.length-1),b=Ph(r.after.charCodeAt(0),x,a);b.inside&&(f=f.slice(0,-1)+eu(x));const y=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},h+f+y}function AR(e,t,n){return n.options.strong||"*"}function TR(e,t,n,r){return n.safe(e.value,r)}function MR(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 RR(e,t,n){const r=(pS(n)+(n.options.ruleSpaces?" ":"")).repeat(MR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const gS={blockquote:tR,break:$5,code:lR,definition:cR,emphasis:aS,hardBreak:$5,heading:fR,html:lS,image:oS,imageReference:cS,inlineCode:uS,link:hS,linkReference:fS,list:wR,listItem:SR,paragraph:jR,root:CR,strong:mS,text:TR,thematicBreak:RR};function LR(){return{enter:{table:DR,tableData:F5,tableHeader:F5,tableRow:zR},exit:{codeText:BR,table:OR,tableData:lg,tableHeader:lg,tableRow:lg}}}function DR(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 OR(e){this.exit(e),this.data.inTable=void 0}function zR(e){this.enter({type:"tableRow",children:[]},e)}function lg(e){this.exit(e)}function F5(e){this.enter({type:"tableCell",children:[]},e)}function BR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,PR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function PR(e,t){return t==="|"?t:e}function $R(e){const t=e||{},n=t.tableCellPadding,r=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:f,tableRow:h}};function u(y,_,j,N){return p(m(y,j,N),y.align)}function h(y,_,j,N){const w=x(y,j,N),E=p([w]);return E.slice(0,E.indexOf(`
|
|
99
|
-
`))}function f(y,_,j,N){const w=j.enter("tableCell"),E=j.enter("phrasing"),C=j.containerPhrasing(y,{...N,before:o,after:o});return E(),w(),C}function p(y,_){return J7(y,{align:_,alignDelimiters:r,padding:n,stringLength:a})}function m(y,_,j){const N=y.children;let w=-1;const E=[],C=_.enter("table");for(;++w<N.length;)E[w]=x(N[w],_,j);return C(),E}function x(y,_,j){const N=y.children;let w=-1;const E=[],C=_.enter("tableRow");for(;++w<N.length;)E[w]=f(N[w],y,_,j);return C(),E}function b(y,_,j){let N=gS.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function FR(){return{exit:{taskListCheckValueChecked:U5,taskListCheckValueUnchecked:U5,paragraph:IR}}}function UR(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:HR}}}function U5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function IR(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 r=n.children[0];if(r&&r.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const h=a[o];if(h.type==="paragraph"){u=h;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function HR(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",h=n.createTracker(r);o&&h.move(u);let f=gS.listItem(e,t,n,{...r,...h.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(m){return m+u}}function qR(){return[w7(),H7(),Y7(),LR(),FR()]}function VR(e){return{extensions:[k7(),q7(e),W7(),$R(e),UR()]}}const GR={tokenize:ZR,partial:!0},xS={tokenize:JR,partial:!0},vS={tokenize:eL,partial:!0},bS={tokenize:tL,partial:!0},YR={tokenize:nL,partial:!0},yS={name:"wwwAutolink",tokenize:XR,previous:wS},_S={name:"protocolAutolink",tokenize:KR,previous:kS},li={name:"emailAutolink",tokenize:QR,previous:SS},Es={};function WR(){return{text:Es}}let Ca=48;for(;Ca<123;)Es[Ca]=li,Ca++,Ca===58?Ca=65:Ca===91&&(Ca=97);Es[43]=li;Es[45]=li;Es[46]=li;Es[95]=li;Es[72]=[li,_S];Es[104]=[li,_S];Es[87]=[li,yS];Es[119]=[li,yS];function QR(e,t,n){const r=this;let a,o;return u;function u(x){return!wx(x)||!SS.call(r,r.previous)||pv(r.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(x))}function h(x){return wx(x)?(e.consume(x),h):x===64?(e.consume(x),f):n(x)}function f(x){return x===46?e.check(YR,m,p)(x):x===45||x===95||Hn(x)?(o=!0,e.consume(x),f):m(x)}function p(x){return e.consume(x),a=!0,f}function m(x){return o&&a&&Zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function XR(e,t,n){const r=this;return a;function a(u){return u!==87&&u!==119||!wS.call(r,r.previous)||pv(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(GR,e.attempt(xS,e.attempt(vS,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function KR(e,t,n){const r=this;let a="",o=!1;return u;function u(x){return(x===72||x===104)&&kS.call(r,r.previous)&&!pv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),h):n(x)}function h(x){if(Zn(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),h;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),f}return n(x)}function f(x){return x===47?(e.consume(x),o?p:(o=!0,f)):n(x)}function p(x){return x===null||Oh(x)||Ht(x)||Pa(x)||Wh(x)?n(x):e.attempt(xS,e.attempt(vS,m),n)(x)}function m(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function ZR(e,t,n){let r=0;return a;function a(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),a):u===46&&r===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function JR(e,t,n){let r,a,o;return u;function u(p){return p===46||p===95?e.check(bS,f,h)(p):p===null||Ht(p)||Pa(p)||p!==45&&Wh(p)?f(p):(o=!0,e.consume(p),u)}function h(p){return p===95?r=!0:(a=r,r=void 0),e.consume(p),u}function f(p){return a||r||!o?n(p):t(p)}}function eL(e,t){let n=0,r=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&r<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(bS,t,o)(u):u===null||Ht(u)||Pa(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&r++,e.consume(u),a}}function tL(e,t,n){return r;function r(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),r):h===38?(e.consume(h),o):h===93?(e.consume(h),a):h===60||h===null||Ht(h)||Pa(h)?t(h):n(h)}function a(h){return h===null||h===40||h===91||Ht(h)||Pa(h)?t(h):r(h)}function o(h){return Zn(h)?u(h):n(h)}function u(h){return h===59?(e.consume(h),r):Zn(h)?(e.consume(h),u):n(h)}}function nL(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return Hn(o)?n(o):t(o)}}function wS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ht(e)}function kS(e){return!Zn(e)}function SS(e){return!(e===47||wx(e))}function wx(e){return e===43||e===45||e===46||e===95||Hn(e)}function pv(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const rL={tokenize:dL,partial:!0};function sL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:oL,continuation:{tokenize:cL},exit:uL}},text:{91:{name:"gfmFootnoteCall",tokenize:lL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iL,resolveTo:aL}}}}function iL(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const f=r.events[a][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return h;function h(f){if(!u||!u._balanced)return n(f);const p=os(r.sliceSerialize({start:u.end,end:r.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function aL(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 r={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)},h=[e[n+1],e[n+2],["enter",r,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",r,t]];return e.splice(n,e.length-n+1,...h),e}function lL(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,u;return h;function h(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),f}function f(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||Ht(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(os(r.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return Ht(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 oL(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,u=0,h;return f;function f(_){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&&!h||_===null||_===91||Ht(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=os(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Ht(_)||(h=!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),wt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function cL(e,t,n){return e.check(au,t,e.attempt(rL,t,n))}function uL(e){e.exit("gfmFootnoteDefinition")}function dL(e,t,n){const r=this;return wt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function hL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,h){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},x={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},b=[["enter",m,h],["enter",u[p][1],h],["exit",u[p][1],h],["enter",x,h]],y=h.parser.constructs.insideSpan.null;y&&Ar(b,b.length,0,Qh(y,u.slice(p+1,f),h)),Ar(b,b.length,0,[["exit",x,h],["enter",u[f][1],h],["exit",u[f][1],h],["exit",m,h]]),Ar(u,p-1,f-p+3,b),f=p+b.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function o(u,h,f){const p=this.previous,m=this.events;let x=0;return b;function b(_){return p===126&&m[m.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=io(p);if(_===126)return x>1?f(_):(u.consume(_),x++,y);if(x<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),w=io(_);return N._open=!w||w===2&&!!j,N._close=!j||j===2&&!!w,h(_)}}}class fL{constructor(){this.map=[]}add(t,n,r){pL(this,t,n,r)}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 r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0}}function pL(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function mL(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function gL(){return{flow:{null:{name:"table",tokenize:xL,resolveAll:vL}}}}function xL(e,t,n){const r=this;let a=0,o=0,u;return h;function h(z){let q=r.events.length-1;for(;q>-1;){const Z=r.events[q][1].type;if(Z==="lineEnding"||Z==="linePrefix")q--;else break}const T=q>-1?r.events[q][1].type:null,ie=T==="tableHead"||T==="tableRow"?D:f;return ie===D&&r.parser.lazy[r.now().line]?n(z):ie(z)}function f(z){return e.enter("tableHead"),e.enter("tableRow"),p(z)}function p(z){return z===124||(u=!0,o+=1),m(z)}function m(z){return z===null?n(z):Ie(z)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):n(z):pt(z)?wt(e,m,"whitespace")(z):(o+=1,u&&(u=!1,a+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),x(z)))}function x(z){return z===null||z===124||Ht(z)?(e.exit("data"),m(z)):(e.consume(z),z===92?b:x)}function b(z){return z===92||z===124?(e.consume(z),x):x(z)}function y(z){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(z):(e.enter("tableDelimiterRow"),u=!1,pt(z)?wt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):_(z))}function _(z){return z===45||z===58?N(z):z===124?(u=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),j):O(z)}function j(z){return pt(z)?wt(e,N,"whitespace")(z):N(z)}function N(z){return z===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),w):z===45?(o+=1,w(z)):z===null||Ie(z)?L(z):O(z)}function w(z){return z===45?(e.enter("tableDelimiterFiller"),E(z)):O(z)}function E(z){return z===45?(e.consume(z),E):z===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(z))}function C(z){return pt(z)?wt(e,L,"whitespace")(z):L(z)}function L(z){return z===124?_(z):z===null||Ie(z)?!u||a!==o?O(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):O(z)}function O(z){return n(z)}function D(z){return e.enter("tableRow"),U(z)}function U(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),U):z===null||Ie(z)?(e.exit("tableRow"),t(z)):pt(z)?wt(e,U,"whitespace")(z):(e.enter("data"),I(z))}function I(z){return z===null||z===124||Ht(z)?(e.exit("data"),U(z)):(e.consume(z),z===92?W:I)}function W(z){return z===92||z===124?(e.consume(z),I):I(z)}}function vL(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],h=!1,f=0,p,m,x;const b=new fL;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(h=!1,f!==0&&(I5(b,t,f,p,m),m=void 0,f=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(r=!0,x=void 0,o=[0,0,0,0],u=[0,n+1,0,0],h&&(h=!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")?(r=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],x=Gd(b,t,o,a,void 0,x),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(u[0]=u[1],x=Gd(b,t,o,a,void 0,x)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(h=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,o[1]!==0?(u[0]=u[1],x=Gd(b,t,o,a,n,x)):u[1]!==0&&(x=Gd(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&I5(b,t,f,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=mL(t.events,n))}return e}function Gd(e,t,n,r,a,o){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(o.end=Object.assign({},$l(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=$l(t.events,n[1]);if(o={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=$l(t.events,n[2]),m=$l(t.events,n[3]),x={type:h,start:Object.assign({},p),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",x,t]]),r!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return a!==void 0&&(o.end=Object.assign({},$l(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function I5(e,t,n,r,a){const o=[],u=$l(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),r.end=Object.assign({},u),o.push(["exit",r,t]),e.add(n+1,0,o)}function $l(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const bL={name:"tasklistCheck",tokenize:_L};function yL(){return{text:{91:bL}}}function _L(e,t,n){const r=this;return a;function a(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return Ht(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):n(f)}function h(f){return Ie(f)?t(f):pt(f)?e.check({tokenize:wL},t,n)(f):n(f)}}function wL(e,t,n){return wt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function kL(e){return Dk([WR(),sL(),hL(e),gL(),yL()])}const SL={};function mv(e){const t=this,n=e||SL,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(kL(n)),o.push(qR()),u.push(VR(n))}const jL=1500;async function NL(e){var r;try{if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.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 Jh({text:e,label:t="Copy",className:n=""}){const[r,a]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await NL(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),jL))},h=r?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":h,title:h,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:r?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"})]})})}function $h(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map($h).join(""):typeof e=="object"&&e!==null&&"props"in e?$h((t=e.props)==null?void 0:t.children):""}const og=/https?:\/\/[^\s<>"'`]+/gi,CL=`.,;:!?]}>'"`;function EL(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const r=e.slice(0,t),a=(r.match(/\(/g)||[]).length,o=(r.match(/\)/g)||[]).length;if(a>=o)break;t--;continue}if(CL.includes(n)){t--;continue}break}return e.slice(0,t)}function AL(e){return/^https?:\/\/[^\s/]/i.test(e)}function TL(e){if(!e)return[];const t=[];let n=0;og.lastIndex=0;let r;for(;(r=og.exec(e))!==null;){const a=EL(r[0]);!a||!AL(a)||(r.index>n&&t.push({type:"text",value:e.slice(n,r.index)}),t.push({type:"link",value:a,href:a}),n=r.index+a.length,og.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const H5=40;function ML(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>H5?`${t.slice(0,H5-1)}…`:t}`:"Copy"}function jS({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const r=$h(e);if(!r)return l.jsx("code",{className:`px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] font-mono-code border border-cc-border/40 ${n} ${t}`,children:e});const a=TL(r);return l.jsxs("span",{className:`inline-flex items-center align-middle max-w-full gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-cc-fg/[0.06] border border-cc-border/40 ${t}`,children:[l.jsx("code",{className:`min-w-0 break-all font-mono-code ${n}`,children:a.map((o,u)=>o.type==="link"?l.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:o.value},u):l.jsx("span",{children:o.value},u))}),l.jsx(Jh,{text:r,label:ML(r),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const Fh=25*1024*1024,Uh=100*1024*1024;function NS(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=r.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},r.onerror=n,r.readAsDataURL(e)})}function Gi(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 CS(e){return e.startsWith("image/")}function ES({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let r="FILE";return t==="application/pdf"||n==="pdf"?r="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?r="ZIP":["csv","tsv"].includes(n)?r="CSV":["json","yaml","yml","toml","xml"].includes(n)?r="DATA":["md","txt","log"].includes(n)?r="TXT":["doc","docx","rtf","odt"].includes(n)?r="DOC":["xls","xlsx","ods"].includes(n)?r="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?r="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?r="VID":n&&(r=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:r})]})}function AS({name:e,mediaType:t,base64:n,size:r,onRemove:a,className:o="w-12 h-12"}){const u=CS(t);return l.jsxs("div",{className:"relative group",title:`${e} (${Gi(r)})`,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(ES,{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 RL({name:e,mediaType:t,data:n,size:r}){return CS(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(ES,{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:Gi(r)})]})]})}function LL({message:e}){const t=$a(),[n,r]=k.useState(!1),a=!t&&!!e.detail;return l.jsxs("div",{className:"py-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-3 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}),a&&l.jsx("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,className:"shrink-0 text-[11px] text-cc-muted/60 hover:text-cc-muted underline decoration-dotted cursor-pointer",children:n?"hide report":"show report"}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}),a&&n&&l.jsx("pre",{className:"mt-1.5 mx-3 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap break-words max-h-80 overflow-auto rounded-md bg-cc-hover/40 p-2",children:e.detail})]})}function DL({message:e}){return e.role==="system"?l.jsx(LL,{message:e}):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(RL,{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(gv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx($L,{message:e})})}function OL(e){const t=[];for(const n of e)if(n.type==="tool_use"){const r=t[t.length-1];(r==null?void 0:r.kind)==="tool_group"&&r.name===n.name?r.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 zL(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 BL(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function PL({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 $L({message:e}){var u;const t=e.contentBlocks||[],n=$a(),r=k.useMemo(()=>OL(t),[t]),a=k.useMemo(()=>zL(t),[t]),o=k.useMemo(()=>n?r.filter(h=>!BL(h)):r,[r,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(cg,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(PL,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const h=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(cg,{}),l.jsx("div",{className:"flex-1 min-w-0",children:h?l.jsx(MS,{text:e.content}):l.jsx(gv,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(cg,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((h,f)=>{if(h.kind==="content")return l.jsx(FL,{block:h.block,toolUseById:a},f);if(h.items.length===1){const p=h.items[0];return l.jsx(vw,{name:p.name,input:p.input,toolUseId:p.id},f)}return l.jsx(HL,{name:h.name,items:h.items},f)})})]})}function cg(){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 gv({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(dv,{remarkPlugins:[mv],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:r})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:r}),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:r,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof r=="string"&&r.includes(`
|
|
100
|
-
`)){const h=(o==null?void 0:o[1])||"",f=$h(r);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"})]}),h&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:h}),l.jsx(Jh,{text:f,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:r})})]})}return l.jsx(jS,{children:r})},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 FL({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(gv,{text:e.text});if(e.type==="thinking")return l.jsx(MS,{text:e.thinking});if(e.type==="tool_use")return l.jsx(vw,{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),r=t.get(e.tool_use_id),a=r==null?void 0:r.name,o=e.is_error??!1;return a==="Bash"?l.jsx(UL,{text:n,isError:o}):l.jsx(IL,{content:n,isError:o})}return null}function TS(e){return`${e} ${e===1?"line":"lines"}`}function UL({text:e,isError:t}){const n=e.split(/\r?\n/),r=n.length>20,[a,o]=k.useState(!1),u=$a(),[h,f]=k.useState(!1),p=a||!r?e:n.slice(-20).join(`
|
|
101
|
-
`),m=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Jh,{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}),r&&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(Hh,{open:h,onToggle:()=>f(!h),marker:"›",label:t?"Error output":"Output",meta:TS(n.length),labelClassName:t?"text-cc-error/70":""}),h&&l.jsx("div",{className:"mt-1",children:m})]}):m}function IL({content:e,isError:t}){const n=$a(),[r,a]=k.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Jh,{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(Hh,{open:r,onToggle:()=>a(!r),marker:"›",label:t?"Error result":"Result",meta:TS(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),r&&l.jsx("div",{className:"mt-1",children:o})]}):o}function HL({name:e,items:t}){const[n,r]=k.useState(!1),a=tu(e),o=Yi(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>r(!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(Xl,{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,h)=>{const f=Ic(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:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})}function MS({text:e}){const t=e.trim(),n=$a(),[r,a]=k.useState(!1),o=t.split(`
|
|
102
|
-
`),u=n?2:8,h=n?200:600,f=o.length>u||t.length>h,p=f&&!r?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(dv,{remarkPlugins:[mv],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."})}),f&&!r&&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 Ec(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function wc(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function q5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":qL(t):"N/A"}catch{return"N/A"}}function kx(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const r=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return r>0?`${r}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function V5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function qL(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),r=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${r}m`:n>0?`${n}h${r}m`:`${r}m`}function VL({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(Xl,{type:tu(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:Yi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function GL({entries:e}){const[t,n]=k.useState(!1),r=k.useMemo(()=>{const a=e.reduce((f,p)=>f+p.elapsedSeconds,0),o=Math.max(...e.map(f=>f.elapsedSeconds),.1),u=e.filter(f=>f.isError).length,h=e.filter(f=>!f.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:h}},[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 ${r.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:[r.totalTime.toFixed(1),"s"]}),r.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[r.errorCount," error",r.errorCount>1?"s":""]})]}),r.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[r.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/r.maxTime*100)}%`,minWidth:"3px"},title:`${Yi(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(YL,{entry:a,maxTime:r.maxTime},a.toolUseId))})]})}function YL({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),r=!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":r?"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(Xl,{type:tu(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Yi(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":r?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const Yd=100,WL=40,QL=120,G5=1e4,XL=15*6e4,ug=new Map,KL=[],ZL=[];function JL(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function eD(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const r of t){if(r.type==="text"&&r.text.trim()||r.type==="thinking")return null;if(r.type==="tool_use"){if(n===null)n=r.name;else if(n!==r.name)return null}}return n}function Y5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function tD(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 RS(e){const t=[];for(const n of e){const r=eD(n);if(r){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===r){a.items.push(...Y5(n));continue}t.push({kind:"tool_msg_group",toolName:r,items:Y5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function LS(e,t,n){const r=RS(e),a=[];for(const o of r){a.push(o);const u=tD(o);for(const h of u){const f=n.get(h);if(f&&f.length>0){const p=t.get(h)||{description:"Subagent",agentType:""},m=LS(f,t,n);a.push({kind:"subagent",taskToolUseId:h,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 nD(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:h}=o,f=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=f&&f.length>0?f.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(h,{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:f})}}if(t.size===0)return RS(e);const n=new Map,r=[];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 r.push(a);return LS(r,t,n)}function rD({group:e}){const[t,n]=k.useState(!1),r=tu(e.toolName),a=Yi(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(W5,{}),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(Xl,{type:r}),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:Ic(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(W5,{}),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(Xl,{type:r}),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,h)=>{const f=Ic(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:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})})]})})}function DS({entries:e,toolActivity:t}){return l.jsx(l.Fragment,{children:e.map((n,r)=>{if(n.kind==="tool_msg_group")return l.jsx(rD,{group:n},n.firstId||r);if(n.kind==="subagent")return l.jsx(aD,{group:n},n.taskToolUseId);const a=n.msg,o=sD(a),u=t&&o.length>0?t.filter(f=>o.includes(f.toolUseId)):[],h=u.length>0&&u.every(f=>f.completedAt);return l.jsxs("div",{children:[l.jsx(DL,{message:a}),h&&l.jsx(GL,{entries:u})]},a.id)})})}function sD(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function iD(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 aD({group:e}){const[t,n]=k.useState(!1),r=e.description||"Subagent",a=e.agentType,o=e.children.length,u=iD(e.status),h=e.receiverCount,f=e.senderThreadId,p=e.receiverThreadIds||[],m=e.backend||"claude",x=e.children[e.children.length-1],b=k.useMemo(()=>{var y,_;if(!x)return"";if(x.kind==="tool_msg_group")return`${Yi(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(w=>w.type==="tool_use");if(N)return Yi(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:r}),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}),h!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[h," agent",h===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:[(f||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[f&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",f]}),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(DS,{entries:e.children})]})]})})}function W5(){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 lD({sessionId:e}){var Dt;const t=G(we=>we.messages.get(e)??KL),n=G(we=>(we.sdkSessions||ZL).find(Ge=>Ge.sessionId===e)),r=G(we=>we.streamingStartedAt.get(e)),a=G(we=>we.streamingOutputTokens.get(e)),o=G(we=>we.sessionStatus.get(e)),u=G(we=>we.lastActivityAt.get(e)),h=G(we=>we.sessionProcesses.get(e)),f=G(we=>we.toolProgress.get(e)),p=G(we=>we.toolActivity.get(e)),m=k.useRef(null),x=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(Yd),[w,E]=k.useState([]),[C,L]=k.useState(0),[O,D]=k.useState(!1),[U,I]=k.useState(!1),[W,z]=k.useState(!1),[q,T]=k.useState(""),ie=k.useRef(new Set),Z=G(we=>we.chatTabReentryTickBySession.get(e)??0),Y=k.useMemo(()=>t.some(we=>we.role==="assistant"&&we.isStreaming),[t]),P=k.useMemo(()=>(h??[]).filter(we=>we.status==="running"),[h]),$=P.length>0,re=k.useMemo(()=>{const we=p??[];for(let Ge=we.length-1;Ge>=0;Ge--)if(!we[Ge].completedAt)return we[Ge]},[p]),ae=k.useMemo(()=>P.length>0?Math.min(...P.map(we=>we.startedAt)):null,[P]),R=k.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,X=n!=null&&n.forkSession?"Forked from":"Continuing from",M=k.useMemo(()=>{if(w.length===0)return t;const we=[],Ge=new Set;for(const gt of w)Ge.has(gt.id)||(Ge.add(gt.id),we.push(gt));for(const gt of t)Ge.has(gt.id)||(Ge.add(gt.id),we.push(gt));return we},[w,t]),me=k.useMemo(()=>nD(M),[M]);k.useEffect(()=>{N(Yd),E([]),L(0),D(!1),I(!1),z(!1),T(""),ie.current=new Set},[e,R]);const be=me.length,Ce=be>j,De=Ce?me.slice(be-j):me,Ee=be-De.length,Ae=k.useCallback(()=>{const we=x.current,Ge=(we==null?void 0:we.scrollHeight)??0;N(gt=>gt+Yd),requestAnimationFrame(()=>{if(we){const gt=we.scrollHeight;we.scrollTop+=gt-Ge}})},[]),Fe=k.useCallback(async(we={})=>{if(!B||!R||W)return;const Ge=x.current,gt=(Ge==null?void 0:Ge.scrollHeight)??0,_n=U?C:0;z(!0),T("");try{const je=await Ne.getClaudeSessionHistory(R,{cursor:_n,limit:WL}),Be=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})),yt=[];for(const Te of Be)ie.current.has(Te.id)||(ie.current.add(Te.id),yt.push(Te));E(Te=>[...yt,...Te]),L(je.nextCursor),D(je.hasMore),I(!0),yt.length>0&&N(Te=>Te+yt.length),we.preserveScroll!==!1&&Ge&&requestAnimationFrame(()=>{const Te=Ge.scrollHeight;Ge.scrollTop+=Te-gt})}catch(je){const Be=je instanceof Error?je.message:String(je);T(Be||"Failed to load previous history"),U||(E([]),L(0),D(!1))}finally{z(!1)}},[B,R,W,U,C]);k.useEffect(()=>{if(!r&&o!=="running"&&!$){_(0);return}const we=r||Date.now();_(Date.now()-we);const Ge=setInterval(()=>_(Date.now()-we),1e3);return()=>clearInterval(Ge)},[r,o,$]);function dt(){const we=x.current;if(!we)return;b.current=we.scrollHeight-we.scrollTop-we.clientHeight<120;const Ge=Math.max(0,we.scrollHeight-we.clientHeight-we.scrollTop);ug.set(e,Ge),B&&U&&O&&!W&&we.scrollTop<=QL&&Fe({preserveScroll:!0})}const Je=k.useCallback(()=>{const we=x.current;if(!we)return;const Ge=we.style.scrollBehavior;we.style.scrollBehavior="auto",we.scrollTop=we.scrollHeight,we.style.scrollBehavior=Ge},[]),At=k.useCallback(()=>{const we=x.current;if(!we)return;const Ge=we.style.scrollBehavior;we.style.scrollBehavior="auto";const gt=ug.get(e);typeof gt=="number"?we.scrollTop=Math.max(0,we.scrollHeight-we.clientHeight-gt):we.scrollTop=we.scrollHeight,we.style.scrollBehavior=Ge},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>At())},[e,At]),k.useEffect(()=>()=>{const we=x.current;if(!we)return;const Ge=Math.max(0,we.scrollHeight-we.clientHeight-we.scrollTop);ug.set(e,Ge)},[e]),k.useEffect(()=>{Z&&requestAnimationFrame(()=>Je())},[Z,Je]),k.useEffect(()=>{var we;b.current&&((we=m.current)==null||we.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:[X," ",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 Fe({preserveScroll:!1}),disabled:W,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"})}),W?"Loading...":"Load previous history"]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}):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 mt=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,rt=$&&(o!=="running"||mt>=G5)?"background":mt>=XL&&!re?"stalled":mt>=G5?"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:dt,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&&!U&&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:[X," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[R," ",n!=null&&n.cwd?`· ${JL(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Fe({preserveScroll:!0}),disabled:W,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:W?"Loading...":"Load previous history"})]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}),B&&U&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:O?W?"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:Ae,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(Yd,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(DS,{entries:De,toolActivity:p}),f&&f.size>0&&!Y&&l.jsx(VL,{tools:Array.from(f.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":rt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${rt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${rt==="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]"}`}),rt==="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:wc(Math.max(0,Date.now()-ae))})]}),((Dt=P[0])==null?void 0:Dt.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})]})]}):rt==="stalled"?l.jsxs("span",{children:["No activity for ",wc(mt)," — the agent may be stuck"]}):rt==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:re?`Running ${re.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:re?wc(Math.max(0,Date.now()-re.startedAt)):`no update for ${wc(mt)}`}),(re==null?void 0:re.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:re.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:wc(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:[Ec(a)," tokens"]})]})]})]}),l.jsx("div",{ref:m})]})})]})}const oD={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function cD(e,t){for(const[r,a]of Object.entries(oD))if(e.includes(r))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function uD(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:cD(t.value,n)}))}const OS=[{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5-1",label:"Fable 5.1",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:""}],zS=[{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:"●"}],xv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],vv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],dD=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],BS=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],PS=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function $S(e){return e==="codex"?zS:OS}function Q5(e){return e==="codex"?vv:xv}function Mz(e){return e==="codex"?PS:BS}function X5(e){return e==="codex"?zS[0].value:OS[0].value}function K5(e){return e==="codex"?vv[0].value:xv[0].value}function Rz(e){return e==="codex"?PS[0].value:BS[0].value}function hD(e){return e==="codex"?[]:dD}function Z5({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=G(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=G(b=>b.sessions.get(e)),u=G(b=>b.cliConnected.get(e)??!1),h=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",f=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=$S(h),m=p.find(b=>b.value===f)||(f?{label:f,icon:"?"}:null),x=k.useCallback(b=>{if(n(!1),b===f)return;zn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=G.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,f]);return k.useEffect(()=>{if(!t)return;const b=y=>{r.current&&!r.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),k.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),!u||!m?null:l.jsxs("div",{ref:r,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===f?"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===f,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===f&&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 FS({open:e,loading:t,prompts:n,selectedIndex:r,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((h,f)=>l.jsxs("button",{"data-prompt-index":f,onClick:()=>a(h),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${f===r?"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:["@",h.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:h.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:h.scope})]},h.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function US({text:e,caretPos:t,cwd:n,enabled:r=!0}){const[a,o]=k.useState(!1),[u,h]=k.useState(0),[f,p]=k.useState([]),[m,x]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{x(!0);try{const w=await Ne.listPrompts(n);p(w.filter(E=>!!E.name.trim()))}catch{p([])}finally{x(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const w=e.slice(0,t),E=w.match(/(^|\s)@([^\s@]*)$/);if(!E||E.index===void 0)return null;const C=w.length-E[0].length+E[1].length;return{query:E[2]||"",start:C,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const w=_.query.toLowerCase();if(!w)return f;const E=f.filter(L=>L.name.toLowerCase().startsWith(w)),C=f.filter(L=>!L.name.toLowerCase().startsWith(w)&&L.name.toLowerCase().includes(w));return[...E,...C]},[a,_,f]);k.useEffect(()=>{const w=r&&!!_;w&&!a?(o(!0),h(0)):!w&&a&&o(!1)},[r,_,a]),k.useEffect(()=>{u>=j.length&&h(Math.max(0,j.length-1))},[j.length,u]),k.useEffect(()=>{if(!b.current||!a)return;const E=b.current.querySelectorAll("[data-prompt-index]")[u];E&&E.scrollIntoView({block:"nearest"})},[u,a]);const N=k.useCallback(w=>{if(!_)return{nextText:e,nextCursor:t};const E=`${w.content} `,C=`${e.slice(0,_.start)}${E}${e.slice(_.end)}`,L=_.start+E.length;return{nextText:C,nextCursor:L}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:h,mentionContext:_,filteredPrompts:j,promptsLoading:m,savedPrompts:f,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const fD=[];function J5({isPlan:e,isConnected:t,onToggle:n,modeLabel:r,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",h=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",f=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?h:f:"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:r})]})}function Wd({onClick:e,disabled:t,active:n,title:r,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:r,children:a})}function ew(){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 tw({isRunning:e,canSend:t,onSend:n,onInterrupt:r,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",h=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:r,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?h:"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 pD({sessionId:e}){var oe,ke;const[t,n]=k.useState(""),[r,a]=k.useState([]),[o,u]=k.useState(null),[h,f]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,E]=k.useState("global"),[C,L]=k.useState(null),[O,D]=k.useState(0),U=k.useRef(null),I=k.useRef(null),W=k.useRef(null),z=k.useRef(null),q=G(Q=>Q.cliConnected),T=G(Q=>Q.sessions.get(e)),ie=G(Q=>Q.previousPermissionMode.get(e)||"acceptEdits"),Z=q.get(e)??!1,Y=(T==null?void 0:T.permissionMode)||"acceptEdits",P=Y==="plan",$=(T==null?void 0:T.backend_type)==="codex",ae=((ke=(oe=($?vv:xv).find(Q=>Q.value===Y))==null?void 0:oe.label)==null?void 0:ke.toLowerCase())||Y,R=US({text:t,caretPos:O,cwd:T==null?void 0:T.cwd,enabled:!p}),B=k.useMemo(()=>{const Q=[];if(T!=null&&T.slash_commands)for(const xe of T.slash_commands)Q.push({name:xe,type:"command"});if(T!=null&&T.skills)for(const xe of T.skills)Q.push({name:xe,type:"skill"});return Q},[T==null?void 0:T.slash_commands,T==null?void 0:T.skills]),X=k.useMemo(()=>{if(!p)return[];const Q=t.match(/^\/(\S*)$/);if(!Q)return[];const xe=Q[1].toLowerCase();return xe===""?B:B.filter(Oe=>Oe.name.toLowerCase().includes(xe))},[t,p,B]);k.useEffect(()=>{const Q=t.startsWith("/")&&/^\/\S*$/.test(t)&&B.length>0;Q&&!p?(m(!0),b(0)):!Q&&p&&m(!1)},[t,B.length,p]),k.useEffect(()=>{x>=X.length&&b(Math.max(0,X.length-1))},[X.length,x]),k.useEffect(()=>{if(!W.current||!p)return;const xe=W.current.querySelectorAll("[data-cmd-index]")[x];xe&&xe.scrollIntoView({block:"nearest"})},[x,p]),k.useEffect(()=>{if(z.current===null||!U.current)return;const Q=z.current;U.current.setSelectionRange(Q,Q),z.current=null},[t]);const M=k.useCallback(Q=>{var xe;n(`/${Q.name} `),m(!1),(xe=U.current)==null||xe.focus()},[]),me=k.useCallback(Q=>{var Oe;const xe=R.selectPrompt(Q);z.current=xe.nextCursor,n(xe.nextText),R.setMentionMenuOpen(!1),D(xe.nextCursor),(Oe=U.current)==null||Oe.focus(),U.current&&(U.current.style.height="auto",U.current.style.height=Math.min(U.current.scrollHeight,200)+"px")},[R]);function be(){var lt;const Q=t.trim();if(!Q||!Z)return;const xe=vg(),Oe=r.length>0?r.map(ot=>({name:ot.name,media_type:ot.mediaType,data:ot.base64,size:ot.size})):void 0;zn(e,{type:"user_message",content:Q,session_id:e,attachments:Oe,client_msg_id:xe});const Xe=G.getState();Xe.appendMessage(e,{id:xe,role:"user",content:Q,attachments:Oe,timestamp:Date.now()}),Xe.setSessionStatus(e,"running"),Xe.setLastActivity(e,Date.now()),Xe.streamingStartedAt.has(e)||Xe.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),m(!1),R.setMentionMenuOpen(!1),U.current&&(U.current.style.height="auto"),(lt=U.current)==null||lt.focus()}function Ce(Q){if(p&&X.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),b(xe=>(xe+1)%X.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),b(xe=>(xe-1+X.length)%X.length);return}if(Q.key==="Tab"&&!Q.shiftKey){Q.preventDefault(),M(X[x]);return}if(Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),M(X[x]);return}if(Q.key==="Escape"){Q.preventDefault(),m(!1);return}}if(R.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),R.setMentionMenuIndex(xe=>(xe+1)%R.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),R.setMentionMenuIndex(xe=>(xe-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),me(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault(),Ge();return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),be())}function De(Q){n(Q.target.value),D(Q.target.selectionStart??Q.target.value.length);const xe=Q.target;xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px"}function Ee(){U.current&&D(U.current.selectionStart??0)}function Ae(){zn(e,{type:"interrupt"})}async function Fe(Q){if(Q.length===0)return;const xe=[],Oe=[];let Xe=r.reduce((lt,ot)=>lt+ot.size,0);for(const lt of Q){if(lt.size>Fh){Oe.push(`${lt.name} is too large (${Gi(lt.size)}, max ${Gi(Fh)})`);continue}if(Xe+lt.size>Uh){Oe.push(`${lt.name} would exceed the per-message limit (${Gi(Uh)})`);continue}const{base64:ot,mediaType:Et}=await NS(lt);xe.push({name:lt.name,base64:ot,mediaType:Et,size:lt.size}),Xe+=lt.size}xe.length>0&&a(lt=>[...lt,...xe]),u(Oe.length>0?Oe.join("; "):null)}async function dt(Q){const xe=Q.target.files;xe&&(await Fe(Array.from(xe)),Q.target.value="")}function Je(Q){a(xe=>xe.filter((Oe,Xe)=>Xe!==Q))}async function At(Q){var Xe;const xe=(Xe=Q.clipboardData)==null?void 0:Xe.items;if(!xe)return;const Oe=[];for(const lt of Array.from(xe)){if(lt.kind!=="file")continue;const ot=lt.getAsFile();if(!ot)continue;const Et=ot.name&&ot.name.length>0?ot.name:`pasted-${Date.now()}.${(ot.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Oe.push(new File([ot],Et,{type:ot.type,lastModified:ot.lastModified}))}Oe.length>0&&(Q.preventDefault(),await Fe(Oe))}function mt(Q){Q.dataTransfer.types.includes("Files")&&(Q.preventDefault(),Q.stopPropagation(),f(!0))}function rt(Q){Q.currentTarget===Q.target&&f(!1)}async function Dt(Q){if(!Q.dataTransfer.types.includes("Files"))return;Q.preventDefault(),Q.stopPropagation(),f(!1);const xe=Array.from(Q.dataTransfer.files);xe.length>0&&await Fe(xe)}function we(){const Q=t.trim().slice(0,32);N(Q||""),L(null),_(xe=>!xe)}function Ge(){if(!Z)return;const Q=G.getState();if(!P)Q.setPreviousPermissionMode(e,Y),zn(e,{type:"set_permission_mode",mode:"plan"}),Q.updateSession(e,{permissionMode:"plan"});else{const xe=ie||($?"bypassPermissions":"acceptEdits");zn(e,{type:"set_permission_mode",mode:xe}),Q.updateSession(e,{permissionMode:xe})}}async function gt(){const Q=t.trim(),xe=j.trim();if(!Q||!xe)return;if(w==="project"&&!(T!=null&&T.cwd)){L("No project folder available for this session");return}const Oe={name:xe,content:Q,scope:w};w==="project"&&(Oe.projectPaths=[T.cwd]);try{await Ne.createPrompt(Oe),await R.refreshPrompts(),_(!1),N(""),E("global"),L(null)}catch(Xe){const lt=Xe instanceof Error&&Xe.message?Xe.message:"Could not save prompt.";L(lt)}}const je=G(Q=>Q.promptSuggestions.get(e))??fD,Be=G(Q=>Q.clearPromptSuggestions),Te=G(Q=>Q.sessionStatus).get(e)==="running",Xr=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 ${h?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:mt,onDragLeave:rt,onDrop:Dt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[h&&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"})}),r.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:r.map((Q,xe)=>l.jsx(AS,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>Je(xe)},xe))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:I,type:"file",multiple:!0,onChange:dt,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((Q,xe)=>l.jsx("button",{onClick:()=>{if(!Z||Te)return;const Oe=vg();zn(e,{type:"user_message",content:Q,session_id:e,client_msg_id:Oe}),G.getState().appendMessage(e,{id:Oe,role:"user",content:Q,timestamp:Date.now()}),Be(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:Q,children:Q},xe))}),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&&X.length>0&&l.jsx("div",{ref:W,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:X.map((Q,xe)=>l.jsxs("button",{"data-cmd-index":xe,onClick:()=>M(Q),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${xe===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:Q.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:["/",Q.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Q.type})]})]},`${Q.type}-${Q.name}`))}),l.jsx(FS,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:me,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:Q=>{N(Q.target.value),C&&L(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":w==="global",onClick:()=>E("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${w==="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":w==="project",onClick:()=>E("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${w==="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"})]}),w==="project"&&(T==null?void 0:T.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:T.cwd,children:T.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"),L(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:gt,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(J5,{isPlan:P,isConnected:Z,onToggle:Ge,modeLabel:ae,size:"mobile"}),l.jsx(Z5,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(Wd,{onClick:we,disabled:!Z||!t.trim(),active:Z&&!!t.trim(),title:"Save as prompt",children:l.jsx(ew,{})}),l.jsx(Wd,{onClick:()=>{var Q;return(Q=I.current)==null?void 0:Q.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:U,value:t,onChange:De,onKeyDown:Ce,onClick:Ee,onKeyUp:Ee,onPaste:At,"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(tw,{isRunning:Te,canSend:Xr,onSend:be,onInterrupt:Ae,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(Wd,{onClick:()=>{var Q;return(Q=I.current)==null?void 0:Q.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(Wd,{onClick:we,disabled:!Z||!t.trim(),active:Z&&!!t.trim(),title:"Save as prompt",children:l.jsx(ew,{})}),l.jsx(J5,{isPlan:P,isConnected:Z,onToggle:Ge,modeLabel:ae,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(Z5,{sessionId:e}),l.jsx(tw,{isRunning:Te,canSend:Xr,onSend:be,onInterrupt:Ae,size:"desktop"})]})]})]})})}function mD(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 r=e.rules[0];if(r!=null&&r.ruleContent)return`Allow "${r.ruleContent}" ${n}`;if(r!=null&&r.toolName)return`Allow ${r.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function gD(e,t){const n={};for(const[r,a]of Object.entries(t)){const o=e[Number(r)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:r;n[u]=a}return n}function xD({permission:e,sessionId:t}){const[n,r]=k.useState(!1),a=G(p=>p.removePermission);function o(p,m){r(!0),zn(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(){r(!0),zn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const h=e.tool_name==="AskUserQuestion",f=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 ${h?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:h?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 ${h?"text-cc-primary":"text-cc-warning"}`,children:h?"Question":"Permission Request"}),!h&&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})]}),h?l.jsx(wD,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(yD,{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&&!h&&l.jsx(bD,{validation:e.ai_validation}),!h&&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"]}),f==null?void 0:f.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"})}),mD(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 vD(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 bD({validation:e}){const t=e.verdict==="uncertain"&&vD(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",r=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:r}),l.jsx("span",{children:e.reason})]})}function yD({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(_D,{input:t}):e==="Edit"?l.jsx(kD,{input:t}):e==="Write"?l.jsx(SD,{input:t}):e==="Read"?l.jsx(jD,{input:t}):e==="Glob"?l.jsx(ND,{input:t}):e==="Grep"?l.jsx(CD,{input:t}):e==="ExitPlanMode"?l.jsx(ED,{input:t}):l.jsx(IS,{input:t,description:n})}function _D({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 wD({input:e,onSelect:t,disabled:n}){const r=Array.isArray(e.questions)?e.questions:[],[a,o]=k.useState({}),[u,h]=k.useState({}),[f,p]=k.useState({});function m(N){return gD(r,N)}function x(N,w){const E=String(N);o(C=>({...C,[E]:w})),p(C=>({...C,[E]:!1})),r.length<=1&&t(m({[E]:w}))}function b(N){var C;const w=String(N),E=(C=u[w])==null?void 0:C.trim();E&&(o(L=>({...L,[w]:E})),r.length<=1&&t(m({[w]:E})))}function y(N,w){const E=String(N);h(L=>({...L,[E]:w}));const C=w.trim();o(L=>{if(!C){const O={...L};return delete O[E],O}return{...L,[E]:C}})}function _(N){const w=String(N);p(E=>{const C=!!E[w],L={...E,[w]:!C};return C&&(o(O=>{const D={...O};return delete D[w],D}),h(O=>{const D={...O};return delete D[w],D})),L})}function j(){t(m(a))}if(r.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(IS,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[r.map((N,w)=>{const E=typeof N.header=="string"?N.header:"",C=typeof N.question=="string"?N.question:"",L=Array.isArray(N.options)?N.options:[],O=String(w),D=a[O],U=f[O];return l.jsxs("div",{className:"space-y-2",children:[E&&l.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:E}),C&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:C}),L.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[L.map((I,W)=>{const z=typeof I.label=="string"?I.label:String(I),q=typeof I.description=="string"?I.description:"",T=D===z;return l.jsx("button",{onClick:()=>x(w,z),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${T?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children: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 ${T?"border-cc-primary":"border-cc-muted/40"}`,children:T&&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:z}),q&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:q})]})]})},W)}),l.jsx("button",{onClick:()=>_(w),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${U?"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 ${U?"border-cc-primary":"border-cc-muted/40"}`,children:U&&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..."})]})}),U&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[O]||"",onChange:I=>y(w,I.target.value),onKeyDown:I=>{I.key==="Enter"&&b(w)},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}),r.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},w)}),r.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 kD({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=String(e.new_string||"");return l.jsx(ao,{oldText:n,newText:r,fileName:t,mode:"compact"})}function SD({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(ao,{newText:n,fileName:t,mode:"compact"})}function jD({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 ND({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 CD({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",r=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}),r&&l.jsx("div",{className:"text-cc-muted",children:r})]})}function ED({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(dv,{remarkPlugins:[mv],components:{h1:({children:r})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:r}),h2:({children:r})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:r}),h3:({children:r})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:r}),p:({children:r})=>l.jsx("p",{className:"mb-2 last:mb-0",children:r}),ul:({children:r})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:r}),ol:({children:r})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:r}),li:({children:r})=>l.jsx("li",{children:r}),strong:({children:r})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:r}),a:({href:r,children:a})=>l.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:r=>{const{children:a,className:o}=r;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(jS,{textClassName:"text-[12px] text-cc-code-fg",children:a})},pre:({children:r})=>l.jsx(l.Fragment,{children:r}),blockquote:({children:r})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:r})},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((r,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(r.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(r.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function IS({input:e,description:t}){const n=Object.entries(e).filter(([,r])=>r!=null&&r!=="");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(([r,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:[r,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},r)})})]})}function AD({entry:e,onDismiss:t}){const{request:n,behavior:r,reason:a}=e,o=r==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const h=n.input.command;u=h.length>60?h.slice(0,60)+"...":h}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 TD=[],MD=[],nw="activity-tray-panel";function RD(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),a=n%60;return`${r}m${a>0?` ${a}s`:""}`}function LD(e,t,n=4e3){const[r,a]=k.useState(!1),o=k.useRef(void 0),u=e.length+t.length,h=u>0&&e.every(f=>f.status==="completed")&&t.every(f=>f.status!=="running");return k.useEffect(()=>(clearTimeout(o.current),h?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[h,n]),k.useEffect(()=>{a(!1)},[u]),r}function DD(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const r=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(r)},[e]),t}function OD({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 zD({agent:e,tick:t}){const[n,r]=k.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(OD,{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:RD(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>r(!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 BD({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 PD({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=k.useRef(null),o=G(C=>C.sessionTasks.get(e)??TD),u=G(C=>C.sessionBackgroundAgents.get(e)??MD),h=LD(o,u),f=u.some(C=>C.status==="running"),p=DD(f),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=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const C=L=>{L.key==="Escape"&&(L.stopPropagation(),N())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,N]),k.useEffect(()=>{if(!t)return;const C=L=>{r.current&&!r.current.contains(L.target)&&N()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[w,E]=k.useState(!1);return k.useEffect(()=>{_&&E(!1)},[_,o.length,u.length]),!_||w?null:l.jsxs("div",{ref:r,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${h?"opacity-0 pointer-events-none":"opacity-100"}`,style:h?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{h&&E(!0)},children:[t&&l.jsxs("div",{ref:a,id:nw,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(zD,{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(BD,{task:C},C.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":nw,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 $D({sessionId:e}){const t=G(_=>_.pendingPermissions.get(e)),n=G(_=>_.aiResolvedPermissions.get(e)),r=G(_=>_.clearAiResolvedPermissions),a=G(_=>_.connectionStatus.get(e)??"disconnected"),o=G(_=>_.cliConnected.get(e)??!1),u=G(_=>_.cliReconnecting.get(e)??!1),h=G(_=>_.setCliReconnecting),[f,p]=k.useState(null),m=k.useRef(void 0);k.useEffect(()=>{p(null),clearTimeout(m.current)},[e,o]),k.useEffect(()=>()=>clearTimeout(m.current),[]);const x=k.useCallback(async()=>{p(null),clearTimeout(m.current),h(e,!0);try{await Ne.relaunchSession(e)}catch(_){Xi(_),h(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),m.current=setTimeout(()=>p(null),4e3)}},[e,h]),b=k.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:f?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:f}),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(lD,{sessionId:e}),l.jsx(PD,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(AD,{entry:n[n.length-1],onDismiss:()=>r(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(xD,{permission:_,sessionId:e},_.request_id))}),l.jsx(pD,{sessionId:e})]})}function FD({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=G(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,h=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function p(m){r.current&&!r.current.contains(m.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function f(p,m){const x=!m,b={[p]:x};G.getState().setSessionAiValidation(e,b),U3(e,b)}return l.jsxs("div",{ref:r,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:()=>f("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:()=>f("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:()=>f("aiValidationAutoDeny",h),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 ${h?"text-cc-success":"text-cc-muted"}`,children:h?"On":"Off"})]})]})]})]})}function UD({sessionId:e}){const[t,n]=k.useState(!1),[r,a]=k.useState(null),[o,u]=k.useState(!1),h=k.useRef(null);k.useEffect(()=>{if(!t)return;const p=x=>{h.current&&!h.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 f=k.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){Xi(m),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:h,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:()=>f("html"),disabled:r!==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:[r==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>f("txt"),disabled:r!==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:[r==="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 ID({sessionId:e}){const t=G(m=>m.density),n=G(m=>m.magicUiAvailable),r=G(m=>{var x;return!!e&&((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0}),a=k.useCallback(()=>{var x;if(!e)return;const m=G.getState();((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0&&(m.setSessionMagicUi(e,!1),Cy(e,!1))},[e]),o=k.useCallback(()=>{G.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{G.getState().setDensity("compact"),a()},[a]),h=k.useCallback(()=>{e&&(G.getState().setSessionMagicUi(e,!0),Cy(e,!0))},[e]);if(!n||!e)return l.jsx(HD,{});const f=t==="compact",p=[{key:"standard",label:"Standard view",active:!r&&!f,onClick:o,icon:l.jsx(HS,{})},{key:"compact",label:"Compact view",active:!r&&f,onClick:u,icon:l.jsx(qS,{})},{key:"magic",label:"Magic dashboard view",active:r,onClick:h,icon:l.jsx(qD,{})}];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 HD(){const e=G(a=>a.density),t=k.useCallback(()=>G.getState().toggleDensity(),[]),n=e==="compact",r=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:r,"aria-label":r,"aria-pressed":n,children:n?l.jsx(qS,{}):l.jsx(HS,{})})}function HS(){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 qD(){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 VD(){var U;const e=k.useSyncExternalStore(I=>(window.addEventListener("hashchange",I),()=>window.removeEventListener("hashchange",I)),()=>window.location.hash),t=k.useMemo(()=>Wx(e),[e]),n=t.page==="session"||t.page==="home",r=G(I=>I.currentSessionId),a=G(I=>I.cliConnected),o=G(I=>I.sessionStatus),u=G(I=>I.sessionNames),h=G(I=>I.sdkSessions),f=G(I=>I.sidebarOpen),p=G(I=>I.setSidebarOpen),m=G(I=>I.taskPanelOpen),x=G(I=>I.setTaskPanelOpen),b=G(I=>I.activeTab),y=G(I=>I.setActiveTab),_=G(I=>I.markChatTabReentry),j=G(I=>r?I.gitChangedFilesCount.get(r)??0:0),N=r?o.get(r)??null:null,w=r?a.get(r)??!1:!1,E=r?(u==null?void 0:u.get(r))||((U=h.find(I=>I.sessionId===r))==null?void 0:U.name)||`Session ${r.slice(0,8)}`:null,C=!!(r&&n),L=t.page==="session"&&!!r,O=["chat","diff"],D=I=>{I==="chat"&&b!=="chat"&&r&&_(r),y(I)};return k.useEffect(()=>{const I=W=>{if(!(W.metaKey||W.ctrlKey)||W.key.toLowerCase()!=="j"||!C)return;const z=W.target;if(z&&(z.tagName==="TEXTAREA"||z.tagName==="INPUT"||z.isContentEditable))return;W.preventDefault();const q=Math.max(0,O.indexOf(b)),T=W.shiftKey?-1:1,ie=(q+T+O.length)%O.length;D(O[ie])};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[C,O,b,y,_,r]),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(!f),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${f?"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:()=>D("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 ${w?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>D("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&&r&&l.jsx(FD,{sessionId:r}),C&&r&&l.jsx(UD,{sessionId:r}),C&&l.jsx(ID,{sessionId:r??null}),l.jsx(GD,{}),L&&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 GD(){const e=G(n=>n.darkMode),t=k.useCallback(()=>G.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 VS="cc-recent-dirs";function Ih(){try{return JSON.parse(localStorage.getItem(VS)||"[]")}catch{return[]}}function GS(e){const t=Ih().filter(n=>n!==e);t.unshift(e),localStorage.setItem(VS,JSON.stringify(t.slice(0,5)))}function YD(){return!1}function YS({onClose:e,embedded:t=!1}){const[n,r]=k.useState([]),[a,o]=k.useState(!0),[u,h]=k.useState(null),[f,p]=k.useState(""),[m,x]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,w]=k.useState(""),[E,C]=k.useState([{key:"",value:""}]),[L,O]=k.useState(!1),D=k.useCallback(()=>{Ne.listEnvs().then(r).catch(()=>{}).finally(()=>o(!1))},[]);k.useEffect(()=>{D()},[D]);function U(Y){h(Y.slug),p(Y.name);const P=Object.entries(Y.variables).map(([$,re])=>({key:$,value:re}));P.length===0&&P.push({key:"",value:""}),x(P),y("")}function I(){h(null),y("")}async function W(){if(!u)return;const Y={};for(const P of m){const $=P.key.trim();$&&(Y[$]=P.value)}try{await Ne.updateEnv(u,{name:f.trim()||void 0,variables:Y}),h(null),y(""),D()}catch(P){y(P instanceof Error?P.message:String(P))}}async function z(Y){try{await Ne.deleteEnv(Y),u===Y&&h(null),D()}catch(P){y(P instanceof Error?P.message:String(P))}}async function q(){const Y=N.trim();if(!Y)return;O(!0);const P={};for(const $ of E){const re=$.key.trim();re&&(P[re]=$.value)}try{await Ne.createEnv(Y,P),w(""),C([{key:"",value:""}]),j(!1),y(""),D()}catch($){y($ instanceof Error?$.message:String($))}finally{O(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:N,onChange:Y=>w(Y.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:Y=>{Y.key==="Enter"&&N.trim()&&q()}}),l.jsx(Qd,{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:q,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(Y=>{const P=u===Y.slug,$=Object.keys(Y.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:f,onChange:re=>p(re.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(Qd,{rows:m,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:I,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 W(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},Y.slug):l.jsx(WD,{env:Y,varCount:$,onStartEdit:()=>U(Y),onDelete:()=>void z(Y.slug)},Y.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const T=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:Y=>w(Y.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:Y=>{Y.key==="Enter"&&N.trim()&&q()}}),l.jsx(Qd,{rows:E,onChange:C}),l.jsx("button",{onClick:q,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]}),ie=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(Y=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:Y.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]}),u===Y.slug?l.jsx("button",{onClick:I,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:()=>U(Y),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>z(Y.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===Y.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:f,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(Qd,{rows:m,onChange:x})]})}),l.jsx("button",{onClick:W,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==Y.slug&&Object.keys(Y.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(Y.variables).map(([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))})]},Y.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:Y=>Y.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),ie,T]})]});return lo.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 WD({env:e,varCount:t,onStartEdit:n,onDelete:r}){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:r,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 Qd({rows:e,onChange:t}){function n(o,u,h){const f=[...e];f[o]={...f[o],[u]:h},t(f)}function r(o){const u=e.filter((h,f)=>f!==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:h=>n(u,"key",h.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:h=>n(u,"value",h.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:()=>r(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 QD=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:YS},Symbol.toStringTag,{value:"Module"}));function XD(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let r="";for(const a of t)r+="/"+a,n.push({label:a,path:r});return n}function KD({initialPath:e,onSelect:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState([]),[h,f]=k.useState(!0),[p,m]=k.useState(""),[x,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,E]=k.useState(-1),[C,L]=k.useState(!1),[O,D]=k.useState(()=>Ih()),U=k.useRef(null),I=k.useRef(null),W=k.useRef(null),z=k.useRef(new Map),q=k.useMemo(()=>{if(!j)return o;const $=j.toLowerCase();return o.filter(re=>re.name.toLowerCase().includes($))},[o,j]),T=k.useCallback(async $=>{f(!0),m(""),N(""),E(-1);try{const re=await Ne.listDirs($);a(re.path),u(re.dirs)}catch{m("Could not load directory"),u([])}finally{f(!1)}},[]);k.useEffect(()=>{T(e||void 0)},[]),k.useEffect(()=>{const $=U.current;if(!$)return;function re(R){if(R.key!=="Tab")return;const B=$.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(B.length===0)return;const X=B[0],M=B[B.length-1];R.shiftKey&&document.activeElement===X?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),X.focus())}document.addEventListener("keydown",re);const ae=setTimeout(()=>{var R;(R=W.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(ae)}},[]);const ie=k.useCallback(()=>{C||(L(!0),setTimeout(n,150))},[n,C]);k.useEffect(()=>{function $(re){if(re.key==="Escape"){if(y)return;ie()}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,ie]),k.useEffect(()=>{function $(re){var R,B;if(y)return;if(re.key==="Backspace"&&document.activeElement!==W.current){if(r&&r!=="/"){re.preventDefault();const X=r.split("/").slice(0,-1).join("/")||"/";T(X)}return}const ae=q.length;if(ae!==0){if(re.key==="ArrowDown"){re.preventDefault();const X=w<ae-1?w+1:0;E(X),(R=z.current.get(X))==null||R.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const X=w>0?w-1:ae-1;E(X),(B=z.current.get(X))==null||B.focus()}}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,q.length,w,r,T]),k.useEffect(()=>{var $;w>=0&&(($=z.current.get(w))==null||$.scrollIntoView({block:"nearest"}))},[w]);function Z($){GS($),D(Ih()),t($),n()}const Y=XD(r),P=r.split("/").pop()||"/";return lo.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:ie,children:l.jsxs("div",{ref:U,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:ie,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),O.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:O.map($=>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:Y.map(($,re)=>{const ae=re===Y.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[re>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||T($.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(r)},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:W,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(r),"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:I,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:h?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map(($,re)=>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+re*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 ${re*.1}s infinite`}})]},re))}):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:()=>T(r||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):q.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:q.map(($,re)=>l.jsxs("li",{className:`flex items-center transition-colors ${w===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ae=>{ae?z.current.set(re,ae):z.current.delete(re)},onClick:()=>T($.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 ZD(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function JD(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():ZD(e.identifier,e.title)}function Uc({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 eO({defaultProjectId:e,connectionId:t,onCreated:n,onClose:r}){const[a,o]=k.useState(""),[u,h]=k.useState(""),[f,p]=k.useState(""),[m,x]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,w]=k.useState(""),[E,C]=k.useState(""),[L,O]=k.useState(!0),[D,U]=k.useState(!1),[I,W]=k.useState("");k.useEffect(()=>{let q=!0;return Promise.all([Ne.getLinearStates(t),Ne.getLinearConnection(t)]).then(([T,ie])=>{var Y;if(!q)return;j(T.teams),w(ie.viewerId);const Z=((Y=T.teams[0])==null?void 0:Y.id)||"";p(Z)}).catch(T=>{q&&W(T instanceof Error?T.message:"Failed to load teams")}).finally(()=>{q&&O(!1)}),()=>{q=!1}},[t]),k.useEffect(()=>{if(!f||_.length===0){C("");return}const q=_.find(ie=>ie.id===f),T=q==null?void 0:q.states.find(ie=>ie.type==="backlog");C((T==null?void 0:T.id)||"")},[f,_]);async function z(){if(!(!a.trim()||!f)){U(!0),W("");try{const q=await Ne.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:m,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:E||void 0,connectionId:t});n(q.issue)}catch(q){W(q instanceof Error?q.message:"Failed to create issue")}finally{U(!1)}}}return lo.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:r,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:q=>q.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:r,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"})})})]}),I&&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:I}),L?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:q=>o(q.target.value),onKeyDown:q=>{q.key==="Enter"&&a.trim()&&f&&!D&&z()},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:q=>h(q.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:f,onChange:q=>p(q.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(q=>l.jsxs("option",{value:q.id,children:[q.name," (",q.key,")"]},q.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:q=>x(Number(q.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:q=>y(q.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:r,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:z,disabled:!a.trim()||!f||D,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:D?"Creating...":"Create Issue"})]})]})]})}),document.body)}function tO({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:r,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[h,f]=k.useState([]),[p,m]=k.useState(null),[x,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[w,E]=k.useState(!1),[C,L]=k.useState(!1),[O,D]=k.useState(""),[U,I]=k.useState(!1),[W,z]=k.useState(null),[q,T]=k.useState([]),[ie,Z]=k.useState(!1),[Y,P]=k.useState(""),[$,re]=k.useState(!1),[ae,R]=k.useState([]),[B,X]=k.useState(!1),[M,me]=k.useState(""),[be,Ce]=k.useState(!1),[De,Ee]=k.useState([]),[Ae,Fe]=k.useState(!1),[dt,Je]=k.useState(!1),At=k.useRef(null);k.useEffect(()=>{function je(Be){At.current&&!At.current.contains(Be.target)&&(E(!1),re(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),k.useEffect(()=>{if(!n){f([]),m(null),b(!1),u(null);return}let je=!0;return Ne.listLinearConnections().then(({connections:Be})=>{je&&(f(Be),b(!0),Be.length>0?(m(Be[0].id),u(Be[0].id)):(m(null),u(null)))}).catch(()=>{je&&b(!0)}),()=>{je=!1}},[n]);const mt=k.useCallback(je=>{m(je),u(je),a(null),N([]),_(""),D(""),Ee([]),me(""),R([]),W&&(Z(!0),P(""),Ne.getLinearProjectIssues(W.projectId,10,je).then(({issues:Be})=>{T(Be)}).catch(Be=>{P(Be instanceof Error?Be.message:String(Be))}).finally(()=>{Z(!1)}))},[W,u,a]);k.useEffect(()=>{if(!t||!n){z(null),T([]);return}let je=!0;return Z(!0),P(""),(async()=>{try{const{mapping:Be}=await Ne.getLinearProjectMapping(t.repoRoot);if(!je)return;if(z(Be),Be){const{issues:yt}=await Ne.getLinearProjectIssues(Be.projectId,10,p??void 0);if(!je)return;T(yt)}else T([])}catch(Be){if(!je)return;P(Be instanceof Error?Be.message:String(Be))}finally{je&&Z(!1)}})(),()=>{je=!1}},[t,n,p]),k.useEffect(()=>{if(!n)return;const je=y.trim();if(je.length<2){N([]),D(""),L(!1);return}let Be=!0;L(!0),D("");const yt=setTimeout(()=>{Ne.searchLinearIssues(je,8,p??void 0).then(Te=>{Be&&N(Te.issues)}).catch(Te=>{Be&&(N([]),D(Te instanceof Error?Te.message:String(Te)))}).finally(()=>{Be&&L(!1)})},400);return()=>{Be=!1,clearTimeout(yt)}},[n,y,p]),k.useEffect(()=>{if(!n||!be){Ee([]),Fe(!1);return}const je=M.trim();if(je.length<2){Ee([]),Fe(!1);return}let Be=!0;Fe(!0);const yt=setTimeout(()=>{Ne.searchLinearIssues(je,10,p??void 0).then(Te=>{Be&&Ee(Te.issues)}).catch(()=>{Be&&Ee([])}).finally(()=>{Be&&Fe(!1)})},400);return()=>{Be=!1,clearTimeout(yt)}},[n,be,M,p]);function rt(je,Be=!1){a(je),_(`${je.identifier} - ${je.title}`);const yt=JD(je);o(yt,!0),Be&&E(!1)}function Dt(){a(null),_(""),N([]),D("")}async function we(je){if(t)try{const{mapping:Be}=await Ne.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});z(Be),re(!1),Z(!0),P("");const{issues:yt}=await Ne.getLinearProjectIssues(je.id,10,p??void 0);T(yt)}catch(Be){P(Be instanceof Error?Be.message:String(Be))}finally{Z(!1)}}async function Ge(){if(t){try{await Ne.removeLinearProjectMapping(t.repoRoot)}catch{}z(null),T([]),a(null),_("")}}function gt(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),ae.length===0&&(X(!0),Ne.listLinearProjects(p??void 0).then(({projects:je})=>R(je)).catch(()=>{}).finally(()=>X(!1)))}function _n(je){Je(!1),rt(je),W&&(Z(!0),Ne.getLinearProjectIssues(W.projectId,10,p??void 0).then(({issues:Be})=>T(Be)).catch(()=>{}).finally(()=>Z(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:At,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&&h.length>1&&l.jsx("select",{value:p??"",onChange:je=>mt(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:h.map(je=>l.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),W?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(Uc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:W.projectName}),l.jsx("button",{type:"button",onClick:Ge,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:()=>Je(!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":w,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}E(!w)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${r?"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(Uc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:gt,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:()=>Je(!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."})]})]}),W&&(()=>{const je=M.trim().toLowerCase(),Be=!be&&je?q.filter(Te=>Te.identifier.toLowerCase().includes(je)||Te.title.toLowerCase().includes(je)):be?[]:q,yt=be?De:Be;return l.jsxs("div",{className:"mt-2",children:[r&&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:r.identifier})," - ",r.title]}),l.jsx("button",{type:"button",onClick:Dt,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=>me(Te.target.value),placeholder:be?"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"}),ie?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):Y?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:Y}):Ae?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):be&&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..."}):yt.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:yt.map(Te=>l.jsxs("button",{type:"button",onClick:()=>rt(Te),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(r==null?void 0:r.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:be,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:()=>re(!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:()=>we(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))})]}),w&&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&&O&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:O}),y.trim().length>=2&&!C&&!O&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!C&&!O&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>l.jsxs("button",{type:"button",onClick:()=>rt(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"})})})]}),U&&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:()=>{I(!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"})})]}),dt&&l.jsx(eO,{defaultProjectId:W==null?void 0:W.projectId,connectionId:p??void 0,onCreated:_n,onClose:()=>Je(!1)})]}):null}function nO({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:r,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:h}){const[f,p]=k.useState([]),[m,x]=k.useState(!1),[b,y]=k.useState(""),_=k.useRef(null);return k.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),k.useEffect(()=>{t?Ne.listBranches(t.repoRoot).then(j=>{p(j),h(j)}).catch(()=>{p([]),h([])}):(p([]),h([]))},[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),h(j)}).catch(()=>{p([]),h([])})}),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":r?"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=f.filter(L=>!L.isRemote&&(!j||L.name.toLowerCase().includes(j))),w=f.filter(L=>L.isRemote&&(!j||L.name.toLowerCase().includes(j))),E=f.some(L=>L.name.toLowerCase()===j),C=N.length>0||w.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(L=>l.jsxs("button",{onClick:()=>{o(L.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 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[L.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[L.ahead,"↑"]}),L.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[L.behind,"↓"]}),L.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"}),L.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"})]})]},L.name))]}),w.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"}),w.map(L=>l.jsxs("button",{onClick:()=>{o(L.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 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.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-${L.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 rO=336*60*60*1e3,Ea=12,sO=24;function Sx(e){return e.split("/").filter(Boolean).pop()||e}function rw(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Sx(e.cwd)}function iO(e){return e.length>8?e.slice(0,8):e}function aO(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function lO(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 r=Math.floor(n/60);if(r<24)return`${r}h ago`;const a=Math.floor(r/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 oO(){var mi;const[e,t]=k.useState(""),[n]=k.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[r,a]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[h,f]=k.useState(""),[p,m]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=k.useState([]),[y,_]=k.useState(()=>X5(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>K5(localStorage.getItem("cc-backend")||"claude")),[w,E]=k.useState(()=>localStorage.getItem("cc-effort")||""),[C,L]=k.useState(()=>Ih()[0]||""),[O,D]=k.useState([]),[U,I]=k.useState(null),[W,z]=k.useState(!1),[q,T]=k.useState(""),[ie,Z]=k.useState(null),[Y,P]=k.useState(!1),[$,re]=k.useState(null),[ae,R]=k.useState(null),[B,X]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=ie||$S(p),me=Q5(p),be=hD(p),[Ce,De]=k.useState([]),[Ee,Ae]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[Fe,dt]=k.useState(!1),[Je,At]=k.useState(!1),mt=YD(),[rt,Dt]=k.useState(()=>mt),[we,Ge]=k.useState([]),[gt,_n]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,Be]=k.useState(!1),yt=k.useRef(null),[Te,Xr]=k.useState(null),oe=k.useRef(null),ke=k.useRef(null),[Q,xe]=k.useState(!1),[Oe,Xe]=k.useState(!1),[lt,ot]=k.useState(!1),[Et,wn]=k.useState(!1),[st,fr]=k.useState(!1),[Bn,cs]=k.useState(""),[Kr,Zr]=k.useState(!0),[ne,ve]=k.useState([]),[_e,Ke]=k.useState(!1),[qt,fn]=k.useState(""),[Pn,Vt]=k.useState(!1),[Gn,Tr]=k.useState(Ea),[Ua,uo]=k.useState(""),[Yn,Ji]=k.useState(null),[ho,fo]=k.useState(!1),[Mr,en]=k.useState(""),[Tn,pr]=k.useState(!1),[po,ef]=k.useState([]),[ea,ta]=k.useState(null),[us,oi]=k.useState(!1),[As,Jn]=k.useState(""),[na,ds]=k.useState(0),nn=k.useRef(null),er=k.useRef(null),Ia=k.useRef(null),Jr=k.useRef(null),hs=k.useRef(null),mo=k.useRef(null),go=G(H=>H.currentSessionId),rn=US({text:e,caretPos:na,cwd:C||void 0});k.useEffect(()=>{if(nn.current===null||!er.current)return;const H=nn.current;er.current.setSelectionRange(H,H),nn.current=null},[e]),k.useEffect(()=>{var ge;window.matchMedia("(min-width: 640px)").matches&&((ge=er.current)==null||ge.focus())},[]),k.useEffect(()=>{Ne.getHome().then(({home:H,cwd:ge})=>{C||L(ge||H)}).catch(()=>{}),Ne.listEnvs().then(De).catch(()=>{}),Ne.listSandboxes().then(Ge).catch(()=>{}),Ne.getBackends().then(b).catch(()=>{}),Ne.getSettings().then(H=>{P(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function tf(H){m(H),localStorage.setItem("cc-backend",H),Z(null),_(X5(H)),N(K5(H)),H!=="claude"&&(fr(!1),ve([]),fn(""),Ke(!1),Vt(!1),Tr(Ea),uo(""))}k.useEffect(()=>{if(p!=="codex"){Z(null);return}Ne.getBackendModels(p).then(H=>{if(H.length>0){const ge=uD(H);Z(ge),ge.some(Ze=>Ze.value===y)||_(ge[0].value)}}).catch(()=>{})},[p]),k.useEffect(()=>{if(oe.current&&(clearInterval(oe.current),oe.current=null),Xr(null),!rt)return;const H="the-companion:latest",ge=()=>{Ne.getImageStatus(H).then(Ze=>{Xr(Ze),Ze.status==="idle"&&Ne.pullImage(H).catch(()=>{}),(Ze.status==="ready"||Ze.status==="error")&&oe.current&&(clearInterval(oe.current),oe.current=null)}).catch(()=>{})};return ge(),oe.current=setInterval(ge,2e3),()=>{oe.current&&(clearInterval(oe.current),oe.current=null)}},[rt]),k.useEffect(()=>{function H(ge){Ia.current&&!Ia.current.contains(ge.target)&&xe(!1),Jr.current&&!Jr.current.contains(ge.target)&&Xe(!1),hs.current&&!hs.current.contains(ge.target)&&ot(!1),mo.current&&!mo.current.contains(ge.target)&&dt(!1),yt.current&&!yt.current.contains(ge.target)&&Be(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),k.useEffect(()=>{if(!C){Ji(null);return}Ne.getRepoInfo(C).then(H=>{Ji(H),en(H.currentBranch),pr(!1)}).catch(()=>{Ji(null),en(""),pr(!1)})},[C]);const ra=M.find(H=>H.value===y)||M[0],Ha=me.find(H=>H.value===j)||me[0],es=be.find(H=>H.value===w)||be[0],tr=p==="codex"?"/logo-codex.svg":"/logo.svg",cu=C?C.split("/").pop()||C:"Select folder",xo=k.useMemo(()=>Bn.trim(),[Bn]),qa=p==="claude"&&st&&xo.length>0,fs=k.useMemo(()=>{const H=Date.now()-rO;return ne.filter(ge=>ge.createdAt>=H)},[ne]),ci=k.useMemo(()=>Pn?ne:fs.length>0?fs:ne,[Pn,fs,ne]),Rr=k.useMemo(()=>Ua.trim().toLowerCase(),[Ua]),un=k.useMemo(()=>Rr?ci.filter(H=>{const ge=rw(H).toLowerCase(),Ze=Sx(H.cwd).toLowerCase(),_t=(H.gitBranch||"").toLowerCase(),ct=H.cwd.toLowerCase(),Ve=H.resumeSessionId.toLowerCase();return ge.includes(Rr)||Ze.includes(Rr)||_t.includes(Rr)||ct.includes(Rr)||Ve.includes(Rr)}):ci,[ci,Rr]),sa=k.useMemo(()=>un.slice(0,Gn),[un,Gn]),uu=Gn<un.length,Va=Math.max(0,ne.length-fs.length),ui=!Pn&&fs.length>0,Ga=k.useCallback(async()=>{if(p==="claude"){Ke(!0),fn("");try{const[H,ge]=await Promise.all([Ne.listSessions(),Ne.discoverClaudeSessions(400).then(Ve=>Ve.sessions)]),Ze=new Map,_t=Ve=>{const Wn=Ze.get(Ve.resumeSessionId);(!Wn||Ve.createdAt>Wn.createdAt)&&Ze.set(Ve.resumeSessionId,Ve)};for(const Ve of H)Ve.backendType!=="codex"&&Ve.cliSessionId&&_t({resumeSessionId:Ve.cliSessionId,sessionId:Ve.sessionId,name:Ve.name,model:Ve.model,createdAt:Ve.createdAt,cwd:Ve.cwd,gitBranch:Ve.gitBranch,source:"companion"});for(const Ve of ge)_t({resumeSessionId:Ve.sessionId,sessionId:Ve.sessionId,slug:Ve.slug,createdAt:Ve.lastActivityAt,cwd:Ve.cwd,gitBranch:Ve.gitBranch,source:"claude_disk"});const ct=Array.from(Ze.values()).sort((Ve,Wn)=>{const kn=C&&Ve.cwd===C?0:1,Or=C&&Wn.cwd===C?0:1;return kn!==Or?kn-Or:Wn.createdAt-Ve.createdAt});ve(ct),Vt(!1),Tr(Ea)}catch(H){const ge=H instanceof Error?H.message:String(H);fn(ge||"Failed to load existing sessions"),ve([]),Tr(Ea)}finally{Ke(!1)}}},[p,C]);k.useEffect(()=>{p==="claude"&&st&&Ga()},[p,st,Ga]),k.useEffect(()=>{Tr(Ea)},[Rr,Pn]);async function vo(H){if(H.length===0)return;const ge=[],Ze=[];let _t=O.reduce((ct,Ve)=>ct+Ve.size,0);for(const ct of H){if(ct.size>Fh){Ze.push(`${ct.name} is too large (${Gi(ct.size)}, max ${Gi(Fh)})`);continue}if(_t+ct.size>Uh){Ze.push(`${ct.name} would exceed the per-message limit (${Gi(Uh)})`);continue}const{base64:Ve,mediaType:Wn}=await NS(ct);ge.push({name:ct.name,base64:Ve,mediaType:Wn,size:ct.size}),_t+=ct.size}ge.length>0&&D(ct=>[...ct,...ge]),I(Ze.length>0?Ze.join("; "):null)}async function di(H){const ge=H.target.files;ge&&(await vo(Array.from(ge)),H.target.value="")}function nf(H){D(ge=>ge.filter((Ze,_t)=>_t!==H))}async function du(H){var _t;const ge=(_t=H.clipboardData)==null?void 0:_t.items;if(!ge)return;const Ze=[];for(const ct of Array.from(ge)){if(ct.kind!=="file")continue;const Ve=ct.getAsFile();if(!Ve)continue;const Wn=Ve.name&&Ve.name.length>0?Ve.name:`pasted-${Date.now()}.${(Ve.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ze.push(new File([Ve],Wn,{type:Ve.type,lastModified:Ve.lastModified}))}Ze.length>0&&(H.preventDefault(),await vo(Ze))}function hu(H){t(H.target.value),ds(H.target.selectionStart??H.target.value.length);const ge=H.target;ge.style.height="auto",ge.style.height=Math.min(ge.scrollHeight,200)+"px"}function Ya(){er.current&&ds(er.current.selectionStart??0)}function fu(H){var Ze;const ge=rn.selectPrompt(H);nn.current=ge.nextCursor,t(ge.nextText),rn.setMentionMenuOpen(!1),ds(ge.nextCursor),(Ze=er.current)==null||Ze.focus(),er.current&&(er.current.style.height="auto",er.current.style.height=Math.min(er.current.scrollHeight,200)+"px")}function rf(H){if(rn.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),rn.setMentionMenuOpen(!1);return}if(rn.mentionMenuOpen&&rn.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),rn.setMentionMenuIndex(ge=>(ge+1)%rn.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),rn.setMentionMenuIndex(ge=>(ge-1+rn.filteredPrompts.length)%rn.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),fu(rn.filteredPrompts[rn.mentionMenuIndex]);return}}if(rn.mentionMenuOpen&&rn.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 ge=Q5(p),_t=(ge.findIndex(ct=>ct.value===j)+1)%ge.length;N(ge[_t].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Lr())}function Wa(H){const ge=r.trim(),Ze=ge?`[${ge}]: ${H}`:H;if(!$)return Ze;const _t=($.description??"").trim();return`${["Linear issue context:",`- Identifier: ${$.identifier}`,`- Title: ${$.title}`,$.stateName?`- State: ${$.stateName}`:"",$.priorityLabel?`- Priority: ${$.priorityLabel}`:"",$.teamName?`- Team: ${$.teamName}`:"",`- URL: ${$.url}`,_t?`- Description:
|
|
112
|
-
${_t}`:""].filter(Boolean).join(`
|
|
113
|
-
`)}
|
|
114
|
-
|
|
115
|
-
User request:
|
|
116
|
-
${Ze}`}async function Lr(){const H=e.trim();if(!(!H||W)){if(n&&!r.trim()){T("Please enter your name before starting a session.");return}if(z(!0),T(""),Jn(""),Yn){const ge=Mr||Yn.currentBranch;if(ge&&ge===Yn.currentBranch){const Ze=po.find(_t=>_t.name===ge&&!_t.isRemote);if(Ze&&Ze.behind>0){ta({behind:Ze.behind,branchName:ge});return}}}await hi(H)}}async function hi(H,ge){const Ze=G.getState();Ze.clearCreation(),Ze.setSessionCreating(!0,p);try{go&&_g(go);const _t=(ge==null?void 0:ge.resumeSessionAt)||(qa?xo:void 0),ct=_t?(ge==null?void 0:ge.forkSession)??(qa?Kr:void 0):void 0,Ve=(ge==null?void 0:ge.cwd)||C,Wn=(ge==null?void 0:ge.branch)!==void 0?ge.branch.trim()||void 0:Mr.trim()||void 0,kn=(ge==null?void 0:ge.useWorktree)!==void 0?ge.useWorktree:ho,Or=(ge==null?void 0:ge.createBranch)!==void 0?ge.createBranch:!!(Wn&&Tn),Ts=await B6({model:y,permissionMode:j,effort:p==="claude"&&w?w:void 0,cwd:Ve||void 0,envSlug:Ee||void 0,sandboxEnabled:rt?!0:void 0,sandboxSlug:rt&>?gt:void 0,branch:Wn,createBranch:Or?!0:void 0,useWorktree:kn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:_t,forkSession:ct,userName:r.trim()||void 0,linearConnectionId:$&&ae||void 0,linearIssue:$?{identifier:$.identifier,title:$.title,stateName:$.stateName,teamName:$.teamName,url:$.url}:void 0},ps=>{G.getState().addCreationProgress(ps)}),Sn=Ts.sessionId,gu=G.getState(),yo=gu.sdkSessions.filter(ps=>ps.sessionId!==Sn);gu.setSdkSessions([...yo,{sessionId:Sn,state:Ts.state,cwd:Ts.cwd,createdAt:Date.now(),backendType:Ts.backendType||p,model:y,permissionMode:j,userName:r.trim()||void 0,resumeSessionAt:_t,forkSession:_t?ct===!0:void 0}]);const _o=new Set(G.getState().sessionNames.values()),aa=fw(_o),la=o.trim()||r.trim(),xu=h.trim()||aa,vu=la?`${la}_${xu}`:xu;G.getState().setSessionName(Sn,vu),Ne.renameSession(Sn,vu).catch(()=>{}),f(""),Ve&&GS(Ve),G.getState().setPreviousPermissionMode(Sn,j),Qx(Sn,!0),nu(Sn),await B3(Sn);const bu=H.trim();if(bu.length>0){const ps=Wa(bu),yu=vg(),_u=O.length>0?O.map(Ka=>({name:Ka.name,media_type:Ka.mediaType,data:Ka.base64,size:Ka.size})):void 0;zn(Sn,{type:"user_message",content:ps,session_id:Sn,attachments:_u,client_msg_id:yu}),G.getState().appendMessage(Sn,{id:yu,role:"user",content:ps,attachments:_u,timestamp:Date.now()})}$&&(Ne.linkLinearIssue(Sn,$,ae||void 0).then(()=>G.getState().setLinkedLinearIssue(Sn,$)).catch(()=>{}),Ne.transitionLinearIssue($.id,ae||void 0).catch(()=>{})),G.getState().clearCreation()}catch(_t){const ct=_t instanceof Error?_t.message:String(_t);T(ct),G.getState().setCreationError(ct),z(!1)}}async function Qa(H,ge){W||(z(!0),T(""),Jn(""),L(H.cwd),fo(!1),pr(!1),en(H.gitBranch||""),cs(H.resumeSessionId),Zr(ge),await hi("",{resumeSessionAt:H.resumeSessionId,forkSession:ge,cwd:H.cwd,branch:H.gitBranch,useWorktree:!1,createBranch:!1}))}async function fi(){if(ea){oi(!0),Jn("");try{const H=C||(Yn==null?void 0:Yn.repoRoot);if(!H)throw new Error("No working directory");const ge=await Ne.gitPull(H);if(!ge.success){Jn(ge.output||"Pull failed"),oi(!1),z(!1);return}ta(null),oi(!1),await hi(e.trim())}catch(H){Jn(H instanceof Error?H.message:String(H)),oi(!1)}}}function pi(){const H=e.trim();ta(null),Jn(""),hi(H)}function pu(){ta(null),Jn(""),z(!1)}const bo=k.useCallback((H,ge)=>{en(H),pr(ge)},[]),mu=k.useCallback((H,ge)=>{en(H),pr(ge)},[]),ia=k.useCallback(H=>{ef(H)},[]),Dr=k.useCallback(H=>{re(H),!H&&Yn&&(en(Yn.currentBranch),pr(!1))},[Yn]),Xa=e.trim().length>0&&!W&&(!n||r.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:tr,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:r,onChange:H=>{const ge=H.target.value;a(ge),localStorage.setItem("cc-user-name",ge)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":r.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 ge=H.target.value;u(ge),localStorage.setItem("cc-session-prefix",ge)},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:h,onChange:H=>f(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()||r.trim()||"MA","_",h.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:ke,type:"file",multiple:!0,onChange:di,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(FS,{open:rn.mentionMenuOpen,loading:rn.promptsLoading,prompts:rn.filteredPrompts,selectedIndex:rn.mentionMenuIndex,onSelect:fu,menuRef:rn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),($||O.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:()=>Dr(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),O.map((H,ge)=>l.jsx(AS,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>nf(ge),className:"w-10 h-10"},ge))]}),U&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:U}),l.jsx("textarea",{ref:er,value:e,onChange:hu,onKeyDown:rf,onClick:Ya,onKeyUp:Ya,onPaste:du,"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:Ia,children:[l.jsxs("button",{onClick:()=>xe(!Q),"aria-expanded":Q,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:ra.icon}),l.jsx("span",{children:ra.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"})})]}),Q&&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),xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${H.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:H.icon}),H.label]},H.value))})]}),be.length>0&&l.jsxs("div",{className:"relative",ref:hs,children:[l.jsxs("button",{onClick:()=>ot(!lt),"aria-expanded":lt,"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:es.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"})})]}),lt&&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:be.map(H=>l.jsx("button",{onClick:()=>{E(H.value),localStorage.setItem("cc-effort",H.value),ot(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===w?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:Jr,children:[l.jsxs("button",{onClick:()=>Xe(!Oe),"aria-expanded":Oe,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"})}),Ha.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"})})]}),Oe&&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:me.map(H=>l.jsx("button",{onClick:()=>{N(H.value),Xe(!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:()=>wn(!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:cu})]}),Et&&l.jsx(KD,{initialPath:C||"",onSelect:H=>{L(H)},onClose:()=>wn(!1)})]}),l.jsx(nO,{cwd:C,gitRepoInfo:Yn,selectedBranch:Mr,isNewBranch:Tn,useWorktree:ho,onBranchChange:bo,onWorktreeChange:fo,onBranchesLoaded:ia}),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:mo,children:[l.jsxs("button",{onClick:()=>{Fe||Ne.listEnvs().then(De).catch(()=>{}),dt(!Fe)},"aria-expanded":Fe,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?((mi=Ce.find(H=>H.slug===Ee))==null?void 0:mi.name)||"Env":"No env"})]}),Fe&&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:()=>{Ae(""),localStorage.setItem("cc-selected-env",""),dt(!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:()=>{Ae(H.slug),localStorage.setItem("cc-selected-env",H.slug),dt(!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:()=>{At(!0),dt(!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..."})})]})]}),mt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var H;return(H=ke.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:Lr,disabled:!Xa,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Xa?"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&&tf(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:()=>fr(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 ${st?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":st,"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 ${st?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":st?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!st||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 Ga(),disabled:_e,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:_e?"Refreshing...":"Refresh detected sessions"}),ne.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",sa.length," of ",un.length," ",Rr?"matching":ui?"recent":"detected"," Claude session",un.length!==1?"s":"","."]}),!Pn&&Va>0&&fs.length>0&&l.jsxs("button",{type:"button",onClick:()=>{Vt(!0),Tr(Ea)},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 (",Va,")"]}),Pn&&fs.length>0&&l.jsx("button",{type:"button",onClick:()=>{Vt(!1),Tr(Ea)},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:Ua,onChange:H=>uo(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."]}),qt&&l.jsx("p",{className:"text-[11px] text-cc-error",children:qt}),!_e&&!qt&&un.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:Rr?"No sessions match this search.":"No Claude sessions detected yet."}),sa.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:sa.map(H=>{const ge=rw(H),Ze=Sx(H.cwd),_t=H.source==="companion"?"Companion":"Claude",ct=xo===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 ${ct?"text-cc-primary font-medium":"text-cc-fg"}`,children:ge}),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:iO(H.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:_t})]})]}),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:Ze}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:H.cwd,children:aO(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:lO(H.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{cs(H.resumeSessionId),Zr(!0),Qa(H,!0)},"aria-label":`Fork and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${ct&&Kr?"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:()=>{cs(H.resumeSessionId),Zr(!1),Qa(H,!1)},"aria-label":`Continue and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${ct&&!Kr?"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}`)})}),uu&&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:()=>Tr(H=>Math.min(H+sO,un.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 (",un.length-Gn," 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:()=>{X(!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(tO,{cwd:C,gitRepoInfo:Yn,linearConfigured:Y,selectedLinearIssue:$,onIssueSelect:Dr,onBranchFromIssue:mu,onConnectionSelect:R})]}),ea&&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:ea.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[ea.behind," commit",ea.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),As&&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:As}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:pu,disabled:us,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:pi,disabled:us,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:fi,disabled:us,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:us?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"})]})]})]})}),q&&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:q})]})]}),Je&&l.jsx(YS,{onClose:()=>{At(!1),Ne.listEnvs().then(De).catch(()=>{})}})]})}const cO=[],uO=[],dO={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"}},hO={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function fO({server:e,sessionId:t}){var h,f;const[n,r]=k.useState(!1),a=dO[e.status]||hO,o=e.status!=="disabled",u=((h=e.tools)==null?void 0:h.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:()=>r(!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:()=>P3(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:()=>$3(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,(f=e.config.args)!=null&&f.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 pO({sessionId:e,onDone:t}){const[n,r]=k.useState(""),[a,o]=k.useState("stdio"),[u,h]=k.useState(""),[f,p]=k.useState(""),[m,x]=k.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(),f.trim()&&(j.args=f.trim().split(/\s+/))):j.url=m.trim(),F3(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:_=>r(_.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:_=>h(_.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:f,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 mO({sessionId:e}){const t=G(h=>h.mcpServers.get(e)||cO),n=G(h=>h.cliConnected.get(e)??!1),[r,a]=k.useState(!1),o=G(h=>{var f;return((f=h.sessions.get(e))==null?void 0:f.mcp_servers)??uO});k.useEffect(()=>{n&&Ny(e)},[e,n]);const u=t.length>0?t:o.map(h=>({name:h.name,status:h.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(!r),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:()=>Ny(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"})]})})]})]}),r&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(pO,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(h=>l.jsx(fO,{server:h,sessionId:e},h.name))}),!r&&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 gO({cwd:e,open:t,onClose:n}){var q;const[r,a]=k.useState([]),[o,u]=k.useState(!0),[h,f]=k.useState(0),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[w,E]=k.useState(null),C=k.useCallback(()=>{u(!0),N(null),Ne.getClaudeMdFiles(e).then(T=>{a(T.files),T.files.length>0&&(f(0),m(T.files[0].content)),E(null),b(!1),u(!1)}).catch(T=>{N(T.message),u(!1)})},[e]);k.useEffect(()=>{t&&C()},[t,C]);const L=T=>{x&&!confirm("Discard unsaved changes?")||(f(T),m(r[T].content),b(!1),E(null))},O=async()=>{var ie;const T=w||((ie=r[h])==null?void 0:ie.path);if(T){_(!0),N(null);try{await Ne.saveClaudeMd(T,p),b(!1),w?C():a(Z=>Z.map((Y,P)=>P===h?{...Y,content:p}:Y))}catch(Z){N(Z instanceof Error?Z.message:"Failed to save")}finally{_(!1)}}},D=T=>{const ie=T==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;E(ie),m(`# CLAUDE.md
|
|
120
|
-
|
|
121
|
-
`),b(!0)},U=()=>{x&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const I=T=>T.startsWith(e+"/")?T.slice(e.length+1):T,W=r.some(T=>T.path===`${e}/CLAUDE.md`),z=r.some(T=>T.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:U}),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:U,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:[r.map((T,ie)=>l.jsxs("button",{onClick:()=>L(ie),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!w&&h===ie?"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:I(T.path)})]},T.path)),w&&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:I(w)})]})]}),(!W||!z)&&!w&&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"}),!W&&l.jsxs("button",{onClick:()=>D("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"})]}),!z&&l.jsxs("button",{onClick:()=>D("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:[r.length===0&&!w?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:()=>D("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:()=>D("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:I(w||(((q=r[h])==null?void 0:q.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[x&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:O,disabled:!x||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${x&&!y?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:y?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:p,onChange:T=>{m(T.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 sw({icon:e,title:t,expanded:n,onToggle:r}){return l.jsxs("button",{onClick:r,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 Qs({label:e,sublabel:t,count:n,onClick:r}){return l.jsxs("button",{onClick:r,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 xO({path:e,content:t,onClose:n}){let r;try{r=JSON.stringify(JSON.parse(t),null,2)}catch{r=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:r})}),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 vO({path:e,label:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState(!0),[h,f]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(null);k.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,r),f(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{m(!1)}},_=()=>{h&&!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:[h&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!h||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${h&&!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:r,onChange:j=>{a(j.target.value),f(!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 bO({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[r,a]=k.useState(null),[o,u]=k.useState(!0);return k.useEffect(()=>{Ne.readFile(e.path).then(h=>{a(h.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(xO,{path:e.path,content:r||"",onClose:n})}return e.kind==="claude-md"?l.jsx(gO,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(vO,{path:e.path,label:e.label,onClose:n})}function yO({sessionId:e}){const t=G(w=>w.sessions.get(e)),n=G(w=>w.sdkSessions.find(E=>E.sessionId===e)),r=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=k.useState(null),[u,h]=k.useState(!0),[f,p]=k.useState(!1),[m,x]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(r)try{const w=await Ne.getClaudeConfig(r);o(w)}catch{}finally{h(!1)}},[r]);if(k.useEffect(()=>{_()},[_]),!r)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(sw,{icon:"project",title:`Project (${j})`,expanded:f,onToggle:()=>p(w=>!w)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(w=>l.jsx(Qs,{label:w.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:w.path,kind:"claude-md"})},w.path)),a.project.settings&&l.jsx(Qs,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(Qs,{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(w=>l.jsx(Qs,{label:`/${w.name}`,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.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(sw,{icon:"user",title:`User (${N})`,expanded:m,onToggle:()=>x(w=>!w)}),m&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(Qs,{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(w=>l.jsx(Qs,{label:w.name,sublabel:w.description?w.description.slice(0,40):void 0,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.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(w=>l.jsx(Qs,{label:w.name,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),a.user.settings&&l.jsx(Qs,{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(w=>l.jsx(Qs,{label:`/${w.name}`,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.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&&lo.createPortal(l.jsx(bO,{item:b,cwd:r,onClose:()=>y(null)}),document.body)]})}function _O(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 r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}class wO extends k.Component{constructor(){super(...arguments);Yb(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Xi(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 WS=[],bv=3e4,kO=6e4,SO=5*6e4;let iw=null,aw=new Map;function jO(e){return e!==iw&&(iw=e,aw=new Map(e.map(t=>[t.sessionId,t]))),aw}function ou(e){return G(k.useCallback(t=>jO(t.sdkSessions).get(e),[e]))}const QS="cc-panel-collapsed";function lw(){try{const e=localStorage.getItem(QS);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function NO(e){try{localStorage.setItem(QS,JSON.stringify([...e]))}catch{}}function XS({id:e,label:t,badge:n,defaultOpen:r=!0,children:a}){const[o,u]=k.useState(()=>lw().has(e)?!0:!r),h=k.useRef(!0);k.useEffect(()=>{if(h.current){h.current=!1;return}const p=lw();o?p.add(e):p.delete(e),NO(p)},[o,e]);const f=k.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:f,"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 CO(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,r]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(XS,{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;r(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 KS(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function ZS(e){return e>80?"critical":e>50?"elevated":"normal"}function ai({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 — ${ZS(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 ${KS(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function EO({sessionId:e}){var f;const[t,n]=k.useState(null),r=k.useCallback(async()=>{try{const p=await Ne.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=k.useRef(0);if(k.useEffect(()=>{r();const p=setInterval(()=>{a.current+=1,a.current%2===0?r():n(m=>m?{...m}:null)},bv);return()=>clearInterval(p)},[r]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,h=!o&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!o&&!u&&!h?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(ai,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?q5(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(ai,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?q5(t.seven_day.resets_at):void 0}),h&&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 — ${ZS(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 ${KS(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function Xd(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function AO(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await Ne.getSystemMemory();r||n(u)}catch{}};a();const o=setInterval(a,kO);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(ai,{label:"Memory",pct:t.used_percent,detail:`${Xd(t.used_bytes)} / ${Xd(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(ai,{label:"Swap",pct:t.swap_used_percent,detail:`${Xd(t.swap_used_bytes)} / ${Xd(t.swap_total_bytes)}`})]}):null}function TO(e){const t=e/1099511627776;if(t>=1)return`${t.toFixed(1)} TB`;const n=e/1024**3;return n>=1?`${n.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function MO(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await Ne.getSystemDisk();r||n(u)}catch{}};a();const o=setInterval(a,SO);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(ai,{label:"Disk",pct:t.used_percent,detail:`${TO(t.available_bytes)} free`})}):null}function RO({sessionId:e}){const t=G(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),bv);return()=>clearInterval(o)},[t]),!t)return null;const{primary:r,secondary:a}=t;return!r&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[r&&l.jsx(ai,{label:`${V5(r.windowDurationMins)} Limit`,pct:r.usedPercent,detail:r.resetsAt>0?kx(r.resetsAt):void 0}),a&&l.jsx(ai,{label:`${V5(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?kx(a.resetsAt):void 0})]})}function LO({sessionId:e}){const t=G(r=>{var a;return(a=r.sessions.get(e))==null?void 0:a.codex_token_details}),n=G(r=>{var a;return((a=r.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:Ec(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:Ec(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:Ec(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:Ec(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(ai,{label:"Context",pct:n})]}):null}function DO(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 OO({pr:e}){const t=DO(e.state,e.isDraft),{checksSummary:n,reviewThreads:r}=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"]}),r.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"})}),r.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 zO({sessionId:e}){const t=G(u=>u.sessions.get(e)),n=ou(e),r=G(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 k.useEffect(()=>{r||!a||!o||Ne.getPRStatus(a,o).then(u=>{G.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,r]),!(r!=null&&r.available)||!r.pr?null:l.jsx(OO,{pr:r.pr})}const BO=6e4;function dg(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 PO({sessionId:e}){const t=G(T=>T.linkedLinearIssues.get(e)),[n,r]=k.useState([]),[a,o]=k.useState(null),[u,h]=k.useState([]),[f,p]=k.useState(""),[m,x]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,w]=k.useState(""),[E,C]=k.useState([]),[L,O]=k.useState(!1),D=k.useRef(null);k.useEffect(()=>{Ne.getLinkedLinearIssue(e).then(T=>{T.issue&&G.getState().setLinkedLinearIssue(e,T.issue)}).catch(()=>{})},[e]);const U=k.useCallback(async()=>{if(t)try{const T=await Ne.getLinkedLinearIssue(e,!0);T.issue&&(G.getState().setLinkedLinearIssue(e,T.issue),T.issue.stateType==="completed"&&y(!0)),T.comments&&r(T.comments),T.assignee!==void 0&&o(T.assignee??null),T.labels&&h(T.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;U();const T=setInterval(U,BO);return()=>clearInterval(T)},[U,t]),k.useEffect(()=>{if(!_)return;const T=N.trim();if(T.length<2){C([]);return}let ie=!0;O(!0);const Z=setTimeout(()=>{Ne.searchLinearIssues(T,6).then(Y=>{ie&&C(Y.issues)}).catch(()=>{ie&&C([])}).finally(()=>{ie&&O(!1)})},400);return()=>{ie=!1,clearTimeout(Z)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var T;return(T=D.current)==null?void 0:T.focus()},50)},[_]);async function I(){if(!(!t||!f.trim()||m)){x(!0);try{const T=await Ne.addLinearComment(t.id,f.trim());r(ie=>[...ie,T.comment]),p("")}catch{}finally{x(!1)}}}async function W(){try{await Ne.unlinkLinearIssue(e),G.getState().setLinkedLinearIssue(e,null),r([]),o(null),h([]),y(!1)}catch{}}async function z(T){try{await Ne.linkLinearIssue(e,T),G.getState().setLinkedLinearIssue(e,T),j(!1),w(""),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(Uc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:D,type:"text",value:N,onChange:T=>w(T.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),w(""),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"})})})]}),L&&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(T=>l.jsxs("button",{onClick:()=>z(T),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:T.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${dg(T.stateType,T.stateName).cls}`,children:dg(T.stateType,T.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:T.title})]},T.id))}),N.trim().length>=2&&!L&&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(Uc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const q=dg(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(Uc,{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] ${q.cls}`,children:q.label}),l.jsx("button",{onClick:W,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(T=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id))})]}),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),G.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(T=>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:T.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:_O(new Date(T.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:T.body})]},T.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:T=>p(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),I())},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:I,disabled:!f.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 $O({sessionId:e}){const t=G(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(h=>h+1),bv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const r=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?kx(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(ai,{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 ${r?"text-cc-error":"text-cc-warning"}`,children:[r?"rate limited":t.status,o&&` · resets ${o}`]})]}),r&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function FO({sessionId:e}){const t=G(a=>a.sessions.get(e)),n=ou(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(RO,{sessionId:e}),l.jsx(LO,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx($O,{sessionId:e}),l.jsx(EO,{sessionId:e})]})}function UO({sessionId:e}){const t=G(p=>p.sessions.get(e)),n=ou(e),r=(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,h=(t==null?void 0:t.total_lines_removed)||0,f=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return r?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:r,children:r}),(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||h>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"})]}),h>0&&l.jsxs("span",{className:"text-cc-error",children:["-",h,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&f&&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(f).then(p=>{G.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Xi(new Error(`git pull failed: ${p.output}`))}).catch(p=>Xi(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function IO({sessionId:e}){const t=G(o=>o.sessionTasks.get(e)||WS),n=G(o=>o.sessions.get(e)),r=ou(e),a=((n==null?void 0:n.backend_type)||(r==null?void 0:r.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(WO,{task:o},o.id))})})}const HO={"usage-limits":FO,"server-memory":AO,"server-disk":MO,"git-branch":UO,"github-pr":zO,"linear-issue":PO,"mcp-servers":mO,tasks:IO};function qO(e,t){const n=G(r=>r.sessionTasks.get(t)||WS);if(e==="tasks"&&n.length>0){const r=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[r,"/",n.length]})}return null}function VO({isCodex:e}){const t=G(p=>p.taskPanelConfig),n=G(p=>p.toggleSectionEnabled),r=G(p=>p.moveSectionUp),a=G(p=>p.moveSectionDown),o=G(p=>p.resetTaskPanelConfig),u=G(p=>p.setTaskPanelConfigMode),h=e?"codex":"claude",f=t.order.filter(p=>{const m=ii.find(x=>x.id===p);return!(!m||m.backends&&!m.backends.includes(h))});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:f.map((p,m)=>{const x=ii.find(j=>j.id===p),b=t.enabled[p]??!0,y=m===0,_=m===f.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:()=>r(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 GO({sectionId:e,sessionId:t,children:n}){var o;const r=((o=ii.find(u=>u.id===e))==null?void 0:o.label)??e,a=qO(e,t);return l.jsx(XS,{id:e,label:r,badge:a,children:n})}function YO({sessionId:e}){const t=G(m=>m.sessions.get(e)),n=ou(e),r=G(m=>m.taskPanelOpen),a=G(m=>m.setTaskPanelOpen),o=G(m=>m.taskPanelConfigMode),u=G(m=>m.taskPanelConfig);if(!r)return null;const h=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",f=h?"codex":"claude",p=u.order.filter(m=>{const x=ii.find(b=>b.id===m);return!(!x||x.backends&&!x.backends.includes(f))});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?G.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(VO,{isCodex:h}):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(CO,{}),l.jsx(yO,{sessionId:e}),p.filter(m=>u.enabled[m]!==!1).map(m=>{var b;const x=HO[m];return x?l.jsx(GO,{sectionId:m,sessionId:e,children:l.jsx(wO,{label:(b=ii.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:()=>G.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 WO({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(r=>`#${r}`).join(", ")]})]})]})}function QO({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 XO({sessionId:e}){const t=G(O=>O.sessions.get(e)),n=G(O=>O.sdkSessions.find(D=>D.sessionId===e)),r=G(O=>O.diffPanelSelectedFile.get(e)??null),a=G(O=>O.setDiffPanelSelectedFile),o=G(O=>O.diffBase),u=G(O=>O.setDiffBase),h=G(O=>O.changedFilesTick.get(e)??0),f=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),w=G(O=>O.setGitChangedFilesCount);k.useEffect(()=>{if(!f)return;let O=!1;return Ne.getChangedFiles(f,o).then(({files:D})=>{if(O)return;const U=`${f}/`,I=D.filter(W=>W.path===f||W.path.startsWith(U)).map(W=>({abs:W.path,rel:W.path.startsWith(U)?W.path.slice(U.length):W.path,status:W.status==="A"||W.status==="?"?"created":W.status==="D"?"deleted":"updated"})).sort((W,z)=>W.rel.localeCompare(z.rel));N(I),w(e,I.length)}).catch(()=>{O||(N([]),w(e,0))}),()=>{O=!0}},[f,o,h,e,w]);const E=j;k.useEffect(()=>{!r&&E.length>0&&a(e,E[0].abs)},[r,E,e,a]),k.useEffect(()=>{var O;r&&(E.some(D=>D.abs===r)||a(e,((O=E[0])==null?void 0:O.abs)??null))},[r,E,e,a]),k.useEffect(()=>{if(!r){m("");return}let O=!1;return b(!0),Ne.getFileDiff(r,o).then(D=>{O||(m(D.diff),b(!1))}).catch(()=>{O||(m(""),b(!1))}),()=>{O=!0}},[r,o]);const C=k.useCallback(O=>{a(e,O),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),L=k.useMemo(()=>!r||!f?r:r.startsWith(f+"/")?r.slice(f.length+1):r,[r,f]);return f?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:O,rel:D,status:U})=>l.jsxs("button",{onClick:()=>C(O),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${O===r?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(QO,{status:U}),l.jsx("span",{className:"truncate leading-snug",children:D})]},O))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[r&&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:L==null?void 0:L.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:L})]}),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"})}):r?l.jsx("div",{className:"p-4",children:l.jsx(ao,{unifiedDiff:p,fileName:L||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 KO(){const e=G(f=>f.updateInfo),t=G(f=>f.updateDismissedVersion),n=G(f=>f.dismissUpdate),[r,a]=k.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(),G.getState().setUpdateOverlayActive(!0)}catch(f){localStorage.removeItem("companion_docker_prompt_pending"),Xi(f),a(!1)}},u=()=>{n(e.latestVersion)},h=r||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:h,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:h?"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 ZO({steps:e,error:t,backend:n,onCancel:r}){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"),h=e.some(x=>x.status==="error")||!!t,f=[...e].reverse().find(x=>x.status==="in_progress"),p=[...e].reverse().find(x=>x.status==="done"),m=h?"Something went wrong":u?"Launching session...":(f==null?void 0:f.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&&!h&&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&&!h?"scale-110":""} ${h?"opacity-40 grayscale":""}`}),o&&!h&&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&&!h&&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 ${h?"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})})}),(h||o)&&r&&l.jsx("button",{onClick:r,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:h?"Dismiss":"Cancel"}),!h&&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 JO(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const ez={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function tz(e){const[t,n]=k.useState("installing"),r=k.useRef(null),a=k.useRef(!0);return k.useEffect(()=>(a.current=!0,()=>{a.current=!1,r.current&&clearTimeout(r.current)}),[]),k.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),h()},5e3);function h(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:JO()}).then(f=>{if(!f.ok)throw new Error("not ready");return f.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{r.current=setTimeout(h,1500)})}return()=>{clearTimeout(o),clearTimeout(u),r.current&&clearTimeout(r.current)}},[e]),t}function JS({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:ez[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(r=>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:`${r*.2}s`}},r))}),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 nz({active:e}){const t=tz(e);return e?l.jsx(JS,{phase:t,className:"fixed inset-0 z-[100]"}):null}function Lz({phase:e}){return l.jsx(JS,{phase:e,className:"absolute inset-0"})}function rz(){const e=G(j=>j.dockerUpdateDialogOpen),t=G(j=>j.setDockerUpdateDialogOpen),[n,r]=k.useState("prompt"),[a,o]=k.useState(!1),[u,h]=k.useState(null),f=k.useRef(null);if(k.useEffect(()=>{e&&Ne.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){f.current&&(clearInterval(f.current),f.current=null);return}return f.current=setInterval(()=>{Ne.getImageStatus("the-companion:latest").then(j=>{h(j),j.status==="ready"?r("done"):j.status==="error"&&r("error")}).catch(()=>{})},2e3),()=>{f.current&&(clearInterval(f.current),f.current=null)}},[n]),!e)return null;function p(){r("pulling"),Ne.pullImage("the-companion:latest").then(j=>{j.state&&h(j.state)}).catch(()=>{r(j=>j==="pulling"?"error":j)})}function m(){p()}function x(){y()}function b(){y()}function y(){r("prompt"),h(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 Dz({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 hg=["welcome","claude","codex","done"],ow='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function jx(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function sz({onComplete:e}){const[t,n]=k.useState("welcome"),[r,a]=k.useState(""),[o,u]=k.useState(""),[h,f]=k.useState(!1),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(jx),w=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const q=w.current;if(!q)return;function T(Z){if(Z.key==="Escape"){Z.preventDefault();return}if(Z.key!=="Tab")return;const Y=q.querySelectorAll(ow);if(Y.length===0)return;const P=Y[0],$=Y[Y.length-1];Z.shiftKey?document.activeElement===P&&(Z.preventDefault(),$.focus()):document.activeElement===$&&(Z.preventDefault(),P.focus())}document.addEventListener("keydown",T);const ie=q.querySelector(ow);return ie==null||ie.focus(),()=>document.removeEventListener("keydown",T)},[t]);const E=k.useCallback(async()=>{if(!r.trim()){n("codex");return}f(!0),m("");try{await Ne.updateSettings({claudeCodeOAuthToken:r.trim()}),b(!0),n("codex")}catch(q){m(q instanceof Error?q.message:"Failed to save token")}finally{f(!1)}},[r]),C=k.useCallback(async()=>{f(!0),m("");try{(await Ne.getSettings()).codexDeviceAuthConfigured?(_(!0),await O()):m("No Codex auth found. Run codex --login in your terminal first.")}catch(q){m(q instanceof Error?q.message:"Failed to check auth status")}finally{f(!1)}},[]),L=k.useCallback(async()=>{f(!0),m("");try{await Ne.updateSettings({openaiApiKey:o.trim()}),_(!0),await O()}catch(q){m(q instanceof Error?q.message:"Failed to save API key")}finally{f(!1)}},[o]),O=k.useCallback(async()=>{try{await Ne.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),D=k.useCallback(()=>{e()},[e]),U=k.useCallback(async()=>{await O(),e()},[O,e]),I=k.useCallback(q=>{m(""),n(q)},[]),W=hg.indexOf(t),z=jx();return lo.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:z?"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:w,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:z?"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 ${W+1} of ${hg.length-1}`,children:hg.slice(0,3).map((q,T)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:T===W?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:T<=W?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:T<=W?1:.5}},q))}),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(iz,{onSetupClaude:()=>I("claude"),onSetupCodex:()=>I("codex")}),t==="claude"&&l.jsx(az,{token:r,onTokenChange:a,onSave:E,onSkip:()=>I("codex"),saving:h,error:p}),t==="codex"&&l.jsx(lz,{apiKey:o,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:L,onSkip:()=>O(),onBack:()=>I("claude"),saving:h,error:p}),t==="done"&&l.jsx(oz,{claudeConfigured:x,codexConfigured:y,onDone:D})]}),t==="welcome"&&l.jsx("button",{onClick:U,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 iz({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 az({token:e,onTokenChange:t,onSave:n,onSkip:r,saving:a,error:o}){const u=k.useRef(null);k.useEffect(()=>{var f;(f=u.current)==null||f.focus()},[]);const h="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(ej,{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:f=>t(f.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?h: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:h,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:r,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 lz({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:r,onSkip:a,onBack:o,saving:u,error:h}){const[f,p]=k.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(ej,{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"})]})})]}),h&&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:h})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!f),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:f?"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":f?"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":h?m:void 0,"aria-invalid":h?!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()?r: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 oz({claudeConfigured:e,codexConfigured:t,onDone:n}){const r=!e&&!t,a=jx(),[o,u]=k.useState(a);return k.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:r?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:r?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:r?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:r?"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 ej({text:e}){const[t,n]=k.useState(!1),r=k.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:r,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 cz(e){return G(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const uz=k.lazy(()=>qn(()=>import("./Playground-BdB18EpN.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),dz=k.lazy(()=>qn(()=>import("./SettingsPage-BIvJyPOd.js"),[]).then(e=>({default:e.SettingsPage}))),hz=k.lazy(()=>qn(()=>import("./IntegrationsPage-C7cQyPBt.js"),[]).then(e=>({default:e.IntegrationsPage}))),fz=k.lazy(()=>qn(()=>import("./LinearSettingsPage-CBbKNZVH.js"),[]).then(e=>({default:e.LinearSettingsPage}))),pz=k.lazy(()=>qn(()=>import("./LinearOAuthSettingsPage-BG4-JYjD.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),mz=k.lazy(()=>qn(()=>import("./TailscalePage-BhGXhs0h.js"),[]).then(e=>({default:e.TailscalePage}))),gz=k.lazy(()=>qn(()=>import("./PromptsPage-C7vU_XHW.js"),[]).then(e=>({default:e.PromptsPage}))),xz=k.lazy(()=>qn(()=>Promise.resolve().then(()=>QD),void 0).then(e=>({default:e.EnvManager}))),vz=k.lazy(()=>qn(()=>import("./SandboxManager-DKcCgC-r.js"),[]).then(e=>({default:e.SandboxManager}))),bz=k.lazy(()=>qn(()=>import("./CronManager-Dbz9rad2.js"),[]).then(e=>({default:e.CronManager}))),yz=k.lazy(()=>qn(()=>import("./AgentsPage-E73zA-6k.js"),[]).then(e=>({default:e.AgentsPage}))),_z=k.lazy(()=>qn(()=>import("./RunsPage-BsIYybEZ.js"),[]).then(e=>({default:e.RunsPage}))),wz=k.lazy(()=>qn(()=>import("./DashboardPage-Dk4z826H.js"),[]).then(e=>({default:e.DashboardPage}))),kz=k.lazy(()=>qn(()=>import("./MagicUIView-wrboravS.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function lr(){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 Sz(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function jz(){const e=G(ae=>ae.isAuthenticated),t=G(ae=>ae.darkMode),n=G(ae=>ae.currentSessionId),r=G(ae=>ae.sidebarOpen),a=G(ae=>ae.taskPanelOpen),o=G(ae=>ae.homeResetKey),u=G(ae=>ae.activeTab),h=cz(n),f=G(ae=>ae.sessionCreating),p=G(ae=>ae.sessionCreatingBackend),m=G(ae=>ae.creationProgress),x=G(ae=>ae.creationError),b=G(ae=>ae.updateOverlayActive),y=Sz(),_=k.useMemo(()=>Wx(y),[y]),j=_.page==="settings",N=_.page==="prompts",w=_.page==="integrations",E=_.page==="integration-linear",C=_.page==="integration-linear-oauth",L=_.page==="integration-tailscale",O=_.page==="environments",D=_.page==="sandboxes",U=_.page==="scheduled",I=_.page==="agents"||_.page==="agent-detail",W=_.page==="runs",z=_.page==="dashboard",q=_.page==="session"||_.page==="home";k.useEffect(()=>{O6(y||"#/")},[y]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const T=k.useRef(G.getState().currentSessionId);k.useEffect(()=>{if(T.current!==null&&_.page==="home"){Qx(T.current,!0),T.current=null;return}if(T.current=null,_.page==="session"){const ae=G.getState();ae.currentSessionId!==_.sessionId&&ae.setCurrentSession(_.sessionId),nu(_.sessionId)}else if(_.page==="home"){const ae=G.getState();ae.currentSessionId!==null&&ae.setCurrentSession(null)}},[_]);const ie=G(ae=>n?ae.changedFilesTick.get(n)??0:0),Z=G(ae=>ae.diffBase),Y=G(ae=>ae.setGitChangedFilesCount),P=G(ae=>{var R,B;return n&&(((R=ae.sessions.get(n))==null?void 0:R.cwd)||((B=ae.sdkSessions.find(X=>X.sessionId===n))==null?void 0:B.cwd))||null});k.useEffect(()=>{if(!n||!P)return;let ae=!1;return Ne.getChangedFiles(P,Z).then(({files:R})=>{if(ae)return;const B=`${P}/`,X=R.filter(M=>M.path===P||M.path.startsWith(B)).length;Y(n,X)}).catch(()=>{}),()=>{ae=!0}},[n,P,Z,ie,Y]),k.useEffect(()=>{const ae=()=>{Ne.checkForUpdate().then(B=>{G.getState().setUpdateInfo(B)}).catch(()=>{})};ae();const R=setInterval(ae,300*1e3);return()=>clearInterval(R)},[]),k.useEffect(()=>{const ae=()=>{Ne.getClaudeCompat().then(B=>{G.getState().setClaudeCompatInfo(B)}).catch(()=>{})};ae();const R=setInterval(ae,300*1e3);return()=>clearInterval(R)},[]);const[$,re]=k.useState(!1);return k.useEffect(()=>{e&&Ne.getSettings().then(ae=>{ae.publicUrl&&G.getState().setPublicUrl(ae.publicUrl),G.getState().setMagicUiAvailable(!!ae.magicUiEnabled&&!!ae.claudeCliAvailable),ae.onboardingCompleted||re(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?_.page==="playground"?l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(uz,{})}):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:[r&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>G.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
|
-
${r?"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(eA,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(VD,{}),l.jsx(KO,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[j&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(dz,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(gz,{embedded:!0})})}),w&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(hz,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(fz,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(pz,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(mz,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(xz,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(vz,{embedded:!0})})}),U&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(bz,{embedded:!0})})}),I&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(yz,{route:_})})}),W&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(_z,{})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(wz,{})})}),q&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(XO,{sessionId:n}):h?l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(kz,{sessionId:n})}):l.jsx($D,{sessionId:n}):l.jsx(oO,{},o)}),f&&m&&m.length>0&&l.jsx(ZO,{steps:m,error:x,backend:p??void 0,onCancel:()=>G.getState().clearCreation()})]})]})]}),n&&q&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>G.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:()=>G.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(YO,{sessionId:n})})]}),l.jsx(nz,{active:b}),l.jsx(rz,{}),$&&l.jsx(sz,{onComplete:()=>re(!1)})]}):l.jsx(U6,{})}class Nz extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Xi(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}}D6();oC.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(Nz,{children:l.jsx(jz,{})})}));qn(()=>import("./sw-register-CWqt9RnE.js"),[]).catch(()=>{});export{AD as A,ah as B,pD as C,Ez as D,tu as E,KD as F,OO as G,lo as H,X5 as I,$S as J,uD as K,Uc as L,lD as M,gD as N,mD as O,xD as P,Az as Q,Rz as R,ZO as S,vw as T,KO as U,Mz as V,qn as _,Ne as a,qm as b,zn as c,$D as d,W6 as e,DL as f,L6 as g,ao as h,YD as i,l as j,Lz as k,Dz as l,VL as m,Qx as n,GL as o,FD as p,RO as q,k as r,Tz as s,_O as t,G as u,LO as v,Yi as w,Xl as x,Ic as y,gO as z};
|