@hellcoder/companion 0.121.0 → 0.122.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-ClW7bWRx.js → AgentsPage-DcOqIP9k.js} +1 -1
- package/dist/assets/{CronManager-CNRhJ7JU.js → CronManager-DNNKDHYb.js} +1 -1
- package/dist/assets/{DashboardPage-Ch_HQGg0.js → DashboardPage-B10_oar4.js} +1 -1
- package/dist/assets/{IntegrationsPage-BHj_BEVr.js → IntegrationsPage-C3o8sLpo.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-B5U70sHB.js → LinearOAuthSettingsPage-C181ckxW.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CVmZKj9l.js → LinearSettingsPage-B-7G76Ns.js} +1 -1
- package/dist/assets/{MagicUIDashboard-5nBMuLS8.js → MagicUIDashboard-CkEZ3BVa.js} +1 -1
- package/dist/assets/{MagicUIView-CdHkHIEh.js → MagicUIView-BmwHDokR.js} +1 -1
- package/dist/assets/{Playground-Dpfq4KMB.js → Playground-DvE5Hx7h.js} +1 -1
- package/dist/assets/{PromptsPage-BHtp_9DW.js → PromptsPage-BFYinvPb.js} +1 -1
- package/dist/assets/{RunsPage-bbhhFNkd.js → RunsPage-C_wKk1gx.js} +1 -1
- package/dist/assets/{SandboxManager-b3xCX8cU.js → SandboxManager-DRRe06TY.js} +1 -1
- package/dist/assets/{SettingsPage-CEOoHbQk.js → SettingsPage-DlqgaG3K.js} +1 -1
- package/dist/assets/{TailscalePage-C1bGGkFU.js → TailscalePage-DHuSFb11.js} +1 -1
- package/dist/assets/index-BnF_YIhB.css +1 -0
- package/dist/assets/index-ZUC5y0cV.js +141 -0
- package/dist/assets/{sw-register-2ITbAS9w.js → sw-register-D2DuNbEG.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/session-orchestrator.test.ts +76 -0
- package/server/session-orchestrator.ts +52 -0
- package/server/settings-manager.ts +1 -1
- package/server/ws-bridge.ts +20 -3
- package/dist/assets/index-CUfPwiv5.css +0 -1
- package/dist/assets/index-_VjPWGkx.js +0 -141
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-Dpfq4KMB.js","assets/MagicUIDashboard-5nBMuLS8.js","assets/MagicUIView-CdHkHIEh.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var sE=Object.defineProperty;var iE=(e,t,n)=>t in e?sE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var e_=(e,t,n)=>iE(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();const rE="modulepreload",aE=function(e){return"/"+e},t_={},Gn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=u(n.map(m=>{if(m=aE(m),m in t_)return;t_[m]=!0;const v=m.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":rE,v||(b.as="script"),b.crossOrigin="",b.href=m,h&&b.setAttribute("nonce",h),document.head.appendChild(b),v)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})};function ux(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vm={exports:{}},Nc={};/**
|
|
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 n_;function lE(){if(n_)return Nc;n_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,c){var u=null;if(c!==void 0&&(u=""+c),a.key!==void 0&&(u=""+a.key),"key"in a){c={};for(var f in a)f!=="key"&&(c[f]=a[f])}else c=a;return a=c.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:c}}return Nc.Fragment=t,Nc.jsx=n,Nc.jsxs=n,Nc}var s_;function oE(){return s_||(s_=1,Vm.exports=lE()),Vm.exports}var l=oE(),Gm={exports:{}},Ke={};/**
|
|
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 i_;function cE(){if(i_)return Ke;i_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),y=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function C(B,ce,ye){this.props=B,this.context=ce,this.refs=S,this.updater=ye||j}C.prototype.isReactComponent={},C.prototype.setState=function(B,ce){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,ce,"setState")},C.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=C.prototype;function L(B,ce,ye){this.props=B,this.context=ce,this.refs=S,this.updater=ye||j}var O=L.prototype=new E;O.constructor=L,N(O,C.prototype),O.isPureReactComponent=!0;var R=Array.isArray;function F(){}var D={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function P(B,ce,ye){var Ne=ye.ref;return{$$typeof:e,type:B,key:ce,ref:Ne!==void 0?Ne:null,props:ye}}function Y(B,ce){return P(B.type,ce,B.props)}function A(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function fe(B){var ce={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ye){return ce[ye]})}var te=/\/+/g;function K(B,ce){return typeof B=="object"&&B!==null&&B.key!=null?fe(""+B.key):ce.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(F,F):(B.status="pending",B.then(function(ce){B.status==="pending"&&(B.status="fulfilled",B.value=ce)},function(ce){B.status==="pending"&&(B.status="rejected",B.reason=ce)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function V(B,ce,ye,Ne,Ae){var Le=typeof B;(Le==="undefined"||Le==="boolean")&&(B=null);var De=!1;if(B===null)De=!0;else switch(Le){case"bigint":case"string":case"number":De=!0;break;case"object":switch(B.$$typeof){case e:case t:De=!0;break;case v:return De=B._init,V(De(B._payload),ce,ye,Ne,Ae)}}if(De)return Ae=Ae(B),De=Ne===""?"."+K(B,0):Ne,R(Ae)?(ye="",De!=null&&(ye=De.replace(te,"$&/")+"/"),V(Ae,ce,ye,"",function(Ut){return Ut})):Ae!=null&&(A(Ae)&&(Ae=Y(Ae,ye+(Ae.key==null||B&&B.key===Ae.key?"":(""+Ae.key).replace(te,"$&/")+"/")+De)),ce.push(Ae)),1;De=0;var Ee=Ne===""?".":Ne+":";if(R(B))for(var Re=0;Re<B.length;Re++)Ne=B[Re],Le=Ee+K(Ne,Re),De+=V(Ne,ce,ye,Le,Ae);else if(Re=_(B),typeof Re=="function")for(B=Re.call(B),Re=0;!(Ne=B.next()).done;)Ne=Ne.value,Le=Ee+K(Ne,Re++),De+=V(Ne,ce,ye,Le,Ae);else if(Le==="object"){if(typeof B.then=="function")return V(G(B),ce,ye,Ne,Ae);throw ce=String(B),Error("Objects are not valid as a React child (found: "+(ce==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":ce)+"). If you meant to render a collection of children, use an array instead.")}return De}function se(B,ce,ye){if(B==null)return B;var Ne=[],Ae=0;return V(B,Ne,"","",function(Le){return ce.call(ye,Le,Ae++)}),Ne}function ae(B){if(B._status===-1){var ce=B._result,ye=ce();ye.then(function(Ne){(B._status===0||B._status===-1)&&(B._status=1,B._result=Ne,ye.status===void 0&&(ye.status="fulfilled",ye.value=Ne))},function(Ne){(B._status===0||B._status===-1)&&(B._status=2,B._result=Ne,ye.status===void 0&&(ye.status="rejected",ye.reason=Ne))}),B._status===-1&&(B._status=0,B._result=ye)}if(B._status===1)return B._result.default;throw B._result}var M=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ce=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(ce))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)};function Te(B){var ce=D.T,ye={};ye.types=ce!==null?ce.types:null,D.T=ye;try{var Ne=B(),Ae=D.S;Ae!==null&&Ae(ye,Ne),typeof Ne=="object"&&Ne!==null&&typeof Ne.then=="function"&&Ne.then(F,M)}catch(Le){M(Le)}finally{ce!==null&&ye.types!==null&&(ce.types=ye.types),D.T=ce}}function Ce(B){var ce=D.T;if(ce!==null){var ye=ce.types;ye===null?ce.types=[B]:ye.indexOf(B)===-1&&ye.push(B)}else Te(Ce.bind(null,B))}var z={map:se,forEach:function(B,ce,ye){se(B,function(){ce.apply(this,arguments)},ye)},count:function(B){var ce=0;return se(B,function(){ce++}),ce},toArray:function(B){return se(B,function(ce){return ce})||[]},only:function(B){if(!A(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ke.Activity=x,Ke.Children=z,Ke.Component=C,Ke.Fragment=n,Ke.Profiler=a,Ke.PureComponent=L,Ke.StrictMode=i,Ke.Suspense=h,Ke.ViewTransition=b,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(B){return D.H.useMemoCache(B)}},Ke.addTransitionType=Ce,Ke.cache=function(B){return function(){return B.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(B,ce,ye){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var Ne=N({},B.props),Ae=B.key;if(ce!=null)for(Le in ce.key!==void 0&&(Ae=""+ce.key),ce)!X.call(ce,Le)||Le==="key"||Le==="__self"||Le==="__source"||Le==="ref"&&ce.ref===void 0||(Ne[Le]=ce[Le]);var Le=arguments.length-2;if(Le===1)Ne.children=ye;else if(1<Le){for(var De=Array(Le),Ee=0;Ee<Le;Ee++)De[Ee]=arguments[Ee+2];Ne.children=De}return P(B.type,Ae,Ne)},Ke.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:c,_context:B},B},Ke.createElement=function(B,ce,ye){var Ne,Ae={},Le=null;if(ce!=null)for(Ne in ce.key!==void 0&&(Le=""+ce.key),ce)X.call(ce,Ne)&&Ne!=="key"&&Ne!=="__self"&&Ne!=="__source"&&(Ae[Ne]=ce[Ne]);var De=arguments.length-2;if(De===1)Ae.children=ye;else if(1<De){for(var Ee=Array(De),Re=0;Re<De;Re++)Ee[Re]=arguments[Re+2];Ae.children=Ee}if(B&&B.defaultProps)for(Ne in De=B.defaultProps,De)Ae[Ne]===void 0&&(Ae[Ne]=De[Ne]);return P(B,Le,Ae)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(B){return{$$typeof:f,render:B}},Ke.isValidElement=A,Ke.lazy=function(B){return{$$typeof:v,_payload:{_status:-1,_result:B},_init:ae}},Ke.memo=function(B,ce){return{$$typeof:m,type:B,compare:ce===void 0?null:ce}},Ke.startTransition=Te,Ke.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ke.use=function(B){return D.H.use(B)},Ke.useActionState=function(B,ce,ye){return D.H.useActionState(B,ce,ye)},Ke.useCallback=function(B,ce){return D.H.useCallback(B,ce)},Ke.useContext=function(B){return D.H.useContext(B)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(B,ce){return D.H.useDeferredValue(B,ce)},Ke.useEffect=function(B,ce){return D.H.useEffect(B,ce)},Ke.useEffectEvent=function(B){return D.H.useEffectEvent(B)},Ke.useId=function(){return D.H.useId()},Ke.useImperativeHandle=function(B,ce,ye){return D.H.useImperativeHandle(B,ce,ye)},Ke.useInsertionEffect=function(B,ce){return D.H.useInsertionEffect(B,ce)},Ke.useLayoutEffect=function(B,ce){return D.H.useLayoutEffect(B,ce)},Ke.useMemo=function(B,ce){return D.H.useMemo(B,ce)},Ke.useOptimistic=function(B,ce){return D.H.useOptimistic(B,ce)},Ke.useReducer=function(B,ce,ye){return D.H.useReducer(B,ce,ye)},Ke.useRef=function(B){return D.H.useRef(B)},Ke.useState=function(B){return D.H.useState(B)},Ke.useSyncExternalStore=function(B,ce,ye){return D.H.useSyncExternalStore(B,ce,ye)},Ke.useTransition=function(){return D.H.useTransition()},Ke.version="19.3.0",Ke}var r_;function dx(){return r_||(r_=1,Gm.exports=cE()),Gm.exports}var k=dx();const tf=ux(k);var Ym={exports:{}},Cc={},Xm={exports:{}},Qm={};/**
|
|
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 a_;function uE(){return a_||(a_=1,(function(e){function t(G,V){var se=G.length;G.push(V);e:for(;0<se;){var ae=se-1>>>1,M=G[ae];if(0<a(M,V))G[ae]=V,G[se]=M,se=ae;else break e}}function n(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var V=G[0],se=G.pop();if(se!==V){G[0]=se;e:for(var ae=0,M=G.length,Te=M>>>1;ae<Te;){var Ce=2*(ae+1)-1,z=G[Ce],B=Ce+1,ce=G[B];if(0>a(z,se))B<M&&0>a(ce,z)?(G[ae]=ce,G[B]=se,ae=B):(G[ae]=z,G[Ce]=se,ae=Ce);else if(B<M&&0>a(ce,se))G[ae]=ce,G[B]=se,ae=B;else break e}}return V}function a(G,V){var se=G.sortIndex-V.sortIndex;return se!==0?se:G.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],m=[],v=1,x=null,b=3,y=!1,_=!1,j=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function L(G){for(var V=n(m);V!==null;){if(V.callback===null)i(m);else if(V.startTime<=G)i(m),V.sortIndex=V.expirationTime,t(h,V);else break;V=n(m)}}function O(G){if(j=!1,L(G),!_)if(n(h)!==null)_=!0,R||(R=!0,A());else{var V=n(m);V!==null&&K(O,V.startTime-G)}}var R=!1,F=-1,D=5,X=-1;function P(){return N?!0:!(e.unstable_now()-X<D)}function Y(){if(N=!1,R){var G=e.unstable_now();X=G;var V=!0;try{e:{_=!1,j&&(j=!1,C(F),F=-1),y=!0;var se=b;try{t:{for(L(G),x=n(h);x!==null&&!(x.expirationTime>G&&P());){var ae=x.callback;if(typeof ae=="function"){x.callback=null,b=x.priorityLevel;var M=ae(x.expirationTime<=G);if(G=e.unstable_now(),typeof M=="function"){x.callback=M,L(G),V=!0;break t}x===n(h)&&i(h),L(G)}else i(h);x=n(h)}if(x!==null)V=!0;else{var Te=n(m);Te!==null&&K(O,Te.startTime-G),V=!1}}break e}finally{x=null,b=se,y=!1}V=void 0}}finally{V?A():R=!1}}}var A;if(typeof E=="function")A=function(){E(Y)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,te=fe.port2;fe.port1.onmessage=Y,A=function(){te.postMessage(null)}}else A=function(){S(Y,0)};function K(G,V){F=S(function(){G(e.unstable_now())},V)}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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(G){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var se=b;b=V;try{return G()}finally{b=se}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(G,V){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var se=b;b=G;try{return V()}finally{b=se}},e.unstable_scheduleCallback=function(G,V,se){var ae=e.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ae+se:ae):se=ae,G){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=se+M,G={id:v++,callback:V,priorityLevel:G,startTime:se,expirationTime:M,sortIndex:-1},se>ae?(G.sortIndex=se,t(m,G),n(h)===null&&G===n(m)&&(j?(C(F),F=-1):j=!0,K(O,se-ae))):(G.sortIndex=M,t(h,G),_||y||(_=!0,R||(R=!0,A()))),G},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(G){var V=b;return function(){var se=b;b=V;try{return G.apply(this,arguments)}finally{b=se}}}})(Qm)),Qm}var l_;function dE(){return l_||(l_=1,Xm.exports=uE()),Xm.exports}var Km={exports:{}},Bn={};/**
|
|
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 o_;function fE(){if(o_)return Bn;o_=1;var e=dx();function t(v){var x="https://react.dev/errors/"+v;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)x+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+v+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal"),c=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function f(v,x,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:y==null?null:y===u?u:""+y,children:v,containerInfo:x,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(v,x){if(v==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return Bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Bn.browser=function(v){return{$$typeof:c,_reason:v}},Bn.createPortal=function(v,x){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(t(299));return f(v,x,null,b)},Bn.flushSync=function(v){var x=h.T,b=i.p;try{if(h.T=null,i.p=2,v)return v()}finally{h.T=x,i.p=b,i.d.f()}},Bn.preconnect=function(v,x){typeof v=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,i.d.C(v,x))},Bn.prefetchDNS=function(v){typeof v=="string"&&i.d.D(v)},Bn.preinit=function(v,x){if(typeof v=="string"&&x&&typeof x.as=="string"){var b=x.as,y=m(b,x.crossOrigin),_=typeof x.integrity=="string"?x.integrity:void 0,j=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;b==="style"?i.d.S(v,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:y,integrity:_,fetchPriority:j}):b==="script"&&i.d.X(v,{crossOrigin:y,integrity:_,fetchPriority:j,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},Bn.preinitModule=function(v,x){if(typeof v=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var b=m(x.as,x.crossOrigin);i.d.M(v,{crossOrigin:b,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0})}}else x==null&&i.d.M(v)},Bn.preload=function(v,x){if(typeof v=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var b=x.as,y=m(b,x.crossOrigin);i.d.L(v,b,{crossOrigin:y,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},Bn.preloadModule=function(v,x){if(typeof v=="string")if(x){var b=m(x.as,x.crossOrigin);i.d.m(v,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:b,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0})}else i.d.m(v)},Bn.requestFormReset=function(v){i.d.r(v)},Bn.unstable_batchedUpdates=function(v,x){return v(x)},Bn.useFormState=function(v,x,b){return h.H.useFormState(v,x,b)},Bn.useFormStatus=function(){return h.H.useHostTransitionStatus()},Bn.version="19.3.0",Bn}var c_;function b2(){if(c_)return Km.exports;c_=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(),Km.exports=fE(),Km.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 u_;function hE(){if(u_)return Cc;u_=1;var e=dE(),t=dx(),n=b2();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+s+"; visit "+r+" 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 c(s){for(var r=s,o=r;o&&!o.alternate;)r=o,(r.flags&4098)!==0&&(s=r.return),o=r.return;for(;r.return;)r=r.return;return r.tag===3?s:null}function u(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function h(s){if(c(s)!==s)throw Error(i(188))}function m(s){var r=s.alternate;if(!r){if(r=c(s),r===null)throw Error(i(188));return r!==s?null:s}for(var o=s,d=r;;){var p=o.return;if(p===null)break;var g=p.alternate;if(g===null){if(d=p.return,d!==null){o=d;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===o)return h(p),s;if(g===d)return h(p),r;g=g.sibling}throw Error(i(188))}if(o.return!==d.return)o=p,d=g;else{for(var w=!1,T=p.child;T;){if(T===o){w=!0,o=p,d=g;break}if(T===d){w=!0,d=p,o=g;break}T=T.sibling}if(!w){for(T=g.child;T;){if(T===o){w=!0,o=g,d=p;break}if(T===d){w=!0,d=g,o=p;break}T=T.sibling}if(!w)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?s:r}function v(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=v(s),r!==null)return r;s=s.sibling}return null}function x(s,r,o,d,p,g){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&o(s,d,p,g)||(s.tag!==22||s.memoizedState===null)&&(r||s.tag!==5&&s.tag!==27)&&x(s.child,r,o,d,p,g))return!0;s=s.sibling}return!1}function b(s){for(s=s.return;s!==null;){if(s.tag===3||s.tag===5||s.tag===27)return s;s=s.return}return null}function y(s){var r=!1;for(s=s.return;s!==null&&(s.tag===4&&(r=!0),!(s.tag===3||s.tag===5||s.tag===27));)s=s.return;return r}function _(s){var r=[null,null],o=b(s);return o===null||j(r,s,o.child,{foundSelf:!1}),r}function j(s,r,o,d){for(;o!==null;){if(o===r)d.foundSelf=!0;else if(o.tag===5||o.tag===27||o.tag===6){if(d.foundSelf)return s[1]=o,!0;s[0]=o}else if((o.tag!==22||o.memoizedState===null)&&j(s,r,o.child,d))return!0;o=o.sibling}return!1}function N(s){switch(s.tag){case 5:case 27:case 6:return s.stateNode;case 3:return s.stateNode.containerInfo;default:throw Error(i(559))}}var S=null,C=null;function E(s,r,o){return s===o?!0:s===r?(S=s,!0):!1}function L(s,r,o){return s===o?(C=s,!1):s===r?(C!==null&&(S=s),!0):!1}function O(s){if(s===null)return null;do s=s===null?null:s.return;while(s&&s.tag!==5&&s.tag!==27&&s.tag!==3);return s||null}function R(s,r,o){for(var d=0,p=s;p;p=o(p))d++;p=0;for(var g=r;g;g=o(g))p++;for(;0<d-p;)s=o(s),d--;for(;0<p-d;)r=o(r),p--;for(;d--;){if(s===r||r!==null&&s===r.alternate)return s;s=o(s),r=o(r)}return null}var F=Object.assign,D=Symbol.for("react.element"),X=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),fe=Symbol.for("react.profiler"),te=Symbol.for("react.consumer"),K=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),se=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),Te=Symbol.for("react.activity"),Ce=Symbol.for("react.legacy_hidden"),z=Symbol.for("react.memo_cache_sentinel"),B=Symbol.for("react.view_transition"),ce=Symbol.for("react.recoverable"),ye=Symbol.iterator;function Ne(s){return s===null||typeof s!="object"?null:(s=ye&&s[ye]||s["@@iterator"],typeof s=="function"?s:null)}var Ae=Symbol.for("react.client.reference");function Le(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Ae?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case Y:return"Fragment";case fe:return"Profiler";case A:return"StrictMode";case V:return"Suspense";case se:return"SuspenseList";case Te:return"Activity";case B:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case P:return"Portal";case K:return s.displayName||"Context";case te:return(s._context.displayName||"Context")+".Consumer";case G:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case ae:return r=s.displayName||null,r!==null?r:Le(s.type)||"Memo";case M:r=s._payload,s=s._init;try{return Le(s(r))}catch{}}return null}var De=Array.isArray,Ee=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ut={pending:!1,data:null,method:null,action:null},Qt=[],Ft=-1;function jt(s){return{current:s}}function wt(s){0>Ft||(s.current=Qt[Ft],Qt[Ft]=null,Ft--)}function Xe(s,r){Ft++,Qt[Ft]=s.current,s.current=r}var St=jt(null),nn=jt(null),ne=jt(null),je=jt(null);function Ye(s,r){switch(Xe(ne,r),Xe(nn,s),Xe(St,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?cy(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=cy(r),s=uy(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}wt(St),Xe(St,s)}function Je(){wt(St),wt(nn),wt(ne)}function un(s){var r=s.memoizedState;r!==null&&(Yl._currentValue=r.memoizedState,Xe(je,s)),r=St.current;var o=uy(r,s.type);r!==o&&(Xe(nn,s),Xe(St,o))}function ue(s){nn.current===s&&(wt(St),wt(nn)),je.current===s&&(wt(je),Yl._currentValue=Ut)}var be,H;function ge(s){if(be===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);be=r&&r[1]||"",H=-1<o.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+be+s+H}var Pe=!1;function We(s,r){if(!s||Pe)return"";Pe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(r){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(Me){var W=Me}Reflect.construct(s,[],pe)}else{try{pe.call()}catch(Me){W=Me}pe=!1;try{var ie=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),pe=!0,new s}finally{pe&&(ie!==void 0?Object.defineProperty(s.prototype,"props",ie):delete s.prototype.props)}}}else{try{throw Error()}catch(Me){W=Me}(pe=s())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(Me){if(Me&&W&&typeof Me.stack=="string")return[Me.stack,W.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=d.DetermineComponentFrameRoot(),w=g[0],T=g[1];if(w&&T){var $=w.split(`
|
|
45
|
-
`),J=T.split(`
|
|
46
|
-
`);for(p=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;p<J.length&&!J[p].includes("DetermineComponentFrameRoot");)p++;if(d===$.length||p===J.length)for(d=$.length-1,p=J.length-1;1<=d&&0<=p&&$[d]!==J[p];)p--;for(;1<=d&&0<=p;d--,p--)if($[d]!==J[p]){if(d!==1||p!==1)do if(d--,p--,0>p||$[d]!==J[p]){var le=`
|
|
47
|
-
`+$[d].replace(" at new "," at ");return s.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",s.displayName)),le}while(1<=d&&0<=p);break}}}finally{Pe=!1,Error.prepareStackTrace=o}return(o=s?s.displayName||s.name:"")?ge(o):""}function at(s,r){switch(s.tag){case 26:case 27:case 5:return ge(s.type);case 16:return ge("Lazy");case 13:return s.child!==r&&r!==null?ge("Suspense Fallback"):ge("Suspense");case 19:return ge("SuspenseList");case 0:case 15:return We(s.type,!1);case 11:return We(s.type.render,!1);case 1:return We(s.type,!0);case 31:return ge("Activity");case 30:return ge("ViewTransition");default:return""}}function ft(s){try{var r="",o=null;do r+=at(s,o),o=s,s=s.return;while(s);return r}catch(d){return`
|
|
48
|
-
Error generating stack: `+d.message+`
|
|
49
|
-
`+d.stack}}var hn=Object.prototype.hasOwnProperty,rs=e.unstable_scheduleCallback,Ct=e.unstable_cancelCallback,bs=e.unstable_shouldYield,In=e.unstable_requestPaint,sn=e.unstable_now,vr=e.unstable_getCurrentPriorityLevel,$i=e.unstable_ImmediatePriority,oe=e.unstable_UserBlockingPriority,ve=e.unstable_NormalPriority,we=e.unstable_LowPriority,rt=e.unstable_IdlePriority,It=e.log,Sn=e.unstable_setDisableYieldValue,Nn=null,xt=null;function rn(s){if(typeof It=="function"&&Sn(s),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Nn,s)}catch{}}var en=Math.clz32?Math.clz32:ys,Co=Math.log,Ru=Math.LN2;function ys(s){return s>>>=0,s===0?32:31-(Co(s)/Ru|0)|0}var br=256,ga=262144,xa=4194304;function Ys(s){var r=s&42;if(r!==0)return r;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&-s;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 Xs(s,r,o){var d=s.pendingLanes;if(d===0)return 0;var p=0,g=s.suspendedLanes,w=s.pingedLanes;s=s.warmLanes;var T=d&134217727;return T!==0?(d=T&~g,d!==0?p=Ys(d):(w&=T,w!==0?p=Ys(w):o||(o=T&~s,o!==0&&(p=Ys(o))))):(T=d&~g,T!==0?p=Ys(T):w!==0?p=Ys(w):o||(o=d&~s,o!==0&&(p=Ys(o)))),p===0?0:r!==0&&r!==p&&(r&g)===0&&(g=p&-p,o=r&-r,g>=o||g===32&&(o&4194048)!==0)?r:p}function yr(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Bi(s,r){(r&8)!==0&&(r|=r&32);var o=s.entangledLanes;if(o!==0)for(s=s.entanglements,o&=r;0<o;){var d=31-en(o),p=1<<d;r|=s[d],o&=~p}return r}function jh(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Ou(){var s=xa;return xa<<=1,(xa&62914560)===0&&(xa=4194304),s}function Pi(s){for(var r=[],o=0;31>o;o++)r.push(s);return r}function ui(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ol(s,r,o,d,p,g){var w=s.pendingLanes;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=o,s.entangledLanes&=o,s.errorRecoveryDisabledLanes&=o,s.shellSuspendCounter=0;var T=s.entanglements,$=s.expirationTimes,J=s.hiddenUpdates;for(o=w&~o;0<o;){var le=31-en(o),pe=1<<le;T[le]=0,$[le]=-1;var W=J[le];if(W!==null)for(J[le]=null,le=0;le<W.length;le++){var ie=W[le];ie!==null&&(ie.lane&=-536870913)}o&=~pe}d!==0&&va(s,d,0),g!==0&&p===0&&s.tag!==0&&(s.suspendedLanes|=g&~(w&~r))}function va(s,r,o){s.pendingLanes|=r,s.suspendedLanes&=~r;var d=31-en(r);s.entangledLanes|=r,s.entanglements[d]=s.entanglements[d]|1073741824|o&261930}function Eo(s,r){var o=s.entangledLanes|=r;for(s=s.entanglements;o;){var d=31-en(o),p=1<<d;p&r|s[d]&r&&(s[d]|=r),o&=~p}}function di(s,r){var o=r&-r;return o=(o&42)!==0?1:To(o),(o&(s.suspendedLanes|r))!==0?0:o}function To(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 ba(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ya(){var s=Re.p;return s!==0?s:(s=window.event,s===void 0?32:Yy(s.type))}function as(s,r){var o=Re.p;try{return Re.p=s,r()}finally{Re.p=o}}var _s=Math.random().toString(36).slice(2),dn="__reactFiber$"+_s,Cn="__reactProps$"+_s,fi="__reactContainer$"+_s,Mo="__reactEvents$"+_s,an="__reactListeners$"+_s,Nh="__reactHandles$"+_s,Ao="__reactResources$"+_s,_a="__reactMarker$"+_s,cl="__reactLoad$"+_s;function ul(s){delete s[dn],delete s[Cn],delete s[an],delete s[Nh]}function Ui(s){var r;if(r=s[dn])return r;for(var o=s.parentNode;o;){if(r=o[fi]||o[dn]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(s=Cy(s);s!==null;){if(o=s[dn])return o;s=Cy(s)}return r}s=o,o=s.parentNode}return null}function hi(s){if(s=s[dn]||s[fi]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function _r(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function ls(s){var r=s[Ao];return r||(r=s[Ao]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function ln(s){s[_a]=!0}function ws(s){s[cl]=void 0}var Qs=new Set,dl={};function Fi(s,r){Ii(s,r),Ii(s+"Capture",r)}function Ii(s,r){for(dl[s]=r,s=0;s<r.length;s++)Qs.add(r[s])}var Ch=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fl={},Ro={};function Eh(s){return hn.call(Ro,s)?!0:hn.call(fl,s)?!1:Ch.test(s)?Ro[s]=!0:(fl[s]=!0,!1)}var vt=!1;function Lu(){var s=vt;return vt=!1,s}function hl(s,r,o){if(Eh(r))if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var d=r.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,o)}}function wa(s,r,o){if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,o)}}function Os(s,r,o,d){if(d===null)s.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttributeNS(r,o,d)}}function Xn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Du(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function zu(s,r,o){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var p=d.get,g=d.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return p.call(this)},set:function(w){o=""+w,g.call(this,w)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function wr(s){if(!s._valueTracker){var r=Du(s)?"checked":"value";s._valueTracker=zu(s,r,""+s[r])}}function Oo(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var o=r.getValue(),d="";return s&&(d=Du(s)?s.checked?"true":"false":s.value),s=d,s!==o?(r.setValue(s),!0):!1}var Th=/[\n"\\]/g;function os(s){return s.replace(Th,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Lo(s,r,o,d,p,g,w,T){s.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?s.type=w:s.removeAttribute("type"),r!=null?w==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Xn(r)):s.value!==""+Xn(r)&&(s.value=""+Xn(r)):w!=="submit"&&w!=="reset"||s.removeAttribute("value"),r!=null?w==="number"&&s.value==r?Do(s,Xn(s.value)):Do(s,Xn(r)):o!=null?Do(s,Xn(o)):d!=null&&s.removeAttribute("value"),p==null&&g!=null&&(s.defaultChecked=!!g),p!=null&&(s.checked=p&&typeof p!="function"&&typeof p!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.name=""+Xn(T):s.removeAttribute("name")}function $u(s,r,o,d,p,g,w,T){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),r!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||r!=null)){wr(s);return}o=o!=null?""+Xn(o):"",r=r!=null?""+Xn(r):o,T||r===s.value||(s.value=r),s.defaultValue=r}d=d??p,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=T?s.checked:!!d,s.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(s.name=w),wr(s)}function Do(s,r){s.defaultValue!==""+r&&(s.defaultValue=""+r)}function Sr(s,r,o,d){if(s=s.options,r){r={};for(var p=0;p<o.length;p++)r["$"+o[p]]=!0;for(o=0;o<s.length;o++)p=r.hasOwnProperty("$"+s[o].value),s[o].selected!==p&&(s[o].selected=p),p&&d&&(s[o].defaultSelected=!0)}else{for(o=""+Xn(o),r=null,p=0;p<s.length;p++){if(s[p].value===o){s[p].selected=!0,d&&(s[p].defaultSelected=!0);return}r!==null||s[p].disabled||(r=s[p])}r!==null&&(r.selected=!0)}}function zo(s,r,o){if(r!=null&&(r=""+Xn(r),r!==s.value&&(s.value=r),o==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=o!=null?""+Xn(o):""}function $o(s,r,o,d){if(r==null){if(d!=null){if(o!=null)throw Error(i(92));if(De(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),r=o}o=Xn(r),s.defaultValue=o,d=s.textContent,d===o&&d!==""&&d!==null&&(s.value=d),wr(s)}function Hi(s,r){if(r){var o=s.firstChild;if(o&&o===s.lastChild&&o.nodeType===3){o.nodeValue=r;return}}s.textContent=r}var q=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 xe(s,r,o){var d=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":d?s.setProperty(r,o):typeof o!="number"||o===0||q.has(r)?r==="float"?s.cssFloat=o:s[r]=(""+o).trim():s[r]=o+"px"}function st(s,r,o){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||r!=null&&r.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",vt=!0);for(var p in r)d=r[p],r.hasOwnProperty(p)&&o[p]!==d&&(xe(s,p,d),vt=!0)}else for(var g in r)r.hasOwnProperty(g)&&xe(s,g,r[g])}function mt(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 gt=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"],["maskType","mask-type"],["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"]]),Qe=/^[\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 Rn(s){return Qe.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Qn(){}var kr=null;function jr(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var pn=null,qi=null;function Bu(s){var r=hi(s);if(r&&(s=r.stateNode)){var o=s[Cn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Lo(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=s;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+os(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var d=o[r];if(d!==s&&d.form===s.form){var p=d[Cn]||null;if(!p)throw Error(i(90));Lo(d,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<o.length;r++)d=o[r],d.form===s.form&&Oo(d)}break e;case"textarea":zo(s,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&Sr(s,!!o.multiple,r,!1)}}}var Bo=!1;function Pu(s,r,o){if(Bo)return s(r,o);Bo=!0;try{var d=s(r);return d}finally{if(Bo=!1,(pn!==null||qi!==null)&&($d(),pn&&(r=pn,s=qi,qi=pn=null,Bu(r),s)))for(r=0;r<s.length;r++)Bu(s[r])}}function Nr(s,r){var o=s.stateNode;if(o===null)return null;var d=o[Cn]||null;if(d===null)return null;o=d[r];e:switch(r){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(o&&typeof o!="function")throw Error(i(231,r,typeof o));return o}var pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pl=!1;if(pi)try{var Cr={};Object.defineProperty(Cr,"passive",{get:function(){pl=!0}}),window.addEventListener("test",Cr,Cr),window.removeEventListener("test",Cr,Cr)}catch{pl=!1}var Ks=null,mi=null,Sa=null;function Po(){if(Sa)return Sa;var s,r=mi,o=r.length,d,p="value"in Ks?Ks.value:Ks.textContent,g=p.length;for(s=0;s<o&&r[s]===p[s];s++);var w=o-s;for(d=1;d<=w&&r[o-d]===p[g-d];d++);return Sa=p.slice(s,1<d?1-d:void 0)}function Vi(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function Uu(){return!0}function av(){return!1}function Kn(s){function r(o,d,p,g,w){this._reactName=o,this._targetInst=p,this.type=d,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var T in s)s.hasOwnProperty(T)&&(o=s[T],this[T]=o?o(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Uu:av,this.isPropagationStopped=av,this}return F(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Uu)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Uu)},persist:function(){},isPersistent:Uu}),r}var Er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fu=Kn(Er),Uo=F({},Er,{view:0,detail:0}),EN=Kn(Uo),Mh,Ah,Fo,Iu=F({},Uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oh,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!==Fo&&(Fo&&s.type==="mousemove"?(Mh=s.screenX-Fo.screenX,Ah=s.screenY-Fo.screenY):Ah=Mh=0,Fo=s),Mh)},movementY:function(s){return"movementY"in s?s.movementY:Ah}}),lv=Kn(Iu),TN=F({},Iu,{dataTransfer:0}),MN=Kn(TN),AN=F({},Uo,{relatedTarget:0}),Rh=Kn(AN),RN=F({},Er,{animationName:0,elapsedTime:0,pseudoElement:0}),ON=Kn(RN),LN=F({},Er,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),DN=Kn(LN),zN=F({},Er,{data:0}),ov=Kn(zN),$N={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BN={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"},PN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function UN(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=PN[s])?!!r[s]:!1}function Oh(){return UN}var FN=F({},Uo,{key:function(s){if(s.key){var r=$N[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Vi(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?BN[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oh,charCode:function(s){return s.type==="keypress"?Vi(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Vi(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),IN=Kn(FN),HN=F({},Iu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cv=Kn(HN),qN=F({},Er,{submitter:0}),VN=Kn(qN),GN=F({},Uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oh}),YN=Kn(GN),XN=F({},Er,{propertyName:0,elapsedTime:0,pseudoElement:0}),QN=Kn(XN),KN=F({},Iu,{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}),WN=Kn(KN),ZN=F({},Er,{newState:0,oldState:0,source:0}),JN=Kn(ZN),eC=[9,13,27,32],Lh=pi&&"CompositionEvent"in window,Io=null;pi&&"documentMode"in document&&(Io=document.documentMode);var tC=pi&&"TextEvent"in window&&!Io,uv=pi&&(!Lh||Io&&8<Io&&11>=Io),dv=" ",fv=!1;function hv(s,r){switch(s){case"keyup":return eC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ml=!1;function nC(s,r){switch(s){case"compositionend":return pv(r);case"keypress":return r.which!==32?null:(fv=!0,dv);case"textInput":return s=r.data,s===dv&&fv?null:s;default:return null}}function sC(s,r){if(ml)return s==="compositionend"||!Lh&&hv(s,r)?(s=Po(),Sa=mi=Ks=null,ml=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return uv&&r.locale!=="ko"?null:r.data;default:return null}}var iC={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 mv(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!iC[s.type]:r==="textarea"}function gv(s,r,o,d){pn?qi?qi.push(d):qi=[d]:pn=d,r=Hd(r,"onChange"),0<r.length&&(o=new Fu("onChange","change",null,o,d),s.push({event:o,listeners:r}))}var Ho=null,qo=null;function rC(s){sy(s,0)}function Hu(s){var r=_r(s);if(Oo(r))return s}function xv(s,r){if(s==="change")return r}var vv=!1;if(pi){var Dh;if(pi){var zh="oninput"in document;if(!zh){var bv=document.createElement("div");bv.setAttribute("oninput","return;"),zh=typeof bv.oninput=="function"}Dh=zh}else Dh=!1;vv=Dh&&(!document.documentMode||9<document.documentMode)}function yv(){Ho&&(Ho.detachEvent("onpropertychange",_v),qo=Ho=null)}function _v(s){if(s.propertyName==="value"&&Hu(qo)){var r=[];gv(r,qo,s,jr(s)),Pu(rC,r)}}function aC(s,r,o){s==="focusin"?(yv(),Ho=r,qo=o,Ho.attachEvent("onpropertychange",_v)):s==="focusout"&&yv()}function lC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Hu(qo)}function oC(s,r){if(s==="click")return Hu(r)}function cC(s,r){if(s==="input"||s==="change")return Hu(r)}function uC(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Ss=typeof Object.is=="function"?Object.is:uC;function Vo(s,r){if(Ss(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var o=Object.keys(s),d=Object.keys(r);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var p=o[d];if(!hn.call(r,p)||!Ss(s[p],r[p]))return!1}return!0}function $h(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}}function wv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Sv(s,r){var o=wv(s);s=0;for(var d;o;){if(o.nodeType===3){if(d=s+o.textContent.length,s<=r&&d>=r)return{node:o,offset:r-s};s=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=wv(o)}}function kv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?kv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function jv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=$h(s.document);r instanceof s.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)s=r.contentWindow;else break;r=$h(s.document)}return r}function Bh(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var dC=pi&&"documentMode"in document&&11>=document.documentMode,gl=null,Ph=null,Go=null,Uh=!1;function Nv(s,r,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Uh||gl==null||gl!==$h(d)||(d=gl,"selectionStart"in d&&Bh(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}),Go&&Vo(Go,d)||(Go=d,d=Hd(Ph,"onSelect"),0<d.length&&(r=new Fu("onSelect","select",null,r,o),s.push({event:r,listeners:d}),r.target=gl)))}function ka(s,r){var o={};return o[s.toLowerCase()]=r.toLowerCase(),o["Webkit"+s]="webkit"+r,o["Moz"+s]="moz"+r,o}var xl={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionrun:ka("Transition","TransitionRun"),transitionstart:ka("Transition","TransitionStart"),transitioncancel:ka("Transition","TransitionCancel"),transitionend:ka("Transition","TransitionEnd")},Fh={},Cv={};pi&&(Cv=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function ja(s){if(Fh[s])return Fh[s];if(!xl[s])return s;var r=xl[s],o;for(o in r)if(r.hasOwnProperty(o)&&o in Cv)return Fh[s]=r[o];return s}var Ev=ja("animationend"),Tv=ja("animationiteration"),Mv=ja("animationstart"),fC=ja("transitionrun"),hC=ja("transitionstart"),pC=ja("transitioncancel"),Av=ja("transitionend"),Rv=new Map,Ih="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");Ih.push("scrollEnd");function Ws(s,r){Rv.set(s,r),Fi(r,[s])}var mC=0;function Gi(s,r){if(s.name!=null&&s.name!=="auto")return s.name;if(r.autoName!==null)return r.autoName;s=ti.identifierPrefix;var o=mC++;return s="_"+s+"t_"+o.toString(32)+"_",r.autoName=s}function Ov(s){if(s==null||typeof s=="string")return s;var r=null,o=$l;if(o!==null)for(var d=0;d<o.length;d++){var p=s[o[d]];if(p!=null){if(p==="none")return"none";r=r==null?p:r+(" "+p)}}return r??s.default}function Yi(s,r){return s=Ov(s),r=Ov(r),r==null?s==="auto"?null:s:r==="auto"?null:r}var qu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ls=[],vl=0,Hh=0;function Vu(){for(var s=vl,r=Hh=vl=0;r<s;){var o=Ls[r];Ls[r++]=null;var d=Ls[r];Ls[r++]=null;var p=Ls[r];Ls[r++]=null;var g=Ls[r];if(Ls[r++]=null,d!==null&&p!==null){var w=d.pending;w===null?p.next=p:(p.next=w.next,w.next=p),d.pending=p}g!==0&&Lv(o,p,g)}}function Gu(s,r,o,d){Ls[vl++]=s,Ls[vl++]=r,Ls[vl++]=o,Ls[vl++]=d,Hh|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function qh(s,r,o,d){return Gu(s,r,o,d),Yu(s)}function Na(s,r){return Gu(s,null,null,r),Yu(s)}function Lv(s,r,o){s.lanes|=o;var d=s.alternate;d!==null&&(d.lanes|=o);for(var p=!1,g=s.return;g!==null;)g.childLanes|=o,d=g.alternate,d!==null&&(d.childLanes|=o),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(p=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,p&&r!==null&&(p=31-en(o),s=g.hiddenUpdates,d=s[p],d===null?s[p]=[r]:d.push(r),r.lane=o|536870912),g):null}function Yu(s){if(50<pc)throw pc=0,zd=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var bl={};function gC(s,r,o,d){this.tag=s,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,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 cs(s,r,o,d){return new gC(s,r,o,d)}function Vh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Xi(s,r){var o=s.alternate;return o===null?(o=cs(s.tag,r,s.key,s.mode),o.elementType=s.elementType,o.type=s.type,o.stateNode=s.stateNode,o.alternate=s,s.alternate=o):(o.pendingProps=r,o.type=s.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=s.flags&1206910976,o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,r=s.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=s.sibling,o.index=s.index,o.ref=s.ref,o.refCleanup=s.refCleanup,o}function Dv(s,r){s.flags&=1206910978;var o=s.alternate;return o===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,r=o.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Xu(s,r,o,d,p,g){var w=0;if(d=s,typeof d=="function")Vh(d)&&(w=1);else if(typeof d=="string")w=q3(s,o,St.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case Te:return s=cs(31,o,r,p),s.elementType=Te,s.lanes=g,s;case Y:return Ca(o.children,p,g,r);case A:w=8,p|=24;break;case fe:return s=cs(12,o,r,p|2),s.elementType=fe,s.lanes=g,s;case V:return s=cs(13,o,r,p),s.elementType=V,s.lanes=g,s;case se:return s=cs(19,o,r,p),s.elementType=se,s.lanes=g,s;case Ce:case B:return s=p|32,s=cs(30,o,r,s),s.elementType=B,s.lanes=g,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case K:w=10;break e;case te:w=9;break e;case G:w=11;break e;case ae:w=14;break e;case M:w=16,d=null;break e}w=29,o=Error(i(130,s===null?"null":typeof s,"")),d=null}return r=cs(w,o,r,p),r.elementType=s,r.type=d,r.lanes=g,r}function Ca(s,r,o,d){return s=cs(7,s,d,r),s.lanes=o,s}function Gh(s,r,o){return s=cs(6,s,null,r),s.lanes=o,s}function zv(s){var r=cs(18,null,null,0);return r.stateNode=s,r}function Yh(s,r,o){return r=cs(4,s.children!==null?s.children:[],s.key,r),r.lanes=o,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var $v=new WeakMap;function Ds(s,r){if(typeof s=="object"&&s!==null){var o=$v.get(s);return o!==void 0?o:(r={value:s,source:r,stack:ft(r)},$v.set(s,r),r)}return{value:s,source:r,stack:ft(r)}}var yl=[],_l=0,Qu=null,Yo=0,zs=[],$s=0,Tr=null,gi=1,xi="";function Qi(s,r){yl[_l++]=Yo,yl[_l++]=Qu,Qu=s,Yo=r}function Bv(s,r,o){zs[$s++]=gi,zs[$s++]=xi,zs[$s++]=Tr,Tr=s;var d=gi;s=xi;var p=32-en(d)-1;d&=~(1<<p),o+=1;var g=32-en(r)+p;if(30<g){var w=p-p%5;g=(d&(1<<w)-1).toString(32),d>>=w,p-=w,gi=1<<32-en(r)+p|o<<p|d,xi=g+s}else gi=1<<g|o<<p|d,xi=s}function Ku(s){s.return!==null&&(Qi(s,1),Bv(s,1,0))}function Xh(s){for(;s===Qu;)Qu=yl[--_l],yl[_l]=null,Yo=yl[--_l],yl[_l]=null;for(;s===Tr;)Tr=zs[--$s],zs[$s]=null,xi=zs[--$s],zs[$s]=null,gi=zs[--$s],zs[$s]=null}function Pv(s,r){zs[$s++]=gi,zs[$s++]=xi,zs[$s++]=Tr,gi=r.id,xi=r.overflow,Tr=s}var En=null,Ht=null,lt=!1,Mr=null,Bs=!1,Qh=Error(i(519));function Ar(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xo(Ds(r,s)),Qh}function Uv(s){var r=s.stateNode,o=s.type,d=s.memoizedProps;switch(r[dn]=s,r[Cn]=d,o){case"dialog":ut("cancel",r),ut("close",r);break;case"iframe":case"object":case"embed":ut("load",r);break;case"video":case"audio":for(o=0;o<gc.length;o++)ut(gc[o],r);break;case"source":ut("error",r);break;case"img":case"image":case"link":ut("error",r),ut("load",r);break;case"details":ut("toggle",r);break;case"input":ut("invalid",r),$u(r,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ut("invalid",r);break;case"textarea":ut("invalid",r),$o(r,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||d.suppressHydrationWarning===!0||ly(r.textContent,o)?(d.popover!=null&&(ut("beforetoggle",r),ut("toggle",r)),d.onScroll!=null&&ut("scroll",r),d.onScrollEnd!=null&&ut("scrollend",r),d.onClick!=null&&(r.onclick=Qn),r=!0):r=!1,r||Ar(s,!0)}function Wu(s){for(En=s.return;En;)switch(En.tag){case 5:case 31:case 13:Bs=!1;return;case 27:case 3:Bs=!0;return;default:En=En.return}}function wl(s){if(s!==En)return!1;if(!lt)return Wu(s),lt=!0,!1;var r=s.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=s.type,o=!(o!=="form"&&o!=="button")||jm(s.type,s.memoizedProps)),o=!o),o&&Ht&&Ar(s),Wu(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Ny(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Ny(s)}else r===27?(r=Ht,Yr(s.type)?(s=Lm,Lm=null,Ht=s):Ht=r):Ht=En?Us(s.stateNode.nextSibling):null;return!0}function Ea(){Ht=En=null,lt=!1}function Kh(){var s=Mr;return s!==null&&(fs===null?fs=s:fs.push.apply(fs,s),Mr=null),s}function Xo(s){Mr===null?Mr=[s]:Mr.push(s)}var Wh=jt(null),Ta=null,Ki=null;function Rr(s,r,o){Xe(Wh,r._currentValue),r._currentValue=o}function Wi(s){s._currentValue=Wh.current,wt(Wh)}function Zu(s,r,o){for(;s!==null;){var d=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,d!==null&&(d.childLanes|=r)):d!==null&&(d.childLanes&r)!==r&&(d.childLanes|=r),s===o)break;s=s.return}}function Zh(s,r,o,d){var p=s.child;for(p!==null&&(p.return=s);p!==null;){var g=p.dependencies;if(g!==null){var w=p.child;g=g.firstContext;e:for(;g!==null;){var T=g;g=p;for(var $=0;$<r.length;$++)if(T.context===r[$]){g.lanes|=o,T=g.alternate,T!==null&&(T.lanes|=o),Zu(g.return,o,s),d||(w=null);break e}g=T.next}}else if(p.tag===18){if(w=p.return,w===null)throw Error(i(341));w.lanes|=o,g=w.alternate,g!==null&&(g.lanes|=o),Zu(w,o,s),w=null}else p.tag===13&&p.memoizedState!==null&&p.memoizedState.dehydrated===null?(p.lanes|=o,w=p.alternate,w!==null&&(w.lanes|=o),Zu(p.return,o,s),w=p.child,w=w!==null?w.sibling:null):w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===s){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}}function Ma(s,r,o,d){s=null;for(var p=r,g=!1;p!==null;){if(!g){if((p.flags&524288)!==0)g=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var w=p.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var T=p.type;Ss(p.pendingProps.value,w.value)||(s!==null?s.push(T):s=[T])}}else if(p===je.current){if(w=p.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(s!==null?s.push(Yl):s=[Yl])}p=p.return}return s!==null&&Zh(r,s,o,d),r.flags|=262144,s!==null}function Ju(s){for(s=s.firstContext;s!==null;){if(!Ss(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Aa(s){Ta=s,Ki=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function On(s){return Fv(Ta,s)}function ed(s,r){return Ta===null&&Aa(s),Fv(s,r)}function Fv(s,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},Ki===null){if(s===null)throw Error(i(308));Ki=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else Ki=Ki.next=r;return o}var xC=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(o,d){s.push(d)}};this.abort=function(){r.aborted=!0,s.forEach(function(o){return o()})}},vC=e.unstable_scheduleCallback,bC=e.unstable_NormalPriority,mn={$$typeof:K,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jh(){return{controller:new xC,data:new Map,refCount:0}}function Qo(s){s.refCount--,s.refCount===0&&vC(bC,function(){s.controller.abort()})}function Iv(s,r){if((s.pendingLanes&4194048)!==0){var o=s.transitionTypes;for(o===null&&(o=s.transitionTypes=[]),s=0;s<r.length;s++){var d=r[s];o.indexOf(d)===-1&&o.push(d)}}}var Ko=null;function yC(s){var r=s.transitionTypes;return s.transitionTypes=null,r}var Wo=null,ep=0,Ra=0,Sl=null;function _C(s,r){if(Wo===null){var o=Wo=[];ep=0,Ra=gm(),Sl={status:"pending",value:void 0,then:function(d){o.push(d)}}}return ep++,r.then(Hv,Hv),r}function Hv(){if(--ep===0&&(Ko=null,Wo!==null)){Sl!==null&&(Sl.status="fulfilled");var s=Wo;Wo=null,Ra=0,Sl=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function wC(s,r){var o=[],d={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return s.then(function(){d.status="fulfilled",d.value=r;for(var p=0;p<o.length;p++)(0,o[p])(r)},function(p){for(d.status="rejected",d.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),d}var qv=Ee.S;Ee.S=function(s,r){if(zb=sn(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&_C(s,r),Ko!==null)for(var o=Fl;o!==null;)Iv(o,Ko),o=o.next;if(o=s.types,o!==null){for(var d=Fl;d!==null;)Iv(d,o),d=d.next;if(Ra!==0){d=Ko,d===null&&(d=Ko=[]);for(var p=0;p<o.length;p++){var g=o[p];d.indexOf(g)===-1&&d.push(g)}}}qv!==null&&qv(s,r)};var Oa=jt(null);function tp(){var s=Oa.current;return s!==null?s:$t.pooledCache}function td(s,r){r===null?Xe(Oa,Oa.current):Xe(Oa,r.pool)}function Vv(){var s=tp();return s===null?null:{parent:mn._currentValue,pool:s}}var kl=Error(i(460)),np=Error(i(474)),nd=Error(i(542)),sd={then:function(){}};function Gv(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Yv(s,r,o){switch(o=s[o],o===void 0?s.push(r):o!==r&&(r.then(Qn,Qn),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Qv(s),s===void 0&&!("reason"in r)?Error(i(600)):s;default:if(typeof r.status=="string")r.then(Qn,Qn);else{if(s=$t,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(d){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=d}},function(d){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=d}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Qv(s),s}throw Da=r,kl}}function La(s){try{var r=s._init;return r(s._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Da=o,kl):o}}var Da=null;function Xv(){if(Da===null)throw Error(i(459));var s=Da;return Da=null,s}function Qv(s){if(s===kl||s===nd)throw Error(i(483))}var jl=null,Zo=0;function id(s){var r=Zo;return Zo+=1,jl===null&&(jl=[]),Yv(jl,s,r)}function Or(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function rd(s,r){throw r.$$typeof===D?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Kv(s){function r(Z,I){if(s){var ee=Z.deletions;ee===null?(Z.deletions=[I],Z.flags|=16):ee.push(I)}}function o(Z,I){if(!s)return null;for(;I!==null;)r(Z,I),I=I.sibling;return null}function d(Z){for(var I=new Map;Z!==null;)Z.key===null?I.set(Z.index,Z):I.set(Z.key,Z),Z=Z.sibling;return I}function p(Z,I){return Z=Xi(Z,I),Z.index=0,Z.sibling=null,Z}function g(Z,I,ee){return Z.index=ee,s?(ee=Z.alternate,ee!==null?(ee=ee.index,ee<I?(Z.flags|=2,I):ee):(Z.flags|=134217730,I)):(Z.flags|=1048576,I)}function w(Z){return s&&Z.alternate===null&&(Z.flags|=134217730),Z}function T(Z,I,ee,he){return I===null||I.tag!==6?(I=Gh(ee,Z.mode,he),I.return=Z,I):(I=p(I,ee),I.return=Z,I)}function $(Z,I,ee,he){var Oe=ee.type;return Oe===Y?(Z=le(Z,I,ee.props.children,he,ee.key),Or(Z,ee),Z):I!==null&&(I.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===M&&La(Oe)===I.type)?(I=p(I,ee.props),Or(I,ee),I.return=Z,I):(I=Xu(ee.type,ee.key,ee.props,null,Z.mode,he),Or(I,ee),I.return=Z,I)}function J(Z,I,ee,he){return I===null||I.tag!==4||I.stateNode.containerInfo!==ee.containerInfo||I.stateNode.implementation!==ee.implementation?(I=Yh(ee,Z.mode,he),I.return=Z,I):(I=p(I,ee.children||[]),I.return=Z,I)}function le(Z,I,ee,he,Oe){return I===null||I.tag!==7?(I=Ca(ee,Z.mode,he,Oe),I.return=Z,I):(I=p(I,ee),I.return=Z,I)}function pe(Z,I,ee){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=Gh(""+I,Z.mode,ee),I.return=Z,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case X:return ee=Xu(I.type,I.key,I.props,null,Z.mode,ee),Or(ee,I),ee.return=Z,ee;case P:return I=Yh(I,Z.mode,ee),I.return=Z,I;case M:return I=La(I),pe(Z,I,ee)}if(De(I)||Ne(I))return I=Ca(I,Z.mode,ee,null),I.return=Z,I;if(typeof I.then=="function")return pe(Z,id(I),ee);if(I.$$typeof===K)return pe(Z,ed(Z,I),ee);rd(Z,I)}return null}function W(Z,I,ee,he){var Oe=I!==null?I.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Oe!==null?null:T(Z,I,""+ee,he);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case X:return ee.key===Oe?$(Z,I,ee,he):null;case P:return ee.key===Oe?J(Z,I,ee,he):null;case M:return ee=La(ee),W(Z,I,ee,he)}if(De(ee)||Ne(ee))return Oe!==null?null:le(Z,I,ee,he,null);if(typeof ee.then=="function")return W(Z,I,id(ee),he);if(ee.$$typeof===K)return W(Z,I,ed(Z,ee),he);rd(Z,ee)}return null}function ie(Z,I,ee,he,Oe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Z=Z.get(ee)||null,T(I,Z,""+he,Oe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case X:return Z=Z.get(he.key===null?ee:he.key)||null,$(I,Z,he,Oe);case P:return Z=Z.get(he.key===null?ee:he.key)||null,J(I,Z,he,Oe);case M:return he=La(he),ie(Z,I,ee,he,Oe)}if(De(he)||Ne(he))return Z=Z.get(ee)||null,le(I,Z,he,Oe,null);if(typeof he.then=="function")return ie(Z,I,ee,id(he),Oe);if(he.$$typeof===K)return ie(Z,I,ee,ed(I,he),Oe);rd(I,he)}return null}function Me(Z,I,ee,he){for(var Oe=null,pt=null,Fe=I,Ge=I=0,vn=null;Fe!==null&&Ge<ee.length;Ge++){Fe.index>Ge?(vn=Fe,Fe=null):vn=Fe.sibling;var bt=W(Z,Fe,ee[Ge],he);if(bt===null){Fe===null&&(Fe=vn);break}s&&Fe&&bt.alternate===null&&r(Z,Fe),I=g(bt,I,Ge),pt===null?Oe=bt:pt.sibling=bt,pt=bt,Fe=vn}if(Ge===ee.length)return o(Z,Fe),lt&&Qi(Z,Ge),Oe;if(Fe===null){for(;Ge<ee.length;Ge++)Fe=pe(Z,ee[Ge],he),Fe!==null&&(I=g(Fe,I,Ge),pt===null?Oe=Fe:pt.sibling=Fe,pt=Fe);return lt&&Qi(Z,Ge),Oe}for(Fe=d(Fe);Ge<ee.length;Ge++)vn=ie(Fe,Z,Ge,ee[Ge],he),vn!==null&&(s&&(bt=vn.alternate,bt!==null&&Fe.delete(bt.key===null?Ge:bt.key)),I=g(vn,I,Ge),pt===null?Oe=vn:pt.sibling=vn,pt=vn);return s&&Fe.forEach(function(Zr){return r(Z,Zr)}),lt&&Qi(Z,Ge),Oe}function Be(Z,I,ee,he){if(ee==null)throw Error(i(151));for(var Oe=null,pt=null,Fe=I,Ge=I=0,vn=null,bt=ee.next();Fe!==null&&!bt.done;Ge++,bt=ee.next()){Fe.index>Ge?(vn=Fe,Fe=null):vn=Fe.sibling;var Zr=W(Z,Fe,bt.value,he);if(Zr===null){Fe===null&&(Fe=vn);break}s&&Fe&&Zr.alternate===null&&r(Z,Fe),I=g(Zr,I,Ge),pt===null?Oe=Zr:pt.sibling=Zr,pt=Zr,Fe=vn}if(bt.done)return o(Z,Fe),lt&&Qi(Z,Ge),Oe;if(Fe===null){for(;!bt.done;Ge++,bt=ee.next())bt=pe(Z,bt.value,he),bt!==null&&(I=g(bt,I,Ge),pt===null?Oe=bt:pt.sibling=bt,pt=bt);return lt&&Qi(Z,Ge),Oe}for(Fe=d(Fe);!bt.done;Ge++,bt=ee.next())bt=ie(Fe,Z,Ge,bt.value,he),bt!==null&&(s&&(vn=bt.alternate,vn!==null&&Fe.delete(vn.key===null?Ge:vn.key)),I=g(bt,I,Ge),pt===null?Oe=bt:pt.sibling=bt,pt=bt);return s&&Fe.forEach(function(nE){return r(Z,nE)}),lt&&Qi(Z,Ge),Oe}function tt(Z,I,ee,he){if(typeof ee=="object"&&ee!==null&&ee.type===Y&&ee.key===null&&ee.props.ref===void 0&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case X:e:{for(var Oe=ee.key;I!==null;){if(I.key===Oe){if(Oe=ee.type,Oe===Y){if(I.tag===7){o(Z,I.sibling),he=p(I,ee.props.children),Or(he,ee),he.return=Z,Z=he;break e}}else if(I.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===M&&La(Oe)===I.type){o(Z,I.sibling),he=p(I,ee.props),Or(he,ee),he.return=Z,Z=he;break e}o(Z,I);break}else r(Z,I);I=I.sibling}ee.type===Y?(he=Ca(ee.props.children,Z.mode,he,ee.key),Or(he,ee),he.return=Z,Z=he):(he=Xu(ee.type,ee.key,ee.props,null,Z.mode,he),Or(he,ee),he.return=Z,Z=he)}return w(Z);case P:e:{for(Oe=ee.key;I!==null;){if(I.key===Oe)if(I.tag===4&&I.stateNode.containerInfo===ee.containerInfo&&I.stateNode.implementation===ee.implementation){o(Z,I.sibling),he=p(I,ee.children||[]),he.return=Z,Z=he;break e}else{o(Z,I);break}else r(Z,I);I=I.sibling}he=Yh(ee,Z.mode,he),he.return=Z,Z=he}return w(Z);case M:return ee=La(ee),tt(Z,I,ee,he)}if(De(ee))return Me(Z,I,ee,he);if(Ne(ee)){if(Oe=Ne(ee),typeof Oe!="function")throw Error(i(150));return ee=Oe.call(ee),Be(Z,I,ee,he)}if(typeof ee.then=="function")return tt(Z,I,id(ee),he);if(ee.$$typeof===K)return tt(Z,I,ed(Z,ee),he);rd(Z,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,I!==null&&I.tag===6?(o(Z,I.sibling),he=p(I,ee),he.return=Z,Z=he):(o(Z,I),he=Gh(ee,Z.mode,he),he.return=Z,Z=he),w(Z)):o(Z,I)}return function(Z,I,ee,he){try{Zo=0;var Oe=tt(Z,I,ee,he);return jl=null,Oe}catch(Fe){if(Fe===kl||Fe===nd)throw Fe;var pt=cs(29,Fe,null,Z.mode);return pt.lanes=he,pt.return=Z,pt}finally{}}}var za=Kv(!0),Wv=Kv(!1),Lr=!1;function sp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ip(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Dr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function zr(s,r,o){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Et&2)!==0){var p=d.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),d.pending=r,r=Yu(s),Lv(s,null,o),r}return Gu(s,d,r,o),Yu(s)}function Jo(s,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var d=r.lanes;d&=s.pendingLanes,o|=d,r.lanes=o,Eo(s,o)}}function rp(s,r){var o=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var p=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?p=g=w:g=g.next=w,o=o.next}while(o!==null);g===null?p=g=r:g=g.next=r}else p=g=r;o={baseState:d.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:d.shared,callbacks:d.callbacks},s.updateQueue=o;return}s=o.lastBaseUpdate,s===null?o.firstBaseUpdate=r:s.next=r,o.lastBaseUpdate=r}var ap=!1;function ec(){if(ap){var s=Sl;if(s!==null)throw s}}function tc(s,r,o,d){ap=!1;var p=s.updateQueue;Lr=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var $=T,J=$.next;$.next=null,w===null?g=J:w.next=J,w=$;var le=s.alternate;le!==null&&(le=le.updateQueue,T=le.lastBaseUpdate,T!==w&&(T===null?le.firstBaseUpdate=J:T.next=J,le.lastBaseUpdate=$))}if(g!==null){var pe=p.baseState;w=0,le=J=$=null,T=g;do{var W=T.lane&-536870913,ie=W!==T.lane;if(ie?(ht&W)===W:(d&W)===W){W!==0&&W===Ra&&(ap=!0),le!==null&&(le=le.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Me=s,Be=T;W=r;var tt=o;switch(Be.tag){case 1:if(Me=Be.payload,typeof Me=="function"){pe=Me.call(tt,pe,W);break e}pe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Be.payload,W=typeof Me=="function"?Me.call(tt,pe,W):Me,W==null)break e;pe=F({},pe,W);break e;case 2:Lr=!0}}W=T.callback,W!==null&&(s.flags|=64,ie&&(s.flags|=8192),ie=p.callbacks,ie===null?p.callbacks=[W]:ie.push(W))}else ie={lane:W,tag:T.tag,payload:T.payload,callback:T.callback,next:null},le===null?(J=le=ie,$=pe):le=le.next=ie,w|=W;if(T=T.next,T===null){if(T=p.shared.pending,T===null)break;ie=T,T=ie.next,ie.next=null,p.lastBaseUpdate=ie,p.shared.pending=null}}while(!0);le===null&&($=pe),p.baseState=$,p.firstBaseUpdate=J,p.lastBaseUpdate=le,g===null&&(p.shared.lanes=0),Hr|=w,s.lanes=w,s.memoizedState=pe}}function Zv(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function Jv(s,r){var o=s.callbacks;if(o!==null)for(s.callbacks=null,s=0;s<o.length;s++)Zv(o[s],r)}var $r=jt(null),ad=jt(0);function e1(s,r){s=nr,Xe(ad,s),Xe($r,r),nr=s|r.baseLanes}function lp(){Xe(ad,nr),Xe($r,$r.current)}function op(){nr=ad.current,wt($r),wt(ad)}var Ln=jt(null),Hn=null;function Br(s){var r=s.alternate;Xe(Dn,Dn.current&1),Xe(Ln,s),Hn===null&&(r===null||$r.current!==null||r.memoizedState!==null)&&(Hn=s)}function cp(s){Xe(Dn,Dn.current),Xe(Ln,s),Hn===null&&(Hn=s)}function t1(s){s.tag===22?(Xe(Dn,Dn.current),Xe(Ln,s),Hn===null&&(Hn=s)):Pr()}function Pr(){Xe(Dn,Dn.current),Xe(Ln,Ln.current)}function ks(s){wt(Ln),Hn===s&&(Hn=null),wt(Dn)}var Dn=jt(0);function nc(s,r){Xe(Ln,Ln.current),Xe(Dn,r)}function up(s){wt(Dn),wt(Ln),Hn===s&&(Hn=null)}function ld(s){for(var r=s;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Rm(o)||Om(o)))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!=="independent"){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Zi=0,et=null,Lt=null,gn=null,od=!1,Nl=!1,$a=!1,cd=0,sc=0,Cl=null,SC=0;function on(){throw Error(i(321))}function dp(s,r){if(r===null)return!1;for(var o=0;o<r.length&&o<s.length;o++)if(!Ss(s[o],r[o]))return!1;return!0}function fp(s,r,o,d,p,g){return Zi=g,et=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Ee.H=s===null||s.memoizedState===null?B1:P1,$a=!1,g=o(d,p),$a=!1,Nl&&(g=s1(r,o,d,p)),n1(s),g}function n1(s){Ee.H=gd;var r=Lt!==null&&Lt.next!==null;if(Zi=0,gn=Lt=et=null,od=!1,sc=0,Cl=null,r)throw Error(i(300));s===null||xn||(s=s.dependencies,s!==null&&Ju(s)&&(xn=!0))}function s1(s,r,o,d){et=s;var p=0;do{if(Nl&&(Cl=null),sc=0,Nl=!1,25<=p)throw Error(i(301));if(p+=1,gn=Lt=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}Ee.H=AC,g=r(o,d)}while(Nl);return g}function kC(){var s=Ee.H,r=s.useState()[0];return r=typeof r.then=="function"?ic(r):r,s=s.useState()[0],(Lt!==null?Lt.memoizedState:null)!==s&&(et.flags|=1024),r}function hp(){var s=cd!==0;return cd=0,s}function pp(s,r,o){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~o}function mp(s){if(od){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}od=!1}Zi=0,gn=Lt=et=null,Nl=!1,sc=cd=0,Cl=null}function Wn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gn===null?et.memoizedState=gn=s:gn=gn.next=s,gn}function fn(){if(Lt===null){var s=et.alternate;s=s!==null?s.memoizedState:null}else s=Lt.next;var r=gn===null?et.memoizedState:gn.next;if(r!==null)gn=r,Lt=s;else{if(s===null)throw et.alternate===null?Error(i(467)):Error(i(310));Lt=s,s={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},gn===null?et.memoizedState=gn=s:gn=gn.next=s}return gn}function ud(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ic(s){var r=sc;return sc+=1,Cl===null&&(Cl=[]),s=Yv(Cl,s,r),r=et,(gn===null?r.memoizedState:gn.next)===null&&(r=r.alternate,Ee.H=r===null||r.memoizedState===null?B1:P1),s}function dd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return ic(s);if(s.$$typeof===ce)return;if(s.$$typeof===K)return On(s)}throw Error(i(438,String(s)))}function gp(s){var r=null,o=et.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var d=et.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(r={data:d.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=ud(),et.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(s),d=0;d<s;d++)o[d]=z;return r.index++,o}function Ji(s,r){return typeof r=="function"?r(s):r}function fd(s){var r=fn();return xp(r,Lt,s)}function xp(s,r,o){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var p=s.baseQueue,g=d.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}r.baseQueue=p=g,d.pending=null}if(g=s.baseState,p===null)s.memoizedState=g;else{r=p.next;var T=w=null,$=null,J=r,le=!1;do{var pe=J.lane&-536870913;if(pe!==J.lane?(ht&pe)===pe:(Zi&pe)===pe){var W=J.revertLane;if(W===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),pe===Ra&&(le=!0);else if((Zi&W)===W){J=J.next,W===Ra&&(le=!0);continue}else pe={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},$===null?(T=$=pe,w=g):$=$.next=pe,et.lanes|=W,Hr|=W;pe=J.action,$a&&o(g,pe),g=J.hasEagerState?J.eagerState:o(g,pe)}else W={lane:pe,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},$===null?(T=$=W,w=g):$=$.next=W,et.lanes|=pe,Hr|=pe;J=J.next}while(J!==null&&J!==r);if($===null?w=g:$.next=T,!Ss(g,s.memoizedState)&&(xn=!0,le&&(o=Sl,o!==null)))throw o;s.memoizedState=g,s.baseState=w,s.baseQueue=$,d.lastRenderedState=g}return p===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function vp(s){var r=fn(),o=r.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=s;var d=o.dispatch,p=o.pending,g=r.memoizedState;if(p!==null){o.pending=null;var w=p=p.next;do g=s(g,w.action),w=w.next;while(w!==p);Ss(g,r.memoizedState)||(xn=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),o.lastRenderedState=g}return[g,d]}function i1(s,r,o){var d=et,p=fn(),g=lt;if(g){if(o===void 0)throw Error(i(407));o=o()}else o=r();var w=!Ss((Lt||p).memoizedState,o);if(w&&(p.memoizedState=o,xn=!0),p=p.queue,_p(l1.bind(null,d,p,s),[s]),s=p.getSnapshot!==r||w||gn!==null&&(gn.memoizedState.tag&1)!==0,El(s?9:8,{destroy:void 0},a1.bind(null,d,p,o,r),null),s){if(d.flags|=2048,$t===null)throw Error(i(349));g||(Zi&127)!==0||r1(d,r,o)}return o}function r1(s,r,o){s.flags|=16384,s={getSnapshot:r,value:o},r=et.updateQueue,r===null?(r=ud(),et.updateQueue=r,r.stores=[s]):(o=r.stores,o===null?r.stores=[s]:o.push(s))}function a1(s,r,o,d){r.value=o,r.getSnapshot=d,o1(r)&&c1(s)}function l1(s,r,o){return o(function(){o1(r)&&c1(s)})}function o1(s){var r=s.getSnapshot;s=s.value;try{var o=r();return!Ss(s,o)}catch{return!0}}function c1(s){var r=Na(s,2);r!==null&&hs(r,s,2)}function bp(s){var r=Wn();if(typeof s=="function"){var o=s;if(s=o(),$a){rn(!0);try{o()}finally{rn(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:s},r}function u1(s,r,o,d){return s.baseState=o,xp(s,Lt,typeof d=="function"?d:Ji)}function jC(s,r,o,d,p){if(md(s))throw Error(i(485));if(s=r.action,s!==null){var g={payload:p,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){g.listeners.push(w)}};Ee.T!==null?o(!0):g.isTransition=!1,d(g),o=r.pending,o===null?(g.next=r.pending=g,d1(r,g)):(g.next=o.next,r.pending=o.next=g)}}function d1(s,r){var o=r.action,d=r.payload,p=s.state;if(r.isTransition){var g=Ee.T,w={};w.types=g!==null?g.types:null,Ee.T=w;try{var T=o(p,d),$=Ee.S;$!==null&&$(w,T),f1(s,r,T)}catch(J){yp(s,r,J)}finally{g!==null&&w.types!==null&&(g.types=w.types),Ee.T=g}}else try{g=o(p,d),f1(s,r,g)}catch(J){yp(s,r,J)}}function f1(s,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){h1(s,r,d)},function(d){return yp(s,r,d)}):h1(s,r,o)}function h1(s,r,o){r.status="fulfilled",r.value=o,p1(r),s.state=o,r=s.pending,r!==null&&(o=r.next,o===r?s.pending=null:(o=o.next,r.next=o,d1(s,o)))}function yp(s,r,o){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=o,p1(r),r=r.next;while(r!==d)}s.action=null}function p1(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function m1(s,r){return r}function g1(s,r){if(lt){var o=$t.formState;if(o!==null){e:{var d=et;if(lt){if(Ht){t:{for(var p=Ht,g=Bs;p.nodeType!==8;){if(!g){p=null;break t}if(p=Us(p.nextSibling),p===null){p=null;break t}}g=p.data,p=g==="F!"||g==="F"?p:null}if(p){Ht=Us(p.nextSibling),d=p.data==="F!";break e}}Ar(d)}d=!1}d&&(r=o[0])}}return o=Wn(),o.memoizedState=o.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:m1,lastRenderedState:r},o.queue=d,o=D1.bind(null,et,d),d.dispatch=o,d=bp(!1),g=Np.bind(null,et,!1,d.queue),d=Wn(),p={state:r,dispatch:null,action:s,pending:null},d.queue=p,o=jC.bind(null,et,p,g,o),p.dispatch=o,d.memoizedState=s,[r,o,!1]}function x1(s){var r=fn();return v1(r,Lt,s)}function v1(s,r,o){if(r=xp(s,r,m1)[0],s=fd(Ji)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=ic(r)}catch(w){throw w===kl?nd:w}else d=r;r=fn();var p=r.queue,g=p.dispatch;return o!==r.memoizedState&&(et.flags|=2048,El(9,{destroy:void 0},NC.bind(null,p,o),null)),[d,g,s]}function NC(s,r){s.action=r}function b1(s){var r=fn(),o=Lt;if(o!==null)return v1(r,o,s);fn(),r=r.memoizedState,o=fn();var d=o.queue.dispatch;return o.memoizedState=s,[r,d,!1]}function El(s,r,o,d){return s={tag:s,create:o,deps:d,inst:r,next:null},r=et.updateQueue,r===null&&(r=ud(),et.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=s.next=s:(d=o.next,o.next=s,s.next=d,r.lastEffect=s),s}function y1(){return fn().memoizedState}function hd(s,r,o,d){var p=Wn();et.flags|=s,p.memoizedState=El(1|r,{destroy:void 0},o,d===void 0?null:d)}function pd(s,r,o,d){var p=fn();d=d===void 0?null:d;var g=p.memoizedState.inst;Lt!==null&&d!==null&&dp(d,Lt.memoizedState.deps)?p.memoizedState=El(r,g,o,d):(et.flags|=s,p.memoizedState=El(1|r,g,o,d))}function _1(s,r){hd(8390656,8,s,r)}function _p(s,r){pd(2048,8,s,r)}function CC(s){et.flags|=4;var r=et.updateQueue;if(r===null)r=ud(),et.updateQueue=r,r.events=[s];else{var o=r.events;o===null?r.events=[s]:o.push(s)}}function w1(s){var r=fn().memoizedState;return CC({ref:r,nextImpl:s}),function(){if((Et&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function S1(s,r){return pd(4,2,s,r)}function k1(s,r){return pd(4,4,s,r)}function j1(s,r){if(typeof r=="function"){s=s();var o=r(s);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function N1(s,r,o){o=o!=null?o.concat([s]):null,pd(4,4,j1.bind(null,r,s),o)}function wp(){}function C1(s,r){var o=fn();r=r===void 0?null:r;var d=o.memoizedState;return r!==null&&dp(r,d[1])?d[0]:(o.memoizedState=[s,r],s)}function E1(s,r){var o=fn();r=r===void 0?null:r;var d=o.memoizedState;if(r!==null&&dp(r,d[1]))return d[0];if(d=s(),$a){rn(!0);try{s()}finally{rn(!1)}}return o.memoizedState=[d,r],d}function Sp(s,r,o){return o===void 0||(Zi&1073741824)!==0&&(ht&261930)===0?s.memoizedState=r:(s.memoizedState=o,s=Bb(),et.lanes|=s,Hr|=s,o)}function T1(s,r,o,d){return Ss(o,r)?o:$r.current!==null?(s=Sp(s,o,d),Ss(s,r)||(xn=!0),s):(Zi&106)===0||(Zi&1073741824)!==0&&(ht&261930)===0?(xn=!0,s.memoizedState=o):(s=Bb(),et.lanes|=s,Hr|=s,r)}function M1(s,r,o,d,p){var g=Re.p;Re.p=g!==0&&8>g?g:8;var w=Ee.T,T={};T.types=w!==null?w.types:null,Ee.T=T,Np(s,!1,r,o);try{var $=p(),J=Ee.S;if(J!==null&&J(T,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var le=wC($,d);rc(s,r,le,Es(s))}else rc(s,r,d,Es(s))}catch(pe){rc(s,r,{then:function(){},status:"rejected",reason:pe},Es())}finally{Re.p=g,w!==null&&T.types!==null&&(w.types=T.types),Ee.T=w}}function EC(){}function kp(s,r,o,d){if(s.tag!==5)throw Error(i(476));var p=A1(s).queue;M1(s,p,r,Ut,o===null?EC:function(){return R1(s),o(d)})}function A1(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:Ut,baseState:Ut,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:Ut},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:o},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function R1(s){var r=A1(s);r.next===null&&(r=s.alternate.memoizedState),rc(s,r.next.queue,{},Es())}function jp(){return On(Yl)}function O1(){return fn().memoizedState}function L1(){return fn().memoizedState}function TC(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var o=Es();s=Dr(o);var d=zr(r,s,o);d!==null&&(hs(d,r,o),Jo(d,r,o)),r={cache:Jh()},s.payload=r;return}r=r.return}}function MC(s,r,o){var d=Es();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},md(s)?z1(r,o):(o=qh(s,r,o,d),o!==null&&(hs(o,s,d),$1(o,r,d)))}function D1(s,r,o){var d=Es();rc(s,r,o,d)}function rc(s,r,o,d){var p={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(md(s))z1(r,p);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var w=r.lastRenderedState,T=g(w,o);if(p.hasEagerState=!0,p.eagerState=T,Ss(T,w))return Gu(s,r,p,0),$t===null&&Vu(),!1}catch{}finally{}if(o=qh(s,r,p,d),o!==null)return hs(o,s,d),$1(o,r,d),!0}return!1}function Np(s,r,o,d){if(d={lane:2,revertLane:gm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},md(s)){if(r)throw Error(i(479))}else r=qh(s,o,d,2),r!==null&&hs(r,s,2)}function md(s){var r=s.alternate;return s===et||r!==null&&r===et}function z1(s,r){Nl=od=!0;var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}function $1(s,r,o){if((o&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,o|=d,r.lanes=o,Eo(s,o)}}var gd={readContext:On,use:dd,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on,useEffectEvent:on},B1={readContext:On,use:dd,useCallback:function(s,r){return Wn().memoizedState=[s,r===void 0?null:r],s},useContext:On,useEffect:_1,useImperativeHandle:function(s,r,o){o=o!=null?o.concat([s]):null,hd(4194308,4,j1.bind(null,r,s),o)},useLayoutEffect:function(s,r){return hd(4194308,4,s,r)},useInsertionEffect:function(s,r){hd(4,2,s,r)},useMemo:function(s,r){var o=Wn();r=r===void 0?null:r;var d=s();if($a){rn(!0);try{s()}finally{rn(!1)}}return o.memoizedState=[d,r],d},useReducer:function(s,r,o){var d=Wn();if(o!==void 0){var p=o(r);if($a){rn(!0);try{o(r)}finally{rn(!1)}}}else p=r;return d.memoizedState=d.baseState=p,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:p},d.queue=s,s=s.dispatch=MC.bind(null,et,s),[d.memoizedState,s]},useRef:function(s){var r=Wn();return s={current:s},r.memoizedState=s},useState:function(s){s=bp(s);var r=s.queue,o=D1.bind(null,et,r);return r.dispatch=o,[s.memoizedState,o]},useDebugValue:wp,useDeferredValue:function(s,r){var o=Wn();return Sp(o,s,r)},useTransition:function(){var s=bp(!1);return s=M1.bind(null,et,s.queue,!0,!1),Wn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,o){var d=et,p=Wn();if(lt){if(o===void 0)throw Error(i(407));o=o()}else{if(o=r(),$t===null)throw Error(i(349));(ht&127)!==0||r1(d,r,o)}p.memoizedState=o;var g={value:o,getSnapshot:r};return p.queue=g,_1(l1.bind(null,d,g,s),[s]),d.flags|=2048,El(9,{destroy:void 0},a1.bind(null,d,g,o,r),null),o},useId:function(){var s=Wn(),r=$t.identifierPrefix;if(lt){var o=xi,d=gi;o=(d&~(1<<32-en(d)-1)).toString(32)+o,r="_"+r+"R_"+o,o=cd++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=SC++,r="_"+r+"r_"+o.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:jp,useFormState:g1,useActionState:g1,useOptimistic:function(s){var r=Wn();r.memoizedState=r.baseState=s;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=Np.bind(null,et,!0,o),o.dispatch=r,[s,r]},useMemoCache:gp,useCacheRefresh:function(){return Wn().memoizedState=TC.bind(null,et)},useEffectEvent:function(s){var r=Wn(),o={impl:s};return r.memoizedState=o,function(){if((Et&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},P1={readContext:On,use:dd,useCallback:C1,useContext:On,useEffect:_p,useImperativeHandle:N1,useInsertionEffect:S1,useLayoutEffect:k1,useMemo:E1,useReducer:fd,useRef:y1,useState:function(){return fd(Ji)},useDebugValue:wp,useDeferredValue:function(s,r){var o=fn();return T1(o,Lt.memoizedState,s,r)},useTransition:function(){var s=fd(Ji)[0],r=fn().memoizedState;return[typeof s=="boolean"?s:ic(s),r]},useSyncExternalStore:i1,useId:O1,useHostTransitionStatus:jp,useFormState:x1,useActionState:x1,useOptimistic:function(s,r){var o=fn();return u1(o,Lt,s,r)},useMemoCache:gp,useCacheRefresh:L1,useEffectEvent:w1},AC={readContext:On,use:dd,useCallback:C1,useContext:On,useEffect:_p,useImperativeHandle:N1,useInsertionEffect:S1,useLayoutEffect:k1,useMemo:E1,useReducer:vp,useRef:y1,useState:function(){return vp(Ji)},useDebugValue:wp,useDeferredValue:function(s,r){var o=fn();return Lt===null?Sp(o,s,r):T1(o,Lt.memoizedState,s,r)},useTransition:function(){var s=vp(Ji)[0],r=fn().memoizedState;return[typeof s=="boolean"?s:ic(s),r]},useSyncExternalStore:i1,useId:O1,useHostTransitionStatus:jp,useFormState:b1,useActionState:b1,useOptimistic:function(s,r){var o=fn();return Lt!==null?u1(o,Lt,s,r):(o.baseState=s,[s,o.queue.dispatch])},useMemoCache:gp,useCacheRefresh:L1,useEffectEvent:w1};function Cp(s,r,o,d){r=s.memoizedState,o=o(d,r),o=o==null?r:F({},r,o),s.memoizedState=o,s.lanes===0&&(s.updateQueue.baseState=o)}var Ep={enqueueSetState:function(s,r,o){s=s._reactInternals;var d=Es(),p=Dr(d);p.payload=r,o!=null&&(p.callback=o),r=zr(s,p,d),r!==null&&(hs(r,s,d),Jo(r,s,d))},enqueueReplaceState:function(s,r,o){s=s._reactInternals;var d=Es(),p=Dr(d);p.tag=1,p.payload=r,o!=null&&(p.callback=o),r=zr(s,p,d),r!==null&&(hs(r,s,d),Jo(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var o=Es(),d=Dr(o);d.tag=2,r!=null&&(d.callback=r),r=zr(s,d,o),r!==null&&(hs(r,s,o),Jo(r,s,o))}};function U1(s,r,o,d,p,g,w){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,g,w):r.prototype&&r.prototype.isPureReactComponent?!Vo(o,d)||!Vo(p,g):!0}function F1(s,r,o,d){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,d),r.state!==s&&Ep.enqueueReplaceState(r,r.state,null)}function Ba(s,r){var o=r;if("ref"in r){o={};for(var d in r)d!=="ref"&&(o[d]=r[d])}if(s=s.defaultProps){o===r&&(o=F({},o));for(var p in s)o[p]===void 0&&(o[p]=s[p])}return o}function I1(s){qu(s)}function H1(s){console.error(s)}function q1(s){qu(s)}function xd(s,r){try{var o=s.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function V1(s,r,o){try{var d=s.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Tp(s,r,o){return o=Dr(o),o.tag=3,o.payload={element:null},o.callback=function(){xd(s,r)},o}function G1(s){return s=Dr(s),s.tag=3,s}function Y1(s,r,o,d){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var g=d.value;s.payload=function(){return p(g)},s.callback=function(){V1(r,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(s.callback=function(){V1(r,o,d),typeof p!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function RC(s,r,o,d,p){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(r=o.alternate,r!==null&&Ma(r,o,p,!0),o=Ln.current,o!==null){switch(o.tag){case 31:case 13:case 19:return Hn===null?Bd():o.alternate===null&&cn===0&&(cn=3),o.flags&=-257,o.flags|=65536,o.lanes=p,d===sd?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([d]):r.add(d),hm(s,d,p)),!1;case 22:return o.flags|=65536,d===sd?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([d]):o.add(d)),hm(s,d,p)),!1}throw Error(i(435,o.tag))}return hm(s,d,p),Bd(),!1}if(lt)return r=Ln.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,d!==Qh&&(s=Error(i(422),{cause:d}),Xo(Ds(s,o)))):(d!==Qh&&(r=Error(i(423),{cause:d}),Xo(Ds(r,o))),s=s.current.alternate,s.flags|=65536,p&=-p,s.lanes|=p,d=Ds(d,o),p=Tp(s.stateNode,d,p),rp(s,p),cn!==4&&(cn=2)),!1;var g=Error(i(520),{cause:d});if(g=Ds(g,o),hc===null?hc=[g]:hc.push(g),cn!==4&&(cn=2),r===null)return!0;d=Ds(d,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,s=p&-p,o.lanes|=s,s=Tp(o.stateNode,d,s),rp(o,s),!1;case 1:if(r=o.type,g=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(qr===null||!qr.has(g))))return o.flags|=65536,p&=-p,o.lanes|=p,p=G1(p),Y1(p,s,o,d),rp(o,p),!1;break;case 22:if(o.memoizedState!==null)return o.flags|=65536,!1}o=o.return}while(o!==null);return!1}var Mp=Error(i(461)),xn=!1;function kn(s,r,o,d){r.child=s===null?Wv(r,null,o,d):za(r,s.child,o,d)}function X1(s,r,o,d,p){o=o.render;var g=r.ref;if("ref"in d){var w={};for(var T in d)T!=="ref"&&(w[T]=d[T])}else w=d;return Aa(r),d=fp(s,r,o,w,g,p),T=hp(),s!==null&&!xn?(pp(s,r,p),er(s,r,p)):(lt&&T&&Ku(r),r.flags|=1,kn(s,r,d,p),r.child)}function Q1(s,r,o,d,p){if(s===null){var g=o.type;return typeof g=="function"&&!Vh(g)&&g.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=g,K1(s,r,g,d,p)):(s=Xu(o.type,null,d,r,r.mode,p),s.ref=r.ref,s.return=r,r.child=s)}if(g=s.child,!Bp(s,p)){var w=g.memoizedProps;if(o=o.compare,o=o!==null?o:Vo,o(w,d)&&s.ref===r.ref)return er(s,r,p)}return r.flags|=1,s=Xi(g,d),s.ref=r.ref,s.return=r,r.child=s}function K1(s,r,o,d,p){if(s!==null){var g=s.memoizedProps;if(Vo(g,d)&&s.ref===r.ref)if(xn=!1,r.pendingProps=d=g,Bp(s,p))(s.flags&131072)!==0&&(xn=!0);else return r.lanes=s.lanes,er(s,r,p)}return Ap(s,r,o,d,p)}function W1(s,r,o,d){var p=d.children,g=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((r.flags&128)!==0){if(g=g!==null?g.baseLanes|o:o,s!==null){for(d=r.child=s.child,p=0;d!==null;)p=p|d.lanes|d.childLanes,d=d.sibling;d=p&~g}else d=0,r.child=null;return Z1(s,r,g,o,d)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&td(r,g!==null?g.cachePool:null),g!==null?e1(r,g):lp(),t1(r);else return d=r.lanes=536870912,Z1(s,r,g!==null?g.baseLanes|o:o,o,d)}else g!==null?(td(r,g.cachePool),e1(r,g),Pr(),r.memoizedState=null):(s!==null&&td(r,null),lp(),Pr());return kn(s,r,p,o),r.child}function ac(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Z1(s,r,o,d,p){var g=tp();return g=g===null?null:{parent:mn._currentValue,pool:g},r.memoizedState={baseLanes:o,cachePool:g},s!==null&&td(r,null),lp(),t1(r),s!==null&&Ma(s,r,d,!0),r.childLanes=p,null}function vd(s,r){return r=bd({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function J1(s,r,o){return za(r,s.child,null,o),s=vd(r,r.pendingProps),s.flags|=2,ks(r),r.memoizedState=null,s}function OC(s,r,o){var d=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(lt){if(d.mode==="hidden")return s=vd(r,d),r.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},ac(null,s);if(cp(r),(s=Ht)?(s=jy(s,Bs),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Tr!==null?{id:gi,overflow:xi}:null,retryLane:536870912,hydrationErrors:null},o=zv(s),o.return=r,r.child=o,En=r,Ht=null)):s=null,s===null)throw Ar(r);return r.lanes=536870912,null}return vd(r,d)}var g=s.memoizedState;if(g!==null){var w=g.dehydrated;if(cp(r),p)if(r.flags&256)r.flags&=-257,r=J1(s,r,o);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(xn||Ma(s,r,o,!1),p=(o&s.childLanes)!==0,xn||p){if($r.current===null){if(d=$t,d!==null&&(w=di(d,o),w!==0&&w!==g.retryLane))throw g.retryLane=w,Na(s,w),hs(d,s,w),Mp;Bd()}r=J1(s,r,o)}else s=g.treeContext,Ht=Us(w.nextSibling),En=r,lt=!0,Mr=null,Bs=!1,s!==null&&Pv(r,s),r=vd(r,d),r.flags|=134221824;return r}return s=Xi(s.child,{mode:d.mode,children:d.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Tl(s,r){var o=r.ref;if(o===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(s===null||s.ref!==o)&&(r.flags|=4194816)}}function Ap(s,r,o,d,p){return Aa(r),o=fp(s,r,o,d,void 0,p),d=hp(),s!==null&&!xn?(pp(s,r,p),er(s,r,p)):(lt&&d&&Ku(r),r.flags|=1,kn(s,r,o,p),r.child)}function eb(s,r,o,d,p,g){return Aa(r),r.updateQueue=null,o=s1(r,d,o,p),n1(s),d=hp(),s!==null&&!xn?(pp(s,r,g),er(s,r,g)):(lt&&d&&Ku(r),r.flags|=1,kn(s,r,o,g),r.child)}function tb(s,r,o,d,p){if(Aa(r),r.stateNode===null){var g=bl,w=o.contextType;typeof w=="object"&&w!==null&&(g=On(w)),g=new o(d,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Ep,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=d,g.state=r.memoizedState,g.refs={},sp(r),w=o.contextType,g.context=typeof w=="object"&&w!==null?On(w):bl,g.state=r.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(Cp(r,o,w,d),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(w=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),w!==g.state&&Ep.enqueueReplaceState(g,g.state,null),tc(r,d,g,p),ec(),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308),d=!0}else if(s===null){g=r.stateNode;var T=r.memoizedProps,$=Ba(o,T);g.props=$;var J=g.context,le=o.contextType;w=bl,typeof le=="object"&&le!==null&&(w=On(le));var pe=o.getDerivedStateFromProps;le=typeof pe=="function"||typeof g.getSnapshotBeforeUpdate=="function",T=r.pendingProps!==T,le||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(T||J!==w)&&F1(r,g,d,w),Lr=!1;var W=r.memoizedState;g.state=W,tc(r,d,g,p),ec(),J=r.memoizedState,T||W!==J||Lr?(typeof pe=="function"&&(Cp(r,o,pe,d),J=r.memoizedState),($=Lr||U1(r,o,$,d,W,J,w))?(le||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(r.flags|=4194308)):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=J),g.props=d,g.state=J,g.context=w,d=$):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{g=r.stateNode,ip(s,r),w=r.memoizedProps,le=Ba(o,w),g.props=le,pe=r.pendingProps,W=g.context,J=o.contextType,$=bl,typeof J=="object"&&J!==null&&($=On(J)),T=o.getDerivedStateFromProps,(J=typeof T=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(w!==pe||W!==$)&&F1(r,g,d,$),Lr=!1,W=r.memoizedState,g.state=W,tc(r,d,g,p),ec();var ie=r.memoizedState;w!==pe||W!==ie||Lr||s!==null&&s.dependencies!==null&&Ju(s.dependencies)?(typeof T=="function"&&(Cp(r,o,T,d),ie=r.memoizedState),(le=Lr||U1(r,o,le,d,W,ie,$)||s!==null&&s.dependencies!==null&&Ju(s.dependencies))?(J||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(d,ie,$),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(d,ie,$)),typeof g.componentDidUpdate=="function"&&(r.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof g.componentDidUpdate!="function"||w===s.memoizedProps&&W===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&W===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=ie),g.props=d,g.state=ie,g.context=$,d=le):(typeof g.componentDidUpdate!="function"||w===s.memoizedProps&&W===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&W===s.memoizedState||(r.flags|=1024),d=!1)}return g=d,Tl(s,r),d=(r.flags&128)!==0,g||d?(g=r.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:g.render(),r.flags|=1,s!==null&&d?(r.child=za(r,s.child,null,p),r.child=za(r,null,o,p)):kn(s,r,o,p),r.memoizedState=g.state,s=r.child):s=er(s,r,p),s}function nb(s,r,o,d){return Ea(),r.flags|=256,kn(s,r,o,d),r.child}var Rp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Op(s){return{baseLanes:s,cachePool:Vv()}}function Lp(s,r,o){return s=s!==null?s.childLanes&~o:0,r&&(s|=Cs),s}function sb(s,r,o){var d=r.pendingProps,p=!1,g=(r.flags&128)!==0,w;if((w=g)||(w=s!==null&&s.memoizedState===null?!1:(Dn.current&2)!==0),w&&(p=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,s===null){if(lt){if(p?Br(r):Pr(),(s=Ht)?(s=jy(s,Bs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Tr!==null?{id:gi,overflow:xi}:null,retryLane:536870912,hydrationErrors:null},o=zv(s),o.return=r,r.child=o,En=r,Ht=null)):s=null,s===null)throw Ar(r);return Om(s)?r.lanes=32:r.lanes=536870912,null}return g=d.children,d=d.fallback,p?(Pr(),p=r.mode,g=bd({mode:"hidden",children:g},p),d=Ca(d,p,o,null),g.return=r,d.return=r,g.sibling=d,r.child=g,d=r.child,d.memoizedState=Op(o),d.childLanes=Lp(s,w,o),r.memoizedState=Rp,ac(null,d)):(Br(r),Dp(r,g))}var T=s.memoizedState;if(T!==null){var $=T.dehydrated;if($!==null)return LC(s,r,g,w,d,$,T,o)}return p?(Pr(),p=d.fallback,g=r.mode,T=s.child,$=T.sibling,d=Xi(T,{mode:"hidden",children:d.children}),d.subtreeFlags=T.subtreeFlags&1206910976,$!==null?p=Xi($,p):(p=Ca(p,g,o,null),p.flags|=2),p.return=r,d.return=r,d.sibling=p,r.child=d,ac(null,d),d=r.child,p=s.child.memoizedState,p===null?p=Op(o):(g=p.cachePool,g!==null?(T=mn._currentValue,g=g.parent!==T?{parent:T,pool:T}:g):g=Vv(),p={baseLanes:p.baseLanes|o,cachePool:g}),d.memoizedState=p,d.childLanes=Lp(s,w,o),r.memoizedState=Rp,ac(s.child,d)):(Br(r),o=s.child,s=o.sibling,o=Xi(o,{mode:"visible",children:d.children}),o.return=r,o.sibling=null,s!==null&&(w=r.deletions,w===null?(r.deletions=[s],r.flags|=16):w.push(s)),r.child=o,r.memoizedState=null,o)}function Dp(s,r){return r=bd({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function bd(s,r){return s=cs(22,s,null,r),s.lanes=0,s}function yd(s,r,o){return za(r,s.child,null,o),s=Dp(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function LC(s,r,o,d,p,g,w,T){if(o)return r.flags&256?(Br(r),r.flags&=-257,yd(s,r,T)):r.memoizedState!==null?(Pr(),r.child=s.child,r.flags|=128,null):(Pr(),g=p.fallback,w=r.mode,p=bd({mode:"visible",children:p.children},w),g=Ca(g,w,T,null),g.flags|=2,p.return=r,g.return=r,p.sibling=g,r.child=p,za(r,s.child,null,T),p=r.child,p.memoizedState=Op(T),p.childLanes=Lp(s,d,T),r.memoizedState=Rp,ac(null,p));if(Br(r),Om(g)){if(d=g.nextSibling&&g.nextSibling.dataset,d)var $=d.dgst;return d=$,d!==""&&(p=Error(i(419)),p.stack="",p.digest=d,Xo({value:p,source:null,stack:null})),yd(s,r,T)}if(xn||Ma(s,r,T,!1),d=(T&s.childLanes)!==0,xn||d){if($r.current!==null)return yd(s,r,T);if(d=$t,d!==null&&(p=di(d,T),p!==0&&p!==w.retryLane))throw w.retryLane=p,Na(s,p),hs(d,s,p),Mp;return Rm(g)||Bd(),yd(s,r,T)}return Rm(g)?(r.flags|=192,r.child=s.child,null):(s=w.treeContext,Ht=Us(g.nextSibling),En=r,lt=!0,Mr=null,Bs=!1,s!==null&&Pv(r,s),r=Dp(r,p.children),r.flags|=134221824,r)}function ib(s,r,o){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),Zu(s.return,r,o)}function rb(s){for(var r=null;s!==null;){var o=s.alternate;o!==null&&ld(o)===null&&(r=s),s=s.sibling}return r}function _d(s,r,o,d,p,g){var w=s.memoizedState;w===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:p,treeForkCount:g}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=p,w.treeForkCount=g)}function zp(s){var r=s.child;for(s.child=null;r!==null;){var o=r.sibling;r.sibling=s.child,s.child=r,r=o}}function $p(s,r,o){var d=r.pendingProps,p=d.revealOrder,g=d.tail;d=d.children;var w=Dn.current;if(r.flags&128)return nc(r,w),null;var T=(w&2)!==0;if(T?(w=w&1|2,r.flags|=128):w&=1,nc(r,w),p==="backwards"&&s!==null?(zp(s),kn(s,r,d,o),zp(s)):kn(s,r,d,o),d=lt?Yo:0,!T&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&ib(s,o,r);else if(s.tag===19)ib(s,o,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(p){case"backwards":o=rb(r.child),o===null?(p=r.child,r.child=null):(p=o.sibling,o.sibling=null,zp(r)),_d(r,!0,p,null,g,d);break;case"unstable_legacy-backwards":for(o=null,p=r.child,r.child=null;p!==null;){if(s=p.alternate,s!==null&&ld(s)===null){r.child=p;break}s=p.sibling,p.sibling=o,o=p,p=s}_d(r,!0,o,null,g,d);break;case"together":_d(r,!1,null,null,void 0,d);break;case"independent":r.memoizedState=null;break;default:o=rb(r.child),o===null?(p=r.child,r.child=null):(p=o.sibling,o.sibling=null),_d(r,!1,p,o,g,d)}return r.child}function ab(s,r,o){var d=r.pendingProps;return Rr(r,r.type,d.value),kn(s,r,d.children,o),r.child}function er(s,r,o){if(s!==null&&(r.dependencies=s.dependencies),Hr|=r.lanes,(o&r.childLanes)===0)if(s!==null){if(Ma(s,r,o,!1),(o&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,o=Xi(s,s.pendingProps),r.child=o,o.return=r;s.sibling!==null;)s=s.sibling,o=o.sibling=Xi(s,s.pendingProps),o.return=r;o.sibling=null}return r.child}function Bp(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Ju(s)))}function DC(s,r,o){switch(r.tag){case 3:Ye(r,r.stateNode.containerInfo),Rr(r,mn,s.memoizedState.cache),Ea();break;case 27:case 5:un(r);break;case 4:Ye(r,r.stateNode.containerInfo);break;case 10:Rr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,cp(r),null;break;case 13:var d=r.memoizedState;if(d!==null){if(d.dehydrated!==null)return Br(r),r.flags|=128,null;d=Ma(s,r,o,!1);var p=r.child.childLanes;return d||(o&p)!==0?sb(s,r,o):(Br(r),s=er(s,r,o),s!==null?s.sibling:null)}Br(r);break;case 19:if(r.flags&128)return $p(s,r,o);if(p=(s.flags&128)!==0,d=(o&r.childLanes)!==0,d||(Ma(s,r,o,!1),d=(o&r.childLanes)!==0),p){if(d)return $p(s,r,o);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),nc(r,Dn.current),d)break;return null;case 22:return r.lanes=0,W1(s,r,o,r.pendingProps);case 24:Rr(r,mn,s.memoizedState.cache)}return er(s,r,o)}function lb(s,r,o){if(s!==null)if(s.memoizedProps!==r.pendingProps)xn=!0;else{if(!Bp(s,o)&&(r.flags&128)===0)return xn=!1,DC(s,r,o);xn=(s.flags&131072)!==0}else xn=!1,lt&&(r.flags&1048576)!==0&&Bv(r,Yo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var d=r.pendingProps;if(s=La(r.elementType),r.type=s,typeof s=="function")Vh(s)?(d=Ba(s,d),r.tag=1,r=tb(null,r,s,d,o)):(r.tag=0,r=Ap(null,r,s,d,o));else{if(s!=null){var p=s.$$typeof;if(p===G){r.tag=11,r=X1(null,r,s,d,o);break e}else if(p===ae){r.tag=14,r=Q1(null,r,s,d,o);break e}else if(p===K){r.tag=10,r.type=s,r=ab(null,r,o);break e}}throw r=Le(s)||s,Error(i(306,r,""))}}return r;case 0:return Ap(s,r,r.type,r.pendingProps,o);case 1:return d=r.type,p=Ba(d,r.pendingProps),tb(s,r,d,p,o);case 3:e:{if(Ye(r,r.stateNode.containerInfo),s===null)throw Error(i(387));d=r.pendingProps;var g=r.memoizedState;p=g.element,ip(s,r),tc(r,d,null,o);var w=r.memoizedState;if(d=w.cache,Rr(r,mn,d),d!==g.cache&&Zh(r,[mn],o,!0),ec(),d=w.element,g.isDehydrated)if(g={element:d,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=nb(s,r,d,o);break e}else if(d!==p){p=Ds(Error(i(424)),r),Xo(p),r=nb(s,r,d,o);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Ht=Us(s.firstChild),En=r,lt=!0,Mr=null,Bs=!0,o=Wv(r,null,d,o),r.child=o;o;)o.flags=o.flags&-3|134221824,o=o.sibling}else{if(Ea(),d===p){r=er(s,r,o);break e}kn(s,r,d,o)}r=r.child}return r;case 26:return Tl(s,r),s===null?(o=Ry(r.type,null,r.pendingProps,null))?r.memoizedState=o:lt||(r.stateNode=dy(r.type,r.pendingProps,ne.current,r)):r.memoizedState=Ry(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return un(r),s===null&<&&(d=r.stateNode=Ey(r.type,r.pendingProps,ne.current),En=r,Bs=!0,p=Ht,Yr(r.type)?(Lm=p,Ht=Us(d.firstChild)):Ht=p),kn(s,r,r.pendingProps.children,o),Tl(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&<&&((p=d=Ht)&&(d=T3(d,r.type,r.pendingProps,Bs),d!==null?(r.stateNode=d,En=r,Ht=Us(d.firstChild),Bs=!1,p=!0):p=!1),p||Ar(r)),un(r),p=r.type,g=r.pendingProps,w=s!==null?s.memoizedProps:null,d=g.children,jm(p,g)?d=null:w!==null&&jm(p,w)&&(r.flags|=32),r.memoizedState!==null&&(p=fp(s,r,kC,null,null,o),Yl._currentValue=p),Tl(s,r),kn(s,r,d,o),r.child;case 6:return s===null&<&&((s=o=Ht)&&(o=M3(o,r.pendingProps,Bs),o!==null?(r.stateNode=o,En=r,Ht=null,s=!0):s=!1),s||Ar(r)),null;case 13:return sb(s,r,o);case 4:return Ye(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=za(r,null,d,o):kn(s,r,d,o),r.child;case 11:return X1(s,r,r.type,r.pendingProps,o);case 7:return d=r.pendingProps,Tl(s,r),kn(s,r,d,o),r.child;case 8:return kn(s,r,r.pendingProps.children,o),r.child;case 12:return kn(s,r,r.pendingProps.children,o),r.child;case 10:return ab(s,r,o);case 9:return p=r.type._context,d=r.pendingProps.children,Aa(r),p=On(p),d=d(p),r.flags|=1,kn(s,r,d,o),r.child;case 14:return Q1(s,r,r.type,r.pendingProps,o);case 15:return K1(s,r,r.type,r.pendingProps,o);case 19:return $p(s,r,o);case 31:return OC(s,r,o);case 22:return W1(s,r,o,r.pendingProps);case 24:return Aa(r),d=On(mn),s===null?(p=tp(),p===null&&(p=$t,g=Jh(),p.pooledCache=g,g.refCount++,g!==null&&(p.pooledCacheLanes|=o),p=g),r.memoizedState={parent:d,cache:p},sp(r),Rr(r,mn,p)):((s.lanes&o)!==0&&(ip(s,r),tc(r,null,null,o),ec()),p=s.memoizedState,g=r.memoizedState,p.parent!==d?(p={parent:d,cache:d},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),Rr(r,mn,d)):(d=g.cache,Rr(r,mn,d),d!==p.cache&&Zh(r,[mn],o,!0))),kn(s,r,r.pendingProps.children,o),r.child;case 30:return r.stateNode===null&&(r.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=r.pendingProps,d.name!=null&&d.name!=="auto"?r.flags|=s===null?18882560:18874368:lt&&Ku(r),s!==null&&s.memoizedProps.name!==d.name?r.flags|=4194816:Tl(s,r),kn(s,r,d.children,o),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function tr(s){s.flags|=4}function Pp(s,r,o,d,p){var g;if((g=(s.mode&32)!==0)&&(g=o===null?zy(r,d):zy(r,d)&&(d.src!==o.src||d.srcSet!==o.srcSet)),g){if(s.flags|=16777216,(p&335544128)===p)if(s.stateNode.complete)s.flags|=8192;else if(Ib())s.flags|=8192;else throw Da=sd,np}else s.flags&=-16777217}function ob(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!$y(r))if(Ib())s.flags|=8192;else throw Da=sd,np}function wd(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Ou():536870912,s.lanes|=r,Ll|=r)}function lc(s,r){if(!lt)switch(s.tailMode){case"visible":break;case"collapsed":for(var o=s.tail,d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(r=s.tail,o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s.tail=null:o.sibling=null}}function qt(s){var r=s.alternate!==null&&s.alternate.child===s.child,o=0,d=0;if(r)for(var p=s.child;p!==null;)o|=p.lanes|p.childLanes,d|=p.subtreeFlags&1206910976,d|=p.flags&1206910976,p.return=s,p=p.sibling;else for(p=s.child;p!==null;)o|=p.lanes|p.childLanes,d|=p.subtreeFlags,d|=p.flags,p.return=s,p=p.sibling;return s.subtreeFlags|=d,s.childLanes=o,r}function zC(s,r,o){var d=r.pendingProps;switch(Xh(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(r),null;case 1:return qt(r),null;case 3:return o=r.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),Wi(mn),Je(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(s===null||s.child===null)&&(wl(r)?tr(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Kh())),qt(r),null;case 26:var p=r.type,g=r.memoizedState;return s===null?(tr(r),g!==null?(qt(r),ob(r,g)):(qt(r),Pp(r,p,null,d,o))):g?g!==s.memoizedState?(tr(r),qt(r),ob(r,g)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&tr(r),qt(r),Pp(r,p,s,d,o)),null;case 27:if(ue(r),o=ne.current,p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&tr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}s=St.current,wl(r)?Uv(r):(s=Ey(p,d,o),r.stateNode=s,tr(r))}return qt(r),r.subtreeFlags&=-33554433,null;case 5:if(ue(r),p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&tr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}if(g=St.current,wl(r))Uv(r);else{var w=vc(ne.current);switch(g){case 1:g=w.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:g=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":g=w.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":g=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":g=w.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?g.multiple=!0:d.size&&(g.size=d.size);break;default:g=typeof d.is=="string"?w.createElement(p,{is:d.is}):w.createElement(p)}}g[dn]=r,g[Cn]=d;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)g.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=g;e:switch($n(g,p,d),p){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&tr(r)}}return qt(r),r.subtreeFlags&=-33554433,Pp(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,o),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&tr(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(i(166));if(s=ne.current,wl(r)){if(s=r.stateNode,o=r.memoizedProps,d=null,p=En,p!==null)switch(p.tag){case 27:case 5:d=p.memoizedProps}s[dn]=r,s=!!(s.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||ly(s.nodeValue,o)),s||Ar(r,!0)}else s=vc(s).createTextNode(d),s[dn]=r,r.stateNode=s}return qt(r),null;case 31:if(o=r.memoizedState,s===null||s.memoizedState!==null){if(d=wl(r),o!==null){if(s===null){if(!d)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[dn]=r}else Ea(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),s=!1}else o=Kh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),s=!0;if(!s)return r.flags&256?(ks(r),r):(ks(r),null);if((r.flags&128)!==0)throw Error(i(558))}return qt(r),null;case 13:if(d=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(p=wl(r),d!==null&&d.dehydrated!==null){if(s===null){if(!p)throw Error(i(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[dn]=r}else Ea(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),p=!1}else p=Kh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(ks(r),r):(ks(r),null)}return ks(r),(r.flags&128)!==0?(r.lanes=o,r):(o=d!==null,s=s!==null&&s.memoizedState!==null,o&&(d=r.child,p=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(p=d.alternate.memoizedState.cachePool.pool),g=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(g=d.memoizedState.cachePool.pool),g!==p&&(d.flags|=2048)),o!==s&&o&&(r.child.flags|=8192),wd(r,r.updateQueue),qt(r),null);case 4:return Je(),s===null&&ym(r.stateNode.containerInfo),r.flags|=67108864,qt(r),null;case 10:return Wi(r.type),qt(r),null;case 19:if(up(r),d=r.memoizedState,d===null)return qt(r),null;if(p=(r.flags&128)!==0,g=d.rendering,g===null)if(p)lc(d,!1);else{if(cn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(g=ld(s),g!==null){for(r.flags|=128,lc(d,!1),s=g.updateQueue,r.updateQueue=s,wd(r,s),r.subtreeFlags=0,s=o,o=r.child;o!==null;)Dv(o,s),o=o.sibling;return nc(r,Dn.current&1|2),lt&&Qi(r,d.treeForkCount),r.child}s=s.sibling}d.tail!==null&&sn()>Ld&&(r.flags|=128,p=!0,lc(d,!1),r.lanes=4194304)}else{if(!p)if(s=ld(g),s!==null){if(r.flags|=128,p=!0,s=s.updateQueue,r.updateQueue=s,wd(r,s),lc(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!g.alternate&&!lt)return qt(r),null}else 2*sn()-d.renderingStartTime>Ld&&o!==536870912&&(r.flags|=128,p=!0,lc(d,!1),r.lanes=4194304);d.isBackwards?(g.sibling=r.child,r.child=g):(s=d.last,s!==null?s.sibling=g:r.child=g,d.last=g)}if(d.tail!==null){s=d.tail;e:{for(o=s;o!==null;){if(o.alternate!==null){o=!1;break e}o=o.sibling}o=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=sn(),s.sibling=null,g=Dn.current,g=p?g&1|2:g&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!o||lt?nc(r,g):(o=g,Xe(Ln,r),Xe(Dn,o),Hn===null&&(Hn=r)),lt&&Qi(r,d.treeForkCount),s}return qt(r),null;case 22:case 23:return ks(r),op(),d=r.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(r.flags|=8192):d&&(r.flags|=8192),d?(o&536870912)!==0&&(r.flags&128)===0&&(qt(r),r.subtreeFlags&6&&(r.flags|=8192)):qt(r),o=r.updateQueue,o!==null&&wd(r,o.retryQueue),o=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==o&&(r.flags|=2048),s!==null&&wt(Oa),null;case 24:return o=null,s!==null&&(o=s.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),Wi(mn),qt(r),null;case 25:return null;case 30:return r.flags|=33554432,qt(r),null}throw Error(i(156,r.tag))}function $C(s,r){switch(Xh(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Wi(mn),Je(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return ue(r),null;case 31:if(r.memoizedState!==null){if(ks(r),r.alternate===null)throw Error(i(340));Ea()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(ks(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Ea()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return up(r),s=r.flags,s&65536?(r.flags=s&-65537|128,s=r.memoizedState,s!==null&&(s.rendering=null,s.tail=null),r.flags|=4,r):null;case 4:return Je(),null;case 10:return Wi(r.type),null;case 22:case 23:return ks(r),op(),s!==null&&wt(Oa),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Wi(mn),null;case 25:return null;default:return null}}function cb(s,r){switch(Xh(r),r.tag){case 3:Wi(mn),Je();break;case 26:case 27:case 5:ue(r);break;case 4:Je();break;case 31:r.memoizedState!==null&&ks(r);break;case 13:ks(r);break;case 19:up(r);break;case 10:Wi(r.type);break;case 22:case 23:ks(r),op(),s!==null&&wt(Oa);break;case 24:Wi(mn)}}function oc(s,r){try{var o=r.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var p=d.next;o=p;do{if((o.tag&s)===s){d=void 0;var g=o.create,w=o.inst;d=g(),w.destroy=d}o=o.next}while(o!==p)}}catch(T){At(r,r.return,T)}}function Ur(s,r,o){try{var d=r.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var g=p.next;d=g;do{if((d.tag&s)===s){var w=d.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,p=r;var $=o,J=T;try{J()}catch(le){At(p,$,le)}}}d=d.next}while(d!==g)}}catch(le){At(r,r.return,le)}}function ub(s){var r=s.updateQueue;if(r!==null){var o=s.stateNode;try{Jv(r,o)}catch(d){At(s,s.return,d)}}}function db(s,r,o){o.props=Ba(s.type,s.memoizedProps),o.state=s.memoizedState;try{o.componentWillUnmount()}catch(d){At(s,r,d)}}function vi(s,r){try{var o=s.ref;if(o!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var p=s.stateNode,g=Gi(s.memoizedProps,p);(p.ref===null||p.ref.name!==g)&&(p.ref=vy(g)),d=p.ref;break;case 7:if(s.stateNode===null){var w=new Ts(s);x(s.child,!1,C3,w,void 0,void 0),s.stateNode=w}d=s.stateNode;break;default:d=s.stateNode}typeof o=="function"?s.refCleanup=o(d):o.current=d}}catch(T){At(s,r,T)}}function zn(s,r){var o=s.ref,d=s.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(p){At(s,r,p)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){At(s,r,p)}else o.current=null}function Sd(s,r){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&r!==null)for(var o=0;o<r.length;o++)ky(s.stateNode,r[o])}function fb(s){for(var r=s.return;r!==null&&(Fp(r)&&ky(s.stateNode,r.stateNode),!Up(r));)r=r.return}function cc(s){for(var r=s.return;r!==null&&(Fp(r)&&E3(s.stateNode,r.stateNode),!Up(r));)r=r.return}function Up(s){return s.tag===5||s.tag===3||s.tag===27}function Fp(s){return s&&s.tag===7&&s.stateNode!==null}function Ip(s){var r=s.type,o=s.memoizedProps,d=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(p){At(s,s.return,p)}}function Hp(s,r,o){try{var d=s.stateNode;c3(d,s.type,o,r),d[Cn]=r}catch(p){At(s,s.return,p)}}function hb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Yr(s.type)||s.tag===4}function qp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||hb(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&&Yr(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 Vp(s,r,o,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(p,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(p),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=Qn)),Sd(s,d),vt=!0;else if(p!==4&&(p===27&&(Sd(s,d),d=null,Yr(s.type)&&(o=s.stateNode,r=null)),s=s.child,s!==null))for(Vp(s,r,o,d),s=s.sibling;s!==null;)Vp(s,r,o,d),s=s.sibling}function kd(s,r,o,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?o.insertBefore(p,r):o.appendChild(p),Sd(s,d),vt=!0;else if(p!==4&&(p===27&&(Sd(s,d),d=null,Yr(s.type)&&(o=s.stateNode)),s=s.child,s!==null))for(kd(s,r,o,d),s=s.sibling;s!==null;)kd(s,r,o,d),s=s.sibling}function pb(s){var r=s.stateNode,o=s.memoizedProps;try{for(var d=s.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);$n(r,d,o),r[dn]=s,r[Cn]=o}catch(g){At(s,s.return,g)}}var jd=!1,js=null;function mb(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(jd=!0)}var bi=null;function gb(){var s=bi;return bi=null,s}var us=0;function Ml(s,r,o,d,p){return us=0,xb(s.child,r,o,d,p)}function xb(s,r,o,d,p){for(var g=!1;s!==null;){if(s.tag===5){var w=s.stateNode;if(d!==null){var T=Em(w);d.push(T),T.view&&(g=!0)}else g||Em(w).view&&(g=!0);jd=!0,gy(w,us===0?r:r+"_"+us,o),us++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&p||xb(s.child,r,o,d,p)&&(g=!0));s=s.sibling}return g}function yi(s,r){for(;s!==null;)s.tag===5?xy(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&r||yi(s.child,r)),s=s.sibling}function Nd(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(Nd(s),s.tag===30&&(s.flags&18874368)!==0&&s.stateNode.paired)){var r=s.memoizedProps;if(r.name==null||r.name==="auto")throw Error(i(544));var o=r.name;r=Yi(r.default,r.share),r!=="none"&&(Ml(s,o,r,null,!1)||yi(s.child,!1))}s=s.sibling}}function Gp(s,r){if(s.tag===30){var o=s.stateNode,d=s.memoizedProps,p=Gi(d,o),g=Yi(d.default,o.paired?d.share:d.enter);g!=="none"?Ml(s,p,g,null,!1)?(Nd(s),o.paired||r||Bl(s,d.onEnter)):yi(s.child,!1):Nd(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Gp(s,r),s=s.sibling;else Nd(s)}function Yp(s){if(js!==null&&js.size!==0){var r=js;if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var o=s.memoizedProps,d=o.name;if(d!=null&&d!=="auto"){var p=r.get(d);if(p!==void 0){var g=Yi(o.default,o.share);if(g!=="none"&&(Ml(s,d,g,null,!1)?(g=s.stateNode,p.paired=g,g.paired=p,Bl(s,o.onShare)):yi(s.child,!1)),r.delete(d),r.size===0)break}}}Yp(s)}s=s.sibling}}}function Xp(s){if(s.tag===30){var r=s.memoizedProps,o=Gi(r,s.stateNode),d=js!==null?js.get(o):void 0,p=Yi(r.default,d!==void 0?r.share:r.exit);p!=="none"&&(Ml(s,o,p,null,!1)?d!==void 0?(p=s.stateNode,d.paired=p,p.paired=d,js.delete(o),Bl(s,r.onShare)):Bl(s,r.onExit):yi(s.child,!1)),js!==null&&Yp(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Xp(s),s=s.sibling;else js!==null&&Yp(s)}function vb(s){for(s=s.child;s!==null;){if(s.tag===30){var r=s.memoizedProps,o=Gi(r,s.stateNode);r=Yi(r.default,r.update),s.flags&=-5,r!=="none"&&Ml(s,o,r,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&vb(s);s=s.sibling}}function Qp(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var r=s.stateNode;r.paired!==null&&(r.paired=null,yi(s.child,!1))}Qp(s)}s=s.sibling}}function Cd(s){if(s.tag===30)s.stateNode.paired=null,yi(s.child,!1),Qp(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Cd(s),s=s.sibling;else Qp(s)}function bb(s){for(s=s.child;s!==null;)s.tag===30?yi(s.child,!1):(s.subtreeFlags&33554432)!==0&&bb(s),s=s.sibling}function Kp(s,r,o,d,p,g,w){for(var T=!1;r!==null;){if(r.tag===5){var $=r.stateNode;if(g!==null&&us<g.length){var J=g[us],le=Em($);(J.view||le.view)&&(T=!0);var pe;if(pe=(s.flags&4)===0)if(le.clip)pe=!0;else{pe=J.rect;var W=le.rect;pe=pe.y!==W.y||pe.x!==W.x||pe.height!==W.height||pe.width!==W.width}pe&&(s.flags|=4),le.abs?le=!J.abs:(J=J.rect,le=le.rect,le=J.height!==le.height||J.width!==le.width),le&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&gy($,us===0?o:o+"_"+us,p),T&&(s.flags&4)!==0||(bi===null&&(bi=[]),bi.push($,us===0?d:d+"_"+us,r.memoizedProps)),us++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&w?s.flags|=r.flags&32:Kp(s,r.child,o,d,p,g,w)&&(T=!0));r=r.sibling}return T}function yb(s,r){for(s=s.child;s!==null;){if(s.tag===30){var o=s.memoizedProps,d=s.stateNode,p=Gi(o,d),g=Yi(o.default,o.update),w;w=s.memoizedState,s.memoizedState=null,d=s;var T=s.child;us=0,p=Kp(d,T,p,p,g,w,!1),(s.flags&4)!==0&&p&&Bl(s,o.onUpdate)}else(s.subtreeFlags&33554432)!==0&&yb(s);s=s.sibling}}var Tn=!1,Tt=!1,_i=!1,Wp=!1,_b=typeof WeakSet=="function"?WeakSet:Set,Mn=null,wi=!1,uc=!1,Ed=!1,Zp=!1;function BC(s,r,o){if(s=s.containerInfo,Sm=Xl,s=jv(s),Bh(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var g=p.anchorOffset,w=p.focusNode;p=p.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var T=0,$=-1,J=-1,le=0,pe=0,W=s,ie=null;t:for(;;){for(var Me;W!==d||g!==0&&W.nodeType!==3||($=T+g),W!==w||p!==0&&W.nodeType!==3||(J=T+p),W.nodeType===3&&(T+=W.nodeValue.length),(Me=W.firstChild)!==null;)ie=W,W=Me;for(;;){if(W===s)break t;if(ie===d&&++le===g&&($=T),ie===w&&++pe===p&&(J=T),(Me=W.nextSibling)!==null)break;W=ie,ie=W.parentNode}W=Me}d=$===-1||J===-1?null:{start:$,end:J}}else d=null}d=d||{start:0,end:0}}else d=null;for(km={focusedElem:s,selectionRange:d},Xl=!1,o=(o&335544064)===o,Mn=r,r=o?9270:1024;Mn!==null;){if(s=Mn,o&&(d=s.deletions,d!==null))for(g=0;g<d.length;g++)o&&Xp(d[g]);if(s.alternate===null&&(s.flags&2)!==0)o&&mb(s),Td(o);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&o&&Xp(d),Td(o);continue}else if(d!==null&&d.memoizedState!==null){o&&mb(s),Td(o);continue}}d=s.child,(s.subtreeFlags&r)!==0&&d!==null?(d.return=s,Mn=d):(o&&vb(s),Td(o))}}js=null}function Td(s){for(;Mn!==null;){var r=Mn,o=s,d=r.alternate,p=r.flags;switch(r.tag){case 0:case 11:case 15:break;case 1:if((p&1024)!==0&&d!==null){o=void 0,p=d.memoizedProps,d=d.memoizedState;var g=r.stateNode;try{var w=Ba(r.type,p);o=g.getSnapshotBeforeUpdate(w,d),g.__reactInternalSnapshotBeforeUpdate=o}catch(T){At(r,r.return,T)}}break;case 3:if((p&1024)!==0){if(d=r.stateNode.containerInfo,o=d.nodeType,o===9)Am(d);else if(o===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":Am(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:o&&d!==null&&(o=Gi(d.memoizedProps,d.stateNode),p=r.memoizedProps,p=Yi(p.default,p.update),p!=="none"&&Ml(d,o,p,d.memoizedState=[],!0));break;default:if((p&1024)!==0)throw Error(i(163))}if(d=r.sibling,d!==null){d.return=r.return,Mn=d;break}Mn=r.return}}function wb(s,r,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Si(s,o),d&4&&oc(5,o);break;case 1:if(Si(s,o),d&4)if(s=o.stateNode,r===null)try{s.componentDidMount()}catch(w){At(o,o.return,w)}else{var p=Ba(o.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(p,r,s.__reactInternalSnapshotBeforeUpdate)}catch(w){At(o,o.return,w)}}d&64&&ub(o),d&512&&vi(o,o.return);break;case 3:if(Si(s,o),d&64&&(s=o.updateQueue,s!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Jv(s,r)}catch(w){At(o,o.return,w)}}break;case 27:r===null&&d&4&&pb(o);case 26:case 5:Si(s,o),r===null&&d&4&&Ip(o),d&512&&vi(o,o.return);break;case 12:Si(s,o);break;case 31:Si(s,o),d&4&&Nb(s,o);break;case 13:Si(s,o),d&4&&Cb(s,o),d&64&&(s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(o=KC.bind(null,o),A3(s,o))));break;case 22:if(d=o.memoizedState!==null||Tn,!d){var g=r!==null&&r.memoizedState!==null||Tt;r=Tn,p=Tt,Tn=d,(Tt=g)&&!p?(d=2,(o.subtreeFlags&8772)!==0&&(d|=1),ei(s,o,d)):Si(s,o),Tn=r,Tt=p}break;case 30:Si(s,o),d&512&&vi(o,o.return);break;case 7:d&512&&vi(o,o.return);default:Si(s,o)}}function Jp(s,r){for(s=s.child;s!==null;)Sb(s,r),s=s.sibling}function Sb(s,r){switch(s.tag){case 5:case 26:try{var o=s.stateNode;if(r){var d=o.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var p=s.stateNode,g=s.memoizedProps.style,w=g!=null&&g.hasOwnProperty("display")?g.display:null;p.style.display=w==null||typeof w=="boolean"?"":(""+w).trim()}}catch($){At(s,s.return,$)}em(s,r);break;case 6:try{s.stateNode.nodeValue=r?"":s.memoizedProps,vt=!0}catch($){At(s,s.return,$)}break;case 18:try{var T=s.stateNode;r?my(T,!0):my(s.stateNode,!1)}catch($){At(s,s.return,$)}break;case 22:case 23:s.memoizedState===null&&Jp(s,r);break;default:Jp(s,r)}}function em(s,r){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var o=s,d=r;switch(o.tag){case 4:Sb(o,d);break e;case 22:o.memoizedState===null&&em(o,d);break e;default:em(o,d)}}s=s.sibling}}function kb(s){var r=s.alternate;r!==null&&(s.alternate=null,kb(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&ul(r)),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 Kt=null,ds=!1;function Zs(s,r,o){for(o=o.child;o!==null;)jb(s,r,o),o=o.sibling}function jb(s,r,o){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Nn,o)}catch{}switch(o.tag){case 26:Tt||zn(o,r),Zs(s,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&!Tt&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Tt||zn(o,r),cc(o);var d=Kt,p=ds;Yr(o.type)&&(Kt=o.stateNode,ds=!1),Zs(s,r,o),Ty(o.stateNode,o.type,o.memoizedProps),Kt=d,ds=p;break;case 5:Tt||zn(o,r),cc(o);case 6:if(o.tag===6&&cc(o),d=Kt,p=ds,Kt=null,Zs(s,r,o),Kt=d,ds=p,Kt!==null)if(ds)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(o.stateNode),vt=!0}catch(g){At(o,r,g)}else try{Kt.removeChild(o.stateNode),vt=!0}catch(g){At(o,r,g)}break;case 18:Kt!==null&&(ds?(s=Kt,py(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.stateNode),Ql(s)):py(Kt,o.stateNode));break;case 4:d=Kt,p=ds,Kt=o.stateNode.containerInfo,ds=!0,Zs(s,r,o),Kt=d,ds=p;break;case 0:case 11:case 14:case 15:Ur(2,o,r),Tt||Ur(4,o,r),Zs(s,r,o);break;case 1:Tt||(zn(o,r),d=o.stateNode,typeof d.componentWillUnmount=="function"&&db(o,r,d)),Zs(s,r,o);break;case 21:Zs(s,r,o);break;case 22:Tt=(d=Tt)||o.memoizedState!==null,Zs(s,r,o),Tt=d;break;case 30:zn(o,r),Zs(s,r,o);break;case 7:Tt||zn(o,r),Zs(s,r,o);break;default:Zs(s,r,o)}}function Nb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Ql(s)}catch(o){At(r,r.return,o)}}}function Cb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Ql(s)}catch(o){At(r,r.return,o)}}function PC(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new _b),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new _b),r;default:throw Error(i(435,s.tag))}}function Md(s,r){var o=PC(s);r.forEach(function(d){if(!o.has(d)){o.add(d);var p=WC.bind(null,s,d);d.then(p,p)}})}function Zn(s,r,o){var d=r.deletions;if(d!==null)for(var p=0;p<d.length;p++){var g=d[p],w=s,T=r,$=T;e:for(;$!==null;){switch($.tag){case 27:if(Yr($.type)){Kt=$.stateNode,ds=!1;break e}break;case 5:Kt=$.stateNode,ds=!1;break e;case 3:case 4:Kt=$.stateNode.containerInfo,ds=!0;break e}$=$.return}if(Kt===null)throw Error(i(160));jb(w,T,g),Kt=null,ds=!1,w=g.alternate,w!==null&&(w.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Eb(r,s,o),r=r.sibling}var Js=null;function Eb(s,r,o){var d=s.alternate,p=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(p&4&&(d=s.updateQueue,d=d!==null?d.events:null,d!==null))for(var g=0;g<d.length;g++){var w=d[g];w.ref.impl=w.nextImpl}Zn(r,s,o),Jn(s),p&4&&(Ur(3,s,s.return),oc(3,s),Ur(5,s,s.return));break;case 1:Zn(r,s,o),Jn(s),p&512&&(Tt||d===null||zn(d,d.return)),p&64&&Tn&&(s=s.updateQueue,s!==null&&(r=s.callbacks,r!==null&&(o=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=o===null?r:o.concat(r))));break;case 26:if(g=Js,Zn(r,s,o),Jn(s),p&512&&(Tt||d===null||zn(d,d.return)),p&4)if(p=d!==null?d.memoizedState:null,o=s.memoizedState,d===null)if(o===null)if(s.stateNode===null)if(Tn)s.stateNode=dy(s.type,s.memoizedProps,r.containerInfo,s);else{e:{r=s.type,o=s.memoizedProps,p=g.ownerDocument||g;t:switch(r){case"title":d=p.getElementsByTagName("title")[0],(!d||d[_a]||d[dn]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=p.createElement(r),p.head.insertBefore(d,p.querySelector("head > title"))),$n(d,r,o),d[dn]=s,ln(d),r=d;break e;case"link":if(g=Dy("link","href",p).get(r+(o.href||""))){for(w=0;w<g.length;w++)if(d=g[w],d.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&d.getAttribute("rel")===(o.rel==null?null:o.rel)&&d.getAttribute("title")===(o.title==null?null:o.title)&&d.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){g.splice(w,1);break t}}d=p.createElement(r),$n(d,r,o),p.head.appendChild(d);break;case"meta":if(g=Dy("meta","content",p).get(r+(o.content||""))){for(w=0;w<g.length;w++)if(d=g[w],d.getAttribute("content")===(o.content==null?null:""+o.content)&&d.getAttribute("name")===(o.name==null?null:o.name)&&d.getAttribute("property")===(o.property==null?null:o.property)&&d.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&d.getAttribute("charset")===(o.charSet==null?null:o.charSet)){g.splice(w,1);break t}}d=p.createElement(r),$n(d,r,o),p.head.appendChild(d);break;default:throw Error(i(468,r))}d[dn]=s,ln(d),r=d}s.stateNode=r}else Tn||Bm(g,s.type,s.stateNode);else s.stateNode=Ly(g,o,s.memoizedProps);else p!==o?(p===null?(r=d.stateNode,r===null||Tt||r.parentNode.removeChild(r)):p.count--,o===null?Tn||Bm(g,s.type,s.stateNode):Ly(g,o,s.memoizedProps)):o===null&&s.stateNode!==null&&Hp(s,s.memoizedProps,d.memoizedProps);break;case 27:Zn(r,s,o),Jn(s),p&512&&(Tt||d===null||zn(d,d.return)),d!==null&&p&4&&Hp(s,s.memoizedProps,d.memoizedProps);break;case 5:if(g=_i,_i=!1,Zn(r,s,o),_i=g,Jn(s),p&512&&(Tt||d===null||zn(d,d.return)),s.flags&32){r=s.stateNode;try{Hi(r,""),vt=!0}catch(le){At(s,s.return,le)}}p&4&&s.stateNode!=null&&(r=s.memoizedProps,Hp(s,r,d!==null?d.memoizedProps:r)),p&1024&&(Wp=!0);break;case 6:if(Zn(r,s,o),Jn(s),p&4){if(s.stateNode===null)throw Error(i(162));r=s.memoizedProps,o=s.stateNode;try{o.nodeValue=r,vt=!0}catch(le){At(s,s.return,le)}}break;case 3:if(vt=!1,Vd=null,g=Js,Js=bc(r.containerInfo),Zn(r,s,o),Js=g,Jn(s),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Ql(r.containerInfo)}catch(le){At(s,s.return,le)}Wp&&(Wp=!1,Tb(s)),vt=!1;break;case 4:p=_i,_i=Tn,d=Lu(),g=Js,Js=bc(s.stateNode.containerInfo),Zn(r,s,o),Jn(s),Js=g,vt&&uc&&(Ed=!0),vt=d,_i=p;break;case 12:Zn(r,s,o),Jn(s);break;case 31:Zn(r,s,o),Jn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Md(s,r)));break;case 13:Zn(r,s,o),Jn(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Od=sn()),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Md(s,r)));break;case 22:g=s.memoizedState!==null,w=d!==null&&d.memoizedState!==null;var T=Tn,$=Tt,J=_i;Tn=T||g,_i=J||g,Tt=$||w,Zn(r,s,o),Tt=$,_i=J,Tn=T,Jn(s),p&8192&&(r=s.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,!g||d===null||w||Tn||Tt||(r=w||Tt,o=Tn,d=Tt,Tn=g||Tn,Tt=r,Fr(s,2),Tn=o,Tt=d),!g&&_i||Jp(s,g)),p&4&&(r=s.updateQueue,r!==null&&(o=r.retryQueue,o!==null&&(r.retryQueue=null,Md(s,o))));break;case 19:Zn(r,s,o),Jn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Md(s,r)));break;case 30:p&512&&(Tt||d===null||zn(d,d.return)),p=Lu(),g=uc,w=(o&335544064)===o,T=s.memoizedProps,uc=w&&Yi(T.default,T.update)!=="none",Zn(r,s,o),Jn(s),w&&d!==null&&vt&&(s.flags|=4),uc=g,vt=p;break;case 21:break;case 7:p&512&&(Tt||d===null||zn(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=s);default:Zn(r,s,o),Jn(s)}}function Jn(s){var r=s.flags;if(r&2){try{for(var o,d=s.return;d!==null;){if(hb(d)){o=d;break}d=d.return}d=null;for(var p=s.return;p!==null;){if(Fp(p)){var g=p.stateNode;d===null?d=[g]:d.push(g)}if(Up(p))break;p=p.return}var w=d;if(o==null)throw Error(i(160));switch(o.tag){case 27:var T=o.stateNode,$=qp(s);kd(s,$,T,w);break;case 5:var J=o.stateNode;o.flags&32&&(Hi(J,""),o.flags&=-33);var le=qp(s);kd(s,le,J,w);break;case 3:case 4:var pe=o.stateNode.containerInfo,W=qp(s);Vp(s,W,pe,w);break;default:throw Error(i(161))}}catch(ie){At(s,s.return,ie)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function Tb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;Tb(r),r.tag===5&&r.flags&1024&&(r=r.stateNode,Xl=!0,r.reset(),Xl=!1),s=s.sibling}}function Al(s,r){if(r.subtreeFlags&9270)for(r=r.child;r!==null;)Mb(r,s),r=r.sibling;else yb(r)}function Mb(s,r){var o=s.alternate;if(o===null)Gp(s,!1);else switch(s.tag){case 3:if(Zp=wi=!1,gb(),Al(r,s),!wi&&!Ed){if(s=bi,s!==null)for(var d=0;d<s.length;d+=3){o=s[d];var p=s[d+1];xy(o,s[d+2]),o=o.ownerDocument.documentElement,o!==null&&o.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+p+")"})}s=r.containerInfo,s=s.nodeType===9?s.documentElement:s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName===""&&(s.style.viewTransitionName="none",s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),s.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Zp=!0}bi=null;break;case 5:Al(r,s);break;case 4:d=wi,wi=!1,Al(r,s),wi&&(Ed=!0),wi=d;break;case 22:s.memoizedState===null&&(o.memoizedState!==null?Gp(s,!1):Al(r,s));break;case 30:d=wi,p=gb(),wi=!1,Al(r,s),wi&&(s.flags|=4);var g=s.memoizedProps,w=s.stateNode;r=Gi(g,w),w=Gi(o.memoizedProps,w);var T=Yi(g.default,g.update);T==="none"?r=!1:(g=o.memoizedState,o.memoizedState=null,o=s.child,us=0,r=Kp(s,o,r,w,T,g,!0),us!==(g===null?0:g.length)&&(s.flags|=32)),(s.flags&4)!==0&&r?(Bl(s,s.memoizedProps.onUpdate),bi=p):p!==null&&(p.push.apply(p,bi),bi=p),wi=(s.flags&32)!==0?!0:d;break;default:Al(r,s)}}function Si(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)wb(s,r.alternate,r),r=r.sibling}function Fr(s,r){for(s=s.child;s!==null;){var o=s,d=r;switch(o.tag){case 0:case 11:case 14:case 15:Ur(4,o,o.return),Fr(o,d);break;case 1:zn(o,o.return);var p=o.stateNode;typeof p.componentWillUnmount=="function"&&db(o,o.return,p),Fr(o,d);break;case 27:(d&2)!==0&&Ty(o.stateNode,o.type,o.memoizedProps);case 5:zn(o,o.return),o.tag!==5&&o.tag!==27||cc(o),Fr(o,d);break;case 6:cc(o);break;case 26:zn(o,o.return),p=o.stateNode,o.memoizedState!==null||p===null||Tt||p.parentNode.removeChild(p),Fr(o,d);break;case 22:o.memoizedState===null&&Fr(o,d);break;case 30:zn(o,o.return),Fr(o,d);break;case 7:zn(o,o.return);default:Fr(o,d)}s=s.sibling}}function ei(s,r,o){for(o=(r.subtreeFlags&8772)!==0?o:o&-2,r=r.child;r!==null;){var d=r.alternate,p=s,g=r,w=g.flags,T=(o&1)!==0;switch(g.tag){case 0:case 11:case 15:ei(p,g,o),oc(4,g);break;case 1:if(ei(p,g,o),d=g,p=d.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(le){At(d,d.return,le)}if(d=g,p=d.updateQueue,p!==null){var $=d.stateNode;try{var J=p.shared.hiddenCallbacks;if(J!==null)for(p.shared.hiddenCallbacks=null,p=0;p<J.length;p++)Zv(J[p],$)}catch(le){At(d,d.return,le)}}T&&w&64&&ub(g),vi(g,g.return);break;case 27:(o&2)!==0&&pb(g);case 5:g.tag!==5&&g.tag!==27||fb(g),ei(p,g,o),T&&d===null&&w&4&&Ip(g),vi(g,g.return);break;case 6:fb(g);break;case 26:$=g.stateNode,g.memoizedState!==null||$===null||Tn||Bm(bc($.ownerDocument),g.type,$),ei(p,g,o),T&&d===null&&w&4&&Ip(g),vi(g,g.return);break;case 12:ei(p,g,o);break;case 31:ei(p,g,o),T&&w&4&&Nb(p,g);break;case 13:ei(p,g,o),T&&w&4&&Cb(p,g);break;case 22:g.memoizedState===null&&ei(p,g,o),vi(g,g.return);break;case 30:ei(p,g,o),vi(g,g.return);break;case 7:vi(g,g.return);default:ei(p,g,o)}r=r.sibling}}function tm(s,r){var o=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==o&&(s!=null&&s.refCount++,o!=null&&Qo(o))}function nm(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Qo(s))}function Ps(s,r,o,d){var p=(o&335544064)===o;if(r.subtreeFlags&(p?10262:10256))for(r=r.child;r!==null;)Ab(s,r,o,d),r=r.sibling;else p&&bb(r)}function Ab(s,r,o,d){var p=(o&335544064)===o;p&&r.alternate===null&&r.return!==null&&r.return.alternate!==null&&Cd(r);var g=r.flags;switch(r.tag){case 0:case 11:case 15:Ps(s,r,o,d),g&2048&&oc(9,r);break;case 1:Ps(s,r,o,d);break;case 3:Ps(s,r,o,d),p&&Zp&&(s=s.containerInfo,s=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,s.style.viewTransitionName==="root"&&(s.style.viewTransitionName=""),s=s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName==="none"&&(s.style.viewTransitionName="")),g&2048&&(g=null,r.alternate!==null&&(g=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==g&&(r.refCount++,g!=null&&Qo(g)));break;case 12:if(g&2048){Ps(s,r,o,d),g=r.stateNode;try{var w=r.memoizedProps,T=w.id,$=w.onPostCommit;typeof $=="function"&&$(T,r.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(J){At(r,r.return,J)}}else Ps(s,r,o,d);break;case 31:Ps(s,r,o,d);break;case 13:Ps(s,r,o,d);break;case 23:break;case 22:w=r.stateNode,T=r.alternate,r.memoizedState!==null?(p&&T!==null&&T.memoizedState===null&&Cd(T),w._visibility&2?Ps(s,r,o,d):dc(s,r)):(p&&T!==null&&T.memoizedState!==null&&Cd(r),w._visibility&2?Ps(s,r,o,d):(w._visibility|=2,Rl(s,r,o,d,(r.subtreeFlags&10256)!==0||!1))),g&2048&&tm(T,r);break;case 24:Ps(s,r,o,d),g&2048&&nm(r.alternate,r);break;case 30:p&&(g=r.alternate,g!==null&&(yi(g.child,!0),yi(r.child,!0))),Ps(s,r,o,d);break;default:Ps(s,r,o,d)}}function Rl(s,r,o,d,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var g=s,w=r,T=o,$=d,J=w.flags;switch(w.tag){case 0:case 11:case 15:Rl(g,w,T,$,p),oc(8,w);break;case 23:break;case 22:var le=w.stateNode;w.memoizedState!==null?le._visibility&2?Rl(g,w,T,$,p):dc(g,w):(le._visibility|=2,Rl(g,w,T,$,p)),p&&J&2048&&tm(w.alternate,w);break;case 24:Rl(g,w,T,$,p),p&&J&2048&&nm(w.alternate,w);break;default:Rl(g,w,T,$,p)}r=r.sibling}}function dc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=s,d=r,p=d.flags;switch(d.tag){case 22:dc(o,d),p&2048&&tm(d.alternate,d);break;case 24:dc(o,d),p&2048&&nm(d.alternate,d);break;default:dc(o,d)}r=r.sibling}}var Pa=8192;function Ua(s,r,o){if(s.subtreeFlags&Pa)for(s=s.child;s!==null;)Rb(s,r,o),s=s.sibling}function Rb(s,r,o){switch(s.tag){case 26:Ua(s,r,o),s.flags&Pa&&(s.memoizedState!==null?V3(o,Js,s.memoizedState,s.memoizedProps):(s=s.stateNode,(r&335544128)===r&&Py(o,s)));break;case 5:Ua(s,r,o),s.flags&Pa&&(s=s.stateNode,(r&335544128)===r&&Py(o,s));break;case 3:case 4:var d=Js;Js=bc(s.stateNode.containerInfo),Ua(s,r,o),Js=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Pa,Pa=16777216,Ua(s,r,o),Pa=d):Ua(s,r,o));break;case 30:if((s.flags&Pa)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var p=s.stateNode;p.paired=null,js===null&&(js=new Map),js.set(d,p)}Ua(s,r,o);break;default:Ua(s,r,o)}}function Ob(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function fc(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var d=r[o];Mn=d,Db(d,s)}Ob(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Lb(s),s=s.sibling}function Lb(s){switch(s.tag){case 0:case 11:case 15:fc(s),s.flags&2048&&Ur(9,s,s.return);break;case 3:fc(s);break;case 12:fc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Ad(s)):fc(s);break;default:fc(s)}}function Ad(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var d=r[o];Mn=d,Db(d,s)}Ob(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Ur(8,r,r.return),Ad(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,Ad(r));break;default:Ad(r)}s=s.sibling}}function Db(s,r){for(;Mn!==null;){var o=Mn;switch(o.tag){case 0:case 11:case 15:Ur(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Qo(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,Mn=d;else e:for(o=s;Mn!==null;){d=Mn;var p=d.sibling,g=d.return;if(kb(d),d===o){Mn=null;break e}if(p!==null){p.return=g,Mn=p;break e}Mn=g}}}var UC={getCacheForType:function(s){var r=On(mn),o=r.data.get(s);return o===void 0&&(o=s(),r.data.set(s,o)),o},cacheSignal:function(){return On(mn).controller.signal}},FC=typeof WeakMap=="function"?WeakMap:Map,Et=0,$t=null,ct=null,ht=0,Mt=0,Ns=null,Ir=!1,Ol=!1,sm=!1,nr=0,cn=0,Hr=0,Fa=0,Rd=0,Cs=0,Ll=0,hc=null,fs=null,im=!1,Od=0,zb=0,Ld=1/0,Dd=null,qr=null,tn=0,ti=null,Ia=null,ki=0,rm=0,am=null,$b=null,Dl=null,zl=null,$l=null,pc=0,zd=null;function Es(){return(Et&2)!==0&&ht!==0?ht&-ht:Ee.T!==null?gm():ya()}function Bb(){if(Cs===0)if((ht&536870912)===0||lt){var s=ga;ga<<=1,(ga&3932160)===0&&(ga=262144),Cs=s}else Cs=536870912;return s=Ln.current,s!==null&&(s.flags|=32),Cs}function Bl(s,r){if(r!=null){var o=s.stateNode,d=o.ref;d===null&&(d=o.ref=vy(Gi(s.memoizedProps,o))),zl===null&&(zl=[]),zl.push(r.bind(null,d))}}function hs(s,r,o){(s===$t&&(Mt===2||Mt===9)||s.cancelPendingCommit!==null)&&(Pl(s,0),Vr(s,ht,Cs,!1)),ui(s,o),((Et&2)===0||s!==$t)&&(s===$t&&((Et&2)===0&&(Fa|=o),cn===4&&Vr(s,ht,Cs,!1)),ji(s))}function Pb(s,r,o){if((Et&6)!==0)throw Error(i(327));var d=!o&&(r&127)===0&&(r&s.expiredLanes)===0||yr(s,r),p=d?qC(s,r):om(s,r,!0),g=d;do{if(p===0){Ol&&!d&&Vr(s,r,0,!1);break}else{if(o=s.current.alternate,g&&!IC(o)){p=om(s,r,!1),g=!1;continue}if(p===2){if(g=r,s.errorRecoveryDisabledLanes&g)var w=0;else w=s.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var T=s;p=hc;var $=T.current.memoizedState.isDehydrated;if($&&(Pl(T,w).flags|=256),w=om(T,w,!1),w!==2&&w!==6){if(sm&&!$){T.errorRecoveryDisabledLanes|=g,Fa|=g,p=4;break e}g=fs,fs=p,g!==null&&(fs===null?fs=g:fs.push.apply(fs,g))}p=w}if(g=!1,p!==2)continue}}if(p===1){Pl(s,0),Vr(s,r,0,!0);break}e:{switch(d=s,g=p,g){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r&&(r&62914560)!==r)break;case 6:Vr(d,r,Cs,!Ir);break e;case 2:fs=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(p=Od+300-sn(),10<p)){if(Vr(d,r,Cs,!Ir),Xs(d,0,!0)!==0)break e;ki=r,d.timeoutHandle=Cm(Ub.bind(null,d,o,fs,Dd,im,r,Cs,Fa,Ll,Ir,g,"Throttled",-0,0),p);break e}Ub(d,o,fs,Dd,im,r,Cs,Fa,Ll,Ir,g,null,-0,0)}}break}while(!0);ji(s)}function Ub(s,r,o,d,p,g,w,T,$,J,le,pe,W,ie){s.timeoutHandle=-1;var Me=r.subtreeFlags,Be=(g&335544064)===g;if(pe=null,(Be||Me&8192||(Me&16785408)===16785408)&&(pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},js=null,Rb(r,g,pe),Be&&(Me=pe,Be=s.containerInfo,Be=(Be.nodeType===9?Be:Be.ownerDocument).__reactViewTransition,Be!=null&&(Me.count++,Me.waitingForViewTransition=!0,Me=wc.bind(Me),Be.finished.then(Me,Me))),Me=(g&62914560)===g?Od-sn():(g&4194048)===g?zb-sn():0,Me=G3(pe,Me),Me!==null)){ki=g,s.cancelPendingCommit=Me(Xb.bind(null,s,r,g,o,d,p,w,T,$,J,le,pe,null,W,ie)),Vr(s,g,w,!J);return}Xb(s,r,g,o,d,p,w,T,$,J,le,pe)}function IC(s){for(var r=s;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var p=o[d],g=p.getSnapshot;p=p.value;try{if(!Ss(g(),p))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Vr(s,r,o,d){r=Bi(s,r),r&=~Rd,r&=~Fa,s.suspendedLanes|=r,s.pingedLanes&=~r,d&&(s.warmLanes|=r),d=s.expirationTimes;for(var p=r;0<p;){var g=31-en(p),w=1<<g;d[g]=-1,p&=~w}o!==0&&va(s,o,r)}function $d(){return(Et&6)===0?(mc(0),!1):!0}function lm(){if(ct!==null){if(Mt===0)var s=ct.return;else s=ct,Ki=Ta=null,mp(s),jl=null,Zo=0,s=ct;for(;s!==null;)cb(s.alternate,s),s=s.return;ct=null}}function Pl(s,r){var o=s.timeoutHandle;return o!==-1&&(s.timeoutHandle=-1,f3(o)),o=s.cancelPendingCommit,o!==null&&(s.cancelPendingCommit=null,o()),ki=0,lm(),$t=s,ct=o=Xi(s.current,null),ht=r,Mt=0,Ns=null,Ir=!1,Ol=yr(s,r),sm=!1,Ll=Cs=Rd=Fa=Hr=cn=0,fs=hc=null,im=!1,nr=Bi(s,r),Vu(),o}function Fb(s,r){et=null,Ee.H=gd,r===kl||r===nd?(r=Xv(),Mt=3):r===np?(r=Xv(),Mt=4):Mt=r===Mp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ns=r,ct===null&&(cn=1,xd(s,Ds(r,s.current)))}function Ib(){var s=Ln.current;return s===null?!0:(ht&4194048)===ht?Hn===null:(ht&62914560)===ht||(ht&536870912)!==0?s===Hn:!1}function Hb(){var s=Ee.H;return Ee.H=gd,s===null?gd:s}function qb(){var s=Ee.A;return Ee.A=UC,s}function Bd(){cn=4,Ir||(ht&4194048)!==ht&&Ln.current!==null||(Ol=!0),(Hr&134217727)===0&&(Fa&134217727)===0||$t===null||Vr($t,ht,Cs,!1)}function om(s,r,o){var d=Et;Et|=2;var p=Hb(),g=qb();($t!==s||ht!==r)&&(Dd=null,Pl(s,r)),r=!1;var w=cn;e:do try{if(Mt!==0&&ct!==null){var T=ct,$=Ns;switch(Mt){case 8:lm(),w=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(r=!0);var J=Mt;if(Mt=0,Ns=null,Ul(s,T,$,J),o&&Ol){w=0;break e}break;default:J=Mt,Mt=0,Ns=null,Ul(s,T,$,J)}}HC(),w=cn;break}catch(le){Fb(s,le)}while(!0);return r&&s.shellSuspendCounter++,Ki=Ta=null,Et=d,Ee.H=p,Ee.A=g,ct===null&&($t=null,ht=0,Vu()),w}function HC(){for(;ct!==null;)Vb(ct)}function qC(s,r){var o=Et;Et|=2;var d=Hb(),p=qb();$t!==s||ht!==r?(Dd=null,Ld=sn()+500,Pl(s,r)):Ol=yr(s,r);e:do try{if(Mt!==0&&ct!==null){r=ct;var g=Ns;t:switch(Mt){case 1:Mt=0,Ns=null,Ul(s,r,g,1);break;case 2:case 9:if(Gv(g)){Mt=0,Ns=null,Gb(r);break}r=function(){Mt!==2&&Mt!==9||$t!==s||(Mt=7),ji(s)},g.then(r,r);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:Gv(g)?(Mt=0,Ns=null,Gb(r)):(Mt=0,Ns=null,Ul(s,r,g,7));break;case 5:var w=null;switch(ct.tag){case 26:w=ct.memoizedState;case 5:case 27:var T=ct;if(w?$y(w):T.stateNode.complete){Mt=0,Ns=null;var $=T.sibling;if($!==null)ct=$;else{var J=T.return;J!==null?(ct=J,Pd(J)):ct=null}break t}}Mt=0,Ns=null,Ul(s,r,g,5);break;case 6:Mt=0,Ns=null,Ul(s,r,g,6);break;case 8:lm(),cn=6;break e;default:throw Error(i(462))}}VC();break}catch(le){Fb(s,le)}while(!0);return Ki=Ta=null,Ee.H=d,Ee.A=p,Et=o,ct!==null?0:($t=null,ht=0,Vu(),cn)}function VC(){for(;ct!==null&&!bs();)Vb(ct)}function Vb(s){var r=lb(s.alternate,s,nr);s.memoizedProps=s.pendingProps,r===null?Pd(s):ct=r}function Gb(s){var r=s,o=r.alternate;switch(r.tag){case 15:case 0:r=eb(o,r,r.pendingProps,r.type,void 0,ht);break;case 11:r=eb(o,r,r.pendingProps,r.type.render,r.ref,ht);break;case 5:mp(r);var d=r;d===En&&(lt?(Wu(d),d.tag===5&&d.stateNode!=null&&(Ht=d.stateNode)):(Wu(d),lt=!0));default:cb(o,r),r=ct=Dv(r,nr),r=lb(o,r,nr)}s.memoizedProps=s.pendingProps,r===null?Pd(s):ct=r}function Ul(s,r,o,d){Ki=Ta=null,mp(r),jl=null,Zo=0;var p=r.return;try{if(RC(s,p,r,o,ht)){cn=1,xd(s,Ds(o,s.current)),ct=null;return}}catch(g){if(p!==null)throw ct=p,g;cn=1,xd(s,Ds(o,s.current)),ct=null;return}r.flags&32768?(lt||d===1?s=!0:Ol||(ht&536870912)!==0?s=!1:(Ir=s=!0,(d===2||d===9||d===3||d===6)&&(d=Ln.current,d!==null&&d.tag===13&&(d.flags|=16384))),Yb(r,s)):Pd(r)}function Pd(s){var r=s;do{if((r.flags&32768)!==0){Yb(r,Ir);return}s=r.return;var o=zC(r.alternate,r,nr);if(o!==null){ct=o;return}if(r=r.sibling,r!==null){ct=r;return}ct=r=s}while(r!==null);cn===0&&(cn=5)}function Yb(s,r){do{var o=$C(s.alternate,s);if(o!==null){o.flags&=32767,ct=o;return}if(o=s.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(s=s.sibling,s!==null)){ct=s;return}ct=s=o}while(s!==null);cn=6,ct=null}function Xb(s,r,o,d,p,g,w,T,$,J,le,pe){s.cancelPendingCommit=null;do Ud();while(tn!==0);if((Et&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));s===$t&&(ct=$t=null,ht=0),Ia=r,ti=s,ki=o,am=p,$b=d,GC(s,r,o,w,T,$,pe)}}function GC(s,r,o,d,p,g,w){var T=r.lanes|r.childLanes;if(rm=T,T|=Hh,ol(s,o,T,d,p,g),zl=null,(o&335544064)===o?($l=yC(s),d=10262):($l=null,d=10256),(r.subtreeFlags&d)!==0||(r.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,ZC(ve,function(){return fm(),null})):(s.callbackNode=null,s.callbackPriority=0),jd=!1,d=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||d){d=Ee.T,Ee.T=null,p=Re.p,Re.p=2,g=Et,Et|=4;try{BC(s,r,o)}finally{Et=g,Re.p=p,Ee.T=d}}tn=1,jd?Dl=v3(w,s.containerInfo,$l,cm,um,XC,dm,fm,YC):(cm(),um(),dm())}function YC(s){if(tn!==0){var r=ti.onRecoverableError;r(s,{componentStack:null})}}function XC(){tn===3&&(tn=0,Mb(Ia,ti),tn=4)}function cm(){if(tn===1){tn=0;var s=ti,r=Ia,o=ki,d=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||d){d=Ee.T,Ee.T=null;var p=Re.p;Re.p=2;var g=Et;Et|=4;try{uc=Ed=!1,Eb(r,s,o),o=km;var w=jv(s.containerInfo),T=o.focusedElem,$=o.selectionRange;if(w!==T&&T&&T.ownerDocument&&kv(T.ownerDocument.documentElement,T)){if($!==null&&Bh(T)){var J=$.start,le=$.end;if(le===void 0&&(le=J),"selectionStart"in T)T.selectionStart=J,T.selectionEnd=Math.min(le,T.value.length);else{var pe=T.ownerDocument||document,W=pe&&pe.defaultView||window;if(W.getSelection){var ie=W.getSelection(),Me=T.textContent.length,Be=Math.min($.start,Me),tt=$.end===void 0?Be:Math.min($.end,Me);!ie.extend&&Be>tt&&(w=tt,tt=Be,Be=w);var Z=Sv(T,Be),I=Sv(T,tt);if(Z&&I&&(ie.rangeCount!==1||ie.anchorNode!==Z.node||ie.anchorOffset!==Z.offset||ie.focusNode!==I.node||ie.focusOffset!==I.offset)){var ee=pe.createRange();ee.setStart(Z.node,Z.offset),ie.removeAllRanges(),Be>tt?(ie.addRange(ee),ie.extend(I.node,I.offset)):(ee.setEnd(I.node,I.offset),ie.addRange(ee))}}}}for(pe=[],ie=T;ie=ie.parentNode;)ie.nodeType===1&&pe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<pe.length;T++){var he=pe[T];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Xl=!!Sm,km=Sm=null}finally{Et=g,Re.p=p,Ee.T=d}}s.current=r,tn=2}}function um(){if(tn===2){tn=0;var s=ti,r=Ia,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=Ee.T,Ee.T=null;var d=Re.p;Re.p=2;var p=Et;Et|=4;try{wb(s,r.alternate,r)}finally{Et=p,Re.p=d,Ee.T=o}}tn=3}}function dm(){if(tn===4||tn===3){tn=0;var s=Dl;Dl=null,In();var r=ti,o=Ia,d=ki,p=$b,g=(d&335544064)===d?10262:10256;if((o.subtreeFlags&g)!==0||(o.flags&g)!==0?tn=5:(tn=0,Ia=ti=null,Qb(r,r.pendingLanes)),g=r.pendingLanes,g===0&&(qr=null),ba(d),o=o.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Nn,o,void 0,(o.current.flags&128)===128)}catch{}if(p!==null){o=Ee.T,g=Re.p,Re.p=2,Ee.T=null;try{for(var w=r.onRecoverableError,T=0;T<p.length;T++){var $=p[T];w($.value,{componentStack:$.stack})}}finally{Ee.T=o,Re.p=g}}if(p=zl,w=$l,$l=null,p!==null&&(zl=null,w===null&&(w=[]),s!==null))for($=0;$<p.length;$++)o=(0,p[$])(w),o!==void 0&&s.finished.finally(o);(ki&3)!==0&&Ud(),ji(r),g=r.pendingLanes,(d&261930)!==0&&(g&42)!==0?r===zd?pc++:(pc=0,zd=r):(pc=0,zd=null),mc(0)}}function Qb(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,Qo(r)))}function Ud(){return Dl!==null&&(Dl.skipTransition(),Dl=null),cm(),um(),dm(),fm()}function fm(){if(tn!==5)return!1;var s=ti,r=rm;rm=0;var o=ba(ki),d=Ee.T,p=Re.p;try{Re.p=32>o?32:o,Ee.T=null,o=am,am=null;var g=ti,w=ki;if(tn=0,Ia=ti=null,ki=0,(Et&6)!==0)throw Error(i(331));var T=Et;if(Et|=4,Lb(g.current),Ab(g,g.current,w,o),Et=T,mc(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Nn,g)}catch{}return!0}finally{Re.p=p,Ee.T=d,Qb(s,r)}}function Kb(s,r,o){r=Ds(o,r),r=Tp(s.stateNode,r,2),s=zr(s,r,2),s!==null&&(ui(s,2),ji(s))}function At(s,r,o){if(s.tag===3)Kb(s,s,o);else for(;r!==null;){if(r.tag===3){Kb(r,s,o);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(qr===null||!qr.has(d))){s=Ds(o,s),o=G1(2),d=zr(r,o,2),d!==null&&(Y1(o,d,r,s),ui(d,2),ji(d));break}}r=r.return}}function hm(s,r,o){var d=s.pingCache;if(d===null){d=s.pingCache=new FC;var p=new Set;d.set(r,p)}else p=d.get(r),p===void 0&&(p=new Set,d.set(r,p));p.has(o)||(sm=!0,p.add(o),s=QC.bind(null,s,r,o),r.then(s,s))}function QC(s,r,o){var d=s.pingCache;d!==null&&d.delete(r),s.pingedLanes|=s.suspendedLanes&o,s.warmLanes&=~o,$t===s&&(ht&o)===o&&((cn===4||cn===3&&(ht&62914560)===ht&&300>sn()-Od)&&(Et&2)===0?Pl(s,0):Rd|=o,Ll===ht&&(Ll=0)),ji(s)}function Wb(s,r){r===0&&(r=Ou()),s=Na(s,r),s!==null&&(ui(s,r),ji(s))}function KC(s){var r=s.memoizedState,o=0;r!==null&&(o=r.retryLane),Wb(s,o)}function WC(s,r){var o=0;switch(s.tag){case 31:case 13:var d=s.stateNode,p=s.memoizedState;p!==null&&(o=p.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(r),Wb(s,o)}function ZC(s,r){return rs(s,r)}var Fl=null,Il=null,pm=!1,Fd=!1,mm=!1,Gr=0;function ji(s){s!==Il&&s.next===null&&(Il===null?Fl=Il=s:Il=Il.next=s),Fd=!0,pm||(pm=!0,e3())}function mc(s,r){if(!mm&&Fd){mm=!0;do for(var o=!1,d=Fl;d!==null;){if(s!==0){var p=d.pendingLanes;if(p===0)var g=0;else{var w=d.suspendedLanes,T=d.pingedLanes;g=(1<<31-en(42|s)+1)-1,g&=p&~(w&~T),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,ty(d,g))}else g=ht,g=Xs(d,d===$t?g:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(g&3)===0||yr(d,g)||(o=!0,ty(d,g));d=d.next}while(o);mm=!1}}function JC(){Zb()}function Zb(){Fd=pm=!1;var s=0;Gr!==0&&d3()&&(s=Gr);for(var r=sn(),o=null,d=Fl;d!==null;){var p=d.next,g=Jb(d,r);g===0?(d.next=null,o===null?Fl=p:o.next=p,p===null&&(Il=o)):(o=d,(s!==0||(g&3)!==0)&&(Fd=!0)),d=p}tn!==0&&tn!==5||mc(s),Gr!==0&&(Gr=0)}function Jb(s,r){for(var o=s.suspendedLanes,d=s.pingedLanes,p=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var w=31-en(g),T=1<<w,$=p[w];$===-1?((T&o)===0||(T&d)!==0)&&(p[w]=jh(T,r)):$<=r&&(s.expiredLanes|=T),g&=~T}if(r=$t,o=ht,o=Xs(s,s===r?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,o===0||s===r&&(Mt===2||Mt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&Ct(d),s.callbackNode=null,s.callbackPriority=0;if((o&3)===0||yr(s,o)){if(r=o&-o,r===s.callbackPriority)return r;switch(d!==null&&Ct(d),ba(o)){case 2:case 8:o=oe;break;case 32:o=ve;break;case 268435456:o=rt;break;default:o=ve}return d=ey.bind(null,s),o=rs(o,d),s.callbackPriority=r,s.callbackNode=o,r}return d!==null&&d!==null&&Ct(d),s.callbackPriority=2,s.callbackNode=null,2}function ey(s,r){if(tn!==0&&tn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var o=s.callbackNode;if(Ud()&&s.callbackNode!==o)return null;var d=ht;return d=Xs(s,s===$t?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(Pb(s,d,r),Jb(s,sn()),s.callbackNode!=null&&s.callbackNode===o?ey.bind(null,s):null)}function ty(s,r){if(Ud())return null;Pb(s,r,!0)}function e3(){h3(function(){(Et&6)!==0?rs($i,JC):Zb()})}function gm(){if(Gr===0){var s=Ra;s===0&&(s=br,br<<=1,(br&261888)===0&&(br=256)),Gr=s}return Gr}function ny(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Rn(s)}function t3(s,r,o,d,p){if(r==="submit"&&o&&o.stateNode===p){var g=ny((p[Cn]||null).action),w=d.submitter;w&&(r=(r=w[Cn]||null)?ny(r.formAction):w.getAttribute("formAction"),r!==null&&(g=r,w=null));var T=new Fu("action","action",null,d,p);s.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Gr!==0){var $=new FormData(p,w);kp(o,{pending:!0,data:$,method:p.method,action:g},null,$)}}else typeof g=="function"&&(T.preventDefault(),$=new FormData(p,w),kp(o,{pending:!0,data:$,method:p.method,action:g},g,$))},currentTarget:p}]})}}for(var xm=0;xm<Ih.length;xm++){var vm=Ih[xm],n3=vm.toLowerCase(),s3=vm[0].toUpperCase()+vm.slice(1);Ws(n3,"on"+s3)}Ws(Ev,"onAnimationEnd"),Ws(Tv,"onAnimationIteration"),Ws(Mv,"onAnimationStart"),Ws("dblclick","onDoubleClick"),Ws("focusin","onFocus"),Ws("focusout","onBlur"),Ws(fC,"onTransitionRun"),Ws(hC,"onTransitionStart"),Ws(pC,"onTransitionCancel"),Ws(Av,"onTransitionEnd"),Ii("onMouseEnter",["mouseout","mouseover"]),Ii("onMouseLeave",["mouseout","mouseover"]),Ii("onPointerEnter",["pointerout","pointerover"]),Ii("onPointerLeave",["pointerout","pointerover"]),Fi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gc="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(" "),i3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gc));function sy(s,r){r=(r&4)!==0;for(var o=0;o<s.length;o++){var d=s[o],p=d.event;d=d.listeners;e:{var g=void 0;if(r)for(var w=d.length-1;0<=w;w--){var T=d[w],$=T.instance,J=T.currentTarget;if(T=T.listener,$!==g&&p.isPropagationStopped())break e;g=T,p.currentTarget=J;try{g(p)}catch(le){qu(le)}p.currentTarget=null,g=$}else for(w=0;w<d.length;w++){if(T=d[w],$=T.instance,J=T.currentTarget,T=T.listener,$!==g&&p.isPropagationStopped())break e;g=T,p.currentTarget=J;try{g(p)}catch(le){qu(le)}p.currentTarget=null,g=$}}}}function ut(s,r){var o=r[Mo];o===void 0&&(o=r[Mo]=new Set);var d=s+"__bubble";o.has(d)||(iy(r,s,2,!1),o.add(d))}function bm(s,r,o){var d=0;r&&(d|=4),iy(o,s,d,r)}var Id="_reactListening"+Math.random().toString(36).slice(2);function ym(s){if(!s[Id]){s[Id]=!0,Qs.forEach(function(o){o!=="selectionchange"&&(i3.has(o)||bm(o,!1,s),bm(o,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Id]||(r[Id]=!0,bm("selectionchange",!1,r))}}function iy(s,r,o,d){switch(Yy(r)){case 2:var p=K3;break;case 8:p=W3;break;default:p=Um}o=p.bind(null,r,o,s),p=void 0,!pl||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),d?p!==void 0?s.addEventListener(r,o,{capture:!0,passive:p}):s.addEventListener(r,o,!0):p!==void 0?s.addEventListener(r,o,{passive:p}):s.addEventListener(r,o,!1)}function _m(s,r,o,d,p){var g=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var T=d.stateNode.containerInfo;if(T===p)break;if(w===4)for(w=d.return;w!==null;){var $=w.tag;if(($===3||$===4)&&w.stateNode.containerInfo===p)return;w=w.return}for(;T!==null;){if(w=Ui(T),w===null)return;if($=w.tag,$===5||$===6||$===26||$===27){d=g=w;continue e}T=T.parentNode}}d=d.return}Pu(function(){var J=g,le=jr(o),pe=[];e:{var W=Rv.get(s);if(W!==void 0){var ie=Fu,Me=s;switch(s){case"keypress":if(Vi(o)===0)break e;case"keydown":case"keyup":ie=IN;break;case"focusin":Me="focus",ie=Rh;break;case"focusout":Me="blur",ie=Rh;break;case"beforeblur":case"afterblur":ie=Rh;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=lv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=MN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=YN;break;case Ev:case Tv:case Mv:ie=ON;break;case Av:ie=QN;break;case"scroll":case"scrollend":ie=EN;break;case"wheel":ie=WN;break;case"copy":case"cut":case"paste":ie=DN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=cv;break;case"submit":ie=VN;break;case"toggle":case"beforetoggle":ie=JN}var Be=(r&4)!==0,tt=!Be&&(s==="scroll"||s==="scrollend"),Z=Be?W!==null?W+"Capture":null:W;Be=[];for(var I=J,ee;I!==null;){var he=I;if(ee=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ee===null||Z===null||(he=Nr(I,Z),he!=null&&Be.push(xc(I,he,ee))),tt)break;I=I.return}0<Be.length&&(W=new ie(W,Me,null,o,le),pe.push({event:W,listeners:Be}))}}if((r&7)===0){e:{if(ie=s==="mouseover"||s==="pointerover",W=s==="mouseout"||s==="pointerout",ie&&o!==kr&&(Me=o.relatedTarget||o.fromElement)&&(Ui(Me)||Me[fi]))break e;(W||ie)&&(Me=le.window===le?le:(ie=le.ownerDocument)?ie.defaultView||ie.parentWindow:window,W?(ie=o.relatedTarget||o.toElement,W=J,ie=ie?Ui(ie):null,ie!==null&&(tt=c(ie),Be=ie.tag,ie!==tt||Be!==5&&Be!==27&&Be!==6)&&(ie=null)):(W=null,ie=J),W!==ie&&(Be=lv,he="onMouseLeave",Z="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(Be=cv,he="onPointerLeave",Z="onPointerEnter",I="pointer"),tt=W==null?Me:_r(W),ee=ie==null?Me:_r(ie),Me=new Be(he,I+"leave",W,o,le),Me.target=tt,Me.relatedTarget=ee,he=null,Ui(le)===J&&(Be=new Be(Z,I+"enter",ie,o,le),Be.target=ee,Be.relatedTarget=tt,he=Be),tt=he,Be=W&&ie?R(W,ie,r3):null,W!==null&&ry(pe,Me,W,Be,!1),ie!==null&&tt!==null&&ry(pe,tt,ie,Be,!0)))}e:{if(W=J?_r(J):window,ie=W.nodeName&&W.nodeName.toLowerCase(),ie==="select"||ie==="input"&&W.type==="file")var Oe=xv;else if(mv(W))if(vv)Oe=cC;else{Oe=lC;var pt=aC}else ie=W.nodeName,!ie||ie.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?J&&mt(J.elementType)&&(Oe=xv):Oe=oC;if(Oe&&(Oe=Oe(s,J))){gv(pe,Oe,o,le);break e}pt&&pt(s,W,J)}switch(pt=J?_r(J):window,s){case"focusin":(mv(pt)||pt.contentEditable==="true")&&(gl=pt,Ph=J,Go=null);break;case"focusout":Go=Ph=gl=null;break;case"mousedown":Uh=!0;break;case"contextmenu":case"mouseup":case"dragend":Uh=!1,Nv(pe,o,le);break;case"selectionchange":if(dC)break;case"keydown":case"keyup":Nv(pe,o,le)}var Fe;if(Lh)e:{switch(s){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else ml?hv(s,o)&&(Ge="onCompositionEnd"):s==="keydown"&&o.keyCode===229&&(Ge="onCompositionStart");Ge&&(uv&&o.locale!=="ko"&&(ml||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&ml&&(Fe=Po()):(Ks=le,mi="value"in Ks?Ks.value:Ks.textContent,ml=!0)),pt=Hd(J,Ge),0<pt.length&&(Ge=new ov(Ge,s,null,o,le),pe.push({event:Ge,listeners:pt}),Fe?Ge.data=Fe:(Fe=pv(o),Fe!==null&&(Ge.data=Fe)))),(Fe=tC?nC(s,o):sC(s,o))&&(Ge=Hd(J,"onBeforeInput"),0<Ge.length&&(pt=new ov("onBeforeInput","beforeinput",null,o,le),pe.push({event:pt,listeners:Ge}),pt.data=Fe)),t3(pe,s,J,o,le)}sy(pe,r)})}function xc(s,r,o){return{instance:s,listener:r,currentTarget:o}}function Hd(s,r){for(var o=r+"Capture",d=[];s!==null;){var p=s,g=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||g===null||(p=Nr(s,o),p!=null&&d.unshift(xc(s,p,g)),p=Nr(s,r),p!=null&&d.push(xc(s,p,g))),s.tag===3)return d;s=s.return}return[]}function r3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function ry(s,r,o,d,p){for(var g=r._reactName,w=[];o!==null&&o!==d;){var T=o,$=T.alternate,J=T.stateNode;if(T=T.tag,$!==null&&$===d)break;T!==5&&T!==26&&T!==27||J===null||($=J,p?(J=Nr(o,g),J!=null&&w.unshift(xc(o,J,$))):p||(J=Nr(o,g),J!=null&&w.push(xc(o,J,$)))),o=o.return}w.length!==0&&s.push({event:r,listeners:w})}var a3=/\r\n?/g,l3=/\u0000|\uFFFD/g;function ay(s){return(typeof s=="string"?s:""+s).replace(a3,`
|
|
50
|
-
`).replace(l3,"")}function ly(s,r){return r=ay(r),ay(s)===r}function Rt(s,r,o,d,p,g){switch(o){case"children":if(typeof d=="string")r==="body"||r==="textarea"&&d===""||Hi(s,d);else if(typeof d=="number"||typeof d=="bigint")r!=="body"&&Hi(s,""+d);else return;break;case"className":wa(s,"class",d);break;case"tabIndex":wa(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":wa(s,o,d);break;case"style":st(s,d,g);return;case"data":if(r!=="object"){wa(s,"data",d);break}case"src":case"href":if(d===""&&(r!=="a"||o!=="href")){s.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(o);break}d=Rn(d),s.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(o==="formAction"?(r!=="input"&&Rt(s,r,"name",p.name,p,null),Rt(s,r,"formEncType",p.formEncType,p,null),Rt(s,r,"formMethod",p.formMethod,p,null),Rt(s,r,"formTarget",p.formTarget,p,null)):(Rt(s,r,"encType",p.encType,p,null),Rt(s,r,"method",p.method,p,null),Rt(s,r,"target",p.target,p,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(o);break}d=Rn(d),s.setAttribute(o,d);break;case"onClick":d!=null&&(s.onclick=Qn);return;case"onScroll":d!=null&&ut("scroll",s);return;case"onScrollEnd":d!=null&&ut("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(p.children!=null)throw Error(i(60));(g!=null?g.__html:void 0)!==o&&(s.innerHTML=o)}}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}o=Rn(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(o,d):s.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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(o,""):s.removeAttribute(o);break;case"capture":case"download":d===!0?s.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(o,d):s.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(o,d):s.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(o):s.setAttribute(o,d);break;case"popover":ut("beforetoggle",s),ut("toggle",s),hl(s,"popover",d);break;case"xlinkActuate":Os(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Os(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Os(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Os(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Os(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Os(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Os(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Os(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Os(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":hl(s,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")o=gt.get(o)||o,hl(s,o,d);else return}vt=!0}function wm(s,r,o,d,p,g){switch(o){case"style":st(s,d,g);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(p.children!=null)throw Error(i(60));(g!=null?g.__html:void 0)!==o&&(s.innerHTML=o)}}break;case"children":if(typeof d=="string")Hi(s,d);else if(typeof d=="number"||typeof d=="bigint")Hi(s,""+d);else return;break;case"onScroll":d!=null&&ut("scroll",s);return;case"onScrollEnd":d!=null&&ut("scrollend",s);return;case"onClick":d!=null&&(s.onclick=Qn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!dl.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),g=o.slice(2,p?o.length-7:void 0),r=s[Cn]||null,r=r!=null?r[o]:null,typeof r=="function"&&s.removeEventListener(g,r,p),typeof d=="function")){typeof r!="function"&&r!==null&&(o in s?s[o]=null:s.hasAttribute(o)&&s.removeAttribute(o)),s.addEventListener(g,d,p);break e}vt=!0,o in s?s[o]=d:d===!0?s.setAttribute(o,""):hl(s,o,d)}return}vt=!0}function $n(s,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ut("error",s),ut("load",s);var d=!1,p=!1,g;for(g in o)if(o.hasOwnProperty(g)){var w=o[g];if(w!=null)switch(g){case"src":d=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,g,w,o,null)}}p&&Rt(s,r,"srcSet",o.srcSet,o,null),d&&Rt(s,r,"src",o.src,o,null);return;case"input":ut("invalid",s);var T=g=w=p=null,$=null,J=null;for(d in o)if(o.hasOwnProperty(d)){var le=o[d];if(le!=null)switch(d){case"name":p=le;break;case"type":w=le;break;case"checked":$=le;break;case"defaultChecked":J=le;break;case"value":g=le;break;case"defaultValue":T=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,r));break;default:Rt(s,r,d,le,o,null)}}$u(s,g,T,$,J,w,p,!1);return;case"select":ut("invalid",s),d=w=g=null;for(p in o)if(o.hasOwnProperty(p)&&(T=o[p],T!=null))switch(p){case"value":g=T;break;case"defaultValue":w=T;break;case"multiple":d=T;default:Rt(s,r,p,T,o,null)}r=g,o=w,s.multiple=!!d,r!=null?Sr(s,!!d,r,!1):o!=null&&Sr(s,!!d,o,!0);return;case"textarea":ut("invalid",s),g=p=d=null;for(w in o)if(o.hasOwnProperty(w)&&(T=o[w],T!=null))switch(w){case"value":d=T;break;case"defaultValue":p=T;break;case"children":g=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:Rt(s,r,w,T,o,null)}$o(s,d,p,g);return;case"option":for($ in o)if(o.hasOwnProperty($)&&(d=o[$],d!=null))switch($){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Rt(s,r,$,d,o,null)}return;case"dialog":ut("beforetoggle",s),ut("toggle",s),ut("cancel",s),ut("close",s);break;case"iframe":case"object":ut("load",s);break;case"video":case"audio":for(d=0;d<gc.length;d++)ut(gc[d],s);break;case"image":ut("error",s),ut("load",s);break;case"details":ut("toggle",s);break;case"embed":case"source":case"link":ut("error",s),ut("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(J in o)if(o.hasOwnProperty(J)&&(d=o[J],d!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,J,d,o,null)}return;default:if(mt(r)){for(le in o)o.hasOwnProperty(le)&&(d=o[le],d!==void 0&&wm(s,r,le,d,o,void 0));return}}for(T in o)o.hasOwnProperty(T)&&(d=o[T],d!=null&&Rt(s,r,T,d,o,null))}var o3={};function c3(s,r,o,d){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,g=null,w=null,T=null,$=null,J=null,le=null;for(ie in o){var pe=o[ie];if(o.hasOwnProperty(ie)&&pe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":$=pe;default:d.hasOwnProperty(ie)||Rt(s,r,ie,null,d,pe)}}for(var W in d){var ie=d[W];if(pe=o[W],d.hasOwnProperty(W)&&(ie!=null||pe!=null))switch(W){case"type":ie!==pe&&(vt=!0),g=ie;break;case"name":ie!==pe&&(vt=!0),p=ie;break;case"checked":ie!==pe&&(vt=!0),J=ie;break;case"defaultChecked":ie!==pe&&(vt=!0),le=ie;break;case"value":ie!==pe&&(vt=!0),w=ie;break;case"defaultValue":ie!==pe&&(vt=!0),T=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,r));break;default:ie!==pe&&Rt(s,r,W,ie,d,pe)}}Lo(s,w,T,$,J,le,g,p);return;case"select":ie=w=T=W=null;for(g in o)if($=o[g],o.hasOwnProperty(g)&&$!=null)switch(g){case"value":break;case"multiple":ie=$;default:d.hasOwnProperty(g)||Rt(s,r,g,null,d,$)}for(p in d)if(g=d[p],$=o[p],d.hasOwnProperty(p)&&(g!=null||$!=null))switch(p){case"value":g!==$&&(vt=!0),W=g;break;case"defaultValue":g!==$&&(vt=!0),T=g;break;case"multiple":g!==$&&(vt=!0),w=g;default:g!==$&&Rt(s,r,p,g,d,$)}r=T,o=w,d=ie,W!=null?Sr(s,!!o,W,!1):!!d!=!!o&&(r!=null?Sr(s,!!o,r,!0):Sr(s,!!o,o?[]:"",!1));return;case"textarea":ie=W=null;for(T in o)if(p=o[T],o.hasOwnProperty(T)&&p!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:Rt(s,r,T,null,d,p)}for(w in d)if(p=d[w],g=o[w],d.hasOwnProperty(w)&&(p!=null||g!=null))switch(w){case"value":p!==g&&(vt=!0),W=p;break;case"defaultValue":p!==g&&(vt=!0),ie=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==g&&Rt(s,r,w,p,d,g)}zo(s,W,ie);return;case"option":for(var Me in o)if(W=o[Me],o.hasOwnProperty(Me)&&W!=null&&!d.hasOwnProperty(Me))switch(Me){case"selected":s.selected=!1;break;default:Rt(s,r,Me,null,d,W)}for($ in d)if(W=d[$],ie=o[$],d.hasOwnProperty($)&&W!==ie&&(W!=null||ie!=null))switch($){case"selected":W!==ie&&(vt=!0),s.selected=W&&typeof W!="function"&&typeof W!="symbol";break;default:Rt(s,r,$,W,d,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in o)W=o[Be],o.hasOwnProperty(Be)&&W!=null&&!d.hasOwnProperty(Be)&&Rt(s,r,Be,null,d,W);for(J in d)if(W=d[J],ie=o[J],d.hasOwnProperty(J)&&W!==ie&&(W!=null||ie!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(i(137,r));break;default:Rt(s,r,J,W,d,ie)}return;default:if(mt(r)){for(var tt in o)W=o[tt],o.hasOwnProperty(tt)&&W!==void 0&&!d.hasOwnProperty(tt)&&wm(s,r,tt,void 0,d,W);for(le in d)W=d[le],ie=o[le],!d.hasOwnProperty(le)||W===ie||W===void 0&&ie===void 0||wm(s,r,le,W,d,ie);return}}for(var Z in o)W=o[Z],o.hasOwnProperty(Z)&&W!=null&&!d.hasOwnProperty(Z)&&Rt(s,r,Z,null,d,W);for(pe in d)W=d[pe],ie=o[pe],!d.hasOwnProperty(pe)||W===ie||W==null&&ie==null||Rt(s,r,pe,W,d,ie)}function oy(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var p=o[d],g=p.transferSize,w=p.initiatorType,T=p.duration;if(g&&T&&oy(w)){for(w=0,T=p.responseEnd,d+=1;d<o.length;d++){var $=o[d],J=$.startTime;if(J>T)break;var le=$.transferSize,pe=$.initiatorType;le&&oy(pe)&&($=$.responseEnd,w+=le*($<T?1:(T-J)/($-J)))}if(--d,r+=8*(g+w)/(p.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Sm=null,km=null;function vc(s){return s.nodeType===9?s:s.ownerDocument}function cy(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 uy(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function dy(s,r,o,d){return o=vc(o).createElement(s),o[dn]=d,o[Cn]=r,$n(o,s,r),ln(o),o}function jm(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Nm=null;function d3(){var s=window.event;return s&&s.type==="popstate"?s===Nm?!1:(Nm=s,!0):(Nm=null,!1)}var Cm=typeof setTimeout=="function"?setTimeout:void 0,f3=typeof clearTimeout=="function"?clearTimeout:void 0,fy=typeof Promise=="function"?Promise:void 0,hy=typeof requestAnimationFrame=="function"?requestAnimationFrame:Cm,h3=typeof queueMicrotask=="function"?queueMicrotask:typeof fy<"u"?function(s){return fy.resolve(null).then(s).catch(p3)}:Cm;function p3(s){setTimeout(function(){throw s})}function Yr(s){return s==="head"}function py(s,r){var o=r,d=0;do{var p=o.nextSibling;if(s.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(d===0){s.removeChild(p),Ql(r);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Dm(s.ownerDocument.documentElement);else if(o==="head"){o=s.ownerDocument.head,Dm(o);for(var g=o.firstChild;g;){var w=g.nextSibling,T=g.nodeName;g[_a]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=w}}else o==="body"&&Dm(s.ownerDocument.body);o=p}while(o);Ql(r)}function my(s,r){var o=s;s=0;do{var d=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(s===0)break;s--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||s++;o=d}while(o)}function gy(s,r,o){if(r=CSS.escape(r)!==r?"r-"+btoa(r).replace(/=/g,""):r,s.style.viewTransitionName=r,o!=null&&(s.style.viewTransitionClass=o),o=getComputedStyle(s),o.display==="inline"){if(r=s.getClientRects(),r.length===1)var d=1;else for(var p=d=0;p<r.length;p++){var g=r[p];0<g.width&&0<g.height&&d++}d===1&&(s=s.style,s.display=r.length===1?"inline-block":"block",s.marginTop="-"+o.paddingTop,s.marginBottom="-"+o.paddingBottom)}}function xy(s,r){s=s.style,r=r.style;var o=r!=null?r.hasOwnProperty("viewTransitionName")?r.viewTransitionName:r.hasOwnProperty("view-transition-name")?r["view-transition-name"]:null:null;s.viewTransitionName=o==null||typeof o=="boolean"?"":(""+o).trim(),o=r!=null?r.hasOwnProperty("viewTransitionClass")?r.viewTransitionClass:r.hasOwnProperty("view-transition-class")?r["view-transition-class"]:null:null,s.viewTransitionClass=o==null||typeof o=="boolean"?"":(""+o).trim(),s.display==="inline-block"&&(r==null?s.display=s.margin="":(o=r.display,s.display=o==null||typeof o=="boolean"?"":o,o=r.margin,o!=null?s.margin=o:(o=r.hasOwnProperty("marginTop")?r.marginTop:r["margin-top"],s.marginTop=o==null||typeof o=="boolean"?"":o,r=r.hasOwnProperty("marginBottom")?r.marginBottom:r["margin-bottom"],s.marginBottom=r==null||typeof r=="boolean"?"":r)))}function m3(s,r,o){return o=o.ownerDocument.defaultView,{rect:s,abs:r.position==="absolute"||r.position==="fixed",clip:r.clipPath!=="none"||r.overflow!=="visible"||r.filter!=="none"||r.mask!=="none"||r.mask!=="none"||r.borderRadius!=="0px",view:0<=s.bottom&&0<=s.right&&s.top<=o.innerHeight&&s.left<=o.innerWidth}}function Em(s){var r=s.getBoundingClientRect(),o=getComputedStyle(s);return m3(r,o,s)}function g3(s){return s.documentElement.clientHeight}function x3(s){this.addEventListener("load",s),this.addEventListener("error",s)}function v3(s,r,o,d,p,g,w,T,$){var J=r.nodeType===9?r:r.ownerDocument;try{var le=J.startViewTransition({update:function(){var W=J.defaultView,ie=W.navigation&&W.navigation.transition,Me=J.fonts.status;d();var Be=[];if(Me==="loaded"&&(g3(J),J.fonts.status==="loading"&&Be.push(J.fonts.ready)),Me=Be.length,s!==null)for(var tt=s.suspenseyImages,Z=0,I=0;I<tt.length;I++){var ee=tt[I];if(!ee.complete){var he=ee.getBoundingClientRect();if(0<he.bottom&&0<he.right&&he.top<W.innerHeight&&he.left<W.innerWidth){if(Z+=By(ee),Z>Gd){Be.length=Me;break}ee=new Promise(x3.bind(ee)),Be.push(ee)}}}if(0<Be.length)return W=Promise.race([Promise.all(Be),new Promise(function(Oe){return setTimeout(Oe,500)})]).then(p,p),(ie?Promise.allSettled([ie.finished,W]):W).then(g,g);if(p(),ie)return ie.finished.then(g,g);g()},types:o});J.__reactViewTransition=le;var pe=[];return le.ready.then(function(){for(var W=J.documentElement.getAnimations({subtree:!0}),ie=0;ie<W.length;ie++){var Me=W[ie],Be=Me.effect,tt=Be.pseudoElement;if(tt!=null&&tt.startsWith("::view-transition")){pe.push(Me),Me=Be.getKeyframes();for(var Z=tt=void 0,I=!0,ee=0;ee<Me.length;ee++){var he=Me[ee],Oe=he.width;if(tt===void 0)tt=Oe;else if(tt!==Oe){I=!1;break}if(Oe=he.height,Z===void 0)Z=Oe;else if(Z!==Oe){I=!1;break}delete he.width,delete he.height,he.transform==="none"&&delete he.transform}I&&tt!==void 0&&Z!==void 0&&(Be.setKeyframes(Me),I=getComputedStyle(Be.target,Be.pseudoElement),I.width!==tt||I.height!==Z)&&(I=Me[0],I.width=tt,I.height=Z,I=Me[Me.length-1],I.width=tt,I.height=Z,Be.setKeyframes(Me))}}w()},function(W){J.__reactViewTransition===le&&(J.__reactViewTransition=null);try{if(typeof W=="object"&&W!==null)switch(W.name){case"InvalidStateError":(W.message==="View transition was skipped because document visibility state is hidden."||W.message==="Skipping view transition because document visibility state has become hidden."||W.message==="Skipping view transition because viewport size changed."||W.message==="Transition was aborted because of invalid state")&&(W=null)}W!==null&&$(W)}finally{d(),p(),w()}}),le.finished.finally(function(){for(var W=0;W<pe.length;W++)pe[W].cancel();J.__reactViewTransition===le&&(J.__reactViewTransition=null),T()}),le}catch{return d(),p(),w(),null}}function Ha(s,r){this._scope=document.documentElement,this._selector="::view-transition-"+s+"("+r+")"}Ha.prototype.animate=function(s,r){return r=typeof r=="number"?{duration:r}:F({},r),r.pseudoElement=this._selector,this._scope.animate(s,r)},Ha.prototype.getAnimations=function(){for(var s=this._scope,r=this._selector,o=s.getAnimations({subtree:!0}),d=[],p=0;p<o.length;p++){var g=o[p].effect;g!==null&&g.target===s&&g.pseudoElement===r&&d.push(o[p])}return d},Ha.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function vy(s){return{name:s,group:new Ha("group",s),imagePair:new Ha("image-pair",s),old:new Ha("old",s),new:new Ha("new",s)}}function Ts(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}Ts.prototype.addEventListener=function(s,r,o){var d=null,p=null;if(!(o!=null&&typeof o!="boolean"&&(d=o.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var g=this._eventListeners;if(yy(g,s,r,o)===-1){var w=this,T=r;o!=null&&typeof o!="boolean"&&o.once===!0&&(T=function($){w.removeEventListener(s,r,o),typeof r=="function"?r.call(this,$):r.handleEvent($)}),d!==null&&(p=w.removeEventListener.bind(w,s,r,o),d.addEventListener("abort",p,{once:!0}),p=d.removeEventListener.bind(d,"abort",p)),d=Hl(o),g.push({type:s,listener:r,optionsOrUseCapture:o,attachedListener:T,cleanup:p}),x(this._fragmentFiber.child,!1,b3,s,T,d)}this._eventListeners=g}};function b3(s,r,o,d){return N(s).addEventListener(r,o,d),!1}Ts.prototype.removeEventListener=function(s,r,o){var d=this._eventListeners;if(d!==null&&(r=yy(d,s,r,o),r!==-1)){var p=d[r];o=p.attachedListener;var g=p.cleanup;p=Hl(p.optionsOrUseCapture),x(this._fragmentFiber.child,!1,y3,s,o,p),d.splice(r,1),g!==null&&g()}};function y3(s,r,o,d){return N(s).removeEventListener(r,o,d),!1}function Hl(s){return s!=null&&typeof s!="boolean"&&(s.once===!0||s.signal instanceof AbortSignal)?{capture:s.capture,passive:s.passive}:s}function by(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function yy(s,r,o,d){if(s.length===0)return-1;d=by(d);for(var p=0;p<s.length;p++){var g=s[p];if(g.type===r&&g.listener===o&&by(g.optionsOrUseCapture)===d)return p}return-1}Ts.prototype.dispatchEvent=function(s){var r=b(this._fragmentFiber);if(r===null)return!0;r=N(r);var o=this._eventListeners;if(o!==null&&0<o.length||!s.bubbles){var d=r.nodeType===9?r.createComment(""):document.createTextNode("");if(o)for(var p=0;p<o.length;p++){var g=o[p];d.addEventListener(g.type,g.attachedListener,Hl(g.optionsOrUseCapture))}if(r.appendChild(d),s=d.dispatchEvent(s),o)for(p=0;p<o.length;p++)g=o[p],d.removeEventListener(g.type,g.attachedListener,Hl(g.optionsOrUseCapture));return r.removeChild(d),s}return r.dispatchEvent(s)},Ts.prototype.focus=function(s){x(this._fragmentFiber.child,!0,_y,s,void 0,void 0)};function _y(s,r){return s.tag===6?!1:(s=N(s),R3(s,r))}Ts.prototype.focusLast=function(s){var r=[];x(this._fragmentFiber.child,!0,Tm,r,void 0,void 0);for(var o=r.length-1;0<=o&&!_y(r[o],s);o--);};function Tm(s,r){return r.push(s),!1}Ts.prototype.blur=function(){var s=b(this._fragmentFiber);s!==null&&(s=N(s),s=vc(s).activeElement,s!==null&&x(this._fragmentFiber.child,!1,_3,s,void 0,void 0))};function _3(s,r){return s.tag===6?!1:(s=N(s),s===r||s.contains(r)?(r.blur(),!0):!1)}Ts.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),x(this._fragmentFiber.child,!1,w3,s,void 0,void 0)};function w3(s,r){return s.tag===6||(s=N(s),r.observe(s)),!1}Ts.prototype.unobserveUsing=function(s){var r=this._observers;if(r!==null&&r.has(s)){r.delete(s),x(this._fragmentFiber.child,!1,S3,s,void 0,void 0);for(var o=r=0;o<ni.length;o++){var d=ni[o];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):ni[r++]=d}ni.length=r}};function S3(s,r){return s.tag===6||(s=N(s),r.unobserve(s)),!1}var ni=[],Mm=!1;function k3(s,r,o){ni.push({fragmentInstance:s,observer:r,instance:o}),Mm||(Mm=!0,O3(function(){Mm=!1;var d=ni;ni=[];for(var p=0;p<d.length;p++){var g=d[p];g.observer.unobserve(g.instance)}}))}Ts.prototype.getClientRects=function(){var s=[];return x(this._fragmentFiber.child,!1,j3,s,void 0,void 0),s};function j3(s,r){if(s.tag===6){s=s.stateNode;var o=s.ownerDocument.createRange();o.selectNodeContents(s),r.push.apply(r,o.getClientRects())}else s=N(s),r.push.apply(r,s.getClientRects());return!1}Ts.prototype.getRootNode=function(s){var r=b(this._fragmentFiber);return r===null?this:N(r).getRootNode(s)},Ts.prototype.compareDocumentPosition=function(s){var r=b(this._fragmentFiber);if(r===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var o=[];x(this._fragmentFiber.child,!1,Tm,o,void 0,void 0);var d=N(r);if(o.length===0){if(o=d,y(this._fragmentFiber)){e:{for(r=this._fragmentFiber.return;r!==null;){if(r.tag===4){r=r.stateNode.containerInfo;break e}if(r.tag===3||r.tag===5||r.tag===27)break;r=r.return}r=null}r!=null&&(o=r)}r=this._fragmentFiber;var p=d=o.compareDocumentPosition(s);return o===s?p=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(o=_(r)[1],o===null?p=Node.DOCUMENT_POSITION_PRECEDING:(s=N(o).compareDocumentPosition(s),p=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),p|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}r=N(o[0]),p=N(o[o.length-1]);var g=y(this._fragmentFiber)?r.parentElement:d;if(g==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=g.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY,g=g.compareDocumentPosition(p)&Node.DOCUMENT_POSITION_CONTAINED_BY;var w=r.compareDocumentPosition(s),T=p.compareDocumentPosition(s),$=w&Node.DOCUMENT_POSITION_CONTAINED_BY||T&Node.DOCUMENT_POSITION_CONTAINED_BY;return T=d&&g&&w&Node.DOCUMENT_POSITION_FOLLOWING&&T&Node.DOCUMENT_POSITION_PRECEDING,r=d&&r===s||g&&p===s||$||T?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&r===s||!g&&p===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:w,r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||N3(r,this._fragmentFiber,o[0],o[o.length-1],s)?r:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function N3(s,r,o,d,p){var g=Ui(p);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(o=!!g)e:{for(;g!==null;){if(g.tag===7&&(g===r||g.alternate===r)){o=!0;break e}g=g.return}o=!1}return o}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(g===null)return g=p.ownerDocument,p===g||p===g.documentElement||p===g.body;e:{for(g=r,r=b(r);g!==null;){if(!(g.tag!==5&&g.tag!==3&&g.tag!==27||g!==r&&g.alternate!==r)){g=!0;break e}g=g.return}g=!1}return g}return s&Node.DOCUMENT_POSITION_PRECEDING?((r=!!g)&&!(r=g===o)&&(r=R(o,g,O),r===null?r=!1:(x(r,!0,E,g,o),g=S,S=null,r=g!==null)),r):s&Node.DOCUMENT_POSITION_FOLLOWING?((r=!!g)&&!(r=g===d)&&(r=R(d,g,O),r===null?r=!1:(x(r,!0,L,g,d),g=S,C=S=null,r=g!==null)),r):!1}function wy(s,r){var o=s.ownerDocument.createRange();o.selectNodeContents(s),s=o.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,r?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}Ts.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(i(566));var r=[];x(this._fragmentFiber.child,!1,Tm,r,void 0,void 0);var o=s!==!1;if(r.length===0){var d=_(this._fragmentFiber);if(d=o?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=N(d),wy(s,o);return}if(d=N(d),d.nodeType!==9){if(d.nodeType===11){o="host"in d?d.host:null,o!==null&&o.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=o?r.length-1:0;d!==(o?-1:r.length);){var p=r[d];p.tag===6?(p=N(p),wy(p,o)):N(p).scrollIntoView(s),d+=o?-1:1}};function C3(s,r){return s=N(s),Sy(s,r),!1}function Sy(s,r){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(r)}function ky(s,r){var o=r._eventListeners;if(o!==null)for(var d=0;d<o.length;d++){var p=o[d];s.addEventListener(p.type,p.attachedListener,Hl(p.optionsOrUseCapture))}s.nodeType!==3&&(o=r._observers,o!==null&&o.forEach(function(g){for(var w=0,T=0;T<ni.length;T++){var $=ni[T];($.fragmentInstance!==r||$.observer!==g||$.instance!==s)&&(ni[w++]=$)}ni.length=w,g.observe(s)}),Sy(s,r))}function E3(s,r){var o=r._eventListeners;if(o!==null)for(var d=0;d<o.length;d++){var p=o[d];s.removeEventListener(p.type,p.attachedListener,Hl(p.optionsOrUseCapture))}s.nodeType!==3&&(o=r._observers,o!==null&&o.forEach(function(g){typeof g.rootMargin=="string"?k3(r,g,s):g.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(r))}function Am(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Am(o),ul(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}s.removeChild(o)}}function T3(s,r,o,d){for(;s.nodeType===1;){var p=o;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[_a])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==p.rel||s.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||s.getAttribute("title")!==(p.title==null?null:p.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(p.src==null?null:p.src)||s.getAttribute("type")!==(p.type==null?null:p.type)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var g=p.name==null?null:""+p.name;if(p.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=Us(s.nextSibling),s===null)break}return null}function M3(s,r,o){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=Us(s.nextSibling),s===null))return null;return s}function jy(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Us(s.nextSibling),s===null))return null;return s}function Rm(s){return s.data==="$?"||s.data==="$~"}function Om(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function A3(s,r){var o=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||o.readyState!=="loading")r();else{var d=function(){r(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Us(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Lm=null;function Ny(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="/$"||o==="/&"){if(r===0)return Us(s.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}s=s.nextSibling}return null}function Cy(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return s;r--}else o!=="/$"&&o!=="/&"||r++}s=s.previousSibling}return null}function R3(s,r){function o(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",o,!0),(s.focus||HTMLElement.prototype.focus).call(s,r)}finally{s.ownerDocument.removeEventListener("focus",o,!0)}return d}function O3(s){hy(function(){hy(function(r){return s(r)})})}function Ey(s,r,o){switch(r=vc(o),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Ty(s,r,o){for(var d in o){var p=o[d];o.hasOwnProperty(d)&&p!=null&&Rt(s,r,d,null,o3,p)}o.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===Qn&&(s.onclick=null),ul(s)}function Dm(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);ul(s)}var Fs=new Map,My=new Set;function bc(s){if(typeof s.getRootNode=="function"){var r=s.getRootNode();if(r.nodeType===9||r.nodeType===11)return r}return s.nodeType===9?s:s.ownerDocument}var sr=Re.d;Re.d={f:L3,r:D3,D:z3,C:$3,L:B3,m:P3,X:F3,S:U3,M:I3};function L3(){var s=sr.f(),r=$d();return s||r}function D3(s){var r=hi(s);r!==null&&r.tag===5&&r.type==="form"?R1(r):sr.r(s)}var ql=typeof document>"u"?null:document;function Ay(s,r,o){var d=ql;if(d&&typeof r=="string"&&r){var p=os(r);p='link[rel="'+s+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),My.has(p)||(My.add(p),s={rel:s,crossOrigin:o,href:r},d.querySelector(p)===null&&(r=d.createElement("link"),$n(r,"link",s),ln(r),d.head.appendChild(r)))}}function z3(s){sr.D(s),Ay("dns-prefetch",s,null)}function $3(s,r){sr.C(s,r),Ay("preconnect",s,r)}function B3(s,r,o){sr.L(s,r,o);var d=ql;if(d&&s&&r){var p='link[rel="preload"][as="'+os(r)+'"]';r==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+os(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+os(o.imageSizes)+'"]')):p+='[href="'+os(s)+'"]';var g=p;switch(r){case"style":g=Vl(s);break;case"script":g=Gl(s)}if(!(Fs.has(g)||(s=F({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:s,as:r},o),Fs.set(g,s),d.querySelector(p)!==null||r==="style"&&d.querySelector(yc(g))||r==="script"&&d.querySelector(_c(g))))){var w=d.createElement("link");$n(w,"link",s),r==="style"&&(w[cl]=!0,w.onload=w.onerror=function(){ws(w)}),ln(w),d.head.appendChild(w)}}}function P3(s,r){sr.m(s,r);var o=ql;if(o&&s){var d=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+os(d)+'"][href="'+os(s)+'"]',g=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Gl(s)}if(!Fs.has(g)&&(s=F({rel:"modulepreload",href:s},r),Fs.set(g,s),o.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(_c(g)))return}d=o.createElement("link"),$n(d,"link",s),ln(d),o.head.appendChild(d)}}}function U3(s,r,o){sr.S(s,r,o);var d=ql;if(d&&s){var p=ls(d).hoistableStyles,g=Vl(s);r=r||"default";var w=p.get(g);if(!w){var T={loading:0,preload:null};if(w=d.querySelector(yc(g)))T.loading=5;else{s=F({rel:"stylesheet",href:s,"data-precedence":r},o),(o=Fs.get(g))&&zm(s,o);var $=w=d.createElement("link");ln($),$n($,"link",s),$._p=new Promise(function(J,le){$.onload=J,$.onerror=le}),$.addEventListener("load",function(){T.loading|=1}),$.addEventListener("error",function(){T.loading|=2}),T.loading|=4,qd(w,r,d)}w={type:"stylesheet",instance:w,count:1,state:T},p.set(g,w)}}}function F3(s,r){sr.X(s,r);var o=ql;if(o&&s){var d=ls(o).hoistableScripts,p=Gl(s),g=d.get(p);g||(g=o.querySelector(_c(p)),g||(s=F({src:s,async:!0},r),(r=Fs.get(p))&&$m(s,r),g=o.createElement("script"),ln(g),$n(g,"link",s),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(p,g))}}function I3(s,r){sr.M(s,r);var o=ql;if(o&&s){var d=ls(o).hoistableScripts,p=Gl(s),g=d.get(p);g||(g=o.querySelector(_c(p)),g||(s=F({src:s,async:!0,type:"module"},r),(r=Fs.get(p))&&$m(s,r),g=o.createElement("script"),ln(g),$n(g,"link",s),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(p,g))}}function Ry(s,r,o,d){var p=(p=ne.current)?bc(p):null;if(!p)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(o=Vl(o.href),r=ls(p).hoistableStyles,d=r.get(o),d||(d={type:"style",instance:null,count:0,state:null},r.set(o,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){s=Vl(o.href);var g=ls(p).hoistableStyles,w=g.get(s);if(w||(p=p.ownerDocument||p,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,w),(g=p.querySelector(yc(s)))?g._p||(w.instance=g,w.state.loading=5):(g=Fs.get(s),g||(g={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Fs.set(s,g)),H3(p,s,g,w.state))),r&&d===null)throw Error(i(528,""));return w}if(r&&d!==null)throw Error(i(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(o=Gl(o),r=ls(p).hoistableScripts,d=r.get(o),d||(d={type:"script",instance:null,count:0,state:null},r.set(o,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Vl(s){return'href="'+os(s)+'"'}function yc(s){return'link[rel="stylesheet"]['+s+"]"}function Oy(s){return F({},s,{"data-precedence":s.precedence,precedence:null})}function H3(s,r,o,d){if(r=s.querySelector('link[rel="preload"][as="style"]['+r+"]")){if(r[cl]!==!0){d.loading=1;return}}else r=s.createElement("link"),r[cl]=!0,r.onload=r.onerror=ws.bind(null,r),$n(r,"link",o),ln(r),s.head.appendChild(r);d.preload=r,r.addEventListener("load",function(){return d.loading|=1}),r.addEventListener("error",function(){return d.loading|=2})}function Gl(s){return'[src="'+os(s)+'"]'}function _c(s){return"script[async]"+s}function Ly(s,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+os(o.href)+'"]');if(d)return r.instance=d,ln(d),d;var p=F({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),ln(d),$n(d,"style",p),qd(d,o.precedence,s),r.instance=d;case"stylesheet":p=Vl(o.href);var g=s.querySelector(yc(p));if(g)return r.state.loading|=4,r.instance=g,ln(g),g;d=Oy(o),(p=Fs.get(p))&&zm(d,p),g=(s.ownerDocument||s).createElement("link"),ln(g);var w=g;return w._p=new Promise(function(T,$){w.onload=T,w.onerror=$}),$n(g,"link",d),r.state.loading|=4,qd(g,o.precedence,s),r.instance=g;case"script":return g=Gl(o.src),(p=s.querySelector(_c(g)))?(r.instance=p,ln(p),p):(d=o,(p=Fs.get(g))&&(d=F({},o),$m(d,p)),s=s.ownerDocument||s,p=s.createElement("script"),ln(p),$n(p,"link",d),s.head.appendChild(p),r.instance=p);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(d=r.instance,r.state.loading|=4,qd(d,o.precedence,s));return r.instance}function qd(s,r,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=d.length?d[d.length-1]:null,g=p,w=0;w<d.length;w++){var T=d[w];if(T.dataset.precedence===r)g=T;else if(g!==p)break}g?g.parentNode.insertBefore(s,g.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(s,r.firstChild))}function zm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function $m(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Vd=null;function Dy(s,r,o){if(Vd===null){var d=new Map,p=Vd=new Map;p.set(o,d)}else p=Vd,d=p.get(o),d||(d=new Map,p.set(o,d));if(d.has(s))return d;for(d.set(s,null),o=o.getElementsByTagName(s),p=0;p<o.length;p++){var g=o[p];if(!(g[_a]||g[dn]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var w=g.getAttribute(r)||"";w=s+w;var T=d.get(w);T?T.push(g):d.set(w,[g])}}return d}function Bm(s,r,o){s=s.ownerDocument||s,s.head.insertBefore(o,r==="title"?s.querySelector("head > title"):null)}function q3(s,r,o){if(o===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function zy(s,r){return s==="img"&&r.src!=null&&r.src!==""&&r.onLoad==null&&r.loading!=="lazy"}function $y(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function By(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Py(s,r){typeof r.decode=="function"&&(s.imgCount++,r.complete||(s.imgBytes+=By(r),s.suspenseyImages.push(r)),s=Y3.bind(s),r.decode().then(s,s))}function V3(s,r,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=Vl(d.href),g=r.querySelector(yc(p));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=wc.bind(s),r.then(s,s)),o.state.loading|=4,o.instance=g,ln(g);return}g=r.ownerDocument||r,d=Oy(d),(p=Fs.get(p))&&zm(d,p),g=g.createElement("link"),ln(g);var w=g;w._p=new Promise(function(T,$){w.onload=T,w.onerror=$}),$n(g,"link",d),o.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(s.count++,o=wc.bind(s),r.addEventListener("load",o),r.addEventListener("error",o))}}var Gd=0;function G3(s,r){return s.stylesheets&&s.count===0&&Xd(s,s.stylesheets),0<s.count||0<s.imgCount?function(o){var d=setTimeout(function(){if(s.stylesheets&&Xd(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+r);0<s.imgBytes&&Gd===0&&(Gd=62500*u3());var p=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Xd(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>Gd?50:800)+r);return s.unsuspend=o,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(p)}}:null}function Uy(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)Xd(s,s.stylesheets);else if(s.unsuspend){var r=s.unsuspend;s.unsuspend=null,r()}}}function wc(){this.count--,Uy(this)}function Y3(){this.imgCount--,Uy(this)}var Yd=null;function Xd(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Yd=new Map,r.forEach(X3,s),Yd=null,wc.call(s))}function X3(s,r){if(!(r.state.loading&4)){var o=Yd.get(s);if(o)var d=o.get(null);else{o=new Map,Yd.set(s,o);for(var p=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<p.length;g++){var w=p[g];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}p=r.instance,w=p.getAttribute("data-precedence"),g=o.get(w)||d,g===d&&o.set(null,p),o.set(w,p),this.count++,d=wc.bind(this),p.addEventListener("load",d),p.addEventListener("error",d),g?g.parentNode.insertBefore(p,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(p,s.firstChild)),r.state.loading|=4}}var Yl={$$typeof:K,Provider:null,Consumer:null,_currentValue:Ut,_currentValue2:Ut,_threadCount:0};function Q3(s,r,o,d,p,g,w,T,$){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=Pi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pi(0),this.hiddenUpdates=Pi(null),this.identifierPrefix=d,this.onUncaughtError=p,this.onCaughtError=g,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.transitionTypes=null,this.incompleteTransitions=new Map}function Fy(s,r,o,d,p,g,w,T,$,J,le,pe){return s=new Q3(s,r,o,w,$,J,le,pe,T),r=1,g===!0&&(r|=24),g=cs(3,null,null,r),s.current=g,g.stateNode=s,r=Jh(),r.refCount++,s.pooledCache=r,r.refCount++,g.memoizedState={element:d,isDehydrated:o,cache:r},sp(g),s}function Iy(s){return s?(s=bl,s):bl}function Hy(s,r,o,d,p,g){p=Iy(p),d.context===null?d.context=p:d.pendingContext=p,d=Dr(r),d.payload={element:o},g=g===void 0?null:g,g!==null&&(d.callback=g),o=zr(s,d,r),o!==null&&(hs(o,s,r),Jo(o,s,r))}function qy(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var o=s.retryLane;s.retryLane=o!==0&&o<r?o:r}}function Pm(s,r){qy(s,r),(s=s.alternate)&&qy(s,r)}function Vy(s){if(s.tag===13||s.tag===31){var r=Na(s,67108864);r!==null&&hs(r,s,67108864),Pm(s,67108864)}}function Gy(s){if(s.tag===13||s.tag===31){var r=Es();r=To(r);var o=Na(s,r);o!==null&&hs(o,s,r),Pm(s,r)}}var Xl=!0;function K3(s,r,o,d){var p=Ee.T;Ee.T=null;var g=Re.p;try{Re.p=2,Um(s,r,o,d)}finally{Re.p=g,Ee.T=p}}function W3(s,r,o,d){var p=Ee.T;Ee.T=null;var g=Re.p;try{Re.p=8,Um(s,r,o,d)}finally{Re.p=g,Ee.T=p}}function Um(s,r,o,d){if(Xl){var p=Fm(d);if(p===null)_m(s,r,d,Qd,o),Xy(s,d);else if(J3(p,s,r,o,d))d.stopPropagation();else if(Xy(s,d),r&4&&-1<Z3.indexOf(s)){for(;p!==null;){var g=hi(p);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var w=Ys(g.pendingLanes);if(w!==0){var T=g;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var $=1<<31-en(w);T.entanglements[1]|=$,w&=~$}ji(g),(Et&6)===0&&(Ld=sn()+500,mc(0))}}break;case 31:case 13:T=Na(g,2),T!==null&&hs(T,g,2),$d(),Pm(g,2)}if(g=Fm(d),g===null&&_m(s,r,d,Qd,o),g===p)break;p=g}p!==null&&d.stopPropagation()}else _m(s,r,d,null,o)}}function Fm(s){return s=jr(s),Im(s)}var Qd=null;function Im(s){if(Qd=null,s=Ui(s),s!==null){var r=c(s);if(r===null)s=null;else{var o=r.tag;if(o===13){if(s=u(r),s!==null)return s;s=null}else if(o===31){if(s=f(r),s!==null)return s;s=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return Qd=s,null}function Yy(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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(vr()){case $i:return 2;case oe:return 8;case ve:case we:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Hm=!1,Xr=null,Qr=null,Kr=null,Sc=new Map,kc=new Map,Wr=[],Z3="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 Xy(s,r){switch(s){case"focusin":case"focusout":Xr=null;break;case"dragenter":case"dragleave":Qr=null;break;case"mouseover":case"mouseout":Kr=null;break;case"pointerover":case"pointerout":Sc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":kc.delete(r.pointerId)}}function jc(s,r,o,d,p,g){return s===null||s.nativeEvent!==g?(s={blockedOn:r,domEventName:o,eventSystemFlags:d,nativeEvent:g,targetContainers:[p]},r!==null&&(r=hi(r),r!==null&&Vy(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),s)}function J3(s,r,o,d,p){switch(r){case"focusin":return Xr=jc(Xr,s,r,o,d,p),!0;case"dragenter":return Qr=jc(Qr,s,r,o,d,p),!0;case"mouseover":return Kr=jc(Kr,s,r,o,d,p),!0;case"pointerover":var g=p.pointerId;return Sc.set(g,jc(Sc.get(g)||null,s,r,o,d,p)),!0;case"gotpointercapture":return g=p.pointerId,kc.set(g,jc(kc.get(g)||null,s,r,o,d,p)),!0}return!1}function Qy(s){var r=Ui(s.target);if(r!==null){var o=c(r);if(o!==null){if(r=o.tag,r===13){if(r=u(o),r!==null){s.blockedOn=r,as(s.priority,function(){Gy(o)});return}}else if(r===31){if(r=f(o),r!==null){s.blockedOn=r,as(s.priority,function(){Gy(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){s.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Kd(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var o=Fm(s.nativeEvent);if(o===null){o=s.nativeEvent;var d=new o.constructor(o.type,o);kr=d,o.target.dispatchEvent(d),kr=null}else return r=hi(o),r!==null&&Vy(r),s.blockedOn=o,!1;r.shift()}return!0}function Ky(s,r,o){Kd(s)&&o.delete(r)}function eE(){Hm=!1,Xr!==null&&Kd(Xr)&&(Xr=null),Qr!==null&&Kd(Qr)&&(Qr=null),Kr!==null&&Kd(Kr)&&(Kr=null),Sc.forEach(Ky),kc.forEach(Ky)}function Wd(s,r){s.blockedOn===r&&(s.blockedOn=null,Hm||(Hm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,eE)))}var Zd=null;function Wy(s){Zd!==s&&(Zd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Zd===s&&(Zd=null);for(var r=0;r<s.length;r+=3){var o=s[r],d=s[r+1],p=s[r+2];if(typeof d!="function"){if(Im(d||o)===null)continue;break}var g=hi(o);g!==null&&(s.splice(r,3),r-=3,kp(g,{pending:!0,data:p,method:o.method,action:d},d,p))}}))}function Ql(s){function r($){return Wd($,s)}Xr!==null&&Wd(Xr,s),Qr!==null&&Wd(Qr,s),Kr!==null&&Wd(Kr,s),Sc.forEach(r),kc.forEach(r);for(var o=0;o<Wr.length;o++){var d=Wr[o];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Wr.length&&(o=Wr[0],o.blockedOn===null);)Qy(o),o.blockedOn===null&&Wr.shift();if(o=(s.ownerDocument||s).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var p=o[d],g=o[d+1],w=p[Cn]||null;if(typeof g=="function")w||Wy(o);else if(w){var T=null;if(g&&g.hasAttribute("formAction")){if(p=g,w=g[Cn]||null)T=w.formAction;else if(Im(p)!==null)continue}else T=w.action;typeof T=="function"?o[d+1]=T:(o.splice(d,3),d-=3),Wy(o)}}}function Zy(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(w){return p=w})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,p=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function qm(s){this._internalRoot=s}Jd.prototype.render=qm.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var o=r.current,d=Es();Hy(o,d,s,r,null,null)},Jd.prototype.unmount=qm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;Hy(s.current,2,null,s,null,null),$d(),r[fi]=null}};function Jd(s){this._internalRoot=s}Jd.prototype.unstable_scheduleHydration=function(s){if(s){var r=ya();s={blockedOn:null,target:s,priority:r};for(var o=0;o<Wr.length&&r!==0&&r<Wr[o].priority;o++);Wr.splice(o,0,s),o===0&&Qy(s)}};var Jy=t.version;if(Jy!=="19.3.0")throw Error(i(527,Jy,"19.3.0"));Re.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=m(r),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var tE={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:Ee,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ef=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ef.isDisabled&&ef.supportsFiber)try{Nn=ef.inject(tE),xt=ef}catch{}}return Cc.createRoot=function(s,r){if(!a(s))throw Error(i(299));var o=!1,d="",p=I1,g=H1,w=q1;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=Fy(s,1,!1,null,null,o,d,null,p,g,w,Zy),s[fi]=r.current,ym(s),new qm(r)},Cc.hydrateRoot=function(s,r,o){if(!a(s))throw Error(i(299));var d=!1,p="",g=I1,w=H1,T=q1,$=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(g=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(T=o.onRecoverableError),o.formState!==void 0&&($=o.formState)),r=Fy(s,1,!0,r,o??null,d,p,$,g,w,T,Zy),r.context=Iy(null),o=r.current,d=Es(),d=To(d),p=Dr(d),p.callback=null,zr(o,p,d),o=d,r.current.lanes=o,ui(r,o),ji(r),s[fi]=r.current,ym(s),new Jd(r)},Cc.version="19.3.0",Cc}var d_;function pE(){if(d_)return Ym.exports;d_=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(),Ym.exports=hE(),Ym.exports}var mE=pE();const f_=e=>{let t;const n=new Set,i=(m,v)=>{const x=typeof m=="function"?m(t):m;if(!Object.is(x,t)){const b=t;t=v??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,f={setState:i,getState:a,getInitialState:()=>h,subscribe:m=>(n.add(m),()=>n.delete(m))},h=t=e(i,a,f);return f},gE=(e=>e?f_(e):f_),xE=e=>e;function vE(e,t=xE){const n=tf.useSyncExternalStore(e.subscribe,tf.useCallback(()=>t(e.getState()),[e,t]),tf.useCallback(()=>t(e.getInitialState()),[e,t]));return tf.useDebugValue(n),n}const h_=e=>{const t=gE(e),n=i=>vE(t,i);return Object.assign(n,t),n},bE=(e=>e?h_(e):h_),l0="companion_auth_token";function p_(){return typeof window>"u"?null:localStorage.getItem(l0)||null}const yE=e=>({authToken:p_(),isAuthenticated:p_()!==null,setAuthToken:t=>{localStorage.setItem(l0,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(l0),e({authToken:null,isAuthenticated:!1})}});function Vt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function _E(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function wE(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function SE(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function kE(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const jE=e=>({sessions:new Map,sdkSessions:[],currentSessionId:SE(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:wE(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:kE(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),c=a.get(t);return c&&a.set(t,{...c,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=Vt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Vt(n.sessions,t),connectionStatus:Vt(n.connectionStatus,t),cliConnected:Vt(n.cliConnected,t),cliReconnecting:Vt(n.cliReconnecting,t),sessionStatus:Vt(n.sessionStatus,t),previousPermissionMode:Vt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:_E(n.recentlyRenamed,t),mcpServers:Vt(n.mcpServers,t),rateLimit:Vt(n.rateLimit,t),prStatus:Vt(n.prStatus,t),linkedLinearIssues:Vt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Vt(n.messages,t),streaming:Vt(n.streaming,t),streamingStartedAt:Vt(n.streamingStartedAt,t),streamingOutputTokens:Vt(n.streamingOutputTokens,t),pendingPermissions:Vt(n.pendingPermissions,t),aiResolvedPermissions:Vt(n.aiResolvedPermissions,t),sessionTasks:Vt(n.sessionTasks,t),changedFilesTick:Vt(n.changedFilesTick,t),gitChangedFilesCount:Vt(n.gitChangedFilesCount,t),sessionProcesses:Vt(n.sessionProcesses,t),toolProgress:Vt(n.toolProgress,t),toolActivity:Vt(n.toolActivity,t),diffPanelSelectedFile:Vt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Vt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const a=new Map(i.sessions),c=a.get(t);return c?(a.set(t,{...c,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(i=>{const a=new Map(i.sessions),c=a.get(t);return c?(a.set(t,{...c,magicUiActive:n}),{sessions:a}):{}})}),NE=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const c=new Map(i.messages);return c.set(t,[...a,n]),{messages:c}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),c=[...a.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return a.set(t,c),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),c=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),c.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:c}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),CE=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),c=new Map(a.get(t)||[]);return c.set(n.request_id,n),a.set(t,c),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),c=[...a.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),a.set(t,c),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),EE=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const a=new Map(i.sessionTasks),c=[...a.get(t)||[],n];return a.set(t,c),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const c=new Map(a.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),c=[...a.get(t)||[],n];return a.set(t,c),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),c=[...a.get(t)||[],n];return a.set(t,c),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const c=new Map(a.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const c=new Map(a.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,i),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),c=[...a.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return a.set(t,c),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const c=new Map(a.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:c}})}),mr=[{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"]}],TE=mr.map(e=>e.id),y2="cc-task-panel-config";function o0(){return{order:[...TE],enabled:Object.fromEntries(mr.map(e=>[e.id,!0]))}}function ME(){if(typeof window>"u")return o0();try{const e=localStorage.getItem(y2);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of mr)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(mr.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return o0()}function nf(e){try{localStorage.setItem(y2,JSON.stringify(e))}catch{}}function AE(){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 RE(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function OE(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function _2(){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 LE(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const DE=e=>({darkMode:AE(),notificationSound:RE(),notificationDesktop:OE(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:ME(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:_2(),density:LE(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setMagicUiAvailable:t=>e({magicUiAvailable:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return nf(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const c={...n.taskPanelConfig,order:i};return nf(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const c={...n.taskPanelConfig,order:i};return nf(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=o0();nf(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})},setDensity:t=>{typeof window<"u"&&localStorage.setItem("cc-density",t),e({density:t})},toggleDensity:()=>e(t=>{const n=t.density==="compact"?"standard":"compact";return typeof window<"u"&&localStorage.setItem("cc-density",n),{density:n}})});function w2(){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 zE=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:w2(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const m=n.quickTerminalTabs.find(v=>v.cwd===t.cwd&&v.containerId===t.containerId);if(m)return{quickTerminalOpen:!0,activeQuickTerminalTabId:m.id}}const i=t.target==="docker",a=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=i?a:a+1,f=i?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${c}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var c;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((c=i[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function $E(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const BE=e=>({updateInfo:null,updateDismissedVersion:$E(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],a=i.findIndex(c=>c.step===t.step);if(a>=0){const c=[...i];return c[a]=t,{creationProgress:c}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),PE=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(i=>{const a=i.magicUiState.get(t);if(a&&a.version>n.version)return{};const c=new Map(i.magicUiState);return c.set(t,n),{magicUiState:c}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const i=new Map(n.magicUiState);return i.delete(t),{magicUiState:i}})}),Q=bE((...e)=>({...yE(...e),...jE(...e),...NE(...e),...CE(...e),...EE(...e),...DE(...e),...zE(...e),...BE(...e),...PE(...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:_2(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:w2(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),UE=Object.freeze(Object.defineProperty({__proto__:null,useStore:Q},Symbol.toStringTag,{value:"Module"})),FE="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",IE=/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 HE(e){return IE.test(e)}function qE(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:HE(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const m_=["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"],g_=["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 x_(){const e=m_[Math.floor(Math.random()*m_.length)],t=g_[Math.floor(Math.random()*g_.length)];return`${e} ${t}`}function S2(e){for(let t=0;t<100;t++){const n=x_();if(!e.has(n))return n}return x_()}let Wm=null;function VE(){return Wm||(Wm=new AudioContext),Wm}function GE(){try{const e=VE();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),c=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(c),c.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class k2{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const c=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(c,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,a)}diffWithOptionsObj(t,n,i,a){var c;const u=C=>{if(C=this.postProcess(C,i),a){setTimeout(function(){a(C)},0);return}else return C},f=n.length,h=t.length;let m=1,v=f+h;i.maxEditLength!=null&&(v=Math.min(v,i.maxEditLength));const x=(c=i.timeout)!==null&&c!==void 0?c:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const S=()=>{for(let C=Math.max(j,-m);C<=Math.min(N,m);C+=2){let E;const L=y[C-1],O=y[C+1];L&&(y[C-1]=void 0);let R=!1;if(O){const D=O.oldPos-C;R=O&&0<=D&&D<f}const F=L&&L.oldPos+1<h;if(!R&&!F){y[C]=void 0;continue}if(!F||R&&L.oldPos<O.oldPos?E=this.addToPath(O,!0,!1,0,i):E=this.addToPath(L,!1,!0,1,i),_=this.extractCommon(E,n,t,C,i),E.oldPos+1>=h&&_+1>=f)return u(this.buildValues(E.lastComponent,n,t))||!0;y[C]=E,E.oldPos+1>=h&&(N=Math.min(N,C-1)),_+1>=f&&(j=Math.max(j,C+1))}m++};if(a)(function C(){setTimeout(function(){if(m>v||Date.now()>b)return a(void 0);S()||C()},0)})();else for(;m<=v&&Date.now()<=b;){const C=S();if(C)return C}}addToPath(t,n,i,a,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,c){const u=n.length,f=i.length;let h=t.oldPos,m=h-a,v=0;for(;m+1<u&&h+1<f&&this.equals(i[h+1],n[m+1],c);)m++,h++,v++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return v&&!c.oneChangePerToken&&(t.lastComponent={count:v,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,m}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const a=[];let c;for(;t;)a.push(t),c=t.previousComponent,delete t.previousComponent,t=c;a.reverse();const u=a.length;let f=0,h=0,m=0;for(;f<u;f++){const v=a[f];if(v.removed)v.value=this.join(i.slice(m,m+v.count)),m+=v.count;else{if(!v.added&&this.useLongestToken){let x=n.slice(h,h+v.count);x=x.map(function(b,y){const _=i[m+y];return _.length>b.length?_:b}),v.value=this.join(x)}else v.value=this.join(n.slice(h,h+v.count));h+=v.count,v.added||(m+=v.count)}}return a}}function v_(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 b_(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 c0(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 u0(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 Ec(e,t){return c0(e,t,"")}function sf(e,t){return u0(e,t,"")}function y_(e,t){return t.slice(0,YE(e,t))}function YE(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const a=Array(i);let c=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[c]?a[u]=a[c]:a[u]=c;c>0&&t[u]!=t[c];)c=a[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=a[c];e[u]==t[c]&&c++}return c}function j2(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function d0(e,t){if(t)return Yc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ro(e,t){if(t)return Yc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Yc(e,t){if(!t)return[ro(e),d0(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=j2(e,t),i=n[0],a=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[c,u]}const __="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}",XE=new RegExp(`[${__}]+|\\s+|[^${__}]`,"ug");class QE extends k2{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=j2(t,u)}else i=t.match(XE)||[];const a=[];let c=null;return i.forEach(u=>{/\s/.test(u)?c==null?a.push(u):a.push(a.pop()+u):c!=null&&/\s/.test(c)?a[a.length-1]==c?a.push(a.pop()+u):a.push(c+u):a.push(u),c=u}),a}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,a=null,c=null;return t.forEach(u=>{u.added?a=u:u.removed?c=u:((a||c)&&w_(i,c,a,u,n.intlSegmenter),i=u,a=null,c=null)}),(a||c)&&w_(i,c,a,null,n.intlSegmenter),t}}const KE=new QE;function WE(e,t,n){return KE.diff(e,t,n)}function w_(e,t,n,i,a){if(t&&n){const[c,u]=Yc(t.value,a),[f,h]=Yc(n.value,a);if(e){const m=v_(c,f);e.value=u0(e.value,f,m),t.value=Ec(t.value,m),n.value=Ec(n.value,m)}if(i){const m=b_(u,h);i.value=c0(i.value,h,m),t.value=sf(t.value,m),n.value=sf(n.value,m)}}else if(n){if(e){const c=ro(n.value,a);n.value=n.value.substring(c.length)}if(i){const c=ro(i.value,a);i.value=i.value.substring(c.length)}}else if(e&&i){const c=ro(i.value,a),[u,f]=Yc(t.value,a),h=v_(c,u);t.value=Ec(t.value,h);const m=b_(Ec(c,h),f);t.value=sf(t.value,m),i.value=c0(i.value,c,m),e.value=u0(e.value,c,c.slice(0,c.length-m.length))}else if(i){const c=ro(i.value,a),u=d0(t.value,a),f=y_(u,c);t.value=sf(t.value,f)}else if(e){const c=d0(e.value,a),u=ro(t.value,a),f=y_(c,u);t.value=Ec(t.value,f)}}class ZE extends k2{constructor(){super(...arguments),this.tokenize=e4}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
51
|
-
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
52
|
-
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
53
|
-
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
54
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const JE=new ZE;function S_(e,t,n){return JE.diff(e,t,n)}function e4(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
55
|
-
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let a=0;a<i.length;a++){const c=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=c:n.push(c)}return n}function t4(e,t,n,i,a,c,u){let f;u?typeof u=="function"?f={callback:u}:f=u:f={},typeof f.context>"u"&&(f.context=4);const h=f.context;if(f.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(f.callback){const{callback:v}=f;S_(n,i,Object.assign(Object.assign({},f),{callback:x=>{const b=m(x);v(b)}}))}else return m(S_(n,i,f));function m(v){if(!v)return;v.push({value:"",lines:[]});function x(C){return C.map(function(E){return" "+E})}const b=[];let y=0,_=0,j=[],N=1,S=1;for(let C=0;C<v.length;C++){const E=v[C],L=E.lines||n4(E.value);if(E.lines=L,E.added||E.removed){if(!y){const O=v[C-1];y=N,_=S,O&&(j=h>0?x(O.lines.slice(-h)):[],y-=j.length,_-=j.length)}for(const O of L)j.push((E.added?"+":"-")+O);E.added?S+=L.length:N+=L.length}else{if(y)if(L.length<=h*2&&C<v.length-2)for(const O of x(L))j.push(O);else{const O=Math.min(L.length,h);for(const F of x(L.slice(0,O)))j.push(F);const R={oldStart:y,oldLines:N-y+O,newStart:_,newLines:S-_+O,lines:j};b.push(R),y=0,_=0,j=[]}N+=L.length,S+=L.length}}for(const C of b)for(let E=0;E<C.lines.length;E++)C.lines[E].endsWith(`
|
|
56
|
-
`)?C.lines[E]=C.lines[E].slice(0,-1):(C.lines.splice(E+1,0,"\"),E++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:c,hunks:b}}}function n4(e){const t=e.endsWith(`
|
|
57
|
-
`),n=e.split(`
|
|
58
|
-
`).map(i=>i+`
|
|
59
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function s4(e,t){return t4("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,c=[];let u=i.oldStart,f=i.newStart;for(const h of i.lines){const m=h[0],v=h.slice(1);m==="-"?c.push({type:"del",content:v,oldLineNo:u++}):m==="+"?c.push({type:"add",content:v,newLineNo:f++}):c.push({type:"context",content:v,oldLineNo:u++,newLineNo:f++})}return N2(c),{header:a,lines:c}})}function i4(e){const t=[],n=e.split(`
|
|
60
|
-
`);let i=null,a=null,c=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){a&&i&&i.hunks.push(a),i&&t.push(i),i={fileName:"",hunks:[]},a=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){i&&(i.fileName=f.slice(6));continue}if(f.startsWith("+++ /dev/null")||f.startsWith("index ")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from")||f.startsWith("rename to")||f.startsWith("similarity index")||f.startsWith("Binary files"))continue;const h=f.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(h){a&&i&&i.hunks.push(a),c=parseInt(h[1],10),u=parseInt(h[2],10),a={header:f,lines:[]};continue}a&&(f.startsWith("+")?a.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?a.lines.push({type:"del",content:f.slice(1),oldLineNo:c++}):f.startsWith(" ")&&a.lines.push({type:"context",content:f.slice(1),oldLineNo:c++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const f of t)for(const h of f.hunks)N2(h.lines);return t}function N2(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const c=t,u=i-n,f=c-a;if(u>0&&f>0){const h=Math.min(u,f);for(let m=0;m<h;m++){const v=e[n+m],x=e[a+m],b=WE(v.content,x.content);v.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 r4({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 a4({hunk:e,showLineNumbers:t}){return l.jsxs("div",{className:"diff-hunk",children:[l.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>l.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),l.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),l.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),l.jsxs("span",{className:"diff-content",children:[l.jsx(r4,{line:n}),!n.content&&" "]})]},i))]})}function l4({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return l.jsxs("div",{className:"diff-file-header",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&l.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function wo({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const c=a==="compact",u=!c,f=k.useMemo(()=>{if(n)return i4(n);const h=e??"",m=t??"";if(!h&&!m)return[];const v=s4(h,m);return[{fileName:i||"",hunks:v}]},[e,t,n,i]);return f.length===0||f.every(h=>h.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${c?"diff-compact":"diff-full"}`,children:f.map((h,m)=>l.jsxs("div",{className:"diff-file",children:[(h.fileName||i)&&l.jsx(l4,{fileName:h.fileName||i||""}),h.hunks.map((v,x)=>l.jsx(a4,{hunk:v,showLineNumbers:u},x))]},m))})}const C2=k.createContext(null);function jB({value:e,children:t}){return l.jsx(C2.Provider,{value:e,children:t})}function o4(){const e=k.useContext(C2),t=Q(n=>n.density);return e??t}function pa(){return o4()==="compact"}function fh({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:c=""}){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 ${c}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const c4={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 So(e){return c4[e]||"tool"}function Ri(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 E2({name:e,input:t,toolUseId:n}){const[i,a]=k.useState(e==="Edit"),c=So(e),u=Ri(e),f=po(e,t);return e==="Edit"?l.jsx(u4,{input:t,toolUseId:n}):e==="Bash"?l.jsx(d4,{input:t,toolUseId:n}):l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[l.jsxs("button",{onClick:()=>a(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(sl,{type:c}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),i&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(f4,{name:e,input:t})})})]})}function u4({input:e,toolUseId:t}){const n=pa(),[i,a]=k.useState(!1),c=String(e.file_path||""),u=c?c.split("/").pop()||c:"",f=String(e.old_string||""),h=String(e.new_string||""),m=!!(f||h),v=!!e.replace_all,[x,b]=k.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(C=>({path:typeof C.path=="string"?C.path:"",kind:typeof C.kind=="string"?C.kind:"update"})).filter(C=>C.path),j=(f+h).split(`
|
|
61
|
-
`).length,N=j>15,S=l.jsx(l.Fragment,{children:m?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!x?"max-h-[240px]":""}`,children:l.jsx(wo,{oldText:f,newText:h,mode:"compact"})}),N&&!x&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),N&&l.jsx("button",{type:"button",onClick:()=>b(!x),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:x?"Show less":`Show all ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((C,E)=>{const L=C.path.split("/").pop()||C.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${C.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":C.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:C.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:L})]},`${C.path}-${E}`)})}):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(fh,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${v?" (all)":""}`,meta:m?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),i&&l.jsx("div",{className:"mt-0.5",children:S})]}):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}),v&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),S]})}function d4({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=pa(),[c,u]=k.useState(!1);if(a){const f=n.split(`
|
|
62
|
-
`)[0]||"",h=i||f||"Command",m=n?n.split(`
|
|
63
|
-
`).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(fh,{open:c,onToggle:()=>u(!c),marker:"$",label:h,meta:!c&&m>0?`+${m}`:void 0,labelClassName:i?"italic":"font-mono-code"}),c&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function f4({name:e,input:t}){switch(e){case"Bash":return l.jsx(h4,{input:t});case"Edit":return l.jsx(p4,{input:t});case"Write":return l.jsx(m4,{input:t});case"Read":return l.jsx(g4,{input:t});case"Glob":return l.jsx(x4,{input:t});case"Grep":return l.jsx(v4,{input:t});case"WebSearch":case"web_search":return l.jsx(b4,{input:t});case"WebFetch":return l.jsx(y4,{input:t});case"Task":return l.jsx(_4,{input:t});case"TodoWrite":return l.jsx(w4,{input:t});case"NotebookEdit":return l.jsx(S4,{input:t});case"SendMessage":return l.jsx(k4,{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 h4({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 p4({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),c=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?l.jsx(wo,{oldText:n,newText:i,fileName:t,mode:"compact"}):c.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}),c.map((u,f)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function m4({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(wo,{newText:n,fileName:t,mode:"compact"})}function g4({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),i!=null&&l.jsxs("span",{children:["limit: ",i]})]})]})}function x4({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 v4({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 b4({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 y4({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 _4({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 w4({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function S4({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),i&&l.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function k4({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 po(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+i;return a.length>60?a.slice(0,60)+"...":a}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function sl({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 j4=2e3,N4=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"]),oi=new Map,pr=new Map,$f=new Map,jf=new Map,sa=new Map,Xc=new Map,cu=new Map,Bf=new Map;function T2(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function M2(e){const t=Q.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function C4(){const e=Q.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 uu=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){uu=!0;for(const[e,t]of pr)clearTimeout(t),pr.delete(e)}else{uu=!1;for(const e of C4()){if(!M2(e))continue;const t=oi.get(e);if(!T2(t)){if(t){try{t.close()}catch{}oi.delete(e)}Su(e)}}}});function Nf(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const a of n)if(!(!a||a===".")){if(a===".."){i.length>0&&i.pop();continue}i.push(a)}return`${t?"/":""}${i.join("/")}`}function E4(e,t){return e.startsWith("/")||!t?Nf(e):Nf(`${t}/${e}`)}function T4(e,t){if(!t)return!0;const n=Nf(t);return e===n||e.startsWith(`${n}/`)}function M4(e){let t=Bf.get(e);return t||(t=new Set,Bf.set(e,t)),t}function Zm(e,t){const n=Q.getState(),i=M4(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:c,input:u,id:f}=a;if(f){if(i.has(f))continue;i.add(f)}if(c==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const m=h.map((v,x)=>({id:String(x+1),subject:v.content||"Task",description:"",activeForm:v.activeForm,status:v.status||"pending"}));n.setTasks(e,m),jf.set(e,m.length)}continue}if(c==="TaskCreate"){const h=(jf.get(e)||0)+1;jf.set(e,h);const m={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,m);continue}if(c==="TaskUpdate"){const h=u.taskId;if(h){const m={};u.status&&(m.status=u.status),u.owner&&(m.owner=u.owner),u.activeForm!==void 0&&(m.activeForm=u.activeForm),u.addBlockedBy&&(m.blockedBy=u.addBlockedBy),n.updateTask(e,h,m)}}}}function Jm(e,t){var c,u;const n=Q.getState(),i=((c=n.sessions.get(e))==null?void 0:c.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:m}=f;if((h==="Edit"||h==="Write")&&typeof m.file_path=="string"){const v=E4(m.file_path,i);T4(v,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Hc=new Map,A4=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function eg(e,t){const n=Q.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const a=i.input;if(a.run_in_background===!0){let c=Hc.get(e);c||(c=new Map,Hc.set(e,c)),c.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,c=Hc.get(e),u=c==null?void 0:c.get(a);if(c&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(m=>"text"in m?m.text:"").join(""):"").match(A4);if(h){const m={taskId:h[1],toolUseId:a,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,m)}c.delete(a),c.size===0&&Hc.delete(e)}}}}const rf=new Map,Pf=new Map;function tg(e,t){const n=Q.getState();let i=Pf.get(e);i||(i=new Set,Pf.set(e,i));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&i.has(a.id))continue;const c=a.input;if(c.run_in_background===!0){a.id&&i.add(a.id);let u=rf.get(e);u||(u=new Map,rf.set(e,u));const f={toolUseId:a.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(a.type==="tool_result"){const c=a.tool_use_id,u=rf.get(e),f=u==null?void 0:u.get(c);if(u&&f){const h=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(v=>"text"in v?v.text:"").join(""):"",m=a.is_error===!0;n.updateBackgroundAgent(e,c,{status:m?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(c),u.size===0&&rf.delete(e)}}}}function k_(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function j_(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function N_(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 R4=0,O4=0;function Ci(){return`msg-${Date.now()}-${++R4}`}function C_(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 qE(e)?`${FE}
|
|
64
|
-
|
|
65
|
-
Details: ${t}`:`Error: ${t}`}function L4(e,t){const n=cu.get(e)||[];n.push(t),cu.set(e,n)}function D4(e,t){const n=cu.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){cu.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const lr=new Map;function E_(e,t,n){const i=Q.getState(),a=i.messages.get(e)||[],c=Xc.get(e);let u=a.filter(h=>!h.isStreaming||h.id===c),f=-1;if(c&&(f=u.findIndex(h=>h.id===c),f===-1&&Xc.delete(e)),f===-1){const h=`stream-${e}-${Ci()}`;Xc.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function Jr(e){Xc.delete(e);const t=Q.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const T_=new Map,z4=8e3;function Kl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=T_.get(e);a&&a.code===t&&i-a.at<z4||(T_.set(e,{code:t,at:i}),Q.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function A2(){return`cmsg-${Date.now()}-${++O4}`}function f0(){return A2()}const $4=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 B4(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 R2(e){return`companion:last-seq:${e}`}function h0(e){const t=$f.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(R2(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return $f.set(e,a),a}catch{return 0}}function M_(e,t){const n=Math.max(0,Math.floor(t));$f.set(e,n);try{localStorage.setItem(R2(e),String(n))}catch{}}function A_(e,t){Fn(e,{type:"session_ack",last_seq:t})}function Cf(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
-
`)}function ng(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 P4(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const f of i)a.set(ng(f),f);const c=[],u=new Set;for(const f of n){const h=ng(f);u.has(h)||(u.add(h),c.push(a.get(h)||f))}for(const f of i){const h=ng(f);u.has(h)||(u.add(h),c.push(f))}return c}function R_(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:po(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function p0(e,t){const n=P4(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Cf(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function U4(e,t){const n=Q.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const c=[...i];c[a]=p0(c[a],t),n.setMessages(e,c)}function F4(e,t){var a,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(a=t.data)==null?void 0:a.substring)==null?void 0:c.call(a,0,120));return}const i=Q.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),O2(e,n)}function O2(e,t,n={}){var u,f,h,m,v,x;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,c=Q.getState();if(i&&typeof t.seq=="number"){const b=h0(e);if(t.seq<=b)return;M_(e,t.seq),a&&A_(e,t.seq)}switch(N4.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),b||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const y=new Set(c.sessionNames.values()),_=S2(y);c.setSessionName(e,_)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Jr(e),c.setStreaming(e,null),Kl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Cf(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=Cf(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(Jr(e),U4(e,_),c.setStreaming(e,null),sa.delete(e),lr.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=b.content)!=null&&f.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};c.addToolActivity(e,R_(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=b.content)!=null&&h.length&&(Zm(e,b.content),Jm(e,b.content),eg(e,b.content),tg(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(sa.delete(e),lr.delete(e),Jr(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.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 _=lr.get(e)||{thinking:"",text:""};sa.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,lr.set(e,_),sa.set(e,"text"),c.setStreaming(e,_.text),E_(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=lr.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,lr.set(e,_),sa.set(e,"thinking"),c.setStreaming(e,_.thinking),E_(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&c.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Bf.delete(e),Pf.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))}}c.updateSession(e,y),Jr(e),c.setStreaming(e,null),sa.delete(e),lr.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&GE(),!document.hasFocus()&&c.notificationDesktop&&k_("Session completed","Claude finished the task",e),b.is_error&&c.appendMessage(e,{id:Ci(),role:"system",content:C_(b),timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const y=t.request;k_("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}];Zm(e,y),Jm(e,y),eg(e,y),tg(e,y)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((m=c.sdkSessions.find(y=>y.sessionId===e))==null?void 0:m.backendType)==="codex"&&c.appendMessage(e,{id:Ci(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||Ci(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((v=t.event)==null?void 0:v.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&c.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=N_(t.event);if(!b)break;c.appendMessage(e,{id:Ci(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...j_(t.event)});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:Ci(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:Ci(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),Jr(e)?Kl(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."}):Kl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),Jr(e)&&Kl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),b==="ready"?c.setSessionStatus(e,"idle"):b==="streaming"?c.setSessionStatus(e,"running"):b==="compacting"?c.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),Jr(e)?Kl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):Kl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const b=c.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"rate_limit":{c.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||Ci(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const S=N.message,C=Cf(S.content),E={id:S.id,role:"assistant",content:C,contentBlocks:S.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:S.model,stopReason:S.stop_reason},L=b.findIndex(O=>O.role==="assistant"&&O.id===E.id);if(L===-1?b.push(E):b[L]=p0(b[L],E),(x=S.content)!=null&&x.length){Zm(e,S.content),Jm(e,S.content),eg(e,S.content),tg(e,S.content);const O=N.timestamp||Date.now();for(const R of S.content){if(R.type==="tool_use"){const F=R.input||{},D=y.get(R.id);y.set(R.id,D??R_(R.id,R.name,F,O,N.parent_tool_use_id))}if(R.type==="tool_result"){const F=y.get(R.tool_use_id);F&&y.set(R.tool_use_id,{...F,completedAt:O,isError:F.isError||!!R.is_error,elapsedSeconds:Math.max(F.elapsedSeconds,F.completedAt?F.elapsedSeconds:Math.max(0,(O-F.startedAt)/1e3))})}}}}else if(N.type==="result"){const S=N.data;S.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:C_(S),timestamp:Date.now()});const C={total_cost_usd:S.total_cost_usd,num_turns:S.num_turns};if(typeof S.total_lines_added=="number"&&(C.total_lines_added=S.total_lines_added),typeof S.total_lines_removed=="number"&&(C.total_lines_removed=S.total_lines_removed),S.modelUsage){for(const E of Object.values(S.modelUsage))if(E.contextWindow>0){const L=E,O=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);C.context_used_percent=Math.max(0,Math.min(O,100))}}c.updateSession(e,C)}else if(N.type==="system_event"){const S=N_(N.event);if(!S)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:S,timestamp:N.timestamp||Date.now(),...j_(N.event)})}}if(b.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,b);else{const N=[...j];for(const S of b){const C=N.findIndex(L=>L.id===S.id);if(C===-1){N.push(S);continue}const E=N[C];E.role==="assistant"&&S.role==="assistant"?N[C]=p0(E,S):N[C]=S}N.sort((S,C)=>(S.timestamp??0)-(C.timestamp??0)),c.setMessages(e,N)}}c.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"&&(Jr(e),c.setStreaming(e,null),sa.delete(e),lr.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=h0(e);y.seq<=_||(M_(e,y.seq),b=y.seq,O2(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&A_(e,b);break}case"prompt_suggestion":{const b=t.suggestions;c.setPromptSuggestions(e,b);break}case"streamlined_text":{c.appendMessage(e,{id:Ci(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:Ci(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{c.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Su(e){const t=oi.get(e);if(T2(t))return;if(t){try{t.close()}catch{}oi.delete(e)}Q.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(B4(e));oi.set(e,i),i.onopen=()=>{const a=h0(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),D4(e,i);const c=pr.get(e);c&&(clearTimeout(c),pr.delete(e))},i.onmessage=a=>F4(e,a),i.onclose=()=>{oi.get(e)===i&&(oi.delete(e),Q.getState().setConnectionStatus(e,"disconnected"),I4(e))},i.onerror=()=>{i.close()}}function I4(e){if(pr.has(e)||uu)return;const t=setTimeout(()=>{pr.delete(e),!uu&&M2(e)&&Su(e)},j4);pr.set(e,t)}function m0(e){const t=pr.get(e);t&&(clearTimeout(t),pr.delete(e));const n=oi.get(e);n&&(n.close(),oi.delete(e)),Q.getState().setConnectionStatus(e,"disconnected"),Bf.delete(e),Pf.delete(e),Hc.delete(e),jf.delete(e),sa.delete(e),Xc.delete(e),lr.delete(e),$f.delete(e),cu.delete(e)}function H4(e){if(!uu)for(const t of e)t.archived||Su(t.sessionId)}function q4(e){return new Promise((t,n)=>{const i=setInterval(()=>{const c=oi.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Fn(e,t){const n=oi.get(e);let i=t;const a=$4.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":case"set_magic_ui":t.client_msg_id||(i={...t,client_msg_id:A2()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&L4(e,i)}function O_(e){Fn(e,{type:"mcp_get_status"})}function V4(e,t,n){Fn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function G4(e,t){Fn(e,{type:"mcp_reconnect",serverName:t})}function Y4(e,t){Fn(e,{type:"mcp_set_servers",servers:t})}function L_(e,t){Fn(e,{type:"set_magic_ui",magicUiActive:t})}function NB(e){Fn(e,{type:"magic_ui_sync"})}function X4(e,t){Fn(e,{type:"set_ai_validation",...t})}const re="u">typeof window?window:void 0,qn="u">typeof globalThis?globalThis:re,jn=qn==null?void 0:qn.navigator,me=qn==null?void 0:qn.document,Yt=qn==null?void 0:qn.location,du=qn==null?void 0:qn.fetch,fx=qn!=null&&qn.XMLHttpRequest&&"withCredentials"in new qn.XMLHttpRequest?qn.XMLHttpRequest:void 0,D_=qn==null?void 0:qn.AbortController,Q4=qn==null?void 0:qn.CompressionStream,ts=jn==null?void 0:jn.userAgent;function L2(){return!(!re||re.navigator.onLine===!1)}const Tc=typeof globalThis<"u"?globalThis:re;Tc&&typeof self>"u"&&(Tc.self=Tc),Tc&&typeof File>"u"&&(Tc.File=function(){});const $e=re??{},K4="0.8.2",hr={DEBUG:!1,LIB_VERSION:K4,LIB_NAME:"browser-common"};var Ti=(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})({}),g0=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const W4=["$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"],Z4=["token"];function Ie(e,t){return e.indexOf(t)!==-1}const hh=function(e){return e.trim()},x0=function(e){return e.replace(/^\$/,"")};function D2(e){var t;const n=[];return(t=JSON.stringify(e,function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}}))!==null&&t!==void 0?t:"null"}const z2=Object.prototype,hx=z2.hasOwnProperty,ph=z2.toString,Ue=Array.isArray||function(e){return ph.call(e)==="[object Array]"},Pn=e=>typeof e=="function",nt=e=>e===Object(e)&&!Ue(e),gs=e=>{if(nt(e)){for(const t in e)if(hx.call(e,t))return!1;return!0}return!1},de=e=>e===void 0,it=e=>ph.call(e)=="[object String]",Qc=e=>it(e)&&e.trim().length===0,Wt=e=>e===null,Ve=e=>de(e)||Wt(e),Zt=e=>ph.call(e)=="[object Number]"&&e==e,or=e=>Zt(e)&&e>0,ss=e=>ph.call(e)==="[object Boolean]",J4=e=>Ie(W4,e),eT=e=>Ie(Z4,e);function $2(e){return e===null||typeof e!="object"}function Uf(e,t){return{}.toString.call(e)===`[object ${t}]`}function ku(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 B2(e,Error)}}function px(e){return"u">typeof Event&&B2(e,Event)}function B2(e,t){try{return e instanceof t}catch{return!1}}const tT=[!0,"true",1,"1","yes"],sg=e=>Ie(tT,e),nT=[!1,"false",0,"0","no"];function z_(e,t,n,i,a,c,u){try{var f=e[c](u),h=f.value}catch(m){return void n(m)}f.done?t(h):Promise.resolve(h).then(i,a)}function zt(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var c=e.apply(t,n);function u(h){z_(c,i,a,u,f,"next",h)}function f(h){z_(c,i,a,u,f,"throw",h)}u(void 0)})}}const sT=["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"],$_=function(e,t=[]){if(!e)return!1;const n=e.toLowerCase();return sT.concat(t).some(i=>{const a=i.toLowerCase();return n.indexOf(a)!==-1})};function Ai(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),Zt(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),Ai(a??n,t,n,i))}var iT=class{constructor(e){this.C={},this.I=e.I,this.R=Ai(e.bucketSize,0,100,e.$),this.A=Ai(e.refillRate,0,this.R,e.$),this.O=Ai(e.refillInterval,0,864e5,e.$)}F(e,t){const n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.A,this.R),e.lastAccess=e.lastAccess+n*this.O)}consumeRateLimit(e){var t;const n=Date.now(),i=String(e);let a=this.C[i];return a?this.F(a,n):(a={tokens:this.R,lastAccess:n},this.C[i]=a),a.tokens===0||(a.tokens--,a.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),a.tokens===0)}stop(){this.C={}}};const mo="Mobile",fu="Android",Ff="Tablet",P2="Android Tablet",U2="iPad",F2="Apple Watch",Ef="Safari",mh="BlackBerry",I2="Samsung Internet",Tf="Chrome",H2="Chrome iOS",q2="Internet Explorer",V2="Internet Explorer Mobile",G2="Opera",Y2="Microsoft Edge",Mf="Firefox",X2="Firefox iOS",If="Nintendo",Hf="PlayStation",gh="Xbox",Q2="Android Mobile",K2="Mobile Safari",ig="Windows",W2="Windows Phone",B_="Nokia",v0="Ouya",rT="Generic "+mo.toLowerCase(),Z2="Generic "+Ff.toLowerCase(),b0="Konqueror",J2="Oculus Browser",eS="Vivaldi",tS="Yandex",nS="Whale",sS="DuckDuckGo",iS="Pale Moon",rS="Waterfox",y0="Brave",aS="Claude",lS="Codex",oS="ChatGPT",cS="Google Search App",rg=new RegExp("Version/(\\d+(\\.\\d+)?)"),ag=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),aT=new RegExp(gh,"i"),lT=new RegExp("PlayStation \\w+","i"),oT=new RegExp("Nintendo \\w+","i"),mx=new RegExp("BlackBerry|PlayBook|BB10","i"),cT={"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"},uS=function(e,t,n,i){return t=t||"",(function(c){return c!=null&&c.brave?y0:null})(n)||(i!=null&&i.detectGoogleSearchApp&&Ie(e,"GSA/")?cS:Ie(e," OPR/")&&Ie(e,"Mini")?"Opera Mini":Ie(e," OPR/")?G2:mx.test(e)?mh:Ie(e,"IEMobile")||Ie(e,"WPDesktop")?V2:Ie(e,"OculusBrowser")?J2:Ie(e,"SamsungBrowser")?I2:Ie(e,"Edge")||Ie(e,"Edg/")?Y2:Ie(e,"Vivaldi/")?eS:Ie(e,"YaBrowser/")?tS:Ie(e,"Whale/")?nS:Ie(e,"DuckDuckGo/")||Ie(e,"Ddg/")?sS:Ie(e,"Claude/")?aS:Ie(e,"Codex/")?lS:Ie(e,"ChatGPT/")?oS:Ie(e,"FBIOS")?"Facebook Mobile":Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?H2:Ie(e,"CrMo")||Ie(e,Tf)?Tf:Ie(e,fu)&&Ie(e,Ef)?Q2:Ie(e,"FxiOS")?X2:Ie(e.toLowerCase(),b0.toLowerCase())?b0:Ie(e,"Brave/")?y0:((c,u)=>u&&Ie(u,"Apple")||(function(f){return Ie(f,Ef)&&!Ie(f,Tf)&&!Ie(f,fu)})(c))(e,t)?Ie(e,mo)?K2:Ef:Ie(e,"PaleMoon/")?iS:Ie(e,"Waterfox/")?rS:Ie(e,Mf)?Mf:Ie(e,"MSIE")||Ie(e,"Trident/")?q2:Ie(e,"Gecko")?Mf:"")},uT={[V2]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Y2]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Tf]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[H2]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ef]:[rg],[K2]:[rg],[G2]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Mf]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[X2]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[b0]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[mh]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),rg],[Q2]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[I2]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[J2]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[eS]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[tS]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[nS]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[y0]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[aS]:[ag],[lS]:[ag],[oS]:[ag],[sS]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[iS]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[rS]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[cS]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[q2]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},dT=function(e,t,n,i){const a=uS(e,t,n,i),c=uT[a];if(de(c))return null;for(let u=0;c.length>u;u++){const f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},P_=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[gh,e&&e[1]||""]],[new RegExp(If,"i"),[If,""]],[new RegExp(Hf,"i"),[Hf,""]],[mx,[mh,""]],[new RegExp(ig,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[W2,""];if(new RegExp(mo).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let i=cT[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[ig,i]}return[ig,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=de(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[fu,[e[2],e[3],e[4]||"0"].join(".")]:[fu,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],dS=function(e){for(let t=0;P_.length>t;t++){const[n,i]=P_[t],a=n.exec(e),c=a&&(Pn(i)?i(a,e):i);if(c)return c}return["",""]},fS=function(e){return oT.test(e)?If:lT.test(e)?Hf:aT.test(e)?gh:new RegExp(v0,"i").test(e)?v0:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?W2:/iPad/.test(e)?U2:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?F2:mx.test(e)?mh:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(B_,"i").test(e)?B_:/(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(mo).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)?fu:P2:new RegExp("(pda|Mobile)","i").test(e)?rT:new RegExp(Ff,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Z2:""},fT=function(e,t){var n;const i=fS(e);return i===U2||i===P2||i==="Kobo"||i==="Kindle Fire"||i===Z2?Ff:i===If||i===gh||i===Hf||i===v0?"Console":i===F2?"Wearable":i?mo:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((n=t==null?void 0:t.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((a=t==null?void 0:t.screenWidth)!==null&&a!==void 0?a:0,(c=t==null?void 0:t.screenHeight)!==null&&c!==void 0?c:0)/((u=t==null?void 0:t.devicePixelRatio)!==null&&u!==void 0?u:1)?mo:Ff:"Desktop";var a,c,u},lg=/\bFBAV\/(\d+(?:\.\d+)*)/i,U_=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",lg],[/\bFBAN\/EMA\b/i,"Facebook Lite",lg],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",lg],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],_0="[Truncated]",ju="[Unserializable]";function fo(e){let t="";for(let n=0;e.length>n;n++){const i=e.charCodeAt(n);if(55296>i||i>56319)t+=56320>i||i>57343?e[n]:"�";else{const a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}function hS(e,t){if(!t)return e;let n=[];try{n=Object.keys(t)}catch{n=[]}for(const i of n){let a;try{a=t[i]}catch{a=ju}Object.defineProperty(e,i,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}const hT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function F_(e,t){return typeof(n=e)=="string"&&hT.test(n)?e:t();var n}function pS(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function da(e){return e&&e.split("#")[0]}function mS(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function I_(e,t,n){return gS.apply(this,arguments)}function gS(){return(gS=zt(function*(e,t,n){let i;try{return yield Promise.race([e,new Promise((a,c)=>{i=mS(()=>{try{n==null||n(),a()}catch(u){c(u)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let af,H_,og;function pT(e){const t=globalThis._posthogChunkIds;if(!t)return;const n=Object.keys(t);return og&&n.length===H_||(H_=n.length,og=n.reduce((i,a)=>{af||(af={});const c=af[a];if(c)i[c[0]]=c[1];else{const u=e(a);for(let f=u.length-1;f>=0;f--){const h=u[f],m=h==null?void 0:h.filename,v=t[a];if(m&&v){i[m]=v,af[a]=[m,v];break}}}return i},{})),og}function Kc(e){return Kc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kc(e)}function mT(e,t,n){return(t=(function(i){var a=(function(c){if(Kc(c)!="object"||!c)return c;var u=c[Symbol.toPrimitive];if(u!==void 0){var f=u.call(c,"string");if(Kc(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(c)})(i);return Kc(a)=="symbol"?a:a+""})(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function U(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q_(Object(n),!0).forEach(function(i){mT(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q_(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}var gT=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){const n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),a=this.buildParsingContext(t),c=this.parseStacktrace(i,a);return{$exception_list:this.convertToExceptionList(c,n),$exception_level:"error"}}modifyFrames(e){var t=this;return zt(function*(){for(const n of e)n.stacktrace&&n.stacktrace.frames&&Ue(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){let n,i;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),U(U({},e),{},{cause:n,stack:i})}applyChunkIds(e,t){return e.map(n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n))}applyCoercers(e,t){for(const n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return zt(function*(){let n=e;for(const i of t.modifiers)n=yield i(n);return n})()}convertToExceptionList(e,t){var n,i,a;const c={type:e.type,value:e.value,mechanism:{type:(n=t.type)!==null&&n!==void 0?n:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(a=e.synthetic)!==null&&a!==void 0&&a}};e.stack&&(c.stacktrace={type:"raw",frames:e.stack});const u=[c];return e.cause!=null&&u.push(...this.convertToExceptionList(e.cause,U(U({},t),{},{handled:!0}))),u}buildParsingContext(e){var t;return{chunkIdMap:pT(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,n=0){const i=(a,c)=>{if(4>=c){const u=this.buildCoercingContext(e,t,c);return this.applyCoercers(a,u)}};return U(U({},t),{},{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:a=>i(a,n),next:a=>i(a,n+1)})}};const xT=/^([a-z][a-z0-9.+-]+):/i,vT=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function bT(e){if(!e||e==="<anonymous>")return!1;const t=xT.exec(e);return!t||vT.includes(t[1].toLowerCase())}function w0(e,t,n,i,a){const c={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:bT(t)};return de(i)||(c.lineno=i),de(a)||(c.colno=a),c}const xS=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:"?",n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},yT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_T=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wT=/\((\S*)(?::(\d+))(?::(\d+))\)/,ST=(e,t)=>{const n=yT.exec(e);if(n){const[,a,c,u]=n;return w0(t,a,"?",+c,+u)}const i=_T.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const u=wT.exec(i[2]);u&&(i[2]=u[1],i[3]=u[2],i[4]=u[3])}const[a,c]=xS(i[1]||"?",i[2]);return w0(t,c,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},kT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,jT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,NT=(e,t)=>{const n=kT.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const c=jT.exec(n[3]);c&&(n[1]=n[1]||"eval",n[3]=c[1],n[4]=c[2],n[5]="")}let i=n[3],a=n[1]||"?";return[a,i]=xS(a,i),w0(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},V_=/\(error: (.*)\)/;function gx(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function CT(e){for(let t=1;10>=t;t++){const n=e.length-2*t;if(0>n)break;let i=!0;for(let a=0;t>a;a++)if(!gx(e[n+a],e[n+t+a])){i=!1;break}if(i){for(let a=0;t>a;a++)e[n+a]=e[n+t+a];return e.length=n+t,{start:n,length:t}}}}function ET(e,t){const n=t.start+t.length,i=bS(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}function vS(e,t){let n=t.start;for(;n>0&&gx(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function bS(e,t){const n=t.start+t.length;let i=n;for(;e.length>i&&gx(e[i],e[i-t.length]);)i++;return i-n}function TT(e,t){const n=t[0];let i=e.length-(n?vS(e,n):0);for(const a of t)i-=bS(e,a);return i}function MT(e,t,n){for(let i=0;e.length>i;i++){const a=e[(t+i)%e.length],c=e[(n+i)%e.length];if(a!==c)return c>a}return!1}var AT=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const n=it(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Uf(e,"DOMException")}isDOMError(e){return Uf(e,"DOMError")}},RT=class{match(e){return ku(e)}coerce(e,t){var n;const i=this.getStack(e),a=i===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??((n=t.syntheticException)===null||n===void 0?void 0:n.stack),cause:e.cause?t.next(e.cause):void 0,synthetic:a}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},OT=class{match(e){return!!Uf(e,"ErrorEvent")&&(e.error!=null||this.lr(e))}coerce(e,t){var n;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return U(U({},i),{},{stack:(n=this.ur(e))!==null&&n!==void 0?n:i.stack,synthetic:!0})}lr(e){return it(e.message)&&e.message.length>0}ur(e){var t,n;const i=e,a=(t=i.lineno)!==null&&t!==void 0?t:0,c=(n=i.colno)!==null&&n!==void 0?n:0;if(it(i.filename)&&i.filename.length!==0&&a!==0)return`Error
|
|
67
|
-
at ${i.filename}:${a}:${c}`}};const LT=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var DT=class{match(e){return typeof e=="string"}coerce(e,t){var n;const[i,a]=this.getInfos(e);return{type:i??"Error",value:a??e,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}getInfos(e){let t="Error",n=e;const i=e.match(LT);return i&&(t=i[1],n=i[2]),[t,n]}};const zT=["fatal","error","warning","log","info","debug"];function yS(e,t=40){const n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(let i=n.length;i>0;i--){const a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?`${a.slice(0,t)}...`:a}return""}var $T=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i;const a=this.getErrorPropertyFromObject(e);return a?t.apply(a):{type:this.getType(e),value:this.getValue(e),stack:(n=this.getStack(e))!==null&&n!==void 0?n:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(px(e))return e.constructor.name;const t="name"in e?e.name:void 0;return it(t)&&!Qc(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message: '${e.message}'`),n}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${yS(e)}`}isSeverityLevel(e){return it(e)&&!Qc(e)&&zT.indexOf(e)>=0}getStack(e){try{return it(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:it(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const n=e[t];if(ku(n))return n}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},BT=class{match(e){return px(e)}coerce(e,t){var n;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${yS(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},PT=class{match(e){return $2(e)}coerce(e,t){var n;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},UT=class{match(e){return Uf(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!px(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var n;const i=this.getUnhandledRejectionReason(e);return $2(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const qf="$message",Vf="$timestamp",FT=new Set([qf,Vf]),cg={enabled:!0,max_bytes:32768};function Gf(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:cg.enabled,max_bytes:HT(e.max_bytes,cg.max_bytes)}:U({},cg)}var IT=class{constructor(e){this.ts=[],this.es=0,this.Mr=Gf(e)}setConfig(e){this.Mr=Gf(e),this.ns()}add(e){const t=(function(i){let a;try{a=D2(i)}catch{return}try{const c=JSON.parse(a);if(!nt(c))return;const u=c,f=u[qf],h=u[Vf];return!it(f)||f.trim().length===0||!it(h)&&!Zt(h)?void 0:{step:u,json:a}}catch{return}})(e);if(!t)return;const n=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const a=encodeURIComponent(i);let c=0;for(let u=0;a.length>u;u++)a[u]==="%"?(c+=1,u+=2):c+=1;return c})(t.json);n>this.Mr.max_bytes||(this.ts.push({step:t.step,bytes:n}),this.es+=n,this.ns())}getAttachable(){return this.ts.map(e=>e.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const e=this.ts.shift();e&&(this.es-=e.bytes)}}};function HT(e,t){if(!Zt(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const G_=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Y_(e){return typeof e=="string"||e}function X_(e){return typeof e=="string"?e:void 0}const qT=["$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"],_S="NativeGzipValidationError",S0=e=>e.length>=2&&e[0]===31&&e[1]===139,Q_=(e,t)=>e===g0.GZipJS||t===g0.GZipJS||t==="gzip",K_=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let Mc;const lf=e=>{throw pS(_S,`Native gzip produced invalid output: ${e}`)},VT=(W_=zt(function*(e,t){18>e.size&&lf("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());S0(n)&&n[2]===8||lf("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(c=>{const u=(()=>{if(Mc)return Mc;Mc=[];for(let h=0;256>h;h++){let m=h;for(let v=0;8>v;v++)m=1&m?3988292384^m>>>1:m>>>1;Mc[h]=m>>>0}return Mc})();let f=4294967295;for(let h=0;c.length>h;h++)f=u[255&(f^c[h])]^f>>>8;return(4294967295^f)>>>0})(t)&&lf("invalid-crc");const a=t.length>>>0;i.getUint32(4,!0)!==a&&lf("invalid-size")}),function(e,t){return W_.apply(this,arguments)});var W_;function k0(){return k0=zt(function*(e,t=!0,n){try{const a=new TextEncoder().encode(e),c=new globalThis.CompressionStream("gzip"),u=c.writable.getWriter(),f=u.write(a).then(()=>u.close()).catch((i=zt(function*(v){try{yield u.abort(v)}catch{}throw v}),function(v){return i.apply(this,arguments)})),h=new Response(c.readable).blob(),[m]=yield Promise.all([h,f]);return yield VT(m,a),m}catch(a){if(n!=null&&n.rethrow)throw a;return t&&console.error("Failed to gzip compress data",a),null}var i}),k0.apply(this,arguments)}const ug=3e5;var wS=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),n=Date.now(),i=Math.min(e.retryAfterMs,ug);if(!t)return this.ss=n,void(this.rs=n+i);this.rs=Math.max(this.rs,Math.min(n+i,this.ss+ug))}remainingMs(){const e=Date.now();if(this.ss-5e3>e)return this.reset(),0;const t=Math.min(ug,Math.max(0,this.rs-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function SS(e,t){if(e==null)return{};var n,i,a=(function(u,f){if(u==null)return{};var h={};for(var m in u)if({}.hasOwnProperty.call(u,m)){if(f.includes(m))continue;h[m]=u[m]}return h})(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;c.length>i;i++)t.includes(n=c[i])||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const GT={}.propertyIsEnumerable;function Yf(e,t){try{return kS(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function xx(e,t,n,i){if(0>=n.remainingNodes)return{stringValue:_0};if(n.remainingNodes--,ss(e))return{boolValue:e};if(typeof e=="bigint")return(function(a,c){const u=a.toString(),f=BigInt("9223372036854775808");return a>=f||-f>a?(c==null||c.debug(`Attribute ${u} is outside the int64 range; encoding it as a string`),{stringValue:u}):{intValue:u}})(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)};const a=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>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:fo(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:_0};if(e instanceof Date){const a=e.getTime(),c=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof c=="string"?fo(c):String(c)}}n.ancestors.add(e);try{try{const a=e.toJSON;if(typeof a=="function")return xx(a.call(e),t,n,i+1)}catch{}return Ue(e)?{arrayValue:{values:YT(e,t,n,i+1)}}:{kvlistValue:{values:kS(e,t,n,i+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:fo(String(e))}}function YT(e,t,n,i){const a=[],c=Math.min(e.length,1e3);let u=0;for(;c>u&&n.remainingNodes>0;u++)try{const f=u in e?e[u]:void 0;if(Ve(f))continue;a.push(xx(f,t,n,i))}catch{a.push({stringValue:ju})}return e.length>u&&a.push({stringValue:_0}),a}function kS(e,t,n,i){const a=[];for(const c in e)if(GT.call(e,c)){if(!c){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=1e3||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const u=e[c];if(Wt(u)||de(u))continue;a.push({key:fo(c),value:xx(u,t,n,i)})}catch{a.push({key:fo(c),value:{stringValue:ju}})}}return a}function jS(e,t,n){return U(U(U(U({},hS({},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})}const XT=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function NS(e,t){const n=hS({},e),i={};for(const a of XT)({}).hasOwnProperty.call(n,a)&&(i[a]=n[a],delete n[a]);return[...Yf(n,t),...Yf(i,t)]}const Z_={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},CS={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}},QT=CS.info;function KT(e){try{return fo(String(e))}catch{return ju}}function WT(e,t,n,i){const a=e.level||"info",{text:c,number:u}=CS[a]||QT,f=(function(b=Date.now()){return String(b)+"000000"})(Zt(i)?i:void 0),h={};t.distinctId&&(h.posthogDistinctId=t.distinctId),t.sessionId&&(h.sessionId=t.sessionId),t.windowId&&(h["window.id"]=t.windowId),Ve(t.sessionStartTimestamp)||(h.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ve(t.lastActivityTimestamp)||(h.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(h["url.full"]=t.currentUrl),t.screenName&&(h["screen.name"]=t.screenName),t.appState&&(h["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(h.feature_flags=t.activeFeatureFlags);const m=U({},h),v=e.attributes;if(v){let b=[];try{b=Object.keys(v)}catch{b=[]}for(const y of b){let _;try{_=v[y]}catch{_=ju}Object.defineProperty(m,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}const x={timeUnixNano:f,observedTimeUnixNano:f,severityNumber:u,severityText:c,body:{stringValue:KT(e.body)},attributes:Yf(m,n)};return e.trace_id&&(x.traceId=e.trace_id),e.span_id&&(x.spanId=e.span_id),de(e.trace_flags)||(x.flags=e.trace_flags),x}function ES(e,t,n){return jS(e,t,n)}function TS(e,t,n,i){return{resourceLogs:[{resource:{attributes:NS(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var MS=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=mS(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function AS(){return .75+.5*Math.random()}function RS(e,t,n,i){const a=Math.min(Math.max(0,t-1),6),c=e*Math.pow(2,a);return Math.round(Math.min(c,Math.max(i,e))*n)}var ZT=class{constructor(e,t,n,i,a,c=()=>Promise.resolve(),u){var f;this._instance=e,this.Mr=t,this.$=n,this.cs=i,this.ds=a,this.vs=c,this.fs=u,this.ps=new MS(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new wS,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(Ti.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var n;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const a={record:WT(i,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.cs(),this.$,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(a))}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Ue(t)?t:[t];let i=e;for(const a of n)try{const c=a(i);if(!c)return this.$.info("Log was rejected in beforeSend function"),null;i=c}catch(c){return this.$.error("Error in beforeSend function for log:",c),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return zt(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return zt(function*(){var t;e.ps.clear();let n=(t=e._instance.getPersistedProperty(Ti.LogsQueue))!==null&&t!==void 0?t:[];if(n.length===0)return;const i=n.length;let a=0;for(;n.length>0&&i>a;){var c,u;const f=e._s;e.bs=0;const h=Math.min(n.length,e.Es),m=n.slice(0,h),v=TS(m.map(b=>b.record),e.qs(),(c=e.fs)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),x=yield e._instance.js(v);if(e._s!==f)return;if(x.kind==="too-large"&&m.length>1)e.Es=Math.max(1,Math.floor(m.length/2)),e.$.warn(`Logs batch of size ${m.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(x),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),x.kind==="retry-later"||(x.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):x.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(m.length),n=(u=e._instance.getPersistedProperty(Ti.LogsQueue))!==null&&u!==void 0?u:[],a+=m.length,x.kind==="fatal"))throw x.error}})()}Bs(e){var t=this;return zt(function*(){var n;const i=Math.max(0,e-t.bs),a=(n=t._instance.getPersistedProperty(Ti.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Ti.LogsQueue,a.slice(i)),yield t.vs()})()}qs(){return ES(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(Ti.LogsQueue))!==null&&t!==void 0?t:[];this.Is>n.length||(n.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Ti.LogsQueue,n),this.Ts>n.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(RS(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Ti.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return zt(function*(){t.ps.clear();const n=t.flush().catch(()=>{});e!==void 0?yield I_(n,e):yield n})()}flushWithTimeout(e){var t=this;return zt(function*(){const n=t.flush();yield I_(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=AS(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const dg=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function J_(e){return String(e)+"000000"}function e5(e,t,n,i){let a="";return i&&(a=Object.keys(i).sort().map(c=>`${JSON.stringify(c)}:${JSON.stringify(i[c])}`).join(",")),`${e}\0${t}\0${n??""}\0${a}`}var JT=class{constructor(e,t,n){this._instance=e,this.Mr=t,this.$=n,this.zs=new Map,this.ps=new MS(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new wS,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Zs({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.Zs({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.Zs({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this;const t=this.ys,n=(function(){var i=zt(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,i;try{n=t.attributes?U({},t.attributes):void 0,i=e5(t.type,t.name,t.unit,n)}catch(u){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,u)}let a=this.zs.get(i);if(!a){if(!this.Ks())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.zs.set(i,a)}const c=this.Ws.get(t.name);c===void 0?this.Ws.set(t.name,t.type):c===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${c}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(a,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(e,t){switch(e.type){case"count":var n;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(dg.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,c){for(let u=0;c.length>u;u++)if(c[u]>=a)return u;return c.length})(t,dg)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Ue(t)?t:[t];let i=e;for(const a of n)try{const c=a(i);if(!c)return this.$.info("Metric was rejected in beforeSend function"),null;i=c}catch(c){return this.$.error("Error in beforeSend function for metric:",c),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(RS(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return zt(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const n=e.Gs,i=yield e._instance.Xs(e.Js(t));if(n===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=AS()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.lo(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return t=this.ao(e),n=(function(c,u,f){return jS(c,u,f)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:NS(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}ao(e){const t=J_(Date.now()),n=new Map;for(const u of e.values()){var i;const f=e5(u.type,u.name,u.unit,void 0);let h=n.get(f);h||(h=U({name:u.name},u.unit&&{unit:u.unit}),u.type==="count"?h.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:u.type==="gauge"?h.gauge={dataPoints:[]}:h.histogram={aggregationTemporality:1,dataPoints:[]},n.set(f,h));const m=Yf((i=u.attributes)!==null&&i!==void 0?i:{},this.$),v=J_(u.windowStartMs);if(u.type==="count"){var a;const x={attributes:m,startTimeUnixNano:v,timeUnixNano:t,asDouble:(a=u.total)!==null&&a!==void 0?a:0};h.sum.dataPoints.push(x)}else if(u.type==="gauge"){var c;const x={attributes:m,timeUnixNano:t,asDouble:(c=u.last)!==null&&c!==void 0?c:0};h.gauge.dataPoints.push(x)}else u.hist&&h.histogram.dataPoints.push({attributes:m,startTimeUnixNano:v,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:dg})}return Array.from(n.values())}lo(e){for(const[i,a]of e){const c=this.zs.get(i);if(c)switch(c.windowStartMs=Math.min(c.windowStartMs,a.windowStartMs),c.type){case"count":var t,n;c.total=((t=c.total)!==null&&t!==void 0?t:0)+((n=a.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(a.hist)if(c.hist){c.hist.count+=a.hist.count,c.hist.sum+=a.hist.sum,c.hist.min=Math.min(c.hist.min,a.hist.min),c.hist.max=Math.max(c.hist.max,a.hist.max);for(let u=0;c.hist.bucketCounts.length>u;u++)c.hist.bucketCounts[u]+=a.hist.bucketCounts[u]}else c.hist=a.hist}else this.Ks()&&this.zs.set(i,a)}}};const OS=(e,{debugEnabled:t}={})=>{const n={N(i,...a){re&&(hr.DEBUG||re.POSTHOG_DEBUG||t)&&!de(re.console)&&re.console&&("__rrweb_original__"in re.console[i]?re.console[i].__rrweb_original__:re.console[i])(e,...a)},debug(...i){n.N("debug",...i)},info(...i){n.N("log",...i)},warn(...i){n.N("warn",...i)},error(...i){n.N("error",...i)},critical(...i){console.error(e,...i)},uninitializedWarning(i){n.error(`You must initialize PostHog before calling ${i}`)},createLogger:(i,a)=>OS(`${e} ${i}`,a)};return n},_e=OS("[PostHog.js]"),Jt=_e.createLogger,e6=Jt("[ExternalScriptsLoader]"),Xf=e=>{const t=me==null?void 0:me.querySelectorAll("script");if(t){for(let n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Ka=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return e6.warn(`${t} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const i=Xf(t);if(i){if(i.__posthog_loading_callback_fired)return n();const c=i.__posthog_loading_error;return c?n(c):(i.addEventListener("load",u=>{i.__posthog_loading_callback_fired=!0,n(void 0,u)}),void i.addEventListener("error",u=>{i.__posthog_loading_error=u,n(u)}))}const a=()=>{if(!me)return n("document not found");if(Xf(t))return Ka(e,t,n);let c=me.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=t,c.onload=f=>{c.__posthog_loading_callback_fired=!0,n(void 0,f)},c.onerror=f=>{c.__posthog_loading_error=f,n(f)},e.config.prepare_external_dependency_script&&(c=e.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")me.head.appendChild(c);else{const f=me.querySelectorAll("body > script");var u;f.length>0?(u=f[0].parentNode)===null||u===void 0||u.insertBefore(c,f[0]):me.body.appendChild(c)}};me!=null&&me.body?a():me==null||me.addEventListener("DOMContentLoaded",a)},fg={},t5=(e,t)=>{let n=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",n)};$e.__PosthogExtensions__=$e.__PosthogExtensions__||{},$e.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t==="remote-config"){const a=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Ka(e,a,n)}const i=e.config.strict_script_versioning;if(i){const a=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),c=fg[a];if(i==="fallback"&&c){if(Xf(c))return void Ka(e,c,n);delete fg[a]}return void Ka(e,a,i==="fallback"?(u,f)=>{if(u)if(typeof u=="string")n(u);else{var h;const m=t5(e,t);fg[a]=m;const v=Xf(a);v==null||(h=v.parentNode)===null||h===void 0||h.removeChild(v),Ka(e,m,n)}else n(void 0,f)}:n)}Ka(e,t5(e,t),n)},$e.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{const i=e.requestRouter.endpointFor("api",t);Ka(e,i,n)},hr.DEBUG=!1,hr.LIB_VERSION="1.429.5",hr.LIB_NAME="web";var _n=hr;const t6="$people_distinct_id",ii="distinct_id",vx="$device_id",hg="$device_model",Qf="__alias",n6="__cmpns",of="$fbc",ri="$fbc_persistence",j0="__timers",LS="$autocapture_disabled_server_side",N0="$heatmaps_enabled_server_side",C0="$exception_capture_enabled_server_side",DS="$error_tracking_suppression_rules",E0="$error_tracking_capture_extension_exceptions",T0="$web_vitals_enabled_server_side",bx="$dead_clicks_enabled_server_side",yx="$product_tours_enabled_server_side",zS="$logs_capture_enabled_server_side",$S="$web_vitals_allowed_metrics",Wc="$session_recording_remote_config",s6="$session_recording_enabled_server_side",i6="$replay_sample_rate",r6="$replay_override_sampling",a6="$replay_override_linked_flag",l6="$replay_override_url_trigger",o6="$replay_override_event_trigger",oo="$sesid",BS="$session_is_sampled",c6="$session_past_minimum_duration",u6="$session_recording_url_trigger_activated_session",d6="$session_recording_event_trigger_activated_session",f6="$debug_first_full_snapshot_timestamp",h6="$sess_rec_flush_size",ai="$enabled_feature_flags",ur="$active_feature_flags",M0="$early_access_features",el="$feature_flag_details",ra="$feature_flag_payloads",tl="$feature_flag_request_id",Zc="$minimal_flag_called_events",Ei="$override_feature_flags",Wa="$override_feature_flag_payloads",aa="$stored_person_properties",la="$stored_group_properties",PS="$groups",A0="$surveys",Kf="$surveys_loaded_at",US="$surveys_activated",FS="$surveys_activated_session",IS="$surveys_activated_timestamps",R0="ph_product_tours",p6="$product_tours_activated",m6="$product_tours_activated_session",g6="$conversations_widget_session_id",x6="$conversations_ticket_id",v6="$conversations_widget_state",b6="$conversations_user_traits",oa="$flag_call_reported",qc="$flag_call_reported_session_id",hu="$feature_flag_errors",ca="$feature_flag_evaluated_at",ns="$user_state",O0="$client_session_props",y6="$capture_rate_limit",HS="$initial_campaign_params",qS="$initial_referrer_info",co="$initial_person_info",_x="$epp",pg="$posthog_cookieless",VS="$cookieless_mode",GS="$sdk_debug_extensions_init_method",YS="$sdk_debug_extensions_init_time_ms",XS="$sdk_debug_recording_script_not_loaded",_6="$sdk_debug_replay_event_trigger_status",w6="$sdk_debug_replay_linked_flag_trigger_status",S6="$sdk_debug_replay_matched_recording_trigger_groups",k6="$sdk_debug_replay_pending_trigger_conditions",j6="$sdk_debug_replay_remote_trigger_matching_config",N6="$sdk_debug_replay_trigger_groups_count",C6="$sdk_debug_replay_url_trigger_status",E6="$session_recording_start_reason",wx="PostHog loadExternalDependency extension not found.",dr="anonymous",Af="identified",QS="identified_only",pu="visibilitychange",Wf="beforeunload",Sx="$pageview",n5="$pageleave",L0="$identify",s5="$groupidentify";function cf(e,t){Ue(e)&&e.forEach(t)}function yt(e,t){if(!Ve(e))if(Ue(e))e.forEach(t);else if((n=>n instanceof FormData)(e))e.forEach((n,i)=>t(n,i));else for(const n in e)hx.call(e,n)&&t(e[n],n)}const Dt=function(e,...t){for(const n of t)for(const i in n)n[i]!==void 0&&(e[i]=n[i]);return e};function Rf(e){const t=Object.keys(e);let n=t.length;const i=new Array(n);for(;n--;)i[n]=[t[n],e[t[n]]];return i}const i5=function(e){try{return e()}catch{return}},T6=function(e){return function(...t){try{return e.apply(this,t)}catch(n){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(n)}}},kx=function(e){const t={};return yt(e,function(n,i){(it(n)&&n.length>0||Zt(n))&&(t[i]=n)}),t};function KS(e){const t=U({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch{}return t}const M6=["herokuapp.com","vercel.app","netlify.app"];function A6(e){const t=e==null?void 0:e.hostname;if(!it(t))return!1;const n=t.split(".").slice(-2).join(".");for(const i of M6)if(n===i)return!1;return!0}function Nt(e,t,n,i){const{capture:a=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:a,passive:c})}function D0(e){return e.name==="ph_toolbar_internal"}const z0=e=>{if(me){try{const t=e+"=",n=me.cookie.split(";").filter(i=>i.length);for(let i=0;n.length>i;i++){let a=n[i];for(;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 Zt(e)&&isFinite(e)&&Math.floor(e)===e});var R6=class $0{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");const c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/256,c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|i>>>24,c[9]=i>>>16,c[10]=i>>>8,c[11]=i,c[12]=a>>>24,c[13]=a>>>16,c[14]=a>>>8,c[15]=a,new $0(c)}toString(){let t="";for(let 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 $0(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let n=0;16>n;n++){const i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}},O6=class{generate(){const e=this.generateOrAbort();if(!de(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(de(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return Zt(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return R6.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new L6}};let WS=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};re&&!de(re.crypto)&&crypto.getRandomValues&&(WS=e=>crypto.getRandomValues(e));var L6=class{nextUint32(){return this.Rt.length>this.$t||(WS(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let r5;const li=()=>D6().toString(),D6=()=>(r5||(r5=new O6)).generate();let Ac="";const z6=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Wl=null;const Gt={Et(){if(!Wt(Wl))return Wl;if(Wl=!1,me)try{const e=`__ph_cookie_support_${li()}`;Gt.At(e,"xyz"),Wl=z0(e)==='"xyz"',Gt.Lt(e)}catch{Wl=!1}return Wl},Pt(e){_e.error("cookieStore error: "+e)},Ot:z0,Dt(e){let t;try{t=JSON.parse(Gt.Ot(e))||{}}catch{}return t},At(e,t,n,i,a){if(!me)return!1;try{let c="",u="";const f=(function(m,v){if(v){let x=(function(b,y=me){if(Ac)return Ac;if(!y||["localhost","127.0.0.1"].includes(b))return"";const _=b.split(".");let j=Math.min(_.length,8);const N="dmn_chk_"+li();for(;!Ac&&j--;){const S=_.slice(j).join("."),C=N+"=1;domain=."+S+";path=/";y.cookie=C+";max-age=3",y.cookie.includes(N)&&(y.cookie=C+";max-age=0",Ac=S)}return Ac})(m);if(!x){const b=(y=>{const _=y.match(z6);return _?_[0]:""})(m);b!==x&&_e.info("Warning: cookie subdomain discovery mismatch",b,x),x=b}return x?"; domain=."+x:""}return""})(me.location.hostname,i);if(n){const m=new Date;m.setTime(m.getTime()+864e5*n),c="; expires="+m.toUTCString()}a&&(u="; secure");const h=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return h.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+h.length),me.cookie=h,!0}catch{return!1}},Lt(e,t){if(me!=null&&me.cookie)try{Gt.At(e,"",-1,t)}catch{return}}};let mg=null;const ot={Et(){if(!Wt(mg))return mg;let e=!0;if(de(re))e=!1;else try{const t="__mplssupport__";ot.At(t,"xyz"),ot.Ot(t)!=='"xyz"'&&(e=!1),ot.Lt(t)}catch{e=!1}return e||_e.error("localStorage unsupported; falling back to cookie store"),mg=e,e},Pt(e){_e.error("localStorage error: "+e)},Ot(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){ot.Pt(t)}return null},Dt(e){try{return JSON.parse(ot.Ot(e))||{}}catch{}return null},At(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ot.Pt(n)}return!1},Lt(e){try{re==null||re.localStorage.removeItem(e)}catch(t){ot.Pt(t)}}},gg=[aa,ur,ai,el,ra,tl,ca,hu,oa],Za=[vx,ii,oo,BS,_x,co,ri,ns],Zf=e=>e+"_cpm",$6=["__proto__","constructor","prototype"],xg=e=>{if(!nt(e))return{};const t={};return Object.keys(e).forEach(n=>{$6.indexOf(n)===-1&&(t[n]=e[n])}),t},vg=(e,t=[])=>{const n={};return[...Za,...t].forEach(i=>{const a=e[i];de(a)||Wt(a)||a===""||(n[i]=a)}),n},ZS=e=>{let t=5381,n=2166136261;for(let i=0;e.length>i;i++){const a=e.charCodeAt(i);t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},a5=(e,t)=>({p:t,f:ZS(JSON.stringify(e))}),l5=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Gt.Dt(Zf(e)),i=(n==null?void 0:n.f)===ZS(t)&&Ue(n.p);return{properties:i?n.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},bg=(e,t)=>t+"|"+(Gt.Ot(Zf(e))||""),Zl={},B0={Et:()=>!0,Pt(e){_e.error("memoryStorage error: "+e)},Ot:e=>e in Zl?Zl[e]:null,Dt:e=>e in Zl?Zl[e]:null,At:(e,t)=>(Zl[e]=t,!0),Lt(e){delete Zl[e]}};let qa=null;const Ot={Et(){if(!Wt(qa))return qa;if(qa=!0,de(re))qa=!1;else try{const e="__support__";Ot.At(e,"xyz"),Ot.Ot(e)!=='"xyz"'&&(qa=!1),Ot.Lt(e)}catch{qa=!1}return qa},Pt(e){_e.error("sessionStorage error: ",e)},Ot(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){Ot.Pt(t)}return null},Dt(e){try{return JSON.parse(Ot.Ot(e))||null}catch{}return null},At(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Ot.Pt(n)}return!1},Lt(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){Ot.Pt(t)}}};var B6=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.Fo.At(this.Oo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get Ao(){const e=this.Fo.Ot(this.Oo);return sg(e)?1:Ie(nT,e)?0:-1}get Fo(){const e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?ot:Gt,n=t.Et()?t:B0;if(!this.Do||this.Do!==n){this.Do=n;const i=e==="localStorage"?Gt:ot;i.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(sg(i.Ot(this.Oo))),i.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[jn==null?void 0:jn.doNotTrack,jn==null?void 0:jn.msDoNotTrack,$e.doNotTrack,jn==null?void 0:jn.globalPrivacyControl].some(e=>sg(e))}};function JS(e,t){var n;const i=e==null||(n=e.config)===null||n===void 0?void 0:n.get_current_url;if(!Pn(i))return t;try{const a=i(t);return it(a)&&a?a:t}catch(a){return _e.error("Error in get_current_url, falling back to window.location.href",a),t}}function o5(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Oi(e){return!!e&&e.nodeType===1}function Un(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ek(e){return!!e&&e.nodeType===3}function jx(e){return!!e&&e.nodeType===11&&Oi(e.host)}function Nx(e){return e?hh(e).split(/\s+/):[]}function c5(e,t){const n=(function(i){var a;const c=re==null||(a=re.location)===null||a===void 0?void 0:a.href;return de(c)?void 0:JS(i,c)})(t);return!!(n&&e&&e.some(i=>n.match(i)))}function go(e){let 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 Nx(t)}function tk(e){return Ve(e)?null:hh(e).split(/(\s+)/).filter(t=>eu(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function mu(e){let t="";return ho(e)&&!gu(e)&&e.childNodes&&e.childNodes.length&&yt(e.childNodes,function(n){var i;ek(n)&&n.textContent&&(t+=(i=tk(n.textContent))!==null&&i!==void 0?i:"")}),hh(t)}function Jc(e){var t;return de(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Cx=["a","button","form","input","select","textarea","label"];function P0(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}function U0(e,t){if(de(t))return!0;for(const n of e)if(t.some(i=>P0(n,i)))return!0;return!1}function nk(e){const t=e.parentNode;return!(!t||!Oi(t))&&t}const yg=[".ph-no-autocapture","[data-ph-no-autocapture]"],sk=["next","previous","prev",">","<"],P6=[...sk,"+","-","−","–"],u5=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,d5=[".ph-no-rageclick",".ph-no-capture"],U6=["","text","search","email","password","url","tel","number"];function ik(e,t){if(!re||Ex(e))return!1;let n,i,a;var c,u;if(ss(t)?(n=!!t&&d5,i=void 0,a=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:d5,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!Oi(h))&&(!!Un(h,"textarea")||(Un(h,"input")?Ie(U6,(h.getAttribute("type")||"").toLowerCase()):(function(m){var v;if(m.isContentEditable)return!0;const x=(v=m.getAttribute)===null||v===void 0?void 0:v.call(m,"contenteditable");return x==="true"||x===""})(h)))})(e))return!1;const{targetElementList:f}=rk(e,!1);return!(function(h,m){if(h===!1||de(h))return!1;let v;if(h===!0)v=sk;else{if(!Ue(h))return!1;if(h.length>10)return _e.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;v=h.map(x=>x.toLowerCase())}return m.some(({safeText:x,ariaLabel:b})=>v.some(y=>u5(x,y)||u5(b,y)))})(i,f.map(h=>{var m;return{safeText:mu(h).toLowerCase(),ariaLabel:((m=h.getAttribute("aria-label"))===null||m===void 0?void 0:m.toLowerCase().trim())||""}}))&&!U0(f,n)}const Ex=e=>!e||Un(e,"html")||!Oi(e),rk=(e,t)=>{if(!re||Ex(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const i=[e];let a=e;for(;a.parentNode&&!Un(a,"body");){if(jx(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}const c=nk(a);if(!c)break;if(t||Cx.indexOf(c.tagName.toLowerCase())>-1)n=!0;else try{const u=re.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(c),a=c}return{parentIsUsefulElement:n,targetElementList:i}};function ho(e){const t=new Set;let n=0;for(let c=e;c.parentNode&&!Un(c,"body");c=c.parentNode){if(n++>=1e3||t.has(c))return!1;t.add(c);const u=go(c);if(Ie(u,"ph-sensitive")||Ie(u,"ph-no-capture"))return!1}if(Ie(go(e),"ph-include"))return!0;const i=e.type||"";if(it(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const a=e.name||e.id||"";return!it(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function gu(e){return!!(Un(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Un(e,"select")||Un(e,"textarea")||e.getAttribute("contenteditable")==="true")}const f5=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}))$"),h5=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,F6=[16,15,14,13],I6=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),p5=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),m5=/[0-9A-Za-z_]/;function H6(e){let t=0,n=!1;for(let i=e.length-1;i>=0;i--){let a=e.charCodeAt(i)-48;n&&(a*=2,a>9&&(a-=9)),t+=a,n=!n}return t%10==0}function eu(e,t=!0){return!(Ve(e)||it(e)&&(e=hh(e),(t?f5.test((e||"").replace(/[- ]/g,"")):(function(n){let i;for(h5.lastIndex=0;i=h5.exec(n);){const a=i[2];if(!a)continue;const c=a.replace(/[- ]/g,"");for(let u=0;c.length>u;u++)for(const f of F6){const h=u+f;if(c.length>=h){const m=c.slice(u,h);if(f5.test(m)&&H6(m))return!0}}}return!1})(e))||(t?I6.test(e):(function(n){let i;for(p5.lastIndex=0;i=p5.exec(n);){const a=i[1],c=i[3];if(!(a&&c&&m5.test(a)&&m5.test(c)))return!0}return!1})(e))))}function g5(e){let t=mu(e);return t=`${t} ${ak(e)}`.trim(),eu(t)?t:""}function ak(e){let t="";return e&&e.childNodes&&e.childNodes.length&&yt(e.childNodes,function(n){var i;if(n&&((i=n.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const a=mu(n);t=`${t} ${a}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${ak(n)}`.trim())}catch(a){_e.error("[AutoCapture]",a)}}),t}function x5(e){return e.replace(/"|\\"/g,'\\"')}function q6(e){const t=e.attr__class;if(t)return Ue(t)?t:Nx(t)}const uf=Jt("[Dead Clicks]"),V6=()=>!0,G6=e=>{var t;const n=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(bx)),i=e.instance.config.capture_dead_clicks;return ss(i)?i:!!nt(i)||n};var v5=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[bx]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this.instance,"dead-clicks-autocapture",a=>{a?uf.error("failed to load script",a):e()})}qo(){var e;if(me){if(!this.Lo&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=nt(this.instance.config.capture_dead_clicks)?U({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=$e.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(me),uf.info("starting...")}}else uf.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,uf.info("stopping..."))}};const Rc=Jt("[SegmentIntegration]");function b5(e,t,n=!0){const i=e.config.segment;if(!i)return t();const{analytics:a,filterProperties:c}=(f=>Pn(f.register))(u=i)?{analytics:u}:u;var u;(function(f,h,m,v){const x=y=>{const _=()=>y.anonymousId()||li();f.config.get_device_id=_,v&&y.id()&&(f.register({distinct_id:y.id(),$device_id:_()}),f.persistence.set_property(ns,Af)),m(v?void 0:y.anonymousId()||void 0)},b=h.user();"then"in b&&Pn(b.then)?b.then(x):x(b)})(e,a,f=>{a.register(((h,m,{filterProperties:v}={})=>{typeof Promise<"u"&&Promise.resolve||Rc.warn("This browser does not have Promise support, and can not use the segment integration");const x=(b,y)=>{if(!y)return b;const _=!!m&&b.event.anonymousId===m&&!b.event.userId;_||b.event.userId||b.event.anonymousId===h.get_distinct_id()||(Rc.info("No userId set, resetting PostHog"),h.reset()),_||(m=void 0),b.event.userId&&b.event.userId!==h.get_distinct_id()&&(Rc.info("UserId set, identifying with PostHog"),h.identify(b.event.userId));let j=h.calculateEventProperties(y,b.event.properties);if(!Ve(v)){const N=b.event.properties||{},S={};for(const E of Object.keys(j))hx.call(N,E)||(S[E]=j[E]);const C=((E,L)=>{const O=Ue(E)?E:[E];let R=U({},L);for(const F of O)try{if(R=F(R),Ve(R))return null}catch(D){return Rc.error("Error in Segment filterProperties:",D),null}return R})(v,S);if(Ve(C))return b;j=C}return b.event.properties=Object.assign({},j,b.event.properties),b};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(b){return x(b,b.event.event)},page(b){return x(b,Sx)},identify(b){return x(b,L0)},screen(b){return x(b,"$screen")}}})(e,f,{filterProperties:c})).then(()=>{t()},h=>{Rc.error("Failed to register the Segment integration",h),t()})},n)}const lk="posthog-js";function ok(e,{organization:t,projectId:n,prefix:i,severityAllowList:a=["error"],sendExceptionsToPostHog:c=!0}={}){return u=>{var f,h,m,v,x;if(a!=="*"&&!a.includes(u.level)||!e.__loaded)return u;u.tags||(u.tags={});const b=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);u.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const y=((f=u.exception)===null||f===void 0?void 0:f.values)||[],_=y.map(S=>U(U({},S),{},{stacktrace:S.stacktrace?U(U({},S.stacktrace),{},{type:"raw",frames:(S.stacktrace.frames||[]).map(C=>U(U({},C),{},{platform:"web:javascript"}))}):void 0})),j={$exception_message:((h=y[0])===null||h===void 0?void 0:h.value)||u.message,$exception_type:(m=y[0])===null||m===void 0?void 0:m.type,$exception_level:u.level,$exception_list:_,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((v=y[0])===null||v===void 0?void 0:v.value)||u.message,$sentry_exception_type:(x=y[0])===null||x===void 0?void 0:x.type,$sentry_tags:u.tags};var N;return t&&n&&(j.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+u.event_id),c&&((N=e.exceptions)===null||N===void 0||N.sendExceptionEvent(j)),u}}var Y6=class{constructor(e,t,n,i,a,c){this.name=lk,this.setupOnce=function(u){u(ok(e,{organization:t,projectId:n,prefix:i,severityAllowList:a,sendExceptionsToPostHog:c==null||c}))}}},y5=class{constructor(e){this.jo=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ho()}Ho(){var e;this.zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.jo)}destroy(){var e;(e=this.zo)===null||e===void 0||e.call(this),this.zo=void 0}doPageView(e,t){var n;const i=this.Uo(e,t);return this.Bo={pathname:(n=re==null?void 0:re.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Uo(e,(t=this.Bo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Bo)===null||e===void 0?void 0:e.pageViewId}}Uo(e,t){const n=this.Bo;if(!n)return{$pageview_id:t};let i={$pageview_id:t,$prev_pageview_id:n.pageViewId};const a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:c,lastScrollY:u,maxScrollY:f,maxContentHeight:h,lastContentY:m,maxContentY:v}=a;if(!(de(c)||de(u)||de(f)||de(h)||de(m)||de(v))){c=Math.ceil(c),u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),m=Math.ceil(m),v=Math.ceil(v);const x=c>1?Ai(u/c,0,1,_e):1,b=c>1?Ai(f/c,0,1,_e):1,y=h>1?Ai(m/h,0,1,_e):1,_=h>1?Ai(v/h,0,1,_e):1;i=Dt(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:x,$prev_pageview_max_scroll:f,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:m,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};const Oc=["flags","surveys"],X6={[t6]:{exposure:"hidden"},[Qf]:{exposure:"hidden"},[n6]:{exposure:"hidden"},[j0]:{exposure:"hidden"},[ri]:{exposure:"hidden"},[LS]:{exposure:"event"},[N0]:{exposure:"hidden"},[zS]:{exposure:"hidden"},[C0]:{exposure:"event"},[DS]:{exposure:"hidden"},[E0]:{exposure:"event"},[T0]:{exposure:"event"},[bx]:{exposure:"event"},[yx]:{exposure:"hidden"},[$S]:{exposure:"event"},[Wc]:{exposure:"hidden"},[s6]:{exposure:"hidden"},[oo]:{exposure:"hidden"},[BS]:{exposure:"event"},[i6]:{exposure:"event",shouldSkipFromEventProperties:e=>Wt(e)},[c6]:{exposure:"event"},[u6]:{exposure:"event"},[d6]:{exposure:"event"},[f6]:{exposure:"event"},[h6]:{exposure:"hidden"},[ai]:{exposure:"hidden",storageGroup:"flags"},[ur]:{exposure:"hidden",storageGroup:"flags"},[M0]:{exposure:"hidden"},[el]:{exposure:"hidden",storageGroup:"flags"},[ra]:{exposure:"hidden",storageGroup:"flags"},[tl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Zc]:{exposure:"hidden",storageGroup:"flags"},[Ei]:{exposure:"hidden"},[Wa]:{exposure:"hidden"},[aa]:{exposure:"hidden"},[la]:{exposure:"hidden"},[A0]:{exposure:"hidden",storageGroup:"surveys"},[Kf]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[US]:{exposure:"event"},[FS]:{exposure:"hidden"},[IS]:{exposure:"hidden"},[R0]:{exposure:"hidden"},[p6]:{exposure:"hidden"},[m6]:{exposure:"hidden"},[g6]:{exposure:"event"},[x6]:{exposure:"event"},[v6]:{exposure:"event"},[b6]:{exposure:"event"},[oa]:{exposure:"hidden"},[qc]:{exposure:"hidden"},[PS]:{exposure:"event"},[hu]:{exposure:"hidden"},[ca]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ns]:{exposure:"hidden"},[O0]:{exposure:"hidden"},[y6]:{exposure:"hidden"},[HS]:{exposure:"hidden"},[qS]:{exposure:"hidden"},[co]:{exposure:"hidden"},[_x]:{exposure:"hidden"},[r6]:{exposure:"event"},[a6]:{exposure:"event"},[l6]:{exposure:"event"},[o6]:{exposure:"event"},[GS]:{exposure:"event"},[YS]:{exposure:"event"},[XS]:{exposure:"event"},[_6]:{exposure:"event"},[w6]:{exposure:"event"},[S6]:{exposure:"event"},[k6]:{exposure:"event"},[j6]:{exposure:"event"},[N6]:{exposure:"event"},[C6]:{exposure:"event"},[E6]:{exposure:"event"}},Q6=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{const t=X6[e];if(t)return t;for(const[n,i]of Q6)if(e.indexOf(n)===0)return i},uo=(e,t)=>{try{let n;return JSON.stringify(e,(i,a)=>{var c;return ku(a)?((c=n)!==null&&c!==void 0||(n=new WeakMap),n.has(a)||n.set(a,KS(a)),n.get(a)):typeof a=="bigint"?a.toString():a},t)}catch{return D2(e)}},xo=e=>{const t=me==null?void 0:me.createElement("a");return de(t)?null:(t.href=e,t)},vo=function(e,t){const n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let a=0;n.length>a;a++){const c=n[a].split("=");if(c[0]===t){i=c;break}}if(!Ue(i)||2>i.length)return"";{let a=i[1];try{a=decodeURIComponent(a)}catch{_e.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")}},xu=function(e,t,n){if(!e||!t||!t.length)return e;const i=e.split("#"),a=i[1],c=(i[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),m=[];for(let x=0;h.length>x;x++){const b=h[x].split("=");Ue(b)&&(t.includes(b[0])?m.push(b[0]+"="+n):m.push(h[x]))}let v=f;return u!=null&&(v+="?"+m.join("&")),a!=null&&(v+="#"+a),v},Jf=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ck=(e,t)=>e>=t&&L2(),uk=(e,t,n,i)=>{if(e===0){if(L2()){const a=t+1;return a===n&&i(),a}return t}return 0},bo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],K6=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...bo],vu="<masked>",W6=["li_fat_id"];function dk(e,t,n){if(!me)return{};const i=t?[...bo,...n||[]]:[],a=fk(xu(me.URL,i,vu),e),c=(function(){const u={};return yt(W6,function(f){const h=z0(f);u[f]=h||null}),u})();return Dt(c,a)}function fk(e,t){const n=K6.concat(t||[]),i={};return yt(n,function(a){const c=vo(e,a);i[a]=c||null}),i}function hk(e){const t=(function(a){return a?a.search("https?://(.*)google.([^/?]*)")===0?"google":a.search("https?://(.*)bing.com")===0?"bing":a.search("https?://(.*)yahoo.com")===0?"yahoo":a.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Wt(t)){i.$search_engine=t;const a=me?vo(me.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function pk(){return navigator.language||navigator.userLanguage}function Z6(){const e=pk();return typeof e=="string"?e.split("-")[0]:void 0}const eh="$direct";function mk(){return(me==null?void 0:me.referrer)||eh}function gk(e,t,n=!1){const i=e?[...bo,...t||[]]:[],a=n?da(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,c=a==null?void 0:a.substring(0,1e3);return{r:mk().substring(0,1e3),u:c?xu(c,i,vu):void 0}}function xk(e,t=!1){var n;const{r:i,u:a}=e,c=t?da(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==eh?eh:(n=xo(i))===null||n===void 0?void 0:n.host};if(c){u.$current_url=c;const f=xo(c);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;const h=fk(c);Dt(u,h)}if(i){const f=hk(i);Dt(u,f)}return u}function vk(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function J6(){try{return new Date().getTimezoneOffset()}catch{return}}const eM={flags:ca,surveys:Kf},tM=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],df=e=>`${e}_cookie_identity_change_pending`,ff=e=>{let t="",n=0;for(const i of e){const a=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(n+a>1e3)break;t+=i,n+=a}return t},bn="main",cr=[ai,ur,el,ra,tl,ca,Zc,aa],_g=e=>cr.indexOf(e)!==-1,ea=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Jl=e=>{if(!e)return{};const t=JSON.parse(e);return nt(t)?t:{}},_5=(e,t)=>{yt(e,(n,i)=>{const a=An(i);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var wg=class{constructor(e,t,n=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Yo=!1,this.Xo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=n,this.props={},this.sl=void 0,this.rl=(i=>{let a="";return i.token&&(a=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+a+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&_e.info("Persistence loaded",e.persistence,U({},this.props)),this.update_config(e,e,t),this.save(),re){const i=()=>this.flush();Nt(re,"beforeunload",i,{capture:!1}),Nt(re,"pagehide",i,{capture:!1}),this.ul=a=>{if(this.Vo&&(!a.storageArea||a.storageArea===(re==null?void 0:re.localStorage))&&a.key)if(a.key!==this.rl){if(this.Zo){const c=Oc.find(u=>a.key===this.hl(u));c&&this.cl(a.key,c)}}else this.cl(a.key,bn)},Nt(re,"storage",this.ul)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const i=this.Ko.get(t);if(!_g(t)||i===!0)return;if(n===!0)return void this.dl(t,!0);const a=new Set(i||[]);n.forEach(c=>a.add(c)),a.size&&this.dl(t,a)})}onCrossTabFeatureFlagChange(e){return this.il.add(e),()=>this.il.delete(e)}destroy(){this.ul&&re&&(re.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(e,t,n=!0){if(this.pi)return!1;let i,a;try{if(a=ot.Ot(e),Wt(a)){const f=this.vl(t);return f.storageValue=null,t!==bn&&(f.persisted=!1),!1}i=Jl(a)}catch{return!1}const c=t===bn?i:ot.Dt(this.rl);if(c&&this.fl(c))return!1;const u=this.pl(i,t,n);return t===bn&&this.Zo&&!ea(this.gl().main,i)||this.ml(i,t,!0,a),u}fl(e){const t=this.props[ii],n=e[ii];return!de(t)&&!de(n)&&t!==n}ml(e,t,n,i){const a=this.vl(t);a.storageValue=i,t!==bn&&(a.persisted=n);try{a.fingerprint=this.yl(e,t)}catch{a.fingerprint=void 0}}pl(e,t,n){let i=!1;return cr.forEach(a=>{var c;const u=(c=An(a))===null||c===void 0?void 0:c.storageGroup;if(t===bn&&this.Zo&&u||t!==bn&&u!==t)return;const f=a in e,h=this.bl(a,f?e[a]:void 0),m=this.Ko.has(a)?a in this.props:f;m===a in this.props&&ea(h,this.props[a])||(m?this._l(a,h,!1):this.wl(a,!1),i=!0)}),i&&n&&this.il.forEach(a=>a()),i}kl(){if(!this.Vo)return!1;try{this.tl=!1;const e=ot.Ot(this.rl),t=this.vl(bn);let n,i=!1,a=!1;if(e!==t.storageValue)if(Wt(e))t.storageValue=null;else{if(n=Jl(e),this.tl=!this.Xo&&this.fl(n),this.tl)return!1;a=this.pl(n,bn,!1),!this.Zo||ea(this.gl().main,n)?this.ml(n,bn,!0,e):t.storageValue=e,i=!0}return this.Zo&&Oc.forEach(c=>{const u=ot.Ot(this.hl(c)),f=this.vl(c),h=n||{},m=i&&cr.some(x=>{var b;return((b=An(x))===null||b===void 0?void 0:b.storageGroup)===c&&x in h});if(u===f.storageValue&&!m)return;if(Wt(u))return f.storageValue=null,f.persisted=!1,void(m&&(a=this.pl(h,c,!1)||a));const v=Jl(u);a=this.pl(v,c,!1)||a,this.ml(v,c,!0,u)}),a}catch{return!1}}dl(e,t){this.Ko.set(e,t);const n=An(e);n!=null&&n.volatile||(this.vl((this.Zo?n==null?void 0:n.storageGroup:void 0)||bn).fingerprint=void 0,this.Sl(e))}xl(){cr.forEach(e=>this.Ko.set(e,!0))}al(){if(this.Vo)try{const e=ot.Ot(this.rl),t=Jl(e);this.vl(bn).storageValue=e,cr.forEach(n=>{var i;const a=this.Zo?(i=An(n))===null||i===void 0?void 0:i.storageGroup:void 0,c=a?ot.Ot(this.hl(a)):null;if(a){const f=this.vl(a);f.storageValue=c,f.persisted=!Wt(c)}const u=a&&!Wt(c)?Jl(c):t;n in this.props?this.Cl(n,u[n],this.props[n]):n in u&&this.dl(n,!0)})}catch{}}bl(e,t){const n=this.Ko.get(e);if(!n)return t;if(n===!0)return this.props[e];if(e==="$active_feature_flags"){const c=new Set(Ue(t)?t:[]),u=new Set(Ue(this.props[e])?this.props[e]:[]);return n.forEach(f=>u.has(f)?c.add(f):c.delete(f)),Array.from(c)}const i=nt(t)?U({},t):{},a=nt(this.props[e])?this.props[e]:{};return n.forEach(c=>{c in a?i[c]=a[c]:delete i[c]}),i}Cl(e,t,n){if(!_g(e))return;const i=this.Ko.get(e);if(i===!0)return;let a=t;if(this.Vo)try{var c;const f=this.Zo?(c=An(e))===null||c===void 0?void 0:c.storageGroup:void 0,h=f?this.hl(f):this.rl;a=Jl(ot.Ot(h))[e]}catch{}const u=new Set(i||[]);if(e==="$active_feature_flags"){if(!de(t)&&!Ue(t)||!de(a)&&!Ue(a)||!Ue(n))return void this.dl(e,!0);const f=new Set(t||[]),h=new Set(a||[]),m=new Set(n);new Set([...f,...m]).forEach(v=>{f.has(v)!==m.has(v)&&u.add(v)}),u.forEach(v=>{h.has(v)===m.has(v)&&u.delete(v)})}else{if(!nt(n))return void(ea(a,n)?this.Ko.delete(e):this.dl(e,!0));{if(!de(t)&&!nt(t)||de(t)&&gs(n)&&de(a))return void this.dl(e,!0);const f=nt(t)?t:{},h=nt(a)?a:{};new Set([...Object.keys(f),...Object.keys(n)]).forEach(m=>{m in f==m in n&&ea(f[m],n[m])||u.add(m)}),u.forEach(m=>{m in h==m in n&&ea(h[m],n[m])&&u.delete(m)})}}u.size?this.dl(e,u):this.Ko.delete(e)}$l(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Zt(t)&&t>0?t:0}Tl(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=vg(e,this.Mr.cookie_persisted_properties||[]),n=a5(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),a=Gt.Ot(this.rl)||void 0;a&&bg(this.rl,a)===i&&(this.Il=i,this.Ml=a)}catch{}else try{const t=Gt.Ot(this.rl)||void 0;this.Il=t?bg(this.rl,t):void 0,this.Ml=t}catch{}}syncCookieProperties(){return this.El(this.Mr)}El(e,t=!1){if(this.pi&&!t||this.Jo||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let n;try{n=Gt.Ot(this.rl)||void 0}catch{}if(!n||n===this.Ml)return!1;const i=bg(this.rl,n);let a;try{a=xg(JSON.parse(n))}catch{return!1}if((Gt.Ot(this.rl)||void 0)!==n)return!1;this.Il=i,this.Ml=n;const c=l5(this.rl,n),u=[...Za,...c.properties],f={};if(Object.keys(a).forEach(j=>{const N=a[j];(de(N)||Wt(N)||N===""||j==="$user_state"&&N!=="anonymous"&&N!=="identified")&&(f[j]=!0,delete a[j])}),gs(a))return!1;const h="distinct_id"in a||a.$user_state==="anonymous"||a.$user_state==="identified",m=this.props,v=m[ii],x=m[ns],b=Dt({},m);[...Za,...e.cookie_persisted_properties||[]].forEach(j=>{if(u.indexOf(j)!==-1&&!(j in a)&&!f[j]&&(h||j!=="distinct_id"&&j!=="$user_state")){const N=b[j];(c.isValid||Za.indexOf(j)===-1||N!==!1&&N!==0)&&delete b[j]}}),this.props=Dt(b,a),cr.forEach(j=>{const N=j in this.props;j in m===N&&ea(m[j],this.props[j])||(N?this.Cl(j,m[j],this.props[j]):this.dl(j,!0))}),!h||"$user_state"in a||"$user_state"in this.props||this._l(ns,dr);const y=this.props[ii],_=this.props[ns];return!h||y===v&&_===x||(this.Xo=!0,this.Qo=!0,Ot.At(df(this.rl),!0),this.wl(aa),this.wl(ur),this.wl(ai),this.wl(el),this.wl(ra),this.wl(tl),this.wl(ca),this.wl(hu),this.wl(oa),_!=="anonymous"||x!=="identified"&&a.$user_state!=="anonymous"&&(de(v)||y===v)||(_5(this.props,a),this.wl(la)),_==="identified"?this.props.$user_id=y:delete this.props.$user_id,this.wl(Qf)),!0}consumeCookieIdentityChange(){const e=df(this.rl),t=this.Qo||!!Ot.Ot(e);return this.Qo=!1,t&&Ot.Lt(e),t}Pl(e=!1){return!(this.Jo||this.pi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.Jo=!0,0))}Rl(){this.Jo&&(de(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[bn],this.Fl(!0))}Ol(e=!0){if(this.Jo)try{e?this.Rl():de(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){tM.indexOf(e.persistence.toLowerCase())===-1&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((u=[],f=!1)=>{const h=[...Za,...u];return U(U({},ot),{},{Dt(m){try{let x,b={};try{x=Gt.Ot(m)||void 0,b=x?xg(JSON.parse(x)):{}}catch{}const y=JSON.parse(ot.Ot(m)||"{}");let _;if(f){const j=l5(m,x),N=[...Za,...j.properties],S={};Object.keys(b).forEach(E=>{const L=b[E];Wt(L)||L===""||E==="$user_state"&&L!=="anonymous"&&L!=="identified"||(S[E]=L)});const C="distinct_id"in S||S.$user_state==="anonymous"||S.$user_state==="identified";if(Object.keys(S).length>0){var v;const E=y[ii],L=(v=y.$user_state)!==null&&v!==void 0?v:dr;h.forEach(O=>{if(N.indexOf(O)!==-1&&!(O in b)&&(C||O!=="distinct_id"&&O!=="$user_state")){const R=y[O];(j.isValid||Za.indexOf(O)===-1||R!==!1&&R!==0)&&delete y[O]}}),!C||"$user_state"in b||"$user_state"in y||(y[ns]=dr),!C||("distinct_id"in S?S[ii]:y[ii])===E&&("$user_state"in S?S[ns]:y[ns])===L||(gg.forEach(O=>delete y[O]),S.$user_state==="identified"&&"distinct_id"in S?y.$user_id=S[ii]:delete y.$user_id,S.$user_state!=="identified"&&(delete y[PS],delete y[la]),delete y.__alias)}_=Dt(y,S)}else _=Dt(b,y);return ot.At(m,_),_}catch{}return null},At(m,v,x,b,y,_){const j=ot.At(m,v,void 0,void 0,_);try{const N=vg(v,u);if(Object.keys(N).length){if(f){const S=Zf(m),C=a5(N,u);if(Gt.At(S,C,x,b,y,_),Gt.Ot(S)!==JSON.stringify(C)){Gt.Lt(S,b);const E=vg(v);return Gt.At(m,E,x,b,y,_),j}}Gt.At(m,N,x,b,y,_)}}catch(N){ot.Pt(N)}return j},Lt(m,v){try{re==null||re.localStorage.removeItem(m),Gt.Lt(m,v),Gt.Lt(Zf(m),v)}catch(x){ot.Pt(x)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,i=!1,a=!1;const c=e.persistence.toLowerCase();return c==="localstorage"&&ot.Et()?(n=ot,a=!0):c==="localstorage+cookie"&&t.Et()?(n=t,a=!0,i=!0):c==="sessionstorage"&&Ot.Et()?n=Ot:c==="memory"?n=B0:c==="cookie"&&Gt.Et()?(n=Gt,i=!0):t.Et()?(n=t,a=!0,i=!0):Gt.Et()?(n=Gt,i=!0):n=B0,this.Vo=a,this.Go=i,n}hl(e){return`${this.rl}__${e}`}ll(e){return this.Vo&&!!e.split_storage}properties(){const e={};return yt(this.props,(t,n)=>{const i=An(n);if(!i||i.exposure==="event"){var a;if(!(i==null||(a=i.shouldSkipFromEventProperties)===null||a===void 0)&&a.call(i,t))return;e[n]=t}}),e}load(e=!1){if(this.pi&&!e)return;const t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",n=t?ot.Dt(this.rl):null;let i={};if(t)try{i=xg(Gt.Dt(this.rl)),yt(i,(f,h)=>{(de(f)||Wt(f)||f==="")&&delete i[h]})}catch{}const a=this.Fo.Dt(this.rl);if(a&&(this.props=Dt({},a)),this.Zo&&this.Dl(),t&&a){var c,u;const f=n==null?void 0:n[ii],h=(c=n==null?void 0:n.$user_state)!==null&&c!==void 0?c:dr,m=a[ii],v=(u=a.$user_state)!==null&&u!==void 0?u:dr;if(m!==f||v!==h){this.Qo=!0,Ot.At(df(this.rl),!0);const x=Dt({},this.props);gg.forEach(y=>delete x[y]),v!=="anonymous"||h!=="identified"&&i.$user_state!=="anonymous"&&(de(f)||m===f)||(_5(x,i),delete x[la]),this.props=x;const b=new Set;gg.forEach(y=>{var _;const j=(_=An(y))===null||_===void 0?void 0:_.storageGroup;j&&b.add(j)}),b.forEach(y=>{const _={};yt(this.props,(j,N)=>{var S;((S=An(N))===null||S===void 0?void 0:S.storageGroup)===y&&(_[N]=j)}),gs(_)?(ot.Lt(this.hl(y)),this.Wo[y]={}):ot.At(this.hl(y),_)&&(this.Wo[y]={persisted:!0,fingerprint:this.yl(_,y)})})}}Ot.Ot(df(this.rl))&&(this.Qo=!0)}Dl(){for(const e of Oc){const t=ot.Dt(this.hl(e));if(t&&!gs(t)){const n=this.vl(e);n.persisted=!0,this.Ll(e)||(n.fingerprint=this.yl(t,e)),this.Nl(e,t)||Dt(this.props,t)}}}Ll(e){return Object.keys(this.props).some(t=>{var n;return((n=An(t))===null||n===void 0?void 0:n.storageGroup)===e})}Nl(e,t){const n=eM[e];if(!n)return!1;const i=t[n],a=this.props[n];return Zt(i)&&Zt(a)&&a>i}refreshKey(e){var t;if(this.pi||e==="$fbc_persistence"&&this.el)return;const n=this.Zo?(t=An(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=n?ot.Dt(this.hl(n)):this.Fo.Dt(this.rl);if(i&&e in i)this._l(e,i[e],!1);else{if(n){const a=this.Fo.Dt(this.rl);if(a&&e in a)return void this._l(e,a[e],!1)}this.wl(e,!1)}}save(){if(this.pi)return;const e=this.$l();e>0?de(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},e)):this.Fl()}flush(){de(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(e=!1){if(this.pi||this.Jo&&!e)return;e||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(ri));const t=!e&&!this.Yo;t||(this.tl=!1);const n=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&_e.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(n&&this.il.forEach(a=>a()));const i=this.jl(this.Fo,this.rl,this.props,bn);i==="written"&&this.Tl(this.props),i!=="failed"&&(this.Ko.clear(),this.Xo=!1,this.el=!1),n&&this.il.forEach(a=>a())}ql(){const{main:e,groups:t}=this.gl(),n=this.jl(this.Fo,this.rl,e,bn);n==="written"&&this.Tl(e),n!=="failed"&&(this.Xo=!1,this.el=!1,cr.forEach(a=>{var c;!((c=An(a))===null||c===void 0)&&c.storageGroup||this.Ko.delete(a)}));for(const a of Oc){var i;const c=t[a];if(gs(c)&&!(!((i=this.Wo[a])===null||i===void 0)&&i.persisted)){cr.forEach(f=>{var h;((h=An(f))===null||h===void 0?void 0:h.storageGroup)===a&&this.Ko.delete(f)});continue}const u=this.jl(ot,this.hl(a),c,a);u!=="failed"&&cr.forEach(f=>{const h=An(f);(h==null?void 0:h.storageGroup)!==a||u!=="written"&&h.volatile||this.Ko.delete(f)})}}gl(){const e={},t={flags:{},surveys:{}};return yt(this.props,(n,i)=>{var a;const c=(a=An(i))===null||a===void 0?void 0:a.storageGroup;c?t[c][i]=n:e[i]=n}),{main:e,groups:t}}yl(e,t){if(t===bn)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const n={};return yt(e,(i,a)=>{var c;n[a]=!((c=An(a))===null||c===void 0)&&c.volatile?"__volatile__":i}),JSON.stringify(n)}jl(e,t,n,i){const a=this.vl(i);if(i!==bn&&!a.dirty&&!de(a.fingerprint))return"skipped";let c;try{if(c=this.yl(n,i),c===a.fingerprint)return a.dirty=!1,"skipped"}catch{c=void 0}return e.At(t,n,this.Bl,this.Hl,this.zl,this.Mr.debug)?(a.dirty=!1,i!==bn&&(a.persisted=!0),de(c)||(a.fingerprint=c),this.Vo&&(a.storageValue=ot.Ot(t)),"written"):(this.Mr.debug&&_e.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.xl(),de(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!e&&this.nl)for(const t of Oc)ot.Lt(this.hl(t));e?delete this.Wo[bn]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(nt(e)){this.syncCookieProperties(),de(t)&&(t="None"),this.Bl=de(n)?this.Ul:n;let i=!1;if(yt(e,(a,c)=>{this.props.hasOwnProperty(c)&&this.props[c]!==t||(this._l(c,a),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(nt(e)){this.syncCookieProperties(),this.Bl=de(t)?this.Ul:t;let n=!1;if(yt(e,(i,a)=>{e.hasOwnProperty(a)&&(this.props[a]!==i||nt(i)||Ue(i))&&(this._l(a,i),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let n=!1;for(const i of t)i in this.props&&(this.wl(i),n=!0);n&&this.save()}update_campaign_params(){const e=me==null?void 0:me.URL;if(e===this.sl)return;const t=dk(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),n=!gs(kx(t));return n&&this.register(t),this.sl=e,n?t:void 0}update_search_keyword(){this.register((function(){const e=me==null?void 0:me.referrer;return e?hk(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:mk(),$referring_domain:(me==null?void 0:me.referrer)&&((e=xo(me.referrer))===null||e===void 0?void 0:e.host)||eh},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=gk(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[co]:this.Go?{r:ff(e.r),u:e.u?ff(e.u):void 0}:e},void 0)}get_initial_props(){const e={};yt([qS,HS],n=>{const i=this.props[n];i&&yt(i,function(a,c){e["$initial_"+x0(c)]=a})});const t=this.props[co];if(t){const n=(function(i,a=!1){const c=xk(i,a),u={};return yt(c,function(f,h){u[`$initial_${x0(h)}`]=f}),u})(t,this.Mr.disable_capture_url_hashes);Dt(e,n)}return e}safe_merge(e){return yt(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){const i=e.persistence!==t.persistence,a=!((y,_)=>{if(y.length!==_.length)return!1;const j=[...y].sort(),N=[..._].sort();return j.every((S,C)=>S===N[C])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),c=i||a,u=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,f=e.disable_persistence||!!n,h=!!this.pi&&!f;f||this.El(t,h),this.Mr=e,!f&&(i||a||u)&&(this.Il=void 0,this.Ml=void 0,this.El(U(U({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),h));const m=c||u?this.ol(e):this.Fo;this.Wl();const v=this.ll(e),x=c||v!==this.Zo,b=!f&&(x||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(h);this.Yo=x;try{if(this.Ul=this.Bl=e.cookie_expiration,this.set_disabled(f),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),x){const y=this.props;this.clear(),this.Fo=m,this.Zo=v,this.props=y,this.save()}else u&&(this.Fo=m,f||(delete this.Wo[bn],this.Fl()))}finally{this.Yo=!1,b&&this.Ol()}}Wl(){const e=this.props[co];if(!this.Go||!nt(e)||typeof e.r!="string")return;const t=ff(e.r),n=typeof e.u=="string"?ff(e.u):e.u;t===e.r&&n===e.u||this._l(co,U(U({},e),{},{r:t,u:n}))}set_disabled(e){this.pi=e,this.pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Hl&&(this.Hl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const n=this.props.__timers||{};n[e]=t,this._l(j0,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return de(n)||(delete t[e],this._l(j0,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this._l(e,t),this.save()}_l(e,t,n=!0){var i;const a=this.props[e];this.props[e]=t,n&&(e!=="distinct_id"&&e!=="$user_state"||a===t||(this.Xo=!0),e!=="$fbc_persistence"||ea(a,t)||(this.el=!0),this.Cl(e,a,t),!((i=An(e))===null||i===void 0)&&i.volatile||this.Sl(e))}wl(e,t=!0){delete this.props[e],t&&(_g(e)&&this.dl(e,!0),e==="$fbc_persistence"&&(this.el=!0),this.Sl(e))}Sl(e){var t;const n=(t=An(e))===null||t===void 0?void 0:t.storageGroup;n&&(this.vl(n).dirty=!0)}vl(e){return this.Wo[e]||(this.Wo[e]={})}};const As={GZipJS:"gzip-js",Base64:"base64"},Lc={Activation:"events",Cancellation:"cancelEvents"},Sg={Popover:"popover",API:"api",Widget:"widget"},fr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},kg={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},F0={Popover:"popover",Inline:"inline"};function hf(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&Pn(n.then)&&n.then(void 0,()=>{})}}}}const nM={SHOWN:"product tour shown"},w5={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},S5=Jt("[RateLimiter]");var sM=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(i=>{S5.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void S5.warn(`could not rate limit - continuing. Error: "${i==null?void 0:i.message}"`,{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,n,i;const{captureEventsBurstLimit:a,captureEventsPerSecond:c}=this,u=new Date().getTime(),f=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:a,last:u};f.tokens+=(u-f.last)/1e3*c,f.last=u,f.tokens>a&&(f.tokens=a);const h=1>f.tokens;if(h||e||(f.tokens=Math.max(0,f.tokens-1)),h&&!e){const m=(Zt(f.dropped)?f.dropped:0)+1;f.dropped=m,!this.lastEventRateLimited&&this.Vl(m)&&(f.dropped=0)}return this.lastEventRateLimited=h,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",f),{isRateLimited:h,remainingTokens:f.tokens}}Gl(e){const t=this.instance.config.property_denylist;return!Ue(t)||!t.includes(e)}Zl(){var e;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(Yt!=null&&Yt.pathname))return`${(e=Yt.origin)!==null&&e!==void 0?e:""}${Yt.pathname}`}Vl(e){var t,n;const{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,c=this.Zl(),u=this.Gl("$session_id")?(t=(n=this.instance).get_session_id)===null||t===void 0?void 0:t.call(n):void 0,f=[`${e} event(s) dropped since the last warning`,c?`triggered on ${c}`:void 0,u?`session ${u}`: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 ${a} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const ta=Jt("[RemoteConfig]");var bk=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$e._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ql(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Jl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return ta.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Yl())return void ta.warn("Remote config is disabled. Falling back to local config.");this.Ql(e=>{if(!e)return ta.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(e)})}catch(e){ta.error("Error loading remote config",e),this.Kl()}}Kl(e,t){!e&&t&&(t.statusCode===0?t.error||ta.warn("Failed to fetch remote config from PostHog."):ta.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(i){ta.error("Error applying remote config",i)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)===null||n===void 0||n.ensureFlagsLoaded()}catch(i){ta.error("Error loading feature flags",i)}}},Gs=Uint8Array,xs=Uint16Array,yo=Uint32Array,Tx=new Gs([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]),Mx=new Gs([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]),k5=new Gs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yk=function(e,t){for(var n=new xs(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new yo(n[30]);for(i=1;30>i;++i)for(var c=n[i];n[i+1]>c;++c)a[c]=c-n[i]<<5|i;return[n,a]},_k=yk(Tx,2),I0=_k[1];_k[0][28]=258,I0[258]=28;for(var j5=yk(Mx,0)[1],wk=new xs(32768),Xt=0;32768>Xt;++Xt){var eo=(43690&Xt)>>>1|(21845&Xt)<<1;wk[Xt]=((65280&(eo=(61680&(eo=(52428&eo)>>>2|(13107&eo)<<2))>>>4|(3855&eo)<<4))>>>8|(255&eo)<<8)>>>1}var tu=function(e,t,n){for(var i=e.length,a=0,c=new xs(t);i>a;++a)++c[e[a]-1];var u,f=new xs(t);for(a=0;t>a;++a)f[a]=f[a-1]+c[a-1]<<1;for(u=new xs(i),a=0;i>a;++a)u[a]=wk[f[e[a]-1]++]>>>15-e[a];return u},il=new Gs(288);for(Xt=0;144>Xt;++Xt)il[Xt]=8;for(Xt=144;256>Xt;++Xt)il[Xt]=9;for(Xt=256;280>Xt;++Xt)il[Xt]=7;for(Xt=280;288>Xt;++Xt)il[Xt]=8;var th=new Gs(32);for(Xt=0;32>Xt;++Xt)th[Xt]=5;var iM=tu(il,9),rM=tu(th,5),Sk=function(e){return(e/8|0)+(7&e&&1)},kk=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof xs?xs:e instanceof yo?yo:Gs)(n-t);return i.set(e.subarray(t,n)),i},ir=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Dc=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},jg=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,c=n.slice();if(!a)return[new Gs(0),0];if(a==1){var u=new Gs(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort(function(O,R){return O.f-R.f}),n.push({s:-1,f:25001});var f=n[0],h=n[1],m=0,v=1,x=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};v!=a-1;)f=n[n[x].f>n[m].f?m++:x++],h=n[m!=v&&n[x].f>n[m].f?m++:x++],n[v++]={s:-1,f:f.f+h.f,l:f,r:h};var b=c[0].s;for(i=1;a>i;++i)c[i].s>b&&(b=c[i].s);var y=new xs(b+1),_=H0(n[v-1],y,0);if(_>t){i=0;var j=0,N=_-t,S=1<<N;for(c.sort(function(O,R){return y[R.s]-y[O.s]||O.f-R.f});a>i;++i){var C=c[i].s;if(t>=y[C])break;j+=S-(1<<_-y[C]),y[C]=t}for(j>>>=N;j>0;){var E=c[i].s;t>y[E]?j-=1<<t-y[E]++-1:++i}for(;i>=0&&j;--i){var L=c[i].s;y[L]==t&&(--y[L],++j)}_=t}return[new Gs(y),_]},H0=function(e,t,n){return e.s==-1?Math.max(H0(e.l,t,n+1),H0(e.r,t,n+1)):t[e.s]=n},N5=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new xs(++t),i=0,a=e[0],c=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++c;else{if(!a&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(a),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(a);c=1,a=e[f]}return[n.subarray(0,i),t]},zc=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},q0=function(e,t,n){var i=n.length,a=Sk(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var c=0;i>c;++c)e[a+c+4]=n[c];return 8*(a+4+i)},C5=function(e,t,n,i,a,c,u,f,h,m,v){ir(t,v++,n),++a[256];for(var x=jg(a,15),b=x[0],y=x[1],_=jg(c,15),j=_[0],N=_[1],S=N5(b),C=S[0],E=S[1],L=N5(j),O=L[0],R=L[1],F=new xs(19),D=0;C.length>D;++D)F[31&C[D]]++;for(D=0;O.length>D;++D)F[31&O[D]]++;for(var X=jg(F,7),P=X[0],Y=X[1],A=19;A>4&&!P[k5[A-1]];--A);var fe,te,K,G,V=m+5<<3,se=zc(a,il)+zc(c,th)+u,ae=zc(a,b)+zc(c,j)+u+14+3*A+zc(F,P)+(2*F[16]+3*F[17]+7*F[18]);if(se>=V&&ae>=V)return q0(t,v,e.subarray(h,h+m));if(ir(t,v,1+(se>ae)),v+=2,se>ae){fe=tu(b,y),te=b,K=tu(j,N),G=j;var M=tu(P,Y);for(ir(t,v,E-257),ir(t,v+5,R-1),ir(t,v+10,A-4),v+=14,D=0;A>D;++D)ir(t,v+3*D,P[k5[D]]);v+=3*A;for(var Te=[C,O],Ce=0;2>Ce;++Ce){var z=Te[Ce];for(D=0;z.length>D;++D)ir(t,v,M[B=31&z[D]]),v+=P[B],B>15&&(ir(t,v,z[D]>>>5&127),v+=z[D]>>>12)}}else fe=iM,te=il,K=rM,G=th;for(D=0;f>D;++D)if(i[D]>255){var B;Dc(t,v,fe[257+(B=i[D]>>>18&31)]),v+=te[B+257],B>7&&(ir(t,v,i[D]>>>23&31),v+=Tx[B]);var ce=31&i[D];Dc(t,v,K[ce]),v+=G[ce],ce>3&&(Dc(t,v,i[D]>>>5&8191),v+=Mx[ce])}else Dc(t,v,fe[i[D]]),v+=te[i[D]];return Dc(t,v,fe[256]),v+te[256]},aM=new yo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lM=(function(){for(var e=new yo(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Ng=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function oM(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=lM[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),i=e.length;n.p(e);var a,c,u,f,h,m=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(x,b,y,_,j,N){var S=x.length,C=new Gs(_+S+5*(1+Math.floor(S/7e3))+j),E=C.subarray(_,C.length-j),L=0;if(!b||8>S)for(var O=0;S>=O;O+=65535){var R=O+65535;S>R?L=q0(E,L,x.subarray(O,R)):(E[O]=N,L=q0(E,L,x.subarray(O,S)))}else{for(var F=aM[b-1],D=F>>>13,X=8191&F,P=(1<<y)-1,Y=new xs(32768),A=new xs(P+1),fe=Math.ceil(y/3),te=2*fe,K=function(Ye){return(x[Ye]^x[Ye+1]<<fe^x[Ye+2]<<te)&P},G=new yo(25e3),V=new xs(288),se=new xs(32),ae=0,M=0,Te=(O=0,0),Ce=0,z=0;S>O;++O){var B=K(O),ce=32767&O,ye=A[B];if(Y[ce]=ye,A[B]=ce,O>=Ce){var Ne=S-O;if((ae>7e3||Te>24576)&&Ne>423){L=C5(x,E,0,G,V,se,M,Te,z,O-z,L),Te=ae=M=0,z=O;for(var Ae=0;286>Ae;++Ae)V[Ae]=0;for(Ae=0;30>Ae;++Ae)se[Ae]=0}var Le=2,De=0,Ee=X,Re=ce-ye&32767;if(Ne>2&&B==K(O-Re))for(var Ut=Math.min(D,Ne)-1,Qt=Math.min(32767,O),Ft=Math.min(258,Ne);Qt>=Re&&--Ee&&ce!=ye;){if(x[O+Le]==x[O+Le-Re]){for(var jt=0;Ft>jt&&x[O+jt]==x[O+jt-Re];++jt);if(jt>Le){if(Le=jt,De=Re,jt>Ut)break;var wt=Math.min(Re,jt-2),Xe=0;for(Ae=0;wt>Ae;++Ae){var St=O-Re+Ae+32768&32767,nn=St-Y[St]+32768&32767;nn>Xe&&(Xe=nn,ye=St)}}}Re+=(ce=ye)-(ye=Y[ce])+32768&32767}if(De){G[Te++]=268435456|I0[Le]<<18|j5[De];var ne=31&I0[Le],je=31&j5[De];M+=Tx[ne]+Mx[je],++V[257+ne],++se[je],Ce=O+Le,++ae}else G[Te++]=x[O],++V[x[O]]}}L=C5(x,E,N,G,V,se,M,Te,z,O-z,L)}return kk(C,0,_+Sk(L)+j)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h,!0)),v=m.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&&Ng(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(m,t),Ng(m,v-8,n.d()),Ng(m,v-4,i),m}const cM=!!fx||!!du,jk="text/plain";let Of=!1;const Nk=(e,t)=>{const[n,i]=e.split("#"),[a,c]=n.split("?");if(!c)return e;const u=c.split("&").filter(f=>f.split("=")[0]!==t).join("&");return`${a}${u?`?${u}`:""}${i?`#${i}`:""}`},Nu=(e,t,n=!0)=>{var i;const[a,c]=e.split("?"),u=U({},t),f=(i=c==null?void 0:c.split("&").map(m=>{var v;const[x,b]=m.split("="),y=n&&(v=u[x])!==null&&v!==void 0?v:b;return delete u[x],`${x}=${y}`}))!==null&&i!==void 0?i:[],h=(function(m,v="&"){let x,b;const y=[];return yt(m,function(_,j){de(_)||de(j)||j==="undefined"||(x=encodeURIComponent((N=>N instanceof File)(_)?_.name:_.toString()),b=encodeURIComponent(j),y[y.length]=b+"="+x)}),y.join(v)})(u);return h&&f.push(h),f.length>0?`${a}?${f.join("&")}`:a},Cg=e=>{if(e.Xl)return e.Xl;const{data:t,compression:n}=e;if(!t)return;if(n===As.GZipJS){const a=oM((function(c){var u=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var f=new Gs(c.length+(c.length>>>1)),h=0,m=function(y){f[h++]=y},v=0;u>v;++v){if(h+5>f.length){var x=new Gs(h+8+(u-v<<1));x.set(f),f=x}var b=c.charCodeAt(v);128>b?m(b):2048>b?(m(192|b>>>6),m(128|63&b)):b>55295&&57344>b?(m(240|(b=65536+(1047552&b)|1023&c.charCodeAt(++v))>>>18),m(128|b>>>12&63),m(128|b>>>6&63),m(128|63&b)):(m(224|b>>>12),m(128|b>>>6&63),m(128|63&b))}return kk(f,0,h)})(uo(t)),{mtime:0});return{contentType:jk,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===As.Base64){const a=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(f,h)=>String.fromCharCode(parseInt(h,16))))})(uo(t)),c=(u=>"data="+encodeURIComponent(typeof u=="string"?u:uo(u)))(a);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}const i=uo(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},Ck=e=>{const t=()=>e.transport==="sendBeacon"?{url:Nu(e.url,{compression:As.Base64}),encodedBody:Cg(U(U({},e),{},{compression:As.Base64,Xl:void 0}))}:{url:Nk(e.url,"compression"),encodedBody:Cg(U(U({},e),{},{compression:void 0,Xl:void 0}))};let n;try{n=Cg(e)}catch(a){if(Q_(e.compression,vo(e.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",a),t();throw a}return n&&Q_(e.compression,vo(e.url,"compression"))&&!((i=n.body)instanceof ArrayBuffer?S0(new Uint8Array(i)):ArrayBuffer.isView(i)&&S0(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Of=!0,t()):{url:e.url,encodedBody:n};var i},Ek=e=>{try{return Ck(e)}catch(n){var t;return _e.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},uM=(function(){var e=zt(function*(t){const n=yield(function(a){return k0.apply(this,arguments)})(uo(t.data),_n.DEBUG,{rethrow:!0});if(!n)return t;const i=yield n.arrayBuffer();return U(U({},t),{},{Xl:{contentType:jk,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),dM=/Failed to fetch|NetworkError|Load failed/i,Tk=e=>(e==null?void 0:e.name)==="TypeError"&&dM.test((e==null?void 0:e.message)||""),Mk=e=>{const t=Ek(e);if(!t)return;const n=new fx,{url:i,encodedBody:a}=t;n.open(e.method||"GET",i,!0);const{contentType:c,body:u}=a??{};yt(e.headers,function(f,h){n.setRequestHeader(h,f)}),c&&n.setRequestHeader("Content-Type",c),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f;const h={statusCode:n.status,text:n.responseText};if(n.status===200)try{h.json=JSON.parse(n.responseText)}catch{}(f=e.callback)===null||f===void 0||f.call(e,h)}},n.send(u)},Ak=e=>{const t=Ek(e);if(!t)return;const{url:n,encodedBody:i}=t,{contentType:a,body:c,estimatedSize:u}=i??{},f=new Headers;yt(e.headers,function(x,b){f.append(b,x)}),a&&f.append("Content-Type",a);let h=null,m=!1;if(D_){const x=new D_;h={signal:x.signal,timeout:setTimeout(()=>{var b;m=!0,x.abort(pS("AbortError","PostHog request timed out"+((b=e.timeout)?` after ${b}ms`:"")))},e.timeout)}}const v=x=>{var b;m&&(x==null?void 0:x.name)==="AbortError"||Tk(x)?_e.warn(x):_e.error(x),(b=e.callback)===null||b===void 0||b.call(e,{statusCode:0,error:x})};try{du(n,U({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&!e.ta&&52428.8>(u||0),body:c,signal:h==null?void 0:h.signal},e.fetchOptions)).then(x=>x.text().then(b=>{var y;const _={statusCode:x.status,text:b};if(x.status===200)try{_.json=JSON.parse(b)}catch(j){_e.error(j)}(y=e.callback)===null||y===void 0||y.call(e,_)})).catch(v).finally(()=>h?clearTimeout(h.timeout):null)}catch(x){h&&clearTimeout(h.timeout),v(x)}},V0=e=>{try{var t;const{url:n,encodedBody:i}=Ck(e),{contentType:a,body:c,estimatedSize:u}=i??{};if(!c)return;const f=c instanceof Blob?c:new Blob([c],{type:a});if(jn.sendBeacon(n,f))return;const h=Ue(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Ue(h)&&h.length>1&&(u??0)>16384){const m=Math.ceil(h.length/2),v=x=>Ue(e.data)?x:U(U({},e.data),{},{batch:x});return V0(U(U({},e),{},{data:v(h.slice(0,m))})),void V0(U(U({},e),{},{data:v(h.slice(m))}))}_e.warn(`Beacon of ~${u??0} bytes was rejected by the browser, falling back to ${du?"fetch":"XHR"}`),du?Ak(U(U({},e),{},{ta:!0})):Mk(e)}catch(n){_e.warn("Beacon send failed",n)}},E5=(e,t,n,i)=>{const a=i==="query"?t==="POST"?"sent_at":"_":void 0;return Nu(n===As.GZipJS?Nk(e,"compression"):e,U(U({},a?{[a]:Date.now().toString()}:{}),n===As.GZipJS?{}:{compression:n}))},fM=(()=>{const e=[];return du&&e.push({transport:"fetch",method:Ak}),fx&&e.push({transport:"XHR",method:Mk}),jn!=null&&jn.sendBeacon&&e.push({transport:"sendBeacon",method:V0}),e})();var hM=class{constructor(e,t){this.ea=!0,this.ia=[],this.na=Ai((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,_e.createLogger("flush interval"),3e3),this.sa=e}enqueue(e){this.ia.push(e),this.ra||this.oa()}unload(){this.la();const e=this.ia.length>0?this.aa():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.ua(U(U({},n),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const e=this.aa();for(const t in e){const n=e[t],i=new Date().getTime();n.data&&Ue(n.data)&&yt(n.data,a=>{a.offset=Math.abs(a.timestamp-i),delete a.timestamp}),this.ua(n)}}},this.na))}ua(e){try{this.sa(e)}catch(t){_e.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const e={};return yt(this.ia,t=>{var n;const i=t,a=(i?i.batchKey:null)||i.url;de(e[a])&&(e[a]=U(U({},i),{},{data:[]})),(n=e[a].data)===null||n===void 0||n.push(i.data)}),this.ia=[],e}};const pM=["retriesPerformedSoFar"];var mM=class{constructor(e){this._instance=e,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!de(re)&&"onLine"in re.navigator){if(this.da=re.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},Nt(re,"online",this.va),Nt(re,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,n=SS(e,pM);or(t)&&(n.url=Nu(n.url,{retry_count:t})),this._instance._send_request(U(U({},n),{},{callback:i=>{var a;if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(t??0))return void this.Ls(U({retriesPerformedSoFar:t},n));i.statusCode===0&&_e.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${t??0} retries.`)}(a=n.callback)===null||a===void 0||a.call(n,i)}}))}Ls(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const n=(function(c){const u=3e3*Math.pow(2,c),f=u/2,h=Math.min(18e5,u),m=(Math.random()-.5)*(h-f);return Math.ceil(h+m)})(t),i=Date.now()+n;this.ia.push({retryAt:i,requestOptions:e});let a=`Enqueued failed request for retry in ${n}`;navigator.onLine||(a+=" (Browser is offline)"),_e.warn(a),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),this.ia.length===0)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const e=Date.now(),t=[],n=this.ia.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ia=t,n.length>0)for(const{requestOptions:i}of n)this.retriableRequest(i)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,de(re)||(this.va&&(re.removeEventListener("online",this.va),this.va=void 0),this.pa&&(re.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:e}of this.ia)try{this._instance._send_request(U(U({},e),{},{transport:"sendBeacon"}))}catch(t){_e.error(t)}this.ia=[]}},gM=class{constructor(e){this._instance=e,this.ya=()=>{var t,n,i,a;this.ba||(this.ba={});const c=this.scrollElement(),u=this.scrollY(),f=c?Math.max(0,c.scrollHeight-c.clientHeight):0,h=u+((c==null?void 0:c.clientHeight)||0),m=(c==null?void 0:c.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(u),this.ba.maxScrollY=Math.max(u,(t=this.ba.maxScrollY)!==null&&t!==void 0?t:0),this.ba.maxScrollHeight=Math.max(f,(n=this.ba.maxScrollHeight)!==null&&n!==void 0?n:0),this.ba.lastContentY=h,this.ba.maxContentY=Math.max(h,(i=this.ba.maxContentY)!==null&&i!==void 0?i:0),this.ba.maxContentHeight=Math.max(m,(a=this.ba.maxContentHeight)!==null&&a!==void 0?a:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const e=this.ba;return setTimeout(this.ya,0),e}startMeasuringScrollPosition(){Nt(re,"scroll",this.ya,{capture:!0}),Nt(re,"scrollend",this.ya,{capture:!0}),Nt(re,"resize",this.ya)}scrollElement(){if(this._a){const n=Ue(this._a)?this._a:[this._a];for(const i of n){var e;const a=re==null||(e=re.document)===null||e===void 0?void 0:e.querySelector(i);if(a)return a}return}var t;return re==null||(t=re.document)===null||t===void 0?void 0:t.documentElement}wa(e){var t,n;const i=e==="y"?"scrollTop":"scrollLeft";if(this._a){const a=this.scrollElement();return a&&a[i]||0}return re?e==="y"?re.scrollY||re.pageYOffset||((t=re.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:re.scrollX||re.pageXOffset||((n=re.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const xM=e=>gk(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);var T5=class{constructor(e,t,n,i){this.je=a=>{const c=this.ka();if(c&&c.sessionId===a)return;const u={sessionId:a,props:this.Sa(this._instance)};this.xa.register({[O0]:u})},this._instance=e,this.Ca=t,this.xa=n,this.Sa=i||xM,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[O0]}getSetOnceProps(){var e;const t=(e=this.ka())===null||e===void 0?void 0:e.props;return t?"r"in t?xk(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return yt(kx(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${x0(n)}`]=t}),e}},nh=class{on(e,t){return this.$a[e]||(this.$a[e]=[]),this.$a[e].push(t),()=>{this.$a[e]=this.$a[e].filter(n=>n!==t)}}emit(e,t){for(const n of this.$a[e]||[])n(t);for(const n of this.$a["*"]||[])n(e,t)}constructor(){this.$a={}}};const to=Jt("[SessionId]"),M5=864e5;var A5=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,n){var i;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new nh,this.Aa=(c,u)=>!(!or(c)||!or(u))&&Math.abs(c-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.xa=e.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=t||li,this.Da=n||li;const a=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ai(this.Mr.session_idle_timeout_seconds||1800,60,36e3,to.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+a+"_window_id",this.qa="ph_"+a+"_primary_window_exists",this.ja()){const c=Ot.Dt(this.Na),u=Ot.Dt(this.qa);c&&!u?this.Be=c:Ot.Lt(this.Na),Ot.At(this.qa,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return de(this.Ea)&&(this.Ea=[]),this.Ea.push(e),this.Xt&&e(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(t=>t!==e)}}ja(){return this.Mr.persistence!=="memory"&&!this.xa.pi&&Ot.Et()}Ha(e){e!==this.Be&&(this.Be=e,this.ja()&&Ot.At(this.Na,e))}za(){return this.Be?this.Be:this.ja()?Ot.Dt(this.Na):null}Ua(e){const t=this.Ia;return!Wt(t)&&!Wt(e)&&5e3>Math.abs(e-t)}Wa(e,t,n){const i=t!==this._sessionActivityTimestamp,a=!(e!==this.Xt||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,a&&!i||a&&this.Ua(t)||(this.Ia=t,this.xa.register({[oo]:[t,e,n]}))}Va(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return or(t)&&t>0}Ga(){this.Va()?this.xa.refreshKey(oo):(this.xa.flush(),this.xa.load())}Za(){var e;if(Wt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,t,n]=this.Qa();t===this.Xt&&n===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[oo]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[e]=this.Qa(),t=or(e)?e:0,n=or(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}Ka(e){return this.Ga(),this.Aa(e,this.Ja())}Qa(){const e=this.xa.props[oo];return Ue(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Ya),this.Ya=void 0,this.Wa(null,null,null)}setBootstrapSessionId(e,t=!1){const n=((i,a=new Date().getTime())=>{try{const c=(u=>{const f=u.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)})(i);return c>a+6e4?void to.error("Bootstrap sessionID cannot be in the future"):c}catch(c){return void to.error("Invalid sessionID in bootstrap",c)}})(e);return!de(n)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:n}:this.Wa(e,new Date().getTime(),n),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Ya),this.Ya=void 0,this.Pa&&re&&(re.removeEventListener(Wf,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Ot.Lt(this.qa)},Nt(re,Wf,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=t||new Date().getTime(),a=this.Xt;if(n)this.Ma=i;else if(Wt(this.Ma)||this.Ma>i||i-this.Ma>=1e3){var c,u;(c=(u=this.xa).syncCookieProperties)===null||c===void 0||c.call(u),this.Ma=i}let[,f,h]=this.Qa();const m=!de(a)&&f!==a,v=this.Ja();let x=this.za();const b=this.Fa,y=!!b&&(b.sessionStartTimestamp>i+6e4||i-b.sessionStartTimestamp>M5),_=b?y:or(h)&&Math.abs(i-h)>M5;let j=!1,N=m;const S=!f||!!b,C=f;let E=!S&&!e&&this.Aa(i,v);if(E&&(E=this.Ka(i),E||to.info("cross-tab refresh kept the session alive",{sessionId:f}),[,f,h]=this.Qa()),S||E||_){N=!1;const F=b&&!y;f=F?b.sessionId:this.Oa(),x=this.Da(),to.info("new session ID assigned",{sessionId:f,windowId:x,bootstrapped:!!F,changeReason:{noSessionId:S,activityTimeout:E,sessionPastMaximumLength:_}}),h=F?b.sessionStartTimestamp:i,this.Fa=void 0,j=!0}else x||(x=this.Da(),j=!0),N=N||f!==C,N&&(to.info("adopted cross-tab session id",{sessionId:f,windowId:x}),j=!0);const L=or(v)&&e&&!_?v:i,O=or(h)?h:new Date().getTime();this.Ha(x),this.Wa(f,L,O),e||this.La();const R={noSessionId:S,activityTimeout:E,sessionPastMaximumLength:_,crossTabAdoption:N};return j&&this.Ea.forEach(F=>F(f,x,R)),{sessionId:f,windowId:x,sessionStartTimestamp:O,changeReason:j?R:void 0,lastActivityTimestamp:v}}La(){this.Ra||(clearTimeout(this.Ya),this.Ya=setTimeout(()=>{if(!this.Ra)if(this.Ka(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:e})}else this.La()},1.1*this.sessionTimeoutMs))}};const Rk=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&$_(n,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(a=>$_(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver};function Ok(){return(Ok=zt(function*(){const e=jn==null?void 0:jn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return it(n)&&n.length>0?n:void 0}catch(t){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function vM(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function Lk(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}const sh=(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}},pf=e=>e.toLowerCase(),Dk={exact:(e,t)=>t.some(n=>e.some(i=>n===i)),is_not:(e,t)=>t.every(n=>e.every(i=>n!==i)),regex:(e,t)=>t.some(n=>e.some(i=>sh(n,i))),not_regex:(e,t)=>t.every(n=>e.every(i=>!sh(n,i))),icontains:(e,t)=>t.map(pf).some(n=>e.map(pf).some(i=>n.includes(i))),not_icontains:(e,t)=>t.map(pf).every(n=>e.map(pf).every(i=>!n.includes(i))),gt:(e,t)=>t.some(n=>{const i=parseFloat(n);return!isNaN(i)&&e.some(a=>i>parseFloat(a))}),lt:(e,t)=>t.some(n=>{const i=parseFloat(n);return!isNaN(i)&&e.some(a=>i<parseFloat(a))})};function zk(e,t){return!e||Object.entries(e).every(([n,i])=>{const a=t==null?void 0:t[n];if(a==null)return!1;const c=Dk[i.operator];return!!c&&c(i.values,[String(a)])})}function Eg(e,t,n){return uo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const G0="custom",R5="i.posthog.com",bM=/^\/static\//,yM=["/s/","/e/","/i/"];var _M=class{constructor(e){this.Xa={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${R5}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Xa[this.apiHost]||(this.Xa[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":G0),this.Xa[this.apiHost]}tu(e){if(!bM.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}eu(e){const t=xo(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}iu(e,t,n){if(e==="ui")return n;let i=n;const a=this.instance.config.rewriteRequestPath;if(a){var c;const u=((c=xo(n))===null||c===void 0?void 0:c.href)||n;i=a(new URL(u)).toString()}if(a&&e==="api"&&yM.some(u=>t.indexOf(u)===0)){const u=this.eu(i);if(u){const f=this.apiHost;let h=this.nu;(h==null?void 0:h.apiHost)===f&&h.rewriteRequestPath===a||(h={apiHost:f,rewriteRequestPath:a,urls:new Set},this.nu=h),h.urls.add(u)}}return i}isIngestionEndpoint(e){const t=this.nu,n=this.eu(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.iu(e,t,this.uiHost+t);if(e==="flags")return this.iu(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.tu(t);if(i)return this.iu(e,t,`${i}${t}`)}if(this.region===G0)return this.iu(e,t,this.apiHost+t);const n=R5+t;switch(e){case"assets":return this.iu(e,t,`https://${this.region}-assets.${n}`);case"api":return this.iu(e,t,`https://${this.region}.${n}`)}}};const kt=Jt("[Surveys]"),$k=e=>{try{const t=(n=>((i,a)=>`seenSurvey_${(function(c){return c.current_iteration&&c.current_iteration>0?`${c.id}_${c.current_iteration}`:c.id})(a)}`)(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){kt.error("Failed to persist survey seen state",t)}},wM=[Sg.Popover,Sg.Widget,Sg.API],SM={ignoreConditions:!1,ignoreDelay:!1,displayType:F0.Popover},kM=Jt("[PostHog ExternalIntegrations]"),jM={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var NM=class{constructor(e){this._instance=e}No(e,t){var n,i;(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,e,a=>{if(a)return kM.error("failed to load script",a);t()})}startIfEnabledOrStop(){var e;for(const[a,c]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,n,i;c&&!(!((t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[a])&&this.No(jM[a],()=>{var u;(u=$e.__PosthogExtensions__)===null||u===void 0||(u=u.integrations)===null||u===void 0||(u=u[a])===null||u===void 0||u.start(this._instance)}),!c&&(!((n=$e.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[a])&&((i=$e.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[a])===null||i===void 0||i.stop())}}},CM=class{constructor(e,t){this.$=e,this.po=t,this.su=new Map,this.So=!1}add(e){var t=this;return zt(function*(){if(t.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.su.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.su.set(e.name,e);try{const n=e.setup(t.po);n&&(yield n)}catch(n){const i=t.su.get(e.name)===e;i&&t.su.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,n),i&&t.ru(e)}})()}getExtension(e){return this.su.get(e)}dispose(){if(this.So)return;this.So=!0;const e=Array.from(this.su.values()).reverse();this.su.clear();for(const t of e)this.ru(t)}ru(e){try{var t;const n=(t=e.dispose)===null||t===void 0?void 0:t.call(e);n&&Pn(n.then)&&n.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(n){this.$.error(`Failed to dispose browser extension "${e.name}"`,n)}}},EM=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);const n={};for(const i of e){const a=t==null?void 0:t.get_property(i);de(a)||(n[i]=a)}return n}set(e,t){var n;(n=this._instance.persistence)===null||n===void 0||n.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}};const O5="extensionsRemoteConfig";var TM=class{constructor(e){this.instance=e,this.So=!1,this.$=_e,this.ou=e.lu,this.kv=new EM(e),this.onEvent=t=>hf(this.instance.on("eventCaptured",n=>{try{t({event:n.event,properties:n.properties})}catch(i){this.$.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=t=>{if(this.So)return hf(()=>{});const n=a=>{try{t(a)}catch(c){this.$.error("Browser extension remote config listener failed",c)}},i=this.instance.au.on(O5,n);return this.ou&&n(this.ou),hf(i)},this.uu=new CM(_e.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(vx);return typeof e=="string"?e:void 0}get library(){return{name:_n.LIB_NAME,version:_n.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,i;const a=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=a==null?void 0:a.sessionId)!==null&&t!==void 0?t:"",windowId:(n=a==null?void 0:a.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(i=a==null?void 0:a.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.uu.add(e)}getExtension(e){return this.uu.getExtension(e)}capture(e,t,n){var i=this;return zt(function*(){n?i.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):i.instance.capture(e,t)})()}registerDynamicEventProperties(e){return hf(this.instance.hu(e))}handleRemoteConfig(e){this.So||(this.ou=e,this.instance.au.emit(O5,e))}sendRequest(e){var t=this;return zt(function*(n,i={}){var a;const c=t.instance.requestRouter.endpointFor((a=i.target)!==null&&a!==void 0?a:"api",n),u={method:i.method,url:i.query?Nu(c,i.query):c,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?g0.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(t.instance._send_request(u),{statusCode:202}):new Promise(f=>{u.callback=f,t.instance._send_request(u)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const nu={};let Tg=0;const su=()=>{},L5='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$c="Surveys module not available",D5="sanitize_properties is deprecated. Use before_send instead",Bk="Invalid value for property_denylist config: ",MM=/^[A-Za-z0-9_-]{1,400}$/,Mg=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,AM=["token","distinct_id",VS],Vc="posthog";let Pk=!cM&&(ts==null?void 0:ts.indexOf("MSIE"))===-1&&(ts==null?void 0:ts.indexOf("Mozilla"))===-1;const RM=e=>{const 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},Ag=e=>{var t;return U({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:A6(me==null?void 0:me.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:su,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Yt&&it(Yt==null?void 0:Yt.search)&&Yt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.location)===null||t===void 0?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){_e.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:QS,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:su},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:P6,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:RM(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))},OM=[["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"]],z5=e=>{const t={};for(const[a,c]of OM)de(e[a])||(t[c]=e[a]);const n=Dt({},t,e),i=e.__preview_external_dependency_versioned_paths;return de(i)||(de(e.strict_script_versioning)&&(n.strict_script_versioning=!!i),it(i)&&de(e.asset_host)&&(n.asset_host=i)),Ue(e.property_blacklist)&&(de(e.property_denylist)?n.property_denylist=e.property_blacklist:Ue(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:_e.error(Bk+e.property_denylist)),n};var LM=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(e){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},iu=class ia{du(t){if(!t)return;const n=this.su.indexOf(t);n!==-1&&this.su.splice(n,1)}vu(t,n){var i;return this.du(t),this.su.push(n),(i=n.initialize)===null||i===void 0||i.call(n),n}fu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}pu(){if(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.mu)return;let n,i,a;t?(n=`persistence is set to '${this.config.persistence}'`,i=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",a="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",i="on every page load",a="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, 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. ${a}`)}yu(){if(this.fu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const i=this.config.get_device_id(li());this.register({distinct_id:i,$device_id:i}),t.set_property(ns,dr)}this._u()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new LM,this.Su=!1,this.version=_n.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new nh,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ag(),this.SentryIntegration=Y6,this.sentryIntegration=i=>(function(a,c){const u=ok(a,c);return{name:lk,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new gM(this),this.pageViewManager=new y5(this),this.rateLimiter=new sM(this),this.requestRouter=new _M(this),this.consent=new B6(this),this.externalIntegrations=new NM(this);const n=(t=ia.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,a,c)=>{const u=it(i)?{[i]:a}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,a,c)=>{const u=it(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",i=>_e.info(`send "${i==null?void 0:i.event}"`,i))}init(t,n,i){if(i&&i!==Vc){var a;const c=(a=nu[i])!==null&&a!==void 0?a:new ia;return c._init(t,n,i),nu[i]=c,nu[Vc][i]=c,c}return this._init(t,n,i)}_init(t,n={},i){var a,c,u;const f=it(t)?t.trim():"";if(!f)return _e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var h;if(this.__loaded)return f!==((h=this.config)===null||h===void 0?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=Ag(n.defaults),n.debug=this.Pu(n.debug),this.Ru=n,this.Au=[],n.person_profiles?this.Mu=n.person_profiles:n.process_person&&(this.Mu=n.process_person);const m=Ag(n.defaults),v=z5(n),x=Dt({},m,v,{name:i,token:f});nt(m.rageclick)&&nt(v.rageclick)&&(x.rageclick=Dt({},m.rageclick,v.rageclick)),nt(m.session_recording)&&nt(v.session_recording)&&(x.session_recording=Dt({},m.session_recording,v.session_recording)),this.set_config(x),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:As.GZipJS;const b=this.bu();if(this.persistence=new wg(this.config,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wg(U(U({},this.config),{},{persistence:"sessionStorage"}),b,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&Ot.Et()){const S=Ot.Dt(this.Cu);Ue(S)&&S.forEach(C=>{it(C)&&this.xu.add(C)})}else Ot.Lt(this.Cu);const y=U({},this.persistence.props),_=U({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Fu=new hM(S=>this.Ou(S),this.config.request_queue_config),this.Du=new mM(this),this.__request_queue=[];const j=this.fu();j||(this.sessionManager=new A5(this),this.sessionPropsManager=new T5(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((S,C,E)=>{(E!=null&&E.activityTimeout||E!=null&&E.sessionPastMaximumLength||E!=null&&E.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(j)},0)):(_e.info("Initializing extensions synchronously"),this.qu(j)),_n.DEBUG=_n.DEBUG||this.config.debug,_n.DEBUG&&_e.info("Starting in debug mode",{this:this,config:n,thisC:U({},this.config),p:y,s:_}),this.config.identity_distinct_id&&!(!((a=n.bootstrap)===null||a===void 0)&&a.distinctID)&&(n.bootstrap=U(U({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const N=(c=n.bootstrap)===null||c===void 0?void 0:c.distinctID;if(this.mu=!!N&&!Qc(N),(u=n.bootstrap)===null||u===void 0?void 0:u.distinctID){const S=n.bootstrap.distinctID,C=this.get_distinct_id(),E=this.persistence.get_property(ns);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==S&&E==="anonymous")this.identify(S);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==S&&E==="identified")_e.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{const L=this.config.get_device_id(li()),O=n.bootstrap.isIdentifiedID?L:S;this.persistence.set_property(ns,n.bootstrap.isIdentifiedID?Af:dr),this.register({distinct_id:S,$device_id:O})}}if(j)this.register_once({distinct_id:pg,$device_id:null},"");else if(!this.get_distinct_id()){const S=this.config.get_device_id(li());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(ns,dr)}return Nt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Nt(re,"pageshow",()=>{var S;this.wu=!1,this.ku||(S=this.Du)===null||S===void 0||S.resume()}),n.segment?b5(this,()=>this.ju()):this.ju(),Pn(this.config._onCapture)&&this.config._onCapture!==su&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&_e.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 Ok.apply(this,arguments)})().then(S=>{S&&this.register({[hg]:S})}).catch(su),this}Bu(t){const n=t;return it(n.name)&&Pn(n.setup)}Hu(t,n){this.Bu(t)?n.push(()=>{this.zu().add(t).catch(()=>{var i;return(i=t.dispose)===null||i===void 0?void 0:i.call(t)}).catch(i=>{_e.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.su.push(t)}Nu(){var t,n,i;const a=(t=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&t!==void 0?t:(i=ia.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var c,u,f;a&&(this.featureFlags&&this.featureFlags instanceof a||((c=this.Uu)===null||c===void 0||c.call(this),this.Uu=void 0,this.featureFlags=new a(this)),Pn(this.featureFlags.onReloading)&&Pn(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):(u=(f=this.featureFlags).initialize)===null||u===void 0||u.call(f))}qu(t){const n=performance.now(),i=U(U({},ia.__defaultExtensionClasses),this.config.__extensionClasses),a=[];var c,u,f,h,m,v,x;i.exceptions&&this.su.push(this.exceptions=(c=this.exceptions)!==null&&c!==void 0?c:new i.exceptions(this)),i.historyAutocapture&&this.su.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.su.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.su.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.su.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||a.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Hu(this.autocapture=new i.autocapture(this),a),i.surveys&&this.Hu(this.surveys=(u=this.surveys)!==null&&u!==void 0?u:new i.surveys(this),a),i.logs&&this.Hu(this.logs=(f=this.logs)!==null&&f!==void 0?f:new i.logs(this),a),i.metrics&&this.su.push(this.metrics=(h=this.metrics)!==null&&h!==void 0?h:new i.metrics(this)),i.conversations&&this.su.push(this.conversations=(m=this.conversations)!==null&&m!==void 0?m:new i.conversations(this)),i.productTours&&this.su.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.su.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.su.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,G6)),i.toolbar&&this.su.push(this.toolbar=(v=this.toolbar)!==null&&v!==void 0?v:new i.toolbar(this)),i.experiments&&this.su.push(this.experiments=(x=this.experiments)!==null&&x!==void 0?x:new i.experiments(this)),this.su.forEach(b=>{b.initialize&&a.push(()=>{var y;(y=b.initialize)===null||y===void 0||y.call(b)})}),a.push(()=>{if(this.Wu){const b=this.Wu;this.Wu=void 0,this.su.forEach(y=>{var _;return(_=y.onRemoteConfig)===null||_===void 0?void 0:_.call(y,b)})}}),this.Vu(a,n)}Vu(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,n)},0);const a=t.shift();if(a)try{a()}catch(c){_e.error("Error initializing extension:",c)}}const i=Math.round(performance.now()-n);this.register_for_session({[GS]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[YS]:i}),this.config.__preview_deferred_init_extensions&&_e.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var n;if(!me||!me.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(a.supportedCompression,As.GZipJS)?As.GZipJS:Ie(a.supportedCompression,As.Base64)?As.Base64:void 0),!((i=a.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:QS}),(n=this.Gu)===null||n===void 0||n.handleRemoteConfig(t),this.su.forEach(a=>{var c;return(c=a.onRemoteConfig)===null||c===void 0?void 0:c.call(a,t)})}ju(){try{this.config.loaded(this)}catch(t){_e.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(Yt==null?void 0:Yt.hostname)){const t=Yt.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new bk(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Fu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&cf(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,n,i,a,c,u;this.wu=!0,(t=this.surveys)===null||t===void 0||(n=t.handlePageUnload)===null||n===void 0||n.call(t),(i=this.metrics)===null||i===void 0||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(n5),(a=this.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(c=this.Fu)===null||c===void 0||c.unload(),(u=this.Du)===null||u===void 0||u.unload()):this.Ku()&&this.capture(n5,null,{transport:"sendBeacon"})}_send_request(t){var n,i,a;this.__loaded?Pk?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((i=t.callback)===null||i===void 0||i.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=U(U({},this.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(n=this.compression)!==null&&n!==void 0?n:t.compressionFallback:t.compression,(de(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(c=>{var u,f,h;const m=U({},c);m.timeout=m.timeout||6e4;const v=(u=m.transport)!==null&&u!==void 0?u:"fetch";v==="sendBeacon"&&de(m.compression)&&m.data&&(m.compression=As.Base64),m.method==="POST"&&m.data&&(m.timestampMode==="capture-body"?m.data=(_=>{var j,N;const S=(Ue(_)?_:[_]).map(E=>U(U({},E),E.timestamp instanceof Date&&!isNaN(E.timestamp.getTime())?{timestamp:E.timestamp.toISOString()}:{})),C=S[0];return{api_key:(j=C==null||(N=C.properties)===null||N===void 0?void 0:N.token)!==null&&j!==void 0?j:C==null?void 0:C.token,batch:S,sent_at:new Date().toISOString()}})(m.data):m.timestampMode==="body"&&(m.data=((_,j=new Date().toISOString())=>Ue(_)?_.map(N=>U(U({},N),{},{sent_at:j})):U(U({},_),{},{sent_at:j}))(m.data))),m.url=E5(m.url,m.method,m.compression,m.timestampMode);const x=fM.filter(_=>!m.disableTransport||!_.transport||!m.disableTransport.includes(_.transport)),b=(f=(h=(function(_,j){for(let N=0;_.length>N;N++)if(j(_[N]))return _[N]})(x,_=>_.transport===v))===null||h===void 0?void 0:h.method)!==null&&f!==void 0?f:x[0].method;if(!b)throw new Error("No available transport method");const y=_=>{try{b(_)}catch(N){var j;Tk(N)?_e.warn(N):_e.error(N),(j=m.callback)===null||j===void 0||j.call(m,{statusCode:0,error:N})}};v!=="sendBeacon"&&m.data&&m.compression===As.GZipJS&&Q4&&typeof Promise<"u"&&!Of?uM(m).then(_=>{y(_)}).catch(_=>{if(K_(_))return Of=!0,void y(U(U({},m),{},{compression:void 0,url:E5(c.url,c.method,void 0,c.timestampMode)}));(j=>{if(!j||typeof j!="object")return!1;const N="name"in j?String(j.name):"";return K_(j)||N===_S})(_)&&(Of=!0),y(m)}):b(m)})(U(U({},t),{},{callback:c=>{var u,f,h;this.rateLimiter.checkForLimiting(c),400>c.statusCode||(f=(h=this.config).on_request_error)===null||f===void 0||f.call(h,c),(u=t.callback)===null||u===void 0||u.call(t,c)}}))):t.fireCallbackOnDrop&&((a=t.callback)===null||a===void 0||a.call(t,{statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){Tg++;try{let n;const i=[],a=[],c=[];cf(t,f=>{if(f)if(n=f[0],Ue(n))c.push(f);else if(Pn(f))try{f.call(this)}catch(h){_e.error("Error executing queued PostHog call",f,h)}else Ue(f)&&n==="alias"?i.push(f):Ue(f)&&n.indexOf("capture")!==-1&&Pn(this[n])?c.push(f):a.push(f)});const u=function(f,h){cf(f,function(m){try{if(Ue(m[0])){let v=h;yt(m,function(x){v=v[x[0]].apply(v,x.slice(1))})}else h[m[0]].apply(h,m.slice(1))}catch(v){_e.error("Error executing queued PostHog call",m,v)}})};u(i,this),u(a,this),u(c,this)}finally{Tg--}}push(t){if(Tg>0&&Ue(t)&&it(t[0])){const n=ia.prototype[t[0]];return void(Pn(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}Yu(){var t;const n=(t=this.persistence)===null||t===void 0?void 0:t.get_property(ri);return it(n)&&Mg.test(n)?{value:n,delivered:!1}:nt(n)&&it(n.value)&&Mg.test(n.value)?{value:n.value,delivered:n.delivered===!0}:void 0}Xu(t,n,i,a){if(!this.persistence)return;this.persistence.refreshKey(ri);const c=this.Yu();if(!a){if(i)return it(n)&&Mg.test(n)?(n!==(c==null?void 0:c.value)&&this.persistence.register({[ri]:{value:n,delivered:!1}}),{value:n,pending:n!==(c==null?void 0:c.value)||!c.delivered}):void this.persistence.unregister(ri);if(it(t)&&MM.test(t)){if((c==null?void 0:c.value.split(".")[3])===t)return{value:c.value,pending:!c.delivered};const u=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[ri]:{value:u,delivered:!1}}),{value:u,pending:!0}}return c?{value:c.value,pending:!c.delivered}:void 0}this.persistence.unregister(ri)}th(t){if(!this.persistence)return;this.persistence.refreshKey(ri);const n=this.Yu();(n==null?void 0:n.value)!==t||n.delivered||this.persistence.register({[ri]:{value:t,delivered:!0}})}capture(t,n,i){var a,c,u,f,h;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void _e.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(de(t)||!it(t))return void _e.error("No event name provided to posthog.capture");this.yu();const m=!this.config.opt_out_useragent_filter&&this._is_bot();if(m&&!this.config.__preview_capture_bot_pageviews)return;const v=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(v!=null&&v.isRateLimited)return void _e.critical("This capture call is ignored due to client rate limiting.");let x;n!=null&&n.$current_url&&!it(n==null?void 0:n.$current_url)&&(_e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||i!=null&&i.eh||_e.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&&(x=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();const b=new Date,y=(i==null?void 0:i.timestamp)||b,_=F_(i==null?void 0:i.uuid,li);let j={uuid:_,event:t,properties:this.calculateEventProperties(t,n||{},y,_)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&m&&(j.event="$bot_pageview",j.properties.$browser_type="bot"),v&&(j.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);const N=t==="$feature_flag_called"&&j.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i!=null&&i.$set&&!N&&(j.$set=i==null?void 0:i.$set);const S=nt(n==null?void 0:n.$set)?n.$set:void 0,C=!!(i!=null&&i.$set)&&"$fbc"in i.$set,E=C||!!S&&"$fbc"in S,L=C?i==null||(a=i.$set)===null||a===void 0?void 0:a[of]:S==null?void 0:S[of],O=Ue(n==null?void 0:n.$unset)?n.$unset:[],R=(i==null?void 0:i.$unset)||[],F=O.indexOf("$fbc")!==-1||R.indexOf("$fbc")!==-1,D=this.Xu(x==null?void 0:x.fbclid,L,E,F);D&&j.properties.$process_person_profile===!0&&D.pending&&!E&&!N&&(j.$set=U({[of]:D.value},j.$set));const X=i==null?void 0:i.$unset;X&&(j.$unset=X);const P=N?void 0:this.ih(i==null?void 0:i.$set_once,t!==s5,t===L0);if(P&&(j.$set_once=P),i!=null&&i._noTruncate||(Y=this.config.properties_string_max_length,j=(function(se,ae){const M=new Set;return(function Te(Ce,z){if(Ce!==Object(Ce))return ae?ae(Ce):Ce;if(M.has(Ce))return;let B;if(M.add(Ce),Ue(Ce))B=[],cf(Ce,ce=>{B.push(Te(ce))});else{const ce={};yt(ku(Ce)?KS(Ce):Ce,(ye,Ne)=>{M.has(ye)||(ce[Ne]=Te(ye))}),B=ce}return B})(se)})(j,se=>it(se)?se.slice(0,Y):se)),j.timestamp=y,de(i==null?void 0:i.timestamp)||(j.properties.$event_time_override_provided=!0,j.properties.$event_time_override_system_time=b),N&&(j.properties=((se,ae=[])=>{const M={},Te=Ce=>{se[Ce]!==void 0&&(M[Ce]=se[Ce])};return qT.forEach(Te),ae.forEach(Te),M})(j.properties,AM)),t===fr.DISMISSED||t===fr.SENT){const se=n==null?void 0:n[kg.SURVEY_ID],ae=n==null?void 0:n[kg.SURVEY_ITERATION];$k({id:se,current_iteration:ae}),j.$set=U(U({},j.$set),{},{[vM({id:se,current_iteration:ae},t===fr.SENT?"responded":"dismissed")]:!0})}else t===fr.SHOWN&&(j.$set=U(U({},j.$set),{},{[kg.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var Y;if(t===nM.SHOWN){const se=n==null?void 0:n[w5.TOUR_TYPE];se&&(j.$set=U(U({},j.$set),{},{[`${w5.TOUR_LAST_SEEN_DATE}/${se}`]:new Date().toISOString()}))}const A=U(U({},j.properties.$set),j.$set);if(gs(A)||this.setPersonPropertiesForFlags(A),!Ve(this.config.before_send)){const se=this.Os(j);if(!se)return;j=se,j.uuid=F_(j.uuid,li)}const fe=(c=(u=j.$set)===null||u===void 0?void 0:u.$fbc)!==null&&c!==void 0?c:nt((f=j.properties)===null||f===void 0?void 0:f.$set)?j.properties.$set[of]:void 0,te=D!=null&&D.pending&&fe===D.value?D.value:void 0;this.au.emit("eventCaptured",j);const K=(h=i==null?void 0:i._url)!==null&&h!==void 0?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=U(U({method:"POST",url:K,data:j,compression:"best-available",timestampMode:(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(K)?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},i!=null&&i.transport?{transport:i.transport}:{}),te?{fireCallbackOnDrop:!0,callback:se=>{se.statusCode>=200&&300>se.statusCode&&this.th(te)}}:{});var V;return!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly||te?(!G.transport&&!G.callback&&gs((V=this.config.request_headers)!==null&&V!==void 0?V:{})&&this.wu&&(G.transport="sendBeacon"),this.Ou(G)):this.Fu.enqueue(G),j}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}getExtension(t){var n;return(n=this.Gu)===null||n===void 0?void 0:n.getExtension(t)}zu(){var t;return(t=this.Gu)!==null&&t!==void 0?t:this.Gu=new TM(this)}hu(t){this.$u.push(t);let n=!0;return()=>{if(!n)return;n=!1;const i=this.$u.indexOf(t);i!==-1&&this.$u.splice(i,1)}}nh(t=!0){var n,i,a;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Eu=null,this.persistence.get_property("$user_state")==="anonymous"&&((a=this.sessionPersistence)===null||a===void 0||a.clear(),this.xu.clear(),this.sh()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,i,a,c){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.nh();const u=c?void 0:this.persistence.remove_event_timer(t);let f=U({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.fu()&&(f[VS]=!0),t==="$snapshot"){const C=U(U({},this.persistence.properties()),this.sessionPersistence.properties());return f.distinct_id=C.distinct_id,(!it(f.distinct_id)&&!Zt(f.distinct_id)||Qc(f.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}const h=(function(C,E,L,O=!1){var R,F,D,X;if(!ts)return{};const P=C?[...bo,...E||[]]:[],[Y,A]=dS(ts),[fe,te]=(function(B){for(let ce=0;U_.length>ce;ce++){const[ye,Ne,Ae]=U_[ce],Le=B.match(ye);if(Le){const De=Ae&&B.match(Ae)||Le;return[Ne,(De==null?void 0:De[1])||""]}}return["",""]})(ts),K=(function(){const B="u">typeof navigator?navigator:void 0;return B!=null&&B.brave?{brave:!0}:{}})(),G={};de(L)||(G.detectGoogleSearchApp=L);const V={},se=(R=navigator)===null||R===void 0||(R=R.userAgentData)===null||R===void 0?void 0:R.platform,ae=(F=navigator)===null||F===void 0?void 0:F.maxTouchPoints,M=re==null||(D=re.screen)===null||D===void 0?void 0:D.width,Te=re==null||(X=re.screen)===null||X===void 0?void 0:X.height,Ce=re==null?void 0:re.devicePixelRatio;de(se)||(V.userAgentDataPlatform=se),de(ae)||(V.maxTouchPoints=ae),de(M)||(V.screenWidth=M),de(Te)||(V.screenHeight=Te),de(Ce)||(V.devicePixelRatio=Ce);const z=Dt(kx({$os:Y,$os_version:A,$browser:uS(ts,navigator.vendor,K,G),$webview_app:fe,$webview_app_version:te,$device:fS(ts),$device_type:fT(ts,V),$timezone:vk(),$timezone_offset:J6()}),{$current_url:xu(O?da(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,P,vu),$host:Yt==null?void 0:Yt.host,$pathname:Yt==null?void 0:Yt.pathname,$raw_user_agent:ts.length>1e3?ts.substring(0,997)+"...":ts,$browser_version:dT(ts,navigator.vendor,K,G),$browser_language:pk(),$browser_language_prefix:Z6(),$screen_height:re==null?void 0:re.screen.height,$screen_width:re==null?void 0:re.screen.width,$viewport_height:re==null?void 0:re.innerHeight,$viewport_width:re==null?void 0:re.innerWidth,$lib:hr.LIB_NAME,$lib_version:hr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return hr.SDK_DIST_CHANNEL&&(z.$sdk_dist_channel=hr.SDK_DIST_CHANNEL),z})(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){const{sessionId:C,windowId:E}=this.sessionManager.checkAndGetSessionAndWindowId(c,i.getTime(),!0);f.$session_id=C,f.$window_id=E}this.sessionPropsManager&&Dt(f,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&Dt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(m=this.Du)===null||m===void 0?void 0:m.length}catch(C){f.$sdk_debug_error_capturing_properties=String(C)}let v;if(this.requestRouter.region===G0&&(f.$lib_custom_api_host=this.config.api_host),v=t!=="$pageview"||c?t!=="$pageleave"||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),f=Dt(f,v),t==="$pageview"&&me&&(f.title=me.title),!de(u)){const C=i.getTime()-u;f.$duration=parseFloat((C/1e3).toFixed(3))}ts&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");const x=this.persistence.properties(),b=this.sessionPersistence.properties(),y=f.$groups,_=x.$groups;nt(y)&&!gs(y)&&(f.$groups=U(U({},nt(_)?_:{}),y)),yt(["$referrer","$referring_domain"],C=>{C in x&&delete b[C]});const j={};if(this.$u.length>0)for(const C of this.$u.slice())try{Dt(j,C())}catch(E){_e.error("Failed to produce browser extension event properties",E)}f=Dt({},h,x,b,U(U({},j),f)),f.$is_identified=this._isIdentified(),Ue(this.config.property_denylist)?yt(this.config.property_denylist,function(C){delete f[C]}):_e.error(Bk+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const N=this.config.sanitize_properties;N&&(_e.error(D5),f=N(f,t));const S=this.rh();return f.$process_person_profile=S,S&&!c&&this.oh("_calculate_event_properties"),f}ih(t,n=!0,i=!1){var a;if(!this.persistence||!this.rh()||this.Su&&!i)return t;const c=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)===null||a===void 0?void 0:a.getSetOnceProps();let f=Dt({},c,u||{},t||{});const h=this.config.sanitize_properties;return h&&(_e.error(D5),f=h(f,"$set_once")),n&&(this.Su=!0),gs(f)?void 0:f}register(t,n){var i;(i=this.persistence)===null||i===void 0||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)===null||a===void 0||a.register_once(t,n,i)}register_for_session(t){var n,i;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.nh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(a=>this.xu.add(a)),this.sh()}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t),this.xu.delete(t),this.sh()}ah(t,n){this.register({[t]:n})}Lu(){this.xu.forEach(t=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.pi||!Ot.Et())return void Ot.Lt(this.Cu);const n=[];this.xu.forEach(i=>n.push(i)),n.length>0?Ot.At(this.Cu,n):Ot.Lt(this.Cu)}getFeatureFlag(t,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var i,a;return(i=(a=this.featureFlags)===null||a===void 0?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)===null||a===void 0||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)===null||a===void 0||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n=!1,i){var a;return(a=this.featureFlags)===null||a===void 0?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.au.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:$c}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n=!1){this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:$c})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:$c})}renderSurvey(t,n){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,n)}displaySurvey(t,n=SM){var i;(i=this.surveys)===null||i===void 0||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:$c}}canRenderSurveyAsync(t,n=!1){var i,a;return(i=(a=this.surveys)===null||a===void 0?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:$c})}uh(t){return!t||Qc(t)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(_e.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())||(_e.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if(Zt(t)&&(t=t.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t)||!this.oh("posthog.identify"))return;this.yu();const a=this.get_distinct_id(),c=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.nh(!1),f=this.persistence.Pl();let h=!1;try{const v=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:v},""),t!==v&&t!==this.get_property("__alias")&&(this.unregister(Qf),this.register({distinct_id:t}));const x=(this.persistence.get_property("$user_state")||"anonymous")===dr,b=t!==v,y=!b&&x;if(b&&x){var m;const _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:v};this.persistence.set_property(ns,Af),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(L0,_,{$set:n||{},$set_once:i||{}}),this.Eu=Eg(t,n,i),(m=this.featureFlags)===null||m===void 0||m.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:v)}else if(y){this.persistence.set_property(ns,Af);const _=n||{},j=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:_,$set_once:j}),this.Eu=Eg(t,n,i)}else(n||i)&&this.setPersonProperties(n,i);b||c||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(oa)):y&&(n||i)&&this.reloadFeatureFlags(),h=!0}finally{f&&this.persistence.Ol(h)}}setPersonProperties(t,n){if(!t&&!n||!this.oh("posthog.setPersonProperties"))return;const i=Eg(this.get_distinct_id(),t,n);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Eu=i):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const i=(Ue(t)?t:[t]).filter(a=>it(a)&&a.length>0);i.length!==0&&this.oh("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,n,i){var a;if(!t||!n)return void _e.error("posthog.group requires a group type and group key");(a=this.persistence)===null||a===void 0||a.syncCookieProperties(),this.nh();const c=this.getGroups(),u=c[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:U(U({},c),{},{[t]:n})}),(u||i)&&this.rh()){const f={$group_type:t,$group_key:n};i&&(f.$group_set=i),this.capture(s5,f)}i&&this.setGroupPropertiesForFlags({[t]:i}),u&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n=!0){var i;(i=this.featureFlags)===null||i===void 0||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n=!0){var i;this.oh("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)===null||i===void 0||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(t)}reset(t){const n=ss(t)?t:t==null?void 0:t.resetDeviceID,i=ss(t)||t==null?void 0:t.bootstrap;this.hh(n,!1,i)}hh(t,n=!1,i){var a,c,u,f,h,m;if(_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");const v=i==null?void 0:i.sessionID;this.config.bootstrap=i||((a=this.Ru)===null||a===void 0?void 0:a.bootstrap)||{},(c=this.featureFlags)===null||c===void 0||(u=c.updateConfig)===null||u===void 0||u.call(c,this.config,this.Yl());const x=this.get_property(vx),b=this.get_property(hg),y=this.get_property(Wc);(f=this.sessionRecording)===null||f===void 0||f.flushBeforeIdentityReset();const _=this.is_capturing();this.consent.reset(),n||!_||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.");const j=(h=this.persistence)===null||h===void 0||(m=h.Pl)===null||m===void 0?void 0:m.call(h);let N=!1;try{var S,C,E,L,O,R,F,D,X,P,Y,A,fe;if((S=this.persistence)===null||S===void 0||S.clear(),(C=this.sessionPersistence)===null||C===void 0||C.clear(),this.xu.clear(),this.sh(),de(y)||(P=this.persistence)===null||P===void 0||P.register({$session_recording_remote_config:y}),(E=this.surveys)===null||E===void 0||E.reset(),(L=this.featureFlags)===null||L===void 0||L.reset(),(O=this.conversations)===null||O===void 0||O.reset(),(R=this.logs)===null||R===void 0||R.reset(),(F=this.metrics)===null||F===void 0||F.reset(),(D=this.persistence)===null||D===void 0||D.set_property("$user_state","anonymous"),(X=this.sessionManager)===null||X===void 0||X.resetSessionId(),this.Eu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:pg,$device_id:null},"");else{const G=this.config.get_device_id(li());this.register_once({distinct_id:G,$device_id:t?G:x},""),t||de(b)||this.register({[hg]:b})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.fu()&&((fe=this.persistence)===null||fe===void 0||fe.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(Y=this.featureFlags)===null||Y===void 0||Y.initialize(),!Ve(v)&&!(!((A=this.sessionManager)===null||A===void 0)&&A.setBootstrapSessionId(v,!0)))){const G=U({},i);delete G.sessionID,this.config.bootstrap=G}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,N=!0}finally{var te,K;j&&((te=this.persistence)===null||te===void 0||(K=te.Ol)===null||K===void 0||K.call(te,N))}this.reloadFeatureFlags()}shutdown(t){var n=this;return zt(function*(){var i,a,c,u,f,h,m;if(n.__loaded){n.ku=!0,n.zu().dispose(),(i=n.sessionRecording)===null||i===void 0||i.dispose(),(a=n.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(c=n.metrics)===null||c===void 0||c.flush("sendBeacon"),(u=n.Fu)===null||u===void 0||u.unload(),(f=n.Du)===null||f===void 0||f.unload();try{var v;(v=n.featureFlags)===null||v===void 0||v.destroy()}catch(x){_e.error("Error while destroying feature flags",x)}(h=n.persistence)===null||h===void 0||h.destroy(),(m=n.sessionPersistence)===null||m===void 0||m.destroy()}else _e.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,n){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)===null||i===void 0||i.dh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.fh()}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||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let a=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(t!=null&&t.withTimestamp&&i){var c;const u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!i)return a;a+=`?t=${Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}`}return a}alias(t,n){return t===this.get_property("$people_distinct_id")?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(de(n)&&(n=this.get_distinct_id()),t!==n?(this.ah(Qf,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const n=U({},this.config);if(nt(t)){var i,a,c,u,f,h,m,v,x,b,y,_,j;Dt(this.config,z5(t));const S=this.bu();(i=this.persistence)===null||i===void 0||i.update_config(this.config,n,S),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wg(U(U({},this.config),{},{persistence:"sessionStorage"}),S,!1);const C=this.Pu(this.config.debug);var N;ss(C)&&(this.config.debug=C),ss(this.config.debug)&&(this.config.debug?(_n.DEBUG=!0,ot.Et()&&ot.At("ph_debug",!0),_e.info("set_config",{config:t,oldConfig:n,newConfig:U({},this.config)})):(_n.DEBUG=!1,ot.Et()&&ot.Lt("ph_debug"))),(a=this.featureFlags)===null||a===void 0||(c=a.updateConfig)===null||c===void 0||c.call(a,this.config,this.Yl()),(u=this.exceptionObserver)===null||u===void 0||u.onConfigChange(),(f=this.exceptions)===null||f===void 0||f.onConfigChange(),(h=this.sessionRecording)===null||h===void 0||h.startIfEnabledOrStop(),(m=this.tracingHeaders)===null||m===void 0||m.startIfEnabledOrStop(),(v=this.autocapture)===null||v===void 0||v.startIfEnabled(),(x=this.heatmaps)===null||x===void 0||x.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((N=this.historyAutocapture)===null||N===void 0||N.startIfEnabledOrStop()),(b=this.exceptionObserver)===null||b===void 0||b.startIfEnabledOrStop(),(y=this.deadClicksAutocapture)===null||y===void 0||y.startIfEnabledOrStop(),(_=this.surveys)===null||_===void 0||_.loadIfEnabled(),this._u(),(j=this.externalIntegrations)===null||j===void 0||j.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&b5(this,su,!1)}}_overrideSDKInfo(t,n){_n.LIB_NAME=t,_n.LIB_VERSION=n}startSessionRecording(t){const n=t===!0,i={sampling:n||!!(t!=null&&t.sampling),linked_flag:n||!!(t!=null&&t.linked_flag),url_trigger:n||!!(t!=null&&t.url_trigger),event_trigger:n||!!(t!=null&&t.event_trigger)};var a,c,u,f,h;Object.values(i).some(Boolean)&&((a=this.sessionManager)===null||a===void 0||a.checkAndGetSessionAndWindowId(),i.sampling&&((c=this.sessionRecording)===null||c===void 0||c.overrideSampling()),i.linked_flag&&((u=this.sessionRecording)===null||u===void 0||u.overrideLinkedFlag()),i.url_trigger&&((f=this.sessionRecording)===null||f===void 0||f.overrideTrigger("url")),i.event_trigger&&((h=this.sessionRecording)===null||h===void 0||h.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===void 0)&&t.started)}captureException(t,n){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(U(U({},i),n))}catch{return}}addExceptionStep(t,n){var i;(i=this.exceptions)===null||i===void 0||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)===null||n===void 0||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&t!==void 0?t:ia.ph}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)===null||i===void 0?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t;let n=(t=this.config.name)!==null&&t!==void 0?t:Vc;return n!==Vc&&(n="posthog."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}rh(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&gs(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}Ku(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return this.config.person_profiles==="never"?(_e.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(_x,!0),!0)}bu(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}_u(){var t,n;const i=this.bu();var a,c,u;return this.is_capturing()||(a=this.logs)===null||a===void 0||a.gh(),((t=this.persistence)===null||t===void 0?void 0:t.pi)!==i&&((c=this.persistence)===null||c===void 0||c.set_disabled(i)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.pi)!==i&&((u=this.sessionPersistence)===null||u===void 0||u.set_disabled(i)),i&&(this.xu.clear(),this.sh()),i}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this.fu()){var i,a,c,u,f,h;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),(a=this.sessionManager)===null||a===void 0||a.destroy(),(c=this.pageViewManager)===null||c===void 0||c.destroy(),this.sessionManager=new A5(this),this.pageViewManager=new y5(this),this.persistence&&(this.sessionPropsManager=new T5(this,this.sessionManager,this.persistence));const y=(u=(f=this.config.__extensionClasses)===null||f===void 0?void 0:f.sessionRecording)!==null&&u!==void 0?u:(h=ia.__defaultExtensionClasses)===null||h===void 0?void 0:h.sessionRecording;var m,v;y&&(this.sessionRecording=this.vu(this.sessionRecording,new y(this)),this.lu&&((m=this.sessionRecording)===null||m===void 0||(v=m.onRemoteConfig)===null||v===void 0||v.call(m,this.lu)))}var x,b;this.consent.optInOut(!0),this._u(),this.Zu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((x=this.surveys)===null||x===void 0||x.loadIfEnabled()),(de(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.Qu()}else _e.warn(L5)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void _e.warn(L5);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,i;t==null||t.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:pg,$device_id:null}),this.du(t),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return jn?Rk(jn,this.config.custom_blocked_useragents):void 0}Qu(){me&&(me.visibilityState==="visible"?this.Tu||(this.Tu=!0,this.capture(Sx,{title:me.title},{send_instantly:!0}),this.Iu&&(me.removeEventListener(pu,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),Nt(me,pu,this.Iu)))}debug(t){t===!1?(re==null||re.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(re==null||re.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Yl(){const t=this.Ru||{};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?(_e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,i,a,c,u){const f=i in n&&!Ve(n[i]),h=a in n&&!Ve(n[a]);return f?n[i]:!!h&&(u&&u.warn(`Config field '${a}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,_e)}Os(t){var n;if(Ve(this.config.before_send))return t;const i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(eT),a=Ue(this.config.before_send)?this.config.before_send:[this.config.before_send];let c=t;for(const u of a)try{if(c=u(c),Ve(c)){const f=`Event '${t.event}' was rejected in beforeSend function`;return J4(t.event)?_e.warn(`${f}. This can cause unexpected behavior.`):_e.info(f),null}c.properties&&!gs(c.properties)||_e.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(f){return _e.error(`Error in beforeSend function for event '${t.event}':`,f),null}for(const u of i)if(c.properties&&Ve(c.properties[u]))return _e.warn(`Event '${t.event}' had its '${u}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.Bo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}Pu(t){const n=ss(t)&&!t,i=ot.Et()&&ot.Ot("ph_debug")==="true";return!n&&(!!i||t)}};iu.__defaultExtensionClasses={},iu.ph=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let n=0;t.length>n;n++)e.prototype[t[n]]=T6(e.prototype[t[n]])})(iu,["identify"]);var Uk=class{constructor(e){this.disabled=e===!1;const t=nt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}};const Rg="$copy_autocapture",mf=Jt("[AutoCapture]");function Og(e,t){return t.length>e?t.slice(0,e)+"...":t}function DM(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Oi(t));return t}function zM(e,{e:t,maskAllElementAttributes:n,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:c,disableCaptureUrlHashes:u}){var f,h;if(!Oi(e))return{props:{}};const m=[e],v=new Set([e]);let x=e;for(;x.parentNode&&!Un(x,"body")&&1e3>m.length;){if(jx(x.parentNode)){const R=x.parentNode.host;if(v.has(R))break;v.add(R),m.push(R),x=R;continue}if(!Oi(x.parentNode)||v.has(x.parentNode))break;v.add(x.parentNode),m.push(x.parentNode),x=x.parentNode}const b=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?m.findIndex(R=>Un(R,"button")||Un(R,"a")):-1;b>0&&(i=i||m.slice(0,b+1).some(R=>!ho(R)||gu(R)));const y=[],_={};let j,N=!1,S=!1;if(yt(m,R=>{const F=ho(R);if(Un(R,"a")){const D=R.getAttribute("href");N=!!(F&&D&&eu(D))&&(u?da(D):D)}Ie(go(R),"ph-no-capture")&&(S=!0),y.push((function(D,X,P,Y,A=!1){const fe=D.tagName.toLowerCase(),te={tag_name:fe};Cx.indexOf(fe)>-1&&!P&&(te.$el_text=fe.toLowerCase()==="a"||fe.toLowerCase()==="button"?Og(1024,g5(D)):Og(1024,mu(D)));const K=go(D);K.length>0&&(te.classes=K.filter(function(ae){return ae!==""})),yt(D.attributes,function(ae){var M;if((!gu(D)||["name","id","class","aria-label"].indexOf(ae.name)!==-1)&&!(Y!=null&&Y.includes(ae.name))&&!X&&eu(ae.value)&&(!it(M=ae.name)||M.substring(0,10)!=="_ngcontent"&&M.substring(0,7)!=="_nghost")){let Te=ae.value;ae.name==="class"&&(Te=Nx(Te).join(" ")),te["attr__"+ae.name]=Og(1024,ae.name==="href"&&A?da(Te):Te)}});let G=1,V=1,se=D;for(;se=DM(se);)G++,se.tagName===D.tagName&&V++;return te.nth_child=G,te.nth_of_type=V,te})(R,n,i,a,u)),yt((function(D){if(!ho(D))return{};const X={};return yt(D.attributes,function(P){if(P.name&&P.name.indexOf("data-ph-capture-attribute")===0){const Y=P.name.replace("data-ph-capture-attribute-",""),A=P.value;Y&&A&&eu(A)&&(X[Y]=A)}}),X})(R),(D,X)=>{({}).hasOwnProperty.call(_,X)||(_[X]=D)})}),S)return{props:{},explicitNoCapture:S};if(b>0&&(e=m[b],y.splice(0,b)),i||(y[0].$el_text=Un(e,"a")||Un(e,"button")?g5(e):mu(e)),N){var C,E;y[0].attr__href=N;const R=(C=xo(N))===null||C===void 0?void 0:C.host,F=re==null||(E=re.location)===null||E===void 0?void 0:E.host;R&&F&&R!==F&&(j=N)}return{props:Dt((O=t.type,{$event_type:O,$ce_version:1}),c?{}:{$elements:y},{$elements_chain:(L=y,Ue(L)?(function(R){return R.map(F=>{var D,X;let P="";if(F.tag_name&&(P+=F.tag_name),F.attr_class){F.attr_class.sort();for(const fe of F.attr_class)P+=`.${fe.replace(/"/g,"")}`}const Y=U(U(U(U({},F.text?{text:F.text}:{}),{},{"nth-child":(D=F.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(X=F.nth_of_type)!==null&&X!==void 0?X:0},F.href?{href:F.href}:{}),F.attr_id?{attr_id:F.attr_id}:{}),F.attributes),A={};return Rf(Y).sort(([fe],[te])=>(function(K,G){return G>K?-1:K>G?1:0})(fe,te)).forEach(([fe,te])=>A[x5(fe.toString())]=x5(te.toString())),P+=":",P+=Rf(A).map(([fe,te])=>`${fe}="${te}"`).join(""),P}).join(";")})((function(R){return R.map(F=>{var D,X;const P={text:(D=F.$el_text)===null||D===void 0?void 0:D.slice(0,400),tag_name:F.tag_name,href:(X=F.attr__href)===null||X===void 0?void 0:X.slice(0,2048),attr_class:q6(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return Rf(F).filter(([Y])=>Y.indexOf("attr__")===0).forEach(([Y,A])=>P.attributes[Y]=A),P})})(L)):"")},!((f=y[0])===null||f===void 0)&&f.$el_text?{$el_text:(h=y[0])===null||h===void 0?void 0:h.$el_text}:{},j&&t.type==="click"?{$external_click_url:j}:{},_),target:e};var L,O}var $M=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(e){var t;if(!ho(e))return!0;const n=(t=this.vo().css_selector_ignorelist)!==null&&t!==void 0?t:yg,i=new Set;let a=e;for(;a;){if(i.size>=1e3||i.has(a))return!0;i.add(a);const c=a,u=go(c);if(Ie(u,"ph-no-capture")||Ie(u,"ph-sensitive")||gu(c)||n.some(h=>P0(c,h)))return!0;const f=a.parentNode;a=jx(f)?f.host:f&&Oi(f)?f:null}return!1}fo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.uo();if(e.type==="pointerdown"){this.uo();const i=Jc(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&Oi(i)&&(this.ho={target:i,excluded:this.do(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.po)===null||t===void 0?void 0:t.distinctId}))}const n=this.ho;n&&(e.pointerId!==n.id||Math.abs(e.clientX-n.x)>5||Math.abs(e.clientY-n.y)>5?this.uo():e.type==="pointerup"&&(n.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(e){var t;const n=this.ho;this.uo();const i=Jc(e);if(n!=null&&n.released&&n.target.isConnected&&n.distinctId===((t=this.po)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===n.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-n.x)&&5>=Math.abs(e.clientY-n.y)&&i&&(Un(i,"html")||Un(i,"body"))){var a;if(n.excluded)return null;const c=(a=this.vo().css_selector_ignorelist)!==null&&a!==void 0?a:yg;return[i,me==null?void 0:me.documentElement,me==null?void 0:me.body].some(u=>{if(!u)return!1;const f=go(u);return Ie(f,"ph-no-capture")||Ie(f,"ph-sensitive")||!ho(u)||gu(u)||c.some(h=>P0(u,h))})?null:n.target}}constructor(e){this.yo=e,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new Uk(this.Mr.rageclick),this.xo=null}setup(e){this.Co(),this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?t.dispose():(this.$o=t,this.startIfEnabled())}dispose(){var e;this.So||(this.So=!0,this.po=void 0,(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var e,t;return this.vo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Mr}Io(){if(!this.isBrowserSupported())return void mf.info("Disabling Automatic Event Collection because this browser is not supported");if(!re||!me)return;const e=this.Mo=t=>{t=t||(re==null?void 0:re.event);try{if(t.type==="blur")return void this.uo();if(t.type.indexOf("pointer")===0)return void this.fo(t);const n=t.type==="click"?this.mo(t):void 0;if(Wt(n))return;this.Eo(t,"$autocapture",n)}catch(n){mf.error("Failed to capture event",n)}};if(Nt(re,"blur",e),Nt(me,"submit",e,{capture:!0}),Nt(me,"change",e,{capture:!0}),Nt(me,"click",e,{capture:!0}),yt(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Nt(me,t,e,{capture:!0})}),this.vo().capture_copied_text){const t=this.Po=n=>{n=n||(re==null?void 0:re.event);try{this.Eo(n,Rg)}catch(i){mf.error("Failed to capture clipboard event",i)}};Nt(me,"copy",t,{capture:!0}),Nt(me,"cut",t,{capture:!0}),Nt(me,"paste",t,{capture:!0})}}To(){this.uo(),this.Mo&&(re==null||re.removeEventListener("blur",this.Mo),yt(["pointerdown","pointermove","pointerup","pointercancel"],e=>{me==null||me.removeEventListener(e,this.Mo,!0)}),me==null||me.removeEventListener("submit",this.Mo,!0),me==null||me.removeEventListener("change",this.Mo,!0),me==null||me.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(me==null||me.removeEventListener("copy",this.Po,!0),me==null||me.removeEventListener("cut",this.Po,!0),me==null||me.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(e){if(this.So)return;if(this.wo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.ko=t.elementsChainAsString);const n=t.autocapture_opt_out;var i;ss(n)&&((i=this.po)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",n),this._o=n),this.startIfEnabled()}setElementSelectors(e){this.xo=e}getElementSelectors(e,t){var n;const i=[];return(n=this.xo)===null||n===void 0||n.forEach(a=>{const c=me==null?void 0:me.querySelectorAll(a);c==null||c.forEach(u=>{e!==u&&t!==u||Ie(i,a)||i.push(a)})}),i}get isEnabled(){var e,t;if(this.So)return!1;const n=(e=this.po)===null||e===void 0?void 0:e.kv.get(LS),i=this._o,a=this.vo();if(!a.remoteRequestsDisabled&&!this.wo)return!1;const c=a.remoteRequestsDisabled&&!this.wo;if(Wt(i)&&!ss(n)&&!c)return!1;const u=(t=this._o)!==null&&t!==void 0?t:!!n;return!!a.enabled&&!u}Eo(e,t="$autocapture",n){if(!this.isEnabled)return void this.uo();let i=n||Jc(e);ek(i)&&(i=i.parentNode||null);const a=this.Co();var c;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&a.rageclick&&(!((c=this.rageclicks)===null||c===void 0)&&c.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&ik(i,a.rageclick)&&this.Eo(e,"$rageclick",n);const u=t===Rg,f=u?U(U({},a),{},{dom_event_allowlist:void 0}):a;if(i&&(function(x,b,y,_,j,N){var S;if(!re||Ex(x)||y!=null&&y.url_allowlist&&!c5(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&c5(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){const O=y.dom_event_allowlist;if(O&&!O.some(R=>b.type===R))return!1}const{parentIsUsefulElement:C,targetElementList:E}=rk(x,_);if(!(function(O,R){const F=R==null?void 0:R.element_allowlist;if(de(F))return!0;for(const D of O)if(F.some(X=>D.tagName.toLowerCase()===X))return!0;return!1})(E,y)||!U0(E,y==null?void 0:y.css_selector_allowlist)||U0(E,(S=y==null?void 0:y.css_selector_ignorelist)!==null&&S!==void 0?S:yg))return!1;try{const O=re.getComputedStyle(x);if(O&&O.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}const L=x.tagName.toLowerCase();switch(L){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return C?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(Cx.indexOf(L)>-1||x.getAttribute("contenteditable")==="true")}})(i,e,f,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var h;const{props:x,explicitNoCapture:b,target:y}=zM(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(b)return!1;const _=this.getElementSelectors(i,y);if(_&&_.length>0&&(x.$element_selectors=_),t===Rg){const j=e.type||"clipboard";if(j!=="paste"){var m,v;const N=re==null||(m=re.getSelection())===null||m===void 0?void 0:m.toString(),S=tk(N);if(!S)return!1;x.$selected_content=S,x.$clipboard_text_length=(v=N==null?void 0:N.length)!==null&&v!==void 0?v:0}x.$copy_type=j}return(h=this.po)===null||h===void 0||h.capture(t,x).catch(j=>mf.error("Failed to capture event",j)),!0}}isBrowserSupported(){return Pn(me==null?void 0:me.querySelectorAll)}},BM=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,n=nt(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.Yl(),e.url_allowlist=n==null?void 0:n.url_allowlist,e.url_ignorelist=n==null?void 0:n.url_ignorelist,e.dom_event_allowlist=n==null?void 0:n.dom_event_allowlist,e.element_allowlist=n==null?void 0:n.element_allowlist,e.css_selector_allowlist=n==null?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=n==null?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=n==null?void 0:n.element_attribute_ignorelist,e.capture_copied_text=n==null?void 0:n.capture_copied_text}};const Bc=Jt("[ExceptionAutocapture]"),$5=()=>{},B5=e=>{var t;if(Pn(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function Fk(e,t,n){try{if(!(t in e))return $5;const i={next:e[t]},a=n(function(...c){return i.next.apply(this,c)});return Pn(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=a,()=>{if(e[t]===a)return void(e[t]=i.next);let c=e[t],u=B5(c);for(;u;){if(u.next===a)return void(u.next=i.next);c=u.next,u=B5(c)}}}catch{return $5}}const PM=Jt("[TracingHeaders]"),Va=Jt("[Web Vitals]"),P5=9e5,U5=["CLS","FCP","INP","LCP"],UM=["INP","LCP"],FM=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Lg="disabled",F5="lazy_loading",rr=Jt("[SessionRecording]"),IM=Jt("[Heatmaps]");function Dg(e){return nt(e)&&"clientX"in e&&"clientY"in e&&Zt(e.clientX)&&Zt(e.clientY)}const gf=Jt("[Product Tours]"),zg=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(yx))},HM=["$set_once","$set"],Ni=Jt("[SiteApps]"),I5="Error while initializing PostHog app with config id ",Ik=(e,t)=>e!=null&&e.then?e.then(t):t(e),no="SDK is not enabled or survey functionality is not yet loaded",H5="Disabled. Not loading surveys.";var qM=class{constructor(e,t){this.yo=e,this.mh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=n=>{if(this.So||this.Mr.disableSurveys)return;if(!n.ok)return kt.warn("Remote config unavailable. Not loading surveys.");const i=n.config.surveys;if(Ve(i))return kt.warn("Flags not loaded yet. Not loading surveys.");this.Sh=ss(i)?i:i.length>0,kt.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(e){if(!this.So)return this.xh=e,Ik(e.kv.initialize(),()=>{if(this.xh!==e||this.So)return;this.xh=void 0,this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.So?t.dispose():(this.$o=t,this.loadIfEnabled())})}dispose(){var e,t,n,i;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)===null||n===void 0||(i=n.dispose)===null||i===void 0||i.call(n),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(a=>clearTimeout(a)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)===null||e===void 0||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let n=0;n<localStorage.length;n++){const i=localStorage.key(n);(i!=null&&i.startsWith("seenSurvey_")||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach(n=>localStorage.removeItem(n))}catch{}}loadIfEnabled(){if(this.So||!this.po)return;const e=this.Mr;if(this._surveyManager)return;if(this.yh)return void kt.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void kt.info(H5);if(e.cookielessMode&&this.yo.isOptedOut())return void kt.info("Not loading surveys in cookieless mode without consent.");const t=this.yo.getExtensions();if(!t)return void kt.error("PostHog Extensions not found.");if(de(this.Sh)&&!e.advancedEnableSurveys)return;const n=this.Sh||e.advancedEnableSurveys;this.yh=!0;try{const i=t.generateSurveys;if(i)return this.Ch(i,n),void(this.yh=!1);const a=t.loadExternalDependency;if(!a)return this.$h(wx),void(this.yh=!1);a(c=>{try{if(this.So)return;const u=this.yo.getExtensions();c||!(u!=null&&u.generateSurveys)?this.$h("Could not load surveys script",c):this.Ch(u.generateSurveys,n)}finally{this.yh=!1}})}catch(i){throw this.yh=!1,this.$h("Error initializing surveys",i),i}}Ch(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),kt.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(e,t){kt.error(e,t),this.Th({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.bh.push(e),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const i=(n=this.po)!==null&&n!==void 0?n:this.mh;if(!i||this.So)return;if(this.Mr.disableSurveys)return kt.info(H5),e([]);const a=i.kv.get(A0);if(a&&!t)return e(a,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:f,context:h})=>{this.So||e(f,h)}).catch(f=>kt.error("Error in survey callback",f));const c=this.Mh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(f=>{try{return this.Eh(i,f)}catch(h){return kt.error("Error processing surveys response",h),this.Eh(i,{statusCode:0,error:h})}},f=>this.Eh(i,{statusCode:0,error:f}));this._h=c;const u=()=>{this._h===c&&(this._h=null)};c.then(f=>{u(),this.So||e(f.surveys,f.context)},u).catch(f=>kt.error("Error in survey callback",f))}Mh(e,t){const n=this.po;return n?n.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(no)}))}Eh(e,t){if(this.So)return{surveys:[],context:{isLoaded:!1,error:no}};const n=t.statusCode;if(n!==200||!t.json){const u=`Surveys API could not be loaded, status: ${n}`;return n!==0?kt.error(u):t.error||kt.warn(u),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:u}}}this.wh=null;const i=t.json.surveys||[],a=i.filter(u=>(function(f){return!(!f.start_date||f.end_date)})(u)&&(Lk(u)||(function(f){var h;return!!(!((h=f.conditions)===null||h===void 0||(h=h.actions)===null||h===void 0||(h=h.values)===null||h===void 0)&&h.length)})(u)));var c;return a.length>0&&((c=this._surveyEventReceiver)===null||c===void 0||c.register(a)),e.kv.set({[A0]:i,[Kf]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var e,t;const n=(e=(t=this.po)!==null&&t!==void 0?t:this.mh)===null||e===void 0?void 0:e.kv.get(Kf);return Zt(n)&&Date.now()-n>3e5}Rh(){return Zt(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(e,t){var n;const i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};$k(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Th(e){for(const t of this.bh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){kt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t=!1){if(!Ve(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);kt.warn("init was not called")}Ah(e){let t=null;return this.getSurveys(n=>{var i;t=(i=n.find(a=>a.id===e))!==null&&i!==void 0?i:null}),t}Fh(e){if(Ve(this._surveyManager))return{eligible:!1,reason:no};const t=typeof e=="string"?this.Ah(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Oh(e){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Ve(this._surveyManager))return{eligible:!1,reason:no};const t=typeof e=="string"?this.Ah(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ve(this._surveyManager))return kt.warn("init was not called"),{visible:!1,disabledReason:no};const t=this.Oh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ve(this._surveyManager)?(kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:no})):new Promise(n=>{this.getSurveys(i=>{var a;const c=(a=i.find(u=>u.id===e))!==null&&a!==void 0?a:null;if(c){const u=this.Oh(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var i;if(!this.yo.isCapturing())return;if(Ve(this._surveyManager))return void kt.warn("init was not called");const a=typeof e=="string"?this.Ah(e):e;if(!(a!=null&&a.id))return void kt.warn("Survey not found");if(!wM.includes(a.type))return void kt.warn(`Surveys of type ${a.type} cannot be rendered in the app`);const c=me==null?void 0:me.querySelector(t);if(c){if(!((i=a.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){kt.info(`Rendering survey ${a.id} with delay of ${a.appearance.surveyPopupDelaySeconds} seconds`);const u=setTimeout(()=>{var f,h;this.kh.delete(u),!this.So&&this.yo.isCapturing()&&(kt.info(`Rendering survey ${a.id} with delay of ${(f=a.appearance)===null||f===void 0?void 0:f.surveyPopupDelaySeconds} seconds`),(h=this._surveyManager)===null||h===void 0||h.renderSurvey(a,c,n),kt.info(`Survey ${a.id} rendered`))},1e3*a.appearance.surveyPopupDelaySeconds);return void this.kh.add(u)}this._surveyManager.renderSurvey(a,c,n)}else kt.warn("Survey element not found")}displaySurvey(e,t){var n;if(!this.yo.isCapturing())return;if(Ve(this._surveyManager))return void kt.warn("init was not called");const i=this.Ah(e);if(!i)return void kt.warn("Survey not found");let a=i;if(!((n=i.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=U(U({},i),{},{appearance:U(U({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==F0.Popover&&t.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const c=this.Fh(i);if(!c.eligible)return void kt.warn("Survey is not eligible to be displayed: ",c.reason)}t.displayType!==F0.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}cancelPendingSurvey(e){Ve(this._surveyManager)?kt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function so(e,t,n){if(Ve(e))return!1;switch(n){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var VM=class{constructor(e){this._instance=e,this.Dh=new Set,this.Lh=new Set,this.Nh=new nh,this.qh=(t,n)=>this.jh(t,n)&&this.Bh(t,n)&&this.Hh(t,n)&&this.zh(t,n),this.jh=(t,n)=>!(n!=null&&n.event)||(t==null?void 0:t.event)===(n==null?void 0:n.event)}init(){var e,t;de((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.Uh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,i)=>{this.on(n,i)}))}dispose(){var e;(e=this.Uh)===null||e===void 0||e.call(this),this.Uh=void 0,this.Nh=new nh}register(e){var t,n;if(!de((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var a;this.Dh.add(i),(a=i.steps)===null||a===void 0||a.forEach(c=>{this.Lh.add((c==null?void 0:c.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const i=new Set;this.Dh.forEach(a=>{var c;(c=a.steps)===null||c===void 0||c.forEach(u=>{u!=null&&u.selector&&i.add(u.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Dh.clear(),this.Lh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Lh.has(e)||this.Lh.has(t.event))&&this.Dh.forEach(n=>{this.Wh(t,n)&&this.Nh.emit("actionCaptured",n.name)})}Vh(e){this.onAction("actionCaptured",t=>e(t))}Wh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.qh(e,n))return!0;return!1}onAction(e,t){return this.Nh.on(e,t)}Bh(e,t){if(t!=null&&t.url){var n;const i=e==null||(n=e.properties)===null||n===void 0?void 0:n.$current_url;if(!i||typeof i!="string"||!so(i,t.url,t.url_matching||"contains"))return!1}return!0}Hh(e,t){return!!this.Gh(e,t)&&!!this.Zh(e,t)&&!!this.Qh(e,t)}Gh(e,t){var n;if(!(t!=null&&t.href))return!0;const i=this.Jh(e);if(i.length>0)return i.some(c=>so(c.href,t.href,t.href_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&so((function(c){const u=c.match(/(?::|")href="(.*?)"/);return u?u[1]:""})(a),t.href,t.href_matching||"exact")}Zh(e,t){var n;if(!(t!=null&&t.text))return!0;const i=this.Jh(e);if(i.length>0)return i.some(h=>so(h.text,t.text,t.text_matching||"exact")||so(h.$el_text,t.text,t.text_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&(c=(function(h){const m=[],v=/(?::|")text="(.*?)"/g;let x;for(;!Ve(x=v.exec(h));)m.includes(x[1])||m.push(x[1]);return m})(a),u=t.text,f=t.text_matching||"exact",c.some(h=>so(h,u,f)));var c,u,f}Qh(e,t){var n,i;if(!(t!=null&&t.selector))return!0;const a=e==null||(n=e.properties)===null||n===void 0?void 0:n.$element_selectors;if(a!=null&&a.includes(t.selector))return!0;const c=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&c)try{return new RegExp(t.selector_regex).test(c)}catch{return!1}return!1}Jh(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}zh(e,t){return!(t!=null&&t.properties)||t.properties.length===0||zk(t.properties.reduce((n,i)=>{const a=Ue(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:a,operator:i.operator||"exact"},n},{}),e==null?void 0:e.properties)}},GM=class{constructor(e){var t,n;this.Kh=[],this._instance=e,this.Yh=new Map,this.Xh=new Map,this.tc=new Map,this.ec=(t=this._instance)===null||t===void 0||(n=t.onSessionId)===null||n===void 0?void 0:n.call(t,i=>this.nc(i))}sc(e){return!1}rc(){return null}oc(e){}lc(){}ac(e,t){return!!e&&zk(e.propertyFilters,t==null?void 0:t.properties)}uc(e,t){const n=new Map;return e.forEach(i=>{var a;(a=i.conditions)===null||a===void 0||(a=a[t])===null||a===void 0||(a=a.values)===null||a===void 0||a.forEach(c=>{if(c!=null&&c.name){const u=n.get(c.name)||[];u.push(i.id),n.set(c.name,u)}})}),n}hc(e,t,n){const i=(n===Lc.Activation?this.Yh:this.Xh).get(e);let a=[];return this.cc(c=>{a=c.filter(u=>i==null?void 0:i.includes(u.id))}),a.filter(c=>{var u;const f=(u=c.conditions)===null||u===void 0||(u=u[n])===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.find(h=>h.name===e);return this.ac(f,t)})}register(e){this.dc(e,!1)}replace(e){this.dc(e,!0)}dc(e,t){var n;de((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.vc(e,t),this.fc(e,t))}fc(e,t){const n=e.filter(c=>{var u;return(u=c.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length});var i;if(t&&this.tc.clear(),n.length===0)return void(t&&((i=this.gc)===null||i===void 0||i.replace([])));this.gc||(this.gc=new VM(this._instance),this.gc.init(),this.gc.Vh(c=>this.onAction(c)));const a=[];n.forEach(c=>{var u;(u=c.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||u.values.forEach(f=>{if(a.push(f),f.name){var h;const m=(h=this.tc.get(f.name))!==null&&h!==void 0?h:[];m.includes(c.id)||m.push(c.id),this.tc.set(f.name,m)}})}),t?this.gc.replace(a):this.gc.register(a)}mc(e,t){t.forEach((n,i)=>{var a;const c=(a=e.get(i))!==null&&a!==void 0?a:[];n.forEach(u=>{c.includes(u)||c.push(u)}),e.set(i,c)})}vc(e,t){var n,i;const a=e.filter(h=>{var m,v;return((m=h.conditions)===null||m===void 0?void 0:m.events)&&((v=h.conditions)===null||v===void 0||(v=v.events)===null||v===void 0||(v=v.values)===null||v===void 0?void 0:v.length)>0}),c=e.filter(h=>{var m,v;return((m=h.conditions)===null||m===void 0?void 0:m.cancelEvents)&&((v=h.conditions)===null||v===void 0||(v=v.cancelEvents)===null||v===void 0||(v=v.values)===null||v===void 0?void 0:v.length)>0}),u=this.uc(e,Lc.Activation),f=this.uc(e,Lc.Cancellation);t?(this.Yh=u,this.Xh=f):(this.mc(this.Yh,u),this.mc(this.Xh,f)),(a.length!==0||c.length!==0)&&((n=this.Uh)!==null&&n!==void 0||(this.Uh=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((h,m)=>{this.onEvent(h,m)})))}onEvent(e,t){var n,i;const a=this.yc(),c=(t==null||(n=t.properties)===null||n===void 0?void 0:n.$survey_id)||(t==null||(i=t.properties)===null||i===void 0?void 0:i.$product_tour_id);if(c&&this.getActivatedIds().includes(c)){const f=this.bc(e,c);if(f==="consume")return a.info("event consumed activated item, removing it",{event:e,itemId:c}),void this._c([c]);if(f==="persist")return a.info("shown item promoted to persisted activation",{event:e,itemId:c}),this.wc(c),void this.kc([c])}if(this.Xh.has(e)){const f=this.hc(e,t,Lc.Cancellation);f.length>0&&(a.info("cancel event matched, cancelling items",{event:e,itemsToCancel:f.map(h=>h.id)}),this._c(f.map(h=>h.id)),f.forEach(h=>this.Sc(h.id)))}if(!this.Yh.has(e))return;a.info("event name matched",{event:e,eventPayload:t,items:this.Yh.get(e)});const u=this.hc(e,t,Lc.Activation);this.xc(u.map(f=>f.id))}onAction(e){this.tc.has(e)&&this.xc(this.tc.get(e)||[])}xc(e){var t,n;if(e.length===0)return;const i=!!(!((t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0)&&n.call(t)),a=[];for(const c of e)i&&this.sc(c)?this.wc(c)&&this.Cc(c):a.push(c);a.length>0&&(this.Kh=[...new Set([...this.Kh,...a])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(e){this.Kh=this.Kh.filter(n=>n!==e);const t=this.$c();return!t.includes(e)&&(this.Tc([...t,e]),this.Ic(),!0)}_c(e){const t=new Set(e);this.Kh=this.Kh.filter(a=>!t.has(a));const n=this.Mc(),i=n.filter(a=>!t.has(a));i.length!==n.length&&(this.Tc(i),i.length===0&&this.Ec()),this.kc(e)}Pc(){var e;const t=this.rc();if(!t)return{};const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return n&&typeof n=="object"?n:{}}Cc(e){if(!this.rc())return;const t=this.Pc();this.oc(U(U({},t),{},{[e]:Date.now()}))}kc(e){if(!this.rc())return;const t=this.Pc(),n={};let i=!1;for(const[a,c]of Object.entries(t))e.includes(a)?i=!0:n[a]=c;i&&(gs(n)?this.lc():this.oc(n))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(e){if(!this.$c().includes(e))return;const t=this.Pc()[e];return Zt(t)?t:void 0}Mc(){var e;const t=this.Ac();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}$c(){var e,t,n;const i=this.Mc();if(i.length===0)return[];const a=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Fc()],c=(t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0?void 0:n.call(t);return c&&a===c?i:[]}Ic(){var e,t;const n=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);n&&this.Oc(n)}Ec(){this.Dc()}nc(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Fc()];if(n&&n!==e){const i=this.Mc(),a=this.Pc();i.length>0&&(this.Tc([]),i.filter(c=>Zt(a[c])).forEach(c=>this.Sc(c))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(e=>!this.Lc(e))}dispose(){var e,t,n;(e=this.ec)===null||e===void 0||e.call(this),this.ec=void 0,(t=this.Uh)===null||t===void 0||t.call(this),this.Uh=void 0,(n=this.gc)===null||n===void 0||n.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Yh}Nc(){return this.gc}},YM=class extends GM{constructor(e){super(e)}Ac(){return US}Fc(){return FS}rc(){return IS}oc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}lc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}sc(e){var t;let n;this.cc(a=>{n=a.find(c=>c.id===e)});const i=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return Zt(i)&&i>0}qc(){return fr.SHOWN}cc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Sc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}yc(){return kt}Tc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Oc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Dc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Lc(){return!1}bc(e,t){let n;return this.cc(i=>{n=i.find(a=>a.id===t)}),!n||(function(i){var a;return Lk(i)&&!!(!((a=i.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||i.schedule==="always"})(n)?e===fr.SHOWN?"consume":"ignore":e===fr.SHOWN?"persist":e===fr.DISMISSED||e===fr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},XM=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const n of e){const i=this._instance.get_property(n);de(i)||(t[n]=i)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},QM=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:n}=e;return{generateSurveys:t?i=>t(this._instance,i):void 0,loadExternalDependency:n?i=>n(this._instance,"surveys",i):void 0}}createEventReceiver(){return new YM(this._instance)}};const KM=re!=null&&re.location?Jf(re.location.hash,"__posthog")||Jf(location.hash,"state"):null,q5="_postHogToolbarParams",V5=Jt("[Toolbar]"),G5=Jt("[FeatureFlags]");var WM=class{constructor(e,t=!1){this.jc=!1,this.update(e,t)}update(e,t){this.Bc=((n,i)=>{var a,c,u,f,h,m,v;return{bootstrap:{featureFlags:(a=(c=n.bootstrap)===null||c===void 0?void 0:c.featureFlags)!==null&&a!==void 0?a:void 0,featureFlagPayloads:(u=(f=n.bootstrap)===null||f===void 0?void 0:f.featureFlagPayloads)!==null&&u!==void 0?u:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!n.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!n.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!n.advanced_feature_flags_dedup_per_session,cacheTtlMs:n.feature_flag_cache_ttl_ms,refreshIntervalMs:(h=n.remote_config_refresh_interval_ms)!==null&&h!==void 0?h:3e5,requestTimeoutMs:n.feature_flag_request_timeout_ms,compression:n.disable_compression?void 0:"best-available",evaluationContexts:(m=(v=n.evaluation_contexts)!==null&&v!==void 0?v:n.evaluation_environments)!==null&&m!==void 0?m:[],flagKeys:Ue(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.jc||(G5.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),de(e.flag_keys)||Ue(e.flag_keys)||G5.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const Y5=Jt("[FeatureFlags]"),Ga=Jt("[FeatureFlags]",{debugEnabled:!0}),$g=`" failed. Feature flags didn't load in time.`,X5="connection_error",Q5=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},K5=e=>{const t={};for(const[n,i]of Rf(e||{}))i&&(t[n]=i);return t},W5=e=>ku(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),si=Jt("[Error tracking]"),Y0="webkit-masked-url:",ZM=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],JM=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Y0],eA=["__firefox__","__gCrWeb"],Z5="Refusing to render web experiment since the viewer is a likely bot",tA={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>sh(t,e),not_regex:(e,t)=>!sh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Is=Jt("[Conversations]"),Ya="Conversations not available yet.";function J5(e,t){var n,i,a,c,u,f,h;const m=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,v=(i=e==null?void 0:e.maxBufferSize)!==null&&i!==void 0?i:100,x=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=de(x)?Math.max(v,2048):Math.max(v,x),y=U(U({},(function(){let _="",j="";try{const N=jn==null?void 0:jn.userAgent;N&&([_,j]=dS(N))}catch{}return(function(N,S){const C=(function(E){if(E)return{}.hasOwnProperty.call(Z_,E)?Z_[E]:E})(N);return U(U({},C?{"os.name":C}:{}),S?{"os.version":S}:{})})(_,j)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(c=(u=y==null?void 0:y["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&c!==void 0?c:t==null?void 0:t.serviceNameDefault,serviceVersion:(f=y==null?void 0:y["service.version"])!==null&&f!==void 0?f:e==null?void 0:e.serviceVersion,environment:(h=y==null?void 0:y["deployment.environment"])!==null&&h!==void 0?h:e==null?void 0:e.environment,resourceAttributes:y,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:m,maxBufferSize:v,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:m,maxLogsPerInterval:x,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const nA=["debug","log","warn","error","info"],sA=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},ew="console",Hk="__posthogHandledLogsRequestError",Bg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[Hk]=!0,n},tw=e=>!!e&&typeof e=="object"&&e[Hk]===!0,xh={featureFlags:class{constructor(e){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=Y5,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Yc=!1,this.Xc=0,this.sn=()=>{const t=this.td();this.Xc=0,t&&this.reloadFeatureFlags()},this.ed=()=>{var t;const n=this.nd;de(n)||this.Mr.remoteRequestsDisabled||!me||me.visibilityState==="hidden"||Date.now()-((t=this.sd)!==null&&t!==void 0?t:0)<n||(this.reloadFeatureFlags(),this.rd())},this.an=()=>{(me==null?void 0:me.visibilityState)==="visible"&&this.ed()},"get"in e?this.yo=e:(this._instance=e,this.od=new WM(e.config,e.Yl()),this.yo=this.od)}updateConfig(e,t){var n;(n=this.od)===null||n===void 0||n.update(e,t),this.po&&this.ld()}setup(e){return this.xh=e,this.$=e.logger.createLogger("[FeatureFlags]"),Ik(e.kv.initialize(),()=>{this.xh===e&&(this.xh=void 0,this.po=e,this.ad(e))})}ad(e){var t;if(this.po===e)return re&&Nt(re,"online",this.sn),this.ld(),this.ud=e.registerDynamicEventProperties(()=>this.hd()?this.zc:this.Uc),this.dd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.vd(),this.fd(),this.pd()}),this.fd(),this.initialize()}ld(){const e=this.Mr.refreshIntervalMs,t=!this.Mr.remoteRequestsDisabled&&me&&!de(e)&&e>0?e:void 0;t!==this.nd&&(this.gd(),de(t)||(this.nd=t,this.rd(),me!=null&&me.addEventListener&&Nt(me,pu,this.an)))}rd(){de(this.nd)||(de(this.md)||clearInterval(this.md),this.sd=Date.now(),this.md=setInterval(this.ed,this.nd))}gd(){var e;de(this.md)||(clearInterval(this.md),this.md=void 0,me==null||(e=me.removeEventListener)===null||e===void 0||e.call(me,"visibilitychange",this.an)),this.nd=void 0,this.sd=void 0}destroy(){this.yd()}dispose(){this.yd()}yd(){var e,t;this.gd(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.bd(),(e=this.ud)===null||e===void 0||e.dispose(),this.ud=void 0,(t=this.dd)===null||t===void 0||t.call(this),this.dd=void 0,this.Wc=[],re==null||re.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}_d(e){var t;return this.wd&&e in this.wd?this.wd[e]:(t=this.po)===null||t===void 0?void 0:t.kv.get(e)}vd(){return!!this.wd&&(this.wd=void 0,!0)}kd(){var e;return!de((e=this.po)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.vd()}At(e){this.Sd(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.set(e)})}xd(e,t,n){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const a=this._d("$enabled_feature_flags")||{},c=e.$enabled_feature_flags||{},u=t.flags||t.featureFlags,f=t.flags?Object.entries(t.flags).filter(([,S])=>!(S!=null&&S.failed)).map(([S])=>S):[],h=!!t.errorsWhileComputingFlags&&!!t.flags,m=h?f:n&&!Ue(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(c)])),v=this._d("$feature_flag_payloads")||{},x=e.$feature_flag_payloads||{},b=h||n?m:Array.from(new Set([...Object.keys(v),...Object.keys(x)])),y=!h&&!n,_=!!y||m,j=!!y||b,N={[ur]:_,[ai]:_,[ra]:j};e.$feature_flag_details&&(N[el]=_);for(const S of[tl,ca,Zc])de(e[S])||(N[S]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(N)}Lt(e){this.Sd(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.remove(e)})}Sd(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}fd(){const e={};for(const i of[ur,ra,tl,Ei]){const a=this._d(i);de(a)||(e[i]=a)}this.zc=e;const t=U({},e),n=this._d(ai);if(n)for(const[i,a]of Object.entries(n))t[`$feature/${i}`]=a;this.Uc=t}hd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this._d(ca);return typeof t!="number"||Date.now()-t>e}Cd(){return!!this.hd()&&(this.Yc||this.Gc||(this.Yc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}$d(){const e=this.Mr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}Td(){const e=this.Mr.flagKeys;if(!de(e))return e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),n})}initialize(){var e,t;const n=this.Mr,i=(e=(t=n.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,c;const u=(a=(c=n.bootstrap)===null||c===void 0?void 0:c.featureFlagPayloads)!==null&&a!==void 0?a:{},f=Object.keys(i).filter(m=>!de(i[m])).reduce((m,v)=>(m[v]=i[v],m),{}),h=Object.keys(u).filter(m=>f[m]).reduce((m,v)=>(m[v]=u[v],m),{});return this.Id({featureFlags:f,featureFlagPayloads:h},void 0,{persist:!1})}}updateFlags(e,t,n){var i,a;const c=n!=null&&n.merge&&(i=this._d("$enabled_feature_flags"))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this._d("$feature_flag_payloads"))!==null&&a!==void 0?a:{},f=U(U({},c),e),h=U(U({},u),t),m={};for(const[v,x]of Object.entries(f))m[v]={key:v,enabled:Y_(x),variant:X_(x),reason:void 0,metadata:de(h==null?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}};this.Id({flags:m})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._d(el),t=this._d(Ei),n=this._d(Wa);if(!n&&!t)return e||{};const i=Dt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(const f of a){var c;const h=i[f],m=t==null?void 0:t[f],v=de(m)?(c=h==null?void 0:h.enabled)!==null&&c!==void 0&&c:!!m,x=de(m)?h==null?void 0:h.variant:typeof m=="string"?m:void 0,b=n==null?void 0:n[f],y=U(U({},h),{},{enabled:v,variant:v?x??(h==null?void 0:h.variant):void 0});var u;v!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=U(U({},h==null?void 0:h.metadata),{},{payload:b,original_payload:h==null||(u=h.metadata)===null||u===void 0?void 0:u.payload})),i[f]=y}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Hc=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const i=e[n];return{key:n,enabled:Y_(i),variant:X_(i),payload:G_(t[n])}})}getFlagVariants(){const e=this._d(ai),t=this._d(Ei);if(!t)return e||{};const n=Dt({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Hc=!0),n}getFlagPayloads(){const e=this._d(ra),t=this._d(Wa);if(!t)return e||{};const n=Dt({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Hc=!0),n}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.td()||(this.Gc&&(this.Jc=!0),this.Md||(this.Wc.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Md=setTimeout(()=>{this.Ed()},5)))}bd(){clearTimeout(this.Md),this.Md=void 0}onReloading(e){return this.Wc.push(e),()=>{this.Wc=this.Wc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Md||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Qc=e}resetFlagCallReported(){this.Lt(oa)}Ed(e){this.bd();const t=this.po;if(!t||this.Mr.remoteRequestsDisabled||this.td())return;if(this.Gc)return void(this.Jc=!0);const n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:U(U(U({},t.initialPersonProperties),this._d("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._d(la),timezone:vk()};de(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(n.disable_flags=!0);const i=this.$d();i.length&&(n.evaluation_contexts=i);const a=this.Td();de(a)||(n.flag_keys=a);const c=this.Mr.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(c?"&only_evaluate_survey_feature_flags=true":""),f=this.Zc;this.Gc=!0;const h=()=>{this.Jc&&(this.Jc=!1,this.Ed())},m=x=>{var b,y;const _=(b=x.json)!==null&&b!==void 0?b:{},j=x.statusCode!==200;if(this.Gc=!1,f!==this.Zc)return void h();if(this.Pd(x.statusCode),j||this.Jc||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.Jc)return;this.Kc=!j;const N=[];x.error?N.push(x.error instanceof Error&&x.error.name==="AbortError"?"timeout":x.error instanceof Error?X5:"unknown_error"):x.statusCode!==200&&N.push(`api_error_${x.statusCode}`),_.errorsWhileComputingFlags&&N.push("errors_while_computing_flags");const S=!!(!((y=_.quotaLimited)===null||y===void 0)&&y.includes("feature_flags"));S&&N.push("quota_limited"),this.At({[hu]:N}),S?this.$.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.Id(_,j,{partialResponse:c}),h()},v=x=>{this.Gc=!1,f===this.Zc&&(this.At({[hu]:[X5]}),this.$.error("Feature flag request failed",x),this.kd()&&this.pd(!0)),h()};try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(m).catch(v)}catch(x){v(x)}}td(){return ck(this.Xc,3)}Pd(e){this.Xc=uk(e,this.Xc,3,()=>this.$.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.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+$g);if(this.Cd())return;const i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+$g);if(this.Cd())return;const n=this.getFlagVariants(),i=e in n,a=n[e],c=this.getFlagPayloads()[e],u=String(a),f=this._d("$feature_flag_request_id")||void 0,h=this._d("$feature_flag_evaluated_at")||void 0;let m,v=this._d("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var x;const X=(x=this.po)===null||x===void 0?void 0:x.session.sessionId,P=this._d(qc);X&&X!==P&&(v={},m=X)}if(t.send_event||!("send_event"in t))if(e in v&&v[e].includes(u))m&&this.At({[oa]:v,[qc]:m});else{var b,y,_,j,N,S,C,E,L,O,R,F;Ue(v[e])?v[e].push(u):v[e]=[u],this.At(U({[oa]:v},m?{[qc]:m}:{}));const X=this.getFeatureFlagDetails(e),P=[...(b=this._d("$feature_flag_errors"))!==null&&b!==void 0?b:[]];de(a)&&P.push("flag_missing");const Y={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:c??null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:(y=(_=this.Mr.bootstrap)===null||_===void 0||(_=_.featureFlags)===null||_===void 0?void 0:_[e])!==null&&y!==void 0?y:null,$feature_flag_bootstrapped_payload:(j=(N=this.Mr.bootstrap)===null||N===void 0||(N=N.featureFlagPayloads)===null||N===void 0?void 0:N[e])!==null&&j!==void 0?j:null,$used_bootstrap_value:!this.Kc};de(X==null||(S=X.metadata)===null||S===void 0?void 0:S.has_experiment)||(Y.$feature_flag_has_experiment=X.metadata.has_experiment),de(X==null||(C=X.metadata)===null||C===void 0?void 0:C.version)||(Y.$feature_flag_version=X.metadata.version);const A=(E=X==null||(L=X.reason)===null||L===void 0?void 0:L.description)!==null&&E!==void 0?E:X==null||(O=X.reason)===null||O===void 0?void 0:O.code;var D;A&&(Y.$feature_flag_reason=A),!(X==null||(R=X.metadata)===null||R===void 0)&&R.id&&(Y.$feature_flag_id=X.metadata.id),de(X==null?void 0:X.original_variant)&&de(X==null?void 0:X.original_enabled)||(Y.$feature_flag_original_response=de(X.original_variant)?X.original_enabled:X.original_variant),!(X==null||(F=X.metadata)===null||F===void 0)&&F.original_payload&&(Y.$feature_flag_original_payload=X==null||(D=X.metadata)===null||D===void 0?void 0:D.original_payload),P.length&&(Y.$feature_flag_error=P.join(",")),this.Rd(Y)}else m&&this.At({[oa]:v,[qc]:m});return i?{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:G_(c)}:void 0}Rd(e){try{var t;(t=this.po)===null||t===void 0||t.capture("$feature_flag_called",e).catch(n=>{this.$.error("Failed to capture feature flag call",n)})}catch(n){this.$.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Ad(e,t)}Ad(e,t){var n=this;return zt(function*(){const i=n.po;if(!i)return;const a={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},c=n.$d();c.length&&(a.evaluation_contexts=c);const u=n.Td();let f;de(u)||(a.flag_keys=u);try{var h;const m=(h=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.Mr.compression,sentAt:"body",timeoutMs:n.Mr.requestTimeoutMs})).json)===null||h===void 0?void 0:h.featureFlagPayloads;f=(m==null?void 0:m[e])||void 0}catch(m){return void n.$.error("Remote config feature flag request failed",m)}try{t(f)}catch(m){n.$.error("Remote config feature flag callback failed",m)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.Kc)return t.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+$g),t.defaultValue;const n=this.getFeatureFlag(e,t);return de(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.Id(e,t,n)}Id(e,t,n){if(!this.po)return;this.Vc=!0;const i=((a,c={},u={},f={},h,m=Y5)=>{const v=((E,L)=>{const O=E.flags;if(O){const R=Object.fromEntries(Object.keys(O).map(D=>{var X;return[D,(X=O[D].variant)!==null&&X!==void 0?X:O[D].enabled]})),F=Object.fromEntries(Object.keys(O).filter(D=>O[D].enabled).filter(D=>{var X;return!de((X=O[D].metadata)===null||X===void 0?void 0:X.payload)}).map(D=>{var X;return[D,(X=O[D].metadata)===null||X===void 0?void 0:X.payload]}));return U(U({},E),{},{featureFlags:R,featureFlagPayloads:F})}return E.featureFlags&&L.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),E})(a,m),x=v.flags,b=v.featureFlags,y=v.featureFlagPayloads;if(!b)return;const _=a.requestId,j=a.evaluatedAt;if(Ue(b)){m.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const E={};if(b)for(let L=0;b.length>L;L++)E[b[L]]=!0;return{[ur]:b,[ai]:E,[Zc]:!1}}let N=b,S=y,C=x;if(h!=null&&h.partialResponse){const E=Object.keys(N),L=S||{};N=U(U({},c),N),S=U(U({},u),L),E.forEach(O=>{O in L||S==null||delete S[O]}),C=U(U({},f),C)}else if(a.errorsWhileComputingFlags)if(x){const E=new Set(Object.keys(x).filter(O=>{var R;return!(!((R=x[O])===null||R===void 0)&&R.failed)}));N=U(U({},c),Object.fromEntries(Object.entries(N).filter(([O])=>E.has(O))));const L=Object.fromEntries(Object.entries(S||{}).filter(([O])=>E.has(O)));S=U(U({},u),L),E.forEach(O=>{O in L||S==null||delete S[O]}),C=U(U({},f),Object.fromEntries(Object.entries(C||{}).filter(([O])=>E.has(O))))}else N=U(U({},c),N),S=U(U({},u),S),C=U(U({},f),C);return U(U({[ur]:Object.keys(K5(N)),[ai]:N||{},[ra]:S||{},[el]:C||{},[Zc]:a.minimalFlagCalledEvents===!0},_?{[tl]:_}:{}),j?{[ca]:j}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(i)if((n==null?void 0:n.persist)===!1){const a=!de(this.po.kv.get(ai));this.wd=i,a||this.At(i)}else this.vd(),this.xd(i,e,!!(n!=null&&n.partialResponse)),this.At(i);else t&&this.kd();t||(this.Yc=!1),this.pd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Fd(e)}Fd(e){if(this.po){if(e===!1)return this.Lt([Ei,Wa]),this.pd(),void Ga.info("All overrides cleared");if(Ue(e))return this.At({[Ei]:Q5(e)}),this.pd(),void Ga.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const n=e;this.Hc=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const i={},a=n.flags,c=n.payloads;return a&&(i[Ei]=Ue(a)?Q5(a):a),c&&(i[Wa]=c),Object.keys(i).length&&this.At(i),a===!1&&c===!1?this.Lt([Ei,Wa]):a===!1?this.Lt(Ei):c===!1&&this.Lt(Wa),this.pd(),a===!1?Ga.info("Flag overrides cleared"):a&&Ga.info("Flag overrides set",{flags:a}),void(c===!1?Ga.info("Payload overrides cleared"):c&&Ga.info("Payload overrides set",{payloads:c}))}if(e&&typeof e=="object")return this.At({[Ei]:e}),this.pd(),void Ga.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Vc){const{flags:t,flagVariants:n}=this.Od();try{e(t,n)}catch(i){this.$.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i;const a=(this._d("$early_access_features")||[]).find(m=>m.flagKey===e),c={[`$feature_enrollment/${e}`]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);const f=U(U({},this.getFlagVariants()),{},{[e]:t});(i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(c)}),this.At({[ur]:Object.keys(K5(f)),[ai]:f,[aa]:U(U({},this._d("$stored_person_properties")||{}),c)}),this.pd();try{var h;(h=this.po)===null||h===void 0||h.capture("$feature_enrollment_update",u).catch(m=>{this.$.error("Failed to capture early access feature enrollment",m)})}catch(m){this.$.error("Failed to capture early access feature enrollment",m)}}getEarlyAccessFeatures(e,t=!1,n){const i=this._d(M0);!i||t?this.Dd(e,n):e(i)}Dd(e,t){var n=this;return zt(function*(){const i=n.po;if(!i)return;const a=t?`&${t.map(u=>`stage=${u}`).join("&")}`:"";let c;try{const u=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${a}`,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;c=u.json.earlyAccessFeatures,n.At({[M0]:c})}catch(u){return void n.$.error("Early access feature request failed",u)}try{e(c)}catch(u){n.$.error("Early access feature callback failed",u)}})()}Od(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,i)=>(n[i]=t[i],n),{})}}pd(e){this.fd();const{flags:t,flagVariants:n}=this.Od();this.featureFlagEventHandlers.forEach(i=>{try{i(t,n,{errorsLoading:e})}catch(a){this.$.error("Error while running feature flags callback",a)}})}setPersonPropertiesForFlags(e,t=!0){this.Ld(e,t)}Ld(e,t=!0){const n=this._d("$stored_person_properties")||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,c={};if(a)for(const u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(c[u]=a[u]));this.At({[aa]:U(U(U({},n),c),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=U({},this._d("$stored_person_properties")||{});e.forEach(i=>{delete n[i]}),this.At({[aa]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(aa),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this._d("$stored_group_properties")||{},i=U({},n);for(const a of Object.keys(e))i[a]=U(U({},n[a]),e[a]);this.At({[la]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._d("$stored_group_properties")||{};this.At({[la]:U(U({},t),{},{[e]:{}})})}else this.Lt(la)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.wd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.bd(),this.Hc=!1,this.Xc=0}}},iA={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Nd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.qd==="awaiting_config"||this.qd==="missing_config"?this.qd:(e=(t=this.Nd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.qd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.qd=Lg,this.jd=void 0,this.Bd=!1,this.Ke=(()=>{var t,n;if(!(me!=null&&me.visibilityState)||me.visibilityState==="visible")return!0;const i=re==null||(t=re.performance)===null||t===void 0||(n=t.getEntriesByType)===null||n===void 0?void 0:n.call(t,"visibility-state");return!(i!=null&&i.length)||i.some(a=>a.name==="visible")})(),this.an=()=>{var t,n;(me==null?void 0:me.visibilityState)==="visible"&&(this.Ke=!0,(t=this.Nd)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw rr.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');me!=null&&me.addEventListener&&Nt(me,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Bd=!0,me==null||(t=me.removeEventListener)===null||t===void 0||t.call(me,"visibilitychange",this.an),e?this.Hd(!0):this.stopRecording()}get zd(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),n=!this.Mr.disable_session_recording,i=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(this.Bd||this.zd&&(!((t=this.Nd)===null||t===void 0)&&t.isStarted))return;const n=!de(Object.assign)&&!de(Array.from);this.zd&&n?(this.Ud(e),rr.info("starting")):(this.qd=Lg,this.stopRecording())}Ud(e){var t,n;if(this.zd)if(this.qd!=="awaiting_config"&&this.qd!=="missing_config"&&(this.qd=F5),($e==null||(t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((n=$e.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.Wd(e);else{var i,a;const c=this._instance.sessionManager;(i=$e.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this._instance,this.Vd,u=>{if(!this.Bd&&this.zd&&this._instance.sessionManager===c)return u?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),rr.error("could not load recorder",u)):void this.Wd(e);this.qd="disabled"})}}stopRecording(){var e,t;(e=this.jd)===null||e===void 0||e.call(this),this.jd=void 0,(t=this.Nd)===null||t===void 0||t.stop()}Hd(e=!1){var t,n;(t=this.jd)===null||t===void 0||t.call(this),this.jd=void 0,(n=this.Nd)===null||n===void 0||n.discard({discardProducerEvents:e})}Gd(){var e,t;(e=this.xa)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.xa)===null||t===void 0||t.unregister("$replay_sample_rate")}Zd(e,t){if(Ve(e))return null;const n=Zt(e)?e:parseFloat(e);return typeof(i=n)!="number"||!Number.isFinite(i)||0>i||i>1?(rr.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var i}Qd(e){if(this.xa){var t,n;const i=this.xa,a=()=>{var c;const u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Zd((c=this.Mr.session_recording)===null||c===void 0?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Zd(u==null?void 0:u.sampleRate,"remote config sampleRate"),m=f??h;Ve(m)&&this.Gd();const v=u==null?void 0:u.minimumDurationMilliseconds;i.register({[Wc]:U(U({cache_timestamp:Date.now(),enabled:!!u},u),{},{networkPayloadCapture:U({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:m,minimumDurationMilliseconds:de(v)?null:v,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.jd)===null||t===void 0||t.call(this),this.jd=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(a)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Qd(t),void this.Hd()):(this.Qd(t),void this.startIfEnabledOrStop()):(this.qd==="awaiting_config"&&(this.qd="missing_config",rr.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.Nd)===null||n===void 0)&&n.log?this.Nd.log(e,t):rr.warn("log called before recorder was ready")}get Vd(){var e,t;const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Wc);return(n==null||(t=n.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}Jd(){const e=this._instance.get_property(Wc);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return rr.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ve(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wd(e){var t,n,i;if(!this.Bd&&this.zd&&this._instance.sessionManager){if(!(!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return rr.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[XS]:!0});var a;if(this.Nd||(this.Nd=(a=$e.__PosthogExtensions__)===null||a===void 0?void 0:a.initSessionRecording(this._instance,this.Ke),this.Nd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Jd())return this.qd==="missing_config"||this.qd==="awaiting_config"?void 0:(this.qd="awaiting_config",rr.info("persisted remote config is stale, requesting fresh config before starting"),void new bk(this._instance).load());this.qd=F5,(n=(i=this.Nd).setDocumentWasEverVisible)===null||n===void 0||n.call(i,this.Ke),this.Nd.start(e)}else this.qd=Lg}onRRwebEmit(e){var t,n;(t=this.Nd)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.Nd||(t=this.xa)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Nd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Nd||(t=this.xa)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Nd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.Nd||(n=this.xa)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Nd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Nd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!!(!((n=this.Nd)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Nd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},rA={autocapture:class extends $M{constructor(e){super(new BM(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.Kd=this.Yd()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.Xd();return!!(e.path||e.search||this.tv(e))}startIfEnabled(){this.isEnabled&&(_e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Kd=this.Yd(),this.startIfEnabled()}stop(){this.ev&&this.ev(),this.ev=void 0,this.iv&&this.iv(),this.iv=void 0,_e.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.nv("pushState"),this.nv("replaceState"),this.sv(),this.tv()&&this.rv())}nv(e){var t;if(!re||!((t=re.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;Fk(re.history,e,i=>function(a,c,u){i.call(this,a,c,u),n.ov(e)})}Yd(){const e=re==null?void 0:re.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Xd(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:nt(e)?e:{}}tv(e=this.Xd()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}lv(e){const t=this.Xd(),n=this.Kd;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.tv(t)&&e.hash!==n.hash))}ov(e){try{const t=this.Yd();if(!t)return;this.lv(t)&&this._instance.capture(Sx,{navigation_type:e}),this.Kd=t}catch(t){_e.error(`Error capturing ${e} pageview`,t)}}sv(){if(this.ev)return;const e=()=>{this.ov("popstate")};Nt(re,"popstate",e),this.ev=()=>{re&&re.removeEventListener("popstate",e)}}rv(){if(this.iv)return;const e=()=>{this.ov("hashchange")};Nt(re,"hashchange",e),this.iv=()=>{re&&re.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.av=!1,this.bo=!1,this.uv=null,this.instance=e,this.av=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[N0]),this.rageclicks=new Uk(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return nt(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ve(this.Mr.capture_heatmaps)?Ve(this.Mr.enable_heatmaps)?this.av:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.bo)return;IM.info("starting..."),this.hv(),this.an()}else{var e;clearInterval((e=this.uv)!==null&&e!==void 0?e:void 0),this.dv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[N0]:n}),this.av=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}vv(e){Dg(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}an(){this.uv&&clearInterval(this.uv),this.uv=(me==null?void 0:me.visibilityState)==="visible"?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}hv(){re&&me&&(this.fv=this.fa.bind(this),Nt(re,Wf,this.fv),this.pv=e=>this.Cr(e||(re==null?void 0:re.event)),Nt(me,"click",this.pv,{capture:!0}),this.gv=e=>this.mv(e||(re==null?void 0:re.event)),Nt(me,"mousemove",this.gv,{capture:!0}),this.yv=new v5(this.instance,V6,this.vv.bind(this)),this.yv.startIfEnabledOrStop(),this.bv=this.an.bind(this),Nt(me,pu,this.bv),this.bo=!0)}dv(){var e;re&&me&&(this.fv&&re.removeEventListener(Wf,this.fv),this.pv&&me.removeEventListener("click",this.pv,{capture:!0}),this.gv&&me.removeEventListener("mousemove",this.gv,{capture:!0}),this.bv&&me.removeEventListener(pu,this.bv),clearTimeout(this._v),(e=this.yv)===null||e===void 0||e.stop(),this.bo=!1)}wv(e,t){const n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){let m=u;for(;m&&Oi(m)&&!Un(m,"body");){if(m===h)return!1;let y;try{var v,x,b;y=(v=(x=(b=m.ownerDocument)===null||b===void 0?void 0:b.defaultView)!==null&&x!==void 0?x:re)===null||v===void 0?void 0:v.getComputedStyle(m).position}catch{return!1}if(Ie(f,y))return!0;m=nk(m)}return!1})(Jc(e),["fixed","sticky"],a);return{x:e.clientX+(c?0:i),y:e.clientY+(c?0:n),target_fixed:c,type:t}}Cr(e,t="click"){var n;if(o5(e.target)||!Dg(e))return;const i=this.wv(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ik(Jc(e),this.instance.config.rageclick)&&this.Zs(U(U({},i),{},{type:"rageclick"})),this.Zs(i)}mv(e){!o5(e.target)&&Dg(e)&&(clearTimeout(this._v),this._v=setTimeout(()=>{this.Zs(this.wv(e,"mousemove"))},500))}Zs(e){if(!re)return;const t=this.Mr.disable_capture_url_hashes?da(re.location.href):re.location.href,n=this.Mr.custom_personal_data_properties,i=this.Mr.mask_personal_data_properties?[...bo,...n||[]]:[],a=xu(t,i,vu);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}fa(){this.Rt&&!gs(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:v5,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.av=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Sv=()=>{clearTimeout(this.xv),this.xv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",U({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,i)=>U(U({},n),{},{[`$web_vitals_${i.name}_event`]:U({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Cv=n=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ve(n==null?void 0:n.name)||Ve(n==null?void 0:n.value))return void Va.error("Invalid metric received",n);const a=typeof n.navigationURL=="string"?n.navigationURL:void 0,c=this.$v(a);if(de(c))return;const u=Zt(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${c}`;if(this.Tv&&n.value>=this.Tv)return void Va.error("Ignoring metric with value >= "+this.Tv,n);this.Rt.navigationKey!==u&&(this.Sv(),this.xv=setTimeout(this.Sv,this.flushToCaptureTimeoutMs)),de(this.Rt.navigationKey)&&(this.Rt.navigationKey=u,this.Rt.url=c),this.Rt.firstMetricTimestamp=de(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const f=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),h=U(U(U({},n),a?{navigationURL:c}:{}),{},{$current_url:c,timestamp:Date.now()});if(delete h.entries,nt(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const m={};for(const v of FM){const x=v==="url"&&typeof n.attribution[v]=="string"?this.$v(n.attribution[v]):n.attribution[v];de(x)||(m[v]=x)}h.attribution=m}else delete h.attribution;de(f)||(h.$session_id=f.sessionId,h.$window_id=f.windowId),this.Rt.metrics.push(h),this.Rt.metrics.length===this.allowedMetrics.length&&this.Sv()},this.Iv=()=>{if(this.bo)return;let n,i,a,c,u=!1;const f=$e.__PosthogExtensions__,h=f==null?void 0:f.postHogWebVitalsCallbacksByFlavor,m=(h==null?void 0:h[this.Mv])||(this.Mv==="web-vitals"&&de(h)?f==null?void 0:f.postHogWebVitalsCallbacks:void 0);if(!de(m)){const b=m.withoutAttribution,y=this.attributionMetrics;u=!de(b),n=y.indexOf("LCP")>-1?m.onLCP:(b==null?void 0:b.onLCP)||m.onLCP,i=y.indexOf("CLS")>-1?m.onCLS:(b==null?void 0:b.onCLS)||m.onCLS,a=y.indexOf("FCP")>-1?m.onFCP:(b==null?void 0:b.onFCP)||m.onFCP,c=y.indexOf("INP")>-1?m.onINP:(b==null?void 0:b.onINP)||m.onINP}if(!(n&&i&&a&&c))return void Va.error("web vitals callbacks not loaded - not starting");const v={reportSoftNavs:this.useSoftNavs},x=u&&this.attributionMetrics.indexOf("INP")>-1?U(U({},v),{},{includeProcessedEventEntries:!1}):v;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Cv.bind(this),v),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Cv.bind(this),v),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Cv.bind(this),v),this.allowedMetrics.indexOf("INP")>-1&&c(this.Cv.bind(this),x),this.bo=!0},this.av=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[T0]),this.startIfEnabled()}get Ev(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=nt(this.Ev)?(e=this.Ev)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return Ve(n)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||U5:n}get flushToCaptureTimeoutMs(){return(nt(this.Ev)?this.Ev.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=nt(this.Ev)?this.Ev.web_vitals_attribution:void 0;return ss(e)?e?U5:[]:Ue(e)?e:UM}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=nt(this.Ev)?this.Ev.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Tv(){const e=nt(this.Ev)&&Zt(this.Ev.__web_vitals_max_value)?this.Ev.__web_vitals_max_value:P5;return e>0&&6e4>=e?P5:e}get isEnabled(){const e=Yt==null?void 0:Yt.protocol;if(e!=="http:"&&e!=="https:")return Va.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=nt(this.Ev)?this.Ev.web_vitals:ss(this.Ev)?this.Ev:void 0;return ss(t)?t:this.av}startIfEnabled(){this.isEnabled&&!this.bo&&(Va.info("enabled, starting..."),this.No(this.Iv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const n=nt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=nt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[T0]:n}),this._instance.persistence.register({[$S]:i})),this.av=n,this.startIfEnabled()}get Mv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(e){var t;const n=$e.__PosthogExtensions__,i=this.Mv,a=n==null?void 0:n.postHogWebVitalsCallbacksByFlavor;a!=null&&a[i]||i==="web-vitals"&&de(a)&&(n!=null&&n.postHogWebVitalsCallbacks)?e():n==null||(t=n.loadExternalDependency)===null||t===void 0||t.call(n,this._instance,i,c=>{c?Va.error("failed to load script",c):e()})}$v(e){const t=e||(re==null?void 0:re.location.href);if(!t)return void Va.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?da(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...bo,...i||[]]:[];return xu(n,a,vu)}}},aA={exceptionObserver:class{constructor(e){var t;this.Iv=()=>{var n;if(!re||!this.isEnabled||!(!((n=$e.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const i=$e.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$e.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=$e.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Pv&&this.Mr.capture_unhandled_errors&&(this.Pv=i(this.captureException.bind(this))),!this.Rv&&this.Mr.capture_unhandled_rejections&&(this.Rv=a(this.captureException.bind(this))),!this.Av&&this.Mr.capture_console_errors&&(this.Av=c(this.captureException.bind(this)))}catch(u){Bc.error("failed to start",u),this.Fv()}},this._instance=e,this.Ov=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[C0]),this.wt=new iT(U(U({},(function(n={}){var i,a,c,u;return{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(c=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&c!==void 0?c:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Bc})),this.Mr=this.Dv(),this.startIfEnabledOrStop()}Dv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return nt(e)?t=U(U({},t),e):(de(e)?this.Ov:e)&&(t=U(U({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Bc.info("enabled"),this.Fv(),this.No(this.Iv)):this.Fv()}No(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"exception-autocapture",a=>{if(a)return Bc.error("failed to load script",a);e()})}Fv(){var e,t,n;(e=this.Pv)===null||e===void 0||e.call(this),this.Pv=void 0,(t=this.Rv)===null||t===void 0||t.call(this),this.Rv=void 0,(n=this.Av)===null||n===void 0||n.call(this),this.Av=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.Ov=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[C0]:this.Ov}),this.Mr=this.Dv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.Dv()}captureException(e){try{var t,n,i;const a=(t=e==null||(n=e.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(a))return void Bc.info("Skipping exception capture because of client rate limiting.",{exception:a});(i=this._instance.exceptions)===null||i===void 0||i.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,n;this.Lv=[],this.Nv=new gT([new AT,new UT,new OT,new RT,new BT,new $T,new DT,new PT],(function(i,...a){return(c,u=0)=>{const f=[],h=c.split(`
|
|
68
|
-
`),m=Math.min(h.length,u+1e3),v=[];for(let y=u;m>y;y++){const _=h[y];if(_.length>1024)continue;const j=V_.test(_)?_.replace(V_,"$1"):_;if(!j.match(/\S*Error: /)){for(const N of a){const S=N(j,i);if(S){f.push(S);const C=CT(f);if(C){for(let E=v.length-1;E>=0;E--){const L=v[E];if(C.start>=L.start+L.length)break;v.pop()}v.push(C)}break}}if(TT(f,v)>=50)break}}const x=[...v].sort((y,_)=>_.start-y.start),b=x[x.length-1];if(b){const y=vS(f,b);f.splice(b.start-y,y);for(const _ of x)_.start-=y}for(const y of x)ET(f,y);return v.some(y=>y.start===0&&f.length===y.length)&&(function(y){const _=y.map(N=>`${N.function}|${N.filename}|${N.lineno}|${N.colno}|${N.module}`);let j=0;for(let N=1;_.length>N;N++)MT(_,N,j)&&(j=N);y.push(...y.splice(0,j))})(f),(function(y){if(!y.length)return[];const _=Array.from(y);return _.reverse(),_.slice(0,50).map(j=>{return U(U({},j),{},{filename:j.filename||(N=_,N[N.length-1]||{}).filename,function:j.function||"?"});var N})})(f)}})("web:javascript",ST,NT)),this._instance=e,this.Lv=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.qv=Gf(this.jv()),this.Bv=new IT(this.qv)}onConfigChange(){this.qv=Gf(this.jv()),this.Bv.setConfig(this.qv)}onRemoteConfig(e){var t,n,i;if(!e.ok)return;const a=e.config;if(!("errorTracking"in a))return;const c=(t=(n=a.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)===null||i===void 0?void 0:i.captureExtensionExceptions;this.Lv=c,this._instance.persistence&&this._instance.persistence.register({[DS]:this.Lv,[E0]:u})}get Hv(){var e;const t=!!this._instance.get_property(E0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Nv.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.qv.enabled)try{if(!it(e)||e.trim().length===0)return void si.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:i}=(function(a){if(!a)return{sanitizedProperties:{},droppedKeys:[]};const c=[];return{sanitizedProperties:Object.keys(a).reduce((u,f)=>FT.has(f)?(c.push(f),u):(u[f]=a[f],u),{}),droppedKeys:c}})(this.zv(t));i.length>0&&si.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Bv.add(U({[qf]:e,[Vf]:new Date().toISOString()},n))}catch(n){si.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.Uv(t)){if(this.Wv(t))return this.Vv("Exception dropped: matched a suppression rule"),void si.info("Skipping exception capture because a suppression rule matched");if(!this.Hv&&this.Gv(t))return this.Vv("Exception dropped: thrown by a browser extension"),void si.info("Skipping exception capture because it was thrown by an extension");if(!this.Hv&&this.Zv(t))return this.Vv("Exception dropped: thrown by an injected browser script"),void si.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Qv(t))return this.Vv("Exception dropped: thrown by the PostHog SDK"),void si.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.qv.enabled&&Ve(e.$exception_steps)?this.Jv(e):e,i=(function(){const a=globalThis._posthogReleaseId;return typeof a=="string"&&a.length>0?a:void 0})();i&&(n.$release_id=i);try{const a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return a&&this.Bv.clear(),a}catch(a){return W5(a)||si.error("Failed to capture exception event. Dropping this exception.",a),void this.Bv.clear()}}catch(t){return void(W5(t)||si.error("Failed to process exception event. Ignoring this exception.",t))}}Jv(e){try{const t=this.Bv.getAttachable();return t.length===0?e:U(U({},e),{},{$exception_steps:t})}catch(t){return si.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Vv(e){this.qv.enabled&&this.Bv.add({[qf]:e,[Vf]:new Date().toISOString()})}zv(e){return nt(e)?U({},e):{}}jv(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Wv(e){if(e.length===0)return!1;try{const t=e.reduce((n,{type:i,value:a})=>(it(i)&&i.length>0&&n.$exception_types.push(i),it(a)&&a.length>0&&n.$exception_values.push(a),n),{$exception_types:[],$exception_values:[]});return this.Lv.some(n=>{const i=n.values.map(a=>{const c=Dk[a.operator],u=t[a.key];if(!c||!u)return!1;const f=Ue(a.value)?a.value:[a.value];return f.length>0&&c(f,u)});return n.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return si.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Gv(e){const t=e.flatMap(i=>{var a,c;return(a=(c=i.stacktrace)===null||c===void 0?void 0:c.frames)!==null&&a!==void 0?a:[]}),n=t.filter(({filename:i})=>!!i&&JM.some(a=>i.startsWith(a)));return n.length!==0&&(!n.every(({filename:i})=>!!i&&i.startsWith(Y0))||e.some(({type:i,value:a})=>i==="NoResponse"||it(a)&&ZM.some(({value:c,exact:u})=>u?a===c:a.includes(c)))&&!t.some(({in_app:i,filename:a})=>i&&!(a!=null&&a.startsWith(Y0))))}Zv(e){return e.some(({value:t})=>it(t)&&eA.some(n=>t.includes(n)))}Qv(e){if(e.length>0){var t,n,i,a;const c=(t=(n=e[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(i=u==null||(a=u.filename)===null||a===void 0?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Uv(e){return!Ve(e)&&Ue(e)}}},lA=U({productTours:class{get xa(){return this._instance.persistence}constructor(e){this.Kv=null,this.Yv=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var n,i;if(this.xa&&this.xa.register({[yx]:!!t.productTours}),!zg(this._instance))return!this.Kv&&Ve((n=this.xa)===null||n===void 0?void 0:n.props.ph_product_tours)||gf.info("product tours disabled; stopping and clearing cached tours"),(i=this.Kv)===null||i===void 0||i.stop(),this.Kv=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Kv&&zg(this._instance)&&this.No(()=>this.Xv())}No(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"product-tours",a=>{a?gf.error("Could not load product tours script",a):e()})}Xv(){var e;!this.Kv&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.Kv=$e.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Ue(this.Yv)&&!t)return void e(this.Yv,{isLoaded:!0});const n=this.xa;if(n){const i=n.props[R0];if(Ue(i)&&!t)return this.Yv=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!zg(this._instance))return void e([],{isLoaded:!0});const a=i.statusCode;if(a!==200||!i.json){const u=`Product Tours API could not be loaded, status: ${a}`;return a===0?i.error||gf.warn(u):gf.error(u),void e([],{isLoaded:!1,error:u})}const c=Ue(i.json.product_tours)?i.json.product_tours:[];this.Yv=c,n&&n.register({[R0]:c}),e(c,{isLoaded:!0})}})}getActiveProductTours(e){Ve(this.Kv)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Kv.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Kv)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Kv?this.Kv.previewTour(e):this.No(()=>{var t;this.Xv(),(t=this.Kv)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Kv)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Kv)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Kv)===null||e===void 0||e.previousStep()}clearCache(){var e;this.Yv=null,(e=this.xa)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Kv)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Kv)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Kv)===null||t===void 0||t.cancelPendingTour(e)}}},xh),oA={siteApps:class{constructor(e){this._instance=e,this.tf=0,this.ef=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}if(e,t){if(!t)return;const n=this.globalsForEvent(t);this.ef.push(n),this.ef.length>1e3&&(this.ef=this.ef.slice(10))}get siteAppLoaders(){var e;return(e=$e._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.if.bind(this));this.nf=()=>{e(),this.ef=[],this.nf=void 0}}}globalsForEvent(e){var t,n,i,a,c,u,f;if(!e)throw new Error("Event payload is required");const h={},m=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(const[y,_]of Object.entries(v))h[y]={id:m[y],type:y,properties:_};const{$set_once:x,$set:b}=e;return{event:U(U({},SS(e,HM)),{},{properties:U(U(U({},e.properties),b?{$set:U(U({},(t=(n=e.properties)===null||n===void 0?void 0:n.$set)!==null&&t!==void 0?t:{}),b)}:{}),x?{$set_once:U(U({},(i=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&i!==void 0?i:{}),x)}:{}),elements_chain:(c=(u=e.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)===null||f===void 0?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}sf(e){var t;const n=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ni.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)||(Ni.error("prepare_external_dependency_script returned null"),null):e}rf(){var e,t,n,i,a,c,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const h=me==null?void 0:me.defaultView,m=h==null||(e=h.Node)===null||e===void 0?void 0:e.prototype;if(!h||!m)return()=>{};if(this.tf++,this.lf)return this.af();const v=[],x=this,b=new WeakSet,y=(N,S,C)=>{if(!(N!=null&&N[S]))return;const E=N[S];N[S]=C(E),v.push(()=>{N[S]=E})},_=N=>{if(b.has(N))return N;const S=x.sf(N);return S&&b.add(S),S},j=N=>N.map(S=>typeof S=="string"?S:_(S)).filter(S=>!Wt(S));return y(m,"appendChild",N=>function(S){const C=_(S);return C?N.call(this,C):S}),y(m,"insertBefore",N=>function(S,C){const E=_(S);return E?N.call(this,E,C):S}),y(m,"replaceChild",N=>function(S,C){const E=_(S);return E?N.call(this,E,C):C}),[(t=h.Element)===null||t===void 0?void 0:t.prototype,(n=h.Document)===null||n===void 0?void 0:n.prototype,(i=h.DocumentFragment)===null||i===void 0?void 0:i.prototype].forEach(N=>{y(N,"append",S=>function(...C){return S.apply(this,j(C))}),y(N,"prepend",S=>function(...C){return S.apply(this,j(C))})}),[(a=h.Element)===null||a===void 0?void 0:a.prototype,(c=h.CharacterData)===null||c===void 0?void 0:c.prototype,(u=h.DocumentType)===null||u===void 0?void 0:u.prototype].forEach(N=>{y(N,"before",S=>function(...C){return S.apply(this,j(C))}),y(N,"after",S=>function(...C){return S.apply(this,j(C))}),y(N,"replaceWith",S=>function(...C){const E=j(C);return C.length&&!E.length?void 0:S.apply(this,E)})}),y((f=h.Element)===null||f===void 0?void 0:f.prototype,"insertAdjacentElement",N=>function(S,C){const E=_(C);return E?N.call(this,S,E):null}),this.lf=()=>{v.forEach(N=>N()),this.lf=void 0},this.af()}af(){let e=!1;return()=>{var t;e||(e=!0,this.tf--,this.tf===0&&((t=this.lf)===null||t===void 0||t.call(this)))}}uf(e,t=!0){const n=this.rf();try{const i=e(n);return t&&n(),i}catch(i){throw n(),i}}setupSiteApp(e){const t=this.apps[e.id],n=()=>{var c;!t.errored&&this.ef.length&&(Ni.info(`Processing ${this.ef.length} events for site app with id ${e.id}`),this.ef.forEach(u=>this.uf(()=>{var f;return(f=t.processEvent)===null||f===void 0?void 0:f.call(t,u)})),t.processedBuffer=!0),Object.values(this.apps).every(u=>u.processedBuffer||u.errored)&&((c=this.nf)===null||c===void 0||c.call(this))};let i=!1;const a=c=>{t.errored=!c,t.loaded=!0,Ni.info(`Site app with id ${e.id} ${c?"loaded":"errored"}`),i&&n()};try{const{processEvent:c}=this.uf(u=>e.init({posthog:this._instance,callback(f){u(),a(f)}}),!1);c&&(t.processEvent=c),i=!0}catch(c){Ni.error(I5+e.id,c),a(!1)}if(i&&t.loaded)try{n()}catch(c){Ni.error(`Error while processing buffered events PostHog app with config id ${e.id}`,c),t.errored=!0}}hf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}cf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.uf(()=>{var i;return(i=n.processEvent)===null||i===void 0?void 0:i.call(n,t)})}catch(i){Ni.error(`Error while processing event ${e.event} for site app ${n.id}`,i)}}onRemoteConfig(e){var t,n,i;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.hf(),void this._instance.on("eventCaptured",f=>this.cf(f))):void Ni.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.nf)===null||n===void 0||n.call(this),!e.ok)return;const a=e.config;if(!((i=a.siteApps)===null||i===void 0)&&i.length)if(this.isEnabled)for(const{id:f,url:h}of a.siteApps){var c,u;$e[`__$$ph_site_app_${f}`]=this._instance,(c=$e.__PosthogExtensions__)===null||c===void 0||(u=c.loadSiteApp)===null||u===void 0||u.call(c,this._instance,h,m=>{if(m)return Ni.error(I5+f,m)})}else Ni.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},cA={tracingHeaders:class{constructor(e){this._instance=e,this.df=void 0,this.vf=void 0,this.ff=void 0,this.Iv=()=>{const t=this.pf();var n,i;t?(de(this.df)&&(this.df=(n=$e.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),de(this.vf)&&(this.vf=(i=$e.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Fv()}}initialize(){this.startIfEnabledOrStop()}No(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"tracing-headers",a=>{if(a)return PM.error("failed to load script",a);e()})}gf(){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}pf(){const e=this.gf();return Ue(e)?(Ue(this.ff)?this.ff.splice(0,this.ff.length,...e):this.ff=[...e],e.length>0?this.ff:void 0):(Ue(this.ff)&&this.ff.splice(0),this.ff=e||void 0,this.ff)}Fv(){var e,t;(e=this.df)===null||e===void 0||e.call(this),(t=this.vf)===null||t===void 0||t.call(this),this.df=void 0,this.vf=void 0}startIfEnabledOrStop(){this.pf()?this.No(this.Iv):this.Fv()}}},uA=U({surveys:class extends qM{constructor(e){var t;super(new QM(e),(t=e,{get projectToken(){return t.config.token},kv:new XM(t)})),this._instance=e}Mh(e,t){const n=t.query?Nu(e,t.query):e;return new Promise(i=>{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:i})})}}},xh),dA={toolbar:class{constructor(e){this.instance=e}mf(e){$e.ph_toolbar_state=e}yf(){var e;return(e=$e.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,n=void 0){var i,a;if(D0(this.instance.config)||!re||!me)return!1;e=(i=e)!==null&&i!==void 0?i:re.location,n=(a=n)!==null&&a!==void 0?a:re.history;try{if(!t){try{re.localStorage.setItem("test","test"),re.localStorage.removeItem("test")}catch{return!1}t=re==null?void 0:re.localStorage}const c=KM||Jf(e.hash,"__posthog")||Jf(e.hash,"state");let u;const f=c?i5(()=>JSON.parse(atob(decodeURIComponent(c))))||i5(()=>JSON.parse(decodeURIComponent(c))):null;return f&&f.action==="ph_authorize"?(u=f,u.source="url",u&&Object.keys(u).length>0&&(f.desiredHash?e.hash=f.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):(u=JSON.parse(t.getItem(q5)||"{}"),u.source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token||(this.loadToolbar(u),0))}catch{return!1}}bf(e){const t=$e.ph_load_toolbar||$e.ph_load_editor;!Ve(t)&&Pn(t)?t(e,this.instance):V5.warn("No toolbar load function found")}loadToolbar(e){const t=!!(me!=null&&me.getElementById("__POSTHOG_TOOLBAR__"));if(!re||t)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=U(U({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(q5,JSON.stringify(U(U({},i),{},{source:void 0}))),this.yf()===2)this.bf(i);else if(this.yf()===0){var a,c;this.mf(1),(a=$e.__PosthogExtensions__)===null||a===void 0||(c=a.loadExternalDependency)===null||c===void 0||c.call(a,this.instance,"toolbar",u=>{if(u)return V5.error("[Toolbar] Failed to load",u),void this.mf(0);this.mf(2),this.bf(i)}),Nt(re,"turbolinks:load",()=>{this.mf(0),this.loadToolbar(i)})}return!0}_f(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},fA=U({experiments:class es{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(i=>{es.wf("retrieved web experiments from the server"),this.kf=new Map,i.forEach(a=>{if(a.feature_flag_key){var c;this.kf&&(es.wf("setting flag key ",a.feature_flag_key," to web experiment ",a),(c=this.kf)===null||c===void 0||c.set(a.feature_flag_key,a));const u=this._instance.getFeatureFlag(a.feature_flag_key);it(u)&&a.variants[u]&&this.Sf(a.name,u,a.variants[u].transforms)}else if(a.variants)for(const u in a.variants){const f=a.variants[u];es.xf(f,this._instance)&&this.Sf(a.name,u,f.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())es.wf(Z5);else if(!this.Mr.disable_web_experiments){if(Ve(this.kf))return this.kf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();es.wf("applying feature flags",t),t.forEach(n=>{var i;if(this.kf&&(!((i=this.kf)===null||i===void 0)&&i.has(n))){var a;const c=this._instance.getFeatureFlag(n),u=(a=this.kf)===null||a===void 0?void 0:a.get(n);c&&(u!=null&&u.variants[c])&&this.Sf(u.name,c,u.variants[c].transforms)}})}}previewWebExperiment(){const t=es.getWindowLocation();if(t!=null&&t.search){const n=vo(t==null?void 0:t.search,"__experiment_id"),i=vo(t==null?void 0:t.search,"__experiment_variant");n&&i&&(es.wf(`previewing web experiments ${n} && ${i}`),this.getWebExperiments(a=>{this.Cf(parseInt(n),i,a)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const 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.Mr.token}`),method:"GET",timestampMode:"query",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}Cf(t,n,i){const a=i.filter(c=>c.id===t);a&&a.length>0&&(es.wf(`Previewing web experiment [${a[0].name}] with variant [${n}]`),this.Sf(a[0].name,n,a[0].variants[n].transforms))}static xf(t,n){return!Ve(t.conditions)&&es.$f(t,n)&&es.Tf(t)}static $f(t,n){var i;if(Ve(t.conditions)||Ve((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const a=es.getWindowLocation();if(a){var c,u,f;const h=JS(n,a.href);return!(!((c=t.conditions)===null||c===void 0)&&c.url)||tA[(u=(f=t.conditions)===null||f===void 0?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return re==null?void 0:re.location}static Tf(t){var n;if(Ve(t.conditions)||Ve((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const i=dk();if(i.utm_source){var a,c,u,f,h,m,v,x;const b=!(!((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0)&&a.utm_campaign)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_campaign)==i.utm_campaign,y=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_source)||((f=t.conditions)===null||f===void 0||(f=f.utm)===null||f===void 0?void 0:f.utm_source)==i.utm_source,_=!(!((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0)&&h.utm_medium)||((m=t.conditions)===null||m===void 0||(m=m.utm)===null||m===void 0?void 0:m.utm_medium)==i.utm_medium,j=!(!((v=t.conditions)===null||v===void 0||(v=v.utm)===null||v===void 0)&&v.utm_term)||((x=t.conditions)===null||x===void 0||(x=x.utm)===null||x===void 0?void 0:x.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static wf(t,...n){_e.info(`[WebExperiments] ${t}`,n)}Sf(t,n,i){this._is_bot()?es.wf(Z5):n!=="control"?i.forEach(a=>{if(a.selector){var c;es.wf(`applying transform of variant ${n} for experiment ${t} `,a);const u=(c=document)===null||c===void 0?void 0:c.querySelectorAll(a.selector);u==null||u.forEach(f=>{const h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)})}}):es.wf("Control variants leave the page unmodified.")}_is_bot(){return jn&&this._instance?Rk(jn,this.Mr.custom_blocked_useragents):void 0}}},xh),hA={conversations:class{constructor(e){this._instance=e,this.If=void 0,this._conversationsManager=null,this.Mf=!1,this.ne=null,this.Ef=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Pf=e.ok,!e.ok))return;const t=e.config.conversations;Ve(t)||(ss(t)?this.If=t:(this.If=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.If=void 0,this.ne=null,this.Pf=void 0,this.Ef=!1}loadIfEnabled(){if(this._conversationsManager||this.Mf||this._instance.config.disable_conversations||D0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(e&&!de(this.If)&&this.If)if(this.ne&&this.ne.token){this.Mf=!0;try{const t=e.initConversations;if(t)return this.Rf(t),void(this.Mf=!1);const n=e.loadExternalDependency;if(!n)return void this.Af(wx);n(this._instance,"conversations",i=>{i||!e.initConversations?this.Af("Could not load conversations script",i):this.Rf(e.initConversations),this.Mf=!1})}catch(t){this.Af("Error initializing conversations",t),this.Mf=!1}}else Is.error("Conversations enabled but missing token in remote config.")}Rf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Ef=!1,Is.info("Conversations loaded successfully")}catch(t){this.Af("Error completing conversations initialization",t)}else Is.error("Cannot complete initialization: remote config is null")}Af(e,t){Is.error(e,t),this._conversationsManager=null,this.Mf=!1,this.Ef=!0}show(){this._conversationsManager?this._conversationsManager.show():Is.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.If===!0&&!Wt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":D0(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Pf===!1?"remote_config_failed":de(this.If)?this.Pf?"disabled_in_project":"remote_config_pending":this.If?Ve(this.ne)||!this.ne.token?"missing_token":$e!=null&&$e.__PosthogExtensions__?this.Mf?"initializing":this.Ef?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return zt(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Is.warn(Ya),null)})()}getMessages(e,t){var n=this;return zt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Is.warn(Ya),null)})()}markAsRead(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Is.warn(Ya),null)})()}getTickets(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Is.warn(Ya),null)})()}requestRestoreLink(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Is.warn(Ya),null)})()}restoreFromToken(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Is.warn(Ya),null)})()}restoreFromUrlToken(){var e=this;return zt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Is.warn(Ya),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}dh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}fh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},pA={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Ff=!1,this.Of=!1,this.Df=!1,this.$=Jt("[logs]"),this.Lf=U(U({},this.$),{},{error:(...n)=>{n.some(tw)||this.$.error(...n)}}),this.ia=[],this.Nf=[],this.Xc=0,this.So=!1,this.qf=[],this.jf=[],this.Bf=!1,this.Hf=!1,this.zf=()=>{var n,i;this.So||(this.Xc=0,(n=this.Uf)===null||n===void 0||n.onReconnect(),(i=this.Wf)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Ff=!0),re&&Nt(re,"online",this.zf)}Vf(e,t,n,i){var a;const c=J5((a=this._instance)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.logs,n);return[new ZT(this.Gf(e,t),c,this.Lf,()=>this.Zf(),u=>u(),void 0,i),c]}Qf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.Uf&&this.Jf===t||((n=this.Uf)===null||n===void 0||n.reset(),this.Jf=t,[this.Uf,this.Kf]=this.Vf(()=>this.ia,i=>{this.ia=i})),this.Uf}Yf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.Wf&&this.Xf===t||((n=this.Wf)===null||n===void 0||n.reset(),this.Xf=t,[this.Wf,this.tp]=this.Vf(()=>this.Nf,i=>{this.Nf=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ew)),this.Wf}setup(e){var t;if(this.So)return;this.po=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.Ff=!0),(this.Ff||this.ep()&&this.np())&&this.sp();let n=!1;const i=e.onRemoteConfig(a=>{var c;n=a.ok&&((c=a.config.logs)===null||c===void 0?void 0:c.captureConsoleLogs)===!0,this.onRemoteConfig(a)});this.So?i.dispose():(this.$o=i,n||this.loadIfEnabled())}dispose(){var e,t,n,i;this.So||(this.So=!0,this.rp(),(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.po=void 0,this.Df=!1,re==null||re.removeEventListener("online",this.zf),(t=this.op)===null||t===void 0||t.call(this),this.op=void 0,(n=this.Uf)===null||n===void 0||n.reset(),(i=this.Wf)===null||i===void 0||i.reset())}onRemoteConfig(e){var t,n;if(this.So)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;Ve(i)?this.lp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!i}),i?(this.Ff=!0,this.Of||this.sp(),this.loadIfEnabled()):this.lp())}reset(){var e,t,n,i;this.rp(),(e=this.Uf)===null||e===void 0||e.clearQueue(),this.ia=[],(t=this.Uf)===null||t===void 0||t.reset(),(n=this.Wf)===null||n===void 0||n.clearQueue(),this.Nf=[],(i=this.Wf)===null||i===void 0||i.reset(),this.Xc=0}captureLog(e){this.So||this.Qf().captureLog(e)}captureConsoleLog(e){this.So||this.Yf().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.So||this.Yf().captureLog(e,{context:t,occurredAtMs:n})}np(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[zS])}ep(){var e,t,n;return!(!((e=this._instance)===null||e===void 0||(t=e.Yl)===null||t===void 0)&&t.call(e))||!!(!((n=$e._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}gh(){var e;this.rp(),(e=this.Wf)===null||e===void 0||e.clearQueue(),this.Nf=[]}lp(){this.Ff||this.rp()}sp(){var e;if(this.Bf||!($e!=null&&$e.console))return;const t=J5((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;for(const n of nA){let i;try{i=sA($e.console[n])}catch{continue}i&&this.jf.push(Fk($e.console,n,a=>{const c=(...u)=>{try{this.ap(n,u,t)}catch{}return a.apply($e.console,u)};return c.__rrweb_original__=i,c}))}this.Bf=!0,this.up=setTimeout(()=>{this.rp()},3e4)}ap(e,t,n){var i;if(this.Bf&&!this.Hf&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(n>this.qf.length){this.Hf=!0;try{this.qf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Zf()})}finally{this.Hf=!1}}}else this.rp()}rp(){if(this.qf=[],this.Bf){this.Bf=!1,this.up&&(clearTimeout(this.up),this.up=void 0);for(const e of this.jf)e();this.jf=[]}}hp(){const e=this.qf;return this.rp(),e}get logger(){return this.cp||(this.cp={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.cp}flushLogs(e){e?this.dp(e):(this.Uf&&this.Uf.flush().catch(t=>this.vp(t)),this.Wf&&this.Wf.flush().catch(t=>this.vp(t)))}vp(e){tw(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.So||!this.Ff||this.Of||this.Df)return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.rp();const t=e.loadExternalDependency;if(!t)return this.$.error(wx),void this.rp();this.Df=!0;try{t(this._instance,"logs",n=>{if(this.Df=!1,this.So||!this.Ff)return;const i=e.logs;if(n||!(i!=null&&i.initializeLogs))this.$.error("Could not load logs script",n),this.rp();else{var a;const f=this.hp();var c,u;this.op=i.initializeLogs((a=this.po)!==null&&a!==void 0?a:this._instance),this.Of=!0,f.length>0&&((c=i.replayConsoleBuffer)===null||c===void 0||c.call(i,(u=this.po)!==null&&u!==void 0?u:this._instance,f))}})}catch(n){throw this.Df=!1,n}}Gf(e,t){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Ti.LogsQueue?e():void 0,setPersistedProperty(i,a){var c;i===Ti.LogsQueue&&t((c=a)!==null&&c!==void 0?c:[])},js:i=>this.js(i),getLibraryId:()=>_n.LIB_NAME,getLibraryVersion:()=>_n.LIB_VERSION}}js(e){return new Promise(t=>{if(ck(this.Xc,3))return void t({kind:"fatal",error:Bg(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const i=c=>{n||(n=!0,clearTimeout(a),t(c))},a=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Bg(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.fp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:c=>{const u=c.statusCode;if(this.pp(u),u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==408&&u!==429&&500>u)i({kind:"fatal",error:new Error(`logs request failed with status ${u}`)});else{var f;u===0?(c.error||this.$.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Bg(c.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(f=c.error)!==null&&f!==void 0?f:new Error(`logs request failed with status ${u}`)})}}})})}pp(e){(e!==0||this._instance.__loaded)&&(this.Xc=uk(e,this.Xc,3,()=>this.$.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.")))}dp(e){this.ia.length>0&&this.gp(e,this.ia,this.Kf,_n.LIB_NAME,t=>{this.ia=t}),this.Nf.length>0&&this.gp(e,this.Nf,this.tp,ew,t=>{this.Nf=t})}gp(e,t,n,i,a){if(t.length===0)return;const c=t.map(f=>f.record);a([]);const u=TS(c,ES(n,_n.LIB_NAME,_n.LIB_VERSION),i,_n.LIB_VERSION);this._instance._send_request({method:"POST",url:this.fp(),data:u,compression:"best-available",batchKey:"logs",transport:e})}fp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Zf(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:i,sessionStartTimestamp:a,lastActivityTimestamp:c}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=i,Ve(a)||(t.sessionStartTimestamp=a),Ve(c)||(t.lastActivityTimestamp=c)}if(!($e==null||(e=$e.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?da($e.location.href):$e.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(t.activeFeatureFlags=n)}return t}}},mA={metrics:class{constructor(e){this._instance=e,this.$=Jt("[metrics]")}initialize(){}Qf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var n;return this.Uf&&this.Jf===t||((n=this.Uf)===null||n===void 0||n.reset(),this.Jf=t,this.Uf=new JT(this.Gf(),(function(i){var a,c,u,f,h;const m=i==null?void 0:i.resourceAttributes;return{serviceName:(a=m==null?void 0:m["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(c=m==null?void 0:m["service.version"])!==null&&c!==void 0?c:i==null?void 0:i.serviceVersion,environment:(u=m==null?void 0:m["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:m,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(f=i==null?void 0:i.flushIntervalMs)!==null&&f!==void 0?f:1e4,maxSeriesPerFlush:(h=i==null?void 0:i.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(t),this.$)),this.Uf}count(e,t=1,n){this.Qf().count(e,t,n)}gauge(e,t,n){this.Qf().gauge(e,t,n)}histogram(e,t,n){this.Qf().histogram(e,t,n)}flush(e){if(!this.Uf)return Promise.resolve();if(e){const t=this.Uf.drainWindow();return t&&this.Xs(t,e),Promise.resolve()}return this.Uf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Uf)===null||e===void 0||e.reset()}Gf(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Xs:n=>t.Xs(n),getLibraryId:()=>_n.LIB_NAME,getLibraryVersion:()=>_n.LIB_VERSION}}Xs(e,t){return new Promise(n=>{let i=!1;const a=u=>{i||(i=!0,clearTimeout(c),n(u))},c=setTimeout(()=>a({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(U(U({method:"POST",url:this.mp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(u){const f=u.statusCode;if(f>=200&&300>f)a({kind:"ok"});else if(f===413)a({kind:"too-large"});else if(f!==0&&f!==408&&f!==429&&500>f)a({kind:"fatal",error:new Error(`metrics request failed with status ${f}`)});else{var h;a({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error(`metrics request failed with status ${f}`)})}}}))})}mp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};iu.__defaultExtensionClasses=U({},U(U(U(U(U(U(U(U(U(U(U(U(U({},xh),iA),rA),aA),lA),oA),uA),cA),dA),fA),hA),pA),mA));const gA=(function(){_n.SDK_DIST_CHANNEL="npm";const e=nu[Vc]=new iu;return(function(){function t(){t.done||(t.done=!0,Pk=!1,yt(nu,function(n){n._dom_loaded()}))}me!=null&&me.addEventListener?me.readyState==="complete"?t():Nt(me,"DOMContentLoaded",t,{capture:!1}):re&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var bu=gA;const xA="https://us.i.posthog.com",qk="cc-telemetry-enabled";let X0=!1,yu=!1;function vA(){return xA}function bA(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(qk);return e===null?!0:e==="true"}function Vk(e){X0&&(e?(bu.opt_in_capturing({captureEventName:null}),yu=!0):(bu.opt_out_capturing(),yu=!1))}function CB(e){typeof localStorage<"u"&&localStorage.setItem(qk,String(e)),Vk(e)}function yA(){const e=void 0;return e?(bu.init(e,{api_host:vA(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),X0=!0,Vk(bA()),!0):(X0=!1,yu=!1,!1)}function Ax(e,t){yu&&bu.capture(e,t)}function fa(e,t){yu&&bu.captureException(e,t)}function _A(e){Ax("$pageview",{$current_url:e})}const Li="/api",Gk="companion_auth_token";function ha(){if(typeof window>"u")return{};const e=localStorage.getItem(Gk);return e?{Authorization:`Bearer ${e}`}:{}}function rl(e){e===401&&typeof window<"u"&&(localStorage.removeItem(Gk),Gn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>UE);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function wn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Cu(e,t,n,i){Ax("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function Di(e,t,n,i,a){Ax("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),fa(i,{method:e,path:t,status:a})}async function He(e,t){const n=wn();let i=!1;try{const a=await fetch(`${Li}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw Di("POST",e,wn()-n,u,a.status),i=!0,u}return Cu("POST",e,wn()-n,a.status),a.json()}catch(a){throw i||Di("POST",e,wn()-n,a),a}}async function ze(e){const t=wn();let n=!1;try{const i=await fetch(`${Li}${e}`,{headers:{...ha()}});if(!i.ok){rl(i.status);const a=await i.json().catch(()=>({error:i.statusText})),c=new Error(a.error||i.statusText);throw Di("GET",e,wn()-t,c,i.status),n=!0,c}return Cu("GET",e,wn()-t,i.status),i.json()}catch(i){throw n||Di("GET",e,wn()-t,i),i}}async function Hs(e,t){const n=wn();let i=!1;try{const a=await fetch(`${Li}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw Di("PUT",e,wn()-n,u,a.status),i=!0,u}return Cu("PUT",e,wn()-n,a.status),a.json()}catch(a){throw i||Di("PUT",e,wn()-n,a),a}}async function wA(e,t){const n=wn();let i=!1;try{const a=await fetch(`${Li}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw Di("PATCH",e,wn()-n,u,a.status),i=!0,u}return Cu("PATCH",e,wn()-n,a.status),a.json()}catch(a){throw i||Di("PATCH",e,wn()-n,a),a}}async function qs(e,t){const n=wn();let i=!1;try{const a=await fetch(`${Li}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw Di("DELETE",e,wn()-n,u,a.status),i=!0,u}return Cu("DELETE",e,wn()-n,a.status),a.json()}catch(a){throw i||Di("DELETE",e,wn()-n,a),a}}async function SA(e,t){const n=await fetch(`${Li}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...ha()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const i=n.body.getReader(),a=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;c+=a.decode(h,{stream:!0});const m=c.split(`
|
|
69
|
-
|
|
70
|
-
`);c=m.pop()||"";for(const v of m){if(!v.trim())continue;let x="",b="";for(const _ of v.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 kA(){try{const e=await fetch(`${Li}/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 nw(e){try{const t=await fetch(`${Li}/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 ke={getAuthQr:()=>ze("/auth/qr"),getAuthToken:()=>ze("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>ze("/sessions"),discoverClaudeSessions:(e=200)=>ze(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return ze(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>qs(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${Li}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...ha()}});if(!n.ok)throw rl(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>ze(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>wA(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>ze(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>ze("/fs/home"),listEnvs:()=>ze("/envs"),getEnv:e=>ze(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Hs(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>qs(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>ze("/sandboxes"),getSandbox:e=>ze(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Hs(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>qs(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>ze("/docker/base-image"),getSettings:()=>ze("/settings"),updateSettings:e=>Hs("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getCodexAccount:()=>ze("/codex/auth/account"),getCodexLoginStatus:()=>ze("/codex/auth/login"),startCodexLogin:()=>He("/codex/auth/login"),cancelCodexLogin:()=>He("/codex/auth/login/cancel"),codexLogout:()=>He("/codex/auth/logout"),getDashboard:()=>ze("/dashboard"),runDashboardUpdate:()=>He("/dashboard/run"),getDashboardRunStatus:()=>ze("/dashboard/run/status"),getTailscaleStatus:()=>ze("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>ze("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Hs(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>qs(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>ze(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>ze(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>ze(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>ze(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>ze(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>ze(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Hs("/linear/project-mappings",e),removeLinearProjectMapping:e=>qs("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Hs(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>qs(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>ze(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>ze(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>ze(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>ze(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>qs("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>ze(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>ze("/backends"),getBackendModels:e=>ze(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>ze("/containers/status"),getContainerImages:()=>ze("/containers/images"),getImageStatus:e=>ze(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>ze(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>ze(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>ze(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${Li}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...ha()}});if(!t.ok){rl(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Hs("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>ze(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>ze(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>ze(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Hs("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>ze(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>ze("/usage-limits"),getSessionUsageLimits:e=>ze(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>ze("/system/memory"),getSystemDisk:()=>ze("/system/disk"),spawnTerminal:(e,t,n,i)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>ze(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>ze("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>ze("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>ze("/cron/jobs"),getCronJob:e=>ze(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Hs(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>qs(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>ze(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>ze(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>ze("/agents"),getAgent:e=>ze(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Hs(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>qs(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>ze(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>ze(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return ze(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return ze(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return ze(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>ze(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>qs(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>ze("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Hs(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>qs(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>ze(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>ze("/skills"),sendSessionMessage:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return ze(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Hs(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>qs(`/prompts/${encodeURIComponent(e)}`)};let sw=!1;function iw(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function rw(){return new Promise(()=>{})}function jA(){if(sw||typeof window>"u")return;sw=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await iw(i)}catch{return rw()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await iw(n)}catch{return rw()}}}})}catch{}}const aw="#/session/",lw="#/agents/";let ow=!1;function Rx(){ow||(jA(),ow=!0)}function Ox(e){if(Rx(),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(lw)){const n=e.slice(lw.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(aw)){const n=e.slice(aw.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function NA(e){return`#/session/${e}`}function Lx(e,t=!1){Rx();const n=NA(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Pg(e=!1){Rx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function CA(){const[e,t]=k.useState(""),[n,i]=k.useState(null),[a,c]=k.useState(!1),u=Q(v=>v.setAuthToken),f=k.useCallback(async v=>{v.preventDefault();const x=e.trim();if(!x){i("Please enter a token");return}c(!0),i(null),await nw(x)?u(x):i("Invalid token"),c(!1)},[e,u]);k.useEffect(()=>{kA().then(v=>{if(v){u(v);return}const b=new URLSearchParams(window.location.search).get("token");b&&(c(!0),nw(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),c(!1)}))})},[u]);const[h,m]=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:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:v=>{t(v.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>m(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var ko=b2();function EA({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,m]=k.useState("none");return ko.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:v=>v.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>m("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 ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>m("backlog"),disabled:!c,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>m("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function TA(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function MA({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 AA({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 Lf({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:m,onDelete:v,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:S}){const C=e.id.slice(0,8),E=i||e.model||C,L=b===e.id,[O,R]=k.useState(!1),F=k.useRef(null),D=k.useRef(null),X=n?"exited":TA(e,a),P=e.cwd||"";k.useEffect(()=>{if(!O)return;function A(te){var K;F.current&&!F.current.contains(te.target)&&D.current&&!D.current.contains(te.target)&&(R(!1),(K=D.current)==null||K.focus())}function fe(te){var K,G,V;if(te.key==="Escape"){R(!1),(K=D.current)==null||K.focus();return}if(te.key==="Tab"){R(!1);return}if((te.key==="ArrowDown"||te.key==="ArrowUp")&&((G=F.current)!=null&&G.contains(document.activeElement)||D.current===document.activeElement)){te.preventDefault();const se=(V=F.current)==null?void 0:V.querySelectorAll("[role='menuitem']");if(!se||se.length===0)return;const ae=document.activeElement,M=Array.from(se).indexOf(ae);te.key==="ArrowDown"?se[M<se.length-1?M+1:0].focus():se[M>0?M-1:se.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",fe),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",fe)}},[O]),k.useEffect(()=>{O&&requestAnimationFrame(()=>{var A,fe;(fe=(A=F.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||fe.focus()})},[O]);const Y=k.useCallback(A=>{R(!1),A()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:A=>{A.preventDefault(),f(e.id,E)},onKeyDown:A=>{A.key==="F2"&&!L&&(A.preventDefault(),f(e.id,E))},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(MA,{status:X}),L?l.jsx("input",{ref:S,value:y,onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),j()):A.key==="Escape"&&(A.preventDefault(),N()),A.stopPropagation()},onBlur:j,onClick:A=>A.stopPropagation(),onDoubleClick:A=>A.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:E}),P&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:P})]}),!L&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(AA,{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:A=>{A.stopPropagation(),h(A,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:D,onClick:A=>{A.stopPropagation(),R(!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:F,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:()=>Y(()=>f(e.id,E)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>Y(()=>m(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>Y(()=>v(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>Y(()=>h(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function RA({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:m,onUnarchive:v,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:C,isFirst:E}){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:E?"":"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 F;const R=((F=c.get(O.id))==null?void 0:F.size)??0;return l.jsx(Lf,{session:O,isActive:i===O.id,sessionName:a.get(O.id),permCount:R,isRecentlyRenamed:u.has(O.id),onSelect:f,onStartRename:h,onArchive:m,onUnarchive:v,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:C},O.id)})})]})}function OA(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function LA(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function DA(e){const t=new Map;for(const i of e){const a=OA(i.cwd,i.repoRoot||void 0,i.isContainerized),c=LA(a);t.has(a)||t.set(a,{key:a,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,a)=>i.label.localeCompare(a.label));for(const i of n)i.sessions.sort((a,c)=>c.createdAt-a.createdAt);return n}const zA=[{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"}],$A=[{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"}],BA=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],PA=new Map($A.map(e=>[e.id,e]));function UA(){var vr,$i;const[e,t]=k.useState(null),[n,i]=k.useState(""),[a,c]=k.useState(!1),[u,f]=k.useState(null),[h,m]=k.useState(null),[v,x]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,S]=k.useState(!1),[C,E]=k.useState(()=>typeof window<"u"?window.location.hash:""),L=k.useRef(null),O=k.useRef(null),R=Q(oe=>oe.sessions),F=Q(oe=>oe.sdkSessions),D=Q(oe=>oe.currentSessionId),X=Q(oe=>oe.cliConnected),P=Q(oe=>oe.cliReconnecting),Y=Q(oe=>oe.sessionStatus),A=Q(oe=>oe.removeSession),fe=Q(oe=>oe.sessionNames),te=Q(oe=>oe.recentlyRenamed),K=Q(oe=>oe.clearRecentlyRenamed),G=Q(oe=>oe.pendingPermissions),V=Q(oe=>oe.linkedLinearIssues),se=Q(oe=>oe.collapsedProjects),ae=Q(oe=>oe.toggleProjectCollapse),M=Ox(C);k.useEffect(()=>{let oe=!0;async function ve(){try{const rt=await ke.listSessions();if(oe){const It=Q.getState();It.setSdkSessions(rt);const Sn=Q.getState(),Nn=new Set(rt.map(xt=>xt.sessionId));for(const xt of Sn.sessions.keys())!Nn.has(xt)&&Sn.connectionStatus.get(xt)!=="connected"&&Sn.removeSession(xt);H4(rt);for(const xt of rt)if(xt.name&&(!It.sessionNames.has(xt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(It.sessionNames.get(xt.sessionId)))){const rn=It.sessionNames.get(xt.sessionId),en=!!rn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(rn);rn!==xt.name&&(It.setSessionName(xt.sessionId,xt.name),en&&It.markRecentlyRenamed(xt.sessionId))}}}catch{}}ve();const we=setInterval(ve,5e3);return()=>{oe=!1,clearInterval(we)}},[]),k.useEffect(()=>{const oe=()=>E(window.location.hash);return window.addEventListener("hashchange",oe),()=>window.removeEventListener("hashchange",oe)},[]);function Te(oe){Lx(oe),window.innerWidth<768&&Q.getState().setSidebarOpen(!1)}function Ce(){Pg(),Q.getState().newSession(),window.innerWidth<768&&Q.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function z(){e&&n.trim()&&(Q.getState().setSessionName(e,n.trim()),ke.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function B(){t(null),i("")}function ce(oe,ve){t(oe),i(ve)}const ye=k.useCallback((oe,ve)=>{oe.stopPropagation(),j(ve)},[]),Ne=k.useCallback(async oe=>{try{m0(oe),await ke.deleteSession(oe)}catch{}Q.getState().currentSessionId===oe&&Pg(),A(oe)},[A]),Ae=k.useCallback(()=>{_&&(Ne(_),j(null))},[_,Ne]),Le=k.useCallback(()=>{j(null)},[]),De=k.useCallback(()=>{S(!0)},[]),Ee=k.useCallback(async()=>{S(!1);const oe=Q.getState(),ve=new Set;for(const rt of oe.sessions.keys())ve.add(rt);for(const rt of oe.sdkSessions)ve.add(rt.sessionId);const we=Array.from(ve).filter(rt=>{const It=oe.sdkSessions.find(Sn=>Sn.sessionId===rt);return(It==null?void 0:It.archived)??!1});for(const rt of we)await Ne(rt)},[Ne]),Re=k.useCallback(()=>{S(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ve,we;(we=(ve=O.current)==null?void 0:ve.querySelector("button"))==null||we.focus()});function oe(ve){var Sn;if(ve.key==="Escape"){N?Re():Le();return}if(ve.key!=="Tab")return;const we=(Sn=O.current)==null?void 0:Sn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!we||we.length===0)return;const rt=we[0],It=we[we.length-1];ve.shiftKey&&document.activeElement===rt?(ve.preventDefault(),It.focus()):!ve.shiftKey&&document.activeElement===It&&(ve.preventDefault(),rt.focus())}return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[_,N,Le,Re]);const Ut=k.useCallback(async(oe,ve)=>{oe.stopPropagation();const we=F.find(rn=>rn.sessionId===ve),rt=R.get(ve),It=(rt==null?void 0:rt.is_containerized)||!!(we!=null&&we.containerId)||!1,Sn=V.get(ve),Nn=((Sn==null?void 0:Sn.stateType)||"").toLowerCase();if(Sn&&!(Nn==="completed"||Nn==="canceled"||Nn==="cancelled"))try{const rn=await ke.getArchiveInfo(ve);if(rn.issueNotDone){m(ve),x(rn),y(It);return}}catch{}if(It){f(ve);return}Qt(ve)},[F,R,V]),Qt=k.useCallback(async(oe,ve,we)=>{try{m0(oe);const rt={};ve&&(rt.force=!0),we&&we!=="none"&&(rt.linearTransition=we),await ke.archiveSession(oe,Object.keys(rt).length>0?rt:void 0)}catch{}Q.getState().currentSessionId===oe&&(Pg(),Q.getState().newSession());try{const rt=await ke.listSessions();Q.getState().setSdkSessions(rt)}catch{}},[]),Ft=k.useCallback(()=>{u&&(Qt(u,!0),f(null))},[u,Qt]),jt=k.useCallback(()=>{f(null)},[]),wt=k.useCallback((oe,ve)=>{h&&(Qt(h,ve,oe),m(null),x(null))},[h,Qt]),Xe=k.useCallback(()=>{m(null),x(null)},[]),St=k.useCallback(async(oe,ve)=>{oe.stopPropagation();try{await ke.unarchiveSession(ve)}catch{}try{const we=await ke.listSessions();Q.getState().setSdkSessions(we)}catch{}},[]),nn=new Set;for(const oe of R.keys())nn.add(oe);for(const oe of F)nn.add(oe.sessionId);const ne=Array.from(nn).map(oe=>{var rt;const ve=R.get(oe),we=F.find(It=>It.sessionId===oe);return{id:oe,model:(ve==null?void 0:ve.model)||(we==null?void 0:we.model)||"",cwd:(ve==null?void 0:ve.cwd)||(we==null?void 0:we.cwd)||"",gitBranch:(ve==null?void 0:ve.git_branch)||(we==null?void 0:we.gitBranch)||"",isContainerized:(ve==null?void 0:ve.is_containerized)||!!(we!=null&&we.containerId)||!1,gitAhead:(ve==null?void 0:ve.git_ahead)||(we==null?void 0:we.gitAhead)||0,gitBehind:(ve==null?void 0:ve.git_behind)||(we==null?void 0:we.gitBehind)||0,linesAdded:(ve==null?void 0:ve.total_lines_added)||(we==null?void 0:we.totalLinesAdded)||0,linesRemoved:(ve==null?void 0:ve.total_lines_removed)||(we==null?void 0:we.totalLinesRemoved)||0,isConnected:X.get(oe)??!1,isReconnecting:P.get(oe)??!1,status:Y.get(oe)??null,sdkState:(we==null?void 0:we.state)??null,createdAt:(we==null?void 0:we.createdAt)??0,archived:(we==null?void 0:we.archived)??!1,backendType:(ve==null?void 0:ve.backend_type)||(we==null?void 0:we.backendType)||"claude",repoRoot:(ve==null?void 0:ve.repo_root)||"",permCount:((rt=G.get(oe))==null?void 0:rt.size)??0,cronJobId:(ve==null?void 0:ve.cronJobId)||(we==null?void 0:we.cronJobId),cronJobName:(ve==null?void 0:ve.cronJobName)||(we==null?void 0:we.cronJobName),agentId:(ve==null?void 0:ve.agentId)||(we==null?void 0:we.agentId),agentName:(ve==null?void 0:ve.agentName)||(we==null?void 0:we.agentName),userName:we==null?void 0:we.userName}}).sort((oe,ve)=>ve.createdAt-oe.createdAt),je=k.useMemo(()=>Array.from(new Set(ne.map(oe=>oe.userName).filter(oe=>!!oe))).sort(),[ne]),[Ye,Je]=k.useState("__all__"),un=oe=>Ye==="__all__"?!0:Ye==="__none__"?!oe.userName:oe.userName===Ye,ue=ne.some(oe=>!oe.userName),be=ne.filter(un),H=be.filter(oe=>!oe.archived&&!oe.cronJobId&&!oe.agentId),ge=be.filter(oe=>!oe.archived&&!!oe.cronJobId),Pe=be.filter(oe=>!oe.archived&&!!oe.agentId),We=be.filter(oe=>oe.archived),at=D?ne.find(oe=>oe.id===D):null,ft=(at==null?void 0:at.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[hn,rs]=k.useState(!0),[Ct,bs]=k.useState(!0),In=k.useMemo(()=>DA(H),[H]),sn={onSelect:Te,onStartRename:ce,onArchive:Ut,onUnarchive:St,onDelete:ye,onClearRecentlyRenamed:K,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:z,onCancelRename:B,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:ft,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:Ce,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:()=>Q.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"})})})]})}),je.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:Ye,onChange:oe=>Je(oe.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"}),je.map(oe=>l.jsx("option",{value:oe,children:oe},oe)),ue&&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:jt,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:Ft,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:H.length===0&&ge.length===0&&We.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[In.map((oe,ve)=>l.jsx(RA,{group:oe,isCollapsed:se.has(oe.key),onToggleCollapse:ae,currentSessionId:D,sessionNames:fe,pendingPermissions:G,recentlyRenamed:te,isFirst:ve===0,...sn},oe.key)),ge.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>rs(!hn),"aria-expanded":hn,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 ${hn?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",ge.length,")"]}),hn&&l.jsx("div",{className:"mt-0.5",children:ge.map(oe=>{var ve;return l.jsx(Lf,{session:oe,isActive:D===oe.id,sessionName:fe.get(oe.id),permCount:((ve=G.get(oe.id))==null?void 0:ve.size)??0,isRecentlyRenamed:te.has(oe.id),...sn},oe.id)})})]}),Pe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>bs(!Ct),"aria-expanded":Ct,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 ${Ct?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Pe.length,")"]}),Ct&&l.jsx("div",{className:"mt-0.5",children:Pe.map(oe=>{var ve;return l.jsx(Lf,{session:oe,isActive:D===oe.id,sessionName:fe.get(oe.id),permCount:((ve=G.get(oe.id))==null?void 0:ve.size)??0,isRecentlyRenamed:te.has(oe.id),...sn},oe.id)})})]}),We.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>c(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",We.length,")"]}),a&&We.length>1&&l.jsx("button",{onClick:De,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:We.map(oe=>{var ve;return l.jsx(Lf,{session:oe,isActive:D===oe.id,isArchived:!0,sessionName:fe.get(oe.id),permCount:((ve=G.get(oe.id))==null?void 0:ve.size)??0,isRecentlyRenamed:te.has(oe.id),...sn},oe.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Ce,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:BA.map(oe=>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:oe.label}),l.jsx("div",{className:"flex flex-col",children:oe.itemIds.map(ve=>{const we=PA.get(ve);if(!we)return null;const rt=we.activePages?we.activePages.some(It=>M.page===It):M.page===we.id;return l.jsxs("button",{onClick:()=>{window.location.hash=we.hash,window.innerWidth<768&&Q.getState().setSidebarOpen(!1)},title:we.label,"aria-current":rt?"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 ${rt?"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 ${rt?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:we.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:we.iconPath,fillRule:we.fillRule,clipRule:we.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:we.label})]},we.id)})})]},oe.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:zA.map(oe=>l.jsx("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",title:oe.label,"aria-label":`Open ${oe.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:oe.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:oe.iconPath})})},oe.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?Re:Le,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:oe=>oe.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${We.length} archived session${We.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?Re:Le,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?Ee:Ae,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:N?"Delete all":"Delete"})]})]})}),h&&v&&l.jsx(EA,{issueIdentifier:((vr=v.issue)==null?void 0:vr.identifier)||"",issueStateName:(($i=v.issue)==null?void 0:$i.stateName)||"",isContainerized:b,archiveTransitionConfigured:v.archiveTransitionConfigured||!1,archiveTransitionStateName:v.archiveTransitionStateName,hasBacklogState:v.hasBacklogState||!1,onConfirm:wt,onCancel:Xe})]})}function FA(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const IA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qA={};function cw(e,t){return(qA.jsx?HA:IA).test(e)}const VA=/[ \t\n\f\r]/g;function GA(e){return typeof e=="object"?e.type==="text"?uw(e.value):!1:uw(e)}function uw(e){return e.replace(VA,"")===""}class Eu{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Eu.prototype.normal={};Eu.prototype.property={};Eu.prototype.space=void 0;function Yk(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Eu(n,i,t)}function Q0(e){return e.toLowerCase()}class vs{constructor(t,n){this.attribute=n,this.property=t}}vs.prototype.attribute="";vs.prototype.booleanish=!1;vs.prototype.boolean=!1;vs.prototype.commaOrSpaceSeparated=!1;vs.prototype.commaSeparated=!1;vs.prototype.defined=!1;vs.prototype.mustUseProperty=!1;vs.prototype.number=!1;vs.prototype.overloadedBoolean=!1;vs.prototype.property="";vs.prototype.spaceSeparated=!1;vs.prototype.space=void 0;let YA=0;const Ze=ll(),yn=ll(),K0=ll(),Se=ll(),Bt=ll(),nl=ll(),Ms=ll();function ll(){return 2**++YA}const W0=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:yn,commaOrSpaceSeparated:Ms,commaSeparated:nl,number:Se,overloadedBoolean:K0,spaceSeparated:Bt},Symbol.toStringTag,{value:"Module"})),Ug=Object.keys(W0);class Dx extends vs{constructor(t,n,i,a){let c=-1;if(super(t,n),dw(this,"space",a),typeof i=="number")for(;++c<Ug.length;){const u=Ug[c];dw(this,Ug[c],(i&W0[u])===W0[u])}}}Dx.prototype.defined=!0;function dw(e,t,n){n&&(e[t]=n)}function jo(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const c=new Dx(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[Q0(i)]=i,n[Q0(c.attribute)]=i}return new Eu(t,n,e.space)}const Xk=jo({properties:{ariaActiveDescendant:null,ariaAtomic:yn,ariaAutoComplete:null,ariaBusy:yn,ariaChecked:yn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Bt,ariaCurrent:null,ariaDescribedBy:Bt,ariaDetails:null,ariaDisabled:yn,ariaDropEffect:Bt,ariaErrorMessage:null,ariaExpanded:yn,ariaFlowTo:Bt,ariaGrabbed:yn,ariaHasPopup:null,ariaHidden:yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bt,ariaLevel:Se,ariaLive:null,ariaModal:yn,ariaMultiLine:yn,ariaMultiSelectable:yn,ariaOrientation:null,ariaOwns:Bt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:yn,ariaReadOnly:yn,ariaRelevant:null,ariaRequired:yn,ariaRoleDescription:Bt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:yn,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 Qk(e,t){return t in e?e[t]:t}function Kk(e,t){return Qk(e,t.toLowerCase())}const XA=jo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:nl,acceptCharset:Bt,accessKey:Bt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alpha:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Bt,autoFocus:Ze,autoPlay:Ze,blocking:Bt,capture:null,charSet:null,checked:Ze,cite:null,className:Bt,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:yn,controls:Ze,controlsList:Bt,coords:Se|nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:K0,draggable:yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Bt,height:Se,hidden:K0,high:Se,href:null,hrefLang:null,htmlFor:Bt,httpEquiv:Bt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Bt,itemRef:Bt,itemScope:Ze,itemType:Bt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:Se,pattern:null,ping:Bt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Bt,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:Bt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootCustomElementRegistry:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shadowRootSerializable:Ze,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:yn,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:Ze,useMap:null,value:yn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Bt,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:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:yn,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:Ze,disablePictureInPicture:Ze,disableRemotePlayback:Ze,exportParts:nl,part:Bt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Kk}),QA=jo({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:Ms,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:Bt,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:Ze,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:nl,g2:nl,glyphName:nl,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:Ms,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:Bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ms,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ms,rev:Ms,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ms,requiredFeatures:Ms,requiredFonts:Ms,requiredFormats:Ms,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:Ms,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:Ms,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:Ms,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:Qk}),Wk=jo({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()}}),Zk=jo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Kk}),Jk=jo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KA={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"},WA=/[A-Z]/g,fw=/-[a-z]/g,ZA=/^data[-\w.:]+$/i;function JA(e,t){const n=Q0(t);let i=t,a=vs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZA.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(fw,t8);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!fw.test(c)){let u=c.replace(WA,e8);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Dx}return new a(i,t)}function e8(e){return"-"+e.toLowerCase()}function t8(e){return e.charAt(1).toUpperCase()}const n8=Yk([Xk,XA,Wk,Zk,Jk],"html"),zx=Yk([Xk,QA,Wk,Zk,Jk],"svg");function s8(e){return e.join(" ").trim()}var io={},Fg,hw;function i8(){if(hw)return Fg;hw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
72
|
-
`,m="/",v="*",x="",b="comment",y="declaration";function _(N,S){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];S=S||{};var C=1,E=1;function L(te){var K=te.match(t);K&&(C+=K.length);var G=te.lastIndexOf(h);E=~G?te.length-G:E+te.length}function O(){var te={line:C,column:E};return function(K){return K.position=new R(te),X(),K}}function R(te){this.start=te,this.end={line:C,column:E},this.source=S.source}R.prototype.content=N;function F(te){var K=new Error(S.source+":"+C+":"+E+": "+te);if(K.reason=te,K.filename=S.source,K.line=C,K.column=E,K.source=N,!S.silent)throw K}function D(te){var K=te.exec(N);if(K){var G=K[0];return L(G),N=N.slice(G.length),K}}function X(){D(n)}function P(te){var K;for(te=te||[];K=Y();)K!==!1&&te.push(K);return te}function Y(){var te=O();if(!(m!=N.charAt(0)||v!=N.charAt(1))){for(var K=2;x!=N.charAt(K)&&(v!=N.charAt(K)||m!=N.charAt(K+1));)++K;if(K+=2,x===N.charAt(K-1))return F("End of comment missing");var G=N.slice(2,K-2);return E+=2,L(G),N=N.slice(K),E+=2,te({type:b,comment:G})}}function A(){var te=O(),K=D(i);if(K){if(Y(),!D(a))return F("property missing ':'");var G=D(c),V=te({type:y,property:j(K[0].replace(e,x)),value:G?j(G[0].replace(e,x)):x});return D(u),V}}function fe(){var te=[];P(te);for(var K;K=A();)K!==!1&&(te.push(K),P(te));return te}return X(),fe()}function j(N){return N?N.replace(f,x):x}return Fg=_,Fg}var pw;function r8(){if(pw)return io;pw=1;var e=io&&io.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(io,"__esModule",{value:!0}),io.default=n;const t=e(i8());function n(i,a){let c=null;if(!i||typeof i!="string")return c;const u=(0,t.default)(i),f=typeof a=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:m,value:v}=h;f?a(m,v,h):v&&(c=c||{},c[m]=v)}),c}return io}var Pc={},mw;function a8(){if(mw)return Pc;mw=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(m){return!m||n.test(m)||e.test(m)},u=function(m,v){return v.toUpperCase()},f=function(m,v){return"".concat(v,"-")},h=function(m,v){return v===void 0&&(v={}),c(m)?m:(m=m.toLowerCase(),v.reactCompat?m=m.replace(a,f):m=m.replace(i,f),m.replace(t,u))};return Pc.camelCase=h,Pc}var Uc,gw;function l8(){if(gw)return Uc;gw=1;var e=Uc&&Uc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(r8()),n=a8();function i(a,c){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(f,h){f&&h&&(u[(0,n.camelCase)(f,c)]=h)}),u}return i.default=i,Uc=i,Uc}var o8=l8();const c8=ux(o8),ej=tj("end"),$x=tj("start");function tj(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function u8(e){const t=$x(e),n=ej(e);if(t&&n)return{start:t,end:n}}function ru(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xw(e.position):"start"in e||"end"in e?xw(e):"line"in e||"column"in e?Z0(e):""}function Z0(e){return vw(e&&e.line)+":"+vw(e&&e.column)}function xw(e){return Z0(e&&e.start)+"-"+Z0(e&&e.end)}function vw(e){return e&&typeof e=="number"?e:1}class Yn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?a=t:!c.cause&&t&&(u=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?c.ruleId=i:(c.source=i.slice(0,h),c.ruleId=i.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=ru(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yn.prototype.file="";Yn.prototype.name="";Yn.prototype.reason="";Yn.prototype.message="";Yn.prototype.stack="";Yn.prototype.column=void 0;Yn.prototype.line=void 0;Yn.prototype.ancestors=void 0;Yn.prototype.cause=void 0;Yn.prototype.fatal=void 0;Yn.prototype.place=void 0;Yn.prototype.ruleId=void 0;Yn.prototype.source=void 0;const Bx={}.hasOwnProperty,d8=new Map,f8=/[A-Z]/g,h8=new Set(["table","tbody","thead","tfoot","tr"]),p8=new Set(["td","th"]),nj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m8(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=S8(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=w8(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?zx:n8,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=sj(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function sj(e,t,n){if(t.type==="element")return g8(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return x8(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return b8(e,t,n);if(t.type==="mdxjsEsm")return v8(e,t);if(t.type==="root")return y8(e,t,n);if(t.type==="text")return _8(e,t)}function g8(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=zx,e.schema=a),e.ancestors.push(t);const c=rj(e,t.tagName,!1),u=k8(e,t);let f=Ux(e,t);return h8.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!GA(h):!0})),ij(e,u,c,t),Px(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function x8(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}_u(e,t.position)}function v8(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_u(e,t.position)}function b8(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=zx,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:rj(e,t.name,!0),u=j8(e,t),f=Ux(e,t);return ij(e,u,c,t),Px(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function y8(e,t,n){const i={};return Px(i,Ux(e,t)),e.create(t,e.Fragment,i,n)}function _8(e,t){return t.value}function ij(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Px(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function w8(e,t,n){return i;function i(a,c,u,f){const m=Array.isArray(u.children)?n:t;return f?m(c,u,f):m(c,u)}}function S8(e,t){return n;function n(i,a,c,u){const f=Array.isArray(c.children),h=$x(i);return t(a,c,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function k8(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&Bx.call(t.properties,a)){const c=N8(e,a,t.properties[a]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&p8.has(t.tagName)?i=f:n[u]=f}}if(i){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function j8(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const u=c.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else _u(e,t.position);else{const a=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else _u(e,t.position);else c=i.value===null?!0:i.value;n[a]=c}return n}function Ux(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:d8;for(;++i<t.children.length;){const c=t.children[i];let u;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const m=a.get(h)||0;u=h+"-"+m,a.set(h,m+1)}}const f=sj(e,c,u);f!==void 0&&n.push(f)}return n}function N8(e,t,n){const i=JA(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?FA(n):s8(n)),i.property==="style"){let a=typeof n=="object"?n:C8(e,String(n));return e.stylePropertyNameCase==="css"&&(a=E8(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?KA[i.property]||i.property:i.attribute,n]}}function C8(e,t){try{return c8(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=nj+"#cannot-parse-style-attribute",a}}function rj(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,u;for(;++c<a.length;){const f=cw(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}i=u}else i=cw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return Bx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);_u(e)}function _u(e,t){const n=new Yn("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=nj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function E8(e){const t={};let n;for(n in e)Bx.call(e,n)&&(t[T8(n)]=e[n]);return t}function T8(e){let t=e.replace(f8,M8);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function M8(e){return"-"+e.toLowerCase()}const Ig={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"]},A8={};function Fx(e,t){const n=A8,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return aj(e,i,a)}function aj(e,t,n){if(R8(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 bw(e.children,t,n)}return Array.isArray(e)?bw(e,t,n):""}function bw(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=aj(e[a],t,n);return i.join("")}function R8(e){return!!(e&&typeof e=="object")}const yw=document.createElement("i");function Ix(e){const t="&"+e+";";yw.innerHTML=t;const n=yw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Rs(e,t,n,i){const a=e.length;let c=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<i.length;)u=i.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Vs(e,t){return e.length>0?(Rs(e,e.length,0,t),e):t}const _w={}.hasOwnProperty;function lj(e){const t={};let n=-1;for(;++n<e.length;)O8(t,e[n]);return t}function O8(e,t){let n;for(n in t){const a=(_w.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){_w.call(a,u)||(a[u]=[]);const f=c[u];L8(a[u],Array.isArray(f)?f:f?[f]:[])}}}function L8(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Rs(e,0,0,i)}function oj(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 ci(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const is=ma(/[A-Za-z]/),Vn=ma(/[\dA-Za-z]/),D8=ma(/[#-'*+\--9=?A-Z^-~]/);function ih(e){return e!==null&&(e<32||e===127)}const J0=ma(/\d/),z8=ma(/[\dA-Fa-f]/),$8=ma(/[!-/:-@[-`{-~]/);function qe(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function dt(e){return e===-2||e===-1||e===32}const vh=ma(new RegExp("\\p{P}|\\p{S}","u")),al=ma(/\s/);function ma(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function No(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&Vn(e.charCodeAt(n+1))&&Vn(e.charCodeAt(n+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(n+1);c<56320&&f>56319&&f<57344?(u=String.fromCharCode(c,f),a=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function _t(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(h){return dt(h)?(e.enter(n),f(h)):t(h)}function f(h){return dt(h)&&c++<a?(e.consume(h),f):(e.exit(n),t(h))}}const B8={tokenize:P8};function P8(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),_t(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),c(f)}function c(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return qe(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),u)}}const U8={tokenize:F8},ww={tokenize:I8};function F8(e){const t=this,n=[];let i=0,a,c,u;return f;function f(E){if(i<n.length){const L=n[i];return t.containerState=L[1],e.attempt(L[0].continuation,h,m)(E)}return m(E)}function h(E){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const L=t.events.length;let O=L,R;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){R=t.events[O][1].end;break}S(i);let F=L;for(;F<t.events.length;)t.events[F][1].end={...R},F++;return Rs(t.events,O+1,0,t.events.slice(L)),t.events.length=F,m(E)}return f(E)}function m(E){if(i===n.length){if(!a)return b(E);if(a.currentConstruct&&a.currentConstruct.concrete)return _(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ww,v,x)(E)}function v(E){return a&&C(),S(i),b(E)}function x(E){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(E)}function b(E){return t.containerState={},e.attempt(ww,y,_)(E)}function y(E){return i++,n.push([t.currentConstruct,t.containerState]),b(E)}function _(E){if(E===null){a&&C(),S(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return qe(E)?(e.consume(E),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(E),j)}function N(E,L){const O=t.sliceStream(E);if(L&&O.push(null),E.previous=c,c&&(c.next=E),c=E,a.defineSkip(E.start),a.write(O),t.parser.lazy[E.start.line]){let R=a.events.length;for(;R--;)if(a.events[R][1].start.offset<u&&(!a.events[R][1].end||a.events[R][1].end.offset>u))return;const F=t.events.length;let D=F,X,P;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(X){P=t.events[D][1].end;break}X=!0}for(S(i),R=F;R<t.events.length;)t.events[R][1].end={...P},R++;Rs(t.events,D+1,0,t.events.slice(F)),t.events.length=R}}function S(E){let L=n.length;for(;L-- >E;){const O=n[L];t.containerState=O[1],O[0].exit.call(t,e)}n.length=E}function C(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function I8(e,t,n){return _t(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _o(e){if(e===null||Pt(e)||al(e))return 1;if(vh(e))return 2}function bh(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!i.includes(c)&&(t=c(t,n),i.push(c))}return t}const ex={name:"attention",resolveAll:H8,tokenize:q8};function H8(e,t){let n=-1,i,a,c,u,f,h,m,v;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[i][1].end},b={...e[n][1].start};Sw(x,-h),Sw(b,h),u={type:h>1?"strongSequence":"emphasisSequence",start:x,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},c={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},m=[],e[i][1].end.offset-e[i][1].start.offset&&(m=Vs(m,[["enter",e[i][1],t],["exit",e[i][1],t]])),m=Vs(m,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",c,t]]),m=Vs(m,bh(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),m=Vs(m,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(v=2,m=Vs(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):v=0,Rs(e,i-1,n-i+3,m),n=i+m.length-v-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function q8(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=_o(i);let c;return u;function u(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const m=e.exit("attentionSequence"),v=_o(h),x=!v||v===2&&a||n.includes(h),b=!a||a===2&&v||n.includes(i);return m._open=!!(c===42?x:x&&(a||!b)),m._close=!!(c===42?b:b&&(v||!x)),t(h)}}function Sw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const V8={name:"autolink",tokenize:G8};function G8(e,t,n){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(y){return is(y)?(e.consume(y),u):y===64?n(y):m(y)}function u(y){return y===43||y===45||y===46||Vn(y)?(i=1,f(y)):m(y)}function f(y){return y===58?(e.consume(y),i=0,h):(y===43||y===45||y===46||Vn(y))&&i++<32?(e.consume(y),f):(i=0,m(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||ih(y)?n(y):(e.consume(y),h)}function m(y){return y===64?(e.consume(y),v):D8(y)?(e.consume(y),m):n(y)}function v(y){return Vn(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),i=0,v):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||Vn(y))&&i++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const Tu={partial:!0,tokenize:Y8};function Y8(e,t,n){return i;function i(c){return dt(c)?_t(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||qe(c)?t(c):n(c)}}const cj={continuation:{tokenize:Q8},exit:K8,name:"blockQuote",tokenize:X8};function X8(e,t,n){const i=this;return a;function a(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return dt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function Q8(e,t,n){const i=this;return a;function a(u){return dt(u)?_t(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(cj,t,n)(u)}}function K8(e){e.exit("blockQuote")}const uj={name:"characterEscape",tokenize:W8};function W8(e,t,n){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return $8(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const dj={name:"characterReference",tokenize:Z8};function Z8(e,t,n){const i=this;let a=0,c,u;return f;function f(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),h}function h(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),c=31,u=Vn,v(x))}function m(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=z8,v):(e.enter("characterReferenceValue"),c=7,u=J0,v(x))}function v(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Vn&&!Ix(i.sliceSerialize(b))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(x)&&a++<c?(e.consume(x),v):n(x)}}const kw={partial:!0,tokenize:eR},jw={concrete:!0,name:"codeFenced",tokenize:J8};function J8(e,t,n){const i=this,a={partial:!0,tokenize:O};let c=0,u=0,f;return h;function h(R){return m(R)}function m(R){const F=i.events[i.events.length-1];return c=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(R)}function v(R){return R===f?(u++,e.consume(R),v):u<3?n(R):(e.exit("codeFencedFenceSequence"),dt(R)?_t(e,x,"whitespace")(R):x(R))}function x(R){return R===null||qe(R)?(e.exit("codeFencedFence"),i.interrupt?t(R):e.check(kw,j,L)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(R))}function b(R){return R===null||qe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(R)):dt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_t(e,y,"whitespace")(R)):R===96&&R===f?n(R):(e.consume(R),b)}function y(R){return R===null||qe(R)?x(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(R))}function _(R){return R===null||qe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(R)):R===96&&R===f?n(R):(e.consume(R),_)}function j(R){return e.attempt(a,L,N)(R)}function N(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),S}function S(R){return c>0&&dt(R)?_t(e,C,"linePrefix",c+1)(R):C(R)}function C(R){return R===null||qe(R)?e.check(kw,j,L)(R):(e.enter("codeFlowValue"),E(R))}function E(R){return R===null||qe(R)?(e.exit("codeFlowValue"),C(R)):(e.consume(R),E)}function L(R){return e.exit("codeFenced"),t(R)}function O(R,F,D){let X=0;return P;function P(K){return R.enter("lineEnding"),R.consume(K),R.exit("lineEnding"),Y}function Y(K){return R.enter("codeFencedFence"),dt(K)?_t(R,A,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):A(K)}function A(K){return K===f?(R.enter("codeFencedFenceSequence"),fe(K)):D(K)}function fe(K){return K===f?(X++,R.consume(K),fe):X>=u?(R.exit("codeFencedFenceSequence"),dt(K)?_t(R,te,"whitespace")(K):te(K)):D(K)}function te(K){return K===null||qe(K)?(R.exit("codeFencedFence"),F(K)):D(K)}}}function eR(e,t,n){const i=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const Hg={name:"codeIndented",tokenize:nR},tR={partial:!0,tokenize:sR};function nR(e,t,n){const i=this;return a;function a(m){return e.enter("codeIndented"),_t(e,c,"linePrefix",5)(m)}function c(m){const v=i.events[i.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?u(m):n(m)}function u(m){return m===null?h(m):qe(m)?e.attempt(tR,u,h)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||qe(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),f)}function h(m){return e.exit("codeIndented"),t(m)}}function sR(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):qe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):_t(e,c,"linePrefix",5)(u)}function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):qe(u)?a(u):n(u)}}const iR={name:"codeText",previous:aR,resolve:rR,tokenize:lR};function rR(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function aR(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lR(e,t,n){let i=0,a,c;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),f(x)}function f(x){return x===96?(e.consume(x),i++,f):(e.exit("codeTextSequence"),h(x))}function h(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),h):x===96?(c=e.enter("codeTextSequence"),a=0,v(x)):qe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(x))}function m(x){return x===null||x===32||x===96||qe(x)?(e.exit("codeTextData"),h(x)):(e.consume(x),m)}function v(x){return x===96?(e.consume(x),a++,v):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(c.type="codeTextData",m(x))}}class oR{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Fc(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Fc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fc(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);Fc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fc(this.left,n.reverse())}}}function Fc(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 fj(e){const t={};let n=-1,i,a,c,u,f,h,m;const v=new oR(e);for(;++n<v.length;){for(;n in t;)n=t[n];if(i=v.get(n),n&&i[1].type==="chunkFlow"&&v.get(n-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,cR(v,n)),n=t[n],m=!0);else if(i[1]._container){for(c=n,a=void 0;c--;)if(u=v.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(v.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...v.get(a)[1].start},f=v.slice(a,n),f.unshift(i),v.splice(a,n-a+1,f))}}return Rs(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!m}function cR(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const c=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],m={};let v,x,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);c.push(a),y._tokenizer||(v=i.sliceStream(y),y.next||v.push(null),x&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(v),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),x=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const S=f.slice(N[b],N[b+1]),C=c.pop();h.push([C,C+S.length-1]),e.splice(C,2,S)}for(h.reverse(),b=-1;++b<h.length;)m[_+h[b][0]]=_+h[b][1],_+=h[b][1]-h[b][0]-1;return m}const uR={resolve:fR,tokenize:hR},dR={partial:!0,tokenize:pR};function fR(e){return fj(e),e}function hR(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?c(f):qe(f)?e.check(dR,u,c)(f):(e.consume(f),a)}function c(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function pR(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),_t(e,c,"linePrefix")}function c(u){if(u===null||qe(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function hj(e,t,n,i,a,c,u,f,h){const m=h||Number.POSITIVE_INFINITY;let v=0;return x;function x(S){return S===60?(e.enter(i),e.enter(a),e.enter(c),e.consume(S),e.exit(c),b):S===null||S===32||S===41||ih(S)?n(S):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(S))}function b(S){return S===62?(e.enter(c),e.consume(S),e.exit(c),e.exit(a),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===62?(e.exit("chunkString"),e.exit(f),b(S)):S===null||S===60||qe(S)?n(S):(e.consume(S),S===92?_:y)}function _(S){return S===60||S===62||S===92?(e.consume(S),y):y(S)}function j(S){return!v&&(S===null||S===41||Pt(S))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(S)):v<m&&S===40?(e.consume(S),v++,j):S===41?(e.consume(S),v--,j):S===null||S===32||S===40||ih(S)?n(S):(e.consume(S),S===92?N:j)}function N(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function pj(e,t,n,i,a,c){const u=this;let f=0,h;return m;function m(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(c),v}function v(y){return f>999||y===null||y===91||y===93&&!h||y===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(c),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):qe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||qe(y)||f++>999?(e.exit("chunkString"),v(y)):(e.consume(y),h||(h=!dt(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,x):x(y)}}function mj(e,t,n,i,a,c){let u;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,h):n(b)}function h(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):(e.enter(c),m(b))}function m(b){return b===u?(e.exit(c),h(u)):b===null?n(b):qe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),_t(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===u||b===null||qe(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?x:v)}function x(b){return b===u||b===92?(e.consume(b),v):v(b)}}function au(e,t){let n;return i;function i(a){return qe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):dt(a)?_t(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const mR={name:"definition",tokenize:xR},gR={partial:!0,tokenize:vR};function xR(e,t,n){const i=this;let a;return c;function c(y){return e.enter("definition"),u(y)}function u(y){return pj.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=ci(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return Pt(y)?au(e,m)(y):m(y)}function m(y){return hj(e,v,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(gR,x,x)(y)}function x(y){return dt(y)?_t(e,b,"whitespace")(y):b(y)}function b(y){return y===null||qe(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function vR(e,t,n){return i;function i(f){return Pt(f)?au(e,a)(f):n(f)}function a(f){return mj(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return dt(f)?_t(e,u,"whitespace")(f):u(f)}function u(f){return f===null||qe(f)?t(f):n(f)}}const bR={name:"hardBreakEscape",tokenize:yR};function yR(e,t,n){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return qe(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const _R={name:"headingAtx",resolve:wR,tokenize:SR};function wR(e,t){let n=e.length-2,i=3,a,c;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},c={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Rs(e,i,n-i+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function SR(e,t,n){let i=0;return a;function a(v){return e.enter("atxHeading"),c(v)}function c(v){return e.enter("atxHeadingSequence"),u(v)}function u(v){return v===35&&i++<6?(e.consume(v),u):v===null||Pt(v)?(e.exit("atxHeadingSequence"),f(v)):n(v)}function f(v){return v===35?(e.enter("atxHeadingSequence"),h(v)):v===null||qe(v)?(e.exit("atxHeading"),t(v)):dt(v)?_t(e,f,"whitespace")(v):(e.enter("atxHeadingText"),m(v))}function h(v){return v===35?(e.consume(v),h):(e.exit("atxHeadingSequence"),f(v))}function m(v){return v===null||v===35||Pt(v)?(e.exit("atxHeadingText"),f(v)):(e.consume(v),m)}}const kR=["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"],Nw=["pre","script","style","textarea"],jR={concrete:!0,name:"htmlFlow",resolveTo:ER,tokenize:TR},NR={partial:!0,tokenize:AR},CR={partial:!0,tokenize:MR};function ER(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 TR(e,t,n){const i=this;let a,c,u,f,h;return m;function m(z){return v(z)}function v(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),x}function x(z){return z===33?(e.consume(z),b):z===47?(e.consume(z),c=!0,j):z===63?(e.consume(z),a=3,i.interrupt?t:M):is(z)?(e.consume(z),u=String.fromCharCode(z),N):n(z)}function b(z){return z===45?(e.consume(z),a=2,y):z===91?(e.consume(z),a=5,f=0,_):is(z)?(e.consume(z),a=4,i.interrupt?t:M):n(z)}function y(z){return z===45?(e.consume(z),i.interrupt?t:M):n(z)}function _(z){const B="CDATA[";return z===B.charCodeAt(f++)?(e.consume(z),f===B.length?i.interrupt?t:A:_):n(z)}function j(z){return is(z)?(e.consume(z),u=String.fromCharCode(z),N):n(z)}function N(z){if(z===null||z===47||z===62||Pt(z)){const B=z===47,ce=u.toLowerCase();return!B&&!c&&Nw.includes(ce)?(a=1,i.interrupt?t(z):A(z)):kR.includes(u.toLowerCase())?(a=6,B?(e.consume(z),S):i.interrupt?t(z):A(z)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(z):c?C(z):E(z))}return z===45||Vn(z)?(e.consume(z),u+=String.fromCharCode(z),N):n(z)}function S(z){return z===62?(e.consume(z),i.interrupt?t:A):n(z)}function C(z){return dt(z)?(e.consume(z),C):P(z)}function E(z){return z===47?(e.consume(z),P):z===58||z===95||is(z)?(e.consume(z),L):dt(z)?(e.consume(z),E):P(z)}function L(z){return z===45||z===46||z===58||z===95||Vn(z)?(e.consume(z),L):O(z)}function O(z){return z===61?(e.consume(z),R):dt(z)?(e.consume(z),O):E(z)}function R(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),h=z,F):dt(z)?(e.consume(z),R):D(z)}function F(z){return z===h?(e.consume(z),h=null,X):z===null||qe(z)?n(z):(e.consume(z),F)}function D(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||Pt(z)?O(z):(e.consume(z),D)}function X(z){return z===47||z===62||dt(z)?E(z):n(z)}function P(z){return z===62?(e.consume(z),Y):n(z)}function Y(z){return z===null||qe(z)?A(z):dt(z)?(e.consume(z),Y):n(z)}function A(z){return z===45&&a===2?(e.consume(z),G):z===60&&a===1?(e.consume(z),V):z===62&&a===4?(e.consume(z),Te):z===63&&a===3?(e.consume(z),M):z===93&&a===5?(e.consume(z),ae):qe(z)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(NR,Ce,fe)(z)):z===null||qe(z)?(e.exit("htmlFlowData"),fe(z)):(e.consume(z),A)}function fe(z){return e.check(CR,te,Ce)(z)}function te(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),K}function K(z){return z===null||qe(z)?fe(z):(e.enter("htmlFlowData"),A(z))}function G(z){return z===45?(e.consume(z),M):A(z)}function V(z){return z===47?(e.consume(z),u="",se):A(z)}function se(z){if(z===62){const B=u.toLowerCase();return Nw.includes(B)?(e.consume(z),Te):A(z)}return is(z)&&u.length<8?(e.consume(z),u+=String.fromCharCode(z),se):A(z)}function ae(z){return z===93?(e.consume(z),M):A(z)}function M(z){return z===62?(e.consume(z),Te):z===45&&a===2?(e.consume(z),M):A(z)}function Te(z){return z===null||qe(z)?(e.exit("htmlFlowData"),Ce(z)):(e.consume(z),Te)}function Ce(z){return e.exit("htmlFlow"),t(z)}}function MR(e,t,n){const i=this;return a;function a(u){return qe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function AR(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Tu,t,n)}}const RR={name:"htmlText",tokenize:OR};function OR(e,t,n){const i=this;let a,c,u;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),m):M===47?(e.consume(M),O):M===63?(e.consume(M),E):is(M)?(e.consume(M),D):n(M)}function m(M){return M===45?(e.consume(M),v):M===91?(e.consume(M),c=0,_):is(M)?(e.consume(M),C):n(M)}function v(M){return M===45?(e.consume(M),y):n(M)}function x(M){return M===null?n(M):M===45?(e.consume(M),b):qe(M)?(u=x,V(M)):(e.consume(M),x)}function b(M){return M===45?(e.consume(M),y):x(M)}function y(M){return M===62?G(M):M===45?b(M):x(M)}function _(M){const Te="CDATA[";return M===Te.charCodeAt(c++)?(e.consume(M),c===Te.length?j:_):n(M)}function j(M){return M===null?n(M):M===93?(e.consume(M),N):qe(M)?(u=j,V(M)):(e.consume(M),j)}function N(M){return M===93?(e.consume(M),S):j(M)}function S(M){return M===62?G(M):M===93?(e.consume(M),S):j(M)}function C(M){return M===null||M===62?G(M):qe(M)?(u=C,V(M)):(e.consume(M),C)}function E(M){return M===null?n(M):M===63?(e.consume(M),L):qe(M)?(u=E,V(M)):(e.consume(M),E)}function L(M){return M===62?G(M):E(M)}function O(M){return is(M)?(e.consume(M),R):n(M)}function R(M){return M===45||Vn(M)?(e.consume(M),R):F(M)}function F(M){return qe(M)?(u=F,V(M)):dt(M)?(e.consume(M),F):G(M)}function D(M){return M===45||Vn(M)?(e.consume(M),D):M===47||M===62||Pt(M)?X(M):n(M)}function X(M){return M===47?(e.consume(M),G):M===58||M===95||is(M)?(e.consume(M),P):qe(M)?(u=X,V(M)):dt(M)?(e.consume(M),X):G(M)}function P(M){return M===45||M===46||M===58||M===95||Vn(M)?(e.consume(M),P):Y(M)}function Y(M){return M===61?(e.consume(M),A):qe(M)?(u=Y,V(M)):dt(M)?(e.consume(M),Y):X(M)}function A(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,fe):qe(M)?(u=A,V(M)):dt(M)?(e.consume(M),A):(e.consume(M),te)}function fe(M){return M===a?(e.consume(M),a=void 0,K):M===null?n(M):qe(M)?(u=fe,V(M)):(e.consume(M),fe)}function te(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Pt(M)?X(M):(e.consume(M),te)}function K(M){return M===47||M===62||Pt(M)?X(M):n(M)}function G(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function V(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),se}function se(M){return dt(M)?_t(e,ae,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ae(M)}function ae(M){return e.enter("htmlTextData"),u(M)}}const Hx={name:"labelEnd",resolveAll:$R,resolveTo:BR,tokenize:PR},LR={tokenize:UR},DR={tokenize:FR},zR={tokenize:IR};function $R(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&Rs(e,0,e.length,n),e}function BR(e,t){let n=e.length,i=0,a,c,u,f;for(;n--;)if(a=e[n][1],c){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&&(c=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},v={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",m,t]],f=Vs(f,e.slice(c+1,c+i+3)),f=Vs(f,[["enter",v,t]]),f=Vs(f,bh(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),f=Vs(f,[["exit",v,t],e[u-2],e[u-1],["exit",m,t]]),f=Vs(f,e.slice(u+1)),f=Vs(f,[["exit",h,t]]),Rs(e,c,e.length,f),e}function PR(e,t,n){const i=this;let a=i.events.length,c,u;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){c=i.events[a][1];break}return f;function f(b){return c?c._inactive?x(b):(u=i.parser.defined.includes(ci(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):n(b)}function h(b){return b===40?e.attempt(LR,v,u?v:x)(b):b===91?e.attempt(DR,v,u?m:x)(b):u?v(b):x(b)}function m(b){return e.attempt(zR,v,x)(b)}function v(b){return t(b)}function x(b){return c._balanced=!0,n(b)}}function UR(e,t,n){return i;function i(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return Pt(x)?au(e,c)(x):c(x)}function c(x){return x===41?v(x):hj(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return Pt(x)?au(e,h)(x):v(x)}function f(x){return n(x)}function h(x){return x===34||x===39||x===40?mj(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):v(x)}function m(x){return Pt(x)?au(e,v)(x):v(x)}function v(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function FR(e,t,n){const i=this;return a;function a(f){return pj.call(i,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes(ci(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function IR(e,t,n){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const HR={name:"labelStartImage",resolveAll:Hx.resolveAll,tokenize:qR};function qR(e,t,n){const i=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):t(f)}}const VR={name:"labelStartLink",resolveAll:Hx.resolveAll,tokenize:GR};function GR(e,t,n){const i=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const qg={name:"lineEnding",tokenize:YR};function YR(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),_t(e,t,"linePrefix")}}const Df={name:"thematicBreak",tokenize:XR};function XR(e,t,n){let i=0,a;return c;function c(m){return e.enter("thematicBreak"),u(m)}function u(m){return a=m,f(m)}function f(m){return m===a?(e.enter("thematicBreakSequence"),h(m)):i>=3&&(m===null||qe(m))?(e.exit("thematicBreak"),t(m)):n(m)}function h(m){return m===a?(e.consume(m),i++,h):(e.exit("thematicBreakSequence"),dt(m)?_t(e,f,"whitespace")(m):f(m))}}const ms={continuation:{tokenize:ZR},exit:e7,name:"list",tokenize:WR},QR={partial:!0,tokenize:t7},KR={partial:!0,tokenize:JR};function WR(e,t,n){const i=this,a=i.events[i.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return f;function f(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:J0(y)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Df,n,m)(y):m(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return J0(y)&&++u<10?(e.consume(y),h):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),m(y)):n(y)}function m(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Tu,i.interrupt?n:v,e.attempt(QR,b,x))}function v(y){return i.containerState.initialBlankLine=!0,c++,b(y)}function x(y){return dt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function ZR(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Tu,a,c);function a(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,_t(e,t,"listItemIndent",i.containerState.size+1)(f)}function c(f){return i.containerState.furtherBlankLines||!dt(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(KR,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,_t(e,e.attempt(ms,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function JR(e,t,n){const i=this;return _t(e,a,"listItemIndent",i.containerState.size+1);function a(c){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(c):n(c)}}function e7(e){e.exit(this.containerState.type)}function t7(e,t,n){const i=this;return _t(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const u=i.events[i.events.length-1];return!dt(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Cw={name:"setextUnderline",resolveTo:n7,tokenize:s7};function n7(e,t){let n=e.length,i,a,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",c?(e.splice(a,0,["enter",u,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function s7(e,t,n){const i=this;let a;return c;function c(m){let v=i.events.length,x;for(;v--;)if(i.events[v][1].type!=="lineEnding"&&i.events[v][1].type!=="linePrefix"&&i.events[v][1].type!=="content"){x=i.events[v][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||x)?(e.enter("setextHeadingLine"),a=m,u(m)):n(m)}function u(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===a?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),dt(m)?_t(e,h,"lineSuffix")(m):h(m))}function h(m){return m===null||qe(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const i7={tokenize:r7};function r7(e){const t=this,n=e.attempt(Tu,i,e.attempt(this.parser.constructs.flowInitial,a,_t(e,e.attempt(this.parser.constructs.flow,a,e.attempt(uR,a)),"linePrefix")));return n;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const a7={resolveAll:xj()},l7=gj("string"),o7=gj("text");function gj(e){return{resolveAll:xj(e==="text"?c7:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],c=n.attempt(a,u,f);return u;function u(v){return m(v)?c(v):f(v)}function f(v){if(v===null){n.consume(v);return}return n.enter("data"),n.consume(v),h}function h(v){return m(v)?(n.exit("data"),c(v)):(n.consume(v),h)}function m(v){if(v===null)return!0;const x=a[v];let b=-1;if(x)for(;++b<x.length;){const y=x[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function xj(e){return t;function t(n,i){let a=-1,c;for(;++a<=n.length;)c===void 0?n[a]&&n[a][1].type==="data"&&(c=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==c+2&&(n[c][1].end=n[a-1][1].end,n.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(n,i):n}}function c7(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let c=a.length,u=-1,f=0,h;for(;c--;){const m=a[c];if(typeof m=="string"){for(u=m.length;m.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(m===-2)h=!0,f++;else if(m!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const m={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:i.start._bufferIndex+u,_index:i.start._index+c,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...m.start},i.start.offset===i.end.offset?Object.assign(i,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const u7={42:ms,43:ms,45:ms,48:ms,49:ms,50:ms,51:ms,52:ms,53:ms,54:ms,55:ms,56:ms,57:ms,62:cj},d7={91:mR},f7={[-2]:Hg,[-1]:Hg,32:Hg},h7={35:_R,42:Df,45:[Cw,Df],60:jR,61:Cw,95:Df,96:jw,126:jw},p7={38:dj,92:uj},m7={[-5]:qg,[-4]:qg,[-3]:qg,33:HR,38:dj,42:ex,60:[V8,RR],91:VR,92:[bR,uj],93:Hx,95:ex,96:iR},g7={null:[ex,a7]},x7={null:[42,95]},v7={null:[]},b7=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:x7,contentInitial:d7,disable:v7,document:u7,flow:h7,flowInitial:f7,insideSpan:g7,string:p7,text:m7},Symbol.toStringTag,{value:"Module"}));function y7(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},c=[];let u=[],f=[];const h={attempt:F(O),check:F(R),consume:C,enter:E,exit:L,interrupt:F(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:x};let v=t.tokenize.call(m,h);return t.resolveAll&&c.push(t),m;function x(Y){return u=Vs(u,Y),N(),u[u.length-1]!==null?[]:(D(t,0),m.events=bh(c,m.events,m),m.events)}function b(Y,A){return w7(y(Y),A)}function y(Y){return _7(u,Y)}function _(){const{_bufferIndex:Y,_index:A,line:fe,column:te,offset:K}=i;return{_bufferIndex:Y,_index:A,line:fe,column:te,offset:K}}function j(Y){a[Y.line]=Y.column,P()}function N(){let Y;for(;i._index<u.length;){const A=u[i._index];if(typeof A=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<A.length;)S(A.charCodeAt(i._bufferIndex));else S(A)}}function S(Y){v=v(Y)}function C(Y){qe(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,P()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),m.previous=Y}function E(Y,A){const fe=A||{};return fe.type=Y,fe.start=_(),m.events.push(["enter",fe,m]),f.push(fe),fe}function L(Y){const A=f.pop();return A.end=_(),m.events.push(["exit",A,m]),A}function O(Y,A){D(Y,A.from)}function R(Y,A){A.restore()}function F(Y,A){return fe;function fe(te,K,G){let V,se,ae,M;return Array.isArray(te)?Ce(te):"tokenize"in te?Ce([te]):Te(te);function Te(ye){return Ne;function Ne(Ae){const Le=Ae!==null&&ye[Ae],De=Ae!==null&&ye.null,Ee=[...Array.isArray(Le)?Le:Le?[Le]:[],...Array.isArray(De)?De:De?[De]:[]];return Ce(Ee)(Ae)}}function Ce(ye){return V=ye,se=0,ye.length===0?G:z(ye[se])}function z(ye){return Ne;function Ne(Ae){return M=X(),ae=ye,ye.partial||(m.currentConstruct=ye),ye.name&&m.parser.constructs.disable.null.includes(ye.name)?ce():ye.tokenize.call(A?Object.assign(Object.create(m),A):m,h,B,ce)(Ae)}}function B(ye){return Y(ae,M),K}function ce(ye){return M.restore(),++se<V.length?z(V[se]):G}}}function D(Y,A){Y.resolveAll&&!c.includes(Y)&&c.push(Y),Y.resolve&&Rs(m.events,A,m.events.length-A,Y.resolve(m.events.slice(A),m)),Y.resolveTo&&(m.events=Y.resolveTo(m.events,m))}function X(){const Y=_(),A=m.previous,fe=m.currentConstruct,te=m.events.length,K=Array.from(f);return{from:te,restore:G};function G(){i=Y,m.previous=A,m.currentConstruct=fe,m.events.length=te,f=K,P()}}function P(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function _7(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,c)];else{if(u=e.slice(n,a),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}c>0&&u.push(e[a].slice(0,c))}return u}function w7(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
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(c)}a=c===-2,i.push(u)}return i.join("")}function S7(e){const i={constructs:lj([b7,...(e||{}).extensions||[]]),content:a(B8),defined:[],document:a(U8),flow:a(i7),lazy:{},string:a(l7),text:a(o7)};return i;function a(c){return u;function u(f){return y7(i,c,f)}}}function k7(e){for(;!fj(e););return e}const Ew=/[\0\t\n\r]/g;function j7(){let e=1,t="",n=!0,i;return a;function a(c,u,f){const h=[];let m,v,x,b,y;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),x=0,t="",n&&(c.charCodeAt(0)===65279&&x++,n=void 0);x<c.length;){if(Ew.lastIndex=x,m=Ew.exec(c),b=m&&m.index!==void 0?m.index:c.length,y=c.charCodeAt(b),!m){t=c.slice(x);break}if(y===10&&x===b&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),x<b&&(h.push(c.slice(x,b)),e+=b-x),y){case 0:{h.push(65533),e++;break}case 9:{for(v=Math.ceil(e/4)*4,h.push(-2);e++<v;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}x=b+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const N7=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function C7(e){return e.replace(N7,E7)}function E7(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return oj(n.slice(c?2:1),c?16:10)}return Ix(n)||e}const vj={}.hasOwnProperty;function T7(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),M7(n)(k7(S7(n).document().write(j7()(e,t,!0))))}function M7(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(St),autolinkProtocol:X,autolinkEmail:X,atxHeading:c(Ft),blockQuote:c(De),characterEscape:X,characterReference:X,codeFenced:c(Ee),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Ee,u),codeText:c(Re,u),codeTextData:X,data:X,codeFlowValue:X,definition:c(Ut),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Qt),hardBreakEscape:c(jt),hardBreakTrailing:c(jt),htmlFlow:c(wt,u),htmlFlowData:X,htmlText:c(wt,u),htmlTextData:X,image:c(Xe),label:u,link:c(St),listItem:c(ne),listItemValue:b,listOrdered:c(nn,x),listUnordered:c(nn),paragraph:c(je),reference:z,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Ft),strong:c(Ye),thematicBreak:c(un)},exit:{atxHeading:h(),atxHeadingSequence:O,autolink:h(),autolinkEmail:Le,autolinkProtocol:Ae,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:ye,characterReference:Ne,codeFenced:h(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:P,codeIndented:h(S),codeText:h(K),codeTextData:P,data:P,definition:h(),definitionDestinationString:L,definitionLabelString:C,definitionTitleString:E,emphasis:h(),hardBreakEscape:h(A),hardBreakTrailing:h(A),htmlFlow:h(fe),htmlFlowData:P,htmlText:h(te),htmlTextData:P,image:h(V),label:ae,labelText:se,lineEnding:Y,link:h(G),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:B,resourceDestinationString:M,resourceTitleString:Te,resource:Ce,setextHeading:h(D),setextHeadingLineSequence:F,setextHeadingText:R,strong:h(),thematicBreak:h()}};bj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ue){let be={type:"root",children:[]};const H={stack:[be],tokenStack:[],config:t,enter:f,exit:m,buffer:u,resume:v,data:n},ge=[];let Pe=-1;for(;++Pe<ue.length;)if(ue[Pe][1].type==="listOrdered"||ue[Pe][1].type==="listUnordered")if(ue[Pe][0]==="enter")ge.push(Pe);else{const We=ge.pop();Pe=a(ue,We,Pe)}for(Pe=-1;++Pe<ue.length;){const We=t[ue[Pe][0]];vj.call(We,ue[Pe][1].type)&&We[ue[Pe][1].type].call(Object.assign({sliceSerialize:ue[Pe][2].sliceSerialize},H),ue[Pe][1])}if(H.tokenStack.length>0){const We=H.tokenStack[H.tokenStack.length-1];(We[1]||Tw).call(H,void 0,We[0])}for(be.position={start:na(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:na(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)be=t.transforms[Pe](be)||be;return be}function a(ue,be,H){let ge=be-1,Pe=-1,We=!1,at,ft,hn,rs;for(;++ge<=H;){const Ct=ue[ge];switch(Ct[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ct[0]==="enter"?Pe++:Pe--,rs=void 0;break}case"lineEndingBlank":{Ct[0]==="enter"&&(at&&!rs&&!Pe&&!hn&&(hn=ge),rs=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:rs=void 0}if(!Pe&&Ct[0]==="enter"&&Ct[1].type==="listItemPrefix"||Pe===-1&&Ct[0]==="exit"&&(Ct[1].type==="listUnordered"||Ct[1].type==="listOrdered")){if(at){let bs=ge;for(ft=void 0;bs--;){const In=ue[bs];if(In[1].type==="lineEnding"||In[1].type==="lineEndingBlank"){if(In[0]==="exit")continue;ft&&(ue[ft][1].type="lineEndingBlank",We=!0),In[1].type="lineEnding",ft=bs}else if(!(In[1].type==="linePrefix"||In[1].type==="blockQuotePrefix"||In[1].type==="blockQuotePrefixWhitespace"||In[1].type==="blockQuoteMarker"||In[1].type==="listItemIndent"))break}hn&&(!ft||hn<ft)&&(at._spread=!0),at.end=Object.assign({},ft?ue[ft][1].start:Ct[1].end),ue.splice(ft||ge,0,["exit",at,Ct[2]]),ge++,H++}if(Ct[1].type==="listItemPrefix"){const bs={type:"listItem",_spread:!1,start:Object.assign({},Ct[1].start),end:void 0};at=bs,ue.splice(ge,0,["enter",bs,Ct[2]]),ge++,H++,hn=void 0,rs=!0}}}return ue[be][1]._spread=We,H}function c(ue,be){return H;function H(ge){f.call(this,ue(ge),ge),be&&be.call(this,ge)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ue,be,H){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([be,H||void 0]),ue.position={start:na(be.start),end:void 0}}function h(ue){return be;function be(H){ue&&ue.call(this,H),m.call(this,H)}}function m(ue,be){const H=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==ue.type&&(be?be.call(this,ue,ge[0]):(ge[1]||Tw).call(this,ue,ge[0]));else throw new Error("Cannot close `"+ue.type+"` ("+ru({start:ue.start,end:ue.end})+"): it’s not open");H.position.end=na(ue.end)}function v(){return Fx(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.lang=ue}function _(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.meta=ue}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/(\r?\n|\r)$/g,"")}function C(ue){const be=this.resume(),H=this.stack[this.stack.length-1];H.label=be,H.identifier=ci(this.sliceSerialize(ue)).toLowerCase()}function E(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function L(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function O(ue){const be=this.stack[this.stack.length-1];if(!be.depth){const H=this.sliceSerialize(ue).length;be.depth=H}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function F(ue){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function X(ue){const H=this.stack[this.stack.length-1].children;let ge=H[H.length-1];(!ge||ge.type!=="text")&&(ge=Je(),ge.position={start:na(ue.start),end:void 0},H.push(ge)),this.stack.push(ge)}function P(ue){const be=this.stack.pop();be.value+=this.sliceSerialize(ue),be.position.end=na(ue.end)}function Y(ue){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const H=be.children[be.children.length-1];H.position.end=na(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(X.call(this,ue),P.call(this,ue))}function A(){this.data.atHardBreak=!0}function fe(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function te(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function K(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function G(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function V(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function se(ue){const be=this.sliceSerialize(ue),H=this.stack[this.stack.length-2];H.label=C7(be),H.identifier=ci(be).toLowerCase()}function ae(){const ue=this.stack[this.stack.length-1],be=this.resume(),H=this.stack[this.stack.length-1];if(this.data.inReference=!0,H.type==="link"){const ge=ue.children;H.children=ge}else H.alt=be}function M(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function Te(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function Ce(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function B(ue){const be=this.resume(),H=this.stack[this.stack.length-1];H.label=be,H.identifier=ci(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function ce(ue){this.data.characterReferenceType=ue.type}function ye(ue){const be=this.sliceSerialize(ue),H=this.data.characterReferenceType;let ge;H?(ge=oj(be,H==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=Ix(be);const Pe=this.stack[this.stack.length-1];Pe.value+=ge}function Ne(ue){const be=this.stack.pop();be.position.end=na(ue.end)}function Ae(ue){P.call(this,ue);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ue)}function Le(ue){P.call(this,ue);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ue)}function De(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function Ut(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Qt(){return{type:"emphasis",children:[]}}function Ft(){return{type:"heading",depth:0,children:[]}}function jt(){return{type:"break"}}function wt(){return{type:"html",value:""}}function Xe(){return{type:"image",title:null,url:"",alt:null}}function St(){return{type:"link",title:null,url:"",children:[]}}function nn(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function ne(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function je(){return{type:"paragraph",children:[]}}function Ye(){return{type:"strong",children:[]}}function Je(){return{type:"text",value:""}}function un(){return{type:"thematicBreak"}}}function na(e){return{line:e.line,column:e.column,offset:e.offset}}function bj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?bj(e,i):A7(e,i)}}function A7(e,t){let n;for(n in t)if(vj.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function Tw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ru({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+") is still open")}function R7(e){const t=this;t.parser=n;function n(i){return T7(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function O7(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 L7(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
-
`}]}function D7(e,t){const n=t.value?t.value+`
|
|
76
|
-
`:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function z7(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $7(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function B7(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=No(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let u,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=c+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const m={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,m),e.applyData(t,m)}function P7(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 U7(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yj(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function F7(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return yj(e,t);const a={src:No(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function I7(e,t){const n={src:No(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function H7(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function q7(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return yj(e,t);const a={href:No(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function V7(e,t){const n={href:No(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function G7(e,t,n){const i=e.all(t),a=n?Y7(n):_j(t),c={},u=[];if(typeof t.checked=="boolean"){const v=i[0];let x;v&&v.type==="element"&&v.tagName==="p"?x=v:(x={type:"element",tagName:"p",properties:{},children:[]},i.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const v=i[f];(a||f!==0||v.type!=="element"||v.tagName!=="p")&&u.push({type:"text",value:`
|
|
77
|
-
`}),v.type==="element"&&v.tagName==="p"&&!a?u.push(...v.children):u.push(v)}const h=i[i.length-1];h&&(a||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
|
|
78
|
-
`});const m={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,m),e.applyData(t,m)}function Y7(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=_j(n[i])}return t}function _j(e){const t=e.spread;return t??e.children.length>1}function X7(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const u=i[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,c),e.applyData(t,c)}function Q7(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K7(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function W7(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Z7(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=$x(t.children[1]),h=ej(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),a.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function J7(e,t,n){const i=n?n.children:void 0,c=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,f=u?u.length:t.children.length;let h=-1;const m=[];for(;++h<f;){const x=t.children[h],b={},y=u?u[h]:void 0;y&&(b.align=y);let _={type:"element",tagName:c,properties:b,children:[]};x&&(_.children=e.all(x),e.patch(x,_),_=e.applyData(x,_)),m.push(_)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,v),e.applyData(t,v)}function eO(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Mw=9,Aw=32;function tO(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const c=[];for(;i;)c.push(Rw(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return c.push(Rw(t.slice(a),a>0,!1)),c.join("")}function Rw(e,t,n){let i=0,a=e.length;if(t){let c=e.codePointAt(i);for(;c===Mw||c===Aw;)i++,c=e.codePointAt(i)}if(n){let c=e.codePointAt(a-1);for(;c===Mw||c===Aw;)a--,c=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function nO(e,t){const n={type:"text",value:tO(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function sO(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const iO={blockquote:O7,break:L7,code:D7,delete:z7,emphasis:$7,footnoteReference:B7,heading:P7,html:U7,imageReference:F7,image:I7,inlineCode:H7,linkReference:q7,link:V7,listItem:G7,list:X7,paragraph:Q7,root:K7,strong:W7,table:Z7,tableCell:eO,tableRow:J7,text:nO,thematicBreak:sO,toml:xf,yaml:xf,definition:xf,footnoteDefinition:xf};function xf(){}const wj=-1,yh=0,lu=1,rh=2,qx=3,Vx=4,Gx=5,Yx=6,Sj=7,kj=8,{defineProperty:rO}=Object,jj=typeof self=="object"?self:globalThis,Ow=(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 jj[e](t)},aO=(e,t)=>{const n=(a,c)=>(e.set(c,a),a),i=a=>{if(e.has(a))return e.get(a);const[c,u]=t[a];switch(c){case yh:case wj:return n(u,a);case lu:{const f=n([],a);for(const h of u)f.push(i(h));return f}case rh:{const f=n({},a);for(const[h,m]of u){const v=i(h),x=i(m);v==="__proto__"?rO(f,v,{value:x,configurable:!0,enumerable:!0,writable:!0}):f[v]=x}return f}case qx:return n(new Date(u),a);case Vx:{const{source:f,flags:h}=u;return n(new RegExp(f,h),a)}case Gx:{const f=n(new Map,a);for(const[h,m]of u)f.set(i(h),i(m));return f}case Yx:{const f=n(new Set,a);for(const h of u)f.add(i(h));return f}case Sj:{const{name:f,message:h}=u;return n(typeof jj[f]=="function"?Ow(f,h):new Error(h),a)}case kj:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return n(new DataView(f),u)}case"-0":return-0}return n(Ow(c,u),a)};return i},Lw=e=>aO(new Map,e)(0),Ja="",{toString:lO}={},{keys:oO,is:cO}=Object,Ic=e=>{const t=typeof e;if(t!=="object"||!e)return[yh,t];const n=lO.call(e).slice(8,-1);switch(n){case"Array":return[lu,Ja];case"Object":return[rh,Ja];case"Date":return[qx,Ja];case"RegExp":return[Vx,Ja];case"Map":return[Gx,Ja];case"Set":return[Yx,Ja];case"DataView":return[lu,n]}return n.includes("Array")?[lu,n]:e instanceof Error?[Sj,e.name||"Error"]:[rh,n]},vf=([e,t])=>e===yh&&(t==="function"||t==="symbol"),uO=(e,t,n,i)=>{const a=(u,f)=>{const h=i.push(u)-1;return n.set(f,h),h},c=u=>{if(n.has(u))return n.get(u);let[f,h]=Ic(u);switch(f){case yh:{let v=u;switch(h){case"bigint":f=kj,v=u.toString();break;case"number":if(!u&&cO(u,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);v=null;break;case"undefined":return a([wj],u)}return a([f,v],u)}case lu:{if(h){let b=u;return h==="DataView"?b=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(u)),a([h,[...b]],u)}const v=[],x=a([f,v],u);for(const b of u)v.push(c(b));return x}case rh:{if(h)switch(h){case"BigInt":return a([h,u.toString()],u);case"Boolean":case"Number":case"String":return a([h,u.valueOf()],u)}if(t&&"toJSON"in u)return c(u.toJSON());const v=[],x=a([f,v],u);for(const b of oO(u))(e||!vf(Ic(u[b])))&&v.push([c(b),c(u[b])]);return x}case qx:return a([f,isNaN(u.getTime())?Ja:u.toISOString()],u);case Vx:{const{source:v,flags:x}=u;return a([f,{source:v,flags:x}],u)}case Gx:{const v=[],x=a([f,v],u);for(const[b,y]of u)(e||!(vf(Ic(b))||vf(Ic(y))))&&v.push([c(b),c(y)]);return x}case Yx:{const v=[],x=a([f,v],u);for(const b of u)(e||!vf(Ic(b)))&&v.push(c(b));return x}}const{message:m}=u;return a([f,{name:h,message:m}],u)};return c},Dw=(e,{json:t,lossy:n}={})=>{const i=[];return uO(!(t||n),!!t,new Map,i)(e),i},ah=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Lw(Dw(e,t)):structuredClone(e):(e,t)=>Lw(Dw(e,t));function dO(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 fO(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hO(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dO,i=e.options.footnoteBackLabel||fO,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let h=-1;for(;++h<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[h]);if(!m)continue;const v=e.all(m),x=String(m.identifier).toUpperCase(),b=No(x.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let C=typeof n=="string"?n:n(h,y);typeof C=="string"&&(C={type:"text",value:C}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(h,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const N=v[v.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const C=N.children[N.children.length-1];C&&C.type==="text"?C.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(..._)}else v.push(..._);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(v,!0)};e.patch(m,S),f.push(S)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...ah(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
79
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
80
|
-
`}]}}const _h=(function(e){if(e==null)return xO;if(typeof e=="function")return wh(e);if(typeof e=="object")return Array.isArray(e)?pO(e):mO(e);if(typeof e=="string")return gO(e);throw new Error("Expected function, string, or object as test")});function pO(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=_h(e[n]);return wh(i);function i(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function mO(e){const t=e;return wh(n);function n(i){const a=i;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function gO(e){return wh(t);function t(n){return n&&n.type===e}}function wh(e){return t;function t(n,i,a){return!!(vO(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function xO(){return!0}function vO(e){return e!==null&&typeof e=="object"&&"type"in e}const Nj=[],bO=!0,tx=!1,yO="skip";function Cj(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const c=_h(a),u=i?-1:1;f(e,void 0,[])();function f(h,m,v){const x=h&&typeof h=="object"?h:{};if(typeof x.type=="string"){const y=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=Nj,_,j,N;if((!t||c(h,m,v[v.length-1]||void 0))&&(y=_O(n(h,v)),y[0]===tx))return y;if("children"in h&&h.children){const S=h;if(S.children&&y[0]!==yO)for(j=(i?S.children.length:-1)+u,N=v.concat(S);j>-1&&j<S.children.length;){const C=S.children[j];if(_=f(C,j,N)(),_[0]===tx)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function _O(e){return Array.isArray(e)?e:typeof e=="number"?[bO,e]:e==null?Nj:[e]}function Xx(e,t,n,i){let a,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,a=n):(c=t,u=n,a=i),Cj(e,c,f,a);function f(h,m){const v=m[m.length-1],x=v?v.children.indexOf(h):void 0;return u(h,x,v)}}const nx={}.hasOwnProperty,wO={};function SO(e,t){const n=t||wO,i=new Map,a=new Map,c=new Map,u={...iO,...n.handlers},f={all:m,applyData:jO,definitionById:i,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:u,one:h,options:n,patch:kO,wrap:CO};return Xx(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const x=v.type==="definition"?i:a,b=String(v.identifier).toUpperCase();x.has(b)||x.set(b,v)}}),f;function h(v,x){const b=v.type,y=f.handlers[b];if(nx.call(f.handlers,b)&&y)return y(f,v,x);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in v){const{children:j,...N}=v,S=ah(N);return S.children=f.all(v),S}return ah(v)}return(f.options.unknownHandler||NO)(f,v,x)}function m(v){const x=[];if("children"in v){const b=v.children;let y=-1;for(;++y<b.length;){const _=f.one(b[y],v);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=zw(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=zw(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function kO(e,t){e.position&&(t.position=u8(e))}function jO(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,ah(c)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function NO(e,t){const n=t.data||{},i="value"in t&&!(nx.call(n,"hProperties")||nx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function CO(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
|
|
81
|
-
`});++i<e.length;)i&&n.push({type:"text",value:`
|
|
82
|
-
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
83
|
-
`}),n}function zw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function $w(e,t){const n=SO(e,t),i=n.one(e,void 0),a=hO(n),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
|
|
84
|
-
`},a),c}function EO(e,t){return e&&"run"in e?async function(n,i){const a=$w(n,{file:i,...t});await e.run(a,i)}:function(n,i){return $w(n,{file:i,...e||t})}}function Bw(e){if(e)throw e}var Vg,Pw;function TO(){if(Pw)return Vg;Pw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},c=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var v=e.call(m,"constructor"),x=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!v&&!x)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},u=function(m,v){n&&v.name==="__proto__"?n(m,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):m[v.name]=v.newValue},f=function(m,v){if(v==="__proto__")if(e.call(m,v)){if(i)return i(m,v).value}else return;return m[v]};return Vg=function h(){var m,v,x,b,y,_,j=arguments[0],N=1,S=arguments.length,C=!1;for(typeof j=="boolean"&&(C=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<S;++N)if(m=arguments[N],m!=null)for(v in m)x=f(j,v),b=f(m,v),j!==b&&(C&&b&&(c(b)||(y=a(b)))?(y?(y=!1,_=x&&a(x)?x:[]):_=x&&c(x)?x:{},u(j,{name:v,newValue:h(C,_,b)})):typeof b<"u"&&u(j,{name:v,newValue:b}));return j},Vg}var MO=TO();const Gg=ux(MO);function sx(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 AO(){const e=[],t={run:n,use:i};return t;function n(...a){let c=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...a);function f(h,...m){const v=e[++c];let x=-1;if(h){u(h);return}for(;++x<a.length;)(m[x]===null||m[x]===void 0)&&(m[x]=a[x]);a=m,v?RO(v,f)(...m):u(null,...m)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function RO(e,t){let n;return i;function i(...u){const f=e.length>u.length;let h;f&&u.push(a);try{h=e.apply(this,u)}catch(m){const v=m;if(f&&n)throw v;return a(v)}f||(h&&h.then&&typeof h.then=="function"?h.then(c,a):h instanceof Error?a(h):c(h))}function a(u,...f){n||(n=!0,t(u,...f))}function c(u){a(null,u)}}const Mi={basename:OO,dirname:LO,extname:DO,join:zO,sep:"/"};function OO(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mu(e);let n=0,i=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else i<0&&(c=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else u<0&&(c=!0,u=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(i=a):(f=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function LO(e){if(Mu(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function DO(e){Mu(e);let t=e.length,n=-1,i=0,a=-1,c=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?a<0?a=t:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||n<0||c===0||c===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function zO(...e){let t=-1,n;for(;++t<e.length;)Mu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$O(n)}function $O(e){Mu(e);const t=e.codePointAt(0)===47;let n=BO(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function BO(e,t){let n="",i=0,a=-1,c=0,u=-1,f,h;for(;++u<=e.length;){if(u<e.length)f=e.codePointAt(u);else{if(f===47)break;f=47}if(f===47){if(!(a===u-1||c===1))if(a!==u-1&&c===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",i=0):(n=n.slice(0,h),i=n.length-1-n.lastIndexOf("/")),a=u,c=0;continue}}else if(n.length>0){n="",i=0,a=u,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),i=u-a-1;a=u,c=0}else f===46&&c>-1?c++:c=-1}return n}function Mu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const PO={cwd:UO};function UO(){return"/"}function ix(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function FO(e){if(typeof e=="string")e=new URL(e);else if(!ix(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 IO(e)}function IO(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Yg=["history","path","basename","stem","extname","dirname"];class Ej{constructor(t){let n;t?ix(t)?n={path:t}:typeof t=="string"||HO(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":PO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Yg.length;){const c=Yg[i];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let a;for(a in n)Yg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Mi.basename(this.path):void 0}set basename(t){Qg(t,"basename"),Xg(t,"basename"),this.path=Mi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mi.dirname(this.path):void 0}set dirname(t){Uw(this.basename,"dirname"),this.path=Mi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mi.extname(this.path):void 0}set extname(t){if(Xg(t,"extname"),Uw(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=Mi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ix(t)&&(t=FO(t)),Qg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mi.basename(this.path,this.extname):void 0}set stem(t){Qg(t,"stem"),Xg(t,"stem"),this.path=Mi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new Yn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xg(e,t){if(e&&e.includes(Mi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mi.sep+"`")}function Qg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Uw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function HO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qO=(function(e){const i=this.constructor.prototype,a=i[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),VO={}.hasOwnProperty;class Qx extends qO{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=AO()}copy(){const t=new Qx;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Gg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Zg("data",this.frozen),this.namespace[t]=n,this):VO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Zg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=bf(t),i=this.parser||this.Parser;return Kg("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Kg("process",this.parser||this.Parser),Wg("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(c,u){const f=bf(t),h=i.parse(f);i.run(h,f,function(v,x,b){if(v||!x||!b)return m(v);const y=x,_=i.stringify(y,b);XO(_)?b.value=_:b.result=_,m(v,b)});function m(v,x){v||!x?u(v):c?c(x):n(void 0,x)}}}processSync(t){let n=!1,i;return this.freeze(),Kg("processSync",this.parser||this.Parser),Wg("processSync",this.compiler||this.Compiler),this.process(t,a),Iw("processSync","process",n),i;function a(c,u){n=!0,Bw(c),i=u}}run(t,n,i){Fw(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?c(void 0,i):new Promise(c);function c(u,f){const h=bf(n);a.run(t,h,m);function m(v,x,b){const y=x||t;v?f(v):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,c),Iw("runSync","run",i),a;function c(u,f){Bw(u),a=f,i=!0}}stringify(t,n){this.freeze();const i=bf(n),a=this.compiler||this.Compiler;return Wg("stringify",a),Fw(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(Zg("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(m){if(typeof m=="function")h(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[v,...x]=m;h(v,x)}else u(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function u(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(m.plugins),m.settings&&(a.settings=Gg(!0,a.settings,m.settings))}function f(m){let v=-1;if(m!=null)if(Array.isArray(m))for(;++v<m.length;){const x=m[v];c(x)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function h(m,v){let x=-1,b=-1;for(;++x<i.length;)if(i[x][0]===m){b=x;break}if(b===-1)i.push([m,...v]);else if(v.length>0){let[y,..._]=v;const j=i[b][1];sx(j)&&sx(y)&&(y=Gg(!0,j,y)),i[b]=[m,y,..._]}}}}const GO=new Qx().freeze();function Kg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Wg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Zg(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 Fw(e){if(!sx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Iw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bf(e){return YO(e)?e:new Ej(e)}function YO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function XO(e){return typeof e=="string"||QO(e)}function QO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const KO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hw=[],qw={allowDangerousHtml:!0},WO=/^(https?|ircs?|mailto|xmpp)$/i,ZO=[{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 Kx(e){const t=JO(e),n=eL(e);return tL(t.runSync(t.parse(n),n),e)}function JO(e){const t=e.rehypePlugins||Hw,n=e.remarkPlugins||Hw,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...qw}:qw;return GO().use(R7).use(n).use(EO,i).use(t)}function eL(e){const t=e.children||"",n=new Ej;return typeof t=="string"&&(n.value=t),n}function tL(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,c=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||nL;for(const v of ZO)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+KO+v.id,void 0);return Xx(e,m),m8(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function m(v,x,b){if(v.type==="raw"&&b&&typeof x=="number")return u?b.children.splice(x,1):b.children[x]={type:"text",value:v.value},x;if(v.type==="element"){let y;for(y in Ig)if(Object.hasOwn(Ig,y)&&Object.hasOwn(v.properties,y)){const _=v.properties[y],j=Ig[y];(j===null||j.includes(v.tagName))&&(v.properties[y]=h(String(_||""),y,v))}}if(v.type==="element"){let y=n?!n.includes(v.tagName):c?c.includes(v.tagName):!1;if(!y&&i&&typeof x=="number"&&(y=!i(v,x,b)),y&&b&&typeof x=="number")return f&&v.children?b.children.splice(x,1,...v.children):b.children.splice(x,1),x}}}function nL(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||WO.test(e.slice(0,t))?e:""}function Vw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function sL(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iL(e,t,n){const a=_h((n||{}).ignore||[]),c=rL(t);let u=-1;for(;++u<c.length;)Cj(e,"text",f);function f(m,v){let x=-1,b;for(;++x<v.length;){const y=v[x],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return h(m,v)}function h(m,v){const x=v[v.length-1],b=c[u][0],y=c[u][1];let _=0;const N=x.children.indexOf(m);let S=!1,C=[];b.lastIndex=0;let E=b.exec(m.value);for(;E;){const L=E.index,O={index:E.index,input:E.input,stack:[...v,m]};let R=y(...E,O);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?b.lastIndex=L+1:(_!==L&&C.push({type:"text",value:m.value.slice(_,L)}),Array.isArray(R)?C.push(...R):R&&C.push(R),_=L+E[0].length,S=!0),!b.global)break;E=b.exec(m.value)}return S?(_<m.value.length&&C.push({type:"text",value:m.value.slice(_)}),x.children.splice(N,1,...C)):C=[m],N+C.length}}function rL(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([aL(a[0]),lL(a[1])])}return t}function aL(e){return typeof e=="string"?new RegExp(sL(e),"g"):e}function lL(e){return typeof e=="function"?e:function(){return e}}const Jg="phrasing",e0=["autolink","link","image","label"];function oL(){return{transforms:[mL],enter:{literalAutolink:uL,literalAutolinkEmail:t0,literalAutolinkHttp:t0,literalAutolinkWww:t0},exit:{literalAutolink:pL,literalAutolinkEmail:hL,literalAutolinkHttp:dL,literalAutolinkWww:fL}}}function cL(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jg,notInConstruct:e0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jg,notInConstruct:e0},{character:":",before:"[ps]",after:"\\/",inConstruct:Jg,notInConstruct:e0}]}}function uL(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function t0(e){this.config.enter.autolinkProtocol.call(this,e)}function dL(e){this.config.exit.autolinkProtocol.call(this,e)}function fL(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 hL(e){this.config.exit.autolinkEmail.call(this,e)}function pL(e){this.exit(e)}function mL(e){iL(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),xL]],{ignore:["link","linkReference"]})}function gL(e,t,n,i,a){let c="";if(!Tj(a)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!vL(n)))return!1;const u=bL(n+i);if(!u[0])return!1;const f={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function xL(e,t,n,i){return!Tj(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function vL(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 bL(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=Vw(e,"(");let c=Vw(e,")");for(;i!==-1&&a>c;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),c++;return[e,n]}function Tj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||al(n)||vh(n))&&(!t||n!==47)}Mj.peek=EL;function yL(){this.buffer()}function _L(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function wL(){this.buffer()}function SL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function kL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ci(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jL(e){this.exit(e)}function NL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ci(this.sliceSerialize(e)).toLowerCase(),n.label=t}function CL(e){this.exit(e)}function EL(){return"["}function Mj(e,t,n,i){const a=n.createTracker(i);let c=a.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return c+=a.move(n.safe(n.associationId(e),{after:"]",before:c})),f(),u(),c+=a.move("]"),c}function TL(){return{enter:{gfmFootnoteCallString:yL,gfmFootnoteCall:_L,gfmFootnoteDefinitionLabelString:wL,gfmFootnoteDefinition:SL},exit:{gfmFootnoteCallString:kL,gfmFootnoteCall:jL,gfmFootnoteDefinitionLabelString:NL,gfmFootnoteDefinition:CL}}}function ML(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Mj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,c,u){const f=c.createTracker(u);let h=f.move("[^");const m=c.enter("footnoteDefinition"),v=c.enter("label");return h+=f.move(c.safe(c.associationId(i),{before:h,after:"]"})),v(),h+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),h+=f.move((t?`
|
|
85
|
-
`:" ")+c.indentLines(c.containerFlow(i,f.current()),t?Aj:AL))),m(),h}}function AL(e,t,n){return t===0?e:Aj(e,t,n)}function Aj(e,t,n){return(n?"":" ")+e}const RL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Rj.peek=$L;function OL(){return{canContainEols:["delete"],enter:{strikethrough:DL},exit:{strikethrough:zL}}}function LL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RL}],handlers:{delete:Rj}}}function DL(e){this.enter({type:"delete",children:[]},e)}function zL(e){this.exit(e)}function Rj(e,t,n,i){const a=n.createTracker(i),c=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),c(),u}function $L(){return"~"}function BL(e){return e.length}function PL(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||BL,c=[],u=[],f=[],h=[];let m=0,v=-1;for(;++v<e.length;){const j=[],N=[];let S=-1;for(e[v].length>m&&(m=e[v].length);++S<e[v].length;){const C=UL(e[v][S]);if(n.alignDelimiters!==!1){const E=a(C);N[S]=E,(h[S]===void 0||E>h[S])&&(h[S]=E)}j.push(C)}u[v]=j,f[v]=N}let x=-1;if(typeof i=="object"&&"length"in i)for(;++x<m;)c[x]=Gw(i[x]);else{const j=Gw(i);for(;++x<m;)c[x]=j}x=-1;const b=[],y=[];for(;++x<m;){const j=c[x];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let C=n.alignDelimiters===!1?1:Math.max(1,h[x]-N.length-S.length);const E=N+"-".repeat(C)+S;n.alignDelimiters!==!1&&(C=N.length+C+S.length,C>h[x]&&(h[x]=C),y[x]=C),b[x]=E}u.splice(1,0,b),f.splice(1,0,y),v=-1;const _=[];for(;++v<u.length;){const j=u[v],N=f[v];x=-1;const S=[];for(;++x<m;){const C=j[x]||"";let E="",L="";if(n.alignDelimiters!==!1){const O=h[x]-(N[x]||0),R=c[x];R===114?E=" ".repeat(O):R===99?O%2?(E=" ".repeat(O/2+.5),L=" ".repeat(O/2-.5)):(E=" ".repeat(O/2),L=E):L=" ".repeat(O)}n.delimiterStart!==!1&&!x&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||x)&&S.push(" "),n.alignDelimiters!==!1&&S.push(E),S.push(C),n.alignDelimiters!==!1&&S.push(L),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||x!==m-1)&&S.push("|")}_.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return _.join(`
|
|
86
|
-
`)}function UL(e){return e==null?"":String(e)}function Gw(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 FL(e,t,n,i){const a=n.enter("blockquote"),c=n.createTracker(i);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),IL);return a(),u}function IL(e,t,n){return">"+(n?"":" ")+e}function HL(e,t){return Yw(e,t.inConstruct,!0)&&!Yw(e,t.notInConstruct,!1)}function Yw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function Xw(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
87
|
-
`&&HL(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
88
|
-
`}function qL(e,t){const n=String(e);let i=n.indexOf(t),a=i,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++c>u&&(u=c):c=1,a=i+t.length,i=n.indexOf(t,a);return u}function VL(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 GL(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 YL(e,t,n,i){const a=GL(n),c=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(VL(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(c,XL);return x(),b}const f=n.createTracker(i),h=a.repeat(Math.max(qL(c,a)+1,3)),m=n.enter("codeFenced");let v=f.move(h);if(e.lang){const x=n.enter(`codeFencedLang${u}`);v+=f.move(n.safe(e.lang,{before:v,after:" ",encode:["`"],...f.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);v+=f.move(" "),v+=f.move(n.safe(e.meta,{before:v,after:`
|
|
89
|
-
`,encode:["`"],...f.current()})),x()}return v+=f.move(`
|
|
90
|
-
`),c&&(v+=f.move(c+`
|
|
91
|
-
`)),v+=f.move(h),m(),v}function XL(e,t,n){return(n?"":" ")+e}function Wx(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 QL(e,t,n,i){const a=Wx(n),c=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(i);let m=h.move("[");return m+=h.move(n.safe(n.associationId(e),{before:m,after:"]",...h.current()})),m+=h.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(n.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(f=n.enter("destinationRaw"),m+=h.move(n.safe(e.url,{before:m,after:e.title?" ":`
|
|
92
|
-
`,...h.current()}))),f(),e.title&&(f=n.enter(`title${c}`),m+=h.move(" "+a),m+=h.move(n.safe(e.title,{before:m,after:a,...h.current()})),m+=h.move(a),f()),u(),m}function KL(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 wu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function lh(e,t,n){const i=_o(e),a=_o(t);return i===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Oj.peek=WL;function Oj(e,t,n,i){const a=KL(n),c=n.enter("emphasis"),u=n.createTracker(i),f=u.move(a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const m=h.charCodeAt(0),v=lh(i.before.charCodeAt(i.before.length-1),m,a);v.inside&&(h=wu(m)+h.slice(1));const x=h.charCodeAt(h.length-1),b=lh(i.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+wu(x));const y=u.move(a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},f+h+y}function WL(e,t,n){return n.options.emphasis||"*"}function ZL(e,t){let n=!1;return Xx(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,tx}),!!((!e.depth||e.depth<3)&&Fx(e)&&(t.options.setext||n))}function JL(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(i);if(ZL(e,n)){const v=n.enter("headingSetext"),x=n.enter("phrasing"),b=n.containerPhrasing(e,{...c.current(),before:`
|
|
93
|
-
`,after:`
|
|
94
|
-
`});return x(),v(),b+`
|
|
95
|
-
`+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
96
|
-
`))+1))}const u="#".repeat(a),f=n.enter("headingAtx"),h=n.enter("phrasing");c.move(u+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
|
|
97
|
-
`,...c.current()});return/^[\t ]/.test(m)&&(m=wu(m.charCodeAt(0))+m.slice(1)),m=m?u+" "+m:u,n.options.closeAtx&&(m+=" "+u),h(),f(),m}Lj.peek=eD;function Lj(e){return e.value||""}function eD(){return"<"}Dj.peek=tD;function Dj(e,t,n,i){const a=Wx(n),c=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(i);let m=h.move("![");return m+=h.move(n.safe(e.alt,{before:m,after:"]",...h.current()})),m+=h.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(n.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(f=n.enter("destinationRaw"),m+=h.move(n.safe(e.url,{before:m,after:e.title?" ":")",...h.current()}))),f(),e.title&&(f=n.enter(`title${c}`),m+=h.move(" "+a),m+=h.move(n.safe(e.title,{before:m,after:a,...h.current()})),m+=h.move(a),f()),m+=h.move(")"),u(),m}function tD(){return"!"}zj.peek=nD;function zj(e,t,n,i){const a=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("![");const m=n.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(m+"]["),u();const v=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=v,c(),a==="full"||!m||m!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function nD(){return"!"}$j.peek=sD;function $j(e,t,n){let i=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<n.unsafe.length;){const u=n.unsafe[c],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(i);){let m=h.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(h.index+1)}}return a+i+a}function sD(){return"`"}function Bj(e,t){const n=Fx(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))}Pj.peek=iD;function Pj(e,t,n,i){const a=Wx(n),c=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let f,h;if(Bj(e,n)){const v=n.stack;n.stack=[],f=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),f(),n.stack=v,x}f=n.enter("link"),h=n.enter("label");let m=u.move("[");return m+=u.move(n.containerPhrasing(e,{before:m,after:"](",...u.current()})),m+=u.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(n.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(h=n.enter("destinationRaw"),m+=u.move(n.safe(e.url,{before:m,after:e.title?" ":")",...u.current()}))),h(),e.title&&(h=n.enter(`title${c}`),m+=u.move(" "+a),m+=u.move(n.safe(e.title,{before:m,after:a,...u.current()})),m+=u.move(a),h()),m+=u.move(")"),f(),m}function iD(e,t,n){return Bj(e,n)?"<":"["}Uj.peek=rD;function Uj(e,t,n,i){const a=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("[");const m=n.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(m+"]["),u();const v=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=v,c(),a==="full"||!m||m!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function rD(){return"["}function Zx(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 aD(e){const t=Zx(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 lD(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 Fj(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 oD(e,t,n,i){const a=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?lD(n):Zx(n);const f=e.ordered?u==="."?")":".":aD(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&v&&(!v.children||!v.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),Fj(n)===u&&v){let x=-1;for(;++x<e.children.length;){const b=e.children[x];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const m=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=c,a(),m}function cD(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 uD(e,t,n,i){const a=cD(n);let c=n.bulletCurrent||Zx(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(i);f.move(c+" ".repeat(u-c.length)),f.shift(u);const h=n.enter("listItem"),m=n.indentLines(n.containerFlow(e,f.current()),v);return h(),m;function v(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?c:c+" ".repeat(u-c.length))+x}}function dD(e,t,n,i){const a=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,i);return c(),a(),u}const fD=_h(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function hD(e,t,n,i){return(e.children.some(function(u){return fD(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function pD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ij.peek=mD;function Ij(e,t,n,i){const a=pD(n),c=n.enter("strong"),u=n.createTracker(i),f=u.move(a+a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const m=h.charCodeAt(0),v=lh(i.before.charCodeAt(i.before.length-1),m,a);v.inside&&(h=wu(m)+h.slice(1));const x=h.charCodeAt(h.length-1),b=lh(i.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+wu(x));const y=u.move(a+a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},f+h+y}function mD(e,t,n){return n.options.strong||"*"}function gD(e,t,n,i){return n.safe(e.value,i)}function xD(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 vD(e,t,n){const i=(Fj(n)+(n.options.ruleSpaces?" ":"")).repeat(xD(n));return n.options.ruleSpaces?i.slice(0,-1):i}const Hj={blockquote:FL,break:Xw,code:YL,definition:QL,emphasis:Oj,hardBreak:Xw,heading:JL,html:Lj,image:Dj,imageReference:zj,inlineCode:$j,link:Pj,linkReference:Uj,list:oD,listItem:uD,paragraph:dD,root:hD,strong:Ij,text:gD,thematicBreak:vD};function bD(){return{enter:{table:yD,tableData:Qw,tableHeader:Qw,tableRow:wD},exit:{codeText:SD,table:_D,tableData:n0,tableHeader:n0,tableRow:n0}}}function yD(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 _D(e){this.exit(e),this.data.inTable=void 0}function wD(e){this.enter({type:"tableRow",children:[]},e)}function n0(e){this.exit(e)}function Qw(e){this.enter({type:"tableCell",children:[]},e)}function SD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,kD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function kD(e,t){return t==="|"?t:e}function jD(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
98
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:u,tableCell:h,tableRow:f}};function u(y,_,j,N){return m(v(y,j,N),y.align)}function f(y,_,j,N){const S=x(y,j,N),C=m([S]);return C.slice(0,C.indexOf(`
|
|
99
|
-
`))}function h(y,_,j,N){const S=j.enter("tableCell"),C=j.enter("phrasing"),E=j.containerPhrasing(y,{...N,before:c,after:c});return C(),S(),E}function m(y,_){return PL(y,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function v(y,_,j){const N=y.children;let S=-1;const C=[],E=_.enter("table");for(;++S<N.length;)C[S]=x(N[S],_,j);return E(),C}function x(y,_,j){const N=y.children;let S=-1;const C=[],E=_.enter("tableRow");for(;++S<N.length;)C[S]=h(N[S],y,_,j);return E(),C}function b(y,_,j){let N=Hj.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function ND(){return{exit:{taskListCheckValueChecked:Kw,taskListCheckValueUnchecked:Kw,paragraph:ED}}}function CD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TD}}}function Kw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ED(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const a=t.children;let c=-1,u;for(;++c<a.length;){const f=a[c];if(f.type==="paragraph"){u=f;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function TD(e,t,n,i){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(i);c&&f.move(u);let h=Hj.listItem(e,t,n,{...i,...f.current()});return c&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),h;function m(v){return v+u}}function MD(){return[oL(),TL(),OL(),bD(),ND()]}function AD(e){return{extensions:[cL(),ML(e),LL(),jD(e),CD()]}}const RD={tokenize:BD,partial:!0},qj={tokenize:PD,partial:!0},Vj={tokenize:UD,partial:!0},Gj={tokenize:FD,partial:!0},OD={tokenize:ID,partial:!0},Yj={name:"wwwAutolink",tokenize:zD,previous:Qj},Xj={name:"protocolAutolink",tokenize:$D,previous:Kj},xr={name:"emailAutolink",tokenize:DD,previous:Wj},zi={};function LD(){return{text:zi}}let Xa=48;for(;Xa<123;)zi[Xa]=xr,Xa++,Xa===58?Xa=65:Xa===91&&(Xa=97);zi[43]=xr;zi[45]=xr;zi[46]=xr;zi[95]=xr;zi[72]=[xr,Xj];zi[104]=[xr,Xj];zi[87]=[xr,Yj];zi[119]=[xr,Yj];function DD(e,t,n){const i=this;let a,c;return u;function u(x){return!rx(x)||!Wj.call(i,i.previous)||Jx(i.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(x))}function f(x){return rx(x)?(e.consume(x),f):x===64?(e.consume(x),h):n(x)}function h(x){return x===46?e.check(OD,v,m)(x):x===45||x===95||Vn(x)?(c=!0,e.consume(x),h):v(x)}function m(x){return e.consume(x),a=!0,h}function v(x){return c&&a&&is(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function zD(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!Qj.call(i,i.previous)||Jx(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(RD,e.attempt(qj,e.attempt(Vj,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function $D(e,t,n){const i=this;let a="",c=!1;return u;function u(x){return(x===72||x===104)&&Kj.call(i,i.previous)&&!Jx(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),f):n(x)}function f(x){if(is(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),f;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),h}return n(x)}function h(x){return x===47?(e.consume(x),c?m:(c=!0,h)):n(x)}function m(x){return x===null||ih(x)||Pt(x)||al(x)||vh(x)?n(x):e.attempt(qj,e.attempt(Vj,v),n)(x)}function v(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function BD(e,t,n){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),c):n(u)}function c(u){return u===null?n(u):t(u)}}function PD(e,t,n){let i,a,c;return u;function u(m){return m===46||m===95?e.check(Gj,h,f)(m):m===null||Pt(m)||al(m)||m!==45&&vh(m)?h(m):(c=!0,e.consume(m),u)}function f(m){return m===95?i=!0:(a=i,i=void 0),e.consume(m),u}function h(m){return a||i||!c?n(m):t(m)}}function UD(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(Gj,t,c)(u):u===null||Pt(u)||al(u)?t(u):(e.consume(u),a)}function c(u){return u===41&&i++,e.consume(u),a}}function FD(e,t,n){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),c):f===93?(e.consume(f),a):f===60||f===null||Pt(f)||al(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Pt(f)||al(f)?t(f):i(f)}function c(f){return is(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),i):is(f)?(e.consume(f),u):n(f)}}function ID(e,t,n){return i;function i(c){return e.consume(c),a}function a(c){return Vn(c)?n(c):t(c)}}function Qj(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function Kj(e){return!is(e)}function Wj(e){return!(e===47||rx(e))}function rx(e){return e===43||e===45||e===46||e===95||Vn(e)}function Jx(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const HD={tokenize:WD,partial:!0};function qD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:XD,continuation:{tokenize:QD},exit:KD}},text:{91:{name:"gfmFootnoteCall",tokenize:YD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:VD,resolveTo:GD}}}}function VD(e,t,n){const i=this;let a=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const h=i.events[a][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return f;function f(h){if(!u||!u._balanced)return n(h);const m=ci(i.sliceSerialize({start:u.end,end:i.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function GD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...f),e}function YD(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,u;return f;function f(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),h}function h(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(x){if(c>999||x===93&&!u||x===null||x===91||Pt(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(ci(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return Pt(x)||(u=!0),c++,e.consume(x),x===92?v:m}function v(x){return x===91||x===92||x===93?(e.consume(x),c++,m):m(x)}}function XD(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,u=0,f;return h;function h(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):n(_)}function v(_){if(u>999||_===93&&!f||_===null||_===91||Pt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=ci(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Pt(_)||(f=!0),u++,e.consume(_),_===92?x:v}function x(_){return _===91||_===92||_===93?(e.consume(_),u++,v):v(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(c)||a.push(c),_t(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function QD(e,t,n){return e.check(Tu,t,e.attempt(HD,t,n))}function KD(e){e.exit("gfmFootnoteDefinition")}function WD(e,t,n){const i=this;return _t(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function ZD(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,f){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let m=h;for(;m--;)if(u[m][0]==="exit"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[m][1].end.offset-u[m][1].start.offset){u[h][1].type="strikethroughSequence",u[m][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[h][1].end)},x={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[h][1].start)},b=[["enter",v,f],["enter",u[m][1],f],["exit",u[m][1],f],["enter",x,f]],y=f.parser.constructs.insideSpan.null;y&&Rs(b,b.length,0,bh(y,u.slice(m+1,h),f)),Rs(b,b.length,0,[["exit",x,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",v,f]]),Rs(u,m-1,h-m+3,b),h=m+b.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function c(u,f,h){const m=this.previous,v=this.events;let x=0;return b;function b(_){return m===126&&v[v.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=_o(m);if(_===126)return x>1?h(_):(u.consume(_),x++,y);if(x<2&&!n)return h(_);const N=u.exit("strikethroughSequenceTemporary"),S=_o(_);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,f(_)}}}class JD{constructor(){this.map=[]}add(t,n,i){ez(this,t,n,i)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const c of a)t.push(c);a=i.pop()}this.map.length=0}}function ez(e,t,n,i){let a=0;if(!(n===0&&i.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...i);return}a+=1}e.map.push([t,n,i])}}function tz(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function nz(){return{flow:{null:{name:"table",tokenize:sz,resolveAll:iz}}}}function sz(e,t,n){const i=this;let a=0,c=0,u;return f;function f(P){let Y=i.events.length-1;for(;Y>-1;){const te=i.events[Y][1].type;if(te==="lineEnding"||te==="linePrefix")Y--;else break}const A=Y>-1?i.events[Y][1].type:null,fe=A==="tableHead"||A==="tableRow"?R:h;return fe===R&&i.parser.lazy[i.now().line]?n(P):fe(P)}function h(P){return e.enter("tableHead"),e.enter("tableRow"),m(P)}function m(P){return P===124||(u=!0,c+=1),v(P)}function v(P){return P===null?n(P):qe(P)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),y):n(P):dt(P)?_t(e,v,"whitespace")(P):(c+=1,u&&(u=!1,a+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),u=!0,v):(e.enter("data"),x(P)))}function x(P){return P===null||P===124||Pt(P)?(e.exit("data"),v(P)):(e.consume(P),P===92?b:x)}function b(P){return P===92||P===124?(e.consume(P),x):x(P)}function y(P){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(P):(e.enter("tableDelimiterRow"),u=!1,dt(P)?_t(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P))}function _(P){return P===45||P===58?N(P):P===124?(u=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),j):O(P)}function j(P){return dt(P)?_t(e,N,"whitespace")(P):N(P)}function N(P){return P===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),S):P===45?(c+=1,S(P)):P===null||qe(P)?L(P):O(P)}function S(P){return P===45?(e.enter("tableDelimiterFiller"),C(P)):O(P)}function C(P){return P===45?(e.consume(P),C):P===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(P))}function E(P){return dt(P)?_t(e,L,"whitespace")(P):L(P)}function L(P){return P===124?_(P):P===null||qe(P)?!u||a!==c?O(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):O(P)}function O(P){return n(P)}function R(P){return e.enter("tableRow"),F(P)}function F(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),F):P===null||qe(P)?(e.exit("tableRow"),t(P)):dt(P)?_t(e,F,"whitespace")(P):(e.enter("data"),D(P))}function D(P){return P===null||P===124||Pt(P)?(e.exit("data"),F(P)):(e.consume(P),P===92?X:D)}function X(P){return P===92||P===124?(e.consume(P),D):D(P)}}function iz(e,t){let n=-1,i=!0,a=0,c=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,m,v,x;const b=new JD;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(Ww(b,t,h,m,v),v=void 0,h=0),m={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",m,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,x=void 0,c=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,v={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",v,t]])),a=_.type==="tableDelimiterRow"?2:v?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],x=yf(b,t,c,a,void 0,x),c=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(u[0]=u[1],x=yf(b,t,c,a,void 0,x)),c=u,u=[c[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,c[1]!==0?(u[0]=u[1],x=yf(b,t,c,a,n,x)):u[1]!==0&&(x=yf(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&Ww(b,t,h,m,v),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=tz(t.events,n))}return e}function yf(e,t,n,i,a,c){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(c.end=Object.assign({},ao(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const h=ao(t.events,n[1]);if(c={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const m=ao(t.events,n[2]),v=ao(t.events,n[3]),x={type:f,start:Object.assign({},m),end:Object.assign({},v)};if(e.add(n[2],0,[["enter",x,t]]),i!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return a!==void 0&&(c.end=Object.assign({},ao(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function Ww(e,t,n,i,a){const c=[],u=ao(t.events,n);a&&(a.end=Object.assign({},u),c.push(["exit",a,t])),i.end=Object.assign({},u),c.push(["exit",i,t]),e.add(n+1,0,c)}function ao(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const rz={name:"tasklistCheck",tokenize:lz};function az(){return{text:{91:rz}}}function lz(e,t,n){const i=this;return a;function a(h){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),c)}function c(h){return Pt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(h)}function f(h){return qe(h)?t(h):dt(h)?e.check({tokenize:oz},t,n)(h):n(h)}}function oz(e,t,n){return _t(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function cz(e){return lj([LD(),qD(),ZD(e),nz(),az()])}const uz={};function ev(e){const t=this,n=e||uz,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(cz(n)),c.push(MD()),u.push(AD(n))}const dz=1500;async function fz(e){var i;try{if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function Sh({text:e,label:t="Copy",className:n=""}){const[i,a]=k.useState(!1),c=k.useRef(null);k.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const u=async()=>{await fz(e)&&(a(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>a(!1),dz))},f=i?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":f,title:f,className:`inline-flex items-center justify-center w-6 h-6 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors ${n}`,children:i?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":"true",children:[l.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),l.jsx("path",{d:"M10.5 5V3.75A.75.75 0 009.75 3H3.75A.75.75 0 003 3.75v6a.75.75 0 00.75.75H5"})]})})}function oh(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(oh).join(""):typeof e=="object"&&e!==null&&"props"in e?oh((t=e.props)==null?void 0:t.children):""}const s0=/https?:\/\/[^\s<>"'`]+/gi,hz=`.,;:!?]}>'"`;function pz(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const i=e.slice(0,t),a=(i.match(/\(/g)||[]).length,c=(i.match(/\)/g)||[]).length;if(a>=c)break;t--;continue}if(hz.includes(n)){t--;continue}break}return e.slice(0,t)}function mz(e){return/^https?:\/\/[^\s/]/i.test(e)}function gz(e){if(!e)return[];const t=[];let n=0;s0.lastIndex=0;let i;for(;(i=s0.exec(e))!==null;){const a=pz(i[0]);!a||!mz(a)||(i.index>n&&t.push({type:"text",value:e.slice(n,i.index)}),t.push({type:"link",value:a,href:a}),n=i.index+a.length,s0.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const Zw=40;function xz(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>Zw?`${t.slice(0,Zw-1)}…`:t}`:"Copy"}function Zj({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const i=oh(e);if(!i)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=gz(i);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((c,u)=>c.type==="link"?l.jsx("a",{href:c.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:c.value},u):l.jsx("span",{children:c.value},u))}),l.jsx(Sh,{text:i,label:xz(i),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const ch=25*1024*1024,uh=100*1024*1024;function Jj(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const c=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:c,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function ua(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 eN(e){return e.startsWith("image/")}function tN({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let i="FILE";return t==="application/pdf"||n==="pdf"?i="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?i="ZIP":["csv","tsv"].includes(n)?i="CSV":["json","yaml","yml","toml","xml"].includes(n)?i="DATA":["md","txt","log"].includes(n)?i="TXT":["doc","docx","rtf","odt"].includes(n)?i="DOC":["xls","xlsx","ods"].includes(n)?i="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?i="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?i="VID":n&&(i=n.slice(0,4).toUpperCase()),l.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[l.jsx("path",{d:"M3 1.75h6.5L13 5.25v9A1.25 1.25 0 0 1 11.75 15.5h-7.5A1.25 1.25 0 0 1 3 14.25V1.75z"}),l.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),l.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:i})]})}function nN({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:c="w-12 h-12"}){const u=eN(t);return l.jsxs("div",{className:"relative group",title:`${e} (${ua(i)})`,children:[l.jsx("div",{className:`${c} 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(tN,{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 vz({name:e,mediaType:t,data:n,size:i}){return eN(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(tN,{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:ua(i)})]})]})}function bz({message:e}){const t=pa(),[n,i]=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:()=>i(c=>!c),"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 yz({message:e}){return e.role==="system"?l.jsx(bz,{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(vz,{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(tv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(jz,{message:e})})}function _z(e){const t=[];for(const n of e)if(n.type==="tool_use"){const i=t[t.length-1];(i==null?void 0:i.kind)==="tool_group"&&i.name===n.name?i.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function wz(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 Sz(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function kz({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 jz({message:e}){var u;const t=e.contentBlocks||[],n=pa(),i=k.useMemo(()=>_z(t),[t]),a=k.useMemo(()=>wz(t),[t]),c=k.useMemo(()=>n?i.filter(f=>!Sz(f)):i,[i,n]);if(n&&c.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(zf,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(kz,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const f=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(zf,{}),l.jsx("div",{className:"flex-1 min-w-0",children:f?l.jsx(iN,{text:e.content}):l.jsx(tv,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(zf,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:c.map((f,h)=>{if(f.kind==="content")return l.jsx(Nz,{block:f.block,toolUseById:a},h);if(f.items.length===1){const m=f.items[0];return l.jsx(E2,{name:m.name,input:m.input,toolUseId:m.id},h)}return l.jsx(Tz,{name:f.name,items:f.items},h)})})]})}function zf(){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 tv({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(Kx,{remarkPlugins:[ev],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:a}=n,c=/language-(\w+)/.exec(a||"");if(c||typeof i=="string"&&i.includes(`
|
|
100
|
-
`)){const f=(c==null?void 0:c[1])||"",h=oh(i);return l.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),f&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),l.jsx(Sh,{text:h,label:"Copy code",className:"ml-auto -mr-1"})]}),l.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:l.jsx("code",{children:i})})]})}return l.jsx(Zj,{children:i})},pre:({children:n})=>l.jsx(l.Fragment,{children:n}),table:({children:n})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>l.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>l.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>l.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&l.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function Nz({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(tv,{text:e.text});if(e.type==="thinking")return l.jsx(iN,{text:e.thinking});if(e.type==="tool_use")return l.jsx(E2,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),a=i==null?void 0:i.name,c=e.is_error??!1;return a==="Bash"?l.jsx(Cz,{text:n,isError:c}):l.jsx(Ez,{content:n,isError:c})}return null}function sN(e){return`${e} ${e===1?"line":"lines"}`}function Cz({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,c]=k.useState(!1),u=pa(),[f,h]=k.useState(!1),m=a||!i?e:n.slice(-20).join(`
|
|
101
|
-
`),v=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Sh,{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:m}),i&&l.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[l.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:a?`${n.length} lines`:`last 20 of ${n.length}`}),l.jsx("button",{onClick:()=>c(!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(fh,{open:f,onToggle:()=>h(!f),marker:"›",label:t?"Error output":"Output",meta:sN(n.length),labelClassName:t?"text-cc-error/70":""}),f&&l.jsx("div",{className:"mt-1",children:v})]}):v}function Ez({content:e,isError:t}){const n=pa(),[i,a]=k.useState(!1),c=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Sh,{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(fh,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:sN(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:c})]}):c}function Tz({name:e,items:t}){const[n,i]=k.useState(!1),a=So(e),c=Ri(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(sl,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:c}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=po(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function iN({text:e}){const t=e.trim(),n=pa(),[i,a]=k.useState(!1),c=t.split(`
|
|
102
|
-
`),u=n?2:8,f=n?200:600,h=c.length>u||t.length>f,m=h&&!i?c.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(Kx,{remarkPlugins:[ev],components:{p:({children:v})=>l.jsx("p",{className:"mb-2 last:mb-0",children:v}),ul:({children:v})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:v}),ol:({children:v})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:v}),li:({children:v})=>l.jsx("li",{children:v}),code:({children:v})=>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:v})},children:m||"No thinking text captured."})}),h&&!i&&l.jsx("button",{onClick:()=>a(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function Gc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lo(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Jw(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":Mz(t):"N/A"}catch{return"N/A"}}function ax(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${c}m`:`${c}m`}function e2(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function Mz(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function Az({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(sl,{type:So(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:Ri(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function Rz({entries:e}){const[t,n]=k.useState(!1),i=k.useMemo(()=>{const a=e.reduce((h,m)=>h+m.elapsedSeconds,0),c=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:a,maxTime:c,errorCount:u,running:f}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${Ri(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(Oz,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function Oz({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[l.jsx(sl,{type:So(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Ri(e.toolName)})]}),l.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:l.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}function Lz(e){var n;const t=e.contentBlocks;return t&&t.length>0?t.some(i=>i.type==="text"&&i.text.trim().length>0):!!((n=e.content)!=null&&n.trim())}function Dz(e){if(e.kind!=="message")return!1;const t=e.msg;if(t.role==="user")return!0;if(t.role==="system")return!!t.meta;if(t.isStreaming)return!0;if(t.stopReason==="tool_use")return!1;const n=t.contentBlocks;return n!=null&&n.some(i=>i.type==="tool_use")?!1:Lz(t)}function zz(e){switch(e.kind){case"message":return e.msg.id;case"tool_msg_group":return e.firstId;case"subagent":return e.taskToolUseId;case"activity_run":return e.key}}function $z(e){if(e.length>=2)return!0;const t=e[0];return!(t.kind==="message"&&t.msg.role==="system")}function Bz(e){const t=[];let n=[];const i=()=>{n.length!==0&&($z(n)?t.push({kind:"activity_run",key:zz(n[0]),children:n}):t.push(...n),n=[])};for(const a of e)a.kind==="activity_run"||Dz(a)?(i(),t.push(a)):n.push(a);return i(),t}const t2=160;function lx(e){const t=e.split(`
|
|
104
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>t2?`${t.slice(0,t2)}…`:t:""}function rN(e,t){const n=po(e,t);return{label:n?`${Ri(e)} · ${n}`:Ri(e),toolName:e}}function Pz(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="tool_use")return rN(n.name,n.input);if(n.type==="text"&&n.text.trim())return{label:lx(n.text),italic:!0};if(n.type==="thinking"&&n.thinking.trim())return{label:lx(n.thinking),italic:!0}}return null}function Uz(e){var t;switch(e.kind){case"subagent":return{label:`Subagent · ${e.description||"Subagent"}`,toolName:"Task"};case"tool_msg_group":{const n=e.items[e.items.length-1];return n?rN(n.name,n.input):null}case"activity_run":return kh(e).latest;case"message":{const n=e.msg;if(n.role==="system")return{label:n.content,italic:!0};const i=n.contentBlocks;return i&&i.length>0?Pz(i)??{label:"Thinking…",italic:!0}:(t=n.content)!=null&&t.trim()?{label:lx(n.content),italic:!0}:{label:"Thinking…",italic:!0}}}}function aN(e){switch(e.kind){case"message":return[e.msg.timestamp,e.msg.timestamp];case"tool_msg_group":return[e.startedAt,e.endedAt];case"subagent":{let t=null,n=null;for(const i of e.children){const[a,c]=aN(i);a!==null&&(t===null||a<t)&&(t=a),c!==null&&(n===null||c>n)&&(n=c)}return[t,n]}case"activity_run":{const t=kh(e);return[t.startedAt,t.endedAt]}}}function kh(e,t){let n=0,i=0,a=0,c=null,u=null;for(const h of e.children){if(h.kind==="subagent")i++;else if(h.kind==="tool_msg_group")n+=h.items.length;else if(h.kind==="message")for(const x of h.msg.contentBlocks??[])x.type==="tool_use"&&n++,x.type==="tool_result"&&x.is_error&&a++;else{const x=kh(h);n+=x.toolCalls,i+=x.subagents,a+=x.errors}const[m,v]=aN(h);m!==null&&(c===null||m<c)&&(c=m),v!==null&&(u===null||v>u)&&(u=v)}t!==void 0&&c!==null&&(u=Math.max(u??t,t));const f=e.children[e.children.length-1];return{toolCalls:n,subagents:i,errors:a,steps:e.children.length,startedAt:c,endedAt:u,latest:f?Uz(f):null}}function Fz({run:e,live:t,children:n}){const[i,a]=k.useState(!1),c=t?Date.now():void 0,u=k.useMemo(()=>kh(e,c),[e,c]),f=u.startedAt!==null&&u.endedAt!==null?Math.max(0,u.endedAt-u.startedAt):null,h=[];u.toolCalls>0&&h.push(`${u.toolCalls} tool call${u.toolCalls===1?"":"s"}`),u.subagents>0&&h.push(`${u.subagents} subagent${u.subagents===1?"":"s"}`),u.errors>0&&h.push(l.jsxs("span",{className:"text-cc-error",children:[u.errors," error",u.errors===1?"":"s"]},"err")),f!==null&&f>=1e3&&h.push(lo(f));const m=t?"Working":"Worked",v=`${u.steps} step${u.steps===1?"":"s"}`,x=u.latest;return l.jsxs("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]","data-activity-run":e.key,children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(zf,{}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("button",{type:"button",onClick:()=>a(b=>!b),"aria-expanded":i,"aria-label":`${m}: ${v}, ${i?"collapse":"expand"} details`,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer min-w-0",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 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full shrink-0 ${t?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsx("span",{className:"text-[11px] font-medium text-cc-fg/70 shrink-0",children:m}),h.length>0&&l.jsx("span",{className:"text-[11px] text-cc-muted/60 font-mono-code truncate min-w-0 tabular-nums",children:h.map((b,y)=>l.jsxs("span",{children:[l.jsx("span",{className:"text-cc-muted/35",children:" · "}),b]},y))}),l.jsx("span",{className:"ml-auto text-[10px] text-cc-muted/40 group-hover:text-cc-muted/70 shrink-0 tabular-nums",children:i?"hide":v})]}),!i&&x&&l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 pl-4 py-0.5 text-[11px] min-w-0",children:[x.toolName&&l.jsx(sl,{type:So(x.toolName)}),l.jsx("span",{className:`truncate min-w-0 ${x.italic?"italic text-cc-muted/60":"font-mono-code text-cc-muted/70"}`,children:x.label})]})]})]}),i&&l.jsx("div",{className:"mt-4 space-y-5 sm:space-y-7 animate-[fadeSlideIn_0.2s_ease-out]",children:n})]})}const _f=100,Iz=40,Hz=120,n2=1e4,qz=15*6e4,i0=new Map,Vz=[],Gz=[];function Yz(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function Xz(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function s2(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function Qz(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 lN(e){const t=[];for(const n of e){const i=Xz(n);if(i){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===i){a.items.push(...s2(n)),a.endedAt=Math.max(a.endedAt,n.timestamp);continue}t.push({kind:"tool_msg_group",toolName:i,items:s2(n),firstId:n.id,startedAt:n.timestamp,endedAt:n.timestamp})}else t.push({kind:"message",msg:n})}return t}function oN(e,t,n){const i=lN(e),a=[];for(const c of i){a.push(c);const u=Qz(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const m=t.get(f)||{description:"Subagent",agentType:""},v=oN(h,t,n);a.push({kind:"subagent",taskToolUseId:f,description:m.description,agentType:m.agentType,backend:m.backend,status:m.status,receiverCount:m.receiverCount,senderThreadId:m.senderThreadId,receiverThreadIds:m.receiverThreadIds,children:v})}}}return a}function Kz(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const c of a.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:f}=c,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,m=h&&h.length>0?h.length:void 0,v=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"||v!==void 0||m!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:x?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:m,senderThreadId:v,receiverThreadIds:h})}}if(t.size===0)return lN(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let c=n.get(a.parentToolUseId);c||(c=[],n.set(a.parentToolUseId,c)),c.push(a)}else i.push(a);return oN(i,t,n)}function Wz({group:e}){const[t,n]=k.useState(!1),i=So(e.toolName),a=Ri(e.toolName),c=e.items.length;if(c===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(i2,{}),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(sl,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:po(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(i2,{}),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(sl,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:c})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=po(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function nv({entries:e,toolActivity:t,liveRunKey:n}){return l.jsx(l.Fragment,{children:e.map((i,a)=>{if(i.kind==="activity_run")return l.jsx(Fz,{run:i,live:i.key===n,children:l.jsx(nv,{entries:i.children,toolActivity:t})},i.key);if(i.kind==="tool_msg_group")return l.jsx(Wz,{group:i},i.firstId||a);if(i.kind==="subagent")return l.jsx(e$,{group:i},i.taskToolUseId);const c=i.msg,u=Zz(c),f=t&&u.length>0?t.filter(m=>u.includes(m.toolUseId)):[],h=f.length>0&&f.every(m=>m.completedAt);return l.jsxs("div",{children:[l.jsx(yz,{message:c}),h&&l.jsx(Rz,{entries:f})]},c.id)})})}function Zz(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function Jz(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 e$({group:e}){const[t,n]=k.useState(!1),i=e.description||"Subagent",a=e.agentType,c=e.children.length,u=Jz(e.status),f=e.receiverCount,h=e.senderThreadId,m=e.receiverThreadIds||[],v=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`${Ri(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(S=>S.type==="tool_use");if(N)return Ri(N.name)}return""},[x]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:v==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&b&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:b}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||m.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),m.length>0&&l.jsxs("span",{children:["receivers: ",m.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(nv,{entries:e.children})]})]})})}function i2(){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 t$({sessionId:e}){var nn;const t=Q(ne=>ne.messages.get(e)??Vz),n=Q(ne=>(ne.sdkSessions||Gz).find(je=>je.sessionId===e)),i=Q(ne=>ne.streamingStartedAt.get(e)),a=Q(ne=>ne.streamingOutputTokens.get(e)),c=Q(ne=>ne.sessionStatus.get(e)),u=Q(ne=>ne.lastActivityAt.get(e)),f=Q(ne=>ne.sessionProcesses.get(e)),h=Q(ne=>ne.toolProgress.get(e)),m=Q(ne=>ne.toolActivity.get(e)),v=k.useRef(null),x=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(_f),[S,C]=k.useState([]),[E,L]=k.useState(0),[O,R]=k.useState(!1),[F,D]=k.useState(!1),[X,P]=k.useState(!1),[Y,A]=k.useState(""),fe=k.useRef(new Set),te=Q(ne=>ne.chatTabReentryTickBySession.get(e)??0),K=k.useMemo(()=>t.some(ne=>ne.role==="assistant"&&ne.isStreaming),[t]),G=k.useMemo(()=>(f??[]).filter(ne=>ne.status==="running"),[f]),V=G.length>0,se=k.useMemo(()=>{const ne=m??[];for(let je=ne.length-1;je>=0;je--)if(!ne[je].completedAt)return ne[je]},[m]),ae=k.useMemo(()=>G.length>0?Math.min(...G.map(ne=>ne.startedAt)):null,[G]),M=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]),Te=M.length>0,Ce=n!=null&&n.forkSession?"Forked from":"Continuing from",z=k.useMemo(()=>{if(S.length===0)return t;const ne=[],je=new Set;for(const Ye of S)je.has(Ye.id)||(je.add(Ye.id),ne.push(Ye));for(const Ye of t)je.has(Ye.id)||(je.add(Ye.id),ne.push(Ye));return ne},[S,t]),B=k.useMemo(()=>Kz(z),[z]);k.useEffect(()=>{N(_f),C([]),L(0),R(!1),D(!1),P(!1),A(""),fe.current=new Set},[e,M]);const ce=B.length,ye=ce>j,Ne=k.useMemo(()=>ye?B.slice(ce-j):B,[B,ye,ce,j]),Ae=ce-Ne.length,Le=pa(),De=k.useMemo(()=>Le?Bz(Ne):Ne,[Le,Ne]),Ee=De[De.length-1],Re=c==="running"&&(Ee==null?void 0:Ee.kind)==="activity_run"?Ee.key:void 0,Ut=k.useCallback(()=>{const ne=x.current,je=(ne==null?void 0:ne.scrollHeight)??0;N(Ye=>Ye+_f),requestAnimationFrame(()=>{if(ne){const Ye=ne.scrollHeight;ne.scrollTop+=Ye-je}})},[]),Qt=k.useCallback(async(ne={})=>{if(!Te||!M||X)return;const je=x.current,Ye=(je==null?void 0:je.scrollHeight)??0,Je=F?E:0;P(!0),A("");try{const un=await ke.getClaudeSessionHistory(M,{cursor:Je,limit:Iz}),ue=un.messages.map(H=>({id:H.id,role:H.role,content:H.content,contentBlocks:H.role==="assistant"?H.contentBlocks:void 0,timestamp:H.timestamp||Date.now(),model:H.role==="assistant"?H.model:void 0,stopReason:H.role==="assistant"?H.stopReason:void 0})),be=[];for(const H of ue)fe.current.has(H.id)||(fe.current.add(H.id),be.push(H));C(H=>[...be,...H]),L(un.nextCursor),R(un.hasMore),D(!0),be.length>0&&N(H=>H+be.length),ne.preserveScroll!==!1&&je&&requestAnimationFrame(()=>{const H=je.scrollHeight;je.scrollTop+=H-Ye})}catch(un){const ue=un instanceof Error?un.message:String(un);A(ue||"Failed to load previous history"),F||(C([]),L(0),R(!1))}finally{P(!1)}},[Te,M,X,F,E]);k.useEffect(()=>{if(!i&&c!=="running"&&!V){_(0);return}const ne=i||Date.now();_(Date.now()-ne);const je=setInterval(()=>_(Date.now()-ne),1e3);return()=>clearInterval(je)},[i,c,V]);function Ft(){const ne=x.current;if(!ne)return;b.current=ne.scrollHeight-ne.scrollTop-ne.clientHeight<120;const je=Math.max(0,ne.scrollHeight-ne.clientHeight-ne.scrollTop);i0.set(e,je),Te&&F&&O&&!X&&ne.scrollTop<=Hz&&Qt({preserveScroll:!0})}const jt=k.useCallback(()=>{const ne=x.current;if(!ne)return;const je=ne.style.scrollBehavior;ne.style.scrollBehavior="auto",ne.scrollTop=ne.scrollHeight,ne.style.scrollBehavior=je},[]),wt=k.useCallback(()=>{const ne=x.current;if(!ne)return;const je=ne.style.scrollBehavior;ne.style.scrollBehavior="auto";const Ye=i0.get(e);typeof Ye=="number"?ne.scrollTop=Math.max(0,ne.scrollHeight-ne.clientHeight-Ye):ne.scrollTop=ne.scrollHeight,ne.style.scrollBehavior=je},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>wt())},[e,wt]),k.useEffect(()=>()=>{const ne=x.current;if(!ne)return;const je=Math.max(0,ne.scrollHeight-ne.clientHeight-ne.scrollTop);i0.set(e,je)},[e]),k.useEffect(()=>{te&&requestAnimationFrame(()=>jt())},[te,jt]),k.useEffect(()=>{var ne;b.current&&((ne=v.current)==null||ne.scrollIntoView({behavior:"smooth"}))},[t]),z.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:Te?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:[Ce," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:M.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void Qt({preserveScroll:!1}),disabled:X,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"})}),X?"Loading...":"Load previous history"]}),Y&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:Y})]}):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 Xe=c==="running"&&u!=null?Math.max(0,Date.now()-u):0,St=V&&(c!=="running"||Xe>=n2)?"background":Xe>=qz&&!se?"stalled":Xe>=n2?"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:Ft,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:[Te&&!F&&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:[Ce," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[M," ",n!=null&&n.cwd?`· ${Yz(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Qt({preserveScroll:!0}),disabled:X,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:X?"Loading...":"Load previous history"})]}),Y&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:Y})]}),Te&&F&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:O?X?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),ye&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Ut,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(_f,Ae)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ae," hidden)"]})]})}),l.jsx(nv,{entries:De,toolActivity:m,liveRunKey:Re}),h&&h.size>0&&!K&&l.jsx(Az,{tools:Array.from(h.values())}),c==="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..."})]}),(c==="running"||V)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":St,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${St==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${St==="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]"}`}),St==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:G.length===1?"Background process running":`${G.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:lo(Math.max(0,Date.now()-ae))})]}),((nn=G[0])==null?void 0:nn.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:G[0].description})]})]}):St==="stalled"?l.jsxs("span",{children:["No activity for ",lo(Xe)," — the agent may be stuck"]}):St==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:se?`Running ${se.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:se?lo(Math.max(0,Date.now()-se.startedAt)):`no update for ${lo(Xe)}`}),(se==null?void 0:se.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:se.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:lo(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:[Gc(a)," tokens"]})]})]})]}),l.jsx("div",{ref:v})]})})]})}const n$={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function s$(e,t){for(const[i,a]of Object.entries(n$))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function i$(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:s$(t.value,n)}))}const cN=[{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:""}],uN=[{value:"gpt-6-astra",label:"GPT-6-Astra",icon:"✦"},{value:"gpt-5.6-sol",label:"GPT-5.6-Sol",icon:"■"},{value:"gpt-5.6-terra",label:"GPT-5.6-Terra",icon:"✳"},{value:"gpt-5.6-luna",label:"GPT-5.6-Luna",icon:"⚡"},{value:"gpt-5.5",label:"GPT-5.5",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],sv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],iv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],r$=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],dN=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],fN=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function hN(e){return e==="codex"?uN:cN}function r2(e){return e==="codex"?iv:sv}function EB(e){return e==="codex"?fN:dN}function a2(e){return e==="codex"?uN[0].value:cN[0].value}function l2(e){return e==="codex"?iv[0].value:sv[0].value}function TB(e){return e==="codex"?fN[0].value:dN[0].value}function a$(e){return e==="codex"?[]:r$}function o2({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=Q(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),c=Q(b=>b.sessions.get(e)),u=Q(b=>b.cliConnected.get(e)??!1),f=(a==null?void 0:a.backendType)??(c==null?void 0:c.backend_type)??"claude",h=(c==null?void 0:c.model)??(a==null?void 0:a.model)??"",m=hN(f),v=m.find(b=>b.value===h)||(h?{label:h,icon:"?"}:null),x=k.useCallback(b=>{if(n(!1),b===h)return;Fn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=Q.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,h]);return k.useEffect(()=>{if(!t)return;const b=y=>{i.current&&!i.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),k.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),!u||!v?null:l.jsxs("div",{ref:i,className:"relative shrink-0",children:[l.jsxs("button",{onClick:()=>n(b=>!b),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${v.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[v.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:v.icon}),l.jsx("span",{children:v.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:m.map(b=>l.jsxs("button",{onClick:()=>x(b.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${b.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":b.value===h,children:[b.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:b.icon}),l.jsx("span",{className:"flex-1 text-left",children:b.label}),b.value===h&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},b.value))})]})}function pN({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:c,className:u=""}){return e?l.jsx("div",{ref:c,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>l.jsxs("button",{"data-prompt-index":h,onClick:()=>a(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function mN({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,c]=k.useState(!1),[u,f]=k.useState(0),[h,m]=k.useState([]),[v,x]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{x(!0);try{const S=await ke.listPrompts(n);m(S.filter(C=>!!C.name.trim()))}catch{m([])}finally{x(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const S=e.slice(0,t),C=S.match(/(^|\s)@([^\s@]*)$/);if(!C||C.index===void 0)return null;const E=S.length-C[0].length+C[1].length;return{query:C[2]||"",start:E,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const S=_.query.toLowerCase();if(!S)return h;const C=h.filter(L=>L.name.toLowerCase().startsWith(S)),E=h.filter(L=>!L.name.toLowerCase().startsWith(S)&&L.name.toLowerCase().includes(S));return[...C,...E]},[a,_,h]);k.useEffect(()=>{const S=i&&!!_;S&&!a?(c(!0),f(0)):!S&&a&&c(!1)},[i,_,a]),k.useEffect(()=>{u>=j.length&&f(Math.max(0,j.length-1))},[j.length,u]),k.useEffect(()=>{if(!b.current||!a)return;const C=b.current.querySelectorAll("[data-prompt-index]")[u];C&&C.scrollIntoView({block:"nearest"})},[u,a]);const N=k.useCallback(S=>{if(!_)return{nextText:e,nextCursor:t};const C=`${S.content} `,E=`${e.slice(0,_.start)}${C}${e.slice(_.end)}`,L=_.start+C.length;return{nextText:E,nextCursor:L}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:j,promptsLoading:v,savedPrompts:h,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const l$=[];function c2({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const c=a==="desktop",u=c?"px-2.5 py-1.5":"px-2 py-1",f=c?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",h=c?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?f:h:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:i})]})}function wf({onClick:e,disabled:t,active:n,title:i,children:a}){return l.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:a})}function u2(){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 d2({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const c=a==="desktop",u=c?"w-9 h-9":"w-10 h-10",f=c?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?f:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function o$({sessionId:e}){var ue,be;const[t,n]=k.useState(""),[i,a]=k.useState([]),[c,u]=k.useState(null),[f,h]=k.useState(!1),[m,v]=k.useState(!1),[x,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState("global"),[E,L]=k.useState(null),[O,R]=k.useState(0),F=k.useRef(null),D=k.useRef(null),X=k.useRef(null),P=k.useRef(null),Y=Q(H=>H.cliConnected),A=Q(H=>H.sessions.get(e)),fe=Q(H=>H.previousPermissionMode.get(e)||"acceptEdits"),te=Y.get(e)??!1,K=(A==null?void 0:A.permissionMode)||"acceptEdits",G=K==="plan",V=(A==null?void 0:A.backend_type)==="codex",ae=((be=(ue=(V?iv:sv).find(H=>H.value===K))==null?void 0:ue.label)==null?void 0:be.toLowerCase())||K,M=mN({text:t,caretPos:O,cwd:A==null?void 0:A.cwd,enabled:!m}),Te=k.useMemo(()=>{const H=[];if(A!=null&&A.slash_commands)for(const ge of A.slash_commands)H.push({name:ge,type:"command"});if(A!=null&&A.skills)for(const ge of A.skills)H.push({name:ge,type:"skill"});return H},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),Ce=k.useMemo(()=>{if(!m)return[];const H=t.match(/^\/(\S*)$/);if(!H)return[];const ge=H[1].toLowerCase();return ge===""?Te:Te.filter(Pe=>Pe.name.toLowerCase().includes(ge))},[t,m,Te]);k.useEffect(()=>{const H=t.startsWith("/")&&/^\/\S*$/.test(t)&&Te.length>0;H&&!m?(v(!0),b(0)):!H&&m&&v(!1)},[t,Te.length,m]),k.useEffect(()=>{x>=Ce.length&&b(Math.max(0,Ce.length-1))},[Ce.length,x]),k.useEffect(()=>{if(!X.current||!m)return;const ge=X.current.querySelectorAll("[data-cmd-index]")[x];ge&&ge.scrollIntoView({block:"nearest"})},[x,m]),k.useEffect(()=>{if(P.current===null||!F.current)return;const H=P.current;F.current.setSelectionRange(H,H),P.current=null},[t]);const z=k.useCallback(H=>{var ge;n(`/${H.name} `),v(!1),(ge=F.current)==null||ge.focus()},[]),B=k.useCallback(H=>{var Pe;const ge=M.selectPrompt(H);P.current=ge.nextCursor,n(ge.nextText),M.setMentionMenuOpen(!1),R(ge.nextCursor),(Pe=F.current)==null||Pe.focus(),F.current&&(F.current.style.height="auto",F.current.style.height=Math.min(F.current.scrollHeight,200)+"px")},[M]);function ce(){var at;const H=t.trim();if(!H||!te)return;const ge=f0(),Pe=i.length>0?i.map(ft=>({name:ft.name,media_type:ft.mediaType,data:ft.base64,size:ft.size})):void 0;Fn(e,{type:"user_message",content:H,session_id:e,attachments:Pe,client_msg_id:ge});const We=Q.getState();We.appendMessage(e,{id:ge,role:"user",content:H,attachments:Pe,timestamp:Date.now()}),We.setSessionStatus(e,"running"),We.setLastActivity(e,Date.now()),We.streamingStartedAt.has(e)||We.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),v(!1),M.setMentionMenuOpen(!1),F.current&&(F.current.style.height="auto"),(at=F.current)==null||at.focus()}function ye(H){if(m&&Ce.length>0){if(H.key==="ArrowDown"){H.preventDefault(),b(ge=>(ge+1)%Ce.length);return}if(H.key==="ArrowUp"){H.preventDefault(),b(ge=>(ge-1+Ce.length)%Ce.length);return}if(H.key==="Tab"&&!H.shiftKey){H.preventDefault(),z(Ce[x]);return}if(H.key==="Enter"&&!H.shiftKey){H.preventDefault(),z(Ce[x]);return}if(H.key==="Escape"){H.preventDefault(),v(!1);return}}if(M.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),M.setMentionMenuOpen(!1);return}if(M.mentionMenuOpen&&M.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),M.setMentionMenuIndex(ge=>(ge+1)%M.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),M.setMentionMenuIndex(ge=>(ge-1+M.filteredPrompts.length)%M.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),B(M.filteredPrompts[M.mentionMenuIndex]);return}}if(M.mentionMenuOpen&&M.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault(),Xe();return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),ce())}function Ne(H){n(H.target.value),R(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 Ae(){F.current&&R(F.current.selectionStart??0)}function Le(){Fn(e,{type:"interrupt"})}async function De(H){if(H.length===0)return;const ge=[],Pe=[];let We=i.reduce((at,ft)=>at+ft.size,0);for(const at of H){if(at.size>ch){Pe.push(`${at.name} is too large (${ua(at.size)}, max ${ua(ch)})`);continue}if(We+at.size>uh){Pe.push(`${at.name} would exceed the per-message limit (${ua(uh)})`);continue}const{base64:ft,mediaType:hn}=await Jj(at);ge.push({name:at.name,base64:ft,mediaType:hn,size:at.size}),We+=at.size}ge.length>0&&a(at=>[...at,...ge]),u(Pe.length>0?Pe.join("; "):null)}async function Ee(H){const ge=H.target.files;ge&&(await De(Array.from(ge)),H.target.value="")}function Re(H){a(ge=>ge.filter((Pe,We)=>We!==H))}async function Ut(H){var We;const ge=(We=H.clipboardData)==null?void 0:We.items;if(!ge)return;const Pe=[];for(const at of Array.from(ge)){if(at.kind!=="file")continue;const ft=at.getAsFile();if(!ft)continue;const hn=ft.name&&ft.name.length>0?ft.name:`pasted-${Date.now()}.${(ft.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Pe.push(new File([ft],hn,{type:ft.type,lastModified:ft.lastModified}))}Pe.length>0&&(H.preventDefault(),await De(Pe))}function Qt(H){H.dataTransfer.types.includes("Files")&&(H.preventDefault(),H.stopPropagation(),h(!0))}function Ft(H){H.currentTarget===H.target&&h(!1)}async function jt(H){if(!H.dataTransfer.types.includes("Files"))return;H.preventDefault(),H.stopPropagation(),h(!1);const ge=Array.from(H.dataTransfer.files);ge.length>0&&await De(ge)}function wt(){const H=t.trim().slice(0,32);N(H||""),L(null),_(ge=>!ge)}function Xe(){if(!te)return;const H=Q.getState();if(!G)H.setPreviousPermissionMode(e,K),Fn(e,{type:"set_permission_mode",mode:"plan"}),H.updateSession(e,{permissionMode:"plan"});else{const ge=fe||(V?"bypassPermissions":"acceptEdits");Fn(e,{type:"set_permission_mode",mode:ge}),H.updateSession(e,{permissionMode:ge})}}async function St(){const H=t.trim(),ge=j.trim();if(!H||!ge)return;if(S==="project"&&!(A!=null&&A.cwd)){L("No project folder available for this session");return}const Pe={name:ge,content:H,scope:S};S==="project"&&(Pe.projectPaths=[A.cwd]);try{await ke.createPrompt(Pe),await M.refreshPrompts(),_(!1),N(""),C("global"),L(null)}catch(We){const at=We instanceof Error&&We.message?We.message:"Could not save prompt.";L(at)}}const ne=Q(H=>H.promptSuggestions.get(e))??l$,je=Q(H=>H.clearPromptSuggestions),Je=Q(H=>H.sessionStatus).get(e)==="running",un=t.trim().length>0&&te;return l.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${f?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:Qt,onDragLeave:Ft,onDrop:jt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((H,ge)=>l.jsx(nN,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>Re(ge)},ge))}),c&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:c}),l.jsx("input",{ref:D,type:"file",multiple:!0,onChange:Ee,className:"hidden","aria-label":"Attach files"}),ne.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:ne.map((H,ge)=>l.jsx("button",{onClick:()=>{if(!te||Je)return;const Pe=f0();Fn(e,{type:"user_message",content:H,session_id:e,client_msg_id:Pe}),Q.getState().appendMessage(e,{id:Pe,role:"user",content:H,timestamp:Date.now()}),je(e)},disabled:!te||Je,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:H,children:H},ge))}),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 ${G?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[m&&Ce.length>0&&l.jsx("div",{ref:X,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:Ce.map((H,ge)=>l.jsxs("button",{"data-cmd-index":ge,onClick:()=>z(H),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${ge===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:H.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:["/",H.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:H.type})]})]},`${H.type}-${H.name}`))}),l.jsx(pN,{open:M.mentionMenuOpen,loading:M.promptsLoading,prompts:M.filteredPrompts,selectedIndex:M.mentionMenuIndex,onSelect:B,menuRef:M.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:H=>{N(H.target.value),E&&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":S==="global",onClick:()=>C("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="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":S==="project",onClick:()=>C("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="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"})]}),S==="project"&&(A==null?void 0:A.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:A.cwd,children:A.cwd}),E?l.jsx("div",{className:"text-[11px] text-cc-error",children:E}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),C("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:St,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(c2,{isPlan:G,isConnected:te,onToggle:Xe,modeLabel:ae,size:"mobile"}),l.jsx(o2,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(wf,{onClick:wt,disabled:!te||!t.trim(),active:te&&!!t.trim(),title:"Save as prompt",children:l.jsx(u2,{})}),l.jsx(wf,{onClick:()=>{var H;return(H=D.current)==null?void 0:H.click()},disabled:!te,active:te,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:F,value:t,onChange:Ne,onKeyDown:ye,onClick:Ae,onKeyUp:Ae,onPaste:Ut,"aria-label":"Message input",placeholder:te?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!te,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(d2,{isRunning:Je,canSend:un,onSend:ce,onInterrupt:Le,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(wf,{onClick:()=>{var H;return(H=D.current)==null?void 0:H.click()},disabled:!te,active:te,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(wf,{onClick:wt,disabled:!te||!t.trim(),active:te&&!!t.trim(),title:"Save as prompt",children:l.jsx(u2,{})}),l.jsx(c2,{isPlan:G,isConnected:te,onToggle:Xe,modeLabel:ae,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(o2,{sessionId:e}),l.jsx(d2,{isRunning:Je,canSend:un,onSend:ce,onInterrupt:Le,size:"desktop"})]})]})]})})}function c$(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function u$(e,t){const n={};for(const[i,a]of Object.entries(t)){const c=e[Number(i)],u=typeof(c==null?void 0:c.question)=="string"&&c.question?c.question:i;n[u]=a}return n}function d$({permission:e,sessionId:t}){const[n,i]=k.useState(!1),a=Q(m=>m.removePermission);function c(m,v){i(!0),Fn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:m,...v!=null&&v.length?{updated_permissions:v}:{}}),a(t,e.request_id)}function u(){i(!0),Fn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return l.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:l.jsx("div",{className:"max-w-3xl mx-auto",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:l.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&l.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&l.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?l.jsx(g$,{input:e.input,onSelect:m=>c({...e.input,answers:m}),disabled:n}):l.jsx(p$,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&l.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&l.jsx(h$,{validation:e.ai_validation}),!f&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>c(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((m,v)=>l.jsxs("button",{onClick:()=>c(void 0,[m]),disabled:n,title:`${m.type}: ${JSON.stringify(m)}`,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"})}),c$(m)]},v)),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 f$(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 h$({validation:e}){const t=e.verdict==="uncertain"&&f$(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return l.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),l.jsx("span",{className:"font-medium",children:i}),l.jsx("span",{children:e.reason})]})}function p$({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(m$,{input:t}):e==="Edit"?l.jsx(x$,{input:t}):e==="Write"?l.jsx(v$,{input:t}):e==="Read"?l.jsx(b$,{input:t}):e==="Glob"?l.jsx(y$,{input:t}):e==="Grep"?l.jsx(_$,{input:t}):e==="ExitPlanMode"?l.jsx(w$,{input:t}):l.jsx(gN,{input:t,description:n})}function m$({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 g$({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,c]=k.useState({}),[u,f]=k.useState({}),[h,m]=k.useState({});function v(N){return u$(i,N)}function x(N,S){const C=String(N);c(E=>({...E,[C]:S})),m(E=>({...E,[C]:!1})),i.length<=1&&t(v({[C]:S}))}function b(N){var E;const S=String(N),C=(E=u[S])==null?void 0:E.trim();C&&(c(L=>({...L,[S]:C})),i.length<=1&&t(v({[S]:C})))}function y(N,S){const C=String(N);f(L=>({...L,[C]:S}));const E=S.trim();c(L=>{if(!E){const O={...L};return delete O[C],O}return{...L,[C]:E}})}function _(N){const S=String(N);m(C=>{const E=!!C[S],L={...C,[S]:!E};return E&&(c(O=>{const R={...O};return delete R[S],R}),f(O=>{const R={...O};return delete R[S],R})),L})}function j(){t(v(a))}if(i.length===0){const N=typeof e.question=="string"?e.question:"";return N?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:N}):l.jsx(gN,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((N,S)=>{const C=typeof N.header=="string"?N.header:"",E=typeof N.question=="string"?N.question:"",L=Array.isArray(N.options)?N.options:[],O=String(S),R=a[O],F=h[O];return l.jsxs("div",{className:"space-y-2",children:[C&&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:C}),E&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:E}),L.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[L.map((D,X)=>{const P=typeof D.label=="string"?D.label:String(D),Y=typeof D.description=="string"?D.description:"",A=R===P;return l.jsx("button",{onClick:()=>x(S,P),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${A?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${A?"border-cc-primary":"border-cc-muted/40"}`,children:A&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:P}),Y&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:Y})]})]})},X)}),l.jsx("button",{onClick:()=>_(S),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${F?"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 ${F?"border-cc-primary":"border-cc-muted/40"}`,children:F&&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..."})]})}),F&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[O]||"",onChange:D=>y(S,D.target.value),onKeyDown:D=>{D.key==="Enter"&&b(S)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},S)}),i.length>1&&Object.keys(a).length>0&&l.jsx("button",{onClick:j,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function x$({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(wo,{oldText:n,newText:i,fileName:t,mode:"compact"})}function v$({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(wo,{newText:n,fileName:t,mode:"compact"})}function b$({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 y$({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 _$({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n}),i&&l.jsx("div",{className:"text-cc-muted",children:i})]})}function w$({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(Kx,{remarkPlugins:[ev],components:{h1:({children:i})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>l.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>l.jsx("li",{children:i}),strong:({children:i})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:a})=>l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:i=>{const{children:a,className:c}=i;return/language-(\w+)/.exec(c||"")||typeof a=="string"&&a.includes(`
|
|
105
|
-
`)?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(Zj,{textClassName:"text-[12px] text-cc-code-fg",children:a})},pre:({children:i})=>l.jsx(l.Fragment,{children:i}),blockquote:({children:i})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),l.jsx("div",{className:"space-y-1",children:n.map((i,a)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[l.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function gN({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,a])=>{const c=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:c})]},i)})})]})}function S$({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,c=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const f=n.input.command;u=f.length>60?f.slice(0,60)+"...":f}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${c?"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-",c?"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 k$=[],j$=[],f2="activity-tray-panel";function N$(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),a=n%60;return`${i}m${a>0?` ${a}s`:""}`}function C$(e,t,n=4e3){const[i,a]=k.useState(!1),c=k.useRef(void 0),u=e.length+t.length,f=u>0&&e.every(h=>h.status==="completed")&&t.every(h=>h.status!=="running");return k.useEffect(()=>(clearTimeout(c.current),f?c.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(c.current)),[f,n]),k.useEffect(()=>{a(!1)},[u]),i}function E$(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(i)},[e]),t}function T$({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 M$({agent:e,tick:t}){const[n,i]=k.useState(!1),a=e.status!=="running",c=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(T$,{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:N$(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[c?l.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function A$({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 R$({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=k.useRef(null),c=Q(E=>E.sessionTasks.get(e)??k$),u=Q(E=>E.sessionBackgroundAgents.get(e)??j$),f=C$(c,u),h=u.some(E=>E.status==="running"),m=E$(h),v=u.filter(E=>E.status==="running").length,x=c.length,b=c.filter(E=>E.status==="completed").length,y=c.filter(E=>E.status==="in_progress").length,_=c.length>0||u.length>0,j=v>0||y>0,N=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const E=L=>{L.key==="Escape"&&(L.stopPropagation(),N())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,N]),k.useEffect(()=>{if(!t)return;const E=L=>{i.current&&!i.current.contains(L.target)&&N()};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[S,C]=k.useState(!1);return k.useEffect(()=>{_&&C(!1)},[_,c.length,u.length]),!_||S?null:l.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,style:f?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{f&&C(!0)},children:[t&&l.jsxs("div",{ref:a,id:f2,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(E=>l.jsx(M$,{agent:E,tick:m},E.toolUseId))]}),u.length>0&&c.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),c.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"})}),c.map(E=>l.jsx(A$,{task:E},E.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":f2,className:`
|
|
106
|
-
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
107
|
-
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
108
|
-
shadow-md shadow-black/15
|
|
109
|
-
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
110
|
-
transition-all duration-200 cursor-pointer
|
|
111
|
-
${t?"ring-1 ring-cc-primary/30":""}
|
|
112
|
-
`,"aria-label":`Activity: ${v} 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:v>0?`${v} agent${v!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.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 O$({sessionId:e}){const t=Q(_=>_.pendingPermissions.get(e)),n=Q(_=>_.aiResolvedPermissions.get(e)),i=Q(_=>_.clearAiResolvedPermissions),a=Q(_=>_.connectionStatus.get(e)??"disconnected"),c=Q(_=>_.cliConnected.get(e)??!1),u=Q(_=>_.cliReconnecting.get(e)??!1),f=Q(_=>_.setCliReconnecting),[h,m]=k.useState(null),v=k.useRef(void 0);k.useEffect(()=>{m(null),clearTimeout(v.current)},[e,c]),k.useEffect(()=>()=>clearTimeout(v.current),[]);const x=k.useCallback(async()=>{m(null),clearTimeout(v.current),f(e,!0);try{await ke.relaunchSession(e)}catch(_){fa(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";m(j),v.current=setTimeout(()=>m(null),4e3)}},[e,f]),b=k.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!c;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(t$,{sessionId:e}),l.jsx(R$,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(S$,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(d$,{permission:_,sessionId:e},_.request_id))}),l.jsx(o$,{sessionId:e})]})}function L$({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=Q(m=>m.sessions.get(e)),c=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function m(v){i.current&&!i.current.contains(v.target)&&n(!1)}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t]);function h(m,v){const x=!v,b={[m]:x};Q.getState().setSessionAiValidation(e,b),X4(e,b)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function D$({sessionId:e}){const[t,n]=k.useState(!1),[i,a]=k.useState(null),[c,u]=k.useState(!1),f=k.useRef(null);k.useEffect(()=>{if(!t)return;const m=x=>{f.current&&!f.current.contains(x.target)&&n(!1)},v=x=>{x.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",m),window.addEventListener("keydown",v),()=>{window.removeEventListener("pointerdown",m),window.removeEventListener("keydown",v)}},[t]);const h=k.useCallback(async m=>{a(m),u(!1);try{const{blob:v,filename:x}=await ke.exportSession(e,m),b=URL.createObjectURL(v),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(v){fa(v),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.jsx("button",{onClick:()=>n(m=>!m),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),c&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function z$({sessionId:e}){const t=Q(v=>v.density),n=Q(v=>v.magicUiAvailable),i=Q(v=>{var x;return!!e&&((x=v.sessions.get(e))==null?void 0:x.magicUiActive)===!0}),a=k.useCallback(()=>{var x;if(!e)return;const v=Q.getState();((x=v.sessions.get(e))==null?void 0:x.magicUiActive)===!0&&(v.setSessionMagicUi(e,!1),L_(e,!1))},[e]),c=k.useCallback(()=>{Q.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{Q.getState().setDensity("compact"),a()},[a]),f=k.useCallback(()=>{e&&(Q.getState().setSessionMagicUi(e,!0),L_(e,!0))},[e]);if(!n||!e)return l.jsx($$,{});const h=t==="compact",m=[{key:"standard",label:"Standard view",active:!i&&!h,onClick:c,icon:l.jsx(xN,{})},{key:"compact",label:"Compact view",active:!i&&h,onClick:u,icon:l.jsx(vN,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:f,icon:l.jsx(B$,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:m.map(v=>l.jsx("button",{onClick:v.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${v.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:v.label,"aria-label":v.label,"aria-pressed":v.active,children:v.icon},v.key))})}function $$(){const e=Q(a=>a.density),t=k.useCallback(()=>Q.getState().toggleDensity(),[]),n=e==="compact",i=n?"Switch to standard density":"Switch to compact density";return l.jsx("button",{onClick:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${n?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:i,"aria-label":i,"aria-pressed":n,children:n?l.jsx(vN,{}):l.jsx(xN,{})})}function xN(){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 vN(){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 B$(){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 P$(){var F;const e=k.useSyncExternalStore(D=>(window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)),()=>window.location.hash),t=k.useMemo(()=>Ox(e),[e]),n=t.page==="session"||t.page==="home",i=Q(D=>D.currentSessionId),a=Q(D=>D.cliConnected),c=Q(D=>D.sessionStatus),u=Q(D=>D.sessionNames),f=Q(D=>D.sdkSessions),h=Q(D=>D.sidebarOpen),m=Q(D=>D.setSidebarOpen),v=Q(D=>D.taskPanelOpen),x=Q(D=>D.setTaskPanelOpen),b=Q(D=>D.activeTab),y=Q(D=>D.setActiveTab),_=Q(D=>D.markChatTabReentry),j=Q(D=>i?D.gitChangedFilesCount.get(i)??0:0),N=i?c.get(i)??null:null,S=i?a.get(i)??!1:!1,C=i?(u==null?void 0:u.get(i))||((F=f.find(D=>D.sessionId===i))==null?void 0:F.name)||`Session ${i.slice(0,8)}`:null,E=!!(i&&n),L=t.page==="session"&&!!i,O=["chat","diff"],R=D=>{D==="chat"&&b!=="chat"&&i&&_(i),y(D)};return k.useEffect(()=>{const D=X=>{if(!(X.metaKey||X.ctrlKey)||X.key.toLowerCase()!=="j"||!E)return;const P=X.target;if(P&&(P.tagName==="TEXTAREA"||P.tagName==="INPUT"||P.isContentEditable))return;X.preventDefault();const Y=Math.max(0,O.indexOf(b)),A=X.shiftKey?-1:1,fe=(Y+A+O.length)%O.length;R(O[fe])};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[E,O,b,y,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>m(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),E&&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:()=>R("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:C||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>R("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:[E&&i&&l.jsx(L$,{sessionId:i}),E&&i&&l.jsx(D$,{sessionId:i}),E&&l.jsx(z$,{sessionId:i??null}),l.jsx(U$,{}),L&&l.jsx("button",{onClick:()=>x(!v),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${v?"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 U$(){const e=Q(n=>n.darkMode),t=k.useCallback(()=>Q.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 bN="cc-recent-dirs";function dh(){try{return JSON.parse(localStorage.getItem(bN)||"[]")}catch{return[]}}function yN(e){const t=dh().filter(n=>n!==e);t.unshift(e),localStorage.setItem(bN,JSON.stringify(t.slice(0,5)))}function F$(){return!1}function _N({onClose:e,embedded:t=!1}){const[n,i]=k.useState([]),[a,c]=k.useState(!0),[u,f]=k.useState(null),[h,m]=k.useState(""),[v,x]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,S]=k.useState(""),[C,E]=k.useState([{key:"",value:""}]),[L,O]=k.useState(!1),R=k.useCallback(()=>{ke.listEnvs().then(i).catch(()=>{}).finally(()=>c(!1))},[]);k.useEffect(()=>{R()},[R]);function F(K){f(K.slug),m(K.name);const G=Object.entries(K.variables).map(([V,se])=>({key:V,value:se}));G.length===0&&G.push({key:"",value:""}),x(G),y("")}function D(){f(null),y("")}async function X(){if(!u)return;const K={};for(const G of v){const V=G.key.trim();V&&(K[V]=G.value)}try{await ke.updateEnv(u,{name:h.trim()||void 0,variables:K}),f(null),y(""),R()}catch(G){y(G instanceof Error?G.message:String(G))}}async function P(K){try{await ke.deleteEnv(K),u===K&&f(null),R()}catch(G){y(G instanceof Error?G.message:String(G))}}async function Y(){const K=N.trim();if(!K)return;O(!0);const G={};for(const V of C){const se=V.key.trim();se&&(G[se]=V.value)}try{await ke.createEnv(K,G),S(""),E([{key:"",value:""}]),j(!1),y(""),R()}catch(V){y(V instanceof Error?V.message:String(V))}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:K=>S(K.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:K=>{K.key==="Enter"&&N.trim()&&Y()}}),l.jsx(Sf,{rows:C,onChange:E}),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:Y,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(K=>{const G=u===K.slug,V=Object.keys(K.variables).length;return G?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:se=>m(se.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),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(Sf,{rows:v,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:D,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 X(),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"})]})]},K.slug):l.jsx(I$,{env:K,varCount:V,onStartEdit:()=>F(K),onDelete:()=>void P(K.slug)},K.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const A=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:K=>S(K.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:K=>{K.key==="Enter"&&N.trim()&&Y()}}),l.jsx(Sf,{rows:C,onChange:E}),l.jsx("button",{onClick:Y,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"})]}),fe=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(K=>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:K.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(K.variables).length," var",Object.keys(K.variables).length!==1?"s":""]}),u===K.slug?l.jsx("button",{onClick:D,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:()=>F(K),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:()=>P(K.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===K.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:G=>m(G.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(Sf,{rows:v,onChange:x})]})}),l.jsx("button",{onClick:X,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!==K.slug&&Object.keys(K.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(K.variables).map(([G,V])=>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:G}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:V})]},G))})]},K.slug))}),te=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:K=>K.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}),fe,A]})]});return ko.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:te}),document.body)}function I$({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function Sf({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function i(c){const u=e.filter((f,h)=>h!==c);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((c,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:c.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:c.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const H$=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:_N},Symbol.toStringTag,{value:"Module"}));function q$(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function V$({initialPath:e,onSelect:t,onClose:n}){const[i,a]=k.useState(""),[c,u]=k.useState([]),[f,h]=k.useState(!0),[m,v]=k.useState(""),[x,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState(-1),[E,L]=k.useState(!1),[O,R]=k.useState(()=>dh()),F=k.useRef(null),D=k.useRef(null),X=k.useRef(null),P=k.useRef(new Map),Y=k.useMemo(()=>{if(!j)return c;const V=j.toLowerCase();return c.filter(se=>se.name.toLowerCase().includes(V))},[c,j]),A=k.useCallback(async V=>{h(!0),v(""),N(""),C(-1);try{const se=await ke.listDirs(V);a(se.path),u(se.dirs)}catch{v("Could not load directory"),u([])}finally{h(!1)}},[]);k.useEffect(()=>{A(e||void 0)},[]),k.useEffect(()=>{const V=F.current;if(!V)return;function se(M){if(M.key!=="Tab")return;const Te=V.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(Te.length===0)return;const Ce=Te[0],z=Te[Te.length-1];M.shiftKey&&document.activeElement===Ce?(M.preventDefault(),z.focus()):!M.shiftKey&&document.activeElement===z&&(M.preventDefault(),Ce.focus())}document.addEventListener("keydown",se);const ae=setTimeout(()=>{var M;(M=X.current)==null||M.focus()},80);return()=>{document.removeEventListener("keydown",se),clearTimeout(ae)}},[]);const fe=k.useCallback(()=>{E||(L(!0),setTimeout(n,150))},[n,E]);k.useEffect(()=>{function V(se){if(se.key==="Escape"){if(y)return;fe()}}return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[y,fe]),k.useEffect(()=>{function V(se){var M,Te;if(y)return;if(se.key==="Backspace"&&document.activeElement!==X.current){if(i&&i!=="/"){se.preventDefault();const Ce=i.split("/").slice(0,-1).join("/")||"/";A(Ce)}return}const ae=Y.length;if(ae!==0){if(se.key==="ArrowDown"){se.preventDefault();const Ce=S<ae-1?S+1:0;C(Ce),(M=P.current.get(Ce))==null||M.focus()}else if(se.key==="ArrowUp"){se.preventDefault();const Ce=S>0?S-1:ae-1;C(Ce),(Te=P.current.get(Ce))==null||Te.focus()}}}return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[y,Y.length,S,i,A]),k.useEffect(()=>{var V;S>=0&&((V=P.current.get(S))==null||V.scrollIntoView({block:"nearest"}))},[S]);function te(V){yN(V),R(dh()),t(V),n()}const K=q$(i),G=i.split("/").pop()||"/";return ko.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${E?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:fe,children:l.jsxs("div",{ref:F,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 ${E?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:V=>V.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:fe,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(V=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>te(V),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:V.split("/").pop()||V}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:V})]})},V))})]}),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:V=>b(V.target.value),onKeyDown:V=>{V.key==="Enter"&&x.trim()&&te(x.trim()),V.key==="Escape"&&(V.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:K.map((V,se)=>{const ae=se===K.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[se>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{ae||A(V.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:V.label})]},V.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:X,type:"text","aria-label":"Filter directories",value:j,onChange:V=>{N(V.target.value),C(-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:()=>te(i),"aria-label":`Select ${G}`,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:G})]})]}),l.jsx("div",{ref:D,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((V,se)=>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+se*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${se*.1}s infinite`}})]},se))}):m?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:m}),l.jsx("button",{type:"button",onClick:()=>A(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):Y.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:Y.map((V,se)=>l.jsxs("li",{className:`flex items-center transition-colors ${S===se?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ae=>{ae?P.current.set(se,ae):P.current.delete(se)},onClick:()=>A(V.path),onKeyDown:ae=>{ae.key==="Enter"&&(ae.preventDefault(),te(V.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:V.path,"aria-label":`Navigate into ${V.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:V.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:()=>te(V.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 ${V.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"})})})]},V.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 G$(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function Y$(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():G$(e.identifier,e.title)}function ou({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 X$({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,c]=k.useState(""),[u,f]=k.useState(""),[h,m]=k.useState(""),[v,x]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,S]=k.useState(""),[C,E]=k.useState(""),[L,O]=k.useState(!0),[R,F]=k.useState(!1),[D,X]=k.useState("");k.useEffect(()=>{let Y=!0;return Promise.all([ke.getLinearStates(t),ke.getLinearConnection(t)]).then(([A,fe])=>{var K;if(!Y)return;j(A.teams),S(fe.viewerId);const te=((K=A.teams[0])==null?void 0:K.id)||"";m(te)}).catch(A=>{Y&&X(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{Y&&O(!1)}),()=>{Y=!1}},[t]),k.useEffect(()=>{if(!h||_.length===0){E("");return}const Y=_.find(fe=>fe.id===h),A=Y==null?void 0:Y.states.find(fe=>fe.type==="backlog");E((A==null?void 0:A.id)||"")},[h,_]);async function P(){if(!(!a.trim()||!h)){F(!0),X("");try{const Y=await ke.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:v,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:C||void 0,connectionId:t});n(Y.issue)}catch(Y){X(Y instanceof Error?Y.message:"Failed to create issue")}finally{F(!1)}}}return ko.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:Y=>Y.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),D&&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:D}),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:Y=>c(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&a.trim()&&h&&!R&&P()},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:Y=>f(Y.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:Y=>m(Y.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(Y=>l.jsxs("option",{value:Y.id,children:[Y.name," (",Y.key,")"]},Y.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:v,onChange:Y=>x(Number(Y.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:Y=>y(Y.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:P,disabled:!a.trim()||!h||R,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:R?"Creating...":"Create Issue"})]})]})]})}),document.body)}function Q$({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=k.useState([]),[m,v]=k.useState(null),[x,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[S,C]=k.useState(!1),[E,L]=k.useState(!1),[O,R]=k.useState(""),[F,D]=k.useState(!1),[X,P]=k.useState(null),[Y,A]=k.useState([]),[fe,te]=k.useState(!1),[K,G]=k.useState(""),[V,se]=k.useState(!1),[ae,M]=k.useState([]),[Te,Ce]=k.useState(!1),[z,B]=k.useState(""),[ce,ye]=k.useState(!1),[Ne,Ae]=k.useState([]),[Le,De]=k.useState(!1),[Ee,Re]=k.useState(!1),Ut=k.useRef(null);k.useEffect(()=>{function ne(je){Ut.current&&!Ut.current.contains(je.target)&&(C(!1),se(!1))}return document.addEventListener("pointerdown",ne),()=>document.removeEventListener("pointerdown",ne)},[]),k.useEffect(()=>{if(!n){h([]),v(null),b(!1),u(null);return}let ne=!0;return ke.listLinearConnections().then(({connections:je})=>{ne&&(h(je),b(!0),je.length>0?(v(je[0].id),u(je[0].id)):(v(null),u(null)))}).catch(()=>{ne&&b(!0)}),()=>{ne=!1}},[n]);const Qt=k.useCallback(ne=>{v(ne),u(ne),a(null),N([]),_(""),R(""),Ae([]),B(""),M([]),X&&(te(!0),G(""),ke.getLinearProjectIssues(X.projectId,10,ne).then(({issues:je})=>{A(je)}).catch(je=>{G(je instanceof Error?je.message:String(je))}).finally(()=>{te(!1)}))},[X,u,a]);k.useEffect(()=>{if(!t||!n){P(null),A([]);return}let ne=!0;return te(!0),G(""),(async()=>{try{const{mapping:je}=await ke.getLinearProjectMapping(t.repoRoot);if(!ne)return;if(P(je),je){const{issues:Ye}=await ke.getLinearProjectIssues(je.projectId,10,m??void 0);if(!ne)return;A(Ye)}else A([])}catch(je){if(!ne)return;G(je instanceof Error?je.message:String(je))}finally{ne&&te(!1)}})(),()=>{ne=!1}},[t,n,m]),k.useEffect(()=>{if(!n)return;const ne=y.trim();if(ne.length<2){N([]),R(""),L(!1);return}let je=!0;L(!0),R("");const Ye=setTimeout(()=>{ke.searchLinearIssues(ne,8,m??void 0).then(Je=>{je&&N(Je.issues)}).catch(Je=>{je&&(N([]),R(Je instanceof Error?Je.message:String(Je)))}).finally(()=>{je&&L(!1)})},400);return()=>{je=!1,clearTimeout(Ye)}},[n,y,m]),k.useEffect(()=>{if(!n||!ce){Ae([]),De(!1);return}const ne=z.trim();if(ne.length<2){Ae([]),De(!1);return}let je=!0;De(!0);const Ye=setTimeout(()=>{ke.searchLinearIssues(ne,10,m??void 0).then(Je=>{je&&Ae(Je.issues)}).catch(()=>{je&&Ae([])}).finally(()=>{je&&De(!1)})},400);return()=>{je=!1,clearTimeout(Ye)}},[n,ce,z,m]);function Ft(ne,je=!1){a(ne),_(`${ne.identifier} - ${ne.title}`);const Ye=Y$(ne);c(Ye,!0),je&&C(!1)}function jt(){a(null),_(""),N([]),R("")}async function wt(ne){if(t)try{const{mapping:je}=await ke.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ne.id,projectName:ne.name});P(je),se(!1),te(!0),G("");const{issues:Ye}=await ke.getLinearProjectIssues(ne.id,10,m??void 0);A(Ye)}catch(je){G(je instanceof Error?je.message:String(je))}finally{te(!1)}}async function Xe(){if(t){try{await ke.removeLinearProjectMapping(t.repoRoot)}catch{}P(null),A([]),a(null),_("")}}function St(){if(!n){window.location.hash="#/integrations/linear";return}se(!0),ae.length===0&&(Ce(!0),ke.listLinearProjects(m??void 0).then(({projects:ne})=>M(ne)).catch(()=>{}).finally(()=>Ce(!1)))}function nn(ne){Re(!1),Ft(ne),X&&(te(!0),ke.getLinearProjectIssues(X.projectId,10,m??void 0).then(({issues:je})=>A(je)).catch(()=>{}).finally(()=>te(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Ut,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),x&&f.length>1&&l.jsx("select",{value:m??"",onChange:ne=>Qt(ne.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(ne=>l.jsx("option",{value:ne.id,children:ne.workspaceName||ne.name},ne.id))}),X?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(ou,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:X.projectName}),l.jsx("button",{type:"button",onClick:Xe,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:()=>Re(!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":S,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}C(!S)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(ou,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:St,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:()=>Re(!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."})]})]}),X&&(()=>{const ne=z.trim().toLowerCase(),je=!ce&&ne?Y.filter(Je=>Je.identifier.toLowerCase().includes(ne)||Je.title.toLowerCase().includes(ne)):ce?[]:Y,Ye=ce?Ne:je;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:jt,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:z,onChange:Je=>B(Je.target.value),placeholder:ce?"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"}),fe?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):K?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:K}):Le?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):ce&&ne.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):Ye.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ne?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:Ye.map(Je=>l.jsxs("button",{type:"button",onClick:()=>Ft(Je),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Je.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:Je.identifier})," ",Je.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Je.stateName,Je.priorityLabel].filter(Boolean).join(" - ")})]},Je.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:ce,onChange:Je=>{ye(Je.target.checked),Je.target.checked||Ae([])},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"})]})]})})(),V&&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:()=>se(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),Te?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(ne=>l.jsx("button",{type:"button",onClick:()=>wt(ne),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:ne.name})},ne.id))})]}),S&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:ne=>{_(ne.target.value)},onFocus:()=>C(!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:()=>{C(!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&&E&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!E&&O&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:O}),y.trim().length>=2&&!E&&!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&&!E&&!O&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(ne=>l.jsxs("button",{type:"button",onClick:()=>Ft(ne,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:ne.identifier})," - ",ne.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ne.stateName,ne.teamName].filter(Boolean).join(" • ")})]},ne.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),F&&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:()=>{D(!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"})})]}),Ee&&l.jsx(X$,{defaultProjectId:X==null?void 0:X.projectId,connectionId:m??void 0,onCreated:nn,onClose:()=>Re(!1)})]}):null}function K$({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,m]=k.useState([]),[v,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?ke.listBranches(t.repoRoot).then(j=>{m(j),f(j)}).catch(()=>{m([]),f([])}):(m([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":v,onClick:()=>{!v&&t&&ke.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{ke.listBranches(t.repoRoot).then(j=>{m(j),f(j)}).catch(()=>{m([]),f([])})}),x(!v),y("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),v&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=h.filter(L=>!L.isRemote&&(!j||L.name.toLowerCase().includes(j))),S=h.filter(L=>L.isRemote&&(!j||L.name.toLowerCase().includes(j))),C=h.some(L=>L.name.toLowerCase()===j),E=N.length>0||S.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:()=>{c(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))]}),S.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"}),S.map(L=>l.jsxs("button",{onClick:()=>{c(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}`))]}),!E&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!C&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{c(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 W$=336*60*60*1e3,Qa=12,Z$=24;function ox(e){return e.split("/").filter(Boolean).pop()||e}function h2(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||ox(e.cwd)}function J$(e){return e.length>8?e.slice(0,8):e}function e9(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function t9(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);if(a<14)return`${a}d ago`;const c=Math.floor(a/7);if(c<8)return`${c}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function n9(){var Hi;const[e,t]=k.useState(""),[n]=k.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=k.useState(""),[m,v]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=k.useState([]),[y,_]=k.useState(()=>a2(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>l2(localStorage.getItem("cc-backend")||"claude")),[S,C]=k.useState(()=>localStorage.getItem("cc-effort")||""),[E,L]=k.useState(()=>dh()[0]||""),[O,R]=k.useState([]),[F,D]=k.useState(null),[X,P]=k.useState(!1),[Y,A]=k.useState(""),[fe,te]=k.useState(null),[K,G]=k.useState(!1),[V,se]=k.useState(null),[ae,M]=k.useState(null),[Te,Ce]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),z=fe||hN(m),B=r2(m),ce=a$(m),[ye,Ne]=k.useState([]),[Ae,Le]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[De,Ee]=k.useState(!1),[Re,Ut]=k.useState(!1),Qt=F$(),[Ft,jt]=k.useState(()=>Qt),[wt,Xe]=k.useState([]),[St,nn]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[ne,je]=k.useState(!1),Ye=k.useRef(null),[Je,un]=k.useState(null),ue=k.useRef(null),be=k.useRef(null),[H,ge]=k.useState(!1),[Pe,We]=k.useState(!1),[at,ft]=k.useState(!1),[hn,rs]=k.useState(!1),[Ct,bs]=k.useState(!1),[In,sn]=k.useState(""),[vr,$i]=k.useState(!0),[oe,ve]=k.useState([]),[we,rt]=k.useState(!1),[It,Sn]=k.useState(""),[Nn,xt]=k.useState(!1),[rn,en]=k.useState(Qa),[Co,Ru]=k.useState(""),[ys,br]=k.useState(null),[ga,xa]=k.useState(!1),[Ys,Xs]=k.useState(""),[yr,Bi]=k.useState(!1),[jh,Ou]=k.useState([]),[Pi,ui]=k.useState(null),[ol,va]=k.useState(!1),[Eo,di]=k.useState(""),[To,ba]=k.useState(0),ya=k.useRef(null),as=k.useRef(null),_s=k.useRef(null),dn=k.useRef(null),Cn=k.useRef(null),fi=k.useRef(null),Mo=Q(q=>q.currentSessionId),an=mN({text:e,caretPos:To,cwd:E||void 0});k.useEffect(()=>{if(ya.current===null||!as.current)return;const q=ya.current;as.current.setSelectionRange(q,q),ya.current=null},[e]),k.useEffect(()=>{var xe;window.matchMedia("(min-width: 640px)").matches&&((xe=as.current)==null||xe.focus())},[]),k.useEffect(()=>{ke.getHome().then(({home:q,cwd:xe})=>{E||L(xe||q)}).catch(()=>{}),ke.listEnvs().then(Ne).catch(()=>{}),ke.listSandboxes().then(Xe).catch(()=>{}),ke.getBackends().then(b).catch(()=>{}),ke.getSettings().then(q=>{G(q.linearApiKeyConfigured)}).catch(()=>{})},[]);function Nh(q){v(q),localStorage.setItem("cc-backend",q),te(null),_(a2(q)),N(l2(q)),q!=="claude"&&(bs(!1),ve([]),Sn(""),rt(!1),xt(!1),en(Qa),Ru(""))}k.useEffect(()=>{if(m!=="codex"){te(null);return}ke.getBackendModels(m).then(q=>{if(q.length>0){const xe=i$(q);te(xe),xe.some(st=>st.value===y)||_(xe[0].value)}}).catch(()=>{})},[m]),k.useEffect(()=>{if(ue.current&&(clearInterval(ue.current),ue.current=null),un(null),!Ft)return;const q="the-companion:latest",xe=()=>{ke.getImageStatus(q).then(st=>{un(st),st.status==="idle"&&ke.pullImage(q).catch(()=>{}),(st.status==="ready"||st.status==="error")&&ue.current&&(clearInterval(ue.current),ue.current=null)}).catch(()=>{})};return xe(),ue.current=setInterval(xe,2e3),()=>{ue.current&&(clearInterval(ue.current),ue.current=null)}},[Ft]),k.useEffect(()=>{function q(xe){_s.current&&!_s.current.contains(xe.target)&&ge(!1),dn.current&&!dn.current.contains(xe.target)&&We(!1),Cn.current&&!Cn.current.contains(xe.target)&&ft(!1),fi.current&&!fi.current.contains(xe.target)&&Ee(!1),Ye.current&&!Ye.current.contains(xe.target)&&je(!1)}return document.addEventListener("pointerdown",q),()=>document.removeEventListener("pointerdown",q)},[]),k.useEffect(()=>{if(!E){br(null);return}ke.getRepoInfo(E).then(q=>{br(q),Xs(q.currentBranch),Bi(!1)}).catch(()=>{br(null),Xs(""),Bi(!1)})},[E]);const Ao=z.find(q=>q.value===y)||z[0],_a=B.find(q=>q.value===j)||B[0],cl=ce.find(q=>q.value===S)||ce[0],ul=m==="codex"?"/logo-codex.svg":"/logo.svg",Ui=E?E.split("/").pop()||E:"Select folder",hi=k.useMemo(()=>In.trim(),[In]),_r=m==="claude"&&Ct&&hi.length>0,ls=k.useMemo(()=>{const q=Date.now()-W$;return oe.filter(xe=>xe.createdAt>=q)},[oe]),ln=k.useMemo(()=>Nn?oe:ls.length>0?ls:oe,[Nn,ls,oe]),ws=k.useMemo(()=>Co.trim().toLowerCase(),[Co]),Qs=k.useMemo(()=>ws?ln.filter(q=>{const xe=h2(q).toLowerCase(),st=ox(q.cwd).toLowerCase(),mt=(q.gitBranch||"").toLowerCase(),gt=q.cwd.toLowerCase(),Qe=q.resumeSessionId.toLowerCase();return xe.includes(ws)||st.includes(ws)||mt.includes(ws)||gt.includes(ws)||Qe.includes(ws)}):ln,[ln,ws]),dl=k.useMemo(()=>Qs.slice(0,rn),[Qs,rn]),Fi=rn<Qs.length,Ii=Math.max(0,oe.length-ls.length),Ch=!Nn&&ls.length>0,fl=k.useCallback(async()=>{if(m==="claude"){rt(!0),Sn("");try{const[q,xe]=await Promise.all([ke.listSessions(),ke.discoverClaudeSessions(400).then(Qe=>Qe.sessions)]),st=new Map,mt=Qe=>{const Rn=st.get(Qe.resumeSessionId);(!Rn||Qe.createdAt>Rn.createdAt)&&st.set(Qe.resumeSessionId,Qe)};for(const Qe of q)Qe.backendType!=="codex"&&Qe.cliSessionId&&mt({resumeSessionId:Qe.cliSessionId,sessionId:Qe.sessionId,name:Qe.name,model:Qe.model,createdAt:Qe.createdAt,cwd:Qe.cwd,gitBranch:Qe.gitBranch,source:"companion"});for(const Qe of xe)mt({resumeSessionId:Qe.sessionId,sessionId:Qe.sessionId,slug:Qe.slug,createdAt:Qe.lastActivityAt,cwd:Qe.cwd,gitBranch:Qe.gitBranch,source:"claude_disk"});const gt=Array.from(st.values()).sort((Qe,Rn)=>{const Qn=E&&Qe.cwd===E?0:1,kr=E&&Rn.cwd===E?0:1;return Qn!==kr?Qn-kr:Rn.createdAt-Qe.createdAt});ve(gt),xt(!1),en(Qa)}catch(q){const xe=q instanceof Error?q.message:String(q);Sn(xe||"Failed to load existing sessions"),ve([]),en(Qa)}finally{rt(!1)}}},[m,E]);k.useEffect(()=>{m==="claude"&&Ct&&fl()},[m,Ct,fl]),k.useEffect(()=>{en(Qa)},[ws,Nn]);async function Ro(q){if(q.length===0)return;const xe=[],st=[];let mt=O.reduce((gt,Qe)=>gt+Qe.size,0);for(const gt of q){if(gt.size>ch){st.push(`${gt.name} is too large (${ua(gt.size)}, max ${ua(ch)})`);continue}if(mt+gt.size>uh){st.push(`${gt.name} would exceed the per-message limit (${ua(uh)})`);continue}const{base64:Qe,mediaType:Rn}=await Jj(gt);xe.push({name:gt.name,base64:Qe,mediaType:Rn,size:gt.size}),mt+=gt.size}xe.length>0&&R(gt=>[...gt,...xe]),D(st.length>0?st.join("; "):null)}async function Eh(q){const xe=q.target.files;xe&&(await Ro(Array.from(xe)),q.target.value="")}function vt(q){R(xe=>xe.filter((st,mt)=>mt!==q))}async function Lu(q){var mt;const xe=(mt=q.clipboardData)==null?void 0:mt.items;if(!xe)return;const st=[];for(const gt of Array.from(xe)){if(gt.kind!=="file")continue;const Qe=gt.getAsFile();if(!Qe)continue;const Rn=Qe.name&&Qe.name.length>0?Qe.name:`pasted-${Date.now()}.${(Qe.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;st.push(new File([Qe],Rn,{type:Qe.type,lastModified:Qe.lastModified}))}st.length>0&&(q.preventDefault(),await Ro(st))}function hl(q){t(q.target.value),ba(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 wa(){as.current&&ba(as.current.selectionStart??0)}function Os(q){var st;const xe=an.selectPrompt(q);ya.current=xe.nextCursor,t(xe.nextText),an.setMentionMenuOpen(!1),ba(xe.nextCursor),(st=as.current)==null||st.focus(),as.current&&(as.current.style.height="auto",as.current.style.height=Math.min(as.current.scrollHeight,200)+"px")}function Xn(q){if(an.mentionMenuOpen&&q.key==="Escape"){q.preventDefault(),an.setMentionMenuOpen(!1);return}if(an.mentionMenuOpen&&an.filteredPrompts.length>0){if(q.key==="ArrowDown"){q.preventDefault(),an.setMentionMenuIndex(xe=>(xe+1)%an.filteredPrompts.length);return}if(q.key==="ArrowUp"){q.preventDefault(),an.setMentionMenuIndex(xe=>(xe-1+an.filteredPrompts.length)%an.filteredPrompts.length);return}if(q.key==="Tab"&&!q.shiftKey||q.key==="Enter"&&!q.shiftKey){q.preventDefault(),Os(an.filteredPrompts[an.mentionMenuIndex]);return}}if(an.mentionMenuOpen&&an.filteredPrompts.length===0&&(q.key==="Enter"&&!q.shiftKey||q.key==="Tab"&&!q.shiftKey)){q.preventDefault();return}if(q.key==="Tab"&&q.shiftKey){q.preventDefault();const xe=r2(m),mt=(xe.findIndex(gt=>gt.value===j)+1)%xe.length;N(xe[mt].value);return}q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),zu())}function Du(q){const xe=i.trim(),st=xe?`[${xe}]: ${q}`:q;if(!V)return st;const mt=(V.description??"").trim();return`${["Linear issue context:",`- Identifier: ${V.identifier}`,`- Title: ${V.title}`,V.stateName?`- State: ${V.stateName}`:"",V.priorityLabel?`- Priority: ${V.priorityLabel}`:"",V.teamName?`- Team: ${V.teamName}`:"",`- URL: ${V.url}`,mt?`- Description:
|
|
113
|
-
${mt}`:""].filter(Boolean).join(`
|
|
114
|
-
`)}
|
|
115
|
-
|
|
116
|
-
User request:
|
|
117
|
-
${st}`}async function zu(){const q=e.trim();if(!(!q||X)){if(n&&!i.trim()){A("Please enter your name before starting a session.");return}if(P(!0),A(""),di(""),ys){const xe=Ys||ys.currentBranch;if(xe&&xe===ys.currentBranch){const st=jh.find(mt=>mt.name===xe&&!mt.isRemote);if(st&&st.behind>0){ui({behind:st.behind,branchName:xe});return}}}await wr(q)}}async function wr(q,xe){const st=Q.getState();st.clearCreation(),st.setSessionCreating(!0,m);try{Mo&&m0(Mo);const mt=(xe==null?void 0:xe.resumeSessionAt)||(_r?hi:void 0),gt=mt?(xe==null?void 0:xe.forkSession)??(_r?vr:void 0):void 0,Qe=(xe==null?void 0:xe.cwd)||E,Rn=(xe==null?void 0:xe.branch)!==void 0?xe.branch.trim()||void 0:Ys.trim()||void 0,Qn=(xe==null?void 0:xe.useWorktree)!==void 0?xe.useWorktree:ga,kr=(xe==null?void 0:xe.createBranch)!==void 0?xe.createBranch:!!(Rn&&yr),jr=await SA({model:y,permissionMode:j,effort:m==="claude"&&S?S:void 0,cwd:Qe||void 0,envSlug:Ae||void 0,sandboxEnabled:Ft?!0:void 0,sandboxSlug:Ft&&St?St:void 0,branch:Rn,createBranch:kr?!0:void 0,useWorktree:Qn?!0:void 0,backend:m,codexInternetAccess:m==="codex"?!0:void 0,resumeSessionAt:mt,forkSession:gt,userName:i.trim()||void 0,linearConnectionId:V&&ae||void 0,linearIssue:V?{identifier:V.identifier,title:V.title,stateName:V.stateName,teamName:V.teamName,url:V.url}:void 0},mi=>{Q.getState().addCreationProgress(mi)}),pn=jr.sessionId,qi=Q.getState(),Bu=qi.sdkSessions.filter(mi=>mi.sessionId!==pn);qi.setSdkSessions([...Bu,{sessionId:pn,state:jr.state,cwd:jr.cwd,createdAt:Date.now(),backendType:jr.backendType||m,model:y,permissionMode:j,userName:i.trim()||void 0,resumeSessionAt:mt,forkSession:mt?gt===!0:void 0}]);const Bo=new Set(Q.getState().sessionNames.values()),Pu=S2(Bo),Nr=c.trim()||i.trim(),pl=f.trim()||Pu,Cr=Nr?`${Nr}_${pl}`:pl;Q.getState().setSessionName(pn,Cr),ke.renameSession(pn,Cr).catch(()=>{}),h(""),Qe&&yN(Qe),Q.getState().setPreviousPermissionMode(pn,j),Lx(pn,!0),Su(pn),await q4(pn);const Ks=q.trim();if(Ks.length>0){const mi=Du(Ks),Sa=f0(),Po=O.length>0?O.map(Vi=>({name:Vi.name,media_type:Vi.mediaType,data:Vi.base64,size:Vi.size})):void 0;Fn(pn,{type:"user_message",content:mi,session_id:pn,attachments:Po,client_msg_id:Sa}),Q.getState().appendMessage(pn,{id:Sa,role:"user",content:mi,attachments:Po,timestamp:Date.now()})}V&&(ke.linkLinearIssue(pn,V,ae||void 0).then(()=>Q.getState().setLinkedLinearIssue(pn,V)).catch(()=>{}),ke.transitionLinearIssue(V.id,ae||void 0).catch(()=>{})),Q.getState().clearCreation()}catch(mt){const gt=mt instanceof Error?mt.message:String(mt);A(gt),Q.getState().setCreationError(gt),P(!1)}}async function Oo(q,xe){X||(P(!0),A(""),di(""),L(q.cwd),xa(!1),Bi(!1),Xs(q.gitBranch||""),sn(q.resumeSessionId),$i(xe),await wr("",{resumeSessionAt:q.resumeSessionId,forkSession:xe,cwd:q.cwd,branch:q.gitBranch,useWorktree:!1,createBranch:!1}))}async function Th(){if(Pi){va(!0),di("");try{const q=E||(ys==null?void 0:ys.repoRoot);if(!q)throw new Error("No working directory");const xe=await ke.gitPull(q);if(!xe.success){di(xe.output||"Pull failed"),va(!1),P(!1);return}ui(null),va(!1),await wr(e.trim())}catch(q){di(q instanceof Error?q.message:String(q)),va(!1)}}}function os(){const q=e.trim();ui(null),di(""),wr(q)}function Lo(){ui(null),di(""),P(!1)}const $u=k.useCallback((q,xe)=>{Xs(q),Bi(xe)},[]),Do=k.useCallback((q,xe)=>{Xs(q),Bi(xe)},[]),Sr=k.useCallback(q=>{Ou(q)},[]),zo=k.useCallback(q=>{se(q),!q&&ys&&(Xs(ys.currentBranch),Bi(!1))},[ys]),$o=e.trim().length>0&&!X&&(!n||i.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:ul,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:i,onChange:q=>{const xe=q.target.value;a(xe),localStorage.setItem("cc-user-name",xe)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:c,onChange:q=>{const xe=q.target.value;u(xe),localStorage.setItem("cc-session-prefix",xe)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:f,onChange:q=>h(q.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),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:[c.trim()||i.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:be,type:"file",multiple:!0,onChange:Eh,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(pN,{open:an.mentionMenuOpen,loading:an.promptsLoading,prompts:an.filteredPrompts,selectedIndex:an.mentionMenuIndex,onSelect:Os,menuRef:an.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(V||O.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[V&&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:V.identifier}),l.jsx("span",{className:"truncate",children:V.title}),l.jsx("button",{type:"button",onClick:()=>zo(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),O.map((q,xe)=>l.jsx(nN,{name:q.name,mediaType:q.mediaType,base64:q.base64,size:q.size,onRemove:()=>vt(xe),className:"w-10 h-10"},xe))]}),F&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:F}),l.jsx("textarea",{ref:as,value:e,onChange:hl,onKeyDown:Xn,onClick:wa,onKeyUp:wa,onPaste:Lu,"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:_s,children:[l.jsxs("button",{onClick:()=>ge(!H),"aria-expanded":H,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:Ao.icon}),l.jsx("span",{children:Ao.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"})})]}),H&&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:z.map(q=>l.jsxs("button",{onClick:()=>{_(q.value),ge(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${q.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:q.icon}),q.label]},q.value))})]}),ce.length>0&&l.jsxs("div",{className:"relative",ref:Cn,children:[l.jsxs("button",{onClick:()=>ft(!at),"aria-expanded":at,"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:cl.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"})})]}),at&&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:ce.map(q=>l.jsx("button",{onClick:()=>{C(q.value),localStorage.setItem("cc-effort",q.value),ft(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===S?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:dn,children:[l.jsxs("button",{onClick:()=>We(!Pe),"aria-expanded":Pe,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"})}),_a.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"})})]}),Pe&&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:B.map(q=>l.jsx("button",{onClick:()=>{N(q.value),We(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value))})]}),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:()=>rs(!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:Ui})]}),hn&&l.jsx(V$,{initialPath:E||"",onSelect:q=>{L(q)},onClose:()=>rs(!1)})]}),l.jsx(K$,{cwd:E,gitRepoInfo:ys,selectedBranch:Ys,isNewBranch:yr,useWorktree:ga,onBranchChange:$u,onWorktreeChange:xa,onBranchesLoaded:Sr}),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:fi,children:[l.jsxs("button",{onClick:()=>{De||ke.listEnvs().then(Ne).catch(()=>{}),Ee(!De)},"aria-expanded":De,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:Ae?((Hi=ye.find(q=>q.slug===Ae))==null?void 0:Hi.name)||"Env":"No env"})]}),De&&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:()=>{Le(""),localStorage.setItem("cc-selected-env",""),Ee(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ae?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),ye.map(q=>l.jsxs("button",{onClick:()=>{Le(q.slug),localStorage.setItem("cc-selected-env",q.slug),Ee(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${q.slug===Ae?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:q.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(q.variables).length," var",Object.keys(q.variables).length!==1?"s":""]})]},q.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{Ut(!0),Ee(!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..."})})]})]}),Qt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var q;return(q=be.current)==null?void 0:q.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children: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:zu,disabled:!$o,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${$o?"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(q=>l.jsxs("button",{onClick:()=>q.available&&Nh(q.id),disabled:!q.available,title:q.available?q.name:`${q.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${q.available?m===q.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[q.name,!q.available&&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"})]})]},q.id))})}),m==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>bs(q=>!q),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ct?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ct,"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 ${Ct?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":Ct?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!Ct||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 fl(),disabled:we,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:we?"Refreshing...":"Refresh detected sessions"}),oe.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",dl.length," of ",Qs.length," ",ws?"matching":Ch?"recent":"detected"," Claude session",Qs.length!==1?"s":"","."]}),!Nn&&Ii>0&&ls.length>0&&l.jsxs("button",{type:"button",onClick:()=>{xt(!0),en(Qa)},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 (",Ii,")"]}),Nn&&ls.length>0&&l.jsx("button",{type:"button",onClick:()=>{xt(!1),en(Qa)},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:Co,onChange:q=>Ru(q.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),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."]}),It&&l.jsx("p",{className:"text-[11px] text-cc-error",children:It}),!we&&!It&&Qs.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:ws?"No sessions match this search.":"No Claude sessions detected yet."}),dl.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:dl.map(q=>{const xe=h2(q),st=ox(q.cwd),mt=q.source==="companion"?"Companion":"Claude",gt=hi===q.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 ${gt?"text-cc-primary font-medium":"text-cc-fg"}`,children:xe}),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:J$(q.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:mt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:q.cwd,children:[l.jsx("div",{className:"truncate",children:st}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:q.cwd,children:e9(q.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:q.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:t9(q.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{sn(q.resumeSessionId),$i(!0),Oo(q,!0)},"aria-label":`Fork and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&vr?"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
|
|
118
|
-
${q.cwd}${q.gitBranch?` (${q.gitBranch})`:""}
|
|
119
|
-
${q.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{sn(q.resumeSessionId),$i(!1),Oo(q,!1)},"aria-label":`Continue and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&!vr?"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
|
|
120
|
-
${q.resumeSessionId}`,children:"Continue"})]})]},`${q.resumeSessionId}-row-${q.sessionId}`)})}),Fi&&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:()=>en(q=>Math.min(q+Z$,Qs.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 (",Qs.length-rn," 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."})]})})})]}),Te&&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.",m==="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:()=>{Ce(!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(Q$,{cwd:E,gitRepoInfo:ys,linearConfigured:K,selectedLinearIssue:V,onIssueSelect:zo,onBranchFromIssue:Do,onConnectionSelect:M})]}),Pi&&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:Pi.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Pi.behind," commit",Pi.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Eo&&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:Eo}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Lo,disabled:ol,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:os,disabled:ol,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:Th,disabled:ol,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:ol?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"})]})]})]})}),Y&&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:Y})]})]}),Re&&l.jsx(_N,{onClose:()=>{Ut(!1),ke.listEnvs().then(Ne).catch(()=>{})}})]})}const s9=[],i9=[],r9={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"}},a9={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function l9({server:e,sessionId:t}){var f,h;const[n,i]=k.useState(!1),a=r9[e.status]||a9,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>V4(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?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:()=>G4(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(m=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:m.annotations&&Object.entries(m.annotations).filter(([,v])=>v).map(([v])=>v).join(", ")||void 0,children:m.name},m.name))})]})]})]})}function o9({sessionId:e,onDone:t}){const[n,i]=k.useState(""),[a,c]=k.useState("stdio"),[u,f]=k.useState(""),[h,m]=k.useState(""),[v,x]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():v.trim());function y(_){if(_.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=v.trim(),Y4(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:y,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:h,onChange:_=>m(_.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:v,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 c9({sessionId:e}){const t=Q(f=>f.mcpServers.get(e)||s9),n=Q(f=>f.cliConnected.get(e)??!1),[i,a]=k.useState(!1),c=Q(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??i9});k.useEffect(()=>{n&&O_(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>O_(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(o9,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>l.jsx(l9,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function u9({cwd:e,open:t,onClose:n}){var Y;const[i,a]=k.useState([]),[c,u]=k.useState(!0),[f,h]=k.useState(0),[m,v]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[S,C]=k.useState(null),E=k.useCallback(()=>{u(!0),N(null),ke.getClaudeMdFiles(e).then(A=>{a(A.files),A.files.length>0&&(h(0),v(A.files[0].content)),C(null),b(!1),u(!1)}).catch(A=>{N(A.message),u(!1)})},[e]);k.useEffect(()=>{t&&E()},[t,E]);const L=A=>{x&&!confirm("Discard unsaved changes?")||(h(A),v(i[A].content),b(!1),C(null))},O=async()=>{var fe;const A=S||((fe=i[f])==null?void 0:fe.path);if(A){_(!0),N(null);try{await ke.saveClaudeMd(A,m),b(!1),S?E():a(te=>te.map((K,G)=>G===f?{...K,content:m}:K))}catch(te){N(te instanceof Error?te.message:"Failed to save")}finally{_(!1)}}},R=A=>{const fe=A==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(fe),v(`# CLAUDE.md
|
|
121
|
-
|
|
122
|
-
`),b(!0)},F=()=>{x&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const D=A=>A.startsWith(e+"/")?A.slice(e.length+1):A,X=i.some(A=>A.path===`${e}/CLAUDE.md`),P=i.some(A=>A.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:F}),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:F,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:c?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((A,fe)=>l.jsxs("button",{onClick:()=>L(fe),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!S&&f===fe?"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:D(A.path)})]},A.path)),S&&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:D(S)})]})]}),(!X||!P)&&!S&&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"}),!X&&l.jsxs("button",{onClick:()=>R("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"})]}),!P&&l.jsxs("button",{onClick:()=>R("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!S?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:()=>R("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:()=>R("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:D(S||(((Y=i[f])==null?void 0:Y.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:m,onChange:A=>{v(A.target.value),b(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),j&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:j})]})]})})]})]})}function p2({icon:e,title:t,expanded:n,onToggle:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function ar({label:e,sublabel:t,count:n,onClick:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&l.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function d9({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:l.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function f9({path:e,label:t,onClose:n}){const[i,a]=k.useState(""),[c,u]=k.useState(!0),[f,h]=k.useState(!1),[m,v]=k.useState(!1),[x,b]=k.useState(null);k.useEffect(()=>{ke.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()=>{v(!0),b(null);try{await ke.writeFile(e,i),h(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{v(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),c?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[f&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!f||m,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${f&&!m?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:m?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:i,onChange:j=>{a(j.target.value),h(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),x&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:x})]})]})}function h9({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=k.useState(null),[c,u]=k.useState(!0);return k.useEffect(()=>{ke.readFile(e.path).then(f=>{a(f.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),c?null:l.jsx(d9,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx(u9,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(f9,{path:e.path,label:e.label,onClose:n})}function p9({sessionId:e}){const t=Q(S=>S.sessions.get(e)),n=Q(S=>S.sdkSessions.find(C=>C.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,c]=k.useState(null),[u,f]=k.useState(!0),[h,m]=k.useState(!1),[v,x]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(i)try{const S=await ke.getClaudeConfig(i);c(S)}catch{}finally{f(!1)}},[i]);if(k.useEffect(()=>{_()},[_]),!i)return null;if(u)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!a)return null;const j=a.project.claudeMd.length+(a.project.settings?1:0)+(a.project.settingsLocal?1:0)+a.project.commands.length,N=(a.user.claudeMd?1:0)+a.user.skills.length+a.user.agents.length+(a.user.settings?1:0)+a.user.commands.length;return l.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[l.jsx(p2,{icon:"project",title:`Project (${j})`,expanded:h,onToggle:()=>m(S=>!S)}),h&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(S=>l.jsx(ar,{label:S.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:S.path,kind:"claude-md"})},S.path)),a.project.settings&&l.jsx(ar,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(ar,{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(S=>l.jsx(ar,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.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(p2,{icon:"user",title:`User (${N})`,expanded:v,onToggle:()=>x(S=>!S)}),v&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(ar,{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(S=>l.jsx(ar,{label:S.name,sublabel:S.description?S.description.slice(0,40):void 0,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.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(S=>l.jsx(ar,{label:S.name,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.settings&&l.jsx(ar,{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(S=>l.jsx(ar,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.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&&ko.createPortal(l.jsx(h9,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function m9(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class g9 extends k.Component{constructor(){super(...arguments);e_(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){fa(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 wN=[],rv=3e4,x9=6e4,v9=5*6e4;let m2=null,g2=new Map;function b9(e){return e!==m2&&(m2=e,g2=new Map(e.map(t=>[t.sessionId,t]))),g2}function Au(e){return Q(k.useCallback(t=>b9(t.sdkSessions).get(e),[e]))}const SN="cc-panel-collapsed";function x2(){try{const e=localStorage.getItem(SN);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function y9(e){try{localStorage.setItem(SN,JSON.stringify([...e]))}catch{}}function kN({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[c,u]=k.useState(()=>x2().has(e)?!0:!i),f=k.useRef(!0);k.useEffect(()=>{if(f.current){f.current=!1;return}const m=x2();c?m.add(e):m.delete(e),y9(m)},[c,e]);const h=k.useCallback(()=>{u(m=>!m)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:h,"aria-expanded":!c,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[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 ${c?"":"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":c?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function _9(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(kN,{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 c=a.target.value;t(c),localStorage.setItem("cc-user-name",c)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),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 c=a.target.value;i(c),localStorage.setItem("cc-session-prefix",c)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),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 jN(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function NN(e){return e>80?"critical":e>50?"elevated":"normal"}function gr({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 — ${NN(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 ${jN(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function w9({sessionId:e}){var h;const[t,n]=k.useState(null),i=k.useCallback(async()=>{try{const m=await ke.getSessionUsageLimits(e);n(m)}catch{}},[e]),a=k.useRef(0);if(k.useEffect(()=>{i();const m=setInterval(()=>{a.current+=1,a.current%2===0?i():n(v=>v?{...v}:null)},rv);return()=>clearInterval(m)},[i]),!t)return null;const c=t.five_hour!==null,u=t.seven_day!==null,f=!c&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!c&&!u&&!f?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(gr,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?Jw(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(gr,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?Jw(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&l.jsx("div",{role:"meter","aria-label":`Extra usage — ${NN(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 ${jN(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function kf(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function S9(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await ke.getSystemMemory();i||n(u)}catch{}};a();const c=setInterval(a,x9);return()=>{i=!0,clearInterval(c)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(gr,{label:"Memory",pct:t.used_percent,detail:`${kf(t.used_bytes)} / ${kf(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(gr,{label:"Swap",pct:t.swap_used_percent,detail:`${kf(t.swap_used_bytes)} / ${kf(t.swap_total_bytes)}`})]}):null}function k9(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 j9(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await ke.getSystemDisk();i||n(u)}catch{}};a();const c=setInterval(a,v9);return()=>{i=!0,clearInterval(c)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(gr,{label:"Disk",pct:t.used_percent,detail:`${k9(t.available_bytes)} free`})}):null}function N9({sessionId:e}){const t=Q(c=>{var u;return(u=c.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const c=setInterval(()=>n(u=>u+1),rv);return()=>clearInterval(c)},[t]),!t)return null;const{primary:i,secondary:a}=t;return!i&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&l.jsx(gr,{label:`${e2(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?ax(i.resetsAt):void 0}),a&&l.jsx(gr,{label:`${e2(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?ax(a.resetsAt):void 0})]})}function C9({sessionId:e}){const t=Q(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=Q(i=>{var a;return((a=i.sessions.get(e))==null?void 0:a.context_used_percent)??0});return t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Gc(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:Gc(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:Gc(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:Gc(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(gr,{label:"Context",pct:n})]}):null}function E9(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 T9({pr:e}){const t=E9(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&l.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),l.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&l.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[l.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),l.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),l.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function M9({sessionId:e}){const t=Q(u=>u.sessions.get(e)),n=Au(e),i=Q(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),c=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return k.useEffect(()=>{i||!a||!c||ke.getPRStatus(a,c).then(u=>{Q.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,c,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(T9,{pr:i.pr})}const A9=6e4;function r0(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 R9({sessionId:e}){const t=Q(A=>A.linkedLinearIssues.get(e)),[n,i]=k.useState([]),[a,c]=k.useState(null),[u,f]=k.useState([]),[h,m]=k.useState(""),[v,x]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,S]=k.useState(""),[C,E]=k.useState([]),[L,O]=k.useState(!1),R=k.useRef(null);k.useEffect(()=>{ke.getLinkedLinearIssue(e).then(A=>{A.issue&&Q.getState().setLinkedLinearIssue(e,A.issue)}).catch(()=>{})},[e]);const F=k.useCallback(async()=>{if(t)try{const A=await ke.getLinkedLinearIssue(e,!0);A.issue&&(Q.getState().setLinkedLinearIssue(e,A.issue),A.issue.stateType==="completed"&&y(!0)),A.comments&&i(A.comments),A.assignee!==void 0&&c(A.assignee??null),A.labels&&f(A.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;F();const A=setInterval(F,A9);return()=>clearInterval(A)},[F,t]),k.useEffect(()=>{if(!_)return;const A=N.trim();if(A.length<2){E([]);return}let fe=!0;O(!0);const te=setTimeout(()=>{ke.searchLinearIssues(A,6).then(K=>{fe&&E(K.issues)}).catch(()=>{fe&&E([])}).finally(()=>{fe&&O(!1)})},400);return()=>{fe=!1,clearTimeout(te)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var A;return(A=R.current)==null?void 0:A.focus()},50)},[_]);async function D(){if(!(!t||!h.trim()||v)){x(!0);try{const A=await ke.addLinearComment(t.id,h.trim());i(fe=>[...fe,A.comment]),m("")}catch{}finally{x(!1)}}}async function X(){try{await ke.unlinkLinearIssue(e),Q.getState().setLinkedLinearIssue(e,null),i([]),c(null),f([]),y(!1)}catch{}}async function P(A){try{await ke.linkLinearIssue(e,A),Q.getState().setLinkedLinearIssue(e,A),j(!1),S(""),E([])}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(ou,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:R,type:"text",value:N,onChange:A=>S(A.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),S(""),E([])},"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..."}),C.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:C.map(A=>l.jsxs("button",{onClick:()=>P(A),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:A.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${r0(A.stateType,A.stateName).cls}`,children:r0(A.stateType,A.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:A.title})]},A.id))}),N.trim().length>=2&&!L&&C.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(ou,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const Y=r0(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(ou,{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] ${Y.cls}`,children:Y.label}),l.jsx("button",{onClick:X,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(A=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.id))})]}),b&&t.stateType==="completed"&&l.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:()=>y(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),l.jsx("button",{onClick:async()=>{try{await ke.archiveSession(e),Q.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(A=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:A.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:m9(new Date(A.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:A.body})]},A.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:h,onChange:A=>m(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),D())},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:D,disabled:!h.trim()||v,"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 O9({sessionId:e}){const t=Q(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(f=>f+1),rv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const i=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,c=typeof t.resetsAt=="number"&&t.resetsAt>0?ax(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(gr,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:c}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${i?"text-cc-error":"text-cc-warning"}`,children:[i?"rate limited":t.status,c&&` · resets ${c}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",c?` — resets in ${c}.`:"."]})]})}function L9({sessionId:e}){const t=Q(a=>a.sessions.get(e)),n=Au(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(N9,{sessionId:e}),l.jsx(C9,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(O9,{sessionId:e}),l.jsx(w9,{sessionId:e})]})}function D9({sessionId:e}){const t=Q(m=>m.sessions.get(e)),n=Au(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,c=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,f=(t==null?void 0:t.total_lines_removed)||0,h=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(a>0||c>0||u>0||f>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),c>0&&l.jsxs("span",{className:"text-cc-warning",children:[c,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&l.jsxs("span",{className:"text-cc-error",children:["-",f,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),c>0&&h&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{ke.gitPull(h).then(m=>{Q.getState().updateSession(e,{git_ahead:m.git_ahead,git_behind:m.git_behind}),m.success||fa(new Error(`git pull failed: ${m.output}`))}).catch(m=>fa(m))},title:"Pull latest changes",children:"Pull"})]})]}):null}function z9({sessionId:e}){const t=Q(c=>c.sessionTasks.get(e)||wN),n=Q(c=>c.sessions.get(e)),i=Au(e),a=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||a?null:l.jsx("div",{className:"px-3 py-2",children:t.length===0?l.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):l.jsx("div",{className:"space-y-0.5",children:t.map(c=>l.jsx(I9,{task:c},c.id))})})}const $9={"usage-limits":L9,"server-memory":S9,"server-disk":j9,"git-branch":D9,"github-pr":M9,"linear-issue":R9,"mcp-servers":c9,tasks:z9};function B9(e,t){const n=Q(i=>i.sessionTasks.get(t)||wN);if(e==="tasks"&&n.length>0){const i=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function P9({isCodex:e}){const t=Q(m=>m.taskPanelConfig),n=Q(m=>m.toggleSectionEnabled),i=Q(m=>m.moveSectionUp),a=Q(m=>m.moveSectionDown),c=Q(m=>m.resetTaskPanelConfig),u=Q(m=>m.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(m=>{const v=mr.find(x=>x.id===m);return!(!v||v.backends&&!v.backends.includes(f))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((m,v)=>{const x=mr.find(j=>j.id===m),b=t.enabled[m]??!0,y=v===0,_=v===h.length-1;return l.jsxs("div",{"data-testid":`config-section-${m}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${b?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[l.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>i(m),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-${m}`,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(m),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-${m}`,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(m),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-${m}`,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]"}`})})]},m)})}),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:()=>c(),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 U9({sectionId:e,sessionId:t,children:n}){var c;const i=((c=mr.find(u=>u.id===e))==null?void 0:c.label)??e,a=B9(e,t);return l.jsx(kN,{id:e,label:i,badge:a,children:n})}function F9({sessionId:e}){const t=Q(v=>v.sessions.get(e)),n=Au(e),i=Q(v=>v.taskPanelOpen),a=Q(v=>v.setTaskPanelOpen),c=Q(v=>v.taskPanelConfigMode),u=Q(v=>v.taskPanelConfig);if(!i)return null;const f=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",h=f?"codex":"claude",m=u.order.filter(v=>{const x=mr.find(b=>b.id===v);return!(!x||x.backends&&!x.backends.includes(h))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:c?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{c?Q.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"})})})]}),c?l.jsx(P9,{isCodex:f}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[l.jsx(_9,{}),l.jsx(p9,{sessionId:e}),m.filter(v=>u.enabled[v]!==!1).map(v=>{var b;const x=$9[v];return x?l.jsx(U9,{sectionId:v,sessionId:e,children:l.jsx(g9,{label:(b=mr.find(y=>y.id===v))==null?void 0:b.label,children:l.jsx(x,{sessionId:e})})},v):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>Q.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 I9({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?l.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),l.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),l.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&l.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&l.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),l.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function H9({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 q9({sessionId:e}){const t=Q(O=>O.sessions.get(e)),n=Q(O=>O.sdkSessions.find(R=>R.sessionId===e)),i=Q(O=>O.diffPanelSelectedFile.get(e)??null),a=Q(O=>O.setDiffPanelSelectedFile),c=Q(O=>O.diffBase),u=Q(O=>O.setDiffBase),f=Q(O=>O.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[m,v]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),S=Q(O=>O.setGitChangedFilesCount);k.useEffect(()=>{if(!h)return;let O=!1;return ke.getChangedFiles(h,c).then(({files:R})=>{if(O)return;const F=`${h}/`,D=R.filter(X=>X.path===h||X.path.startsWith(F)).map(X=>({abs:X.path,rel:X.path.startsWith(F)?X.path.slice(F.length):X.path,status:X.status==="A"||X.status==="?"?"created":X.status==="D"?"deleted":"updated"})).sort((X,P)=>X.rel.localeCompare(P.rel));N(D),S(e,D.length)}).catch(()=>{O||(N([]),S(e,0))}),()=>{O=!0}},[h,c,f,e,S]);const C=j;k.useEffect(()=>{!i&&C.length>0&&a(e,C[0].abs)},[i,C,e,a]),k.useEffect(()=>{var O;i&&(C.some(R=>R.abs===i)||a(e,((O=C[0])==null?void 0:O.abs)??null))},[i,C,e,a]),k.useEffect(()=>{if(!i){v("");return}let O=!1;return b(!0),ke.getFileDiff(i,c).then(R=>{O||(v(R.diff),b(!1))}).catch(()=>{O||(v(""),b(!1))}),()=>{O=!0}},[i,c]);const E=k.useCallback(O=>{a(e,O),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),L=k.useMemo(()=>!i||!h?i:i.startsWith(h+"/")?i.slice(h.length+1):i,[i,h]);return h?C.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:`
|
|
123
|
-
${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
124
|
-
fixed sm:relative z-30 sm:z-auto
|
|
125
|
-
${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
126
|
-
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
127
|
-
`,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 (",C.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:C.map(({abs:O,rel:R,status:F})=>l.jsxs("button",{onClick:()=>E(O),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${O===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(H9,{status:F}),l.jsx("span",{className:"truncate leading-snug",children:R})]},O))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&l.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!y&&l.jsx("button",{onClick:()=>_(!0),className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",title:"Show file list",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children: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(c==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${c==="last-commit"?"default branch":"last commit"} comparison`,children:c==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:x?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?l.jsx("div",{className:"p-4",children:l.jsx(wo,{unifiedDiff:m,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 V9(){const e=Q(h=>h.updateInfo),t=Q(h=>h.updateDismissedVersion),n=Q(h=>h.dismissUpdate),[i,a]=k.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const c=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await ke.triggerUpdate(),Q.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),fa(h),a(!1)}},u=()=>{n(e.latestVersion)},f=i||e.updateInProgress;return l.jsxs("div",{className:"px-4 py-1.5 bg-cc-primary/10 border-b border-cc-primary/20 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.2s_ease-out]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 2a.75.75 0 0 0-.75.75v3.69L5.78 6.15a.75.75 0 0 0-.96 1.15l2.5 2.08a.75.75 0 0 0 1.08-.12l2-2.5a.75.75 0 1 0-1.17-.94L8.75 6.5V3.75A.75.75 0 0 0 8 3z"})}),l.jsxs("span",{className:"text-xs text-cc-fg",children:[l.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",l.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?l.jsx("button",{onClick:c,disabled:f,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Updating...":"Update & Restart"}):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 G9({steps:e,error:t,backend:n,onCancel:i}){const a=n==="codex"?"/logo-codex.svg":"/logo.svg",c=e.some(x=>x.status==="in_progress"),u=e.length>0&&e.every(x=>x.status==="done"),f=e.some(x=>x.status==="error")||!!t,h=[...e].reverse().find(x=>x.status==="in_progress"),m=[...e].reverse().find(x=>x.status==="done"),v=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.label)||(m==null?void 0:m.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:[c&&!f&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:a,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${c&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),c&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:v}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((x,b)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${b*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[x.status==="in_progress"&&l.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),x.status==="done"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:l.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),x.status==="error"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.jsx("span",{className:`text-xs transition-colors duration-200 ${x.status==="in_progress"?"text-cc-fg font-medium":x.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:x.label}),x.detail&&x.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:x.detail})]},x.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(f||c)&&i&&l.jsx("button",{onClick:i,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:f?"Dismiss":"Cancel"}),!f&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(x=>x.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function Y9(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const X9={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function Q9(e){const[t,n]=k.useState("installing"),i=k.useRef(null),a=k.useRef(!0);return k.useEffect(()=>(a.current=!0,()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[]),k.useEffect(()=>{if(!e)return;const c=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),f()},5e3);function f(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:Y9()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(f,1500)})}return()=>{clearTimeout(c),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function CN({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:X9[e]}),l.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&l.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>l.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${i*.2}s`}},i))}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-1000 ease-out",style:{width:n?"100%":e==="waiting"?"75%":e==="restarting"?"40%":"15%"}})})]})}function K9({active:e}){const t=Q9(e);return e?l.jsx(CN,{phase:t,className:"fixed inset-0 z-[100]"}):null}function MB({phase:e}){return l.jsx(CN,{phase:e,className:"absolute inset-0"})}function W9(){const e=Q(j=>j.dockerUpdateDialogOpen),t=Q(j=>j.setDockerUpdateDialogOpen),[n,i]=k.useState("prompt"),[a,c]=k.useState(!1),[u,f]=k.useState(null),h=k.useRef(null);if(k.useEffect(()=>{e&&ke.getSettings().then(j=>{c(j.dockerAutoUpdate),j.dockerAutoUpdate&&m()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{ke.getImageStatus("the-companion:latest").then(j=>{f(j),j.status==="ready"?i("done"):j.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function m(){i("pulling"),ke.pullImage("the-companion:latest").then(j=>{j.state&&f(j.state)}).catch(()=>{i(j=>j==="pulling"?"error":j)})}function v(){m()}function x(){y()}function b(){y()}function y(){i("prompt"),f(null),t(!1)}async function _(){const j=!a;c(j);try{await ke.updateSettings({dockerAutoUpdate:j})}catch{c(!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:v,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(`
|
|
128
|
-
`)})]}),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(`
|
|
129
|
-
`)}),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:v,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 AB({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...
|
|
130
|
-
Layer 1/5: abc123 downloading
|
|
131
|
-
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 Z9=2e3;function J9(){const[e,t]=k.useState(null),[n,i]=k.useState({state:"idle"}),[a,c]=k.useState(!1),[u,f]=k.useState(""),[h,m]=k.useState(!1),v=k.useRef(null),x=k.useCallback(async()=>{try{t(await ke.getCodexAccount())}catch(L){f(L instanceof Error?L.message:String(L))}},[]),b=k.useCallback(()=>{v.current&&(clearInterval(v.current),v.current=null)},[]),y=k.useCallback(()=>{b(),v.current=setInterval(async()=>{try{const L=await ke.getCodexLoginStatus();i(L),L.state!=="pending"&&(b(),L.state==="success"&&x())}catch{}},Z9)},[x,b]);k.useEffect(()=>(x(),ke.getCodexLoginStatus().then(L=>{i(L),L.state==="pending"&&y()}).catch(()=>{}),b),[x,y,b]);const _=async()=>{c(!0),f("");try{const L=await ke.startCodexLogin();i(L),L.state==="pending"?y():L.error&&f(L.error)}catch(L){f(L instanceof Error?L.message:String(L))}finally{c(!1)}},j=async()=>{c(!0),b();try{i(await ke.cancelCodexLogin())}catch(L){f(L instanceof Error?L.message:String(L))}finally{c(!1)}},N=async()=>{c(!0),f("");try{const L=await ke.codexLogout();!L.ok&&L.error&&f(L.error),i({state:"idle"}),await x()}catch(L){f(L instanceof Error?L.message:String(L))}finally{c(!1)}},S=async()=>{if(n.userCode)try{await navigator.clipboard.writeText(n.userCode),m(!0),setTimeout(()=>m(!1),1500)}catch{}},C=n.state==="pending",E=(e==null?void 0:e.cliAvailable)===!1;return l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"block text-sm font-medium",children:"ChatGPT Subscription (Codex)"}),l.jsx("p",{className:"text-xs text-cc-muted",children:"Sign in with your ChatGPT plan to use Codex without an API key. You'll get a code to enter on any device — no terminal access needed."}),E&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:"Codex CLI not found on this machine. Install it to sign in."}),!E&&e&&!C&&l.jsx("p",{className:"text-xs text-cc-muted","data-testid":"codex-account-status",children:e.authenticated?e.method==="apiKey"?"Authenticated with an OpenAI API key":`Signed in as ${e.email||"ChatGPT account"}${e.planType?` (${e.planType})`:""}`:"Not signed in"}),C&&l.jsxs("div",{className:"px-3 py-3 rounded-lg bg-cc-bg border border-cc-primary/20 space-y-2",children:[l.jsxs("p",{className:"text-xs text-cc-muted",children:["1. Open"," ",l.jsx("a",{href:n.verificationUrl,target:"_blank",rel:"noreferrer",className:"text-cc-primary underline",children:n.verificationUrl})]}),l.jsx("p",{className:"text-xs text-cc-muted",children:"2. Enter this code:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"font-mono-code text-lg tracking-widest bg-cc-code-bg px-3 py-1.5 rounded text-cc-code-fg","data-testid":"codex-user-code",children:n.userCode}),l.jsx("button",{type:"button",onClick:S,className:"px-2 py-1 min-h-[32px] rounded-md text-xs bg-cc-hover text-cc-fg cursor-pointer",children:h?"Copied":"Copy"})]}),l.jsx("p",{className:"text-xs text-cc-muted",role:"status",children:"Waiting for approval…"})]}),n.state==="success"&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Signed in to Codex. New sessions will use this account."}),(n.state==="error"||u)&&l.jsx("div",{role:"alert",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:u||n.error}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[C?l.jsx("button",{type:"button",onClick:j,disabled:a,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Cancel"}):l.jsx("button",{type:"button",onClick:_,disabled:a||E,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${a||E?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:a?"Starting…":e!=null&&e.authenticated?"Sign in again":"Sign in with ChatGPT"}),(e==null?void 0:e.authenticated)&&!C&&l.jsx("button",{type:"button",onClick:N,disabled:a,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Sign out"})]})]})}const a0=["welcome","claude","codex","done"],v2='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function cx(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function eB({onComplete:e}){const[t,n]=k.useState("welcome"),[i,a]=k.useState(""),[c,u]=k.useState(""),[f,h]=k.useState(!1),[m,v]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(cx),S=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const Y=S.current;if(!Y)return;function A(te){if(te.key==="Escape"){te.preventDefault();return}if(te.key!=="Tab")return;const K=Y.querySelectorAll(v2);if(K.length===0)return;const G=K[0],V=K[K.length-1];te.shiftKey?document.activeElement===G&&(te.preventDefault(),V.focus()):document.activeElement===V&&(te.preventDefault(),G.focus())}document.addEventListener("keydown",A);const fe=Y.querySelector(v2);return fe==null||fe.focus(),()=>document.removeEventListener("keydown",A)},[t]);const C=k.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),v("");try{await ke.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(Y){v(Y instanceof Error?Y.message:"Failed to save token")}finally{h(!1)}},[i]),E=k.useCallback(async()=>{h(!0),v("");try{(await ke.getSettings()).codexDeviceAuthConfigured?(_(!0),await O()):v("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(Y){v(Y instanceof Error?Y.message:"Failed to check auth status")}finally{h(!1)}},[]),L=k.useCallback(async()=>{h(!0),v("");try{await ke.updateSettings({openaiApiKey:c.trim()}),_(!0),await O()}catch(Y){v(Y instanceof Error?Y.message:"Failed to save API key")}finally{h(!1)}},[c]),O=k.useCallback(async()=>{try{await ke.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),R=k.useCallback(()=>{e()},[e]),F=k.useCallback(async()=>{await O(),e()},[O,e]),D=k.useCallback(Y=>{v(""),n(Y)},[]),X=a0.indexOf(t),P=cx();return ko.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:P?"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:S,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:P?"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 ${X+1} of ${a0.length-1}`,children:a0.slice(0,3).map((Y,A)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:A===X?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:A<=X?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:A<=X?1:.5}},Y))}),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(tB,{onSetupClaude:()=>D("claude"),onSetupCodex:()=>D("codex")}),t==="claude"&&l.jsx(nB,{token:i,onTokenChange:a,onSave:C,onSkip:()=>D("codex"),saving:f,error:m}),t==="codex"&&l.jsx(sB,{apiKey:c,onApiKeyChange:u,onCheckAuth:E,onSaveApiKey:L,onSkip:()=>O(),onBack:()=>D("claude"),saving:f,error:m}),t==="done"&&l.jsx(iB,{claudeConfigured:x,codexConfigured:y,onDone:R})]}),t==="welcome"&&l.jsx("button",{onClick:F,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 tB({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 nB({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:c}){const u=k.useRef(null);k.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(rB,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:c})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function sB({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:c,saving:u,error:f}){const[h,m]=k.useState(!1),v="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:"Sign in with your ChatGPT account — no terminal needed."})]}),l.jsx(J9,{}),f&&l.jsxs("div",{id:v,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>m(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"sk-...","aria-describedby":f?v:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function iB({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=cx(),[c,u]=k.useState(a);return k.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function rB({text:e}){const[t,n]=k.useState(!1),i=k.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}function aB(e){return Q(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const lB=k.lazy(()=>Gn(()=>import("./Playground-Dpfq4KMB.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),oB=k.lazy(()=>Gn(()=>import("./SettingsPage-CEOoHbQk.js"),[]).then(e=>({default:e.SettingsPage}))),cB=k.lazy(()=>Gn(()=>import("./IntegrationsPage-BHj_BEVr.js"),[]).then(e=>({default:e.IntegrationsPage}))),uB=k.lazy(()=>Gn(()=>import("./LinearSettingsPage-CVmZKj9l.js"),[]).then(e=>({default:e.LinearSettingsPage}))),dB=k.lazy(()=>Gn(()=>import("./LinearOAuthSettingsPage-B5U70sHB.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),fB=k.lazy(()=>Gn(()=>import("./TailscalePage-C1bGGkFU.js"),[]).then(e=>({default:e.TailscalePage}))),hB=k.lazy(()=>Gn(()=>import("./PromptsPage-BHtp_9DW.js"),[]).then(e=>({default:e.PromptsPage}))),pB=k.lazy(()=>Gn(()=>Promise.resolve().then(()=>H$),void 0).then(e=>({default:e.EnvManager}))),mB=k.lazy(()=>Gn(()=>import("./SandboxManager-b3xCX8cU.js"),[]).then(e=>({default:e.SandboxManager}))),gB=k.lazy(()=>Gn(()=>import("./CronManager-CNRhJ7JU.js"),[]).then(e=>({default:e.CronManager}))),xB=k.lazy(()=>Gn(()=>import("./AgentsPage-ClW7bWRx.js"),[]).then(e=>({default:e.AgentsPage}))),vB=k.lazy(()=>Gn(()=>import("./RunsPage-bbhhFNkd.js"),[]).then(e=>({default:e.RunsPage}))),bB=k.lazy(()=>Gn(()=>import("./DashboardPage-Ch_HQGg0.js"),[]).then(e=>({default:e.DashboardPage}))),yB=k.lazy(()=>Gn(()=>import("./MagicUIView-CdHkHIEh.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function ps(){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 _B(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function wB(){const e=Q(ae=>ae.isAuthenticated),t=Q(ae=>ae.darkMode),n=Q(ae=>ae.currentSessionId),i=Q(ae=>ae.sidebarOpen),a=Q(ae=>ae.taskPanelOpen),c=Q(ae=>ae.homeResetKey),u=Q(ae=>ae.activeTab),f=aB(n),h=Q(ae=>ae.sessionCreating),m=Q(ae=>ae.sessionCreatingBackend),v=Q(ae=>ae.creationProgress),x=Q(ae=>ae.creationError),b=Q(ae=>ae.updateOverlayActive),y=_B(),_=k.useMemo(()=>Ox(y),[y]),j=_.page==="settings",N=_.page==="prompts",S=_.page==="integrations",C=_.page==="integration-linear",E=_.page==="integration-linear-oauth",L=_.page==="integration-tailscale",O=_.page==="environments",R=_.page==="sandboxes",F=_.page==="scheduled",D=_.page==="agents"||_.page==="agent-detail",X=_.page==="runs",P=_.page==="dashboard",Y=_.page==="session"||_.page==="home";k.useEffect(()=>{_A(y||"#/")},[y]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const A=k.useRef(Q.getState().currentSessionId);k.useEffect(()=>{if(A.current!==null&&_.page==="home"){Lx(A.current,!0),A.current=null;return}if(A.current=null,_.page==="session"){const ae=Q.getState();ae.currentSessionId!==_.sessionId&&ae.setCurrentSession(_.sessionId),Su(_.sessionId)}else if(_.page==="home"){const ae=Q.getState();ae.currentSessionId!==null&&ae.setCurrentSession(null)}},[_]);const fe=Q(ae=>n?ae.changedFilesTick.get(n)??0:0),te=Q(ae=>ae.diffBase),K=Q(ae=>ae.setGitChangedFilesCount),G=Q(ae=>{var M,Te;return n&&(((M=ae.sessions.get(n))==null?void 0:M.cwd)||((Te=ae.sdkSessions.find(Ce=>Ce.sessionId===n))==null?void 0:Te.cwd))||null});k.useEffect(()=>{if(!n||!G)return;let ae=!1;return ke.getChangedFiles(G,te).then(({files:M})=>{if(ae)return;const Te=`${G}/`,Ce=M.filter(z=>z.path===G||z.path.startsWith(Te)).length;K(n,Ce)}).catch(()=>{}),()=>{ae=!0}},[n,G,te,fe,K]),k.useEffect(()=>{const ae=()=>{ke.checkForUpdate().then(Te=>{Q.getState().setUpdateInfo(Te)}).catch(()=>{})};ae();const M=setInterval(ae,300*1e3);return()=>clearInterval(M)},[]),k.useEffect(()=>{const ae=()=>{ke.getClaudeCompat().then(Te=>{Q.getState().setClaudeCompatInfo(Te)}).catch(()=>{})};ae();const M=setInterval(ae,300*1e3);return()=>clearInterval(M)},[]);const[V,se]=k.useState(!1);return k.useEffect(()=>{e&&ke.getSettings().then(ae=>{ae.publicUrl&&Q.getState().setPublicUrl(ae.publicUrl),Q.getState().setMagicUiAvailable(!!ae.magicUiEnabled&&!!ae.claudeCliAvailable),ae.onboardingCompleted||se(!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(ps,{}),children:l.jsx(lB,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>Q.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
132
|
-
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
133
|
-
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
134
|
-
${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
135
|
-
overflow-hidden
|
|
136
|
-
`,children:l.jsx(UA,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(P$,{}),l.jsx(V9,{}),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(ps,{}),children:l.jsx(oB,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(hB,{embedded:!0})})}),S&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(cB,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(uB,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(dB,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(fB,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(pB,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(mB,{embedded:!0})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(gB,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(xB,{route:_})})}),X&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(vB,{})})}),P&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(bB,{})})}),Y&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(q9,{sessionId:n}):f?l.jsx(k.Suspense,{fallback:l.jsx(ps,{}),children:l.jsx(yB,{sessionId:n})}):l.jsx(O$,{sessionId:n}):l.jsx(n9,{},c)}),h&&v&&v.length>0&&l.jsx(G9,{steps:v,error:x,backend:m??void 0,onCancel:()=>Q.getState().clearCreation()})]})]})]}),n&&Y&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>Q.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:()=>Q.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
|
|
137
|
-
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
138
|
-
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
139
|
-
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
140
|
-
overflow-hidden
|
|
141
|
-
`,children:l.jsx(F9,{sessionId:n})})]}),l.jsx(K9,{active:b}),l.jsx(W9,{}),V&&l.jsx(eB,{onComplete:()=>se(!1)})]}):l.jsx(CA,{})}class SB extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){fa(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}}yA();mE.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(SB,{children:l.jsx(wB,{})})}));Gn(()=>import("./sw-register-2ITbAS9w.js"),[]).catch(()=>{});export{S$ as A,po as B,J9 as C,jB as D,u9 as E,V$ as F,T9 as G,Lf as H,So as I,ko as J,a2 as K,ou as L,t$ as M,hN as N,i$ as O,d$ as P,u$ as Q,c$ as R,G9 as S,E2 as T,V9 as U,NB as V,TB as W,EB as X,Gn as _,ke as a,Pg as b,Fn as c,o$ as d,LA as e,O$ as f,bA as g,yz as h,F$ as i,l as j,Fz as k,wo as l,MB as m,Lx as n,AB as o,Az as p,Rz as q,k as r,CB as s,m9 as t,Q as u,L$ as v,N9 as w,C9 as x,Ri as y,sl as z};
|