@hellcoder/companion 0.121.1 → 0.123.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-BksCBN61.js → AgentsPage-D_ZGmkrU.js} +5 -5
- package/dist/assets/CronManager-u5KuicVz.js +1 -0
- package/dist/assets/{DashboardPage-DzdjTocu.js → DashboardPage-Dab8XyGT.js} +1 -1
- package/dist/assets/{IntegrationsPage-CeFJD8qq.js → IntegrationsPage-Bc7SgfqX.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-DRlRTVfQ.js → LinearOAuthSettingsPage-CxyO36qY.js} +1 -1
- package/dist/assets/{LinearSettingsPage-6lZfxn4O.js → LinearSettingsPage-BWfwYF05.js} +1 -1
- package/dist/assets/{MagicUIDashboard-DDBNAFVy.js → MagicUIDashboard-CfD7iyXm.js} +1 -1
- package/dist/assets/{MagicUIView-CbB9S_lC.js → MagicUIView-CO6pZB0M.js} +1 -1
- package/dist/assets/{Playground-C-hSwNGZ.js → Playground-BiB_VDIl.js} +1 -1
- package/dist/assets/{PromptsPage-CdmFkzMP.js → PromptsPage-BIE70OT1.js} +1 -1
- package/dist/assets/{RunsPage-bXFgnAju.js → RunsPage-BAblQKAW.js} +1 -1
- package/dist/assets/{SandboxManager-Bl4PXenO.js → SandboxManager-DsR3hQz1.js} +1 -1
- package/dist/assets/SettingsPage-DuzHKBe_.js +1 -0
- package/dist/assets/{TailscalePage-DRdnrf6G.js → TailscalePage-C3y_bGkT.js} +1 -1
- package/dist/assets/index-Cd0HGwTS.js +141 -0
- package/dist/assets/{sw-register-DhsOPkya.js → sw-register-CUhVLAo0.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/claude-auth.test.ts +305 -0
- package/server/claude-auth.ts +367 -0
- package/server/routes/claude-auth-routes.test.ts +147 -0
- package/server/routes/claude-auth-routes.ts +55 -0
- package/server/routes.ts +2 -0
- package/server/settings-manager.ts +1 -1
- package/dist/assets/CronManager-S0nmTpnB.js +0 -1
- package/dist/assets/SettingsPage-lBpx5wZP.js +0 -1
- package/dist/assets/index-C5CzX0bF.js +0 -141
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-C-hSwNGZ.js","assets/MagicUIDashboard-DDBNAFVy.js","assets/MagicUIView-CbB9S_lC.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var jE=Object.defineProperty;var NE=(e,t,n)=>t in e?jE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l_=(e,t,n)=>NE(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 CE="modulepreload",EE=function(e){return"/"+e},o_={},Vn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(m){return Promise.all(m.map(x=>Promise.resolve(x).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=u(n.map(m=>{if(m=EE(m),m in o_)return;o_[m]=!0;const x=m.endsWith(".css"),v=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=x?"stylesheet":CE,x||(b.as="script"),b.crossOrigin="",b.href=m,h&&b.setAttribute("nonce",h),document.head.appendChild(b),x)return new Promise((y,w)=>{b.addEventListener("load",y),b.addEventListener("error",()=>w(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 px(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wm={exports:{}},Ac={};/**
|
|
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 c_;function TE(){if(c_)return Ac;c_=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 Ac.Fragment=t,Ac.jsx=n,Ac.jsxs=n,Ac}var u_;function ME(){return u_||(u_=1,Wm.exports=TE()),Wm.exports}var l=ME(),Zm={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 d_;function AE(){if(d_)return Ke;d_=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"),x=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),y=Symbol.iterator;function w(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,oe,_e){this.props=B,this.context=oe,this.refs=S,this.updater=_e||j}C.prototype.isReactComponent={},C.prototype.setState=function(B,oe){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,oe,"setState")},C.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=C.prototype;function L(B,oe,_e){this.props=B,this.context=oe,this.refs=S,this.updater=_e||j}var O=L.prototype=new E;O.constructor=L,N(O,C.prototype),O.isPureReactComponent=!0;var R=Array.isArray;function U(){}var D={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function P(B,oe,_e){var Ne=_e.ref;return{$$typeof:e,type:B,key:oe,ref:Ne!==void 0?Ne:null,props:_e}}function Q(B,oe){return P(B.type,oe,B.props)}function A(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function de(B){var oe={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(_e){return oe[_e]})}var K=/\/+/g;function q(B,oe){return typeof B=="object"&&B!==null&&B.key!=null?de(""+B.key):oe.toString(36)}function H(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(U,U):(B.status="pending",B.then(function(oe){B.status==="pending"&&(B.status="fulfilled",B.value=oe)},function(oe){B.status==="pending"&&(B.status="rejected",B.reason=oe)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function I(B,oe,_e,Ne,Me){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 x:return De=B._init,I(De(B._payload),oe,_e,Ne,Me)}}if(De)return Me=Me(B),De=Ne===""?"."+q(B,0):Ne,R(Me)?(_e="",De!=null&&(_e=De.replace(K,"$&/")+"/"),I(Me,oe,_e,"",function(Ft){return Ft})):Me!=null&&(A(Me)&&(Me=Q(Me,_e+(Me.key==null||B&&B.key===Me.key?"":(""+Me.key).replace(K,"$&/")+"/")+De)),oe.push(Me)),1;De=0;var Ce=Ne===""?".":Ne+":";if(R(B))for(var Re=0;Re<B.length;Re++)Ne=B[Re],Le=Ce+q(Ne,Re),De+=I(Ne,oe,_e,Le,Me);else if(Re=w(B),typeof Re=="function")for(B=Re.call(B),Re=0;!(Ne=B.next()).done;)Ne=Ne.value,Le=Ce+q(Ne,Re++),De+=I(Ne,oe,_e,Le,Me);else if(Le==="object"){if(typeof B.then=="function")return I(H(B),oe,_e,Ne,Me);throw oe=String(B),Error("Objects are not valid as a React child (found: "+(oe==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":oe)+"). If you meant to render a collection of children, use an array instead.")}return De}function re(B,oe,_e){if(B==null)return B;var Ne=[],Me=0;return I(B,Ne,"","",function(Le){return oe.call(_e,Le,Me++)}),Ne}function ve(B){if(B._status===-1){var oe=B._result,_e=oe();_e.then(function(Ne){(B._status===0||B._status===-1)&&(B._status=1,B._result=Ne,_e.status===void 0&&(_e.status="fulfilled",_e.value=Ne))},function(Ne){(B._status===0||B._status===-1)&&(B._status=2,B._result=Ne,_e.status===void 0&&(_e.status="rejected",_e.reason=Ne))}),B._status===-1&&(B._status=0,B._result=_e)}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 oe=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(oe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)};function Ee(B){var oe=D.T,_e={};_e.types=oe!==null?oe.types:null,D.T=_e;try{var Ne=B(),Me=D.S;Me!==null&&Me(_e,Ne),typeof Ne=="object"&&Ne!==null&&typeof Ne.then=="function"&&Ne.then(U,M)}catch(Le){M(Le)}finally{oe!==null&&_e.types!==null&&(oe.types=_e.types),D.T=oe}}function Ae(B){var oe=D.T;if(oe!==null){var _e=oe.types;_e===null?oe.types=[B]:_e.indexOf(B)===-1&&_e.push(B)}else Ee(Ae.bind(null,B))}var z={map:re,forEach:function(B,oe,_e){re(B,function(){oe.apply(this,arguments)},_e)},count:function(B){var oe=0;return re(B,function(){oe++}),oe},toArray:function(B){return re(B,function(oe){return oe})||[]},only:function(B){if(!A(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ke.Activity=v,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=Ae,Ke.cache=function(B){return function(){return B.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(B,oe,_e){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var Ne=N({},B.props),Me=B.key;if(oe!=null)for(Le in oe.key!==void 0&&(Me=""+oe.key),oe)!X.call(oe,Le)||Le==="key"||Le==="__self"||Le==="__source"||Le==="ref"&&oe.ref===void 0||(Ne[Le]=oe[Le]);var Le=arguments.length-2;if(Le===1)Ne.children=_e;else if(1<Le){for(var De=Array(Le),Ce=0;Ce<Le;Ce++)De[Ce]=arguments[Ce+2];Ne.children=De}return P(B.type,Me,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,oe,_e){var Ne,Me={},Le=null;if(oe!=null)for(Ne in oe.key!==void 0&&(Le=""+oe.key),oe)X.call(oe,Ne)&&Ne!=="key"&&Ne!=="__self"&&Ne!=="__source"&&(Me[Ne]=oe[Ne]);var De=arguments.length-2;if(De===1)Me.children=_e;else if(1<De){for(var Ce=Array(De),Re=0;Re<De;Re++)Ce[Re]=arguments[Re+2];Me.children=Ce}if(B&&B.defaultProps)for(Ne in De=B.defaultProps,De)Me[Ne]===void 0&&(Me[Ne]=De[Ne]);return P(B,Le,Me)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(B){return{$$typeof:f,render:B}},Ke.isValidElement=A,Ke.lazy=function(B){return{$$typeof:x,_payload:{_status:-1,_result:B},_init:ve}},Ke.memo=function(B,oe){return{$$typeof:m,type:B,compare:oe===void 0?null:oe}},Ke.startTransition=Ee,Ke.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ke.use=function(B){return D.H.use(B)},Ke.useActionState=function(B,oe,_e){return D.H.useActionState(B,oe,_e)},Ke.useCallback=function(B,oe){return D.H.useCallback(B,oe)},Ke.useContext=function(B){return D.H.useContext(B)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(B,oe){return D.H.useDeferredValue(B,oe)},Ke.useEffect=function(B,oe){return D.H.useEffect(B,oe)},Ke.useEffectEvent=function(B){return D.H.useEffectEvent(B)},Ke.useId=function(){return D.H.useId()},Ke.useImperativeHandle=function(B,oe,_e){return D.H.useImperativeHandle(B,oe,_e)},Ke.useInsertionEffect=function(B,oe){return D.H.useInsertionEffect(B,oe)},Ke.useLayoutEffect=function(B,oe){return D.H.useLayoutEffect(B,oe)},Ke.useMemo=function(B,oe){return D.H.useMemo(B,oe)},Ke.useOptimistic=function(B,oe){return D.H.useOptimistic(B,oe)},Ke.useReducer=function(B,oe,_e){return D.H.useReducer(B,oe,_e)},Ke.useRef=function(B){return D.H.useRef(B)},Ke.useState=function(B){return D.H.useState(B)},Ke.useSyncExternalStore=function(B,oe,_e){return D.H.useSyncExternalStore(B,oe,_e)},Ke.useTransition=function(){return D.H.useTransition()},Ke.version="19.3.0",Ke}var f_;function mx(){return f_||(f_=1,Zm.exports=AE()),Zm.exports}var k=mx();const af=px(k);var Jm={exports:{}},Rc={},eg={exports:{}},tg={};/**
|
|
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 h_;function RE(){return h_||(h_=1,(function(e){function t(H,I){var re=H.length;H.push(I);e:for(;0<re;){var ve=re-1>>>1,M=H[ve];if(0<a(M,I))H[ve]=I,H[re]=M,re=ve;else break e}}function n(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var I=H[0],re=H.pop();if(re!==I){H[0]=re;e:for(var ve=0,M=H.length,Ee=M>>>1;ve<Ee;){var Ae=2*(ve+1)-1,z=H[Ae],B=Ae+1,oe=H[B];if(0>a(z,re))B<M&&0>a(oe,z)?(H[ve]=oe,H[B]=re,ve=B):(H[ve]=z,H[Ae]=re,ve=Ae);else if(B<M&&0>a(oe,re))H[ve]=oe,H[B]=re,ve=B;else break e}}return I}function a(H,I){var re=H.sortIndex-I.sortIndex;return re!==0?re:H.id-I.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=[],x=1,v=null,b=3,y=!1,w=!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(H){for(var I=n(m);I!==null;){if(I.callback===null)i(m);else if(I.startTime<=H)i(m),I.sortIndex=I.expirationTime,t(h,I);else break;I=n(m)}}function O(H){if(j=!1,L(H),!w)if(n(h)!==null)w=!0,R||(R=!0,A());else{var I=n(m);I!==null&&q(O,I.startTime-H)}}var R=!1,U=-1,D=5,X=-1;function P(){return N?!0:!(e.unstable_now()-X<D)}function Q(){if(N=!1,R){var H=e.unstable_now();X=H;var I=!0;try{e:{w=!1,j&&(j=!1,C(U),U=-1),y=!0;var re=b;try{t:{for(L(H),v=n(h);v!==null&&!(v.expirationTime>H&&P());){var ve=v.callback;if(typeof ve=="function"){v.callback=null,b=v.priorityLevel;var M=ve(v.expirationTime<=H);if(H=e.unstable_now(),typeof M=="function"){v.callback=M,L(H),I=!0;break t}v===n(h)&&i(h),L(H)}else i(h);v=n(h)}if(v!==null)I=!0;else{var Ee=n(m);Ee!==null&&q(O,Ee.startTime-H),I=!1}}break e}finally{v=null,b=re,y=!1}I=void 0}}finally{I?A():R=!1}}}var A;if(typeof E=="function")A=function(){E(Q)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,K=de.port2;de.port1.onmessage=Q,A=function(){K.postMessage(null)}}else A=function(){S(Q,0)};function q(H,I){U=S(function(){H(e.unstable_now())},I)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var I=3;break;default:I=b}var re=b;b=I;try{return H()}finally{b=re}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(H,I){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var re=b;b=H;try{return I()}finally{b=re}},e.unstable_scheduleCallback=function(H,I,re){var ve=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?ve+re:ve):re=ve,H){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=re+M,H={id:x++,callback:I,priorityLevel:H,startTime:re,expirationTime:M,sortIndex:-1},re>ve?(H.sortIndex=re,t(m,H),n(h)===null&&H===n(m)&&(j?(C(U),U=-1):j=!0,q(O,re-ve))):(H.sortIndex=M,t(h,H),w||y||(w=!0,R||(R=!0,A()))),H},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(H){var I=b;return function(){var re=b;b=I;try{return H.apply(this,arguments)}finally{b=re}}}})(tg)),tg}var p_;function OE(){return p_||(p_=1,eg.exports=RE()),eg.exports}var ng={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 m_;function LE(){if(m_)return Bn;m_=1;var e=mx();function t(x){var v="https://react.dev/errors/"+x;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)v+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; visit "+v+" 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(x,v,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:x,containerInfo:v,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(x,v){if(x==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Bn.browser=function(x){return{$$typeof:c,_reason:x}},Bn.createPortal=function(x,v){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(t(299));return f(x,v,null,b)},Bn.flushSync=function(x){var v=h.T,b=i.p;try{if(h.T=null,i.p=2,x)return x()}finally{h.T=v,i.p=b,i.d.f()}},Bn.preconnect=function(x,v){typeof x=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,i.d.C(x,v))},Bn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},Bn.preinit=function(x,v){if(typeof x=="string"&&v&&typeof v.as=="string"){var b=v.as,y=m(b,v.crossOrigin),w=typeof v.integrity=="string"?v.integrity:void 0,j=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;b==="style"?i.d.S(x,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:j}):b==="script"&&i.d.X(x,{crossOrigin:y,integrity:w,fetchPriority:j,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Bn.preinitModule=function(x,v){if(typeof x=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var b=m(v.as,v.crossOrigin);i.d.M(x,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}}else v==null&&i.d.M(x)},Bn.preload=function(x,v){if(typeof x=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var b=v.as,y=m(b,v.crossOrigin);i.d.L(x,b,{crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Bn.preloadModule=function(x,v){if(typeof x=="string")if(v){var b=m(v.as,v.crossOrigin);i.d.m(x,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}else i.d.m(x)},Bn.requestFormReset=function(x){i.d.r(x)},Bn.unstable_batchedUpdates=function(x,v){return x(v)},Bn.useFormState=function(x,v,b){return h.H.useFormState(x,v,b)},Bn.useFormStatus=function(){return h.H.useHostTransitionStatus()},Bn.version="19.3.0",Bn}var g_;function O2(){if(g_)return ng.exports;g_=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(),ng.exports=LE(),ng.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 x_;function DE(){if(x_)return Rc;x_=1;var e=OE(),t=mx(),n=O2();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 _=!1,T=p.child;T;){if(T===o){_=!0,o=p,d=g;break}if(T===d){_=!0,d=p,o=g;break}T=T.sibling}if(!_){for(T=g.child;T;){if(T===o){_=!0,o=g,d=p;break}if(T===d){_=!0,d=g,o=p;break}T=T.sibling}if(!_)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 x(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=x(s),r!==null)return r;s=s.sibling}return null}function v(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)&&v(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 w(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 U=Object.assign,D=Symbol.for("react.element"),X=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),Q=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),K=Symbol.for("react.consumer"),q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ve=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),Ee=Symbol.for("react.activity"),Ae=Symbol.for("react.legacy_hidden"),z=Symbol.for("react.memo_cache_sentinel"),B=Symbol.for("react.view_transition"),oe=Symbol.for("react.recoverable"),_e=Symbol.iterator;function Ne(s){return s===null||typeof s!="object"?null:(s=_e&&s[_e]||s["@@iterator"],typeof s=="function"?s:null)}var Me=Symbol.for("react.client.reference");function Le(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Me?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case Q:return"Fragment";case de:return"Profiler";case A:return"StrictMode";case I:return"Suspense";case re:return"SuspenseList";case Ee:return"Activity";case B:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case P:return"Portal";case q:return s.displayName||"Context";case K:return(s._context.displayName||"Context")+".Consumer";case H:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case ve: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,Ce=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,Ft={pending:!1,data:null,method:null,action:null},Kt=[],Ut=-1;function Nt(s){return{current:s}}function wt(s){0>Ut||(s.current=Kt[Ut],Kt[Ut]=null,Ut--)}function Xe(s,r){Ut++,Kt[Ut]=s.current,s.current=r}var St=Nt(null),nn=Nt(null),se=Nt(null),je=Nt(null);function Qe(s,r){switch(Xe(se,r),Xe(nn,s),Xe(St,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?gy(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=gy(r),s=xy(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}wt(St),Xe(St,s)}function et(){wt(St),wt(nn),wt(se)}function un(s){var r=s.memoizedState;r!==null&&(Yl._currentValue=r.memoizedState,Xe(je,s)),r=St.current;var o=xy(r,s.type);r!==o&&(Xe(nn,s),Xe(St,o))}function ce(s){nn.current===s&&(wt(St),wt(nn)),je.current===s&&(wt(je),Yl._currentValue=Ft)}var be,G;function me(s){if(be===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);be=r&&r[1]||"",G=-1<o.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+be+s+G}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(Te){var Z=Te}Reflect.construct(s,[],pe)}else{try{pe.call()}catch(Te){Z=Te}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(Te){Z=Te}(pe=s())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(Te){if(Te&&Z&&typeof Te.stack=="string")return[Te.stack,Z.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(),_=g[0],T=g[1];if(_&&T){var $=_.split(`
|
|
45
|
-
`),ee=T.split(`
|
|
46
|
-
`);for(p=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;p<ee.length&&!ee[p].includes("DetermineComponentFrameRoot");)p++;if(d===$.length||p===ee.length)for(d=$.length-1,p=ee.length-1;1<=d&&0<=p&&$[d]!==ee[p];)p--;for(;1<=d&&0<=p;d--,p--)if($[d]!==ee[p]){if(d!==1||p!==1)do if(d--,p--,0>p||$[d]!==ee[p]){var ae=`
|
|
47
|
-
`+$[d].replace(" at new "," at ");return s.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",s.displayName)),ae}while(1<=d&&0<=p);break}}}finally{Pe=!1,Error.prepareStackTrace=o}return(o=s?s.displayName||s.name:"")?me(o):""}function at(s,r){switch(s.tag){case 26:case 27:case 5:return me(s.type);case 16:return me("Lazy");case 13:return s.child!==r&&r!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("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 me("Activity");case 30:return me("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,is=e.unstable_scheduleCallback,Ct=e.unstable_cancelCallback,vs=e.unstable_shouldYield,Fn=e.unstable_requestPaint,sn=e.unstable_now,xr=e.unstable_getCurrentPriorityLevel,Bi=e.unstable_ImmediatePriority,le=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,we=e.unstable_LowPriority,rt=e.unstable_IdlePriority,It=e.log,wn=e.unstable_setDisableYieldValue,Nn=null,xt=null;function rn(s){if(typeof It=="function"&&wn(s),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Nn,s)}catch{}}var en=Math.clz32?Math.clz32:bs,Ao=Math.log,$u=Math.LN2;function bs(s){return s>>>=0,s===0?32:31-(Ao(s)/$u|0)|0}var vr=256,ma=262144,ga=4194304;function Xs(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 Ks(s,r,o){var d=s.pendingLanes;if(d===0)return 0;var p=0,g=s.suspendedLanes,_=s.pingedLanes;s=s.warmLanes;var T=d&134217727;return T!==0?(d=T&~g,d!==0?p=Xs(d):(_&=T,_!==0?p=Xs(_):o||(o=T&~s,o!==0&&(p=Xs(o))))):(T=d&~g,T!==0?p=Xs(T):_!==0?p=Xs(_):o||(o=d&~s,o!==0&&(p=Xs(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 br(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Pi(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 Ah(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 Bu(){var s=ga;return ga<<=1,(ga&62914560)===0&&(ga=4194304),s}function Fi(s){for(var r=[],o=0;31>o;o++)r.push(s);return r}function hi(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 _=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,ee=s.hiddenUpdates;for(o=_&~o;0<o;){var ae=31-en(o),pe=1<<ae;T[ae]=0,$[ae]=-1;var Z=ee[ae];if(Z!==null)for(ee[ae]=null,ae=0;ae<Z.length;ae++){var ie=Z[ae];ie!==null&&(ie.lane&=-536870913)}o&=~pe}d!==0&&xa(s,d,0),g!==0&&p===0&&s.tag!==0&&(s.suspendedLanes|=g&~(_&~r))}function xa(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 Ro(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 pi(s,r){var o=r&-r;return o=(o&42)!==0?1:Oo(o),(o&(s.suspendedLanes|r))!==0?0:o}function Oo(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 va(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ba(){var s=Re.p;return s!==0?s:(s=window.event,s===void 0?32:e_(s.type))}function rs(s,r){var o=Re.p;try{return Re.p=s,r()}finally{Re.p=o}}var ys=Math.random().toString(36).slice(2),dn="__reactFiber$"+ys,Cn="__reactProps$"+ys,mi="__reactContainer$"+ys,Lo="__reactEvents$"+ys,an="__reactListeners$"+ys,Rh="__reactHandles$"+ys,Do="__reactResources$"+ys,ya="__reactMarker$"+ys,cl="__reactLoad$"+ys;function ul(s){delete s[dn],delete s[Cn],delete s[an],delete s[Rh]}function Ui(s){var r;if(r=s[dn])return r;for(var o=s.parentNode;o;){if(r=o[mi]||o[dn]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(s=Ly(s);s!==null;){if(o=s[dn])return o;s=Ly(s)}return r}s=o,o=s.parentNode}return null}function gi(s){if(s=s[dn]||s[mi]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function yr(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function as(s){var r=s[Do];return r||(r=s[Do]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function ln(s){s[ya]=!0}function _s(s){s[cl]=void 0}var Ws=new Set,dl={};function Ii(s,r){Hi(s,r),Hi(s+"Capture",r)}function Hi(s,r){for(dl[s]=r,s=0;s<r.length;s++)Ws.add(r[s])}var Oh=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={},zo={};function Lh(s){return hn.call(zo,s)?!0:hn.call(fl,s)?!1:Oh.test(s)?zo[s]=!0:(fl[s]=!0,!1)}var vt=!1;function Pu(){var s=vt;return vt=!1,s}function hl(s,r,o){if(Lh(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 _a(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 Ds(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 Yn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Fu(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Uu(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(_){o=""+_,g.call(this,_)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(_){o=""+_},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function _r(s){if(!s._valueTracker){var r=Fu(s)?"checked":"value";s._valueTracker=Uu(s,r,""+s[r])}}function $o(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var o=r.getValue(),d="";return s&&(d=Fu(s)?s.checked?"true":"false":s.value),s=d,s!==o?(r.setValue(s),!0):!1}var Dh=/[\n"\\]/g;function ls(s){return s.replace(Dh,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Bo(s,r,o,d,p,g,_,T){s.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.type=_:s.removeAttribute("type"),r!=null?_==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Yn(r)):s.value!==""+Yn(r)&&(s.value=""+Yn(r)):_!=="submit"&&_!=="reset"||s.removeAttribute("value"),r!=null?_==="number"&&s.value==r?Po(s,Yn(s.value)):Po(s,Yn(r)):o!=null?Po(s,Yn(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=""+Yn(T):s.removeAttribute("name")}function Iu(s,r,o,d,p,g,_,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)){_r(s);return}o=o!=null?""+Yn(o):"",r=r!=null?""+Yn(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,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.name=_),_r(s)}function Po(s,r){s.defaultValue!==""+r&&(s.defaultValue=""+r)}function wr(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=""+Yn(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 Fo(s,r,o){if(r!=null&&(r=""+Yn(r),r!==s.value&&(s.value=r),o==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=o!=null?""+Yn(o):""}function Uo(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=Yn(r),s.defaultValue=o,d=s.textContent,d===o&&d!==""&&d!==null&&(s.value=d),_r(s)}function qi(s,r){if(r){var o=s.firstChild;if(o&&o===s.lastChild&&o.nodeType===3){o.nodeValue=r;return}}s.textContent=r}var Y=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 ge(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||Y.has(r)?r==="float"?s.cssFloat=o:s[r]=(""+o).trim():s[r]=o+"px"}function it(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&&(ge(s,p,d),vt=!0)}else for(var g in r)r.hasOwnProperty(g)&&ge(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"]]),Ge=/^[\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 Ge.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Qn(){}var Sr=null;function pl(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ws=null,Zs=null;function Io(s){var r=gi(s);if(r&&(s=r.stateNode)){var o=s[Cn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Bo(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="'+ls(""+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));Bo(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&&$o(d)}break e;case"textarea":Fo(s,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&wr(s,!!o.multiple,r,!1)}}}var kr=!1;function Ss(s,r,o){if(kr)return s(r,o);kr=!0;try{var d=s(r);return d}finally{if(kr=!1,(ws!==null||Zs!==null)&&(Ud(),ws&&(r=ws,s=Zs,Zs=ws=null,Io(r),s)))for(r=0;r<s.length;r++)Io(s[r])}}function jr(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 Js=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ho=!1;if(Js)try{var wa={};Object.defineProperty(wa,"passive",{get:function(){Ho=!0}}),window.addEventListener("test",wa,wa),window.removeEventListener("test",wa,wa)}catch{Ho=!1}var ei=null,Hu=null,Sa=null;function qo(){if(Sa)return Sa;var s,r=Hu,o=r.length,d,p="value"in ei?ei.value:ei.textContent,g=p.length;for(s=0;s<o&&r[s]===p[s];s++);var _=o-s;for(d=1;d<=_&&r[o-d]===p[g-d];d++);return Sa=p.slice(s,1<d?1-d:void 0)}function ks(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 qu(){return!0}function hv(){return!1}function Xn(s){function r(o,d,p,g,_){this._reactName=o,this._targetInst=p,this.type=d,this.nativeEvent=g,this.target=_,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)?qu:hv,this.isPropagationStopped=hv,this}return U(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=qu)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=qu)},persist:function(){},isPersistent:qu}),r}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vu=Xn(Nr),Vo=U({},Nr,{view:0,detail:0}),KN=Xn(Vo),zh,$h,Go,Gu=U({},Vo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ph,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!==Go&&(Go&&s.type==="mousemove"?(zh=s.screenX-Go.screenX,$h=s.screenY-Go.screenY):$h=zh=0,Go=s),zh)},movementY:function(s){return"movementY"in s?s.movementY:$h}}),pv=Xn(Gu),WN=U({},Gu,{dataTransfer:0}),ZN=Xn(WN),JN=U({},Vo,{relatedTarget:0}),Bh=Xn(JN),eC=U({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),tC=Xn(eC),nC=U({},Nr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),sC=Xn(nC),iC=U({},Nr,{data:0}),mv=Xn(iC),rC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aC={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"},lC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=lC[s])?!!r[s]:!1}function Ph(){return oC}var cC=U({},Vo,{key:function(s){if(s.key){var r=rC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=ks(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?aC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ph,charCode:function(s){return s.type==="keypress"?ks(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ks(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),uC=Xn(cC),dC=U({},Gu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gv=Xn(dC),fC=U({},Nr,{submitter:0}),hC=Xn(fC),pC=U({},Vo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ph}),mC=Xn(pC),gC=U({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),xC=Xn(gC),vC=U({},Gu,{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}),bC=Xn(vC),yC=U({},Nr,{newState:0,oldState:0,source:0}),_C=Xn(yC),wC=[9,13,27,32],Fh=Js&&"CompositionEvent"in window,Yo=null;Js&&"documentMode"in document&&(Yo=document.documentMode);var SC=Js&&"TextEvent"in window&&!Yo,xv=Js&&(!Fh||Yo&&8<Yo&&11>=Yo),vv=" ",bv=!1;function yv(s,r){switch(s){case"keyup":return wC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _v(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ml=!1;function kC(s,r){switch(s){case"compositionend":return _v(r);case"keypress":return r.which!==32?null:(bv=!0,vv);case"textInput":return s=r.data,s===vv&&bv?null:s;default:return null}}function jC(s,r){if(ml)return s==="compositionend"||!Fh&&yv(s,r)?(s=qo(),Sa=Hu=ei=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 xv&&r.locale!=="ko"?null:r.data;default:return null}}var NC={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 wv(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!NC[s.type]:r==="textarea"}function Sv(s,r,o,d){ws?Zs?Zs.push(d):Zs=[d]:ws=d,r=Yd(r,"onChange"),0<r.length&&(o=new Vu("onChange","change",null,o,d),s.push({event:o,listeners:r}))}var Qo=null,Xo=null;function CC(s){uy(s,0)}function Yu(s){var r=yr(s);if($o(r))return s}function kv(s,r){if(s==="change")return r}var jv=!1;if(Js){var Uh;if(Js){var Ih="oninput"in document;if(!Ih){var Nv=document.createElement("div");Nv.setAttribute("oninput","return;"),Ih=typeof Nv.oninput=="function"}Uh=Ih}else Uh=!1;jv=Uh&&(!document.documentMode||9<document.documentMode)}function Cv(){Qo&&(Qo.detachEvent("onpropertychange",Ev),Xo=Qo=null)}function Ev(s){if(s.propertyName==="value"&&Yu(Xo)){var r=[];Sv(r,Xo,s,pl(s)),Ss(CC,r)}}function EC(s,r,o){s==="focusin"?(Cv(),Qo=r,Xo=o,Qo.attachEvent("onpropertychange",Ev)):s==="focusout"&&Cv()}function TC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Yu(Xo)}function MC(s,r){if(s==="click")return Yu(r)}function AC(s,r){if(s==="input"||s==="change")return Yu(r)}function RC(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var js=typeof Object.is=="function"?Object.is:RC;function Ko(s,r){if(js(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)||!js(s[p],r[p]))return!1}return!0}function Hh(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 Tv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Mv(s,r){var o=Tv(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=Tv(o)}}function Av(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Av(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Rv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=Hh(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=Hh(s.document)}return r}function qh(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 OC=Js&&"documentMode"in document&&11>=document.documentMode,gl=null,Vh=null,Wo=null,Gh=!1;function Ov(s,r,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Gh||gl==null||gl!==Hh(d)||(d=gl,"selectionStart"in d&&qh(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}),Wo&&Ko(Wo,d)||(Wo=d,d=Yd(Vh,"onSelect"),0<d.length&&(r=new Vu("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")},Yh={},Lv={};Js&&(Lv=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(Yh[s])return Yh[s];if(!xl[s])return s;var r=xl[s],o;for(o in r)if(r.hasOwnProperty(o)&&o in Lv)return Yh[s]=r[o];return s}var Dv=ja("animationend"),zv=ja("animationiteration"),$v=ja("animationstart"),LC=ja("transitionrun"),DC=ja("transitionstart"),zC=ja("transitioncancel"),Bv=ja("transitionend"),Pv=new Map,Qh="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(" ");Qh.push("scrollEnd");function ti(s,r){Pv.set(s,r),Ii(r,[s])}var $C=0;function Vi(s,r){if(s.name!=null&&s.name!=="auto")return s.name;if(r.autoName!==null)return r.autoName;s=ri.identifierPrefix;var o=$C++;return s="_"+s+"t_"+o.toString(32)+"_",r.autoName=s}function Fv(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 Gi(s,r){return s=Fv(s),r=Fv(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)},zs=[],vl=0,Xh=0;function Xu(){for(var s=vl,r=Xh=vl=0;r<s;){var o=zs[r];zs[r++]=null;var d=zs[r];zs[r++]=null;var p=zs[r];zs[r++]=null;var g=zs[r];if(zs[r++]=null,d!==null&&p!==null){var _=d.pending;_===null?p.next=p:(p.next=_.next,_.next=p),d.pending=p}g!==0&&Uv(o,p,g)}}function Ku(s,r,o,d){zs[vl++]=s,zs[vl++]=r,zs[vl++]=o,zs[vl++]=d,Xh|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Kh(s,r,o,d){return Ku(s,r,o,d),Wu(s)}function Na(s,r){return Ku(s,null,null,r),Wu(s)}function Uv(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 Wu(s){if(50<bc)throw bc=0,Fd=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 BC(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 os(s,r,o,d){return new BC(s,r,o,d)}function Wh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Yi(s,r){var o=s.alternate;return o===null?(o=os(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 Iv(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 Zu(s,r,o,d,p,g){var _=0;if(d=s,typeof d=="function")Wh(d)&&(_=1);else if(typeof d=="string")_=fE(s,o,St.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case Ee:return s=os(31,o,r,p),s.elementType=Ee,s.lanes=g,s;case Q:return Ca(o.children,p,g,r);case A:_=8,p|=24;break;case de:return s=os(12,o,r,p|2),s.elementType=de,s.lanes=g,s;case I:return s=os(13,o,r,p),s.elementType=I,s.lanes=g,s;case re:return s=os(19,o,r,p),s.elementType=re,s.lanes=g,s;case Ae:case B:return s=p|32,s=os(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 q:_=10;break e;case K:_=9;break e;case H:_=11;break e;case ve:_=14;break e;case M:_=16,d=null;break e}_=29,o=Error(i(130,s===null?"null":typeof s,"")),d=null}return r=os(_,o,r,p),r.elementType=s,r.type=d,r.lanes=g,r}function Ca(s,r,o,d){return s=os(7,s,d,r),s.lanes=o,s}function Zh(s,r,o){return s=os(6,s,null,r),s.lanes=o,s}function Hv(s){var r=os(18,null,null,0);return r.stateNode=s,r}function Jh(s,r,o){return r=os(4,s.children!==null?s.children:[],s.key,r),r.lanes=o,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var qv=new WeakMap;function $s(s,r){if(typeof s=="object"&&s!==null){var o=qv.get(s);return o!==void 0?o:(r={value:s,source:r,stack:ft(r)},qv.set(s,r),r)}return{value:s,source:r,stack:ft(r)}}var yl=[],_l=0,Ju=null,Zo=0,Bs=[],Ps=0,Cr=null,xi=1,vi="";function Qi(s,r){yl[_l++]=Zo,yl[_l++]=Ju,Ju=s,Zo=r}function Vv(s,r,o){Bs[Ps++]=xi,Bs[Ps++]=vi,Bs[Ps++]=Cr,Cr=s;var d=xi;s=vi;var p=32-en(d)-1;d&=~(1<<p),o+=1;var g=32-en(r)+p;if(30<g){var _=p-p%5;g=(d&(1<<_)-1).toString(32),d>>=_,p-=_,xi=1<<32-en(r)+p|o<<p|d,vi=g+s}else xi=1<<g|o<<p|d,vi=s}function ed(s){s.return!==null&&(Qi(s,1),Vv(s,1,0))}function ep(s){for(;s===Ju;)Ju=yl[--_l],yl[_l]=null,Zo=yl[--_l],yl[_l]=null;for(;s===Cr;)Cr=Bs[--Ps],Bs[Ps]=null,vi=Bs[--Ps],Bs[Ps]=null,xi=Bs[--Ps],Bs[Ps]=null}function Gv(s,r){Bs[Ps++]=xi,Bs[Ps++]=vi,Bs[Ps++]=Cr,xi=r.id,vi=r.overflow,Cr=s}var En=null,Ht=null,lt=!1,Er=null,Fs=!1,tp=Error(i(519));function Tr(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jo($s(r,s)),tp}function Yv(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<_c.length;o++)ut(_c[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),Iu(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),Uo(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||py(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||Tr(s,!0)}function td(s){for(En=s.return;En;)switch(En.tag){case 5:case 31:case 13:Fs=!1;return;case 27:case 3:Fs=!0;return;default:En=En.return}}function wl(s){if(s!==En)return!1;if(!lt)return td(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")||Am(s.type,s.memoizedProps)),o=!o),o&&Ht&&Tr(s),td(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Oy(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Oy(s)}else r===27?(r=Ht,Vr(s.type)?(s=Fm,Fm=null,Ht=s):Ht=r):Ht=En?Is(s.stateNode.nextSibling):null;return!0}function Ea(){Ht=En=null,lt=!1}function np(){var s=Er;return s!==null&&(ds===null?ds=s:ds.push.apply(ds,s),Er=null),s}function Jo(s){Er===null?Er=[s]:Er.push(s)}var sp=Nt(null),Ta=null,Xi=null;function Mr(s,r,o){Xe(sp,r._currentValue),r._currentValue=o}function Ki(s){s._currentValue=sp.current,wt(sp)}function nd(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 ip(s,r,o,d){var p=s.child;for(p!==null&&(p.return=s);p!==null;){var g=p.dependencies;if(g!==null){var _=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),nd(g.return,o,s),d||(_=null);break e}g=T.next}}else if(p.tag===18){if(_=p.return,_===null)throw Error(i(341));_.lanes|=o,g=_.alternate,g!==null&&(g.lanes|=o),nd(_,o,s),_=null}else p.tag===13&&p.memoizedState!==null&&p.memoizedState.dehydrated===null?(p.lanes|=o,_=p.alternate,_!==null&&(_.lanes|=o),nd(p.return,o,s),_=p.child,_=_!==null?_.sibling:null):_=p.child;if(_!==null)_.return=p;else for(_=p;_!==null;){if(_===s){_=null;break}if(p=_.sibling,p!==null){p.return=_.return,_=p;break}_=_.return}p=_}}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 _=p.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var T=p.type;js(p.pendingProps.value,_.value)||(s!==null?s.push(T):s=[T])}}else if(p===je.current){if(_=p.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(s!==null?s.push(Yl):s=[Yl])}p=p.return}return s!==null&&ip(r,s,o,d),r.flags|=262144,s!==null}function sd(s){for(s=s.firstContext;s!==null;){if(!js(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Aa(s){Ta=s,Xi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function On(s){return Qv(Ta,s)}function id(s,r){return Ta===null&&Aa(s),Qv(s,r)}function Qv(s,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},Xi===null){if(s===null)throw Error(i(308));Xi=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else Xi=Xi.next=r;return o}var PC=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()})}},FC=e.unstable_scheduleCallback,UC=e.unstable_NormalPriority,pn={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function rp(){return{controller:new PC,data:new Map,refCount:0}}function ec(s){s.refCount--,s.refCount===0&&FC(UC,function(){s.controller.abort()})}function Xv(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 tc=null;function IC(s){var r=s.transitionTypes;return s.transitionTypes=null,r}var nc=null,ap=0,Ra=0,Sl=null;function HC(s,r){if(nc===null){var o=nc=[];ap=0,Ra=wm(),Sl={status:"pending",value:void 0,then:function(d){o.push(d)}}}return ap++,r.then(Kv,Kv),r}function Kv(){if(--ap===0&&(tc=null,nc!==null)){Sl!==null&&(Sl.status="fulfilled");var s=nc;nc=null,Ra=0,Sl=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function qC(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 Wv=Ce.S;Ce.S=function(s,r){if(Hb=sn(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&HC(s,r),tc!==null)for(var o=Ul;o!==null;)Xv(o,tc),o=o.next;if(o=s.types,o!==null){for(var d=Ul;d!==null;)Xv(d,o),d=d.next;if(Ra!==0){d=tc,d===null&&(d=tc=[]);for(var p=0;p<o.length;p++){var g=o[p];d.indexOf(g)===-1&&d.push(g)}}}Wv!==null&&Wv(s,r)};var Oa=Nt(null);function lp(){var s=Oa.current;return s!==null?s:$t.pooledCache}function rd(s,r){r===null?Xe(Oa,Oa.current):Xe(Oa,r.pool)}function Zv(){var s=lp();return s===null?null:{parent:pn._currentValue,pool:s}}var kl=Error(i(460)),op=Error(i(474)),ad=Error(i(542)),ld={then:function(){}};function Jv(s){return s=s.status,s==="fulfilled"||s==="rejected"}function e1(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,n1(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,n1(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 t1(){if(Da===null)throw Error(i(459));var s=Da;return Da=null,s}function n1(s){if(s===kl||s===ad)throw Error(i(483))}var jl=null,sc=0;function od(s){var r=sc;return sc+=1,jl===null&&(jl=[]),e1(jl,s,r)}function Ar(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function cd(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 s1(s){function r(J,V){if(s){var ne=J.deletions;ne===null?(J.deletions=[V],J.flags|=16):ne.push(V)}}function o(J,V){if(!s)return null;for(;V!==null;)r(J,V),V=V.sibling;return null}function d(J){for(var V=new Map;J!==null;)J.key===null?V.set(J.index,J):V.set(J.key,J),J=J.sibling;return V}function p(J,V){return J=Yi(J,V),J.index=0,J.sibling=null,J}function g(J,V,ne){return J.index=ne,s?(ne=J.alternate,ne!==null?(ne=ne.index,ne<V?(J.flags|=2,V):ne):(J.flags|=134217730,V)):(J.flags|=1048576,V)}function _(J){return s&&J.alternate===null&&(J.flags|=134217730),J}function T(J,V,ne,he){return V===null||V.tag!==6?(V=Zh(ne,J.mode,he),V.return=J,V):(V=p(V,ne),V.return=J,V)}function $(J,V,ne,he){var Oe=ne.type;return Oe===Q?(J=ae(J,V,ne.props.children,he,ne.key),Ar(J,ne),J):V!==null&&(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===M&&La(Oe)===V.type)?(V=p(V,ne.props),Ar(V,ne),V.return=J,V):(V=Zu(ne.type,ne.key,ne.props,null,J.mode,he),Ar(V,ne),V.return=J,V)}function ee(J,V,ne,he){return V===null||V.tag!==4||V.stateNode.containerInfo!==ne.containerInfo||V.stateNode.implementation!==ne.implementation?(V=Jh(ne,J.mode,he),V.return=J,V):(V=p(V,ne.children||[]),V.return=J,V)}function ae(J,V,ne,he,Oe){return V===null||V.tag!==7?(V=Ca(ne,J.mode,he,Oe),V.return=J,V):(V=p(V,ne),V.return=J,V)}function pe(J,V,ne){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Zh(""+V,J.mode,ne),V.return=J,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case X:return ne=Zu(V.type,V.key,V.props,null,J.mode,ne),Ar(ne,V),ne.return=J,ne;case P:return V=Jh(V,J.mode,ne),V.return=J,V;case M:return V=La(V),pe(J,V,ne)}if(De(V)||Ne(V))return V=Ca(V,J.mode,ne,null),V.return=J,V;if(typeof V.then=="function")return pe(J,od(V),ne);if(V.$$typeof===q)return pe(J,id(J,V),ne);cd(J,V)}return null}function Z(J,V,ne,he){var Oe=V!==null?V.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Oe!==null?null:T(J,V,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case X:return ne.key===Oe?$(J,V,ne,he):null;case P:return ne.key===Oe?ee(J,V,ne,he):null;case M:return ne=La(ne),Z(J,V,ne,he)}if(De(ne)||Ne(ne))return Oe!==null?null:ae(J,V,ne,he,null);if(typeof ne.then=="function")return Z(J,V,od(ne),he);if(ne.$$typeof===q)return Z(J,V,id(J,ne),he);cd(J,ne)}return null}function ie(J,V,ne,he,Oe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return J=J.get(ne)||null,T(V,J,""+he,Oe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case X:return J=J.get(he.key===null?ne:he.key)||null,$(V,J,he,Oe);case P:return J=J.get(he.key===null?ne:he.key)||null,ee(V,J,he,Oe);case M:return he=La(he),ie(J,V,ne,he,Oe)}if(De(he)||Ne(he))return J=J.get(ne)||null,ae(V,J,he,Oe,null);if(typeof he.then=="function")return ie(J,V,ne,od(he),Oe);if(he.$$typeof===q)return ie(J,V,ne,id(V,he),Oe);cd(V,he)}return null}function Te(J,V,ne,he){for(var Oe=null,pt=null,Ue=V,Ye=V=0,xn=null;Ue!==null&&Ye<ne.length;Ye++){Ue.index>Ye?(xn=Ue,Ue=null):xn=Ue.sibling;var bt=Z(J,Ue,ne[Ye],he);if(bt===null){Ue===null&&(Ue=xn);break}s&&Ue&&bt.alternate===null&&r(J,Ue),V=g(bt,V,Ye),pt===null?Oe=bt:pt.sibling=bt,pt=bt,Ue=xn}if(Ye===ne.length)return o(J,Ue),lt&&Qi(J,Ye),Oe;if(Ue===null){for(;Ye<ne.length;Ye++)Ue=pe(J,ne[Ye],he),Ue!==null&&(V=g(Ue,V,Ye),pt===null?Oe=Ue:pt.sibling=Ue,pt=Ue);return lt&&Qi(J,Ye),Oe}for(Ue=d(Ue);Ye<ne.length;Ye++)xn=ie(Ue,J,Ye,ne[Ye],he),xn!==null&&(s&&(bt=xn.alternate,bt!==null&&Ue.delete(bt.key===null?Ye:bt.key)),V=g(xn,V,Ye),pt===null?Oe=xn:pt.sibling=xn,pt=xn);return s&&Ue.forEach(function(Kr){return r(J,Kr)}),lt&&Qi(J,Ye),Oe}function Be(J,V,ne,he){if(ne==null)throw Error(i(151));for(var Oe=null,pt=null,Ue=V,Ye=V=0,xn=null,bt=ne.next();Ue!==null&&!bt.done;Ye++,bt=ne.next()){Ue.index>Ye?(xn=Ue,Ue=null):xn=Ue.sibling;var Kr=Z(J,Ue,bt.value,he);if(Kr===null){Ue===null&&(Ue=xn);break}s&&Ue&&Kr.alternate===null&&r(J,Ue),V=g(Kr,V,Ye),pt===null?Oe=Kr:pt.sibling=Kr,pt=Kr,Ue=xn}if(bt.done)return o(J,Ue),lt&&Qi(J,Ye),Oe;if(Ue===null){for(;!bt.done;Ye++,bt=ne.next())bt=pe(J,bt.value,he),bt!==null&&(V=g(bt,V,Ye),pt===null?Oe=bt:pt.sibling=bt,pt=bt);return lt&&Qi(J,Ye),Oe}for(Ue=d(Ue);!bt.done;Ye++,bt=ne.next())bt=ie(Ue,J,Ye,bt.value,he),bt!==null&&(s&&(xn=bt.alternate,xn!==null&&Ue.delete(xn.key===null?Ye:xn.key)),V=g(bt,V,Ye),pt===null?Oe=bt:pt.sibling=bt,pt=bt);return s&&Ue.forEach(function(kE){return r(J,kE)}),lt&&Qi(J,Ye),Oe}function nt(J,V,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===Q&&ne.key===null&&ne.props.ref===void 0&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case X:e:{for(var Oe=ne.key;V!==null;){if(V.key===Oe){if(Oe=ne.type,Oe===Q){if(V.tag===7){o(J,V.sibling),he=p(V,ne.props.children),Ar(he,ne),he.return=J,J=he;break e}}else if(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===M&&La(Oe)===V.type){o(J,V.sibling),he=p(V,ne.props),Ar(he,ne),he.return=J,J=he;break e}o(J,V);break}else r(J,V);V=V.sibling}ne.type===Q?(he=Ca(ne.props.children,J.mode,he,ne.key),Ar(he,ne),he.return=J,J=he):(he=Zu(ne.type,ne.key,ne.props,null,J.mode,he),Ar(he,ne),he.return=J,J=he)}return _(J);case P:e:{for(Oe=ne.key;V!==null;){if(V.key===Oe)if(V.tag===4&&V.stateNode.containerInfo===ne.containerInfo&&V.stateNode.implementation===ne.implementation){o(J,V.sibling),he=p(V,ne.children||[]),he.return=J,J=he;break e}else{o(J,V);break}else r(J,V);V=V.sibling}he=Jh(ne,J.mode,he),he.return=J,J=he}return _(J);case M:return ne=La(ne),nt(J,V,ne,he)}if(De(ne))return Te(J,V,ne,he);if(Ne(ne)){if(Oe=Ne(ne),typeof Oe!="function")throw Error(i(150));return ne=Oe.call(ne),Be(J,V,ne,he)}if(typeof ne.then=="function")return nt(J,V,od(ne),he);if(ne.$$typeof===q)return nt(J,V,id(J,ne),he);cd(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,V!==null&&V.tag===6?(o(J,V.sibling),he=p(V,ne),he.return=J,J=he):(o(J,V),he=Zh(ne,J.mode,he),he.return=J,J=he),_(J)):o(J,V)}return function(J,V,ne,he){try{sc=0;var Oe=nt(J,V,ne,he);return jl=null,Oe}catch(Ue){if(Ue===kl||Ue===ad)throw Ue;var pt=os(29,Ue,null,J.mode);return pt.lanes=he,pt.return=J,pt}finally{}}}var za=s1(!0),i1=s1(!1),Rr=!1;function cp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function up(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 Or(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Lr(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=Wu(s),Uv(s,null,o),r}return Ku(s,d,r,o),Wu(s)}function ic(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,Ro(s,o)}}function dp(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 _={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?p=g=_:g=g.next=_,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 fp=!1;function rc(){if(fp){var s=Sl;if(s!==null)throw s}}function ac(s,r,o,d){fp=!1;var p=s.updateQueue;Rr=!1;var g=p.firstBaseUpdate,_=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var $=T,ee=$.next;$.next=null,_===null?g=ee:_.next=ee,_=$;var ae=s.alternate;ae!==null&&(ae=ae.updateQueue,T=ae.lastBaseUpdate,T!==_&&(T===null?ae.firstBaseUpdate=ee:T.next=ee,ae.lastBaseUpdate=$))}if(g!==null){var pe=p.baseState;_=0,ae=ee=$=null,T=g;do{var Z=T.lane&-536870913,ie=Z!==T.lane;if(ie?(ht&Z)===Z:(d&Z)===Z){Z!==0&&Z===Ra&&(fp=!0),ae!==null&&(ae=ae.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Te=s,Be=T;Z=r;var nt=o;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){pe=Te.call(nt,pe,Z);break e}pe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,Z=typeof Te=="function"?Te.call(nt,pe,Z):Te,Z==null)break e;pe=U({},pe,Z);break e;case 2:Rr=!0}}Z=T.callback,Z!==null&&(s.flags|=64,ie&&(s.flags|=8192),ie=p.callbacks,ie===null?p.callbacks=[Z]:ie.push(Z))}else ie={lane:Z,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ae===null?(ee=ae=ie,$=pe):ae=ae.next=ie,_|=Z;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);ae===null&&($=pe),p.baseState=$,p.firstBaseUpdate=ee,p.lastBaseUpdate=ae,g===null&&(p.shared.lanes=0),Ur|=_,s.lanes=_,s.memoizedState=pe}}function r1(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function a1(s,r){var o=s.callbacks;if(o!==null)for(s.callbacks=null,s=0;s<o.length;s++)r1(o[s],r)}var Dr=Nt(null),ud=Nt(0);function l1(s,r){s=tr,Xe(ud,s),Xe(Dr,r),tr=s|r.baseLanes}function hp(){Xe(ud,tr),Xe(Dr,Dr.current)}function pp(){tr=ud.current,wt(Dr),wt(ud)}var Ln=Nt(null),Un=null;function zr(s){var r=s.alternate;Xe(Dn,Dn.current&1),Xe(Ln,s),Un===null&&(r===null||Dr.current!==null||r.memoizedState!==null)&&(Un=s)}function mp(s){Xe(Dn,Dn.current),Xe(Ln,s),Un===null&&(Un=s)}function o1(s){s.tag===22?(Xe(Dn,Dn.current),Xe(Ln,s),Un===null&&(Un=s)):$r()}function $r(){Xe(Dn,Dn.current),Xe(Ln,Ln.current)}function Ns(s){wt(Ln),Un===s&&(Un=null),wt(Dn)}var Dn=Nt(0);function lc(s,r){Xe(Ln,Ln.current),Xe(Dn,r)}function gp(s){wt(Dn),wt(Ln),Un===s&&(Un=null)}function dd(s){for(var r=s;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Bm(o)||Pm(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 Wi=0,tt=null,Lt=null,mn=null,fd=!1,Nl=!1,$a=!1,hd=0,oc=0,Cl=null,VC=0;function on(){throw Error(i(321))}function xp(s,r){if(r===null)return!1;for(var o=0;o<r.length&&o<s.length;o++)if(!js(s[o],r[o]))return!1;return!0}function vp(s,r,o,d,p,g){return Wi=g,tt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Ce.H=s===null||s.memoizedState===null?V1:G1,$a=!1,g=o(d,p),$a=!1,Nl&&(g=u1(r,o,d,p)),c1(s),g}function c1(s){Ce.H=yd;var r=Lt!==null&&Lt.next!==null;if(Wi=0,mn=Lt=tt=null,fd=!1,oc=0,Cl=null,r)throw Error(i(300));s===null||gn||(s=s.dependencies,s!==null&&sd(s)&&(gn=!0))}function u1(s,r,o,d){tt=s;var p=0;do{if(Nl&&(Cl=null),oc=0,Nl=!1,25<=p)throw Error(i(301));if(p+=1,mn=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)}Ce.H=JC,g=r(o,d)}while(Nl);return g}function GC(){var s=Ce.H,r=s.useState()[0];return r=typeof r.then=="function"?cc(r):r,s=s.useState()[0],(Lt!==null?Lt.memoizedState:null)!==s&&(tt.flags|=1024),r}function bp(){var s=hd!==0;return hd=0,s}function yp(s,r,o){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~o}function _p(s){if(fd){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}fd=!1}Wi=0,mn=Lt=tt=null,Nl=!1,oc=hd=0,Cl=null}function Kn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?tt.memoizedState=mn=s:mn=mn.next=s,mn}function fn(){if(Lt===null){var s=tt.alternate;s=s!==null?s.memoizedState:null}else s=Lt.next;var r=mn===null?tt.memoizedState:mn.next;if(r!==null)mn=r,Lt=s;else{if(s===null)throw tt.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},mn===null?tt.memoizedState=mn=s:mn=mn.next=s}return mn}function pd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cc(s){var r=oc;return oc+=1,Cl===null&&(Cl=[]),s=e1(Cl,s,r),r=tt,(mn===null?r.memoizedState:mn.next)===null&&(r=r.alternate,Ce.H=r===null||r.memoizedState===null?V1:G1),s}function md(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return cc(s);if(s.$$typeof===oe)return;if(s.$$typeof===q)return On(s)}throw Error(i(438,String(s)))}function wp(s){var r=null,o=tt.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var d=tt.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=pd(),tt.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 Zi(s,r){return typeof r=="function"?r(s):r}function gd(s){var r=fn();return Sp(r,Lt,s)}function Sp(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 _=p.next;p.next=g.next,g.next=_}r.baseQueue=p=g,d.pending=null}if(g=s.baseState,p===null)s.memoizedState=g;else{r=p.next;var T=_=null,$=null,ee=r,ae=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(ht&pe)===pe:(Wi&pe)===pe){var Z=ee.revertLane;if(Z===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),pe===Ra&&(ae=!0);else if((Wi&Z)===Z){ee=ee.next,Z===Ra&&(ae=!0);continue}else pe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(T=$=pe,_=g):$=$.next=pe,tt.lanes|=Z,Ur|=Z;pe=ee.action,$a&&o(g,pe),g=ee.hasEagerState?ee.eagerState:o(g,pe)}else Z={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(T=$=Z,_=g):$=$.next=Z,tt.lanes|=pe,Ur|=pe;ee=ee.next}while(ee!==null&&ee!==r);if($===null?_=g:$.next=T,!js(g,s.memoizedState)&&(gn=!0,ae&&(o=Sl,o!==null)))throw o;s.memoizedState=g,s.baseState=_,s.baseQueue=$,d.lastRenderedState=g}return p===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function kp(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 _=p=p.next;do g=s(g,_.action),_=_.next;while(_!==p);js(g,r.memoizedState)||(gn=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),o.lastRenderedState=g}return[g,d]}function d1(s,r,o){var d=tt,p=fn(),g=lt;if(g){if(o===void 0)throw Error(i(407));o=o()}else o=r();var _=!js((Lt||p).memoizedState,o);if(_&&(p.memoizedState=o,gn=!0),p=p.queue,Cp(p1.bind(null,d,p,s),[s]),s=p.getSnapshot!==r||_||mn!==null&&(mn.memoizedState.tag&1)!==0,El(s?9:8,{destroy:void 0},h1.bind(null,d,p,o,r),null),s){if(d.flags|=2048,$t===null)throw Error(i(349));g||(Wi&127)!==0||f1(d,r,o)}return o}function f1(s,r,o){s.flags|=16384,s={getSnapshot:r,value:o},r=tt.updateQueue,r===null?(r=pd(),tt.updateQueue=r,r.stores=[s]):(o=r.stores,o===null?r.stores=[s]:o.push(s))}function h1(s,r,o,d){r.value=o,r.getSnapshot=d,m1(r)&&g1(s)}function p1(s,r,o){return o(function(){m1(r)&&g1(s)})}function m1(s){var r=s.getSnapshot;s=s.value;try{var o=r();return!js(s,o)}catch{return!0}}function g1(s){var r=Na(s,2);r!==null&&fs(r,s,2)}function jp(s){var r=Kn();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:Zi,lastRenderedState:s},r}function x1(s,r,o,d){return s.baseState=o,Sp(s,Lt,typeof d=="function"?d:Zi)}function YC(s,r,o,d,p){if(bd(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(_){g.listeners.push(_)}};Ce.T!==null?o(!0):g.isTransition=!1,d(g),o=r.pending,o===null?(g.next=r.pending=g,v1(r,g)):(g.next=o.next,r.pending=o.next=g)}}function v1(s,r){var o=r.action,d=r.payload,p=s.state;if(r.isTransition){var g=Ce.T,_={};_.types=g!==null?g.types:null,Ce.T=_;try{var T=o(p,d),$=Ce.S;$!==null&&$(_,T),b1(s,r,T)}catch(ee){Np(s,r,ee)}finally{g!==null&&_.types!==null&&(g.types=_.types),Ce.T=g}}else try{g=o(p,d),b1(s,r,g)}catch(ee){Np(s,r,ee)}}function b1(s,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){y1(s,r,d)},function(d){return Np(s,r,d)}):y1(s,r,o)}function y1(s,r,o){r.status="fulfilled",r.value=o,_1(r),s.state=o,r=s.pending,r!==null&&(o=r.next,o===r?s.pending=null:(o=o.next,r.next=o,v1(s,o)))}function Np(s,r,o){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=o,_1(r),r=r.next;while(r!==d)}s.action=null}function _1(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function w1(s,r){return r}function S1(s,r){if(lt){var o=$t.formState;if(o!==null){e:{var d=tt;if(lt){if(Ht){t:{for(var p=Ht,g=Fs;p.nodeType!==8;){if(!g){p=null;break t}if(p=Is(p.nextSibling),p===null){p=null;break t}}g=p.data,p=g==="F!"||g==="F"?p:null}if(p){Ht=Is(p.nextSibling),d=p.data==="F!";break e}}Tr(d)}d=!1}d&&(r=o[0])}}return o=Kn(),o.memoizedState=o.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:w1,lastRenderedState:r},o.queue=d,o=I1.bind(null,tt,d),d.dispatch=o,d=jp(!1),g=Rp.bind(null,tt,!1,d.queue),d=Kn(),p={state:r,dispatch:null,action:s,pending:null},d.queue=p,o=YC.bind(null,tt,p,g,o),p.dispatch=o,d.memoizedState=s,[r,o,!1]}function k1(s){var r=fn();return j1(r,Lt,s)}function j1(s,r,o){if(r=Sp(s,r,w1)[0],s=gd(Zi)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=cc(r)}catch(_){throw _===kl?ad:_}else d=r;r=fn();var p=r.queue,g=p.dispatch;return o!==r.memoizedState&&(tt.flags|=2048,El(9,{destroy:void 0},QC.bind(null,p,o),null)),[d,g,s]}function QC(s,r){s.action=r}function N1(s){var r=fn(),o=Lt;if(o!==null)return j1(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=tt.updateQueue,r===null&&(r=pd(),tt.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 C1(){return fn().memoizedState}function xd(s,r,o,d){var p=Kn();tt.flags|=s,p.memoizedState=El(1|r,{destroy:void 0},o,d===void 0?null:d)}function vd(s,r,o,d){var p=fn();d=d===void 0?null:d;var g=p.memoizedState.inst;Lt!==null&&d!==null&&xp(d,Lt.memoizedState.deps)?p.memoizedState=El(r,g,o,d):(tt.flags|=s,p.memoizedState=El(1|r,g,o,d))}function E1(s,r){xd(8390656,8,s,r)}function Cp(s,r){vd(2048,8,s,r)}function XC(s){tt.flags|=4;var r=tt.updateQueue;if(r===null)r=pd(),tt.updateQueue=r,r.events=[s];else{var o=r.events;o===null?r.events=[s]:o.push(s)}}function T1(s){var r=fn().memoizedState;return XC({ref:r,nextImpl:s}),function(){if((Et&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function M1(s,r){return vd(4,2,s,r)}function A1(s,r){return vd(4,4,s,r)}function R1(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 O1(s,r,o){o=o!=null?o.concat([s]):null,vd(4,4,R1.bind(null,r,s),o)}function Ep(){}function L1(s,r){var o=fn();r=r===void 0?null:r;var d=o.memoizedState;return r!==null&&xp(r,d[1])?d[0]:(o.memoizedState=[s,r],s)}function D1(s,r){var o=fn();r=r===void 0?null:r;var d=o.memoizedState;if(r!==null&&xp(r,d[1]))return d[0];if(d=s(),$a){rn(!0);try{s()}finally{rn(!1)}}return o.memoizedState=[d,r],d}function Tp(s,r,o){return o===void 0||(Wi&1073741824)!==0&&(ht&261930)===0?s.memoizedState=r:(s.memoizedState=o,s=Vb(),tt.lanes|=s,Ur|=s,o)}function z1(s,r,o,d){return js(o,r)?o:Dr.current!==null?(s=Tp(s,o,d),js(s,r)||(gn=!0),s):(Wi&106)===0||(Wi&1073741824)!==0&&(ht&261930)===0?(gn=!0,s.memoizedState=o):(s=Vb(),tt.lanes|=s,Ur|=s,r)}function $1(s,r,o,d,p){var g=Re.p;Re.p=g!==0&&8>g?g:8;var _=Ce.T,T={};T.types=_!==null?_.types:null,Ce.T=T,Rp(s,!1,r,o);try{var $=p(),ee=Ce.S;if(ee!==null&&ee(T,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ae=qC($,d);uc(s,r,ae,Ms(s))}else uc(s,r,d,Ms(s))}catch(pe){uc(s,r,{then:function(){},status:"rejected",reason:pe},Ms())}finally{Re.p=g,_!==null&&T.types!==null&&(_.types=T.types),Ce.T=_}}function KC(){}function Mp(s,r,o,d){if(s.tag!==5)throw Error(i(476));var p=B1(s).queue;$1(s,p,r,Ft,o===null?KC:function(){return P1(s),o(d)})}function B1(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:Ft,baseState:Ft,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zi,lastRenderedState:Ft},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zi,lastRenderedState:o},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function P1(s){var r=B1(s);r.next===null&&(r=s.alternate.memoizedState),uc(s,r.next.queue,{},Ms())}function Ap(){return On(Yl)}function F1(){return fn().memoizedState}function U1(){return fn().memoizedState}function WC(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var o=Ms();s=Or(o);var d=Lr(r,s,o);d!==null&&(fs(d,r,o),ic(d,r,o)),r={cache:rp()},s.payload=r;return}r=r.return}}function ZC(s,r,o){var d=Ms();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},bd(s)?H1(r,o):(o=Kh(s,r,o,d),o!==null&&(fs(o,s,d),q1(o,r,d)))}function I1(s,r,o){var d=Ms();uc(s,r,o,d)}function uc(s,r,o,d){var p={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(bd(s))H1(r,p);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var _=r.lastRenderedState,T=g(_,o);if(p.hasEagerState=!0,p.eagerState=T,js(T,_))return Ku(s,r,p,0),$t===null&&Xu(),!1}catch{}finally{}if(o=Kh(s,r,p,d),o!==null)return fs(o,s,d),q1(o,r,d),!0}return!1}function Rp(s,r,o,d){if(d={lane:2,revertLane:wm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},bd(s)){if(r)throw Error(i(479))}else r=Kh(s,o,d,2),r!==null&&fs(r,s,2)}function bd(s){var r=s.alternate;return s===tt||r!==null&&r===tt}function H1(s,r){Nl=fd=!0;var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}function q1(s,r,o){if((o&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,o|=d,r.lanes=o,Ro(s,o)}}var yd={readContext:On,use:md,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},V1={readContext:On,use:md,useCallback:function(s,r){return Kn().memoizedState=[s,r===void 0?null:r],s},useContext:On,useEffect:E1,useImperativeHandle:function(s,r,o){o=o!=null?o.concat([s]):null,xd(4194308,4,R1.bind(null,r,s),o)},useLayoutEffect:function(s,r){return xd(4194308,4,s,r)},useInsertionEffect:function(s,r){xd(4,2,s,r)},useMemo:function(s,r){var o=Kn();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=Kn();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=ZC.bind(null,tt,s),[d.memoizedState,s]},useRef:function(s){var r=Kn();return s={current:s},r.memoizedState=s},useState:function(s){s=jp(s);var r=s.queue,o=I1.bind(null,tt,r);return r.dispatch=o,[s.memoizedState,o]},useDebugValue:Ep,useDeferredValue:function(s,r){var o=Kn();return Tp(o,s,r)},useTransition:function(){var s=jp(!1);return s=$1.bind(null,tt,s.queue,!0,!1),Kn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,o){var d=tt,p=Kn();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||f1(d,r,o)}p.memoizedState=o;var g={value:o,getSnapshot:r};return p.queue=g,E1(p1.bind(null,d,g,s),[s]),d.flags|=2048,El(9,{destroy:void 0},h1.bind(null,d,g,o,r),null),o},useId:function(){var s=Kn(),r=$t.identifierPrefix;if(lt){var o=vi,d=xi;o=(d&~(1<<32-en(d)-1)).toString(32)+o,r="_"+r+"R_"+o,o=hd++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=VC++,r="_"+r+"r_"+o.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Ap,useFormState:S1,useActionState:S1,useOptimistic:function(s){var r=Kn();r.memoizedState=r.baseState=s;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=Rp.bind(null,tt,!0,o),o.dispatch=r,[s,r]},useMemoCache:wp,useCacheRefresh:function(){return Kn().memoizedState=WC.bind(null,tt)},useEffectEvent:function(s){var r=Kn(),o={impl:s};return r.memoizedState=o,function(){if((Et&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},G1={readContext:On,use:md,useCallback:L1,useContext:On,useEffect:Cp,useImperativeHandle:O1,useInsertionEffect:M1,useLayoutEffect:A1,useMemo:D1,useReducer:gd,useRef:C1,useState:function(){return gd(Zi)},useDebugValue:Ep,useDeferredValue:function(s,r){var o=fn();return z1(o,Lt.memoizedState,s,r)},useTransition:function(){var s=gd(Zi)[0],r=fn().memoizedState;return[typeof s=="boolean"?s:cc(s),r]},useSyncExternalStore:d1,useId:F1,useHostTransitionStatus:Ap,useFormState:k1,useActionState:k1,useOptimistic:function(s,r){var o=fn();return x1(o,Lt,s,r)},useMemoCache:wp,useCacheRefresh:U1,useEffectEvent:T1},JC={readContext:On,use:md,useCallback:L1,useContext:On,useEffect:Cp,useImperativeHandle:O1,useInsertionEffect:M1,useLayoutEffect:A1,useMemo:D1,useReducer:kp,useRef:C1,useState:function(){return kp(Zi)},useDebugValue:Ep,useDeferredValue:function(s,r){var o=fn();return Lt===null?Tp(o,s,r):z1(o,Lt.memoizedState,s,r)},useTransition:function(){var s=kp(Zi)[0],r=fn().memoizedState;return[typeof s=="boolean"?s:cc(s),r]},useSyncExternalStore:d1,useId:F1,useHostTransitionStatus:Ap,useFormState:N1,useActionState:N1,useOptimistic:function(s,r){var o=fn();return Lt!==null?x1(o,Lt,s,r):(o.baseState=s,[s,o.queue.dispatch])},useMemoCache:wp,useCacheRefresh:U1,useEffectEvent:T1};function Op(s,r,o,d){r=s.memoizedState,o=o(d,r),o=o==null?r:U({},r,o),s.memoizedState=o,s.lanes===0&&(s.updateQueue.baseState=o)}var Lp={enqueueSetState:function(s,r,o){s=s._reactInternals;var d=Ms(),p=Or(d);p.payload=r,o!=null&&(p.callback=o),r=Lr(s,p,d),r!==null&&(fs(r,s,d),ic(r,s,d))},enqueueReplaceState:function(s,r,o){s=s._reactInternals;var d=Ms(),p=Or(d);p.tag=1,p.payload=r,o!=null&&(p.callback=o),r=Lr(s,p,d),r!==null&&(fs(r,s,d),ic(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var o=Ms(),d=Or(o);d.tag=2,r!=null&&(d.callback=r),r=Lr(s,d,o),r!==null&&(fs(r,s,o),ic(r,s,o))}};function Y1(s,r,o,d,p,g,_){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,g,_):r.prototype&&r.prototype.isPureReactComponent?!Ko(o,d)||!Ko(p,g):!0}function Q1(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&&Lp.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=U({},o));for(var p in s)o[p]===void 0&&(o[p]=s[p])}return o}function X1(s){Qu(s)}function K1(s){console.error(s)}function W1(s){Qu(s)}function _d(s,r){try{var o=s.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function Z1(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 Dp(s,r,o){return o=Or(o),o.tag=3,o.payload={element:null},o.callback=function(){_d(s,r)},o}function J1(s){return s=Or(s),s.tag=3,s}function eb(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(){Z1(r,o,d)}}var _=o.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(s.callback=function(){Z1(r,o,d),typeof p!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function e3(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 Un===null?Id():o.alternate===null&&cn===0&&(cn=3),o.flags&=-257,o.flags|=65536,o.lanes=p,d===ld?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([d]):r.add(d),bm(s,d,p)),!1;case 22:return o.flags|=65536,d===ld?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)),bm(s,d,p)),!1}throw Error(i(435,o.tag))}return bm(s,d,p),Id(),!1}if(lt)return r=Ln.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,d!==tp&&(s=Error(i(422),{cause:d}),Jo($s(s,o)))):(d!==tp&&(r=Error(i(423),{cause:d}),Jo($s(r,o))),s=s.current.alternate,s.flags|=65536,p&=-p,s.lanes|=p,d=$s(d,o),p=Dp(s.stateNode,d,p),dp(s,p),cn!==4&&(cn=2)),!1;var g=Error(i(520),{cause:d});if(g=$s(g,o),vc===null?vc=[g]:vc.push(g),cn!==4&&(cn=2),r===null)return!0;d=$s(d,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,s=p&-p,o.lanes|=s,s=Dp(o.stateNode,d,s),dp(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"&&(Ir===null||!Ir.has(g))))return o.flags|=65536,p&=-p,o.lanes|=p,p=J1(p),eb(p,s,o,d),dp(o,p),!1;break;case 22:if(o.memoizedState!==null)return o.flags|=65536,!1}o=o.return}while(o!==null);return!1}var zp=Error(i(461)),gn=!1;function Sn(s,r,o,d){r.child=s===null?i1(r,null,o,d):za(r,s.child,o,d)}function tb(s,r,o,d,p){o=o.render;var g=r.ref;if("ref"in d){var _={};for(var T in d)T!=="ref"&&(_[T]=d[T])}else _=d;return Aa(r),d=vp(s,r,o,_,g,p),T=bp(),s!==null&&!gn?(yp(s,r,p),Ji(s,r,p)):(lt&&T&&ed(r),r.flags|=1,Sn(s,r,d,p),r.child)}function nb(s,r,o,d,p){if(s===null){var g=o.type;return typeof g=="function"&&!Wh(g)&&g.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=g,sb(s,r,g,d,p)):(s=Zu(o.type,null,d,r,r.mode,p),s.ref=r.ref,s.return=r,r.child=s)}if(g=s.child,!qp(s,p)){var _=g.memoizedProps;if(o=o.compare,o=o!==null?o:Ko,o(_,d)&&s.ref===r.ref)return Ji(s,r,p)}return r.flags|=1,s=Yi(g,d),s.ref=r.ref,s.return=r,r.child=s}function sb(s,r,o,d,p){if(s!==null){var g=s.memoizedProps;if(Ko(g,d)&&s.ref===r.ref)if(gn=!1,r.pendingProps=d=g,qp(s,p))(s.flags&131072)!==0&&(gn=!0);else return r.lanes=s.lanes,Ji(s,r,p)}return $p(s,r,o,d,p)}function ib(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 rb(s,r,g,o,d)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&rd(r,g!==null?g.cachePool:null),g!==null?l1(r,g):hp(),o1(r);else return d=r.lanes=536870912,rb(s,r,g!==null?g.baseLanes|o:o,o,d)}else g!==null?(rd(r,g.cachePool),l1(r,g),$r(),r.memoizedState=null):(s!==null&&rd(r,null),hp(),$r());return Sn(s,r,p,o),r.child}function dc(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function rb(s,r,o,d,p){var g=lp();return g=g===null?null:{parent:pn._currentValue,pool:g},r.memoizedState={baseLanes:o,cachePool:g},s!==null&&rd(r,null),hp(),o1(r),s!==null&&Ma(s,r,d,!0),r.childLanes=p,null}function wd(s,r){return r=Sd({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function ab(s,r,o){return za(r,s.child,null,o),s=wd(r,r.pendingProps),s.flags|=2,Ns(r),r.memoizedState=null,s}function t3(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=wd(r,d),r.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},dc(null,s);if(mp(r),(s=Ht)?(s=Ry(s,Fs),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Cr!==null?{id:xi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},o=Hv(s),o.return=r,r.child=o,En=r,Ht=null)):s=null,s===null)throw Tr(r);return r.lanes=536870912,null}return wd(r,d)}var g=s.memoizedState;if(g!==null){var _=g.dehydrated;if(mp(r),p)if(r.flags&256)r.flags&=-257,r=ab(s,r,o);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(gn||Ma(s,r,o,!1),p=(o&s.childLanes)!==0,gn||p){if(Dr.current===null){if(d=$t,d!==null&&(_=pi(d,o),_!==0&&_!==g.retryLane))throw g.retryLane=_,Na(s,_),fs(d,s,_),zp;Id()}r=ab(s,r,o)}else s=g.treeContext,Ht=Is(_.nextSibling),En=r,lt=!0,Er=null,Fs=!1,s!==null&&Gv(r,s),r=wd(r,d),r.flags|=134221824;return r}return s=Yi(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 $p(s,r,o,d,p){return Aa(r),o=vp(s,r,o,d,void 0,p),d=bp(),s!==null&&!gn?(yp(s,r,p),Ji(s,r,p)):(lt&&d&&ed(r),r.flags|=1,Sn(s,r,o,p),r.child)}function lb(s,r,o,d,p,g){return Aa(r),r.updateQueue=null,o=u1(r,d,o,p),c1(s),d=bp(),s!==null&&!gn?(yp(s,r,g),Ji(s,r,g)):(lt&&d&&ed(r),r.flags|=1,Sn(s,r,o,g),r.child)}function ob(s,r,o,d,p){if(Aa(r),r.stateNode===null){var g=bl,_=o.contextType;typeof _=="object"&&_!==null&&(g=On(_)),g=new o(d,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Lp,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=d,g.state=r.memoizedState,g.refs={},cp(r),_=o.contextType,g.context=typeof _=="object"&&_!==null?On(_):bl,g.state=r.memoizedState,_=o.getDerivedStateFromProps,typeof _=="function"&&(Op(r,o,_,d),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(_=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),_!==g.state&&Lp.enqueueReplaceState(g,g.state,null),ac(r,d,g,p),rc(),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 ee=g.context,ae=o.contextType;_=bl,typeof ae=="object"&&ae!==null&&(_=On(ae));var pe=o.getDerivedStateFromProps;ae=typeof pe=="function"||typeof g.getSnapshotBeforeUpdate=="function",T=r.pendingProps!==T,ae||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(T||ee!==_)&&Q1(r,g,d,_),Rr=!1;var Z=r.memoizedState;g.state=Z,ac(r,d,g,p),rc(),ee=r.memoizedState,T||Z!==ee||Rr?(typeof pe=="function"&&(Op(r,o,pe,d),ee=r.memoizedState),($=Rr||Y1(r,o,$,d,Z,ee,_))?(ae||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=ee),g.props=d,g.state=ee,g.context=_,d=$):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{g=r.stateNode,up(s,r),_=r.memoizedProps,ae=Ba(o,_),g.props=ae,pe=r.pendingProps,Z=g.context,ee=o.contextType,$=bl,typeof ee=="object"&&ee!==null&&($=On(ee)),T=o.getDerivedStateFromProps,(ee=typeof T=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(_!==pe||Z!==$)&&Q1(r,g,d,$),Rr=!1,Z=r.memoizedState,g.state=Z,ac(r,d,g,p),rc();var ie=r.memoizedState;_!==pe||Z!==ie||Rr||s!==null&&s.dependencies!==null&&sd(s.dependencies)?(typeof T=="function"&&(Op(r,o,T,d),ie=r.memoizedState),(ae=Rr||Y1(r,o,ae,d,Z,ie,$)||s!==null&&s.dependencies!==null&&sd(s.dependencies))?(ee||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"||_===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||_===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=ie),g.props=d,g.state=ie,g.context=$,d=ae):(typeof g.componentDidUpdate!="function"||_===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||_===s.memoizedProps&&Z===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)):Sn(s,r,o,p),r.memoizedState=g.state,s=r.child):s=Ji(s,r,p),s}function cb(s,r,o,d){return Ea(),r.flags|=256,Sn(s,r,o,d),r.child}var Bp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pp(s){return{baseLanes:s,cachePool:Zv()}}function Fp(s,r,o){return s=s!==null?s.childLanes&~o:0,r&&(s|=Ts),s}function ub(s,r,o){var d=r.pendingProps,p=!1,g=(r.flags&128)!==0,_;if((_=g)||(_=s!==null&&s.memoizedState===null?!1:(Dn.current&2)!==0),_&&(p=!0,r.flags&=-129),_=(r.flags&32)!==0,r.flags&=-33,s===null){if(lt){if(p?zr(r):$r(),(s=Ht)?(s=Ry(s,Fs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Cr!==null?{id:xi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},o=Hv(s),o.return=r,r.child=o,En=r,Ht=null)):s=null,s===null)throw Tr(r);return Pm(s)?r.lanes=32:r.lanes=536870912,null}return g=d.children,d=d.fallback,p?($r(),p=r.mode,g=Sd({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=Pp(o),d.childLanes=Fp(s,_,o),r.memoizedState=Bp,dc(null,d)):(zr(r),Up(r,g))}var T=s.memoizedState;if(T!==null){var $=T.dehydrated;if($!==null)return n3(s,r,g,_,d,$,T,o)}return p?($r(),p=d.fallback,g=r.mode,T=s.child,$=T.sibling,d=Yi(T,{mode:"hidden",children:d.children}),d.subtreeFlags=T.subtreeFlags&1206910976,$!==null?p=Yi($,p):(p=Ca(p,g,o,null),p.flags|=2),p.return=r,d.return=r,d.sibling=p,r.child=d,dc(null,d),d=r.child,p=s.child.memoizedState,p===null?p=Pp(o):(g=p.cachePool,g!==null?(T=pn._currentValue,g=g.parent!==T?{parent:T,pool:T}:g):g=Zv(),p={baseLanes:p.baseLanes|o,cachePool:g}),d.memoizedState=p,d.childLanes=Fp(s,_,o),r.memoizedState=Bp,dc(s.child,d)):(zr(r),o=s.child,s=o.sibling,o=Yi(o,{mode:"visible",children:d.children}),o.return=r,o.sibling=null,s!==null&&(_=r.deletions,_===null?(r.deletions=[s],r.flags|=16):_.push(s)),r.child=o,r.memoizedState=null,o)}function Up(s,r){return r=Sd({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Sd(s,r){return s=os(22,s,null,r),s.lanes=0,s}function kd(s,r,o){return za(r,s.child,null,o),s=Up(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function n3(s,r,o,d,p,g,_,T){if(o)return r.flags&256?(zr(r),r.flags&=-257,kd(s,r,T)):r.memoizedState!==null?($r(),r.child=s.child,r.flags|=128,null):($r(),g=p.fallback,_=r.mode,p=Sd({mode:"visible",children:p.children},_),g=Ca(g,_,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=Pp(T),p.childLanes=Fp(s,d,T),r.memoizedState=Bp,dc(null,p));if(zr(r),Pm(g)){if(d=g.nextSibling&&g.nextSibling.dataset,d)var $=d.dgst;return d=$,d!==""&&(p=Error(i(419)),p.stack="",p.digest=d,Jo({value:p,source:null,stack:null})),kd(s,r,T)}if(gn||Ma(s,r,T,!1),d=(T&s.childLanes)!==0,gn||d){if(Dr.current!==null)return kd(s,r,T);if(d=$t,d!==null&&(p=pi(d,T),p!==0&&p!==_.retryLane))throw _.retryLane=p,Na(s,p),fs(d,s,p),zp;return Bm(g)||Id(),kd(s,r,T)}return Bm(g)?(r.flags|=192,r.child=s.child,null):(s=_.treeContext,Ht=Is(g.nextSibling),En=r,lt=!0,Er=null,Fs=!1,s!==null&&Gv(r,s),r=Up(r,p.children),r.flags|=134221824,r)}function db(s,r,o){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),nd(s.return,r,o)}function fb(s){for(var r=null;s!==null;){var o=s.alternate;o!==null&&dd(o)===null&&(r=s),s=s.sibling}return r}function jd(s,r,o,d,p,g){var _=s.memoizedState;_===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:p,treeForkCount:g}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=d,_.tail=o,_.tailMode=p,_.treeForkCount=g)}function Ip(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 Hp(s,r,o){var d=r.pendingProps,p=d.revealOrder,g=d.tail;d=d.children;var _=Dn.current;if(r.flags&128)return lc(r,_),null;var T=(_&2)!==0;if(T?(_=_&1|2,r.flags|=128):_&=1,lc(r,_),p==="backwards"&&s!==null?(Ip(s),Sn(s,r,d,o),Ip(s)):Sn(s,r,d,o),d=lt?Zo:0,!T&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&db(s,o,r);else if(s.tag===19)db(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=fb(r.child),o===null?(p=r.child,r.child=null):(p=o.sibling,o.sibling=null,Ip(r)),jd(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&&dd(s)===null){r.child=p;break}s=p.sibling,p.sibling=o,o=p,p=s}jd(r,!0,o,null,g,d);break;case"together":jd(r,!1,null,null,void 0,d);break;case"independent":r.memoizedState=null;break;default:o=fb(r.child),o===null?(p=r.child,r.child=null):(p=o.sibling,o.sibling=null),jd(r,!1,p,o,g,d)}return r.child}function hb(s,r,o){var d=r.pendingProps;return Mr(r,r.type,d.value),Sn(s,r,d.children,o),r.child}function Ji(s,r,o){if(s!==null&&(r.dependencies=s.dependencies),Ur|=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=Yi(s,s.pendingProps),r.child=o,o.return=r;s.sibling!==null;)s=s.sibling,o=o.sibling=Yi(s,s.pendingProps),o.return=r;o.sibling=null}return r.child}function qp(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&sd(s)))}function s3(s,r,o){switch(r.tag){case 3:Qe(r,r.stateNode.containerInfo),Mr(r,pn,s.memoizedState.cache),Ea();break;case 27:case 5:un(r);break;case 4:Qe(r,r.stateNode.containerInfo);break;case 10:Mr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,mp(r),null;break;case 13:var d=r.memoizedState;if(d!==null){if(d.dehydrated!==null)return zr(r),r.flags|=128,null;d=Ma(s,r,o,!1);var p=r.child.childLanes;return d||(o&p)!==0?ub(s,r,o):(zr(r),s=Ji(s,r,o),s!==null?s.sibling:null)}zr(r);break;case 19:if(r.flags&128)return Hp(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 Hp(s,r,o);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),lc(r,Dn.current),d)break;return null;case 22:return r.lanes=0,ib(s,r,o,r.pendingProps);case 24:Mr(r,pn,s.memoizedState.cache)}return Ji(s,r,o)}function pb(s,r,o){if(s!==null)if(s.memoizedProps!==r.pendingProps)gn=!0;else{if(!qp(s,o)&&(r.flags&128)===0)return gn=!1,s3(s,r,o);gn=(s.flags&131072)!==0}else gn=!1,lt&&(r.flags&1048576)!==0&&Vv(r,Zo,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")Wh(s)?(d=Ba(s,d),r.tag=1,r=ob(null,r,s,d,o)):(r.tag=0,r=$p(null,r,s,d,o));else{if(s!=null){var p=s.$$typeof;if(p===H){r.tag=11,r=tb(null,r,s,d,o);break e}else if(p===ve){r.tag=14,r=nb(null,r,s,d,o);break e}else if(p===q){r.tag=10,r.type=s,r=hb(null,r,o);break e}}throw r=Le(s)||s,Error(i(306,r,""))}}return r;case 0:return $p(s,r,r.type,r.pendingProps,o);case 1:return d=r.type,p=Ba(d,r.pendingProps),ob(s,r,d,p,o);case 3:e:{if(Qe(r,r.stateNode.containerInfo),s===null)throw Error(i(387));d=r.pendingProps;var g=r.memoizedState;p=g.element,up(s,r),ac(r,d,null,o);var _=r.memoizedState;if(d=_.cache,Mr(r,pn,d),d!==g.cache&&ip(r,[pn],o,!0),rc(),d=_.element,g.isDehydrated)if(g={element:d,isDehydrated:!1,cache:_.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=cb(s,r,d,o);break e}else if(d!==p){p=$s(Error(i(424)),r),Jo(p),r=cb(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=Is(s.firstChild),En=r,lt=!0,Er=null,Fs=!0,o=i1(r,null,d,o),r.child=o;o;)o.flags=o.flags&-3|134221824,o=o.sibling}else{if(Ea(),d===p){r=Ji(s,r,o);break e}Sn(s,r,d,o)}r=r.child}return r;case 26:return Tl(s,r),s===null?(o=Py(r.type,null,r.pendingProps,null))?r.memoizedState=o:lt||(r.stateNode=vy(r.type,r.pendingProps,se.current,r)):r.memoizedState=Py(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return un(r),s===null&<&&(d=r.stateNode=Dy(r.type,r.pendingProps,se.current),En=r,Fs=!0,p=Ht,Vr(r.type)?(Fm=p,Ht=Is(d.firstChild)):Ht=p),Sn(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=W3(d,r.type,r.pendingProps,Fs),d!==null?(r.stateNode=d,En=r,Ht=Is(d.firstChild),Fs=!1,p=!0):p=!1),p||Tr(r)),un(r),p=r.type,g=r.pendingProps,_=s!==null?s.memoizedProps:null,d=g.children,Am(p,g)?d=null:_!==null&&Am(p,_)&&(r.flags|=32),r.memoizedState!==null&&(p=vp(s,r,GC,null,null,o),Yl._currentValue=p),Tl(s,r),Sn(s,r,d,o),r.child;case 6:return s===null&<&&((s=o=Ht)&&(o=Z3(o,r.pendingProps,Fs),o!==null?(r.stateNode=o,En=r,Ht=null,s=!0):s=!1),s||Tr(r)),null;case 13:return ub(s,r,o);case 4:return Qe(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=za(r,null,d,o):Sn(s,r,d,o),r.child;case 11:return tb(s,r,r.type,r.pendingProps,o);case 7:return d=r.pendingProps,Tl(s,r),Sn(s,r,d,o),r.child;case 8:return Sn(s,r,r.pendingProps.children,o),r.child;case 12:return Sn(s,r,r.pendingProps.children,o),r.child;case 10:return hb(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,Sn(s,r,d,o),r.child;case 14:return nb(s,r,r.type,r.pendingProps,o);case 15:return sb(s,r,r.type,r.pendingProps,o);case 19:return Hp(s,r,o);case 31:return t3(s,r,o);case 22:return ib(s,r,o,r.pendingProps);case 24:return Aa(r),d=On(pn),s===null?(p=lp(),p===null&&(p=$t,g=rp(),p.pooledCache=g,g.refCount++,g!==null&&(p.pooledCacheLanes|=o),p=g),r.memoizedState={parent:d,cache:p},cp(r),Mr(r,pn,p)):((s.lanes&o)!==0&&(up(s,r),ac(r,null,null,o),rc()),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),Mr(r,pn,d)):(d=g.cache,Mr(r,pn,d),d!==p.cache&&ip(r,[pn],o,!0))),Sn(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&&ed(r),s!==null&&s.memoizedProps.name!==d.name?r.flags|=4194816:Tl(s,r),Sn(s,r,d.children,o),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function er(s){s.flags|=4}function Vp(s,r,o,d,p){var g;if((g=(s.mode&32)!==0)&&(g=o===null?Hy(r,d):Hy(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(Xb())s.flags|=8192;else throw Da=ld,op}else s.flags&=-16777217}function mb(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!qy(r))if(Xb())s.flags|=8192;else throw Da=ld,op}function Nd(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Bu():536870912,s.lanes|=r,Ll|=r)}function fc(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 i3(s,r,o){var d=r.pendingProps;switch(ep(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),Ki(pn),et(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(s===null||s.child===null)&&(wl(r)?er(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,np())),qt(r),null;case 26:var p=r.type,g=r.memoizedState;return s===null?(er(r),g!==null?(qt(r),mb(r,g)):(qt(r),Vp(r,p,null,d,o))):g?g!==s.memoizedState?(er(r),qt(r),mb(r,g)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&er(r),qt(r),Vp(r,p,s,d,o)),null;case 27:if(ce(r),o=se.current,p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&er(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}s=St.current,wl(r)?Yv(r):(s=Dy(p,d,o),r.stateNode=s,er(r))}return qt(r),r.subtreeFlags&=-33554433,null;case 5:if(ce(r),p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&er(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))Yv(r);else{var _=Sc(se.current);switch(g){case 1:g=_.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:g=_.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":g=_.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":g=_.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":g=_.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof d.is=="string"?_.createElement("select",{is:d.is}):_.createElement("select"),d.multiple?g.multiple=!0:d.size&&(g.size=d.size);break;default:g=typeof d.is=="string"?_.createElement(p,{is:d.is}):_.createElement(p)}}g[dn]=r,g[Cn]=d;e:for(_=r.child;_!==null;){if(_.tag===5||_.tag===6)g.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===r)break e;for(;_.sibling===null;){if(_.return===null||_.return===r)break e;_=_.return}_.sibling.return=_.return,_=_.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&&er(r)}}return qt(r),r.subtreeFlags&=-33554433,Vp(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,o),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&er(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(i(166));if(s=se.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||py(s.nodeValue,o)),s||Tr(r,!0)}else s=Sc(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=np(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),s=!0;if(!s)return r.flags&256?(Ns(r),r):(Ns(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=np(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Ns(r),r):(Ns(r),null)}return Ns(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),Nd(r,r.updateQueue),qt(r),null);case 4:return et(),s===null&&Nm(r.stateNode.containerInfo),r.flags|=67108864,qt(r),null;case 10:return Ki(r.type),qt(r),null;case 19:if(gp(r),d=r.memoizedState,d===null)return qt(r),null;if(p=(r.flags&128)!==0,g=d.rendering,g===null)if(p)fc(d,!1);else{if(cn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(g=dd(s),g!==null){for(r.flags|=128,fc(d,!1),s=g.updateQueue,r.updateQueue=s,Nd(r,s),r.subtreeFlags=0,s=o,o=r.child;o!==null;)Iv(o,s),o=o.sibling;return lc(r,Dn.current&1|2),lt&&Qi(r,d.treeForkCount),r.child}s=s.sibling}d.tail!==null&&sn()>Bd&&(r.flags|=128,p=!0,fc(d,!1),r.lanes=4194304)}else{if(!p)if(s=dd(g),s!==null){if(r.flags|=128,p=!0,s=s.updateQueue,r.updateQueue=s,Nd(r,s),fc(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!g.alternate&&!lt)return qt(r),null}else 2*sn()-d.renderingStartTime>Bd&&o!==536870912&&(r.flags|=128,p=!0,fc(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?lc(r,g):(o=g,Xe(Ln,r),Xe(Dn,o),Un===null&&(Un=r)),lt&&Qi(r,d.treeForkCount),s}return qt(r),null;case 22:case 23:return Ns(r),pp(),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&&Nd(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),Ki(pn),qt(r),null;case 25:return null;case 30:return r.flags|=33554432,qt(r),null}throw Error(i(156,r.tag))}function r3(s,r){switch(ep(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Ki(pn),et(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return ce(r),null;case 31:if(r.memoizedState!==null){if(Ns(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(Ns(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 gp(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 et(),null;case 10:return Ki(r.type),null;case 22:case 23:return Ns(r),pp(),s!==null&&wt(Oa),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Ki(pn),null;case 25:return null;default:return null}}function gb(s,r){switch(ep(r),r.tag){case 3:Ki(pn),et();break;case 26:case 27:case 5:ce(r);break;case 4:et();break;case 31:r.memoizedState!==null&&Ns(r);break;case 13:Ns(r);break;case 19:gp(r);break;case 10:Ki(r.type);break;case 22:case 23:Ns(r),pp(),s!==null&&wt(Oa);break;case 24:Ki(pn)}}function hc(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,_=o.inst;d=g(),_.destroy=d}o=o.next}while(o!==p)}}catch(T){At(r,r.return,T)}}function Br(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 _=d.inst,T=_.destroy;if(T!==void 0){_.destroy=void 0,p=r;var $=o,ee=T;try{ee()}catch(ae){At(p,$,ae)}}}d=d.next}while(d!==g)}}catch(ae){At(r,r.return,ae)}}function xb(s){var r=s.updateQueue;if(r!==null){var o=s.stateNode;try{a1(r,o)}catch(d){At(s,s.return,d)}}}function vb(s,r,o){o.props=Ba(s.type,s.memoizedProps),o.state=s.memoizedState;try{o.componentWillUnmount()}catch(d){At(s,r,d)}}function bi(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=Vi(s.memoizedProps,p);(p.ref===null||p.ref.name!==g)&&(p.ref=jy(g)),d=p.ref;break;case 7:if(s.stateNode===null){var _=new As(s);v(s.child,!1,X3,_,void 0,void 0),s.stateNode=_}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 Cd(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++)Ay(s.stateNode,r[o])}function bb(s){for(var r=s.return;r!==null&&(Yp(r)&&Ay(s.stateNode,r.stateNode),!Gp(r));)r=r.return}function pc(s){for(var r=s.return;r!==null&&(Yp(r)&&K3(s.stateNode,r.stateNode),!Gp(r));)r=r.return}function Gp(s){return s.tag===5||s.tag===3||s.tag===27}function Yp(s){return s&&s.tag===7&&s.stateNode!==null}function Qp(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 Xp(s,r,o){try{var d=s.stateNode;A3(d,s.type,o,r),d[Cn]=r}catch(p){At(s,s.return,p)}}function yb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Vr(s.type)||s.tag===4}function Kp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||yb(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&&Vr(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 Wp(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)),Cd(s,d),vt=!0;else if(p!==4&&(p===27&&(Cd(s,d),d=null,Vr(s.type)&&(o=s.stateNode,r=null)),s=s.child,s!==null))for(Wp(s,r,o,d),s=s.sibling;s!==null;)Wp(s,r,o,d),s=s.sibling}function Ed(s,r,o,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?o.insertBefore(p,r):o.appendChild(p),Cd(s,d),vt=!0;else if(p!==4&&(p===27&&(Cd(s,d),d=null,Vr(s.type)&&(o=s.stateNode)),s=s.child,s!==null))for(Ed(s,r,o,d),s=s.sibling;s!==null;)Ed(s,r,o,d),s=s.sibling}function _b(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 Td=!1,Cs=null;function wb(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Td=!0)}var yi=null;function Sb(){var s=yi;return yi=null,s}var cs=0;function Ml(s,r,o,d,p){return cs=0,kb(s.child,r,o,d,p)}function kb(s,r,o,d,p){for(var g=!1;s!==null;){if(s.tag===5){var _=s.stateNode;if(d!==null){var T=Lm(_);d.push(T),T.view&&(g=!0)}else g||Lm(_).view&&(g=!0);Td=!0,Sy(_,cs===0?r:r+"_"+cs,o),cs++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&p||kb(s.child,r,o,d,p)&&(g=!0));s=s.sibling}return g}function _i(s,r){for(;s!==null;)s.tag===5?ky(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&r||_i(s.child,r)),s=s.sibling}function Md(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(Md(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=Gi(r.default,r.share),r!=="none"&&(Ml(s,o,r,null,!1)||_i(s.child,!1))}s=s.sibling}}function Zp(s,r){if(s.tag===30){var o=s.stateNode,d=s.memoizedProps,p=Vi(d,o),g=Gi(d.default,o.paired?d.share:d.enter);g!=="none"?Ml(s,p,g,null,!1)?(Md(s),o.paired||r||Bl(s,d.onEnter)):_i(s.child,!1):Md(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Zp(s,r),s=s.sibling;else Md(s)}function Jp(s){if(Cs!==null&&Cs.size!==0){var r=Cs;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=Gi(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)):_i(s.child,!1)),r.delete(d),r.size===0)break}}}Jp(s)}s=s.sibling}}}function em(s){if(s.tag===30){var r=s.memoizedProps,o=Vi(r,s.stateNode),d=Cs!==null?Cs.get(o):void 0,p=Gi(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,Cs.delete(o),Bl(s,r.onShare)):Bl(s,r.onExit):_i(s.child,!1)),Cs!==null&&Jp(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)em(s),s=s.sibling;else Cs!==null&&Jp(s)}function jb(s){for(s=s.child;s!==null;){if(s.tag===30){var r=s.memoizedProps,o=Vi(r,s.stateNode);r=Gi(r.default,r.update),s.flags&=-5,r!=="none"&&Ml(s,o,r,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&jb(s);s=s.sibling}}function tm(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,_i(s.child,!1))}tm(s)}s=s.sibling}}function Ad(s){if(s.tag===30)s.stateNode.paired=null,_i(s.child,!1),tm(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Ad(s),s=s.sibling;else tm(s)}function Nb(s){for(s=s.child;s!==null;)s.tag===30?_i(s.child,!1):(s.subtreeFlags&33554432)!==0&&Nb(s),s=s.sibling}function nm(s,r,o,d,p,g,_){for(var T=!1;r!==null;){if(r.tag===5){var $=r.stateNode;if(g!==null&&cs<g.length){var ee=g[cs],ae=Lm($);(ee.view||ae.view)&&(T=!0);var pe;if(pe=(s.flags&4)===0)if(ae.clip)pe=!0;else{pe=ee.rect;var Z=ae.rect;pe=pe.y!==Z.y||pe.x!==Z.x||pe.height!==Z.height||pe.width!==Z.width}pe&&(s.flags|=4),ae.abs?ae=!ee.abs:(ee=ee.rect,ae=ae.rect,ae=ee.height!==ae.height||ee.width!==ae.width),ae&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&Sy($,cs===0?o:o+"_"+cs,p),T&&(s.flags&4)!==0||(yi===null&&(yi=[]),yi.push($,cs===0?d:d+"_"+cs,r.memoizedProps)),cs++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&_?s.flags|=r.flags&32:nm(s,r.child,o,d,p,g,_)&&(T=!0));r=r.sibling}return T}function Cb(s,r){for(s=s.child;s!==null;){if(s.tag===30){var o=s.memoizedProps,d=s.stateNode,p=Vi(o,d),g=Gi(o.default,o.update),_;_=s.memoizedState,s.memoizedState=null,d=s;var T=s.child;cs=0,p=nm(d,T,p,p,g,_,!1),(s.flags&4)!==0&&p&&Bl(s,o.onUpdate)}else(s.subtreeFlags&33554432)!==0&&Cb(s);s=s.sibling}}var Tn=!1,Tt=!1,wi=!1,sm=!1,Eb=typeof WeakSet=="function"?WeakSet:Set,Mn=null,Si=!1,mc=!1,Rd=!1,im=!1;function a3(s,r,o){if(s=s.containerInfo,Tm=Ql,s=Rv(s),qh(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,_=p.focusNode;p=p.focusOffset;try{d.nodeType,_.nodeType}catch{d=null;break e}var T=0,$=-1,ee=-1,ae=0,pe=0,Z=s,ie=null;t:for(;;){for(var Te;Z!==d||g!==0&&Z.nodeType!==3||($=T+g),Z!==_||p!==0&&Z.nodeType!==3||(ee=T+p),Z.nodeType===3&&(T+=Z.nodeValue.length),(Te=Z.firstChild)!==null;)ie=Z,Z=Te;for(;;){if(Z===s)break t;if(ie===d&&++ae===g&&($=T),ie===_&&++pe===p&&(ee=T),(Te=Z.nextSibling)!==null)break;Z=ie,ie=Z.parentNode}Z=Te}d=$===-1||ee===-1?null:{start:$,end:ee}}else d=null}d=d||{start:0,end:0}}else d=null;for(Mm={focusedElem:s,selectionRange:d},Ql=!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&&em(d[g]);if(s.alternate===null&&(s.flags&2)!==0)o&&wb(s),Od(o);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&o&&em(d),Od(o);continue}else if(d!==null&&d.memoizedState!==null){o&&wb(s),Od(o);continue}}d=s.child,(s.subtreeFlags&r)!==0&&d!==null?(d.return=s,Mn=d):(o&&jb(s),Od(o))}}Cs=null}function Od(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 _=Ba(r.type,p);o=g.getSnapshotBeforeUpdate(_,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)$m(d);else if(o===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":$m(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=Vi(d.memoizedProps,d.stateNode),p=r.memoizedProps,p=Gi(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 Tb(s,r,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:ki(s,o),d&4&&hc(5,o);break;case 1:if(ki(s,o),d&4)if(s=o.stateNode,r===null)try{s.componentDidMount()}catch(_){At(o,o.return,_)}else{var p=Ba(o.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(p,r,s.__reactInternalSnapshotBeforeUpdate)}catch(_){At(o,o.return,_)}}d&64&&xb(o),d&512&&bi(o,o.return);break;case 3:if(ki(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{a1(s,r)}catch(_){At(o,o.return,_)}}break;case 27:r===null&&d&4&&_b(o);case 26:case 5:ki(s,o),r===null&&d&4&&Qp(o),d&512&&bi(o,o.return);break;case 12:ki(s,o);break;case 31:ki(s,o),d&4&&Ob(s,o);break;case 13:ki(s,o),d&4&&Lb(s,o),d&64&&(s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(o=v3.bind(null,o),J3(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),ii(s,o,d)):ki(s,o),Tn=r,Tt=p}break;case 30:ki(s,o),d&512&&bi(o,o.return);break;case 7:d&512&&bi(o,o.return);default:ki(s,o)}}function rm(s,r){for(s=s.child;s!==null;)Mb(s,r),s=s.sibling}function Mb(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,_=g!=null&&g.hasOwnProperty("display")?g.display:null;p.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch($){At(s,s.return,$)}am(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?wy(T,!0):wy(s.stateNode,!1)}catch($){At(s,s.return,$)}break;case 22:case 23:s.memoizedState===null&&rm(s,r);break;default:rm(s,r)}}function am(s,r){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var o=s,d=r;switch(o.tag){case 4:Mb(o,d);break e;case 22:o.memoizedState===null&&am(o,d);break e;default:am(o,d)}}s=s.sibling}}function Ab(s){var r=s.alternate;r!==null&&(s.alternate=null,Ab(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 Wt=null,us=!1;function ni(s,r,o){for(o=o.child;o!==null;)Rb(s,r,o),o=o.sibling}function Rb(s,r,o){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Nn,o)}catch{}switch(o.tag){case 26:Tt||zn(o,r),ni(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),pc(o);var d=Wt,p=us;Vr(o.type)&&(Wt=o.stateNode,us=!1),ni(s,r,o),zy(o.stateNode,o.type,o.memoizedProps),Wt=d,us=p;break;case 5:Tt||zn(o,r),pc(o);case 6:if(o.tag===6&&pc(o),d=Wt,p=us,Wt=null,ni(s,r,o),Wt=d,us=p,Wt!==null)if(us)try{(Wt.nodeType===9?Wt.body:Wt.nodeName==="HTML"?Wt.ownerDocument.body:Wt).removeChild(o.stateNode),vt=!0}catch(g){At(o,r,g)}else try{Wt.removeChild(o.stateNode),vt=!0}catch(g){At(o,r,g)}break;case 18:Wt!==null&&(us?(s=Wt,_y(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.stateNode),Xl(s)):_y(Wt,o.stateNode));break;case 4:d=Wt,p=us,Wt=o.stateNode.containerInfo,us=!0,ni(s,r,o),Wt=d,us=p;break;case 0:case 11:case 14:case 15:Br(2,o,r),Tt||Br(4,o,r),ni(s,r,o);break;case 1:Tt||(zn(o,r),d=o.stateNode,typeof d.componentWillUnmount=="function"&&vb(o,r,d)),ni(s,r,o);break;case 21:ni(s,r,o);break;case 22:Tt=(d=Tt)||o.memoizedState!==null,ni(s,r,o),Tt=d;break;case 30:zn(o,r),ni(s,r,o);break;case 7:Tt||zn(o,r),ni(s,r,o);break;default:ni(s,r,o)}}function Ob(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Xl(s)}catch(o){At(r,r.return,o)}}}function Lb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Xl(s)}catch(o){At(r,r.return,o)}}function l3(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new Eb),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new Eb),r;default:throw Error(i(435,s.tag))}}function Ld(s,r){var o=l3(s);r.forEach(function(d){if(!o.has(d)){o.add(d);var p=b3.bind(null,s,d);d.then(p,p)}})}function Wn(s,r,o){var d=r.deletions;if(d!==null)for(var p=0;p<d.length;p++){var g=d[p],_=s,T=r,$=T;e:for(;$!==null;){switch($.tag){case 27:if(Vr($.type)){Wt=$.stateNode,us=!1;break e}break;case 5:Wt=$.stateNode,us=!1;break e;case 3:case 4:Wt=$.stateNode.containerInfo,us=!0;break e}$=$.return}if(Wt===null)throw Error(i(160));Rb(_,T,g),Wt=null,us=!1,_=g.alternate,_!==null&&(_.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Db(r,s,o),r=r.sibling}var si=null;function Db(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 _=d[g];_.ref.impl=_.nextImpl}Wn(r,s,o),Zn(s),p&4&&(Br(3,s,s.return),hc(3,s),Br(5,s,s.return));break;case 1:Wn(r,s,o),Zn(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=si,Wn(r,s,o),Zn(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=vy(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[ya]||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=Iy("link","href",p).get(r+(o.href||""))){for(_=0;_<g.length;_++)if(d=g[_],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(_,1);break t}}d=p.createElement(r),$n(d,r,o),p.head.appendChild(d);break;case"meta":if(g=Iy("meta","content",p).get(r+(o.content||""))){for(_=0;_<g.length;_++)if(d=g[_],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(_,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||qm(g,s.type,s.stateNode);else s.stateNode=Uy(g,o,s.memoizedProps);else p!==o?(p===null?(r=d.stateNode,r===null||Tt||r.parentNode.removeChild(r)):p.count--,o===null?Tn||qm(g,s.type,s.stateNode):Uy(g,o,s.memoizedProps)):o===null&&s.stateNode!==null&&Xp(s,s.memoizedProps,d.memoizedProps);break;case 27:Wn(r,s,o),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),d!==null&&p&4&&Xp(s,s.memoizedProps,d.memoizedProps);break;case 5:if(g=wi,wi=!1,Wn(r,s,o),wi=g,Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),s.flags&32){r=s.stateNode;try{qi(r,""),vt=!0}catch(ae){At(s,s.return,ae)}}p&4&&s.stateNode!=null&&(r=s.memoizedProps,Xp(s,r,d!==null?d.memoizedProps:r)),p&1024&&(sm=!0);break;case 6:if(Wn(r,s,o),Zn(s),p&4){if(s.stateNode===null)throw Error(i(162));r=s.memoizedProps,o=s.stateNode;try{o.nodeValue=r,vt=!0}catch(ae){At(s,s.return,ae)}}break;case 3:if(vt=!1,Xd=null,g=si,si=kc(r.containerInfo),Wn(r,s,o),si=g,Zn(s),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Xl(r.containerInfo)}catch(ae){At(s,s.return,ae)}sm&&(sm=!1,zb(s)),vt=!1;break;case 4:p=wi,wi=Tn,d=Pu(),g=si,si=kc(s.stateNode.containerInfo),Wn(r,s,o),Zn(s),si=g,vt&&mc&&(Rd=!0),vt=d,wi=p;break;case 12:Wn(r,s,o),Zn(s);break;case 31:Wn(r,s,o),Zn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 13:Wn(r,s,o),Zn(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&($d=sn()),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 22:g=s.memoizedState!==null,_=d!==null&&d.memoizedState!==null;var T=Tn,$=Tt,ee=wi;Tn=T||g,wi=ee||g,Tt=$||_,Wn(r,s,o),Tt=$,wi=ee,Tn=T,Zn(s),p&8192&&(r=s.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,!g||d===null||_||Tn||Tt||(r=_||Tt,o=Tn,d=Tt,Tn=g||Tn,Tt=r,Pr(s,2),Tn=o,Tt=d),!g&&wi||rm(s,g)),p&4&&(r=s.updateQueue,r!==null&&(o=r.retryQueue,o!==null&&(r.retryQueue=null,Ld(s,o))));break;case 19:Wn(r,s,o),Zn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 30:p&512&&(Tt||d===null||zn(d,d.return)),p=Pu(),g=mc,_=(o&335544064)===o,T=s.memoizedProps,mc=_&&Gi(T.default,T.update)!=="none",Wn(r,s,o),Zn(s),_&&d!==null&&vt&&(s.flags|=4),mc=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:Wn(r,s,o),Zn(s)}}function Zn(s){var r=s.flags;if(r&2){try{for(var o,d=s.return;d!==null;){if(yb(d)){o=d;break}d=d.return}d=null;for(var p=s.return;p!==null;){if(Yp(p)){var g=p.stateNode;d===null?d=[g]:d.push(g)}if(Gp(p))break;p=p.return}var _=d;if(o==null)throw Error(i(160));switch(o.tag){case 27:var T=o.stateNode,$=Kp(s);Ed(s,$,T,_);break;case 5:var ee=o.stateNode;o.flags&32&&(qi(ee,""),o.flags&=-33);var ae=Kp(s);Ed(s,ae,ee,_);break;case 3:case 4:var pe=o.stateNode.containerInfo,Z=Kp(s);Wp(s,Z,pe,_);break;default:throw Error(i(161))}}catch(ie){At(s,s.return,ie)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function zb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;zb(r),r.tag===5&&r.flags&1024&&(r=r.stateNode,Ql=!0,r.reset(),Ql=!1),s=s.sibling}}function Al(s,r){if(r.subtreeFlags&9270)for(r=r.child;r!==null;)$b(r,s),r=r.sibling;else Cb(r)}function $b(s,r){var o=s.alternate;if(o===null)Zp(s,!1);else switch(s.tag){case 3:if(im=Si=!1,Sb(),Al(r,s),!Si&&!Rd){if(s=yi,s!==null)for(var d=0;d<s.length;d+=3){o=s[d];var p=s[d+1];ky(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"})),im=!0}yi=null;break;case 5:Al(r,s);break;case 4:d=Si,Si=!1,Al(r,s),Si&&(Rd=!0),Si=d;break;case 22:s.memoizedState===null&&(o.memoizedState!==null?Zp(s,!1):Al(r,s));break;case 30:d=Si,p=Sb(),Si=!1,Al(r,s),Si&&(s.flags|=4);var g=s.memoizedProps,_=s.stateNode;r=Vi(g,_),_=Vi(o.memoizedProps,_);var T=Gi(g.default,g.update);T==="none"?r=!1:(g=o.memoizedState,o.memoizedState=null,o=s.child,cs=0,r=nm(s,o,r,_,T,g,!0),cs!==(g===null?0:g.length)&&(s.flags|=32)),(s.flags&4)!==0&&r?(Bl(s,s.memoizedProps.onUpdate),yi=p):p!==null&&(p.push.apply(p,yi),yi=p),Si=(s.flags&32)!==0?!0:d;break;default:Al(r,s)}}function ki(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Tb(s,r.alternate,r),r=r.sibling}function Pr(s,r){for(s=s.child;s!==null;){var o=s,d=r;switch(o.tag){case 0:case 11:case 14:case 15:Br(4,o,o.return),Pr(o,d);break;case 1:zn(o,o.return);var p=o.stateNode;typeof p.componentWillUnmount=="function"&&vb(o,o.return,p),Pr(o,d);break;case 27:(d&2)!==0&&zy(o.stateNode,o.type,o.memoizedProps);case 5:zn(o,o.return),o.tag!==5&&o.tag!==27||pc(o),Pr(o,d);break;case 6:pc(o);break;case 26:zn(o,o.return),p=o.stateNode,o.memoizedState!==null||p===null||Tt||p.parentNode.removeChild(p),Pr(o,d);break;case 22:o.memoizedState===null&&Pr(o,d);break;case 30:zn(o,o.return),Pr(o,d);break;case 7:zn(o,o.return);default:Pr(o,d)}s=s.sibling}}function ii(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,_=g.flags,T=(o&1)!==0;switch(g.tag){case 0:case 11:case 15:ii(p,g,o),hc(4,g);break;case 1:if(ii(p,g,o),d=g,p=d.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ae){At(d,d.return,ae)}if(d=g,p=d.updateQueue,p!==null){var $=d.stateNode;try{var ee=p.shared.hiddenCallbacks;if(ee!==null)for(p.shared.hiddenCallbacks=null,p=0;p<ee.length;p++)r1(ee[p],$)}catch(ae){At(d,d.return,ae)}}T&&_&64&&xb(g),bi(g,g.return);break;case 27:(o&2)!==0&&_b(g);case 5:g.tag!==5&&g.tag!==27||bb(g),ii(p,g,o),T&&d===null&&_&4&&Qp(g),bi(g,g.return);break;case 6:bb(g);break;case 26:$=g.stateNode,g.memoizedState!==null||$===null||Tn||qm(kc($.ownerDocument),g.type,$),ii(p,g,o),T&&d===null&&_&4&&Qp(g),bi(g,g.return);break;case 12:ii(p,g,o);break;case 31:ii(p,g,o),T&&_&4&&Ob(p,g);break;case 13:ii(p,g,o),T&&_&4&&Lb(p,g);break;case 22:g.memoizedState===null&&ii(p,g,o),bi(g,g.return);break;case 30:ii(p,g,o),bi(g,g.return);break;case 7:bi(g,g.return);default:ii(p,g,o)}r=r.sibling}}function lm(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&&ec(o))}function om(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&ec(s))}function Us(s,r,o,d){var p=(o&335544064)===o;if(r.subtreeFlags&(p?10262:10256))for(r=r.child;r!==null;)Bb(s,r,o,d),r=r.sibling;else p&&Nb(r)}function Bb(s,r,o,d){var p=(o&335544064)===o;p&&r.alternate===null&&r.return!==null&&r.return.alternate!==null&&Ad(r);var g=r.flags;switch(r.tag){case 0:case 11:case 15:Us(s,r,o,d),g&2048&&hc(9,r);break;case 1:Us(s,r,o,d);break;case 3:Us(s,r,o,d),p&&im&&(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&&ec(g)));break;case 12:if(g&2048){Us(s,r,o,d),g=r.stateNode;try{var _=r.memoizedProps,T=_.id,$=_.onPostCommit;typeof $=="function"&&$(T,r.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(ee){At(r,r.return,ee)}}else Us(s,r,o,d);break;case 31:Us(s,r,o,d);break;case 13:Us(s,r,o,d);break;case 23:break;case 22:_=r.stateNode,T=r.alternate,r.memoizedState!==null?(p&&T!==null&&T.memoizedState===null&&Ad(T),_._visibility&2?Us(s,r,o,d):gc(s,r)):(p&&T!==null&&T.memoizedState!==null&&Ad(r),_._visibility&2?Us(s,r,o,d):(_._visibility|=2,Rl(s,r,o,d,(r.subtreeFlags&10256)!==0||!1))),g&2048&&lm(T,r);break;case 24:Us(s,r,o,d),g&2048&&om(r.alternate,r);break;case 30:p&&(g=r.alternate,g!==null&&(_i(g.child,!0),_i(r.child,!0))),Us(s,r,o,d);break;default:Us(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,_=r,T=o,$=d,ee=_.flags;switch(_.tag){case 0:case 11:case 15:Rl(g,_,T,$,p),hc(8,_);break;case 23:break;case 22:var ae=_.stateNode;_.memoizedState!==null?ae._visibility&2?Rl(g,_,T,$,p):gc(g,_):(ae._visibility|=2,Rl(g,_,T,$,p)),p&&ee&2048&&lm(_.alternate,_);break;case 24:Rl(g,_,T,$,p),p&&ee&2048&&om(_.alternate,_);break;default:Rl(g,_,T,$,p)}r=r.sibling}}function gc(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:gc(o,d),p&2048&&lm(d.alternate,d);break;case 24:gc(o,d),p&2048&&om(d.alternate,d);break;default:gc(o,d)}r=r.sibling}}var Pa=8192;function Fa(s,r,o){if(s.subtreeFlags&Pa)for(s=s.child;s!==null;)Pb(s,r,o),s=s.sibling}function Pb(s,r,o){switch(s.tag){case 26:Fa(s,r,o),s.flags&Pa&&(s.memoizedState!==null?hE(o,si,s.memoizedState,s.memoizedProps):(s=s.stateNode,(r&335544128)===r&&Gy(o,s)));break;case 5:Fa(s,r,o),s.flags&Pa&&(s=s.stateNode,(r&335544128)===r&&Gy(o,s));break;case 3:case 4:var d=si;si=kc(s.stateNode.containerInfo),Fa(s,r,o),si=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Pa,Pa=16777216,Fa(s,r,o),Pa=d):Fa(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,Cs===null&&(Cs=new Map),Cs.set(d,p)}Fa(s,r,o);break;default:Fa(s,r,o)}}function Fb(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 xc(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,Ib(d,s)}Fb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ub(s),s=s.sibling}function Ub(s){switch(s.tag){case 0:case 11:case 15:xc(s),s.flags&2048&&Br(9,s,s.return);break;case 3:xc(s);break;case 12:xc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Dd(s)):xc(s);break;default:xc(s)}}function Dd(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,Ib(d,s)}Fb(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Br(8,r,r.return),Dd(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,Dd(r));break;default:Dd(r)}s=s.sibling}}function Ib(s,r){for(;Mn!==null;){var o=Mn;switch(o.tag){case 0:case 11:case 15:Br(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:ec(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(Ab(d),d===o){Mn=null;break e}if(p!==null){p.return=g,Mn=p;break e}Mn=g}}}var o3={getCacheForType:function(s){var r=On(pn),o=r.data.get(s);return o===void 0&&(o=s(),r.data.set(s,o)),o},cacheSignal:function(){return On(pn).controller.signal}},c3=typeof WeakMap=="function"?WeakMap:Map,Et=0,$t=null,ct=null,ht=0,Mt=0,Es=null,Fr=!1,Ol=!1,cm=!1,tr=0,cn=0,Ur=0,Ua=0,zd=0,Ts=0,Ll=0,vc=null,ds=null,um=!1,$d=0,Hb=0,Bd=1/0,Pd=null,Ir=null,tn=0,ri=null,Ia=null,ji=0,dm=0,fm=null,qb=null,Dl=null,zl=null,$l=null,bc=0,Fd=null;function Ms(){return(Et&2)!==0&&ht!==0?ht&-ht:Ce.T!==null?wm():ba()}function Vb(){if(Ts===0)if((ht&536870912)===0||lt){var s=ma;ma<<=1,(ma&3932160)===0&&(ma=262144),Ts=s}else Ts=536870912;return s=Ln.current,s!==null&&(s.flags|=32),Ts}function Bl(s,r){if(r!=null){var o=s.stateNode,d=o.ref;d===null&&(d=o.ref=jy(Vi(s.memoizedProps,o))),zl===null&&(zl=[]),zl.push(r.bind(null,d))}}function fs(s,r,o){(s===$t&&(Mt===2||Mt===9)||s.cancelPendingCommit!==null)&&(Pl(s,0),Hr(s,ht,Ts,!1)),hi(s,o),((Et&2)===0||s!==$t)&&(s===$t&&((Et&2)===0&&(Ua|=o),cn===4&&Hr(s,ht,Ts,!1)),Ni(s))}function Gb(s,r,o){if((Et&6)!==0)throw Error(i(327));var d=!o&&(r&127)===0&&(r&s.expiredLanes)===0||br(s,r),p=d?f3(s,r):pm(s,r,!0),g=d;do{if(p===0){Ol&&!d&&Hr(s,r,0,!1);break}else{if(o=s.current.alternate,g&&!u3(o)){p=pm(s,r,!1),g=!1;continue}if(p===2){if(g=r,s.errorRecoveryDisabledLanes&g)var _=0;else _=s.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){r=_;e:{var T=s;p=vc;var $=T.current.memoizedState.isDehydrated;if($&&(Pl(T,_).flags|=256),_=pm(T,_,!1),_!==2&&_!==6){if(cm&&!$){T.errorRecoveryDisabledLanes|=g,Ua|=g,p=4;break e}g=ds,ds=p,g!==null&&(ds===null?ds=g:ds.push.apply(ds,g))}p=_}if(g=!1,p!==2)continue}}if(p===1){Pl(s,0),Hr(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:Hr(d,r,Ts,!Fr);break e;case 2:ds=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(p=$d+300-sn(),10<p)){if(Hr(d,r,Ts,!Fr),Ks(d,0,!0)!==0)break e;ji=r,d.timeoutHandle=Om(Yb.bind(null,d,o,ds,Pd,um,r,Ts,Ua,Ll,Fr,g,"Throttled",-0,0),p);break e}Yb(d,o,ds,Pd,um,r,Ts,Ua,Ll,Fr,g,null,-0,0)}}break}while(!0);Ni(s)}function Yb(s,r,o,d,p,g,_,T,$,ee,ae,pe,Z,ie){s.timeoutHandle=-1;var Te=r.subtreeFlags,Be=(g&335544064)===g;if(pe=null,(Be||Te&8192||(Te&16785408)===16785408)&&(pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},Cs=null,Pb(r,g,pe),Be&&(Te=pe,Be=s.containerInfo,Be=(Be.nodeType===9?Be:Be.ownerDocument).__reactViewTransition,Be!=null&&(Te.count++,Te.waitingForViewTransition=!0,Te=Cc.bind(Te),Be.finished.then(Te,Te))),Te=(g&62914560)===g?$d-sn():(g&4194048)===g?Hb-sn():0,Te=pE(pe,Te),Te!==null)){ji=g,s.cancelPendingCommit=Te(ty.bind(null,s,r,g,o,d,p,_,T,$,ee,ae,pe,null,Z,ie)),Hr(s,g,_,!ee);return}ty(s,r,g,o,d,p,_,T,$,ee,ae,pe)}function u3(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(!js(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 Hr(s,r,o,d){r=Pi(s,r),r&=~zd,r&=~Ua,s.suspendedLanes|=r,s.pingedLanes&=~r,d&&(s.warmLanes|=r),d=s.expirationTimes;for(var p=r;0<p;){var g=31-en(p),_=1<<g;d[g]=-1,p&=~_}o!==0&&xa(s,o,r)}function Ud(){return(Et&6)===0?(yc(0),!1):!0}function hm(){if(ct!==null){if(Mt===0)var s=ct.return;else s=ct,Xi=Ta=null,_p(s),jl=null,sc=0,s=ct;for(;s!==null;)gb(s.alternate,s),s=s.return;ct=null}}function Pl(s,r){var o=s.timeoutHandle;return o!==-1&&(s.timeoutHandle=-1,L3(o)),o=s.cancelPendingCommit,o!==null&&(s.cancelPendingCommit=null,o()),ji=0,hm(),$t=s,ct=o=Yi(s.current,null),ht=r,Mt=0,Es=null,Fr=!1,Ol=br(s,r),cm=!1,Ll=Ts=zd=Ua=Ur=cn=0,ds=vc=null,um=!1,tr=Pi(s,r),Xu(),o}function Qb(s,r){tt=null,Ce.H=yd,r===kl||r===ad?(r=t1(),Mt=3):r===op?(r=t1(),Mt=4):Mt=r===zp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Es=r,ct===null&&(cn=1,_d(s,$s(r,s.current)))}function Xb(){var s=Ln.current;return s===null?!0:(ht&4194048)===ht?Un===null:(ht&62914560)===ht||(ht&536870912)!==0?s===Un:!1}function Kb(){var s=Ce.H;return Ce.H=yd,s===null?yd:s}function Wb(){var s=Ce.A;return Ce.A=o3,s}function Id(){cn=4,Fr||(ht&4194048)!==ht&&Ln.current!==null||(Ol=!0),(Ur&134217727)===0&&(Ua&134217727)===0||$t===null||Hr($t,ht,Ts,!1)}function pm(s,r,o){var d=Et;Et|=2;var p=Kb(),g=Wb();($t!==s||ht!==r)&&(Pd=null,Pl(s,r)),r=!1;var _=cn;e:do try{if(Mt!==0&&ct!==null){var T=ct,$=Es;switch(Mt){case 8:hm(),_=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(r=!0);var ee=Mt;if(Mt=0,Es=null,Fl(s,T,$,ee),o&&Ol){_=0;break e}break;default:ee=Mt,Mt=0,Es=null,Fl(s,T,$,ee)}}d3(),_=cn;break}catch(ae){Qb(s,ae)}while(!0);return r&&s.shellSuspendCounter++,Xi=Ta=null,Et=d,Ce.H=p,Ce.A=g,ct===null&&($t=null,ht=0,Xu()),_}function d3(){for(;ct!==null;)Zb(ct)}function f3(s,r){var o=Et;Et|=2;var d=Kb(),p=Wb();$t!==s||ht!==r?(Pd=null,Bd=sn()+500,Pl(s,r)):Ol=br(s,r);e:do try{if(Mt!==0&&ct!==null){r=ct;var g=Es;t:switch(Mt){case 1:Mt=0,Es=null,Fl(s,r,g,1);break;case 2:case 9:if(Jv(g)){Mt=0,Es=null,Jb(r);break}r=function(){Mt!==2&&Mt!==9||$t!==s||(Mt=7),Ni(s)},g.then(r,r);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:Jv(g)?(Mt=0,Es=null,Jb(r)):(Mt=0,Es=null,Fl(s,r,g,7));break;case 5:var _=null;switch(ct.tag){case 26:_=ct.memoizedState;case 5:case 27:var T=ct;if(_?qy(_):T.stateNode.complete){Mt=0,Es=null;var $=T.sibling;if($!==null)ct=$;else{var ee=T.return;ee!==null?(ct=ee,Hd(ee)):ct=null}break t}}Mt=0,Es=null,Fl(s,r,g,5);break;case 6:Mt=0,Es=null,Fl(s,r,g,6);break;case 8:hm(),cn=6;break e;default:throw Error(i(462))}}h3();break}catch(ae){Qb(s,ae)}while(!0);return Xi=Ta=null,Ce.H=d,Ce.A=p,Et=o,ct!==null?0:($t=null,ht=0,Xu(),cn)}function h3(){for(;ct!==null&&!vs();)Zb(ct)}function Zb(s){var r=pb(s.alternate,s,tr);s.memoizedProps=s.pendingProps,r===null?Hd(s):ct=r}function Jb(s){var r=s,o=r.alternate;switch(r.tag){case 15:case 0:r=lb(o,r,r.pendingProps,r.type,void 0,ht);break;case 11:r=lb(o,r,r.pendingProps,r.type.render,r.ref,ht);break;case 5:_p(r);var d=r;d===En&&(lt?(td(d),d.tag===5&&d.stateNode!=null&&(Ht=d.stateNode)):(td(d),lt=!0));default:gb(o,r),r=ct=Iv(r,tr),r=pb(o,r,tr)}s.memoizedProps=s.pendingProps,r===null?Hd(s):ct=r}function Fl(s,r,o,d){Xi=Ta=null,_p(r),jl=null,sc=0;var p=r.return;try{if(e3(s,p,r,o,ht)){cn=1,_d(s,$s(o,s.current)),ct=null;return}}catch(g){if(p!==null)throw ct=p,g;cn=1,_d(s,$s(o,s.current)),ct=null;return}r.flags&32768?(lt||d===1?s=!0:Ol||(ht&536870912)!==0?s=!1:(Fr=s=!0,(d===2||d===9||d===3||d===6)&&(d=Ln.current,d!==null&&d.tag===13&&(d.flags|=16384))),ey(r,s)):Hd(r)}function Hd(s){var r=s;do{if((r.flags&32768)!==0){ey(r,Fr);return}s=r.return;var o=i3(r.alternate,r,tr);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 ey(s,r){do{var o=r3(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 ty(s,r,o,d,p,g,_,T,$,ee,ae,pe){s.cancelPendingCommit=null;do qd();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,ri=s,ji=o,fm=p,qb=d,p3(s,r,o,_,T,$,pe)}}function p3(s,r,o,d,p,g,_){var T=r.lanes|r.childLanes;if(dm=T,T|=Xh,ol(s,o,T,d,p,g),zl=null,(o&335544064)===o?($l=IC(s),d=10262):($l=null,d=10256),(r.subtreeFlags&d)!==0||(r.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,y3(xe,function(){return vm(),null})):(s.callbackNode=null,s.callbackPriority=0),Td=!1,d=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||d){d=Ce.T,Ce.T=null,p=Re.p,Re.p=2,g=Et,Et|=4;try{a3(s,r,o)}finally{Et=g,Re.p=p,Ce.T=d}}tn=1,Td?Dl=F3(_,s.containerInfo,$l,mm,gm,g3,xm,vm,m3):(mm(),gm(),xm())}function m3(s){if(tn!==0){var r=ri.onRecoverableError;r(s,{componentStack:null})}}function g3(){tn===3&&(tn=0,$b(Ia,ri),tn=4)}function mm(){if(tn===1){tn=0;var s=ri,r=Ia,o=ji,d=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||d){d=Ce.T,Ce.T=null;var p=Re.p;Re.p=2;var g=Et;Et|=4;try{mc=Rd=!1,Db(r,s,o),o=Mm;var _=Rv(s.containerInfo),T=o.focusedElem,$=o.selectionRange;if(_!==T&&T&&T.ownerDocument&&Av(T.ownerDocument.documentElement,T)){if($!==null&&qh(T)){var ee=$.start,ae=$.end;if(ae===void 0&&(ae=ee),"selectionStart"in T)T.selectionStart=ee,T.selectionEnd=Math.min(ae,T.value.length);else{var pe=T.ownerDocument||document,Z=pe&&pe.defaultView||window;if(Z.getSelection){var ie=Z.getSelection(),Te=T.textContent.length,Be=Math.min($.start,Te),nt=$.end===void 0?Be:Math.min($.end,Te);!ie.extend&&Be>nt&&(_=nt,nt=Be,Be=_);var J=Mv(T,Be),V=Mv(T,nt);if(J&&V&&(ie.rangeCount!==1||ie.anchorNode!==J.node||ie.anchorOffset!==J.offset||ie.focusNode!==V.node||ie.focusOffset!==V.offset)){var ne=pe.createRange();ne.setStart(J.node,J.offset),ie.removeAllRanges(),Be>nt?(ie.addRange(ne),ie.extend(V.node,V.offset)):(ne.setEnd(V.node,V.offset),ie.addRange(ne))}}}}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}}Ql=!!Tm,Mm=Tm=null}finally{Et=g,Re.p=p,Ce.T=d}}s.current=r,tn=2}}function gm(){if(tn===2){tn=0;var s=ri,r=Ia,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=Ce.T,Ce.T=null;var d=Re.p;Re.p=2;var p=Et;Et|=4;try{Tb(s,r.alternate,r)}finally{Et=p,Re.p=d,Ce.T=o}}tn=3}}function xm(){if(tn===4||tn===3){tn=0;var s=Dl;Dl=null,Fn();var r=ri,o=Ia,d=ji,p=qb,g=(d&335544064)===d?10262:10256;if((o.subtreeFlags&g)!==0||(o.flags&g)!==0?tn=5:(tn=0,Ia=ri=null,ny(r,r.pendingLanes)),g=r.pendingLanes,g===0&&(Ir=null),va(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=Ce.T,g=Re.p,Re.p=2,Ce.T=null;try{for(var _=r.onRecoverableError,T=0;T<p.length;T++){var $=p[T];_($.value,{componentStack:$.stack})}}finally{Ce.T=o,Re.p=g}}if(p=zl,_=$l,$l=null,p!==null&&(zl=null,_===null&&(_=[]),s!==null))for($=0;$<p.length;$++)o=(0,p[$])(_),o!==void 0&&s.finished.finally(o);(ji&3)!==0&&qd(),Ni(r),g=r.pendingLanes,(d&261930)!==0&&(g&42)!==0?r===Fd?bc++:(bc=0,Fd=r):(bc=0,Fd=null),yc(0)}}function ny(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,ec(r)))}function qd(){return Dl!==null&&(Dl.skipTransition(),Dl=null),mm(),gm(),xm(),vm()}function vm(){if(tn!==5)return!1;var s=ri,r=dm;dm=0;var o=va(ji),d=Ce.T,p=Re.p;try{Re.p=32>o?32:o,Ce.T=null,o=fm,fm=null;var g=ri,_=ji;if(tn=0,Ia=ri=null,ji=0,(Et&6)!==0)throw Error(i(331));var T=Et;if(Et|=4,Ub(g.current),Bb(g,g.current,_,o),Et=T,yc(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Nn,g)}catch{}return!0}finally{Re.p=p,Ce.T=d,ny(s,r)}}function sy(s,r,o){r=$s(o,r),r=Dp(s.stateNode,r,2),s=Lr(s,r,2),s!==null&&(hi(s,2),Ni(s))}function At(s,r,o){if(s.tag===3)sy(s,s,o);else for(;r!==null;){if(r.tag===3){sy(r,s,o);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ir===null||!Ir.has(d))){s=$s(o,s),o=J1(2),d=Lr(r,o,2),d!==null&&(eb(o,d,r,s),hi(d,2),Ni(d));break}}r=r.return}}function bm(s,r,o){var d=s.pingCache;if(d===null){d=s.pingCache=new c3;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)||(cm=!0,p.add(o),s=x3.bind(null,s,r,o),r.then(s,s))}function x3(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()-$d)&&(Et&2)===0?Pl(s,0):zd|=o,Ll===ht&&(Ll=0)),Ni(s)}function iy(s,r){r===0&&(r=Bu()),s=Na(s,r),s!==null&&(hi(s,r),Ni(s))}function v3(s){var r=s.memoizedState,o=0;r!==null&&(o=r.retryLane),iy(s,o)}function b3(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),iy(s,o)}function y3(s,r){return is(s,r)}var Ul=null,Il=null,ym=!1,Vd=!1,_m=!1,qr=0;function Ni(s){s!==Il&&s.next===null&&(Il===null?Ul=Il=s:Il=Il.next=s),Vd=!0,ym||(ym=!0,w3())}function yc(s,r){if(!_m&&Vd){_m=!0;do for(var o=!1,d=Ul;d!==null;){if(s!==0){var p=d.pendingLanes;if(p===0)var g=0;else{var _=d.suspendedLanes,T=d.pingedLanes;g=(1<<31-en(42|s)+1)-1,g&=p&~(_&~T),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,oy(d,g))}else g=ht,g=Ks(d,d===$t?g:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(g&3)===0||br(d,g)||(o=!0,oy(d,g));d=d.next}while(o);_m=!1}}function _3(){ry()}function ry(){Vd=ym=!1;var s=0;qr!==0&&O3()&&(s=qr);for(var r=sn(),o=null,d=Ul;d!==null;){var p=d.next,g=ay(d,r);g===0?(d.next=null,o===null?Ul=p:o.next=p,p===null&&(Il=o)):(o=d,(s!==0||(g&3)!==0)&&(Vd=!0)),d=p}tn!==0&&tn!==5||yc(s),qr!==0&&(qr=0)}function ay(s,r){for(var o=s.suspendedLanes,d=s.pingedLanes,p=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var _=31-en(g),T=1<<_,$=p[_];$===-1?((T&o)===0||(T&d)!==0)&&(p[_]=Ah(T,r)):$<=r&&(s.expiredLanes|=T),g&=~T}if(r=$t,o=ht,o=Ks(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||br(s,o)){if(r=o&-o,r===s.callbackPriority)return r;switch(d!==null&&Ct(d),va(o)){case 2:case 8:o=le;break;case 32:o=xe;break;case 268435456:o=rt;break;default:o=xe}return d=ly.bind(null,s),o=is(o,d),s.callbackPriority=r,s.callbackNode=o,r}return d!==null&&d!==null&&Ct(d),s.callbackPriority=2,s.callbackNode=null,2}function ly(s,r){if(tn!==0&&tn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var o=s.callbackNode;if(qd()&&s.callbackNode!==o)return null;var d=ht;return d=Ks(s,s===$t?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(Gb(s,d,r),ay(s,sn()),s.callbackNode!=null&&s.callbackNode===o?ly.bind(null,s):null)}function oy(s,r){if(qd())return null;Gb(s,r,!0)}function w3(){D3(function(){(Et&6)!==0?is(Bi,_3):ry()})}function wm(){if(qr===0){var s=Ra;s===0&&(s=vr,vr<<=1,(vr&261888)===0&&(vr=256)),qr=s}return qr}function cy(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Rn(s)}function S3(s,r,o,d,p){if(r==="submit"&&o&&o.stateNode===p){var g=cy((p[Cn]||null).action),_=d.submitter;_&&(r=(r=_[Cn]||null)?cy(r.formAction):_.getAttribute("formAction"),r!==null&&(g=r,_=null));var T=new Vu("action","action",null,d,p);s.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(qr!==0){var $=new FormData(p,_);Mp(o,{pending:!0,data:$,method:p.method,action:g},null,$)}}else typeof g=="function"&&(T.preventDefault(),$=new FormData(p,_),Mp(o,{pending:!0,data:$,method:p.method,action:g},g,$))},currentTarget:p}]})}}for(var Sm=0;Sm<Qh.length;Sm++){var km=Qh[Sm],k3=km.toLowerCase(),j3=km[0].toUpperCase()+km.slice(1);ti(k3,"on"+j3)}ti(Dv,"onAnimationEnd"),ti(zv,"onAnimationIteration"),ti($v,"onAnimationStart"),ti("dblclick","onDoubleClick"),ti("focusin","onFocus"),ti("focusout","onBlur"),ti(LC,"onTransitionRun"),ti(DC,"onTransitionStart"),ti(zC,"onTransitionCancel"),ti(Bv,"onTransitionEnd"),Hi("onMouseEnter",["mouseout","mouseover"]),Hi("onMouseLeave",["mouseout","mouseover"]),Hi("onPointerEnter",["pointerout","pointerover"]),Hi("onPointerLeave",["pointerout","pointerover"]),Ii("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ii("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ii("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ii("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ii("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ii("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _c="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(" "),N3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_c));function uy(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 _=d.length-1;0<=_;_--){var T=d[_],$=T.instance,ee=T.currentTarget;if(T=T.listener,$!==g&&p.isPropagationStopped())break e;g=T,p.currentTarget=ee;try{g(p)}catch(ae){Qu(ae)}p.currentTarget=null,g=$}else for(_=0;_<d.length;_++){if(T=d[_],$=T.instance,ee=T.currentTarget,T=T.listener,$!==g&&p.isPropagationStopped())break e;g=T,p.currentTarget=ee;try{g(p)}catch(ae){Qu(ae)}p.currentTarget=null,g=$}}}}function ut(s,r){var o=r[Lo];o===void 0&&(o=r[Lo]=new Set);var d=s+"__bubble";o.has(d)||(dy(r,s,2,!1),o.add(d))}function jm(s,r,o){var d=0;r&&(d|=4),dy(o,s,d,r)}var Gd="_reactListening"+Math.random().toString(36).slice(2);function Nm(s){if(!s[Gd]){s[Gd]=!0,Ws.forEach(function(o){o!=="selectionchange"&&(N3.has(o)||jm(o,!1,s),jm(o,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Gd]||(r[Gd]=!0,jm("selectionchange",!1,r))}}function dy(s,r,o,d){switch(e_(r)){case 2:var p=vE;break;case 8:p=bE;break;default:p=Gm}o=p.bind(null,r,o,s),p=void 0,!Ho||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 Cm(s,r,o,d,p){var g=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var _=d.tag;if(_===3||_===4){var T=d.stateNode.containerInfo;if(T===p)break;if(_===4)for(_=d.return;_!==null;){var $=_.tag;if(($===3||$===4)&&_.stateNode.containerInfo===p)return;_=_.return}for(;T!==null;){if(_=Ui(T),_===null)return;if($=_.tag,$===5||$===6||$===26||$===27){d=g=_;continue e}T=T.parentNode}}d=d.return}Ss(function(){var ee=g,ae=pl(o),pe=[];e:{var Z=Pv.get(s);if(Z!==void 0){var ie=Vu,Te=s;switch(s){case"keypress":if(ks(o)===0)break e;case"keydown":case"keyup":ie=uC;break;case"focusin":Te="focus",ie=Bh;break;case"focusout":Te="blur",ie=Bh;break;case"beforeblur":case"afterblur":ie=Bh;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=pv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=ZN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=mC;break;case Dv:case zv:case $v:ie=tC;break;case Bv:ie=xC;break;case"scroll":case"scrollend":ie=KN;break;case"wheel":ie=bC;break;case"copy":case"cut":case"paste":ie=sC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=gv;break;case"submit":ie=hC;break;case"toggle":case"beforetoggle":ie=_C}var Be=(r&4)!==0,nt=!Be&&(s==="scroll"||s==="scrollend"),J=Be?Z!==null?Z+"Capture":null:Z;Be=[];for(var V=ee,ne;V!==null;){var he=V;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||J===null||(he=jr(V,J),he!=null&&Be.push(wc(V,he,ne))),nt)break;V=V.return}0<Be.length&&(Z=new ie(Z,Te,null,o,ae),pe.push({event:Z,listeners:Be}))}}if((r&7)===0){e:{if(ie=s==="mouseover"||s==="pointerover",Z=s==="mouseout"||s==="pointerout",ie&&o!==Sr&&(Te=o.relatedTarget||o.fromElement)&&(Ui(Te)||Te[mi]))break e;(Z||ie)&&(Te=ae.window===ae?ae:(ie=ae.ownerDocument)?ie.defaultView||ie.parentWindow:window,Z?(ie=o.relatedTarget||o.toElement,Z=ee,ie=ie?Ui(ie):null,ie!==null&&(nt=c(ie),Be=ie.tag,ie!==nt||Be!==5&&Be!==27&&Be!==6)&&(ie=null)):(Z=null,ie=ee),Z!==ie&&(Be=pv,he="onMouseLeave",J="onMouseEnter",V="mouse",(s==="pointerout"||s==="pointerover")&&(Be=gv,he="onPointerLeave",J="onPointerEnter",V="pointer"),nt=Z==null?Te:yr(Z),ne=ie==null?Te:yr(ie),Te=new Be(he,V+"leave",Z,o,ae),Te.target=nt,Te.relatedTarget=ne,he=null,Ui(ae)===ee&&(Be=new Be(J,V+"enter",ie,o,ae),Be.target=ne,Be.relatedTarget=nt,he=Be),nt=he,Be=Z&&ie?R(Z,ie,C3):null,Z!==null&&fy(pe,Te,Z,Be,!1),ie!==null&&nt!==null&&fy(pe,nt,ie,Be,!0)))}e:{if(Z=ee?yr(ee):window,ie=Z.nodeName&&Z.nodeName.toLowerCase(),ie==="select"||ie==="input"&&Z.type==="file")var Oe=kv;else if(wv(Z))if(jv)Oe=AC;else{Oe=TC;var pt=EC}else ie=Z.nodeName,!ie||ie.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?ee&&mt(ee.elementType)&&(Oe=kv):Oe=MC;if(Oe&&(Oe=Oe(s,ee))){Sv(pe,Oe,o,ae);break e}pt&&pt(s,Z,ee)}switch(pt=ee?yr(ee):window,s){case"focusin":(wv(pt)||pt.contentEditable==="true")&&(gl=pt,Vh=ee,Wo=null);break;case"focusout":Wo=Vh=gl=null;break;case"mousedown":Gh=!0;break;case"contextmenu":case"mouseup":case"dragend":Gh=!1,Ov(pe,o,ae);break;case"selectionchange":if(OC)break;case"keydown":case"keyup":Ov(pe,o,ae)}var Ue;if(Fh)e:{switch(s){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else ml?yv(s,o)&&(Ye="onCompositionEnd"):s==="keydown"&&o.keyCode===229&&(Ye="onCompositionStart");Ye&&(xv&&o.locale!=="ko"&&(ml||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&ml&&(Ue=qo()):(ei=ae,Hu="value"in ei?ei.value:ei.textContent,ml=!0)),pt=Yd(ee,Ye),0<pt.length&&(Ye=new mv(Ye,s,null,o,ae),pe.push({event:Ye,listeners:pt}),Ue?Ye.data=Ue:(Ue=_v(o),Ue!==null&&(Ye.data=Ue)))),(Ue=SC?kC(s,o):jC(s,o))&&(Ye=Yd(ee,"onBeforeInput"),0<Ye.length&&(pt=new mv("onBeforeInput","beforeinput",null,o,ae),pe.push({event:pt,listeners:Ye}),pt.data=Ue)),S3(pe,s,ee,o,ae)}uy(pe,r)})}function wc(s,r,o){return{instance:s,listener:r,currentTarget:o}}function Yd(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=jr(s,o),p!=null&&d.unshift(wc(s,p,g)),p=jr(s,r),p!=null&&d.push(wc(s,p,g))),s.tag===3)return d;s=s.return}return[]}function C3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function fy(s,r,o,d,p){for(var g=r._reactName,_=[];o!==null&&o!==d;){var T=o,$=T.alternate,ee=T.stateNode;if(T=T.tag,$!==null&&$===d)break;T!==5&&T!==26&&T!==27||ee===null||($=ee,p?(ee=jr(o,g),ee!=null&&_.unshift(wc(o,ee,$))):p||(ee=jr(o,g),ee!=null&&_.push(wc(o,ee,$)))),o=o.return}_.length!==0&&s.push({event:r,listeners:_})}var E3=/\r\n?/g,T3=/\u0000|\uFFFD/g;function hy(s){return(typeof s=="string"?s:""+s).replace(E3,`
|
|
50
|
-
`).replace(T3,"")}function py(s,r){return r=hy(r),hy(s)===r}function Rt(s,r,o,d,p,g){switch(o){case"children":if(typeof d=="string")r==="body"||r==="textarea"&&d===""||qi(s,d);else if(typeof d=="number"||typeof d=="bigint")r!=="body"&&qi(s,""+d);else return;break;case"className":_a(s,"class",d);break;case"tabIndex":_a(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":_a(s,o,d);break;case"style":it(s,d,g);return;case"data":if(r!=="object"){_a(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":Ds(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ds(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ds(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ds(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ds(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ds(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ds(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 Em(s,r,o,d,p,g){switch(o){case"style":it(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")qi(s,d);else if(typeof d=="number"||typeof d=="bigint")qi(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 _=o[g];if(_!=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,_,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=_=p=null,$=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var ae=o[d];if(ae!=null)switch(d){case"name":p=ae;break;case"type":_=ae;break;case"checked":$=ae;break;case"defaultChecked":ee=ae;break;case"value":g=ae;break;case"defaultValue":T=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,r));break;default:Rt(s,r,d,ae,o,null)}}Iu(s,g,T,$,ee,_,p,!1);return;case"select":ut("invalid",s),d=_=g=null;for(p in o)if(o.hasOwnProperty(p)&&(T=o[p],T!=null))switch(p){case"value":g=T;break;case"defaultValue":_=T;break;case"multiple":d=T;default:Rt(s,r,p,T,o,null)}r=g,o=_,s.multiple=!!d,r!=null?wr(s,!!d,r,!1):o!=null&&wr(s,!!d,o,!0);return;case"textarea":ut("invalid",s),g=p=d=null;for(_ in o)if(o.hasOwnProperty(_)&&(T=o[_],T!=null))switch(_){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,_,T,o,null)}Uo(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<_c.length;d++)ut(_c[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(ee in o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,ee,d,o,null)}return;default:if(mt(r)){for(ae in o)o.hasOwnProperty(ae)&&(d=o[ae],d!==void 0&&Em(s,r,ae,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 M3={};function A3(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,_=null,T=null,$=null,ee=null,ae=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 Z in d){var ie=d[Z];if(pe=o[Z],d.hasOwnProperty(Z)&&(ie!=null||pe!=null))switch(Z){case"type":ie!==pe&&(vt=!0),g=ie;break;case"name":ie!==pe&&(vt=!0),p=ie;break;case"checked":ie!==pe&&(vt=!0),ee=ie;break;case"defaultChecked":ie!==pe&&(vt=!0),ae=ie;break;case"value":ie!==pe&&(vt=!0),_=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,Z,ie,d,pe)}}Bo(s,_,T,$,ee,ae,g,p);return;case"select":ie=_=T=Z=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),Z=g;break;case"defaultValue":g!==$&&(vt=!0),T=g;break;case"multiple":g!==$&&(vt=!0),_=g;default:g!==$&&Rt(s,r,p,g,d,$)}r=T,o=_,d=ie,Z!=null?wr(s,!!o,Z,!1):!!d!=!!o&&(r!=null?wr(s,!!o,r,!0):wr(s,!!o,o?[]:"",!1));return;case"textarea":ie=Z=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(_ in d)if(p=d[_],g=o[_],d.hasOwnProperty(_)&&(p!=null||g!=null))switch(_){case"value":p!==g&&(vt=!0),Z=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,_,p,d,g)}Fo(s,Z,ie);return;case"option":for(var Te in o)if(Z=o[Te],o.hasOwnProperty(Te)&&Z!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":s.selected=!1;break;default:Rt(s,r,Te,null,d,Z)}for($ in d)if(Z=d[$],ie=o[$],d.hasOwnProperty($)&&Z!==ie&&(Z!=null||ie!=null))switch($){case"selected":Z!==ie&&(vt=!0),s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:Rt(s,r,$,Z,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)Z=o[Be],o.hasOwnProperty(Be)&&Z!=null&&!d.hasOwnProperty(Be)&&Rt(s,r,Be,null,d,Z);for(ee in d)if(Z=d[ee],ie=o[ee],d.hasOwnProperty(ee)&&Z!==ie&&(Z!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:Rt(s,r,ee,Z,d,ie)}return;default:if(mt(r)){for(var nt in o)Z=o[nt],o.hasOwnProperty(nt)&&Z!==void 0&&!d.hasOwnProperty(nt)&&Em(s,r,nt,void 0,d,Z);for(ae in d)Z=d[ae],ie=o[ae],!d.hasOwnProperty(ae)||Z===ie||Z===void 0&&ie===void 0||Em(s,r,ae,Z,d,ie);return}}for(var J in o)Z=o[J],o.hasOwnProperty(J)&&Z!=null&&!d.hasOwnProperty(J)&&Rt(s,r,J,null,d,Z);for(pe in d)Z=d[pe],ie=o[pe],!d.hasOwnProperty(pe)||Z===ie||Z==null&&ie==null||Rt(s,r,pe,Z,d,ie)}function my(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function R3(){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,_=p.initiatorType,T=p.duration;if(g&&T&&my(_)){for(_=0,T=p.responseEnd,d+=1;d<o.length;d++){var $=o[d],ee=$.startTime;if(ee>T)break;var ae=$.transferSize,pe=$.initiatorType;ae&&my(pe)&&($=$.responseEnd,_+=ae*($<T?1:(T-ee)/($-ee)))}if(--d,r+=8*(g+_)/(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 Tm=null,Mm=null;function Sc(s){return s.nodeType===9?s:s.ownerDocument}function gy(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 xy(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 vy(s,r,o,d){return o=Sc(o).createElement(s),o[dn]=d,o[Cn]=r,$n(o,s,r),ln(o),o}function Am(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 Rm=null;function O3(){var s=window.event;return s&&s.type==="popstate"?s===Rm?!1:(Rm=s,!0):(Rm=null,!1)}var Om=typeof setTimeout=="function"?setTimeout:void 0,L3=typeof clearTimeout=="function"?clearTimeout:void 0,by=typeof Promise=="function"?Promise:void 0,yy=typeof requestAnimationFrame=="function"?requestAnimationFrame:Om,D3=typeof queueMicrotask=="function"?queueMicrotask:typeof by<"u"?function(s){return by.resolve(null).then(s).catch(z3)}:Om;function z3(s){setTimeout(function(){throw s})}function Vr(s){return s==="head"}function _y(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),Xl(r);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Um(s.ownerDocument.documentElement);else if(o==="head"){o=s.ownerDocument.head,Um(o);for(var g=o.firstChild;g;){var _=g.nextSibling,T=g.nodeName;g[ya]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=_}}else o==="body"&&Um(s.ownerDocument.body);o=p}while(o);Xl(r)}function wy(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 Sy(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 ky(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 $3(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 Lm(s){var r=s.getBoundingClientRect(),o=getComputedStyle(s);return $3(r,o,s)}function B3(s){return s.documentElement.clientHeight}function P3(s){this.addEventListener("load",s),this.addEventListener("error",s)}function F3(s,r,o,d,p,g,_,T,$){var ee=r.nodeType===9?r:r.ownerDocument;try{var ae=ee.startViewTransition({update:function(){var Z=ee.defaultView,ie=Z.navigation&&Z.navigation.transition,Te=ee.fonts.status;d();var Be=[];if(Te==="loaded"&&(B3(ee),ee.fonts.status==="loading"&&Be.push(ee.fonts.ready)),Te=Be.length,s!==null)for(var nt=s.suspenseyImages,J=0,V=0;V<nt.length;V++){var ne=nt[V];if(!ne.complete){var he=ne.getBoundingClientRect();if(0<he.bottom&&0<he.right&&he.top<Z.innerHeight&&he.left<Z.innerWidth){if(J+=Vy(ne),J>Kd){Be.length=Te;break}ne=new Promise(P3.bind(ne)),Be.push(ne)}}}if(0<Be.length)return Z=Promise.race([Promise.all(Be),new Promise(function(Oe){return setTimeout(Oe,500)})]).then(p,p),(ie?Promise.allSettled([ie.finished,Z]):Z).then(g,g);if(p(),ie)return ie.finished.then(g,g);g()},types:o});ee.__reactViewTransition=ae;var pe=[];return ae.ready.then(function(){for(var Z=ee.documentElement.getAnimations({subtree:!0}),ie=0;ie<Z.length;ie++){var Te=Z[ie],Be=Te.effect,nt=Be.pseudoElement;if(nt!=null&&nt.startsWith("::view-transition")){pe.push(Te),Te=Be.getKeyframes();for(var J=nt=void 0,V=!0,ne=0;ne<Te.length;ne++){var he=Te[ne],Oe=he.width;if(nt===void 0)nt=Oe;else if(nt!==Oe){V=!1;break}if(Oe=he.height,J===void 0)J=Oe;else if(J!==Oe){V=!1;break}delete he.width,delete he.height,he.transform==="none"&&delete he.transform}V&&nt!==void 0&&J!==void 0&&(Be.setKeyframes(Te),V=getComputedStyle(Be.target,Be.pseudoElement),V.width!==nt||V.height!==J)&&(V=Te[0],V.width=nt,V.height=J,V=Te[Te.length-1],V.width=nt,V.height=J,Be.setKeyframes(Te))}}_()},function(Z){ee.__reactViewTransition===ae&&(ee.__reactViewTransition=null);try{if(typeof Z=="object"&&Z!==null)switch(Z.name){case"InvalidStateError":(Z.message==="View transition was skipped because document visibility state is hidden."||Z.message==="Skipping view transition because document visibility state has become hidden."||Z.message==="Skipping view transition because viewport size changed."||Z.message==="Transition was aborted because of invalid state")&&(Z=null)}Z!==null&&$(Z)}finally{d(),p(),_()}}),ae.finished.finally(function(){for(var Z=0;Z<pe.length;Z++)pe[Z].cancel();ee.__reactViewTransition===ae&&(ee.__reactViewTransition=null),T()}),ae}catch{return d(),p(),_(),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}:U({},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 jy(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 As(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}As.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(Cy(g,s,r,o)===-1){var _=this,T=r;o!=null&&typeof o!="boolean"&&o.once===!0&&(T=function($){_.removeEventListener(s,r,o),typeof r=="function"?r.call(this,$):r.handleEvent($)}),d!==null&&(p=_.removeEventListener.bind(_,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}),v(this._fragmentFiber.child,!1,U3,s,T,d)}this._eventListeners=g}};function U3(s,r,o,d){return N(s).addEventListener(r,o,d),!1}As.prototype.removeEventListener=function(s,r,o){var d=this._eventListeners;if(d!==null&&(r=Cy(d,s,r,o),r!==-1)){var p=d[r];o=p.attachedListener;var g=p.cleanup;p=Hl(p.optionsOrUseCapture),v(this._fragmentFiber.child,!1,I3,s,o,p),d.splice(r,1),g!==null&&g()}};function I3(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 Ny(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function Cy(s,r,o,d){if(s.length===0)return-1;d=Ny(d);for(var p=0;p<s.length;p++){var g=s[p];if(g.type===r&&g.listener===o&&Ny(g.optionsOrUseCapture)===d)return p}return-1}As.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)},As.prototype.focus=function(s){v(this._fragmentFiber.child,!0,Ey,s,void 0,void 0)};function Ey(s,r){return s.tag===6?!1:(s=N(s),eE(s,r))}As.prototype.focusLast=function(s){var r=[];v(this._fragmentFiber.child,!0,Dm,r,void 0,void 0);for(var o=r.length-1;0<=o&&!Ey(r[o],s);o--);};function Dm(s,r){return r.push(s),!1}As.prototype.blur=function(){var s=b(this._fragmentFiber);s!==null&&(s=N(s),s=Sc(s).activeElement,s!==null&&v(this._fragmentFiber.child,!1,H3,s,void 0,void 0))};function H3(s,r){return s.tag===6?!1:(s=N(s),s===r||s.contains(r)?(r.blur(),!0):!1)}As.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),v(this._fragmentFiber.child,!1,q3,s,void 0,void 0)};function q3(s,r){return s.tag===6||(s=N(s),r.observe(s)),!1}As.prototype.unobserveUsing=function(s){var r=this._observers;if(r!==null&&r.has(s)){r.delete(s),v(this._fragmentFiber.child,!1,V3,s,void 0,void 0);for(var o=r=0;o<ai.length;o++){var d=ai[o];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):ai[r++]=d}ai.length=r}};function V3(s,r){return s.tag===6||(s=N(s),r.unobserve(s)),!1}var ai=[],zm=!1;function G3(s,r,o){ai.push({fragmentInstance:s,observer:r,instance:o}),zm||(zm=!0,tE(function(){zm=!1;var d=ai;ai=[];for(var p=0;p<d.length;p++){var g=d[p];g.observer.unobserve(g.instance)}}))}As.prototype.getClientRects=function(){var s=[];return v(this._fragmentFiber.child,!1,Y3,s,void 0,void 0),s};function Y3(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}As.prototype.getRootNode=function(s){var r=b(this._fragmentFiber);return r===null?this:N(r).getRootNode(s)},As.prototype.compareDocumentPosition=function(s){var r=b(this._fragmentFiber);if(r===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var o=[];v(this._fragmentFiber.child,!1,Dm,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=w(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 _=r.compareDocumentPosition(s),T=p.compareDocumentPosition(s),$=_&Node.DOCUMENT_POSITION_CONTAINED_BY||T&Node.DOCUMENT_POSITION_CONTAINED_BY;return T=d&&g&&_&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:_,r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Q3(r,this._fragmentFiber,o[0],o[o.length-1],s)?r:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Q3(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:(v(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:(v(r,!0,L,g,d),g=S,C=S=null,r=g!==null)),r):!1}function Ty(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)}As.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(i(566));var r=[];v(this._fragmentFiber.child,!1,Dm,r,void 0,void 0);var o=s!==!1;if(r.length===0){var d=w(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),Ty(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),Ty(p,o)):N(p).scrollIntoView(s),d+=o?-1:1}};function X3(s,r){return s=N(s),My(s,r),!1}function My(s,r){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(r)}function Ay(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 _=0,T=0;T<ai.length;T++){var $=ai[T];($.fragmentInstance!==r||$.observer!==g||$.instance!==s)&&(ai[_++]=$)}ai.length=_,g.observe(s)}),My(s,r))}function K3(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"?G3(r,g,s):g.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(r))}function $m(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":$m(o),ul(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}s.removeChild(o)}}function W3(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[ya])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=Is(s.nextSibling),s===null)break}return null}function Z3(s,r,o){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=Is(s.nextSibling),s===null))return null;return s}function Ry(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Is(s.nextSibling),s===null))return null;return s}function Bm(s){return s.data==="$?"||s.data==="$~"}function Pm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function J3(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 Is(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 Fm=null;function Oy(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="/$"||o==="/&"){if(r===0)return Is(s.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}s=s.nextSibling}return null}function Ly(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 eE(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 tE(s){yy(function(){yy(function(r){return s(r)})})}function Dy(s,r,o){switch(r=Sc(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 zy(s,r,o){for(var d in o){var p=o[d];o.hasOwnProperty(d)&&p!=null&&Rt(s,r,d,null,M3,p)}o.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===Qn&&(s.onclick=null),ul(s)}function Um(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);ul(s)}var Hs=new Map,$y=new Set;function kc(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 nr=Re.d;Re.d={f:nE,r:sE,D:iE,C:rE,L:aE,m:lE,X:cE,S:oE,M:uE};function nE(){var s=nr.f(),r=Ud();return s||r}function sE(s){var r=gi(s);r!==null&&r.tag===5&&r.type==="form"?P1(r):nr.r(s)}var ql=typeof document>"u"?null:document;function By(s,r,o){var d=ql;if(d&&typeof r=="string"&&r){var p=ls(r);p='link[rel="'+s+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),$y.has(p)||($y.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 iE(s){nr.D(s),By("dns-prefetch",s,null)}function rE(s,r){nr.C(s,r),By("preconnect",s,r)}function aE(s,r,o){nr.L(s,r,o);var d=ql;if(d&&s&&r){var p='link[rel="preload"][as="'+ls(r)+'"]';r==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+ls(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+ls(o.imageSizes)+'"]')):p+='[href="'+ls(s)+'"]';var g=p;switch(r){case"style":g=Vl(s);break;case"script":g=Gl(s)}if(!(Hs.has(g)||(s=U({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:s,as:r},o),Hs.set(g,s),d.querySelector(p)!==null||r==="style"&&d.querySelector(jc(g))||r==="script"&&d.querySelector(Nc(g))))){var _=d.createElement("link");$n(_,"link",s),r==="style"&&(_[cl]=!0,_.onload=_.onerror=function(){_s(_)}),ln(_),d.head.appendChild(_)}}}function lE(s,r){nr.m(s,r);var o=ql;if(o&&s){var d=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+ls(d)+'"][href="'+ls(s)+'"]',g=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Gl(s)}if(!Hs.has(g)&&(s=U({rel:"modulepreload",href:s},r),Hs.set(g,s),o.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Nc(g)))return}d=o.createElement("link"),$n(d,"link",s),ln(d),o.head.appendChild(d)}}}function oE(s,r,o){nr.S(s,r,o);var d=ql;if(d&&s){var p=as(d).hoistableStyles,g=Vl(s);r=r||"default";var _=p.get(g);if(!_){var T={loading:0,preload:null};if(_=d.querySelector(jc(g)))T.loading=5;else{s=U({rel:"stylesheet",href:s,"data-precedence":r},o),(o=Hs.get(g))&&Im(s,o);var $=_=d.createElement("link");ln($),$n($,"link",s),$._p=new Promise(function(ee,ae){$.onload=ee,$.onerror=ae}),$.addEventListener("load",function(){T.loading|=1}),$.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Qd(_,r,d)}_={type:"stylesheet",instance:_,count:1,state:T},p.set(g,_)}}}function cE(s,r){nr.X(s,r);var o=ql;if(o&&s){var d=as(o).hoistableScripts,p=Gl(s),g=d.get(p);g||(g=o.querySelector(Nc(p)),g||(s=U({src:s,async:!0},r),(r=Hs.get(p))&&Hm(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 uE(s,r){nr.M(s,r);var o=ql;if(o&&s){var d=as(o).hoistableScripts,p=Gl(s),g=d.get(p);g||(g=o.querySelector(Nc(p)),g||(s=U({src:s,async:!0,type:"module"},r),(r=Hs.get(p))&&Hm(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 Py(s,r,o,d){var p=(p=se.current)?kc(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=as(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=as(p).hoistableStyles,_=g.get(s);if(_||(p=p.ownerDocument||p,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,_),(g=p.querySelector(jc(s)))?g._p||(_.instance=g,_.state.loading=5):(g=Hs.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},Hs.set(s,g)),dE(p,s,g,_.state))),r&&d===null)throw Error(i(528,""));return _}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=as(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="'+ls(s)+'"'}function jc(s){return'link[rel="stylesheet"]['+s+"]"}function Fy(s){return U({},s,{"data-precedence":s.precedence,precedence:null})}function dE(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=_s.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="'+ls(s)+'"]'}function Nc(s){return"script[async]"+s}function Uy(s,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+ls(o.href)+'"]');if(d)return r.instance=d,ln(d),d;var p=U({},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(jc(p));if(g)return r.state.loading|=4,r.instance=g,ln(g),g;d=Fy(o),(p=Hs.get(p))&&Im(d,p),g=(s.ownerDocument||s).createElement("link"),ln(g);var _=g;return _._p=new Promise(function(T,$){_.onload=T,_.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(Nc(g)))?(r.instance=p,ln(p),p):(d=o,(p=Hs.get(g))&&(d=U({},o),Hm(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,_=0;_<d.length;_++){var T=d[_];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 Im(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Hm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Xd=null;function Iy(s,r,o){if(Xd===null){var d=new Map,p=Xd=new Map;p.set(o,d)}else p=Xd,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[ya]||g[dn]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var _=g.getAttribute(r)||"";_=s+_;var T=d.get(_);T?T.push(g):d.set(_,[g])}}return d}function qm(s,r,o){s=s.ownerDocument||s,s.head.insertBefore(o,r==="title"?s.querySelector("head > title"):null)}function fE(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 Hy(s,r){return s==="img"&&r.src!=null&&r.src!==""&&r.onLoad==null&&r.loading!=="lazy"}function qy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Vy(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Gy(s,r){typeof r.decode=="function"&&(s.imgCount++,r.complete||(s.imgBytes+=Vy(r),s.suspenseyImages.push(r)),s=mE.bind(s),r.decode().then(s,s))}function hE(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(jc(p));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Cc.bind(s),r.then(s,s)),o.state.loading|=4,o.instance=g,ln(g);return}g=r.ownerDocument||r,d=Fy(d),(p=Hs.get(p))&&Im(d,p),g=g.createElement("link"),ln(g);var _=g;_._p=new Promise(function(T,$){_.onload=T,_.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=Cc.bind(s),r.addEventListener("load",o),r.addEventListener("error",o))}}var Kd=0;function pE(s,r){return s.stylesheets&&s.count===0&&Zd(s,s.stylesheets),0<s.count||0<s.imgCount?function(o){var d=setTimeout(function(){if(s.stylesheets&&Zd(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+r);0<s.imgBytes&&Kd===0&&(Kd=62500*R3());var p=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Zd(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>Kd?50:800)+r);return s.unsuspend=o,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(p)}}:null}function Yy(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)Zd(s,s.stylesheets);else if(s.unsuspend){var r=s.unsuspend;s.unsuspend=null,r()}}}function Cc(){this.count--,Yy(this)}function mE(){this.imgCount--,Yy(this)}var Wd=null;function Zd(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Wd=new Map,r.forEach(gE,s),Wd=null,Cc.call(s))}function gE(s,r){if(!(r.state.loading&4)){var o=Wd.get(s);if(o)var d=o.get(null);else{o=new Map,Wd.set(s,o);for(var p=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<p.length;g++){var _=p[g];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(o.set(_.dataset.precedence,_),d=_)}d&&o.set(null,d)}p=r.instance,_=p.getAttribute("data-precedence"),g=o.get(_)||d,g===d&&o.set(null,p),o.set(_,p),this.count++,d=Cc.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:q,Provider:null,Consumer:null,_currentValue:Ft,_currentValue2:Ft,_threadCount:0};function xE(s,r,o,d,p,g,_,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=Fi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fi(0),this.hiddenUpdates=Fi(null),this.identifierPrefix=d,this.onUncaughtError=p,this.onCaughtError=g,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.transitionTypes=null,this.incompleteTransitions=new Map}function Qy(s,r,o,d,p,g,_,T,$,ee,ae,pe){return s=new xE(s,r,o,_,$,ee,ae,pe,T),r=1,g===!0&&(r|=24),g=os(3,null,null,r),s.current=g,g.stateNode=s,r=rp(),r.refCount++,s.pooledCache=r,r.refCount++,g.memoizedState={element:d,isDehydrated:o,cache:r},cp(g),s}function Xy(s){return s?(s=bl,s):bl}function Ky(s,r,o,d,p,g){p=Xy(p),d.context===null?d.context=p:d.pendingContext=p,d=Or(r),d.payload={element:o},g=g===void 0?null:g,g!==null&&(d.callback=g),o=Lr(s,d,r),o!==null&&(fs(o,s,r),ic(o,s,r))}function Wy(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var o=s.retryLane;s.retryLane=o!==0&&o<r?o:r}}function Vm(s,r){Wy(s,r),(s=s.alternate)&&Wy(s,r)}function Zy(s){if(s.tag===13||s.tag===31){var r=Na(s,67108864);r!==null&&fs(r,s,67108864),Vm(s,67108864)}}function Jy(s){if(s.tag===13||s.tag===31){var r=Ms();r=Oo(r);var o=Na(s,r);o!==null&&fs(o,s,r),Vm(s,r)}}var Ql=!0;function vE(s,r,o,d){var p=Ce.T;Ce.T=null;var g=Re.p;try{Re.p=2,Gm(s,r,o,d)}finally{Re.p=g,Ce.T=p}}function bE(s,r,o,d){var p=Ce.T;Ce.T=null;var g=Re.p;try{Re.p=8,Gm(s,r,o,d)}finally{Re.p=g,Ce.T=p}}function Gm(s,r,o,d){if(Ql){var p=Ym(d);if(p===null)Cm(s,r,d,Jd,o),t_(s,d);else if(_E(p,s,r,o,d))d.stopPropagation();else if(t_(s,d),r&4&&-1<yE.indexOf(s)){for(;p!==null;){var g=gi(p);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var _=Xs(g.pendingLanes);if(_!==0){var T=g;for(T.pendingLanes|=2,T.entangledLanes|=2;_;){var $=1<<31-en(_);T.entanglements[1]|=$,_&=~$}Ni(g),(Et&6)===0&&(Bd=sn()+500,yc(0))}}break;case 31:case 13:T=Na(g,2),T!==null&&fs(T,g,2),Ud(),Vm(g,2)}if(g=Ym(d),g===null&&Cm(s,r,d,Jd,o),g===p)break;p=g}p!==null&&d.stopPropagation()}else Cm(s,r,d,null,o)}}function Ym(s){return s=pl(s),Qm(s)}var Jd=null;function Qm(s){if(Jd=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 Jd=s,null}function e_(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(xr()){case Bi:return 2;case le:return 8;case xe:case we:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Xm=!1,Gr=null,Yr=null,Qr=null,Ec=new Map,Tc=new Map,Xr=[],yE="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 t_(s,r){switch(s){case"focusin":case"focusout":Gr=null;break;case"dragenter":case"dragleave":Yr=null;break;case"mouseover":case"mouseout":Qr=null;break;case"pointerover":case"pointerout":Ec.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tc.delete(r.pointerId)}}function Mc(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=gi(r),r!==null&&Zy(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),s)}function _E(s,r,o,d,p){switch(r){case"focusin":return Gr=Mc(Gr,s,r,o,d,p),!0;case"dragenter":return Yr=Mc(Yr,s,r,o,d,p),!0;case"mouseover":return Qr=Mc(Qr,s,r,o,d,p),!0;case"pointerover":var g=p.pointerId;return Ec.set(g,Mc(Ec.get(g)||null,s,r,o,d,p)),!0;case"gotpointercapture":return g=p.pointerId,Tc.set(g,Mc(Tc.get(g)||null,s,r,o,d,p)),!0}return!1}function n_(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,rs(s.priority,function(){Jy(o)});return}}else if(r===31){if(r=f(o),r!==null){s.blockedOn=r,rs(s.priority,function(){Jy(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 ef(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var o=Ym(s.nativeEvent);if(o===null){o=s.nativeEvent;var d=new o.constructor(o.type,o);Sr=d,o.target.dispatchEvent(d),Sr=null}else return r=gi(o),r!==null&&Zy(r),s.blockedOn=o,!1;r.shift()}return!0}function s_(s,r,o){ef(s)&&o.delete(r)}function wE(){Xm=!1,Gr!==null&&ef(Gr)&&(Gr=null),Yr!==null&&ef(Yr)&&(Yr=null),Qr!==null&&ef(Qr)&&(Qr=null),Ec.forEach(s_),Tc.forEach(s_)}function tf(s,r){s.blockedOn===r&&(s.blockedOn=null,Xm||(Xm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,wE)))}var nf=null;function i_(s){nf!==s&&(nf=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nf===s&&(nf=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(Qm(d||o)===null)continue;break}var g=gi(o);g!==null&&(s.splice(r,3),r-=3,Mp(g,{pending:!0,data:p,method:o.method,action:d},d,p))}}))}function Xl(s){function r($){return tf($,s)}Gr!==null&&tf(Gr,s),Yr!==null&&tf(Yr,s),Qr!==null&&tf(Qr,s),Ec.forEach(r),Tc.forEach(r);for(var o=0;o<Xr.length;o++){var d=Xr[o];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Xr.length&&(o=Xr[0],o.blockedOn===null);)n_(o),o.blockedOn===null&&Xr.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],_=p[Cn]||null;if(typeof g=="function")_||i_(o);else if(_){var T=null;if(g&&g.hasAttribute("formAction")){if(p=g,_=g[Cn]||null)T=_.formAction;else if(Qm(p)!==null)continue}else T=_.action;typeof T=="function"?o[d+1]=T:(o.splice(d,3),d-=3),i_(o)}}}function r_(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(_){return p=_})},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 Km(s){this._internalRoot=s}sf.prototype.render=Km.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var o=r.current,d=Ms();Ky(o,d,s,r,null,null)},sf.prototype.unmount=Km.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;Ky(s.current,2,null,s,null,null),Ud(),r[mi]=null}};function sf(s){this._internalRoot=s}sf.prototype.unstable_scheduleHydration=function(s){if(s){var r=ba();s={blockedOn:null,target:s,priority:r};for(var o=0;o<Xr.length&&r!==0&&r<Xr[o].priority;o++);Xr.splice(o,0,s),o===0&&n_(s)}};var a_=t.version;if(a_!=="19.3.0")throw Error(i(527,a_,"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?x(s):null,s=s===null?null:s.stateNode,s};var SE={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:Ce,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rf.isDisabled&&rf.supportsFiber)try{Nn=rf.inject(SE),xt=rf}catch{}}return Rc.createRoot=function(s,r){if(!a(s))throw Error(i(299));var o=!1,d="",p=X1,g=K1,_=W1;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&&(_=r.onRecoverableError)),r=Qy(s,1,!1,null,null,o,d,null,p,g,_,r_),s[mi]=r.current,Nm(s),new Km(r)},Rc.hydrateRoot=function(s,r,o){if(!a(s))throw Error(i(299));var d=!1,p="",g=X1,_=K1,T=W1,$=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&&(_=o.onCaughtError),o.onRecoverableError!==void 0&&(T=o.onRecoverableError),o.formState!==void 0&&($=o.formState)),r=Qy(s,1,!0,r,o??null,d,p,$,g,_,T,r_),r.context=Xy(null),o=r.current,d=Ms(),d=Oo(d),p=Or(d),p.callback=null,Lr(o,p,d),o=d,r.current.lanes=o,hi(r,o),Ni(r),s[mi]=r.current,Nm(s),new sf(r)},Rc.version="19.3.0",Rc}var v_;function zE(){if(v_)return Jm.exports;v_=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(),Jm.exports=DE(),Jm.exports}var $E=zE();const b_=e=>{let t;const n=new Set,i=(m,x)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const b=t;t=x??(typeof v!="object"||v===null)?v:Object.assign({},t,v),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},BE=(e=>e?b_(e):b_),PE=e=>e;function FE(e,t=PE){const n=af.useSyncExternalStore(e.subscribe,af.useCallback(()=>t(e.getState()),[e,t]),af.useCallback(()=>t(e.getInitialState()),[e,t]));return af.useDebugValue(n),n}const y_=e=>{const t=BE(e),n=i=>FE(t,i);return Object.assign(n,t),n},UE=(e=>e?y_(e):y_),f0="companion_auth_token";function __(){return typeof window>"u"?null:localStorage.getItem(f0)||null}const IE=e=>({authToken:__(),isAuthenticated:__()!==null,setAuthToken:t=>{localStorage.setItem(f0,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(f0),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 HE(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function qE(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function VE(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function GE(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const YE=e=>({sessions:new Map,sdkSessions:[],currentSessionId:VE(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:qE(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:GE(),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:HE(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}):{}})}),QE=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}})}),XE=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}})}),KE=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}})}),pr=[{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"]}],WE=pr.map(e=>e.id),L2="cc-task-panel-config";function h0(){return{order:[...WE],enabled:Object.fromEntries(pr.map(e=>[e.id,!0]))}}function ZE(){if(typeof window>"u")return h0();try{const e=localStorage.getItem(L2);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of pr)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(pr.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return h0()}function lf(e){try{localStorage.setItem(L2,JSON.stringify(e))}catch{}}function JE(){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 e4(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function t4(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function D2(){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 n4(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const s4=e=>({darkMode:JE(),notificationSound:e4(),notificationDesktop:t4(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:ZE(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:D2(),density:n4(),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 lf(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 lf(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 lf(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=h0();lf(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 z2(){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 i4=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:z2(),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(x=>x.cwd===t.cwd&&x.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 r4(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const a4=e=>({updateInfo:null,updateDismissedVersion:r4(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,creationDraft: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,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:(t,n)=>e({creationError:t,creationDraft:n??null}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),l4=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}})}),W=UE((...e)=>({...IE(...e),...YE(...e),...QE(...e),...XE(...e),...KE(...e),...s4(...e),...i4(...e),...a4(...e),...l4(...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:D2(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:z2(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),o4=Object.freeze(Object.defineProperty({__proto__:null,useStore:W},Symbol.toStringTag,{value:"Module"})),c4="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",u4=/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 d4(e){return u4.test(e)}function f4(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:d4(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const w_=["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"],S_=["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 k_(){const e=w_[Math.floor(Math.random()*w_.length)],t=S_[Math.floor(Math.random()*S_.length)];return`${e} ${t}`}function $2(e){for(let t=0;t<100;t++){const n=k_();if(!e.has(n))return n}return k_()}let sg=null;function h4(){return sg||(sg=new AudioContext),sg}function p4(){try{const e=h4();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 B2{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,x=f+h;i.maxEditLength!=null&&(x=Math.min(x,i.maxEditLength));const v=(c=i.timeout)!==null&&c!==void 0?c:1/0,b=Date.now()+v,y=[{oldPos:-1,lastComponent:void 0}];let w=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=h&&w+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 U=L&&L.oldPos+1<h;if(!R&&!U){y[C]=void 0;continue}if(!U||R&&L.oldPos<O.oldPos?E=this.addToPath(O,!0,!1,0,i):E=this.addToPath(L,!1,!0,1,i),w=this.extractCommon(E,n,t,C,i),E.oldPos+1>=h&&w+1>=f)return u(this.buildValues(E.lastComponent,n,t))||!0;y[C]=E,E.oldPos+1>=h&&(N=Math.min(N,C-1)),w+1>=f&&(j=Math.max(j,C+1))}m++};if(a)(function C(){setTimeout(function(){if(m>x||Date.now()>b)return a(void 0);S()||C()},0)})();else for(;m<=x&&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,x=0;for(;m+1<u&&h+1<f&&this.equals(i[h+1],n[m+1],c);)m++,h++,x++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return x&&!c.oneChangePerToken&&(t.lastComponent={count:x,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 x=a[f];if(x.removed)x.value=this.join(i.slice(m,m+x.count)),m+=x.count;else{if(!x.added&&this.useLongestToken){let v=n.slice(h,h+x.count);v=v.map(function(b,y){const w=i[m+y];return w.length>b.length?w:b}),x.value=this.join(v)}else x.value=this.join(n.slice(h,h+x.count));h+=x.count,x.added||(m+=x.count)}}return a}}function j_(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 N_(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 p0(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 m0(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 Oc(e,t){return p0(e,t,"")}function of(e,t){return m0(e,t,"")}function C_(e,t){return t.slice(0,m4(e,t))}function m4(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 P2(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 g0(e,t){if(t)return Zc(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 Zc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Zc(e,t){if(!t)return[ro(e),g0(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=P2(e,t),i=n[0],a=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[c,u]}const E_="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}",g4=new RegExp(`[${E_}]+|\\s+|[^${E_}]`,"ug");class x4 extends B2{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=P2(t,u)}else i=t.match(g4)||[];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)&&T_(i,c,a,u,n.intlSegmenter),i=u,a=null,c=null)}),(a||c)&&T_(i,c,a,null,n.intlSegmenter),t}}const v4=new x4;function b4(e,t,n){return v4.diff(e,t,n)}function T_(e,t,n,i,a){if(t&&n){const[c,u]=Zc(t.value,a),[f,h]=Zc(n.value,a);if(e){const m=j_(c,f);e.value=m0(e.value,f,m),t.value=Oc(t.value,m),n.value=Oc(n.value,m)}if(i){const m=N_(u,h);i.value=p0(i.value,h,m),t.value=of(t.value,m),n.value=of(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]=Zc(t.value,a),h=j_(c,u);t.value=Oc(t.value,h);const m=N_(Oc(c,h),f);t.value=of(t.value,m),i.value=p0(i.value,c,m),e.value=m0(e.value,c,c.slice(0,c.length-m.length))}else if(i){const c=ro(i.value,a),u=g0(t.value,a),f=C_(u,c);t.value=of(t.value,f)}else if(e){const c=g0(e.value,a),u=ro(t.value,a),f=C_(c,u);t.value=Oc(t.value,f)}}class y4 extends B2{constructor(){super(...arguments),this.tokenize=w4}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 _4=new y4;function M_(e,t,n){return _4.diff(e,t,n)}function w4(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 S4(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:x}=f;M_(n,i,Object.assign(Object.assign({},f),{callback:v=>{const b=m(v);x(b)}}))}else return m(M_(n,i,f));function m(x){if(!x)return;x.push({value:"",lines:[]});function v(C){return C.map(function(E){return" "+E})}const b=[];let y=0,w=0,j=[],N=1,S=1;for(let C=0;C<x.length;C++){const E=x[C],L=E.lines||k4(E.value);if(E.lines=L,E.added||E.removed){if(!y){const O=x[C-1];y=N,w=S,O&&(j=h>0?v(O.lines.slice(-h)):[],y-=j.length,w-=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<x.length-2)for(const O of v(L))j.push(O);else{const O=Math.min(L.length,h);for(const U of v(L.slice(0,O)))j.push(U);const R={oldStart:y,oldLines:N-y+O,newStart:w,newLines:S-w+O,lines:j};b.push(R),y=0,w=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 k4(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 j4(e,t){return S4("","",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],x=h.slice(1);m==="-"?c.push({type:"del",content:x,oldLineNo:u++}):m==="+"?c.push({type:"add",content:x,newLineNo:f++}):c.push({type:"context",content:x,oldLineNo:u++,newLineNo:f++})}return F2(c),{header:a,lines:c}})}function N4(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)F2(h.lines);return t}function F2(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 x=e[n+m],v=e[a+m],b=b4(x.content,v.content);x.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),v.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function C4({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 E4({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(C4,{line:n}),!n.content&&" "]})]},i))]})}function T4({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 jo({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const c=a==="compact",u=!c,f=k.useMemo(()=>{if(n)return N4(n);const h=e??"",m=t??"";if(!h&&!m)return[];const x=j4(h,m);return[{fileName:i||"",hunks:x}]},[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(T4,{fileName:h.fileName||i||""}),h.hunks.map((x,v)=>l.jsx(E4,{hunk:x,showLineNumbers:u},v))]},m))})}const U2=k.createContext(null);function KB({value:e,children:t}){return l.jsx(U2.Provider,{value:e,children:t})}function M4(){const e=k.useContext(U2),t=W(n=>n.density);return e??t}function ha(){return M4()==="compact"}function vh({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 A4={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 No(e){return A4[e]||"tool"}function Oi(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 I2({name:e,input:t,toolUseId:n}){const[i,a]=k.useState(e==="Edit"),c=No(e),u=Oi(e),f=go(e,t);return e==="Edit"?l.jsx(R4,{input:t,toolUseId:n}):e==="Bash"?l.jsx(O4,{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(L4,{name:e,input:t})})})]})}function R4({input:e,toolUseId:t}){const n=ha(),[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),x=!!e.replace_all,[v,b]=k.useState(!1),w=(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&&!v?"max-h-[240px]":""}`,children:l.jsx(jo,{oldText:f,newText:h,mode:"compact"})}),N&&!v&&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(!v),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:v?"Show less":`Show all ${j} lines`})]}):w.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:w.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(vh,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${x?" (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}),x&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),S]})}function O4({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=ha(),[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(vh,{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 L4({name:e,input:t}){switch(e){case"Bash":return l.jsx(D4,{input:t});case"Edit":return l.jsx(z4,{input:t});case"Write":return l.jsx($4,{input:t});case"Read":return l.jsx(B4,{input:t});case"Glob":return l.jsx(P4,{input:t});case"Grep":return l.jsx(F4,{input:t});case"WebSearch":case"web_search":return l.jsx(U4,{input:t});case"WebFetch":return l.jsx(I4,{input:t});case"Task":return l.jsx(H4,{input:t});case"TodoWrite":return l.jsx(q4,{input:t});case"NotebookEdit":return l.jsx(V4,{input:t});case"SendMessage":return l.jsx(G4,{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 D4({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 z4({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(jo,{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 $4({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(jo,{newText:n,fileName:t,mode:"compact"})}function B4({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 P4({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 F4({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 U4({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 I4({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 H4({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 q4({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 V4({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 G4({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 go(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 Y4=2e3,H2=6,Q4=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"]),di=new Map,hr=new Map,Uf=new Map,Ef=new Map,ta=new Map,Jc=new Map,mu=new Map,If=new Map;function q2(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function gx(e){return!e.archived&&e.state!=="exited"}function xx(e){const t=W.getState();if(t.currentSessionId===e)return!0;const n=t.sdkSessions.find(i=>i.sessionId===e);return n?gx(n):!1}function X4(){const e=W.getState(),t=new Set;e.currentSessionId&&t.add(e.currentSessionId);for(const n of e.sdkSessions)gx(n)&&t.add(n.sessionId);return Array.from(t)}const xo=[];function V2(){let e=0;for(const t of di.values())t.readyState===WebSocket.CONNECTING&&e++;return e}function G2(e){const t=xo.indexOf(e);t>=0&&xo.splice(t,1)}function A_(){if(!vo)for(;xo.length>0&&V2()<H2;){const e=xo.shift();xx(e)&&Co(e)}}let vo=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){vo=!0;for(const[e,t]of hr)clearTimeout(t),hr.delete(e)}else{vo=!1;for(const e of X4()){if(!xx(e))continue;const t=di.get(e);if(!q2(t)){if(t){try{t.close()}catch{}di.delete(e)}Co(e)}}}});function Tf(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 K4(e,t){return e.startsWith("/")||!t?Tf(e):Tf(`${t}/${e}`)}function W4(e,t){if(!t)return!0;const n=Tf(t);return e===n||e.startsWith(`${n}/`)}function Z4(e){let t=If.get(e);return t||(t=new Set,If.set(e,t)),t}function ig(e,t){const n=W.getState(),i=Z4(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((x,v)=>({id:String(v+1),subject:x.content||"Task",description:"",activeForm:x.activeForm,status:x.status||"pending"}));n.setTasks(e,m),Ef.set(e,m.length)}continue}if(c==="TaskCreate"){const h=(Ef.get(e)||0)+1;Ef.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 rg(e,t){var c,u;const n=W.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 x=K4(m.file_path,i);W4(x,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Qc=new Map,J4=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function ag(e,t){const n=W.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=Qc.get(e);c||(c=new Map,Qc.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=Qc.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(J4);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&&Qc.delete(e)}}}}const cf=new Map,Hf=new Map;function lg(e,t){const n=W.getState();let i=Hf.get(e);i||(i=new Set,Hf.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=cf.get(e);u||(u=new Map,cf.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=cf.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(x=>"text"in x?x.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&&cf.delete(e)}}}}function R_(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function O_(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function L_(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 eT=0,tT=0;function Ei(){return`msg-${Date.now()}-${++eT}`}function D_(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 f4(e)?`${c4}
|
|
64
|
-
|
|
65
|
-
Details: ${t}`:`Error: ${t}`}function nT(e,t){const n=mu.get(e)||[];n.push(t),mu.set(e,n)}function sT(e,t){const n=mu.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){mu.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const ar=new Map;function z_(e,t,n){const i=W.getState(),a=i.messages.get(e)||[],c=Jc.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&&Jc.delete(e)),f===-1){const h=`stream-${e}-${Ei()}`;Jc.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 Wr(e){Jc.delete(e);const t=W.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const $_=new Map,iT=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=$_.get(e);a&&a.code===t&&i-a.at<iT||($_.set(e,{code:t,at:i}),W.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function Y2(){return`cmsg-${Date.now()}-${++tT}`}function x0(){return Y2()}const rT=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 aT(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 Q2(e){return`companion:last-seq:${e}`}function v0(e){const t=Uf.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(Q2(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return Uf.set(e,a),a}catch{return 0}}function B_(e,t){const n=Math.max(0,Math.floor(t));Uf.set(e,n);try{localStorage.setItem(Q2(e),String(n))}catch{}}function P_(e,t){In(e,{type:"session_ack",last_seq:t})}function Mf(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
-
`)}function og(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 lT(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(og(f),f);const c=[],u=new Set;for(const f of n){const h=og(f);u.has(h)||(u.add(h),c.push(a.get(h)||f))}for(const f of i){const h=og(f);u.has(h)||(u.add(h),c.push(f))}return c}function F_(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:go(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function b0(e,t){const n=lT(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Mf(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function oT(e,t){const n=W.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]=b0(c[a],t),n.setMessages(e,c)}function cT(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=W.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),X2(e,n)}function X2(e,t,n={}){var u,f,h,m,x,v;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,c=W.getState();if(i&&typeof t.seq=="number"){const b=v0(e);if(t.seq<=b)return;B_(e,t.seq),a&&P_(e,t.seq)}switch(Q4.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()),w=$2(y);c.setSessionName(e,w)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Wr(e),c.setStreaming(e,null),Kl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Mf(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=Mf(b.content),w={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(Wr(e),oT(e,w),c.setStreaming(e,null),ta.delete(e),ar.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,F_(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&&(ig(e,b.content),rg(e,b.content),ag(e,b.content),lg(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(ta.delete(e),ar.delete(e),Wr(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 w=ar.get(e)||{thinking:"",text:""};ta.get(e)==="thinking"&&(w.thinking=""),w.text+=y.text,ar.set(e,w),ta.set(e,"text"),c.setStreaming(e,w.text),z_(e,w.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const w=ar.get(e)||{thinking:"",text:""};w.thinking+=y.thinking,ar.set(e,w),ta.set(e,"thinking"),c.setStreaming(e,w.thinking),z_(e,w.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":{If.delete(e),Hf.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 w of Object.values(b.modelUsage))if(w.contextWindow>0){const j=Math.round((w.inputTokens+w.outputTokens)/w.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,y),Wr(e),c.setStreaming(e,null),ta.delete(e),ar.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&p4(),!document.hasFocus()&&c.notificationDesktop&&R_("Session completed","Claude finished the task",e),b.is_error&&c.appendMessage(e,{id:Ei(),role:"system",content:D_(b),timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const y=t.request;R_("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}];ig(e,y),rg(e,y),ag(e,y),lg(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:Ei(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||Ei(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((x=t.event)==null?void 0:x.subtype)==="task_notification"){const{task_id:y,status:w,summary:j}=t.event;y&&w&&c.updateProcess(e,y,{status:w,completedAt:Date.now(),summary:j||void 0})}const b=L_(t.event);if(!b)break;c.appendMessage(e,{id:Ei(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...O_(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:Ei(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:Ei(),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),Wr(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),Wr(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),Wr(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||Ei(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const S=N.message,C=Mf(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]=b0(b[L],E),(v=S.content)!=null&&v.length){ig(e,S.content),rg(e,S.content),ag(e,S.content),lg(e,S.content);const O=N.timestamp||Date.now();for(const R of S.content){if(R.type==="tool_use"){const U=R.input||{},D=y.get(R.id);y.set(R.id,D??F_(R.id,R.name,U,O,N.parent_tool_use_id))}if(R.type==="tool_result"){const U=y.get(R.tool_use_id);U&&y.set(R.tool_use_id,{...U,completedAt:O,isError:U.isError||!!R.is_error,elapsedSeconds:Math.max(U.elapsedSeconds,U.completedAt?U.elapsedSeconds:Math.max(0,(O-U.startedAt)/1e3))})}}}}else if(N.type==="result"){const S=N.data;S.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:D_(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=L_(N.event);if(!S)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:S,timestamp:N.timestamp||Date.now(),...O_(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]=b0(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 w=t.messages[t.messages.length-1];(w==null?void 0:w.type)==="result"&&(Wr(e),c.setStreaming(e,null),ta.delete(e),ar.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 w=v0(e);y.seq<=w||(B_(e,y.seq),b=y.seq,X2(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&P_(e,b);break}case"prompt_suggestion":{const b=t.suggestions;c.setPromptSuggestions(e,b);break}case"streamlined_text":{c.appendMessage(e,{id:Ei(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:Ei(),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 Co(e){const t=di.get(e);if(q2(t))return;if(t){try{t.close()}catch{}di.delete(e)}const n=W.getState();if(n.setConnectionStatus(e,"connecting"),n.currentSessionId!==e&&V2()>=H2){xo.includes(e)||xo.push(e);return}G2(e);const i=new WebSocket(aT(e));di.set(e,i),i.onopen=()=>{const a=v0(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),sT(e,i);const c=hr.get(e);c&&(clearTimeout(c),hr.delete(e)),A_()},i.onmessage=a=>cT(e,a),i.onclose=()=>{di.get(e)===i&&(di.delete(e),W.getState().setConnectionStatus(e,"disconnected"),uT(e),A_())},i.onerror=()=>{i.close()}}function uT(e){if(hr.has(e)||vo)return;const t=setTimeout(()=>{hr.delete(e),!vo&&xx(e)&&Co(e)},Y4);hr.set(e,t)}function y0(e){G2(e);const t=hr.get(e);t&&(clearTimeout(t),hr.delete(e));const n=di.get(e);n&&(n.close(),di.delete(e)),W.getState().setConnectionStatus(e,"disconnected"),If.delete(e),Hf.delete(e),Qc.delete(e),Ef.delete(e),ta.delete(e),Jc.delete(e),ar.delete(e),Uf.delete(e),mu.delete(e)}function dT(e){if(vo)return;const t=W.getState().currentSessionId,n=e.filter(gx),i=t?[...n.filter(a=>a.sessionId===t),...n.filter(a=>a.sessionId!==t)]:n;for(const a of i)Co(a.sessionId)}function In(e,t){const n=di.get(e);let i=t;const a=rT.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:Y2()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&nT(e,i)}function U_(e){In(e,{type:"mcp_get_status"})}function fT(e,t,n){In(e,{type:"mcp_toggle",serverName:t,enabled:n})}function hT(e,t){In(e,{type:"mcp_reconnect",serverName:t})}function pT(e,t){In(e,{type:"mcp_set_servers",servers:t})}function I_(e,t){In(e,{type:"set_magic_ui",magicUiActive:t})}function WB(e){In(e,{type:"magic_ui_sync"})}function mT(e,t){In(e,{type:"set_ai_validation",...t})}const te="u">typeof window?window:void 0,Hn="u">typeof globalThis?globalThis:te,jn=Hn==null?void 0:Hn.navigator,fe=Hn==null?void 0:Hn.document,Yt=Hn==null?void 0:Hn.location,gu=Hn==null?void 0:Hn.fetch,vx=Hn!=null&&Hn.XMLHttpRequest&&"withCredentials"in new Hn.XMLHttpRequest?Hn.XMLHttpRequest:void 0,H_=Hn==null?void 0:Hn.AbortController,gT=Hn==null?void 0:Hn.CompressionStream,es=jn==null?void 0:jn.userAgent;function K2(){return!(!te||te.navigator.onLine===!1)}const Lc=typeof globalThis<"u"?globalThis:te;Lc&&typeof self>"u"&&(Lc.self=Lc),Lc&&typeof File>"u"&&(Lc.File=function(){});const $e=te??{},xT="0.8.3",fr={DEBUG:!1,LIB_VERSION:xT,LIB_NAME:"browser-common"};var Mi=(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})({}),_0=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const vT=["$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"],bT=["token"];function Ie(e,t){return e.indexOf(t)!==-1}const bh=function(e){return e.trim()},w0=function(e){return e.replace(/^\$/,"")};function W2(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,bx=Z2.hasOwnProperty,yh=Z2.toString,Fe=Array.isArray||function(e){return yh.call(e)==="[object Array]"},kn=e=>typeof e=="function",st=e=>e===Object(e)&&!Fe(e),ms=e=>{if(st(e)){for(const t in e)if(bx.call(e,t))return!1;return!0}return!1},ue=e=>e===void 0,Je=e=>yh.call(e)=="[object String]",eu=e=>Je(e)&&e.trim().length===0,Zt=e=>e===null,Ve=e=>ue(e)||Zt(e),Jt=e=>yh.call(e)=="[object Number]"&&e==e,lr=e=>Jt(e)&&e>0,ns=e=>yh.call(e)==="[object Boolean]",yT=e=>Ie(vT,e),_T=e=>Ie(bT,e);function J2(e){return e===null||typeof e!="object"}function qf(e,t){return{}.toString.call(e)===`[object ${t}]`}function Tu(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 eS(e,Error)}}function yx(e){return"u">typeof Event&&eS(e,Event)}function eS(e,t){try{return e instanceof t}catch{return!1}}const wT=[!0,"true",1,"1","yes"],cg=e=>Ie(wT,e),ST=[!1,"false",0,"0","no"];function q_(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){q_(c,i,a,u,f,"next",h)}function f(h){q_(c,i,a,u,f,"throw",h)}u(void 0)})}}const kT=["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"],V_=function(e,t=[]){if(!e)return!1;const n=e.toLowerCase();return kT.concat(t).some(i=>{const a=i.toLowerCase();return n.indexOf(a)!==-1})};function Ri(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),Jt(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),Ri(a??n,t,n,i))}var jT=class{constructor(e){this.C={},this.I=e.I,this.R=Ri(e.bucketSize,0,100,e.$),this.A=Ri(e.refillRate,0,this.R,e.$),this.O=Ri(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 bo="Mobile",xu="Android",Vf="Tablet",tS="Android Tablet",nS="iPad",sS="Apple Watch",Af="Safari",_h="BlackBerry",iS="Samsung Internet",Rf="Chrome",rS="Chrome iOS",aS="Internet Explorer",lS="Internet Explorer Mobile",oS="Opera",cS="Microsoft Edge",Of="Firefox",uS="Firefox iOS",Gf="Nintendo",Yf="PlayStation",wh="Xbox",dS="Android Mobile",fS="Mobile Safari",ug="Windows",hS="Windows Phone",G_="Nokia",S0="Ouya",NT="Generic "+bo.toLowerCase(),pS="Generic "+Vf.toLowerCase(),k0="Konqueror",mS="Oculus Browser",gS="Vivaldi",xS="Yandex",vS="Whale",bS="DuckDuckGo",yS="Pale Moon",_S="Waterfox",j0="Brave",wS="Claude",SS="Codex",kS="ChatGPT",jS="Google Search App",dg=new RegExp("Version/(\\d+(\\.\\d+)?)"),fg=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),CT=new RegExp(wh,"i"),ET=new RegExp("PlayStation \\w+","i"),TT=new RegExp("Nintendo \\w+","i"),_x=new RegExp("BlackBerry|PlayBook|BB10","i"),MT={"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"},NS=function(e,t,n,i){return t=t||"",(function(c){return c!=null&&c.brave?j0:null})(n)||(i!=null&&i.detectGoogleSearchApp&&Ie(e,"GSA/")?jS:Ie(e," OPR/")&&Ie(e,"Mini")?"Opera Mini":Ie(e," OPR/")?oS:_x.test(e)?_h:Ie(e,"IEMobile")||Ie(e,"WPDesktop")?lS:Ie(e,"OculusBrowser")?mS:Ie(e,"SamsungBrowser")?iS:Ie(e,"Edge")||Ie(e,"Edg/")?cS:Ie(e,"Vivaldi/")?gS:Ie(e,"YaBrowser/")?xS:Ie(e,"Whale/")?vS:Ie(e,"DuckDuckGo/")||Ie(e,"Ddg/")?bS:Ie(e,"Claude/")?wS:Ie(e,"Codex/")?SS:Ie(e,"ChatGPT/")?kS:Ie(e,"FBIOS")?"Facebook Mobile":Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?rS:Ie(e,"CrMo")||Ie(e,Rf)?Rf:Ie(e,xu)&&Ie(e,Af)?dS:Ie(e,"FxiOS")?uS:Ie(e.toLowerCase(),k0.toLowerCase())?k0:Ie(e,"Brave/")?j0:((c,u)=>u&&Ie(u,"Apple")||(function(f){return Ie(f,Af)&&!Ie(f,Rf)&&!Ie(f,xu)})(c))(e,t)?Ie(e,bo)?fS:Af:Ie(e,"PaleMoon/")?yS:Ie(e,"Waterfox/")?_S:Ie(e,Of)?Of:Ie(e,"MSIE")||Ie(e,"Trident/")?aS:Ie(e,"Gecko")?Of:"")},AT={[lS]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[cS]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Rf]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[rS]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Af]:[dg],[fS]:[dg],[oS]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Of]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[uS]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[k0]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[_h]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),dg],[dS]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[iS]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[mS]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[gS]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[xS]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[vS]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[j0]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[wS]:[fg],[SS]:[fg],[kS]:[fg],[bS]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[yS]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[_S]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[jS]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[aS]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},RT=function(e,t,n,i){const a=NS(e,t,n,i),c=AT[a];if(ue(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},Y_=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[wh,e&&e[1]||""]],[new RegExp(Gf,"i"),[Gf,""]],[new RegExp(Yf,"i"),[Yf,""]],[_x,[_h,""]],[new RegExp(ug,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[hS,""];if(new RegExp(bo).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let i=MT[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[ug,i]}return[ug,""]}],[/((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=ue(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[xu,[e[2],e[3],e[4]||"0"].join(".")]:[xu,""]],[/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",""]]],CS=function(e){for(let t=0;Y_.length>t;t++){const[n,i]=Y_[t],a=n.exec(e),c=a&&(kn(i)?i(a,e):i);if(c)return c}return["",""]},ES=function(e){return TT.test(e)?Gf:ET.test(e)?Yf:CT.test(e)?wh:new RegExp(S0,"i").test(e)?S0:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?hS:/iPad/.test(e)?nS:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?sS:_x.test(e)?_h:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(G_,"i").test(e)?G_:/(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(bo).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)?xu:tS:new RegExp("(pda|Mobile)","i").test(e)?NT:new RegExp(Vf,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?pS:""},OT=function(e,t){var n;const i=ES(e);return i===nS||i===tS||i==="Kobo"||i==="Kindle Fire"||i===pS?Vf:i===Gf||i===wh||i===Yf||i===S0?"Console":i===sS?"Wearable":i?bo:(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)?bo:Vf:"Desktop";var a,c,u},hg=/\bFBAV\/(\d+(?:\.\d+)*)/i,Q_=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",hg],[/\bFBAN\/EMA\b/i,"Facebook Lite",hg],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",hg],[/\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"]],N0="[Truncated]",Mu="[Unserializable]";function ho(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 TS(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=Mu}Object.defineProperty(e,i,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}const Lf=3e5;var MS=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,Lf);if(!t)return this.ts=n,void(this.es=n+i);this.es=Math.max(this.es,Math.min(n+i,this.ts+Lf))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Lf,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const LT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function X_(e,t){return typeof(n=e)=="string"&<.test(n)?e:t();var n}function AS(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function ca(e){return e&&e.split("#")[0]}function K_(e){try{return e()}catch{return}}function RS(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function W_(e,t,n){return OS.apply(this,arguments)}function OS(){return(OS=zt(function*(e,t,n){let i;try{return yield Promise.race([e,new Promise((a,c)=>{i=RS(()=>{try{n==null||n(),a()}catch(u){c(u)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let uf,Z_,pg;function DT(e){const t=globalThis._posthogChunkIds;if(!t)return;const n=Object.keys(t);return pg&&n.length===Z_||(Z_=n.length,pg=n.reduce((i,a)=>{uf||(uf={});const c=uf[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,x=t[a];if(m&&x){i[m]=x,uf[a]=[m,x];break}}}return i},{})),pg}function tu(e){return tu=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},tu(e)}function zT(e,t,n){return(t=(function(i){var a=(function(c){if(tu(c)!="object"||!c)return c;var u=c[Symbol.toPrimitive];if(u!==void 0){var f=u.call(c,"string");if(tu(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(c)})(i);return tu(a)=="symbol"?a:a+""})(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J_(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 F(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?J_(Object(n),!0).forEach(function(i){zT(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J_(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}var $T=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&&Fe(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)),F(F({},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,F(F({},t),{},{handled:!0}))),u}buildParsingContext(e){var t;return{chunkIdMap:DT(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 F(F({},t),{},{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:a=>i(a,n),next:a=>i(a,n+1)})}};const BT=/^([a-z][a-z0-9.+-]+):/i,PT=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function FT(e){if(!e||e==="<anonymous>")return!1;const t=BT.exec(e);return!t||PT.includes(t[1].toLowerCase())}function C0(e,t,n,i,a){const c={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:FT(t)};return ue(i)||(c.lineno=i),ue(a)||(c.colno=a),c}const LS=(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]},UT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,IT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,HT=/\((\S*)(?::(\d+))(?::(\d+))\)/,qT=(e,t)=>{const n=UT.exec(e);if(n){const[,a,c,u]=n;return C0(t,a,"?",+c,+u)}const i=IT.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const u=HT.exec(i[2]);u&&(i[2]=u[1],i[3]=u[2],i[4]=u[3])}const[a,c]=LS(i[1]||"?",i[2]);return C0(t,c,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},VT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,GT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,YT=(e,t)=>{const n=VT.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const c=GT.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]=LS(a,i),C0(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ew=/\(error: (.*)\)/;function wx(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function QT(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(!wx(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 XT(e,t){const n=t.start+t.length,i=zS(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}function DS(e,t){let n=t.start;for(;n>0&&wx(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function zS(e,t){const n=t.start+t.length;let i=n;for(;e.length>i&&wx(e[i],e[i-t.length]);)i++;return i-n}function KT(e,t){const n=t[0];let i=e.length-(n?DS(e,n):0);for(const a of t)i-=zS(e,a);return i}function WT(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 ZT=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const n=Je(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 qf(e,"DOMException")}isDOMError(e){return qf(e,"DOMError")}},JT=class{match(e){return Tu(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}},e6=class{match(e){return!!qf(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 F(F({},i),{},{stack:(n=this.ur(e))!==null&&n!==void 0?n:i.stack,synthetic:!0})}lr(e){return Je(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(Je(i.filename)&&i.filename.length!==0&&a!==0)return`Error
|
|
67
|
-
at ${i.filename}:${a}:${c}`}};const t6=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var n6=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(t6);return i&&(t=i[1],n=i[2]),[t,n]}};const s6=["fatal","error","warning","log","info","debug"];function $S(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 i6=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(yx(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Je(t)&&!eu(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: ${$S(e)}`}isSeverityLevel(e){return Je(e)&&!eu(e)&&s6.indexOf(e)>=0}getStack(e){try{return Je(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Je(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(Tu(n))return n}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},r6=class{match(e){return yx(e)}coerce(e,t){var n;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${$S(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},a6=class{match(e){return J2(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}}},l6=class{match(e){return qf(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!yx(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 J2(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",Xf="$timestamp",o6=new Set([Qf,Xf]),mg={enabled:!0,max_bytes:32768};function Kf(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:mg.enabled,max_bytes:u6(e.max_bytes,mg.max_bytes)}:F({},mg)}var c6=class{constructor(e){this.ns=[],this.ss=0,this.Mr=Kf(e)}setConfig(e){this.Mr=Kf(e),this.rs()}add(e){const t=(function(i){let a;try{a=W2(i)}catch{return}try{const c=JSON.parse(a);if(!st(c))return;const u=c,f=u[Qf],h=u[Xf];return!Je(f)||f.trim().length===0||!Je(h)&&!Jt(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.ns.push({step:t.step,bytes:n}),this.ss+=n,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function u6(e,t){if(!Jt(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const tw=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function nw(e){return typeof e=="string"||e}function sw(e){return typeof e=="string"?e:void 0}const d6=["$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"],BS="NativeGzipValidationError",E0=e=>e.length>=2&&e[0]===31&&e[1]===139,iw=(e,t)=>e===_0.GZipJS||t===_0.GZipJS||t==="gzip",rw=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let Dc;const df=e=>{throw AS(BS,`Native gzip produced invalid output: ${e}`)},f6=(aw=zt(function*(e,t){18>e.size&&df("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());E0(n)&&n[2]===8||df("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(c=>{const u=(()=>{if(Dc)return Dc;Dc=[];for(let h=0;256>h;h++){let m=h;for(let x=0;8>x;x++)m=1&m?3988292384^m>>>1:m>>>1;Dc[h]=m>>>0}return Dc})();let f=4294967295;for(let h=0;c.length>h;h++)f=u[255&(f^c[h])]^f>>>8;return(4294967295^f)>>>0})(t)&&df("invalid-crc");const a=t.length>>>0;i.getUint32(4,!0)!==a&&df("invalid-size")}),function(e,t){return aw.apply(this,arguments)});var aw;function T0(){return T0=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*(x){try{yield u.abort(x)}catch{}throw x}),function(x){return i.apply(this,arguments)})),h=new Response(c.readable).blob(),[m]=yield Promise.all([h,f]);return yield f6(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}),T0.apply(this,arguments)}function PS(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 h6={}.propertyIsEnumerable;function Wf(e,t){try{return FS(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Sx(e,t,n,i){if(0>=n.remainingNodes)return{stringValue:N0};if(n.remainingNodes--,ns(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:ho(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:N0};if(e instanceof Date){const a=e.getTime(),c=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof c=="string"?ho(c):String(c)}}n.ancestors.add(e);try{try{const a=e.toJSON;if(typeof a=="function")return Sx(a.call(e),t,n,i+1)}catch{}return Fe(e)?{arrayValue:{values:p6(e,t,n,i+1)}}:{kvlistValue:{values:FS(e,t,n,i+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:ho(String(e))}}function p6(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(Sx(f,t,n,i))}catch{a.push({stringValue:Mu})}return e.length>u&&a.push({stringValue:N0}),a}function FS(e,t,n,i){const a=[];for(const c in e)if(h6.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(Zt(u)||ue(u))continue;a.push({key:ho(c),value:Sx(u,t,n,i)})}catch{a.push({key:ho(c),value:{stringValue:Mu}})}}return a}function US(e,t,n){return F(F(F(F({},TS({},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 m6=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function IS(e,t){const n=TS({},e),i={};for(const a of m6)({}).hasOwnProperty.call(n,a)&&(i[a]=n[a],delete n[a]);return[...Wf(n,t),...Wf(i,t)]}const lw={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"},HS={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}},g6=HS.info;function x6(e){try{return ho(String(e))}catch{return Mu}}function v6(e,t,n,i){const a=e.level||"info",{text:c,number:u}=HS[a]||g6,f=(function(b=Date.now()){return String(b)+"000000"})(Jt(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=F({},h),x=e.attributes;if(x){let b=[];try{b=Object.keys(x)}catch{b=[]}for(const y of b){let w;try{w=x[y]}catch{w=Mu}Object.defineProperty(m,y,{value:w,enumerable:!0,writable:!0,configurable:!0})}}const v={timeUnixNano:f,observedTimeUnixNano:f,severityNumber:u,severityText:c,body:{stringValue:x6(e.body)},attributes:Wf(m,n)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),ue(e.trace_flags)||(v.flags=e.trace_flags),v}function qS(e,t,n){return US(e,t,n)}function VS(e,t,n,i){return{resourceLogs:[{resource:{attributes:IS(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var GS=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=RS(()=>{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 YS(){return .75+.5*Math.random()}function QS(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 b6=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 GS(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new MS,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(Mi.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:v6(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=Fe(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(Mi.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),x=VS(m.map(b=>b.record),e.qs(),(c=e.fs)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),v=yield e._instance.js(x);if(e._s!==f)return;if(v.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(v),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),v.kind==="retry-later"||(v.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."):v.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(Mi.LogsQueue))!==null&&u!==void 0?u:[],a+=m.length,v.kind==="fatal"))throw v.error}})()}Bs(e){var t=this;return zt(function*(){var n;const i=Math.max(0,e-t.bs),a=(n=t._instance.getPersistedProperty(Mi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Mi.LogsQueue,a.slice(i)),yield t.vs()})()}qs(){return qS(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(Mi.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(Mi.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(QS(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Mi.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 W_(n,e):yield n})()}flushWithTimeout(e){var t=this;return zt(function*(){const n=t.flush();yield W_(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=YS(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const gg=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ow(e){return String(e)+"000000"}function cw(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 y6=class{constructor(e,t,n){this._instance=e,this.Mr=t,this.$=n,this.zs=new Map,this.ps=new GS(()=>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 MS,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?F({},t.attributes):void 0,i=cw(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.Xs(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)}Xs(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(gg.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,gg)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Fe(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(QS(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.Ys(e.Js(t));if(n===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=YS()):(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 US(c,u,f)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:IS(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}ao(e){const t=ow(Date.now()),n=new Map;for(const u of e.values()){var i;const f=cw(u.type,u.name,u.unit,void 0);let h=n.get(f);h||(h=F({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=Wf((i=u.attributes)!==null&&i!==void 0?i:{},this.$),x=ow(u.windowStartMs);if(u.type==="count"){var a;const v={attributes:m,startTimeUnixNano:x,timeUnixNano:t,asDouble:(a=u.total)!==null&&a!==void 0?a:0};h.sum.dataPoints.push(v)}else if(u.type==="gauge"){var c;const v={attributes:m,timeUnixNano:t,asDouble:(c=u.last)!==null&&c!==void 0?c:0};h.gauge.dataPoints.push(v)}else u.hist&&h.histogram.dataPoints.push({attributes:m,startTimeUnixNano:x,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:gg})}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 XS=(e,{debugEnabled:t}={})=>{const n={N(i,...a){te&&(fr.DEBUG||te.POSTHOG_DEBUG||t)&&!ue(te.console)&&te.console&&("__rrweb_original__"in te.console[i]?te.console[i].__rrweb_original__:te.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)=>XS(`${e} ${i}`,a)};return n},ye=XS("[PostHog.js]"),Xt=ye.createLogger,_6=Xt("[ExternalScriptsLoader]"),Zf=e=>{const t=fe==null?void 0:fe.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 _6.warn(`${t} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const i=Zf(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(!fe)return n("document not found");if(Zf(t))return Ka(e,t,n);let c=fe.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")fe.head.appendChild(c);else{const f=fe.querySelectorAll("body > script");var u;f.length>0?(u=f[0].parentNode)===null||u===void 0||u.insertBefore(c,f[0]):fe.body.appendChild(c)}};fe!=null&&fe.body?a():fe==null||fe.addEventListener("DOMContentLoaded",a)},xg={},uw=(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=xg[a];if(i==="fallback"&&c){if(Zf(c))return void Ka(e,c,n);delete xg[a]}return void Ka(e,a,i==="fallback"?(u,f)=>{if(u)if(typeof u=="string")n(u);else{var h;const m=uw(e,t);xg[a]=m;const x=Zf(a);x==null||(h=x.parentNode)===null||h===void 0||h.removeChild(x),Ka(e,m,n)}else n(void 0,f)}:n)}Ka(e,uw(e,t),n)},$e.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{const i=e.requestRouter.endpointFor("api",t);Ka(e,i,n)},fr.DEBUG=!1,fr.LIB_VERSION="1.433.3",fr.LIB_NAME="web";var yn=fr;const w6="$people_distinct_id",oi="distinct_id",kx="$device_id",vg="$device_model",Jf="__alias",S6="__cmpns",dw="$fbc",po="$fbc_persistence",fw="$fbp",nu="$fbp_persistence",M0="__timers",KS="$autocapture_disabled_server_side",A0="$heatmaps_enabled_server_side",R0="$exception_capture_enabled_server_side",WS="$error_tracking_suppression_rules",O0="$error_tracking_capture_extension_exceptions",L0="$web_vitals_enabled_server_side",jx="$dead_clicks_enabled_server_side",Nx="$product_tours_enabled_server_side",ZS="$logs_capture_enabled_server_side",JS="$web_vitals_allowed_metrics",su="$session_recording_remote_config",k6="$session_recording_enabled_server_side",j6="$replay_sample_rate",N6="$replay_override_sampling",C6="$replay_override_linked_flag",E6="$replay_override_url_trigger",T6="$replay_override_event_trigger",oo="$sesid",ek="$session_is_sampled",M6="$session_past_minimum_duration",A6="$session_recording_url_trigger_activated_session",R6="$session_recording_event_trigger_activated_session",O6="$debug_first_full_snapshot_timestamp",L6="$sess_rec_flush_size",ci="$enabled_feature_flags",cr="$active_feature_flags",D0="$early_access_features",el="$feature_flag_details",sa="$feature_flag_payloads",tl="$feature_flag_request_id",iu="$minimal_flag_called_events",Ti="$override_feature_flags",Wa="$override_feature_flag_payloads",ia="$stored_person_properties",ra="$stored_group_properties",tk="$groups",z0="$surveys",eh="$surveys_loaded_at",nk="$surveys_activated",sk="$surveys_activated_session",ik="$surveys_activated_timestamps",$0="ph_product_tours",D6="$product_tours_activated",z6="$product_tours_activated_session",$6="$conversations_widget_session_id",B6="$conversations_ticket_id",P6="$conversations_widget_state",F6="$conversations_user_traits",aa="$flag_call_reported",Xc="$flag_call_reported_session_id",vu="$feature_flag_errors",la="$feature_flag_evaluated_at",ts="$user_state",B0="$client_session_props",U6="$capture_rate_limit",rk="$initial_campaign_params",ak="$initial_referrer_info",co="$initial_person_info",Cx="$epp",bg="$posthog_cookieless",lk="$cookieless_mode",ok="$sdk_debug_extensions_init_method",ck="$sdk_debug_extensions_init_time_ms",uk="$sdk_debug_recording_script_not_loaded",I6="$sdk_debug_replay_event_trigger_status",H6="$sdk_debug_replay_linked_flag_trigger_status",q6="$sdk_debug_replay_matched_recording_trigger_groups",V6="$sdk_debug_replay_pending_trigger_conditions",G6="$sdk_debug_replay_remote_trigger_matching_config",Y6="$sdk_debug_replay_trigger_groups_count",Q6="$sdk_debug_replay_url_trigger_status",X6="$session_recording_start_reason",Ex="PostHog loadExternalDependency extension not found.",ur="anonymous",Df="identified",dk="identified_only",bu="visibilitychange",th="beforeunload",Tx="$pageview",hw="$pageleave",fk="$identify",pw="$groupidentify";function uo(e,t){Fe(e)&&e.forEach(t)}function jt(e,t){if(!Ve(e))if(Fe(e))e.forEach(t);else if((n=>n instanceof FormData)(e))e.forEach((n,i)=>t(n,i));else for(const n in e)bx.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 zf(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 K6=function(e){return function(...t){try{return e.apply(this,t)}catch(n){ye.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ye.critical(n)}}},Mx=function(e){const t={};return jt(e,function(n,i){(Je(n)&&n.length>0||Jt(n))&&(t[i]=n)}),t};function hk(e){const t=F({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch{}return t}const W6=["herokuapp.com","vercel.app","netlify.app"];function Z6(e){const t=e==null?void 0:e.hostname;if(!Je(t))return!1;const n=t.split(".").slice(-2).join(".");for(const i of W6)if(n===i)return!1;return!0}function yt(e,t,n,i){const{capture:a=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:a,passive:c})}function P0(e){return e.name==="ph_toolbar_internal"}const nh=e=>{if(fe){try{const t=e+"=",n=fe.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 Jt(e)&&isFinite(e)&&Math.floor(e)===e});var J6=class F0{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 F0(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 F0(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}},eM=class{generate(){const e=this.generateOrAbort();if(!ue(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(ue(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return Jt(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 J6.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 tM}};let pk=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};te&&!ue(te.crypto)&&crypto.getRandomValues&&(pk=e=>crypto.getRandomValues(e));var tM=class{nextUint32(){return this.Rt.length>this.$t||(pk(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let mw;const ui=()=>nM().toString(),nM=()=>(mw||(mw=new eM)).generate();let zc="";const sM=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Wl=null;const Gt={Et(){if(!Zt(Wl))return Wl;if(Wl=!1,fe)try{const e=`__ph_cookie_support_${ui()}`;Gt.At(e,"xyz"),Wl=nh(e)==='"xyz"',Gt.Lt(e)}catch{Wl=!1}return Wl},Pt(e){ye.error("cookieStore error: "+e)},Ot:nh,Dt(e){let t;try{t=JSON.parse(Gt.Ot(e))||{}}catch{}return t},At(e,t,n,i,a){if(!fe)return!1;try{let c="",u="";const f=(function(m,x){if(x){let v=(function(b,y=fe){if(zc)return zc;if(!y||["localhost","127.0.0.1"].includes(b))return"";const w=b.split(".");let j=Math.min(w.length,8);const N="dmn_chk_"+ui();for(;!zc&&j--;){const S=w.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",zc=S)}return zc})(m);if(!v){const b=(y=>{const w=y.match(sM);return w?w[0]:""})(m);b!==v&&ye.info("Warning: cookie subdomain discovery mismatch",b,v),v=b}return v?"; domain=."+v:""}return""})(fe.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&&ye.warn("cookieStore warning: large cookie, len="+h.length),fe.cookie=h,!0}catch{return!1}},Lt(e,t){if(fe!=null&&fe.cookie)try{Gt.At(e,"",-1,t)}catch{return}}};let yg=null;const ot={Et(){if(!Zt(yg))return yg;let e=!0;if(ue(te))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||ye.error("localStorage unsupported; falling back to cookie store"),yg=e,e},Pt(e){ye.error("localStorage error: "+e)},Ot(e){try{return te==null?void 0:te.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 te==null||te.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ot.Pt(n)}return!1},Lt(e){try{te==null||te.localStorage.removeItem(e)}catch(t){ot.Pt(t)}}},_g=[ia,cr,ci,el,sa,tl,la,vu,aa],Za=[kx,oi,oo,ek,Cx,co,po,ts],sh=e=>e+"_cpm",iM=["__proto__","constructor","prototype"],wg=e=>{if(!st(e))return{};const t={};return Object.keys(e).forEach(n=>{iM.indexOf(n)===-1&&(t[n]=e[n])}),t},Sg=(e,t=[])=>{const n={};return[...Za,...t].forEach(i=>{const a=e[i];ue(a)||Zt(a)||a===""||(n[i]=a)}),n},mk=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)},gw=(e,t)=>({p:t,f:mk(JSON.stringify(e))}),xw=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Gt.Dt(sh(e)),i=(n==null?void 0:n.f)===mk(t)&&Fe(n.p);return{properties:i?n.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},kg=(e,t)=>t+"|"+(Gt.Ot(sh(e))||""),Zl={},U0={Et:()=>!0,Pt(e){ye.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(!Zt(qa))return qa;if(qa=!0,ue(te))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){ye.error("sessionStorage error: ",e)},Ot(e){try{return te==null?void 0:te.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 te==null||te.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Ot.Pt(n)}return!1},Lt(e){try{te==null||te.sessionStorage.removeItem(e)}catch(t){Ot.Pt(t)}}};var rM=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 cg(e)?1:Ie(ST,e)?0:-1}get Fo(){const e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?ot:Gt,n=t.Et()?t:U0;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(cg(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=>cg(e))}};function gk(e,t){var n;const i=e==null||(n=e.config)===null||n===void 0?void 0:n.get_current_url;if(!kn(i))return t;try{const a=i(t);return Je(a)&&a?a:t}catch(a){return ye.error("Error in get_current_url, falling back to window.location.href",a),t}}function vw(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 Li(e){return!!e&&e.nodeType===1}function Pn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function xk(e){return!!e&&e.nodeType===3}function Ax(e){return!!e&&e.nodeType===11&&Li(e.host)}function Rx(e){return e?bh(e).split(/\s+/):[]}function bw(e,t){const n=(function(i){var a;const c=te==null||(a=te.location)===null||a===void 0?void 0:a.href;return ue(c)?void 0:gk(i,c)})(t);return!!(n&&e&&e.some(i=>n.match(i)))}function yo(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 Rx(t)}function vk(e){return Ve(e)?null:bh(e).split(/(\s+)/).filter(t=>au(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function yu(e){let t="";return mo(e)&&!_u(e)&&e.childNodes&&e.childNodes.length&&jt(e.childNodes,function(n){var i;xk(n)&&n.textContent&&(t+=(i=vk(n.textContent))!==null&&i!==void 0?i:"")}),bh(t)}function ru(e){var t;return ue(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Ox=["a","button","form","input","select","textarea","label"];function I0(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 H0(e,t){if(ue(t))return!0;for(const n of e)if(t.some(i=>I0(n,i)))return!0;return!1}function bk(e){const t=e.parentNode;return!(!t||!Li(t))&&t}const jg=[".ph-no-autocapture","[data-ph-no-autocapture]"],yk=["next","previous","prev",">","<"],aM=[...yk,"+","-","−","–"],yw=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,_w=[".ph-no-rageclick",".ph-no-capture"],lM=["","text","search","email","password","url","tel","number"];function _k(e,t){if(!te||Lx(e))return!1;let n,i,a;var c,u;if(ns(t)?(n=!!t&&_w,i=void 0,a=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:_w,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||!Li(h))&&(!!Pn(h,"textarea")||(Pn(h,"input")?Ie(lM,(h.getAttribute("type")||"").toLowerCase()):(function(m){var x;if(m.isContentEditable)return!0;const v=(x=m.getAttribute)===null||x===void 0?void 0:x.call(m,"contenteditable");return v==="true"||v===""})(h)))})(e))return!1;const{targetElementList:f}=wk(e,!1);return!(function(h,m){if(h===!1||ue(h))return!1;let x;if(h===!0)x=yk;else{if(!Fe(h))return!1;if(h.length>10)return ye.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;x=h.map(v=>v.toLowerCase())}return m.some(({safeText:v,ariaLabel:b})=>x.some(y=>yw(v,y)||yw(b,y)))})(i,f.map(h=>{var m;return{safeText:yu(h).toLowerCase(),ariaLabel:((m=h.getAttribute("aria-label"))===null||m===void 0?void 0:m.toLowerCase().trim())||""}}))&&!H0(f,n)}const Lx=e=>!e||Pn(e,"html")||!Li(e),wk=(e,t)=>{if(!te||Lx(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const i=[e];let a=e;for(;a.parentNode&&!Pn(a,"body");){if(Ax(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}const c=bk(a);if(!c)break;if(t||Ox.indexOf(c.tagName.toLowerCase())>-1)n=!0;else try{const u=te.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(c),a=c}return{parentIsUsefulElement:n,targetElementList:i}};function mo(e){const t=new Set;let n=0;for(let c=e;c.parentNode&&!Pn(c,"body");c=c.parentNode){if(n++>=1e3||t.has(c))return!1;t.add(c);const u=yo(c);if(Ie(u,"ph-sensitive")||Ie(u,"ph-no-capture"))return!1}if(Ie(yo(e),"ph-include"))return!0;const i=e.type||"";if(Je(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const a=e.name||e.id||"";return!Je(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 _u(e){return!!(Pn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Pn(e,"select")||Pn(e,"textarea")||e.getAttribute("contenteditable")==="true")}const ww=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}))$"),Sw=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,oM=[16,15,14,13],cM=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),kw=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),jw=/[0-9A-Za-z_]/;function uM(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 au(e,t=!0){return!(Ve(e)||Je(e)&&(e=bh(e),(t?ww.test((e||"").replace(/[- ]/g,"")):(function(n){let i;for(Sw.lastIndex=0;i=Sw.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 oM){const h=u+f;if(c.length>=h){const m=c.slice(u,h);if(ww.test(m)&&uM(m))return!0}}}return!1})(e))||(t?cM.test(e):(function(n){let i;for(kw.lastIndex=0;i=kw.exec(n);){const a=i[1],c=i[3];if(!(a&&c&&jw.test(a)&&jw.test(c)))return!0}return!1})(e))))}function Nw(e){let t=yu(e);return t=`${t} ${Sk(e)}`.trim(),au(t)?t:""}function Sk(e){let t="";return e&&e.childNodes&&e.childNodes.length&&jt(e.childNodes,function(n){var i;if(n&&((i=n.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const a=yu(n);t=`${t} ${a}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${Sk(n)}`.trim())}catch(a){ye.error("[AutoCapture]",a)}}),t}function Cw(e){return e.replace(/"|\\"/g,'\\"')}function dM(e){const t=e.attr__class;if(t)return Fe(t)?t:Rx(t)}const ff=Xt("[Dead Clicks]"),fM=()=>!0,hM=e=>{var t;const n=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(jx)),i=e.instance.config.capture_dead_clicks;return ns(i)?i:!!st(i)||n};var Ew=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({[jx]: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?ff.error("failed to load script",a):e()})}qo(){var e;if(fe){if(!this.Lo&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=st(this.instance.config.capture_dead_clicks)?F({},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(fe),ff.info("starting...")}}else ff.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,ff.info("stopping..."))}};const $c=Xt("[SegmentIntegration]");function Tw(e,t,n=!0){const i=e.config.segment;if(!i)return t();const{analytics:a,filterProperties:c}=(f=>kn(f.register))(u=i)?{analytics:u}:u;var u;(function(f,h,m,x){const v=y=>{const w=()=>y.anonymousId()||ui();f.config.get_device_id=w,x&&y.id()&&(f.register({distinct_id:y.id(),$device_id:w()}),f.persistence.set_property(ts,Df)),m(x?void 0:y.anonymousId()||void 0)},b=h.user();"then"in b&&kn(b.then)?b.then(v):v(b)})(e,a,f=>{a.register(((h,m,{filterProperties:x}={})=>{typeof Promise<"u"&&Promise.resolve||$c.warn("This browser does not have Promise support, and can not use the segment integration");const v=(b,y)=>{if(!y)return b;const w=!!m&&b.event.anonymousId===m&&!b.event.userId;w||b.event.userId||b.event.anonymousId===h.get_distinct_id()||($c.info("No userId set, resetting PostHog"),h.reset()),w||(m=void 0),b.event.userId&&b.event.userId!==h.get_distinct_id()&&($c.info("UserId set, identifying with PostHog"),h.identify(b.event.userId));let j=h.calculateEventProperties(y,b.event.properties);if(!Ve(x)){const N=b.event.properties||{},S={};for(const E of Object.keys(j))bx.call(N,E)||(S[E]=j[E]);const C=((E,L)=>{const O=Fe(E)?E:[E];let R=F({},L);for(const U of O)try{if(R=U(R),Ve(R))return null}catch(D){return $c.error("Error in Segment filterProperties:",D),null}return R})(x,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 v(b,b.event.event)},page(b){return v(b,Tx)},identify(b){return v(b,fk)},screen(b){return v(b,"$screen")}}})(e,f,{filterProperties:c})).then(()=>{t()},h=>{$c.error("Failed to register the Segment integration",h),t()})},n)}const kk="posthog-js";function jk(e,{organization:t,projectId:n,prefix:i,severityAllowList:a=["error"],sendExceptionsToPostHog:c=!0}={}){return u=>{var f,h,m,x,v;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)||[],w=y.map(S=>F(F({},S),{},{stacktrace:S.stacktrace?F(F({},S.stacktrace),{},{type:"raw",frames:(S.stacktrace.frames||[]).map(C=>F(F({},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:w,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((x=y[0])===null||x===void 0?void 0:x.value)||u.message,$sentry_exception_type:(v=y[0])===null||v===void 0?void 0:v.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 pM=class{constructor(e,t,n,i,a,c){this.name=kk,this.setupOnce=function(u){u(jk(e,{organization:t,projectId:n,prefix:i,severityAllowList:a,sendExceptionsToPostHog:c==null||c}))}}},Mw=class{constructor(e){this.jo=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ye.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=te==null?void 0:te.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:x}=a;if(!(ue(c)||ue(u)||ue(f)||ue(h)||ue(m)||ue(x))){c=Math.ceil(c),u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),m=Math.ceil(m),x=Math.ceil(x);const v=c>1?Ri(u/c,0,1,ye):1,b=c>1?Ri(f/c,0,1,ye):1,y=h>1?Ri(m/h,0,1,ye):1,w=h>1?Ri(x/h,0,1,ye):1;i=Dt(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:v,$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:x,$prev_pageview_max_content_percentage:w})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};const Bc=["flags","surveys"],mM={[w6]:{exposure:"hidden"},[Jf]:{exposure:"hidden"},[S6]:{exposure:"hidden"},[M0]:{exposure:"hidden"},[po]:{exposure:"hidden"},[nu]:{exposure:"hidden"},[KS]:{exposure:"event"},[A0]:{exposure:"hidden"},[ZS]:{exposure:"hidden"},[R0]:{exposure:"event"},[WS]:{exposure:"hidden"},[O0]:{exposure:"event"},[L0]:{exposure:"event"},[jx]:{exposure:"event"},[Nx]:{exposure:"hidden"},[JS]:{exposure:"event"},[su]:{exposure:"hidden"},[k6]:{exposure:"hidden"},[oo]:{exposure:"hidden"},[ek]:{exposure:"event"},[j6]:{exposure:"event",shouldSkipFromEventProperties:e=>Zt(e)},[M6]:{exposure:"event"},[A6]:{exposure:"event"},[R6]:{exposure:"event"},[O6]:{exposure:"event"},[L6]:{exposure:"hidden"},[ci]:{exposure:"hidden",storageGroup:"flags"},[cr]:{exposure:"hidden",storageGroup:"flags"},[D0]:{exposure:"hidden"},[el]:{exposure:"hidden",storageGroup:"flags"},[sa]:{exposure:"hidden",storageGroup:"flags"},[tl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[iu]:{exposure:"hidden",storageGroup:"flags"},[Ti]:{exposure:"hidden"},[Wa]:{exposure:"hidden"},[ia]:{exposure:"hidden"},[ra]:{exposure:"hidden"},[z0]:{exposure:"hidden",storageGroup:"surveys"},[eh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[nk]:{exposure:"event"},[sk]:{exposure:"hidden"},[ik]:{exposure:"hidden"},[$0]:{exposure:"hidden"},[D6]:{exposure:"hidden"},[z6]:{exposure:"hidden"},[$6]:{exposure:"event"},[B6]:{exposure:"event"},[P6]:{exposure:"event"},[F6]:{exposure:"event"},[aa]:{exposure:"hidden"},[Xc]:{exposure:"hidden"},[tk]:{exposure:"event"},[vu]:{exposure:"hidden"},[la]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ts]:{exposure:"hidden"},[B0]:{exposure:"hidden"},[U6]:{exposure:"hidden"},[rk]:{exposure:"hidden"},[ak]:{exposure:"hidden"},[co]:{exposure:"hidden"},[Cx]:{exposure:"hidden"},[N6]:{exposure:"event"},[C6]:{exposure:"event"},[E6]:{exposure:"event"},[T6]:{exposure:"event"},[ok]:{exposure:"event"},[ck]:{exposure:"event"},[uk]:{exposure:"event"},[I6]:{exposure:"event"},[H6]:{exposure:"event"},[q6]:{exposure:"event"},[V6]:{exposure:"event"},[G6]:{exposure:"event"},[Y6]:{exposure:"event"},[Q6]:{exposure:"event"},[X6]:{exposure:"event"}},gM=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{const t=mM[e];if(t)return t;for(const[n,i]of gM)if(e.indexOf(n)===0)return i},fo=(e,t)=>{try{let n;return JSON.stringify(e,(i,a)=>{var c;return Tu(a)?((c=n)!==null&&c!==void 0||(n=new WeakMap),n.has(a)||n.set(a,hk(a)),n.get(a)):typeof a=="bigint"?a.toString():a},t)}catch{return W2(e)}},ua=e=>{const t=fe==null?void 0:fe.createElement("a");return ue(t)?null:(t.href=e,t)},_o=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(!Fe(i)||2>i.length)return"";{let a=i[1];try{a=decodeURIComponent(a)}catch{ye.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")}},wu=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 v=0;h.length>v;v++){const b=h[v].split("=");Fe(b)&&(t.includes(b[0])?m.push(b[0]+"="+n):m.push(h[v]))}let x=f;return u!=null&&(x+="?"+m.join("&")),a!=null&&(x+="#"+a),x},ih=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Nk=(e,t)=>e>=t&&K2(),Ck=(e,t,n,i)=>{if(e===0){if(K2()){const a=t+1;return a===n&&i(),a}return t}return 0},wo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],xM=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...wo],Su="<masked>",vM=["li_fat_id"];function Ek(e,t,n){if(!fe)return{};const i=t?[...wo,...n||[]]:[],a=Tk(wu(fe.URL,i,Su),e),c=(function(){const u={};return jt(vM,function(f){const h=nh(f);u[f]=h||null}),u})();return Dt(c,a)}function Tk(e,t){const n=xM.concat(t||[]),i={};return jt(n,function(a){const c=_o(e,a);i[a]=c||null}),i}function Mk(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(!Zt(t)){i.$search_engine=t;const a=fe?_o(fe.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function Ak(){return navigator.language||navigator.userLanguage}function bM(){const e=Ak();return typeof e=="string"?e.split("-")[0]:void 0}const rh="$direct";function Rk(){return(fe==null?void 0:fe.referrer)||rh}function Ok(e,t,n=!1){const i=e?[...wo,...t||[]]:[],a=n?ca(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,c=a==null?void 0:a.substring(0,1e3);return{r:Rk().substring(0,1e3),u:c?wu(c,i,Su):void 0}}function Lk(e,t=!1){var n;const{r:i,u:a}=e,c=t?ca(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==rh?rh:(n=ua(i))===null||n===void 0?void 0:n.host};if(c){u.$current_url=c;const f=ua(c);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;const h=Tk(c);Dt(u,h)}if(i){const f=Mk(i);Dt(u,f)}return u}function Dk(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function yM(){try{return new Date().getTimezoneOffset()}catch{return}}const _M={flags:la,surveys:eh},wM=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],hf=e=>`${e}_cookie_identity_change_pending`,pf=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},vn="main",or=[ci,cr,el,sa,tl,la,iu,ia],Ng=e=>or.indexOf(e)!==-1,zk=[po,nu],Aw=e=>zk.indexOf(e)!==-1,Zr=(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 st(t)?t:{}},Rw=(e,t)=>{jt(e,(n,i)=>{const a=An(i);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var Cg=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.Xo=!1,this.Yo=!1,this.tl=!1,this.el=new Set,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&&ye.info("Persistence loaded",e.persistence,F({},this.props)),this.update_config(e,e,t),this.save(),te){const i=()=>this.flush();yt(te,"beforeunload",i,{capture:!1}),yt(te,"pagehide",i,{capture:!1}),this.ul=a=>{if(this.Vo&&(!a.storageArea||a.storageArea===(te==null?void 0:te.localStorage))&&a.key)if(a.key!==this.rl){if(this.Zo){const c=Bc.find(u=>a.key===this.hl(u));c&&this.cl(a.key,c)}}else this.cl(a.key,vn)},yt(te,"storage",this.ul)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const i=this.Ko.get(t);if(!Ng(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&&te&&(te.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),Zt(a)){const f=this.vl(t);return f.storageValue=null,t!==vn&&(f.persisted=!1),!1}i=Jl(a)}catch{return!1}const c=t===vn?i:ot.Dt(this.rl);if(c&&this.fl(c))return!1;const u=this.pl(i,t,n);return t===vn&&this.Zo&&!Zr(this.gl().main,i)||this.ml(i,t,!0,a),u}fl(e){const t=this.props[oi],n=e[oi];return!ue(t)&&!ue(n)&&t!==n}ml(e,t,n,i){const a=this.vl(t);a.storageValue=i,t!==vn&&(a.persisted=n);try{a.fingerprint=this.yl(e,t)}catch{a.fingerprint=void 0}}pl(e,t,n){let i=!1;return or.forEach(a=>{var c;const u=(c=An(a))===null||c===void 0?void 0:c.storageGroup;if(t===vn&&this.Zo&&u||t!==vn&&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&&Zr(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(vn);let n,i=!1,a=!1;if(e!==t.storageValue)if(Zt(e))t.storageValue=null;else{if(n=Jl(e),this.tl=!this.Yo&&this.fl(n),this.tl)return!1;a=this.pl(n,vn,!1),!this.Zo||Zr(this.gl().main,n)?this.ml(n,vn,!0,e):t.storageValue=e,i=!0}return this.Zo&&Bc.forEach(c=>{const u=ot.Ot(this.hl(c)),f=this.vl(c),h=n||{},m=i&&or.some(v=>{var b;return((b=An(v))===null||b===void 0?void 0:b.storageGroup)===c&&v in h});if(u===f.storageValue&&!m)return;if(Zt(u))return f.storageValue=null,f.persisted=!1,void(m&&(a=this.pl(h,c,!1)||a));const x=Jl(u);a=this.pl(x,c,!1)||a,this.ml(x,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)||vn).fingerprint=void 0,this.Sl(e))}xl(){or.forEach(e=>this.Ko.set(e,!0))}al(){if(this.Vo)try{const e=ot.Ot(this.rl),t=Jl(e);this.vl(vn).storageValue=e,or.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=!Zt(c)}const u=a&&!Zt(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(Fe(t)?t:[]),u=new Set(Fe(this.props[e])?this.props[e]:[]);return n.forEach(f=>u.has(f)?c.add(f):c.delete(f)),Array.from(c)}const i=st(t)?F({},t):{},a=st(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(!Ng(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(!ue(t)&&!Fe(t)||!ue(a)&&!Fe(a)||!Fe(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(x=>{f.has(x)!==m.has(x)&&u.add(x)}),u.forEach(x=>{h.has(x)===m.has(x)&&u.delete(x)})}else{if(!st(n))return void(Zr(a,n)?this.Ko.delete(e):this.dl(e,!0));{if(!ue(t)&&!st(t)||ue(t)&&ms(n)&&ue(a))return void this.dl(e,!0);const f=st(t)?t:{},h=st(a)?a:{};new Set([...Object.keys(f),...Object.keys(n)]).forEach(m=>{m in f==m in n&&Zr(f[m],n[m])||u.add(m)}),u.forEach(m=>{m in h==m in n&&Zr(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 Jt(t)&&t>0?t:0}Tl(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Sg(e,this.Mr.cookie_persisted_properties||[]),n=gw(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),a=Gt.Ot(this.rl)||void 0;a&&kg(this.rl,a)===i&&(this.Il=i,this.Ml=a)}catch{}else try{const t=Gt.Ot(this.rl)||void 0;this.Il=t?kg(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=kg(this.rl,n);let a;try{a=wg(JSON.parse(n))}catch{return!1}if((Gt.Ot(this.rl)||void 0)!==n)return!1;this.Il=i,this.Ml=n;const c=xw(this.rl,n),u=[...Za,...c.properties],f={};if(Object.keys(a).forEach(j=>{const N=a[j];(ue(N)||Zt(N)||N===""||j==="$user_state"&&N!=="anonymous"&&N!=="identified")&&(f[j]=!0,delete a[j])}),ms(a))return!1;const h="distinct_id"in a||a.$user_state==="anonymous"||a.$user_state==="identified",m=this.props,x=m[oi],v=m[ts],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),or.forEach(j=>{const N=j in this.props;j in m===N&&Zr(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(ts,ur);const y=this.props[oi],w=this.props[ts];return!h||y===x&&w===v||(this.Yo=!0,this.Qo=!0,Ot.At(hf(this.rl),!0),this.wl(ia),this.wl(cr),this.wl(ci),this.wl(el),this.wl(sa),this.wl(tl),this.wl(la),this.wl(vu),this.wl(aa),w!=="anonymous"||v!=="identified"&&a.$user_state!=="anonymous"&&(ue(x)||y===x)||(Rw(this.props,a),this.wl(ra)),w==="identified"?this.props.$user_id=y:delete this.props.$user_id,this.wl(Jf)),!0}consumeCookieIdentityChange(){const e=hf(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&&(ue(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[vn],this.Fl(!0))}Ol(e=!0){if(this.Jo)try{e?this.Rl():ue(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){wM.indexOf(e.persistence.toLowerCase())===-1&&(ye.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 F(F({},ot),{},{Dt(m){try{let v,b={};try{v=Gt.Ot(m)||void 0,b=v?wg(JSON.parse(v)):{}}catch{}const y=JSON.parse(ot.Ot(m)||"{}");let w;if(f){const j=xw(m,v),N=[...Za,...j.properties],S={};Object.keys(b).forEach(E=>{const L=b[E];Zt(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 x;const E=y[oi],L=(x=y.$user_state)!==null&&x!==void 0?x:ur;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[ts]=ur),!C||("distinct_id"in S?S[oi]:y[oi])===E&&("$user_state"in S?S[ts]:y[ts])===L||(_g.forEach(O=>delete y[O]),S.$user_state==="identified"&&"distinct_id"in S?y.$user_id=S[oi]:delete y.$user_id,S.$user_state!=="identified"&&(delete y[tk],delete y[ra]),delete y.__alias)}w=Dt(y,S)}else w=Dt(b,y);return ot.At(m,w),w}catch{}return null},At(m,x,v,b,y,w){const j=ot.At(m,x,void 0,void 0,w);try{const N=Sg(x,u);if(Object.keys(N).length){if(f){const S=sh(m),C=gw(N,u);if(Gt.At(S,C,v,b,y,w),Gt.Ot(S)!==JSON.stringify(C)){Gt.Lt(S,b);const E=Sg(x);return Gt.At(m,E,v,b,y,w),j}}Gt.At(m,N,v,b,y,w)}}catch(N){ot.Pt(N)}return j},Lt(m,x){try{te==null||te.localStorage.removeItem(m),Gt.Lt(m,x),Gt.Lt(sh(m),x)}catch(v){ot.Pt(v)}}})})(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=U0:c==="cookie"&&Gt.Et()?(n=Gt,i=!0):t.Et()?(n=t,a=!0,i=!0):Gt.Et()?(n=Gt,i=!0):n=U0,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 jt(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=wg(Gt.Dt(this.rl)),jt(i,(f,h)=>{(ue(f)||Zt(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[oi],h=(c=n==null?void 0:n.$user_state)!==null&&c!==void 0?c:ur,m=a[oi],x=(u=a.$user_state)!==null&&u!==void 0?u:ur;if(m!==f||x!==h){this.Qo=!0,Ot.At(hf(this.rl),!0);const v=Dt({},this.props);_g.forEach(y=>delete v[y]),x!=="anonymous"||h!=="identified"&&i.$user_state!=="anonymous"&&(ue(f)||m===f)||(Rw(v,i),delete v[ra]),this.props=v;const b=new Set;_g.forEach(y=>{var w;const j=(w=An(y))===null||w===void 0?void 0:w.storageGroup;j&&b.add(j)}),b.forEach(y=>{const w={};jt(this.props,(j,N)=>{var S;((S=An(N))===null||S===void 0?void 0:S.storageGroup)===y&&(w[N]=j)}),ms(w)?(ot.Lt(this.hl(y)),this.Wo[y]={}):ot.At(this.hl(y),w)&&(this.Wo[y]={persisted:!0,fingerprint:this.yl(w,y)})})}}Ot.Ot(hf(this.rl))&&(this.Qo=!0)}Dl(){for(const e of Bc){const t=ot.Dt(this.hl(e));if(t&&!ms(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=_M[e];if(!n)return!1;const i=t[n],a=this.props[n];return Jt(i)&&Jt(a)&&a>i}refreshKey(e){var t;if(this.pi||this.el.has(e))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?ue(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},e)):this.Fl()}flush(){ue(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.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||zk.forEach(a=>this.refreshKey(a)));const t=!e&&!this.Xo;t||(this.tl=!1);const n=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&ye.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,vn);i==="written"&&this.Tl(this.props),i!=="failed"&&(this.Ko.clear(),this.Yo=!1,this.el.clear()),n&&this.il.forEach(a=>a())}ql(){const{main:e,groups:t}=this.gl(),n=this.jl(this.Fo,this.rl,e,vn);n==="written"&&this.Tl(e),n!=="failed"&&(this.Yo=!1,this.el.clear(),or.forEach(a=>{var c;!((c=An(a))===null||c===void 0)&&c.storageGroup||this.Ko.delete(a)}));for(const a of Bc){var i;const c=t[a];if(ms(c)&&!(!((i=this.Wo[a])===null||i===void 0)&&i.persisted)){or.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"&&or.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 jt(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===vn)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const n={};return jt(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!==vn&&!a.dirty&&!ue(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!==vn&&(a.persisted=!0),ue(c)||(a.fingerprint=c),this.Vo&&(a.storageValue=ot.Ot(t)),"written"):(this.Mr.debug&&ye.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.xl(),ue(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 Bc)ot.Lt(this.hl(t));e?delete this.Wo[vn]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(st(e)){this.syncCookieProperties(),ue(t)&&(t="None"),this.Bl=ue(n)?this.Ul:n;let i=!1;if(jt(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(st(e)){this.syncCookieProperties(),this.Bl=ue(t)?this.Ul:t;let n=!1;if(jt(e,(i,a)=>{e.hasOwnProperty(a)&&(this.props[a]!==i||st(i)||Fe(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=fe==null?void 0:fe.URL;if(e===this.sl)return;const t=Ek(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),n=!ms(Mx(t));return n&&this.register(t),this.sl=e,n?t:void 0}update_search_keyword(){this.register((function(){const e=fe==null?void 0:fe.referrer;return e?Mk(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Rk(),$referring_domain:(fe==null?void 0:fe.referrer)&&((e=ua(fe.referrer))===null||e===void 0?void 0:e.host)||rh},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Ok(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:pf(e.r),u:e.u?pf(e.u):void 0}:e},void 0)}get_initial_props(){const e={};jt([ak,rk],n=>{const i=this.props[n];i&&jt(i,function(a,c){e["$initial_"+w0(c)]=a})});const t=this.props[co];if(t){const n=(function(i,a=!1){const c=Lk(i,a),u={};return jt(c,function(f,h){u[`$initial_${w0(h)}`]=f}),u})(t,this.Mr.disable_capture_url_hashes);Dt(e,n)}return e}safe_merge(e){return jt(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,w)=>{if(y.length!==w.length)return!1;const j=[...y].sort(),N=[...w].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(F(F({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),h));const m=c||u?this.ol(e):this.Fo;this.Wl();const x=this.ll(e),v=c||x!==this.Zo,b=!f&&(v||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(h);this.Xo=v;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),v){const y=this.props;this.clear(),this.Fo=m,this.Zo=x,this.props=y,this.save()}else u&&(this.Fo=m,f||(delete this.Wo[vn],this.Fl()))}finally{this.Xo=!1,b&&this.Ol()}}Wl(){const e=this.props[co];if(!this.Go||!st(e)||typeof e.r!="string")return;const t=pf(e.r),n=typeof e.u=="string"?pf(e.u):e.u;t===e.r&&n===e.u||this._l(co,F(F({},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(M0,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return ue(n)||(delete t[e],this._l(M0,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.Yo=!0),Aw(e)&&!Zr(a,t)&&this.el.add(e),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&&(Ng(e)&&this.dl(e,!0),Aw(e)&&this.el.add(e),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 Os={GZipJS:"gzip-js",Base64:"base64"},Pc={Activation:"events",Cancellation:"cancelEvents"},Eg={Popover:"popover",API:"api",Widget:"widget"},dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Tg={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},q0={Popover:"popover",Inline:"inline"};function mf(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&kn(n.then)&&n.then(void 0,()=>{})}}}}const SM={SHOWN:"product tour shown"},Ow={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Lw=Xt("[RateLimiter]");var kM=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=>{Lw.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void Lw.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=(Jt(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!Fe(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 Jr=Xt("[RemoteConfig]");var $k=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 Jr.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void Jr.warn("Remote config is disabled. Falling back to local config.");this.Ql(e=>{if(!e)return Jr.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){Jr.error("Error loading remote config",e),this.Kl()}}Kl(e,t){!e&&t&&(t.statusCode===0?t.error||Jr.warn("Failed to fetch remote config from PostHog."):Jr.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(i){Jr.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){Jr.error("Error loading feature flags",i)}}},Qs=Uint8Array,gs=Uint16Array,So=Uint32Array,Dx=new Qs([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]),zx=new Qs([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]),Dw=new Qs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bk=function(e,t){for(var n=new gs(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new So(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]},Pk=Bk(Dx,2),V0=Pk[1];Pk[0][28]=258,V0[258]=28;for(var zw=Bk(zx,0)[1],Fk=new gs(32768),Qt=0;32768>Qt;++Qt){var eo=(43690&Qt)>>>1|(21845&Qt)<<1;Fk[Qt]=((65280&(eo=(61680&(eo=(52428&eo)>>>2|(13107&eo)<<2))>>>4|(3855&eo)<<4))>>>8|(255&eo)<<8)>>>1}var lu=function(e,t,n){for(var i=e.length,a=0,c=new gs(t);i>a;++a)++c[e[a]-1];var u,f=new gs(t);for(a=0;t>a;++a)f[a]=f[a-1]+c[a-1]<<1;for(u=new gs(i),a=0;i>a;++a)u[a]=Fk[f[e[a]-1]++]>>>15-e[a];return u},il=new Qs(288);for(Qt=0;144>Qt;++Qt)il[Qt]=8;for(Qt=144;256>Qt;++Qt)il[Qt]=9;for(Qt=256;280>Qt;++Qt)il[Qt]=7;for(Qt=280;288>Qt;++Qt)il[Qt]=8;var ah=new Qs(32);for(Qt=0;32>Qt;++Qt)ah[Qt]=5;var jM=lu(il,9),NM=lu(ah,5),Uk=function(e){return(e/8|0)+(7&e&&1)},Ik=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof gs?gs:e instanceof So?So:Qs)(n-t);return i.set(e.subarray(t,n)),i},sr=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Fc=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Mg=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 Qs(0),0];if(a==1){var u=new Qs(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,x=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};x!=a-1;)f=n[n[v].f>n[m].f?m++:v++],h=n[m!=x&&n[v].f>n[m].f?m++:v++],n[x++]={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 gs(b+1),w=G0(n[x-1],y,0);if(w>t){i=0;var j=0,N=w-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<<w-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)}w=t}return[new Qs(y),w]},G0=function(e,t,n){return e.s==-1?Math.max(G0(e.l,t,n+1),G0(e.r,t,n+1)):t[e.s]=n},$w=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new gs(++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]},Uc=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},Y0=function(e,t,n){var i=n.length,a=Uk(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)},Bw=function(e,t,n,i,a,c,u,f,h,m,x){sr(t,x++,n),++a[256];for(var v=Mg(a,15),b=v[0],y=v[1],w=Mg(c,15),j=w[0],N=w[1],S=$w(b),C=S[0],E=S[1],L=$w(j),O=L[0],R=L[1],U=new gs(19),D=0;C.length>D;++D)U[31&C[D]]++;for(D=0;O.length>D;++D)U[31&O[D]]++;for(var X=Mg(U,7),P=X[0],Q=X[1],A=19;A>4&&!P[Dw[A-1]];--A);var de,K,q,H,I=m+5<<3,re=Uc(a,il)+Uc(c,ah)+u,ve=Uc(a,b)+Uc(c,j)+u+14+3*A+Uc(U,P)+(2*U[16]+3*U[17]+7*U[18]);if(re>=I&&ve>=I)return Y0(t,x,e.subarray(h,h+m));if(sr(t,x,1+(re>ve)),x+=2,re>ve){de=lu(b,y),K=b,q=lu(j,N),H=j;var M=lu(P,Q);for(sr(t,x,E-257),sr(t,x+5,R-1),sr(t,x+10,A-4),x+=14,D=0;A>D;++D)sr(t,x+3*D,P[Dw[D]]);x+=3*A;for(var Ee=[C,O],Ae=0;2>Ae;++Ae){var z=Ee[Ae];for(D=0;z.length>D;++D)sr(t,x,M[B=31&z[D]]),x+=P[B],B>15&&(sr(t,x,z[D]>>>5&127),x+=z[D]>>>12)}}else de=jM,K=il,q=NM,H=ah;for(D=0;f>D;++D)if(i[D]>255){var B;Fc(t,x,de[257+(B=i[D]>>>18&31)]),x+=K[B+257],B>7&&(sr(t,x,i[D]>>>23&31),x+=Dx[B]);var oe=31&i[D];Fc(t,x,q[oe]),x+=H[oe],oe>3&&(Fc(t,x,i[D]>>>5&8191),x+=zx[oe])}else Fc(t,x,de[i[D]]),x+=K[i[D]];return Fc(t,x,de[256]),x+K[256]},CM=new So([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),EM=(function(){for(var e=new So(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Ag=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function TM(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(b){for(var y=v,w=0;b.length>w;++w)y=EM[255&y^b[w]]^y>>>8;v=y},d(){return 4294967295^v}}})(),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(v,b,y,w,j,N){var S=v.length,C=new Qs(w+S+5*(1+Math.floor(S/7e3))+j),E=C.subarray(w,C.length-j),L=0;if(!b||8>S)for(var O=0;S>=O;O+=65535){var R=O+65535;S>R?L=Y0(E,L,v.subarray(O,R)):(E[O]=N,L=Y0(E,L,v.subarray(O,S)))}else{for(var U=CM[b-1],D=U>>>13,X=8191&U,P=(1<<y)-1,Q=new gs(32768),A=new gs(P+1),de=Math.ceil(y/3),K=2*de,q=function(Qe){return(v[Qe]^v[Qe+1]<<de^v[Qe+2]<<K)&P},H=new So(25e3),I=new gs(288),re=new gs(32),ve=0,M=0,Ee=(O=0,0),Ae=0,z=0;S>O;++O){var B=q(O),oe=32767&O,_e=A[B];if(Q[oe]=_e,A[B]=oe,O>=Ae){var Ne=S-O;if((ve>7e3||Ee>24576)&&Ne>423){L=Bw(v,E,0,H,I,re,M,Ee,z,O-z,L),Ee=ve=M=0,z=O;for(var Me=0;286>Me;++Me)I[Me]=0;for(Me=0;30>Me;++Me)re[Me]=0}var Le=2,De=0,Ce=X,Re=oe-_e&32767;if(Ne>2&&B==q(O-Re))for(var Ft=Math.min(D,Ne)-1,Kt=Math.min(32767,O),Ut=Math.min(258,Ne);Kt>=Re&&--Ce&&oe!=_e;){if(v[O+Le]==v[O+Le-Re]){for(var Nt=0;Ut>Nt&&v[O+Nt]==v[O+Nt-Re];++Nt);if(Nt>Le){if(Le=Nt,De=Re,Nt>Ft)break;var wt=Math.min(Re,Nt-2),Xe=0;for(Me=0;wt>Me;++Me){var St=O-Re+Me+32768&32767,nn=St-Q[St]+32768&32767;nn>Xe&&(Xe=nn,_e=St)}}}Re+=(oe=_e)-(_e=Q[oe])+32768&32767}if(De){H[Ee++]=268435456|V0[Le]<<18|zw[De];var se=31&V0[Le],je=31&zw[De];M+=Dx[se]+zx[je],++I[257+se],++re[je],Ae=O+Le,++ve}else H[Ee++]=v[O],++I[v[O]]}}L=Bw(v,E,N,H,I,re,M,Ee,z,O-z,L)}return Ik(C,0,w+Uk(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)),x=m.length;return(function(v,b){var y=b.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>b.level?4:b.level==9?2:0,v[9]=3,b.mtime!=0&&Ag(v,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){v[3]=8;for(var w=0;y.length>=w;++w)v[w+10]=y.charCodeAt(w)}})(m,t),Ag(m,x-8,n.d()),Ag(m,x-4,i),m}const MM=!!vx||!!gu,Hk=new WeakMap,qk="text/plain";let Rg=0,$f=!1;const Vk=(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}`:""}`},Au=(e,t,n=!0)=>{var i;const[a,c]=e.split("?"),u=F({},t),f=(i=c==null?void 0:c.split("&").map(m=>{var x;const[v,b]=m.split("="),y=n&&(x=u[v])!==null&&x!==void 0?x:b;return delete u[v],`${v}=${y}`}))!==null&&i!==void 0?i:[],h=(function(m,x="&"){let v,b;const y=[];return jt(m,function(w,j){ue(w)||ue(j)||j==="undefined"||(v=encodeURIComponent((N=>N instanceof File)(w)?w.name:w.toString()),b=encodeURIComponent(j),y[y.length]=b+"="+v)}),y.join(x)})(u);return h&&f.push(h),f.length>0?`${a}?${f.join("&")}`:a},Og=e=>{if(e.Yl)return e.Yl;const{data:t,compression:n}=e;if(!t)return;if(n===Os.GZipJS){const a=TM((function(c){var u=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var f=new Qs(c.length+(c.length>>>1)),h=0,m=function(y){f[h++]=y},x=0;u>x;++x){if(h+5>f.length){var v=new Qs(h+8+(u-x<<1));v.set(f),f=v}var b=c.charCodeAt(x);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(++x))>>>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 Ik(f,0,h)})(fo(t)),{mtime:0});return{contentType:qk,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Os.Base64){const a=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(f,h)=>String.fromCharCode(parseInt(h,16))))})(fo(t)),c=(u=>"data="+encodeURIComponent(typeof u=="string"?u:fo(u)))(a);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}const i=fo(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},Gk=e=>{const t=()=>e.transport==="sendBeacon"?{url:Au(e.url,{compression:Os.Base64}),encodedBody:Og(F(F({},e),{},{compression:Os.Base64,Yl:void 0}))}:{url:Vk(e.url,"compression"),encodedBody:Og(F(F({},e),{},{compression:void 0,Yl:void 0}))};let n;try{n=Og(e)}catch(a){if(iw(e.compression,_o(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),t();throw a}return n&&iw(e.compression,_o(e.url,"compression"))&&!((i=n.body)instanceof ArrayBuffer?E0(new Uint8Array(i)):ArrayBuffer.isView(i)&&E0(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?($f=!0,t()):{url:e.url,encodedBody:n};var i},Yk=e=>{try{return Gk(e)}catch(n){var t;return ye.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},AM=(function(){var e=zt(function*(t){const n=yield(function(a){return T0.apply(this,arguments)})(fo(t.data),yn.DEBUG,{rethrow:!0});if(!n)return t;const i=yield n.arrayBuffer();return F(F({},t),{},{Yl:{contentType:qk,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),RM=/Failed to fetch|NetworkError|Load failed/i,Qk=e=>(e==null?void 0:e.name)==="TypeError"&&RM.test((e==null?void 0:e.message)||""),Xk=e=>{try{const t=(function(n,i=Date.now()){if(typeof n!="string"||!n)return;const a=n.trim(),c=/^\d+\s*,/.test(a)?a.slice(0,a.indexOf(",")).trim():a;if(/^\d+$/.test(c)){const h=1e3*Math.min(Number(c),300);return h>0?h:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(c))return;const u=/^\w{3} \w{3} /.test(c)?c+" GMT":c,f=Date.parse(u)-i;return Number.isFinite(f)&&f>0?Math.min(f,Lf):void 0})(e());return ue(t)?void 0:Math.min(t,3e4)}catch{return}},Kk=e=>{const t=Yk(e);if(!t)return;const n=new vx;Hk.set(n,!0);const{url:i,encodedBody:a}=t;n.open(e.method||"GET",i,!0);const{contentType:c,body:u}=a??{};jt(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,Xk(()=>n.getResponseHeader("Retry-After")))}},n.send(u)},Wk=e=>{const t=Yk(e);if(!t)return;const{url:n,encodedBody:i}=t,{contentType:a,body:c,estimatedSize:u}=i??{},f=new Headers;jt(e.headers,function(y,w){f.append(w,y)}),a&&f.append("Content-Type",a);let h=null,m=!1;if(H_){const y=new H_;h={signal:y.signal,timeout:setTimeout(()=>{var w;m=!0,y.abort(AS("AbortError","PostHog request timed out"+((w=e.timeout)?` after ${w}ms`:"")))},e.timeout)}}const x=y=>{var w;m&&(y==null?void 0:y.name)==="AbortError"||Qk(y)?ye.warn(y):ye.error(y),(w=e.callback)===null||w===void 0||w.call(e,{statusCode:0,error:y})};let v=0;const b=()=>{Rg-=v,v=0,h&&clearTimeout(h.timeout)};try{const y=F({method:(e==null?void 0:e.method)||"GET",headers:f,referrerPolicy:"strict-origin",body:c,signal:h==null?void 0:h.signal},e.fetchOptions),w=u??(ue(c)?0:void 0);y.keepalive=y.method==="POST"&&!e.ta&&y.keepalive!==!1&&y.body===c&&!ue(w)&&w>=0&&52428.8>Rg+w,y.keepalive&&(v=w,Rg+=v),gu(n,y).then(j=>j.text().then(N=>{var S;const C={statusCode:j.status,text:N};if(j.status===200)try{C.json=JSON.parse(N)}catch(E){ye.error(E)}b(),(S=e.callback)===null||S===void 0||S.call(e,C,Xk(()=>j.headers.get("Retry-After")))})).catch(j=>{b(),x(j)}).finally(b)}catch(y){b(),x(y)}},Q0=e=>{try{var t;const{url:n,encodedBody:i}=Gk(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=Fe(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Fe(h)&&h.length>1&&(u??0)>16384){const m=Math.ceil(h.length/2),x=v=>Fe(e.data)?v:F(F({},e.data),{},{batch:v});return Q0(F(F({},e),{},{data:x(h.slice(0,m))})),void Q0(F(F({},e),{},{data:x(h.slice(m))}))}ye.warn(`Beacon of ~${u??0} bytes was rejected by the browser, falling back to ${gu?"fetch":"XHR"}`),gu?Wk(F(F({},e),{},{ta:!0})):Kk(e)}catch(n){ye.warn("Beacon send failed",n)}},Pw=(e,t,n,i)=>{const a=i==="query"?t==="POST"?"sent_at":"_":void 0;return Au(n===Os.GZipJS?Vk(e,"compression"):e,F(F({},a?{[a]:Date.now().toString()}:{}),n===Os.GZipJS?{}:{compression:n}))},OM=(()=>{const e=[];return gu&&e.push({transport:"fetch",method:Wk}),vx&&e.push({transport:"XHR",method:Kk}),jn!=null&&jn.sendBeacon&&e.push({transport:"sendBeacon",method:Q0}),e})();let Zk=!MM&&(es==null?void 0:es.indexOf("MSIE"))===-1&&(es==null?void 0:es.indexOf("Mozilla"))===-1;function Jk(e,t,n){var i,a,c;n&&(t=F(F({},t),{},{callback:u=>n(u)})),e.__loaded?Zk?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((a=t.callback)===null||a===void 0||a.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=F(F({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(i=e.compression)!==null&&i!==void 0?i:t.compressionFallback:t.compression,(ue(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((u,f)=>{var h,m,x;const v=F(F({},u),{},{callback:f??(N=>{var S;return(S=u.callback)===null||S===void 0?void 0:S.call(u,N)})});v.timeout=v.timeout||6e4;const b=(h=v.transport)!==null&&h!==void 0?h:"fetch";b==="sendBeacon"&&ue(v.compression)&&v.data&&(v.compression=Os.Base64),v.method==="POST"&&v.data&&(v.timestampMode==="capture-body"?v.data=(N=>{var S,C;const E=(Fe(N)?N:[N]).map(O=>F(F({},O),O.timestamp instanceof Date&&!isNaN(O.timestamp.getTime())?{timestamp:O.timestamp.toISOString()}:{})),L=E[0];return{api_key:(S=L==null||(C=L.properties)===null||C===void 0?void 0:C.token)!==null&&S!==void 0?S:L==null?void 0:L.token,batch:E,sent_at:new Date().toISOString()}})(v.data):v.timestampMode==="body"&&(v.data=((N,S=new Date().toISOString())=>Fe(N)?N.map(C=>F(F({},C),{},{sent_at:S})):F(F({},N),{},{sent_at:S}))(v.data))),v.url=Pw(v.url,v.method,v.compression,v.timestampMode);const y=OM.filter(N=>!v.disableTransport||!N.transport||!v.disableTransport.includes(N.transport)),w=(m=(x=(function(N,S){for(let C=0;N.length>C;C++)if(S(N[C]))return N[C]})(y,N=>N.transport===b))===null||x===void 0?void 0:x.method)!==null&&m!==void 0?m:y[0].method;if(!w)throw new Error("No available transport method");const j=N=>{try{w(N)}catch(C){var S;Qk(C)?ye.warn(C):ye.error(C),(S=v.callback)===null||S===void 0||S.call(v,{statusCode:0,error:C})}};b!=="sendBeacon"&&v.data&&v.compression===Os.GZipJS&&gT&&typeof Promise<"u"&&!$f?AM(v).then(N=>{j(N)}).catch(N=>{if(rw(N))return $f=!0,void j(F(F({},v),{},{compression:void 0,url:Pw(u.url,u.method,void 0,u.timestampMode)}));(S=>{if(!S||typeof S!="object")return!1;const C="name"in S?String(S.name):"";return rw(S)||C===BS})(N)&&($f=!0),j(v)}):w(v)})(t,(u,f)=>{var h,m,x;e.rateLimiter.checkForLimiting(u),400>u.statusCode||(h=(m=e.config).on_request_error)===null||h===void 0||h.call(m,u),n?n(u,f):(x=t.callback)===null||x===void 0||x.call(t,u)})):t.fireCallbackOnDrop&&((c=t.callback)===null||c===void 0||c.call(t,{statusCode:0}))}var LM=class{constructor(e,t){this.ea=!0,this.ia=[],this.na=Ri((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,ye.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(n,"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)this.ua(e[t])}},this.na))}ua(e,t){try{this.sa(e,t)}catch(n){ye.error(n)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const e={};return jt(this.ia,t=>{var n;const i=t,a=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");ue(e[a])&&(e[a]=F(F({},i),{},{data:[]})),(n=e[a].data)===null||n===void 0||n.push(i.data)}),this.ia=[],e}};const DM=["retriesPerformedSoFar"];var zM=class{constructor(e){this._instance=e,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!ue(te)&&"onLine"in te.navigator){if(this.da=te.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},yt(te,"online",this.va),yt(te,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,i=PS(e,DM);lr(n)&&(i.url=Au(i.url,{retry_count:n})),Jk(this._instance,t?F(F({},i),{},{transport:t}):i,(a,c)=>{var u;if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.Ls(F({retriesPerformedSoFar:n},i),c);a.statusCode===0&&ye.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${n??0} retries.`)}(u=i.callback)===null||u===void 0||u.call(i,a)})}Ls(e,t){const n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;const i=Math.max((function(u){const f=3e3*Math.pow(2,u),h=f/2,m=Math.min(18e5,f),x=(Math.random()-.5)*(m-h);return Math.ceil(m+x)})(n),t??0),a=Date.now()+i;this.ia.push({retryAt:a,requestOptions:e});let c=`Enqueued failed request for retry in ${i}`;navigator.onLine||(c+=" (Browser is offline)"),ye.warn(c),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,ue(te)||(this.va&&(te.removeEventListener("online",this.va),this.va=void 0),this.pa&&(te.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:e}of this.ia)try{this._instance._send_request(F(F({},e),{},{transport:"sendBeacon"}))}catch(t){ye.error(t)}this.ia=[]}},$M=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 this.ba=void 0,setTimeout(this.ya,0),e}startMeasuringScrollPosition(){yt(te,"scroll",this.ya,{capture:!0}),yt(te,"scrollend",this.ya,{capture:!0}),yt(te,"resize",this.ya)}scrollElement(){if(this._a){const n=Fe(this._a)?this._a:[this._a];for(const i of n){var e;const a=te==null||(e=te.document)===null||e===void 0?void 0:e.querySelector(i);if(a)return a}return}var t;return te==null||(t=te.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 te?e==="y"?te.scrollY||te.pageYOffset||((t=te.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:te.scrollX||te.pageXOffset||((n=te.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 BM=e=>Ok(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 Fw=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({[B0]:u})},this._instance=e,this.Ca=t,this.xa=n,this.Sa=i||BM,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[B0]}getSetOnceProps(){var e;const t=(e=this.ka())===null||e===void 0?void 0:e.props;return t?"r"in t?Lk(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 jt(Mx(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${w0(n)}`]=t}),e}},lh=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=Xt("[SessionId]"),Uw=864e5;var Iw=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 lh,this.Aa=(c,u)=>!(!lr(c)||!lr(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||ui,this.Da=n||ui;const a=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ri(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 ue(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!Zt(t)&&!Zt(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 lr(t)&&t>0}Ga(){this.Va()?this.xa.refreshKey(oo):(this.xa.flush(),this.xa.load())}Za(){var e;if(Zt(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=lr(e)?e:0,n=lr(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 Fe(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=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!ue(n)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:n}:this.Wa(e,new Date().getTime(),n),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&te&&(te.removeEventListener(th,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Ot.Lt(this.qa)},yt(te,th,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(Zt(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=!ue(a)&&f!==a,x=this.Ja();let v=this.za();const b=this.Fa,y=!!b&&(b.sessionStartTimestamp>i+6e4||i-b.sessionStartTimestamp>Uw),w=b?y:lr(h)&&Math.abs(i-h)>Uw;let j=!1,N=m;const S=!f||!!b,C=f;let E=!S&&!e&&this.Aa(i,x);if(E&&(E=this.Ka(i),E||to.info("cross-tab refresh kept the session alive",{sessionId:f}),[,f,h]=this.Qa()),S||E||w){N=!1;const U=b&&!y;f=U?b.sessionId:this.Oa(),v=this.Da(),to.info("new session ID assigned",{sessionId:f,windowId:v,bootstrapped:!!U,changeReason:{noSessionId:S,activityTimeout:E,sessionPastMaximumLength:w}}),h=U?b.sessionStartTimestamp:i,this.Fa=void 0,j=!0}else v||(v=this.Da(),j=!0),N=N||f!==C,N&&(to.info("adopted cross-tab session id",{sessionId:f,windowId:v}),j=!0);const L=lr(x)&&e&&!w?x:i,O=lr(h)?h:new Date().getTime();this.Ha(v),this.Wa(f,L,O),e||this.La();const R={noSessionId:S,activityTimeout:E,sessionPastMaximumLength:w,crossTabAdoption:N};return j&&this.Ea.forEach(U=>U(f,v,R)),{sessionId:f,windowId:v,sessionStartTimestamp:O,changeReason:j?R:void 0,lastActivityTimestamp:x}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=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 ej=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&V_(n,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(a=>V_(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver};function tj(){return(tj=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 Je(n)&&n.length>0?n:void 0}catch(t){return void ye.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function PM(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 nj(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 oh=(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}},gf=e=>e.toLowerCase(),sj={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=>oh(n,i))),not_regex:(e,t)=>t.every(n=>e.every(i=>!oh(n,i))),icontains:(e,t)=>t.map(gf).some(n=>e.map(gf).some(i=>n.includes(i))),not_icontains:(e,t)=>t.map(gf).every(n=>e.map(gf).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 ij(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=sj[i.operator];return!!c&&c(i.values,[String(a)])})}function Lg(e,t,n){return fo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const X0="custom",Hw="i.posthog.com",FM=/^\/static\//,UM=["/s/","/e/","/i/"];var IM=class{constructor(e){this.Ya={},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(`.${Hw}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ya[this.apiHost]||(this.Ya[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":X0),this.Ya[this.apiHost]}tu(e){if(!FM.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}eu(e){const t=ua(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=ua(n))===null||c===void 0?void 0:c.href)||n;i=a(new URL(u)).toString()}if(a&&e==="api"&&UM.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===X0)return this.iu(e,t,this.apiHost+t);const n=Hw+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=Xt("[Surveys]"),rj=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)}},HM=[Eg.Popover,Eg.Widget,Eg.API],qM={ignoreConditions:!1,ignoreDelay:!1,displayType:q0.Popover},VM=Xt("[PostHog ExternalIntegrations]"),GM={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var YM=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 VM.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(GM[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())}}},QM=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&&kn(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)}}},XM=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);ue(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 qw="extensionsRemoteConfig";var KM=class{constructor(e){this.instance=e,this.So=!1,this.$=ye,this.ou=e.lu,this.kv=new XM(e),this.onEvent=t=>mf(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 mf(()=>{});const n=a=>{try{t(a)}catch(c){this.$.error("Browser extension remote config listener failed",c)}},i=this.instance.au.on(qw,n);return this.ou&&n(this.ou),mf(i)},this.uu=new QM(ye.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(kx);return typeof e=="string"?e:void 0}get library(){return{name:yn.LIB_NAME,version:yn.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 mf(this.instance.hu(e))}handleRemoteConfig(e){this.So||(this.ou=e,this.instance.au.emit(qw,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?Au(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"?_0.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 ou={};let Dg=0;const cu=()=>{},Vw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ic="Surveys module not available",Gw="sanitize_properties is deprecated. Use before_send instead",aj="Invalid value for property_denylist config: ",WM=/^[A-Za-z0-9_-]{1,400}$/,Yw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Qw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,ZM=["token","distinct_id",lk],Kc="posthog",JM=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},zg=e=>{var t;return F({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Z6(fe==null?void 0:fe.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:cu,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&&Je(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:(te==null||(t=te.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){ye.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:dk,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:cu},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:aM,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:JM(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))},eA=[["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"]],Xw=e=>{const t={};for(const[a,c]of eA)ue(e[a])||(t[c]=e[a]);const n=Dt({},t,e),i=e.__preview_external_dependency_versioned_paths;return ue(i)||(ue(e.strict_script_versioning)&&(n.strict_script_versioning=!!i),Je(i)&&ue(e.asset_host)&&(n.asset_host=i)),Fe(e.property_blacklist)&&(ue(e.property_denylist)?n.property_denylist=e.property_blacklist:Fe(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(aj+e.property_denylist)),n};var tA=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(e){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},uu=class na{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(ui());this.register({distinct_id:i,$device_id:i}),t.set_property(ts,ur)}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 tA,this.Su=!1,this.version=yn.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new lh,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zg(),this.SentryIntegration=pM,this.sentryIntegration=i=>(function(a,c){const u=jk(a,c);return{name:kk,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 $M(this),this.pageViewManager=new Mw(this),this.rateLimiter=new kM(this),this.requestRouter=new IM(this),this.consent=new rM(this),this.externalIntegrations=new YM(this);const n=(t=na.__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=Je(i)?{[i]:a}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,a,c)=>{const u=Je(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",i=>ye.info(`send "${i==null?void 0:i.event}"`,i))}init(t,n,i){if(i&&i!==Kc){var a;const c=(a=ou[i])!==null&&a!==void 0?a:new na;return c._init(t,n,i),ou[i]=c,ou[Kc][i]=c,c}return this._init(t,n,i)}_init(t,n={},i){var a,c,u;const f=Je(t)?t.trim():"";if(!f)return ye.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;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=zg(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=zg(n.defaults),x=Xw(n),v=Dt({},m,x,{name:i,token:f});st(m.rageclick)&&st(x.rageclick)&&(v.rageclick=Dt({},m.rageclick,x.rageclick)),st(m.session_recording)&&st(x.session_recording)&&(v.session_recording=Dt({},m.session_recording,x.session_recording)),this.set_config(v),this.config.on_xhr_error&&ye.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Os.GZipJS;const b=this.bu();if(this.persistence=new Cg(this.config,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Cg(F(F({},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);Fe(S)&&S.forEach(C=>{Je(C)&&this.xu.add(C)})}else Ot.Lt(this.Cu);const y=F({},this.persistence.props),w=F({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Fu=new LM((S,C)=>this.Ou(S,C),this.config.request_queue_config),this.Du=new zM(this),this.__request_queue=[];const j=this.fu();j||(this.sessionManager=new Iw(this),this.sessionPropsManager=new Fw(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?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(j)},0)):(ye.info("Initializing extensions synchronously"),this.qu(j)),yn.DEBUG=yn.DEBUG||this.config.debug,yn.DEBUG&&ye.info("Starting in debug mode",{this:this,config:n,thisC:F({},this.config),p:y,s:w}),this.config.identity_distinct_id&&!(!((a=n.bootstrap)===null||a===void 0)&&a.distinctID)&&(n.bootstrap=F(F({},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&&!eu(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(ts);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==S&&E==="anonymous")this.identify(S);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==S&&E==="identified")ye.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const L=this.config.get_device_id(ui()),O=n.bootstrap.isIdentifiedID?L:S;this.persistence.set_property(ts,n.bootstrap.isIdentifiedID?Df:ur),this.register({distinct_id:S,$device_id:O})}}if(j)this.register_once({distinct_id:bg,$device_id:null},"");else if(!this.get_distinct_id()){const S=this.config.get_device_id(ui());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(ts,ur)}return yt(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),yt(te,"pageshow",()=>{var S;this.wu=!1,this.ku||(S=this.Du)===null||S===void 0||S.resume()}),n.segment?Tw(this,()=>this.ju()):this.ju(),kn(this.config._onCapture)&&this.config._onCapture!==cu&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&ye.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return tj.apply(this,arguments)})().then(S=>{S&&this.register({[vg]:S})}).catch(cu),this}Bu(t){const n=t;return Je(n.name)&&kn(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=>{ye.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=na.__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)),kn(this.featureFlags.onReloading)&&kn(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=F(F({},na.__defaultExtensionClasses),this.config.__extensionClasses),a=[];var c,u,f,h,m,x,v;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,hM)),i.toolbar&&this.su.push(this.toolbar=(x=this.toolbar)!==null&&x!==void 0?x:new i.toolbar(this)),i.experiments&&this.su.push(this.experiments=(v=this.experiments)!==null&&v!==void 0?v: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 w;return(w=y.onRemoteConfig)===null||w===void 0?void 0:w.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){ye.error("Error initializing extension:",c)}}const i=Math.round(performance.now()-n);this.register_for_session({[ok]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ck]:i}),this.config.__preview_deferred_init_extensions&&ye.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var n;if(!fe||!fe.body)return ye.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,Os.GZipJS)?Os.GZipJS:Ie(a.supportedCompression,Os.Base64)?Os.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:dk}),(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){ye.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 $k(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()&&uo(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(hw),(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(hw,null,{transport:"sendBeacon"})}_send_request(t){Jk(this,t)}Ou(t,n){this.Du?this.Du.retriableRequest(t,n):this._send_request(n?F(F({},t),{},{transport:n}):t)}_execute_array(t){Dg++;try{let n;const i=[],a=[],c=[];uo(t,f=>{if(f)if(n=f[0],Fe(n))c.push(f);else if(kn(f))try{f.call(this)}catch(h){ye.error("Error executing queued PostHog call",f,h)}else Fe(f)&&n==="alias"?i.push(f):Fe(f)&&n.indexOf("capture")!==-1&&kn(this[n])?c.push(f):a.push(f)});const u=function(f,h){uo(f,function(m){try{if(Fe(m[0])){let x=h;jt(m,function(v){x=x[v[0]].apply(x,v.slice(1))})}else h[m[0]].apply(h,m.slice(1))}catch(x){ye.error("Error executing queued PostHog call",m,x)}})};u(i,this),u(a,this),u(c,this)}finally{Dg--}}push(t){if(Dg>0&&Fe(t)&&Je(t[0])){const n=na.prototype[t[0]];return void(kn(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}get Xu(){return{property:dw,persistenceKey:po,cookieName:"_fbc",pattern:Yw,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[po]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(po)}}}get Yu(){return{property:fw,persistenceKey:nu,cookieName:"_fbp",pattern:Qw,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[nu]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(nu)}}}th(t){var n;const i=(n=this.persistence)===null||n===void 0?void 0:n.get_property(t.persistenceKey);return Je(i)&&t.pattern.test(i)?{value:i,delivered:!1}:st(i)&&Je(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:i.delivered===!0}:void 0}eh(t,n,i){return n===(i==null?void 0:i.value)?{value:n,pending:!i.delivered}:(t.register(n,!1),{value:n,pending:!0})}ih(t){if(!this.config.save_campaign_params||this.fu())return;const n=nh(t.cookieName);return Je(n)&&t.pattern.test(n)?n:void 0}nh(t,n,i,a){if(!this.persistence)return;const c=this.Xu;this.persistence.refreshKey(c.persistenceKey);const u=this.th(c);if(a)return void c.unregister();if(i)return Je(n)&&Yw.test(n)?this.eh(c,n,u):void c.unregister();const f=Je(t)&&WM.test(t)?t:void 0,h=this.ih(c);return h&&((m,x,v)=>{const b=m.split(".");if(x)return b[3]===x;if(!v)return!0;const y=v.value.split(".");return b[3]===y[3]||Number(b[2])>Number(y[2])})(h,f,u)?this.eh(c,h,u):f?(u==null?void 0:u.value.split(".")[3])===f?{value:u.value,pending:!u.delivered}:this.eh(c,`fb.1.${Date.now()}.${f}`,u):u?{value:u.value,pending:!u.delivered}:void 0}sh(t,n,i){if(!this.persistence)return;const a=this.Yu;this.persistence.refreshKey(a.persistenceKey);const c=this.th(a);if(i)return void a.unregister();if(n)return Je(t)&&Qw.test(t)?this.eh(a,t,c):void a.unregister();const u=this.ih(a);return u?this.eh(a,u,c):c?{value:c.value,pending:!c.delivered}:void 0}rh(t,n){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.th(t);(i==null?void 0:i.value)!==n||i.delivered||t.register(n,!0)}capture(t,n,i){var a,c;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void ye.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(ue(t)||!Je(t))return void ye.error("No event name provided to posthog.capture");this.yu();const u=!this.config.opt_out_useragent_filter&&this._is_bot();if(u&&!this.config.__preview_capture_bot_pageviews)return;const f=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(f!=null&&f.isRateLimited)return void ye.critical("This capture call is ignored due to client rate limiting.");let h;n!=null&&n.$current_url&&!Je(n==null?void 0:n.$current_url)&&(ye.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||i!=null&&i.oh||ye.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(h=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 m=new Date,x=(i==null?void 0:i.timestamp)||m,v=X_(i==null?void 0:i.uuid,ui);let b={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},x,v)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&u&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),f&&(b.properties.$lib_rate_limit_remaining_tokens=f.remainingTokens);const y=t==="$feature_flag_called"&&b.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i!=null&&i.$set&&!y&&(b.$set=i==null?void 0:i.$set);const w=st(n==null?void 0:n.$set)?n.$set:void 0,j=Fe(n==null?void 0:n.$unset)?n.$unset:[],N=(i==null?void 0:i.$unset)||[],S=K=>{var q;const H=!!(i!=null&&i.$set)&&K in i.$set;return{hasProvided:H||!!w&&K in w,provided:H?i==null||(q=i.$set)===null||q===void 0?void 0:q[K]:w==null?void 0:w[K],unset:j.indexOf(K)!==-1||N.indexOf(K)!==-1}},C=S(dw),E=S(fw),L=[{channel:this.Xu,hasProvided:C.hasProvided,update:this.nh(h==null?void 0:h.fbclid,C.provided,C.hasProvided,C.unset)},{channel:this.Yu,hasProvided:E.hasProvided,update:this.sh(E.provided,E.hasProvided,E.unset)}];for(const{channel:K,hasProvided:q,update:H}of L)H&&b.properties.$process_person_profile===!0&&H.pending&&!q&&!y&&(b.$set=F({[K.property]:H.value},b.$set));const O=i==null?void 0:i.$unset;O&&(b.$unset=O);const R=y?void 0:this.ah(i==null?void 0:i.$set_once,t!==pw,t===fk);if(R&&(b.$set_once=R),i!=null&&i._noTruncate||(U=this.config.properties_string_max_length,b=(function(K,q){const H=new Set;return(function I(re,ve){if(re!==Object(re))return q?q(re):re;if(H.has(re))return;let M;if(H.add(re),Fe(re))M=[],uo(re,Ee=>{M.push(I(Ee))});else{const Ee={};jt(Tu(re)?hk(re):re,(Ae,z)=>{H.has(Ae)||(Ee[z]=I(Ae))}),M=Ee}return M})(K)})(b,K=>Je(K)?K.slice(0,U):K)),b.timestamp=x,ue(i==null?void 0:i.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=m),y&&(b.properties=((K,q=[])=>{const H={},I=re=>{K[re]!==void 0&&(H[re]=K[re])};return d6.forEach(I),q.forEach(I),H})(b.properties,ZM)),t===dr.DISMISSED||t===dr.SENT){const K=n==null?void 0:n[Tg.SURVEY_ID],q=n==null?void 0:n[Tg.SURVEY_ITERATION];rj({id:K,current_iteration:q}),b.$set=F(F({},b.$set),{},{[PM({id:K,current_iteration:q},t===dr.SENT?"responded":"dismissed")]:!0})}else t===dr.SHOWN&&(b.$set=F(F({},b.$set),{},{[Tg.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var U;if(t===SM.SHOWN){const K=n==null?void 0:n[Ow.TOUR_TYPE];K&&(b.$set=F(F({},b.$set),{},{[`${Ow.TOUR_LAST_SEEN_DATE}/${K}`]:new Date().toISOString()}))}const D=F(F({},b.properties.$set),b.$set);if(ms(D)||this.setPersonPropertiesForFlags(D),!Ve(this.config.before_send)){const K=this.Os(b);if(!K)return;b=K,b.uuid=X_(b.uuid,ui)}const X=L.filter(({channel:K,update:q})=>{var H,I,re;const ve=(H=(I=b.$set)===null||I===void 0?void 0:I[K.property])!==null&&H!==void 0?H:st((re=b.properties)===null||re===void 0?void 0:re.$set)?b.properties.$set[K.property]:void 0;return(q==null?void 0:q.pending)&&ve===q.value});this.au.emit("eventCaptured",b);const P=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),Q=(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(P),A=F(F(F({method:"POST",url:P,data:b,compression:"best-available",timestampMode:Q?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},Q&&(!((c=b.properties)===null||c===void 0)&&c.$session_id)?{batchGroup:b.properties.$session_id+(b.properties.$window_id?`-${b.properties.$window_id}`:"")}:{}),i!=null&&i.transport?{transport:i.transport}:{}),X.length?{fireCallbackOnDrop:!0,callback:K=>{if(K.statusCode>=200&&300>K.statusCode)for(const{channel:q,update:H}of X)this.rh(q,H.value)}}:{});if(!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly||X.length){var de;let K;!A.transport&&!A.callback&&ms((de=this.config.request_headers)!==null&&de!==void 0?de:{})&&this.wu&&(K="sendBeacon"),this.Ou(A,K)}else this.Fu.enqueue(A);return b}_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 KM(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)}}uh(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.hh()),(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.uh();const u=c?void 0:this.persistence.remove_event_timer(t);let f=F({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.fu()&&(f[lk]=!0),t==="$snapshot"){const C=F(F({},this.persistence.properties()),this.sessionPersistence.properties());return f.distinct_id=C.distinct_id,(!Je(f.distinct_id)&&!Jt(f.distinct_id)||eu(f.distinct_id))&&ye.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,U,D,X;if(!es)return{};const P=C?[...wo,...E||[]]:[],[Q,A]=CS(es),[de,K]=(function(B){for(let oe=0;Q_.length>oe;oe++){const[_e,Ne,Me]=Q_[oe],Le=B.match(_e);if(Le){const De=Me&&B.match(Me)||Le;return[Ne,(De==null?void 0:De[1])||""]}}return["",""]})(es),q=(function(){const B="u">typeof navigator?navigator:void 0;return B!=null&&B.brave?{brave:!0}:{}})(),H={};ue(L)||(H.detectGoogleSearchApp=L);const I={},re=(R=navigator)===null||R===void 0||(R=R.userAgentData)===null||R===void 0?void 0:R.platform,ve=(U=navigator)===null||U===void 0?void 0:U.maxTouchPoints,M=te==null||(D=te.screen)===null||D===void 0?void 0:D.width,Ee=te==null||(X=te.screen)===null||X===void 0?void 0:X.height,Ae=te==null?void 0:te.devicePixelRatio;ue(re)||(I.userAgentDataPlatform=re),ue(ve)||(I.maxTouchPoints=ve),ue(M)||(I.screenWidth=M),ue(Ee)||(I.screenHeight=Ee),ue(Ae)||(I.devicePixelRatio=Ae);const z=Dt(Mx({$os:Q,$os_version:A,$browser:NS(es,navigator.vendor,q,H),$webview_app:de,$webview_app_version:K,$device:ES(es),$device_type:OT(es,I),$timezone:Dk(),$timezone_offset:yM()}),{$current_url:wu(O?ca(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,P,Su),$host:Yt==null?void 0:Yt.host,$pathname:Yt==null?void 0:Yt.pathname,$raw_user_agent:es.length>1e3?es.substring(0,997)+"...":es,$browser_version:RT(es,navigator.vendor,q,H),$browser_language:Ak(),$browser_language_prefix:bM(),$screen_height:te==null?void 0:te.screen.height,$screen_width:te==null?void 0:te.screen.width,$viewport_height:te==null?void 0:te.innerHeight,$viewport_width:te==null?void 0:te.innerWidth,$lib:fr.LIB_NAME,$lib_version:fr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return fr.SDK_DIST_CHANNEL&&(z.$sdk_dist_channel=fr.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 x;if(this.requestRouter.region===X0&&(f.$lib_custom_api_host=this.config.api_host),x=t!=="$pageview"||c?t!=="$pageleave"||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),f=Dt(f,x),t==="$pageview"&&fe&&(f.title=fe.title),!ue(u)){const C=i.getTime()-u;f.$duration=parseFloat((C/1e3).toFixed(3))}es&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");const v=this.persistence.properties(),b=this.sessionPersistence.properties(),y=f.$groups,w=v.$groups;st(y)&&!ms(y)&&(f.$groups=F(F({},st(w)?w:{}),y)),jt(["$referrer","$referring_domain"],C=>{C in v&&delete b[C]});const j={};if(this.$u.length>0)for(const C of this.$u.slice())try{Dt(j,C())}catch(E){ye.error("Failed to produce browser extension event properties",E)}f=Dt({},h,v,b,F(F({},j),f)),f.$is_identified=this._isIdentified(),Fe(this.config.property_denylist)?jt(this.config.property_denylist,function(C){delete f[C]}):ye.error(aj+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const N=this.config.sanitize_properties;N&&(ye.error(Gw),f=N(f,t));const S=this.dh();return f.$process_person_profile=S,S&&!c&&this.fh("_calculate_event_properties"),f}ah(t,n=!0,i=!1){var a;if(!this.persistence||!this.dh()||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&&(ye.error(Gw),f=h(f,"$set_once")),n&&(this.Su=!0),ms(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.uh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(a=>this.xu.add(a)),this.hh()}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.hh()}ph(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.hh()}hh(){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:Ic}),()=>{})}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:Ic})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Ic})}renderSurvey(t,n){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,n)}displaySurvey(t,n=qM){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:Ic}}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:Ic})}gh(t){return!t||eu(t)?(ye.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(ye.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(ye.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return ye.uninitializedWarning("posthog.identify");if(Jt(t)&&(t=t.toString(),ye.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.gh(t)||!this.fh("posthog.identify"))return;this.yu();const a=this.get_distinct_id(),c=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.uh(!1),f=this.persistence.Pl();let h=!1;try{const x=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:x},""),t!==x&&t!==this.get_property("__alias")&&(this.unregister(Jf),this.register({distinct_id:t}));const v=(this.persistence.get_property("$user_state")||"anonymous")===ur,b=t!==x,y=!b&&v;if(b&&v){var m;const w=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:x};this.persistence.set_property(ts,Df),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$identify",w,{$set:n||{},$set_once:i||{}})&&(this.Eu=Lg(t,n,i)),(m=this.featureFlags)===null||m===void 0||m.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:x)}else if(y){this.persistence.set_property(ts,Df);const w=n||{},j=i||{};this.setPersonPropertiesForFlags({$set:w,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:w,$set_once:j})&&(this.Eu=Lg(t,n,i))}else(n||i)&&this.setPersonProperties(n,i);b||c||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(aa)):y&&(n||i)&&this.reloadFeatureFlags(),h=!0}finally{f&&this.persistence.Ol(h)}}setPersonProperties(t,n){if(!t&&!n||!this.fh("posthog.setPersonProperties"))return;const i=Lg(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)):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const i=(Fe(t)?t:[t]).filter(a=>Je(a)&&a.length>0);i.length!==0&&this.fh("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 ye.error("posthog.group requires a group type and group key");(a=this.persistence)===null||a===void 0||a.syncCookieProperties(),this.uh();const c=this.getGroups(),u=c[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:F(F({},c),{},{[t]:n})}),(u||i)&&this.dh()){const f={$group_type:t,$group_key:n};i&&(f.$group_set=i),this.capture(pw,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.fh("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=ns(t)?t:t==null?void 0:t.resetDeviceID,i=ns(t)||t==null?void 0:t.bootstrap;this.mh(n,!1,i)}mh(t,n=!1,i){var a,c,u,f,h,m;if(ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");const x=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.Xl());const v=this.get_property(kx),b=this.get_property(vg),y=this.get_property(su);(f=this.sessionRecording)===null||f===void 0||f.flushBeforeIdentityReset();const w=this.is_capturing();this.consent.reset(),n||!w||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,U,D,X,P,Q,A,de;if((S=this.persistence)===null||S===void 0||S.clear(),(C=this.sessionPersistence)===null||C===void 0||C.clear(),this.xu.clear(),this.hh(),ue(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(),(U=this.metrics)===null||U===void 0||U.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:bg,$device_id:null},"");else{const H=this.config.get_device_id(ui());this.register_once({distinct_id:H,$device_id:t?H:v},""),t||ue(b)||this.register({[vg]:b})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.fu()&&((de=this.persistence)===null||de===void 0||de.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(Q=this.featureFlags)===null||Q===void 0||Q.initialize(),!Ve(x)&&!(!((A=this.sessionManager)===null||A===void 0)&&A.setBootstrapSessionId(x,!0)))){const H=F({},i);delete H.sessionID,this.config.bootstrap=H}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,N=!0}finally{var K,q;j&&((K=this.persistence)===null||K===void 0||(q=K.Ol)===null||q===void 0||q.call(K,N))}this.reloadFeatureFlags()}shutdown(t){var n=this;return zt(function*(){var i,a,c,u,f,h,m,x;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.metrics)===null||u===void 0||u.dispose(),(f=n.Fu)===null||f===void 0||f.unload(),(h=n.Du)===null||h===void 0||h.unload();try{var v;(v=n.featureFlags)===null||v===void 0||v.destroy()}catch(b){ye.error("Error while destroying feature flags",b)}(m=n.persistence)===null||m===void 0||m.destroy(),(x=n.sessionPersistence)===null||x===void 0||x.destroy()}else ye.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.yh()}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.bh()}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")?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this.fh("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this.ph(Jf,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(ye.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const n=F({},this.config);if(st(t)){var i,a,c,u,f,h,m,x,v,b,y,w,j,N;Dt(this.config,Xw(t));const C=this.bu();(i=this.persistence)===null||i===void 0||i.update_config(this.config,n,C),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Cg(F(F({},this.config),{},{persistence:"sessionStorage"}),C,!1);const E=this.Pu(this.config.debug);var S;ns(E)&&(this.config.debug=E),ns(this.config.debug)&&(this.config.debug?(yn.DEBUG=!0,ot.Et()&&ot.At("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:F({},this.config)})):(yn.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.Xl()),(u=this.exceptionObserver)===null||u===void 0||u.onConfigChange(),(f=this.exceptions)===null||f===void 0||f.onConfigChange(),(h=this.metrics)===null||h===void 0||h.onConfigChange(),(m=this.sessionRecording)===null||m===void 0||m.startIfEnabledOrStop(),(x=this.tracingHeaders)===null||x===void 0||x.startIfEnabledOrStop(),(v=this.autocapture)===null||v===void 0||v.startIfEnabled(),(b=this.heatmaps)===null||b===void 0||b.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((S=this.historyAutocapture)===null||S===void 0||S.startIfEnabledOrStop()),(y=this.exceptionObserver)===null||y===void 0||y.startIfEnabledOrStop(),(w=this.deadClicksAutocapture)===null||w===void 0||w.startIfEnabledOrStop(),(j=this.surveys)===null||j===void 0||j.loadIfEnabled(),this._u(),(N=this.externalIntegrations)===null||N===void 0||N.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Tw(this,cu,!1)}}_overrideSDKInfo(t,n){yn.LIB_NAME=t,yn.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(F(F({},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:na._h}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:Kc;return n!==Kc&&(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"}dh(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ms(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.dh()||this.fh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fh(t){return this.config.person_profiles==="never"?(ye.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ph(Cx,!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.wh(),((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.hh()),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.mh(!0,!0),(a=this.sessionManager)===null||a===void 0||a.destroy(),(c=this.pageViewManager)===null||c===void 0||c.destroy(),this.sessionManager=new Iw(this),this.pageViewManager=new Mw(this),this.persistence&&(this.sessionPropsManager=new Fw(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=na.__defaultExtensionClasses)===null||h===void 0?void 0:h.sessionRecording;var m,x;y&&(this.sessionRecording=this.vu(this.sessionRecording,new y(this)),this.lu&&((m=this.sessionRecording)===null||m===void 0||(x=m.onRemoteConfig)===null||x===void 0||x.call(m,this.lu)))}var v,b;this.consent.optInOut(!0),this._u(),this.Zu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((v=this.surveys)===null||v===void 0||v.loadIfEnabled()),(ue(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((b=t==null?void 0:t.captureEventName)!==null&&b!==void 0?b:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ye.warn(Vw)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ye.warn(Vw);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.mh(!0,!0),this.consent.optInOut(!1),this._u(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:bg,$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?ej(jn,this.config.custom_blocked_useragents):void 0}Qu(){fe&&(fe.visibilityState==="visible"?this.Tu||(this.Tu=!0,this.capture(Tx,{title:fe.title},{send_instantly:!0}),this.Iu&&(fe.removeEventListener(bu,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),yt(fe,bu,this.Iu)))}debug(t){t===!1?(te==null||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(te==null||te.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Xl(){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?(ye.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,i,a,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,ye)}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(_T),a=Fe(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 yT(t.event)?ye.warn(`${f}. This can cause unexpected behavior.`):ye.info(f),null}c.properties&&!ms(c.properties)||ye.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(f){return ye.error(`Error in beforeSend function for event '${t.event}':`,f),null}for(const u of i)if(c.properties&&Ve(c.properties[u]))return ye.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=ns(t)&&!t,i=ot.Et()&&ot.Ot("ph_debug")==="true";return!n&&(!!i||t)}};uu.__defaultExtensionClasses={},uu._h=(()=>{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]]=K6(e.prototype[t[n]])})(uu,["identify"]);var lj=class{constructor(e){this.disabled=e===!1;const t=st(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 $g="$copy_autocapture",xf=Xt("[AutoCapture]");function Bg(e,t){return t.length>e?t.slice(0,e)+"...":t}function nA(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Li(t));return t}function sA(e,{e:t,maskAllElementAttributes:n,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:c,disableCaptureUrlHashes:u}){var f,h;if(!Li(e))return{props:{}};const m=[e],x=new Set([e]);let v=e;for(;v.parentNode&&!Pn(v,"body")&&1e3>m.length;){if(Ax(v.parentNode)){const R=v.parentNode.host;if(x.has(R))break;x.add(R),m.push(R),v=R;continue}if(!Li(v.parentNode)||x.has(v.parentNode))break;x.add(v.parentNode),m.push(v.parentNode),v=v.parentNode}const b=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?m.findIndex(R=>Pn(R,"button")||Pn(R,"a")):-1;b>0&&(i=i||m.slice(0,b+1).some(R=>!mo(R)||_u(R)));const y=[],w={};let j,N=!1,S=!1;if(jt(m,R=>{const U=mo(R);if(Pn(R,"a")&&!n&&!(a!=null&&a.includes("href"))){const D=R.getAttribute("href");N=!!(U&&D&&au(D))&&(u?ca(D):D)}Ie(yo(R),"ph-no-capture")&&(S=!0),y.push((function(D,X,P,Q,A=!1){const de=D.tagName.toLowerCase(),K={tag_name:de};Ox.indexOf(de)>-1&&!P&&(K.$el_text=de.toLowerCase()==="a"||de.toLowerCase()==="button"?Bg(1024,Nw(D)):Bg(1024,yu(D)));const q=yo(D);X||Q!=null&&Q.includes("class")||0>=q.length||(K.classes=q.filter(function(ve){return ve!==""})),jt(D.attributes,function(ve){var M;if((!_u(D)||["name","id","class","aria-label"].indexOf(ve.name)!==-1)&&!(Q!=null&&Q.includes(ve.name))&&!X&&au(ve.value)&&(!Je(M=ve.name)||M.substring(0,10)!=="_ngcontent"&&M.substring(0,7)!=="_nghost")){let Ee=ve.value;ve.name==="class"&&(Ee=Rx(Ee).join(" ")),K["attr__"+ve.name]=Bg(1024,ve.name==="href"&&A?ca(Ee):Ee)}});let H=1,I=1,re=D;for(;re=nA(re);)H++,re.tagName===D.tagName&&I++;return K.nth_child=H,K.nth_of_type=I,K})(R,n,i,a,u)),jt((function(D){if(!mo(D))return{};const X={};return jt(D.attributes,function(P){if(P.name&&P.name.indexOf("data-ph-capture-attribute")===0){const Q=P.name.replace("data-ph-capture-attribute-",""),A=P.value;Q&&A&&au(A)&&(X[Q]=A)}}),X})(R),(D,X)=>{({}).hasOwnProperty.call(w,X)||(w[X]=D)})}),S)return{props:{},explicitNoCapture:S};if(b>0&&(e=m[b],y.splice(0,b)),i||(y[0].$el_text=Pn(e,"a")||Pn(e,"button")?Nw(e):yu(e)),N){var C,E;y[0].attr__href=N;const R=(C=ua(N))===null||C===void 0?void 0:C.host,U=te==null||(E=te.location)===null||E===void 0?void 0:E.host;R&&U&&R!==U&&(j=N)}return{props:Dt((O=t.type,{$event_type:O,$ce_version:1}),c?{}:{$elements:y},{$elements_chain:(L=y,Fe(L)?(function(R){return R.map(U=>{var D,X;let P="";if(U.tag_name&&(P+=U.tag_name),U.attr_class){U.attr_class.sort();for(const de of U.attr_class)P+=`.${de.replace(/"/g,"")}`}const Q=F(F(F(F({},U.text?{text:U.text}:{}),{},{"nth-child":(D=U.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(X=U.nth_of_type)!==null&&X!==void 0?X:0},U.href?{href:U.href}:{}),U.attr_id?{attr_id:U.attr_id}:{}),U.attributes),A={};return zf(Q).sort(([de],[K])=>(function(q,H){return H>q?-1:q>H?1:0})(de,K)).forEach(([de,K])=>A[Cw(de.toString())]=Cw(K.toString())),P+=":",P+=zf(A).map(([de,K])=>`${de}="${K}"`).join(""),P}).join(";")})((function(R){return R.map(U=>{var D,X;const P={text:(D=U.$el_text)===null||D===void 0?void 0:D.slice(0,400),tag_name:U.tag_name,href:(X=U.attr__href)===null||X===void 0?void 0:X.slice(0,2048),attr_class:dM(U),attr_id:U.attr__id,nth_child:U.nth_child,nth_of_type:U.nth_of_type,attributes:{}};return zf(U).filter(([Q])=>Q.indexOf("attr__")===0).forEach(([Q,A])=>P.attributes[Q]=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}:{},w),target:e};var L,O}var iA=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(e){var t;if(!mo(e))return!0;const n=(t=this.vo().css_selector_ignorelist)!==null&&t!==void 0?t:jg,i=new Set;let a=e;for(;a;){if(i.size>=1e3||i.has(a))return!0;i.add(a);const c=a,u=yo(c);if(Ie(u,"ph-no-capture")||Ie(u,"ph-sensitive")||_u(c)||n.some(h=>I0(c,h)))return!0;const f=a.parentNode;a=Ax(f)?f.host:f&&Li(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=ru(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&Li(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=ru(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&&(Pn(i,"html")||Pn(i,"body"))){var a;if(n.excluded)return null;const c=(a=this.vo().css_selector_ignorelist)!==null&&a!==void 0?a:jg;return[i,fe==null?void 0:fe.documentElement,fe==null?void 0:fe.body].some(u=>{if(!u)return!1;const f=yo(u);return Ie(f,"ph-no-capture")||Ie(f,"ph-sensitive")||!mo(u)||_u(u)||c.some(h=>I0(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 lj(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 xf.info("Disabling Automatic Event Collection because this browser is not supported");if(!te||!fe)return;const e=this.Mo=t=>{t=t||(te==null?void 0:te.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(Zt(n))return;this.Eo(t,"$autocapture",n)}catch(n){xf.error("Failed to capture event",n)}};if(yt(te,"blur",e),yt(fe,"submit",e,{capture:!0}),yt(fe,"change",e,{capture:!0}),yt(fe,"click",e,{capture:!0}),jt(["pointerdown","pointermove","pointerup","pointercancel"],t=>{yt(fe,t,e,{capture:!0})}),this.vo().capture_copied_text){const t=this.Po=n=>{n=n||(te==null?void 0:te.event);try{this.Eo(n,$g)}catch(i){xf.error("Failed to capture clipboard event",i)}};yt(fe,"copy",t,{capture:!0}),yt(fe,"cut",t,{capture:!0}),yt(fe,"paste",t,{capture:!0})}}To(){this.uo(),this.Mo&&(te==null||te.removeEventListener("blur",this.Mo),jt(["pointerdown","pointermove","pointerup","pointercancel"],e=>{fe==null||fe.removeEventListener(e,this.Mo,!0)}),fe==null||fe.removeEventListener("submit",this.Mo,!0),fe==null||fe.removeEventListener("change",this.Mo,!0),fe==null||fe.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(fe==null||fe.removeEventListener("copy",this.Po,!0),fe==null||fe.removeEventListener("cut",this.Po,!0),fe==null||fe.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;ns(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=fe==null?void 0:fe.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(KS),i=this._o,a=this.vo();if(!a.remoteRequestsDisabled&&!this.wo)return!1;const c=a.remoteRequestsDisabled&&!this.wo;if(Zt(i)&&!ns(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||ru(e);xk(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()))&&_k(i,a.rageclick)&&this.Eo(e,"$rageclick",n);const u=t===$g,f=u?F(F({},a),{},{dom_event_allowlist:void 0}):a;if(i&&(function(v,b,y,w,j,N){var S;if(!te||Lx(v)||y!=null&&y.url_allowlist&&!bw(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&bw(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}=wk(v,w);if(!(function(O,R){const U=R==null?void 0:R.element_allowlist;if(ue(U))return!0;for(const D of O)if(U.some(X=>D.tagName.toLowerCase()===X))return!0;return!1})(E,y)||!H0(E,y==null?void 0:y.css_selector_allowlist)||H0(E,(S=y==null?void 0:y.css_selector_ignorelist)!==null&&S!==void 0?S:jg))return!1;try{const O=te.getComputedStyle(v);if(O&&O.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}const L=v.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&&(Ox.indexOf(L)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,f,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var h;const{props:v,explicitNoCapture:b,target:y}=sA(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(b)return!1;const w=this.getElementSelectors(i,y);if(w&&w.length>0&&(v.$element_selectors=w),t===$g){const j=e.type||"clipboard";if(j!=="paste"){var m,x;const N=te==null||(m=te.getSelection())===null||m===void 0?void 0:m.toString(),S=vk(N);if(!S)return!1;v.$selected_content=S,v.$clipboard_text_length=(x=N==null?void 0:N.length)!==null&&x!==void 0?x:0}v.$copy_type=j}return(h=this.po)===null||h===void 0||h.capture(t,v).catch(j=>xf.error("Failed to capture event",j)),!0}}isBrowserSupported(){return kn(fe==null?void 0:fe.querySelectorAll)}},rA=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,n=st(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.Xl(),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 Hc=Xt("[ExceptionAutocapture]"),Kw=()=>{},Ww=e=>{var t;if(kn(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ku(e,t,n){try{if(!(t in e))return Kw;const i={next:e[t]},a=n(function(...c){return i.next.apply(this,c)});return kn(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=Ww(c);for(;u;){if(u.next===a)return void(u.next=i.next);c=u.next,u=Ww(c)}}}catch{return Kw}}const aA=Xt("[TracingHeaders]"),Va=Xt("[Web Vitals]"),Zw=9e5,Jw=["CLS","FCP","INP","LCP"],lA=["INP","LCP"],oA=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Pg="disabled",e5="lazy_loading",ir=Xt("[SessionRecording]"),cA=Xt("[Heatmaps]");function Fg(e){return st(e)&&"clientX"in e&&"clientY"in e&&Jt(e.clientX)&&Jt(e.clientY)}const vf=Xt("[Product Tours]"),Ug=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Nx))},uA=["$set_once","$set"],Ci=Xt("[SiteApps]"),t5="Error while initializing PostHog app with config id ",oj=(e,t)=>e!=null&&e.then?e.then(t):t(e),no="SDK is not enabled or survey functionality is not yet loaded",n5="Disabled. Not loading surveys.";var dA=class{constructor(e,t){this.yo=e,this.kh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Sh=!1,this.xh=[],this.Ch=null,this.$h=null,this.So=!1,this.Th=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.Ih=ns(i)?i:i.length>0,kt.info(`flags response received, isSurveysEnabled: ${this.Ih}`),this.loadIfEnabled()}}setup(e){if(!this.So)return this.Mh=e,oj(e.kv.initialize(),()=>{if(this.Mh!==e||this.So)return;this.Mh=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.Mh=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.xh=[],this.Ch=null,this.Th.forEach(a=>clearTimeout(a)),this.Th.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.Sh)return void kt.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void kt.info(n5);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(ue(this.Ih)&&!e.advancedEnableSurveys)return;const n=this.Ih||e.advancedEnableSurveys;this.Sh=!0;try{const i=t.generateSurveys;if(i)return this.Eh(i,n),void(this.Sh=!1);const a=t.loadExternalDependency;if(!a)return this.Ph(Ex),void(this.Sh=!1);a(c=>{try{if(this.So)return;const u=this.yo.getExtensions();c||!(u!=null&&u.generateSurveys)?this.Ph("Could not load surveys script",c):this.Eh(u.generateSurveys,n)}finally{this.Sh=!1}})}catch(i){throw this.Sh=!1,this.Ph("Error initializing surveys",i),i}}Eh(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),kt.info("Surveys loaded successfully"),this.Rh({isLoaded:!0}))}Ph(e,t){kt.error(e,t),this.Rh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.xh.push(e),this._surveyManager&&this.Rh({isLoaded:!0}),()=>{this.xh=this.xh.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const i=(n=this.po)!==null&&n!==void 0?n:this.kh;if(!i||this.So)return;if(this.Mr.disableSurveys)return kt.info(n5),e([]);const a=i.kv.get(z0);if(a&&!t)return e(a,{isLoaded:!0}),void(this.Ah()&&this.getSurveys(()=>{},!0));if(this.Ch)return void this.Ch.then(({surveys:f,context:h})=>{this.So||e(f,h)}).catch(f=>kt.error("Error in survey callback",f));const c=this.Fh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(f=>{try{return this.Oh(i,f)}catch(h){return kt.error("Error processing surveys response",h),this.Oh(i,{statusCode:0,error:h})}},f=>this.Oh(i,{statusCode:0,error:f}));this.Ch=c;const u=()=>{this.Ch===c&&(this.Ch=null)};c.then(f=>{u(),this.So||e(f.surveys,f.context)},u).catch(f=>kt.error("Error in survey callback",f))}Fh(e,t){const n=this.po;return n?n.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(no)}))}Oh(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.$h=Date.now(),{surveys:[],context:{isLoaded:!1,error:u}}}this.$h=null;const i=t.json.surveys||[],a=i.filter(u=>(function(f){return!(!f.start_date||f.end_date)})(u)&&(nj(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({[z0]:i,[eh]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Ah(){return this.Dh()&&!this.Ch&&!this.Lh()}Dh(){var e,t;const n=(e=(t=this.po)!==null&&t!==void 0?t:this.kh)===null||e===void 0?void 0:e.kv.get(eh);return Jt(n)&&Date.now()-n>3e5}Lh(){return Jt(this.$h)&&3e5>Date.now()-this.$h}markSurveyAsSeen(e,t){var n;const i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};rj(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Rh(e){for(const t of this.xh)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")}Nh(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}qh(e){if(Ve(this._surveyManager))return{eligible:!1,reason:no};const t=typeof e=="string"?this.Nh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}jh(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.Nh(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.jh(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.jh(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.Nh(e):e;if(!(a!=null&&a.id))return void kt.warn("Survey not found");if(!HM.includes(a.type))return void kt.warn(`Surveys of type ${a.type} cannot be rendered in the app`);const c=fe==null?void 0:fe.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.Th.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.Th.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.Nh(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=F(F({},i),{},{appearance:F(F({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==q0.Popover&&t.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const c=this.qh(i);if(!c.eligible)return void kt.warn("Survey is not eligible to be displayed: ",c.reason)}t.displayType!==q0.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 fA=class{constructor(e){this._instance=e,this.Bh=new Set,this.Hh=new Set,this.zh=new lh,this.Uh=(t,n)=>this.Wh(t,n)&&this.Vh(t,n)&&this.Gh(t,n)&&this.Zh(t,n),this.Wh=(t,n)=>!(n!=null&&n.event)||(t==null?void 0:t.event)===(n==null?void 0:n.event)}init(){var e,t;ue((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.Qh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,i)=>{this.on(n,i)}))}dispose(){var e;(e=this.Qh)===null||e===void 0||e.call(this),this.Qh=void 0,this.zh=new lh}register(e){var t,n;if(!ue((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var a;this.Bh.add(i),(a=i.steps)===null||a===void 0||a.forEach(c=>{this.Hh.add((c==null?void 0:c.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const i=new Set;this.Bh.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.Bh.clear(),this.Hh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Hh.has(e)||this.Hh.has(t.event))&&this.Bh.forEach(n=>{this.Jh(t,n)&&this.zh.emit("actionCaptured",n.name)})}Kh(e){this.onAction("actionCaptured",t=>e(t))}Jh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.Uh(e,n))return!0;return!1}onAction(e,t){return this.zh.on(e,t)}Vh(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}Gh(e,t){return!!this.Xh(e,t)&&!!this.Yh(e,t)&&!!this.tc(e,t)}Xh(e,t){var n;if(!(t!=null&&t.href))return!0;const i=this.ec(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")}Yh(e,t){var n;if(!(t!=null&&t.text))return!0;const i=this.ec(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=[],x=/(?::|")text="(.*?)"/g;let v;for(;!Ve(v=x.exec(h));)m.includes(v[1])||m.push(v[1]);return m})(a),u=t.text,f=t.text_matching||"exact",c.some(h=>so(h,u,f)));var c,u,f}tc(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}ec(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||ij(t.properties.reduce((n,i)=>{const a=Fe(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)}},hA=class{constructor(e){var t,n;this.nc=[],this._instance=e,this.sc=new Map,this.rc=new Map,this.oc=new Map,this.lc=(t=this._instance)===null||t===void 0||(n=t.onSessionId)===null||n===void 0?void 0:n.call(t,i=>this.ac(i))}uc(e){return!1}hc(){return null}cc(e){}dc(){}vc(e,t){return!!e&&ij(e.propertyFilters,t==null?void 0:t.properties)}fc(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}gc(e,t,n){const i=(n===Pc.Activation?this.sc:this.rc).get(e);let a=[];return this.mc(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.vc(f,t)})}register(e){this.yc(e,!1)}replace(e){this.yc(e,!0)}yc(e,t){var n;ue((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.bc(e,t),this._c(e,t))}_c(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.oc.clear(),n.length===0)return void(t&&((i=this.wc)===null||i===void 0||i.replace([])));this.wc||(this.wc=new fA(this._instance),this.wc.init(),this.wc.Kh(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.oc.get(f.name))!==null&&h!==void 0?h:[];m.includes(c.id)||m.push(c.id),this.oc.set(f.name,m)}})}),t?this.wc.replace(a):this.wc.register(a)}kc(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)})}bc(e,t){var n,i;const a=e.filter(h=>{var m,x;return((m=h.conditions)===null||m===void 0?void 0:m.events)&&((x=h.conditions)===null||x===void 0||(x=x.events)===null||x===void 0||(x=x.values)===null||x===void 0?void 0:x.length)>0}),c=e.filter(h=>{var m,x;return((m=h.conditions)===null||m===void 0?void 0:m.cancelEvents)&&((x=h.conditions)===null||x===void 0||(x=x.cancelEvents)===null||x===void 0||(x=x.values)===null||x===void 0?void 0:x.length)>0}),u=this.fc(e,Pc.Activation),f=this.fc(e,Pc.Cancellation);t?(this.sc=u,this.rc=f):(this.kc(this.sc,u),this.kc(this.rc,f)),(a.length!==0||c.length!==0)&&((n=this.Qh)!==null&&n!==void 0||(this.Qh=(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.Sc(),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.xc(e,c);if(f==="consume")return a.info("event consumed activated item, removing it",{event:e,itemId:c}),void this.Cc([c]);if(f==="persist")return a.info("shown item promoted to persisted activation",{event:e,itemId:c}),this.$c(c),void this.Tc([c])}if(this.rc.has(e)){const f=this.gc(e,t,Pc.Cancellation);f.length>0&&(a.info("cancel event matched, cancelling items",{event:e,itemsToCancel:f.map(h=>h.id)}),this.Cc(f.map(h=>h.id)),f.forEach(h=>this.Ic(h.id)))}if(!this.sc.has(e))return;a.info("event name matched",{event:e,eventPayload:t,items:this.sc.get(e)});const u=this.gc(e,t,Pc.Activation);this.Mc(u.map(f=>f.id))}onAction(e){this.oc.has(e)&&this.Mc(this.oc.get(e)||[])}Mc(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.uc(c)?this.$c(c)&&this.Ec(c):a.push(c);a.length>0&&(this.nc=[...new Set([...this.nc,...a])]),this.Sc().info("updating activated items",{activatedItems:this.getActivatedIds()})}$c(e){this.nc=this.nc.filter(n=>n!==e);const t=this.Pc();return!t.includes(e)&&(this.Rc([...t,e]),this.Ac(),!0)}Cc(e){const t=new Set(e);this.nc=this.nc.filter(a=>!t.has(a));const n=this.Fc(),i=n.filter(a=>!t.has(a));i.length!==n.length&&(this.Rc(i),i.length===0&&this.Oc()),this.Tc(e)}Dc(){var e;const t=this.hc();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:{}}Ec(e){if(!this.hc())return;const t=this.Dc();this.cc(F(F({},t),{},{[e]:Date.now()}))}Tc(e){if(!this.hc())return;const t=this.Dc(),n={};let i=!1;for(const[a,c]of Object.entries(t))e.includes(a)?i=!0:n[a]=c;i&&(ms(n)?this.dc():this.cc(n))}Lc(){this.hc()&&this.dc()}getActivationTimestamp(e){if(!this.Pc().includes(e))return;const t=this.Dc()[e];return Jt(t)?t:void 0}Fc(){var e;const t=this.Nc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Pc(){var e,t,n;const i=this.Fc();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.qc()],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:[]}Ac(){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.jc(n)}Oc(){this.Bc()}ac(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.qc()];if(n&&n!==e){const i=this.Fc(),a=this.Dc();i.length>0&&(this.Rc([]),i.filter(c=>Jt(a[c])).forEach(c=>this.Ic(c))),this.Oc(),this.Lc()}}getActivatedIds(){return[...new Set([...this.Pc(),...this.nc])].filter(e=>!this.Hc(e))}dispose(){var e,t,n;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(t=this.Qh)===null||t===void 0||t.call(this),this.Qh=void 0,(n=this.wc)===null||n===void 0||n.dispose(),this.wc=void 0}reset(){this.nc=[],this.Fc().length>0&&this.Rc([]),this.Oc(),this.Lc()}getEventToItemsMap(){return this.sc}zc(){return this.wc}},pA=class extends hA{constructor(e){super(e)}Nc(){return nk}qc(){return sk}hc(){return ik}cc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}dc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}uc(e){var t;let n;this.mc(a=>{n=a.find(c=>c.id===e)});const i=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return Jt(i)&&i>0}Uc(){return dr.SHOWN}mc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Ic(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Sc(){return kt}Rc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}jc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Bc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Hc(){return!1}xc(e,t){let n;return this.mc(i=>{n=i.find(a=>a.id===t)}),!n||(function(i){var a;return nj(i)&&!!(!((a=i.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||i.schedule==="always"})(n)?e===dr.SHOWN?"consume":"ignore":e===dr.SHOWN?"persist":e===dr.DISMISSED||e===dr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},mA=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);ue(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)}},gA=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 pA(this._instance)}};const xA=te!=null&&te.location?ih(te.location.hash,"__posthog")||ih(location.hash,"state"):null,s5="_postHogToolbarParams",i5=Xt("[Toolbar]"),r5=Xt("[FeatureFlags]");var vA=class{constructor(e,t=!1){this.Wc=!1,this.update(e,t)}update(e,t){this.Vc=((n,i)=>{var a,c,u,f,h,m,x;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,idleRefreshBackoff:ue(n.remote_config_refresh_interval_ms),requestTimeoutMs:n.feature_flag_request_timeout_ms,compression:n.disable_compression?void 0:"best-available",evaluationContexts:(m=(x=n.evaluation_contexts)!==null&&x!==void 0?x:n.evaluation_environments)!==null&&m!==void 0?m:[],flagKeys:Fe(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Wc||(r5.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Wc=!0),ue(e.flag_keys)||Fe(e.flag_keys)||r5.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Vc}};const a5=Xt("[FeatureFlags]"),Ga=Xt("[FeatureFlags]",{debugEnabled:!0}),Ig=`" failed. Feature flags didn't load in time.`,l5=["click","keydown","wheel","touchstart","pointerdown"],o5="connection_error",c5=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},u5=e=>{const t={};for(const[n,i]of zf(e||{}))i&&(t[n]=i);return t},d5=e=>Tu(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),li=Xt("[Error tracking]"),K0="webkit-masked-url:",bA=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],yA=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",K0],_A=["__firefox__","__gCrWeb"],f5="Refusing to render web experiment since the viewer is a likely bot",wA={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>oh(t,e),not_regex:(e,t)=>!oh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},qs=Xt("[Conversations]"),Ya="Conversations not available yet.";function h5(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,x=(i=e==null?void 0:e.maxBufferSize)!==null&&i!==void 0?i:100,v=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=ue(v)?Math.max(x,2048):Math.max(x,v),y=F(F({},(function(){let w="",j="";try{const N=jn==null?void 0:jn.userAgent;N&&([w,j]=CS(N))}catch{}return(function(N,S){const C=(function(E){if(E)return{}.hasOwnProperty.call(lw,E)?lw[E]:E})(N);return F(F({},C?{"os.name":C}:{}),S?{"os.version":S}:{})})(w,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:x,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:m,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const SA=["debug","log","warn","error","info"],kA=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},p5="console",cj="__posthogHandledLogsRequestError",Hg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[cj]=!0,n},m5=e=>!!e&&typeof e=="object"&&e[cj]===!0,ch=Xt("[NetworkMetrics]"),$x=()=>{var e;return!(te==null||(e=te.performance)===null||e===void 0)&&e.now?te.performance.now():Date.now()},jA=e=>e?`${Math.floor(e/100)}xx`:"missing",uj=(e,t)=>{var n;const i=String(t);return{method:String(e).toUpperCase(),url:((n=ua(i))===null||n===void 0?void 0:n.href)||i}},W0=(e,t,n,i,a)=>{try{var c,u,f;const m=a();if(!m)return;const x=n||void 0,v=$x()-i,b=ua(t.url);if(b&&b.protocol!=="http:"&&b.protocol!=="https:")return;const y={url:(b==null?void 0:b.href)||t.url,method:t.method},w=kn(m.name)?m.name(y):Je(m.name)?m.name:"http.client.request.duration";if(!w)return;const j=F({method:y.method,host:(c=b==null?void 0:b.hostname)!==null&&c!==void 0?c:"",path:b?(h=b.pathname,h.split("/").map(N=>(S=>/^\d+$/.test(S)||S.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(S))(N)?":id":N).join("/")):"",status_class:jA(x)},(u=m.attributes)===null||u===void 0?void 0:u.call(m,y,{status:x,durationMs:v}));(f=e.metrics)===null||f===void 0||f.histogram(w,v,{unit:"ms",attributes:j})}catch(m){ch.error("Failed to record network metric",m)}var h},dj=()=>{},NA=(e,t)=>kn(te==null?void 0:te.fetch)?ku(te,"fetch",n=>function(...i){const a=$x(),c=n.apply(this,i);if(!t())return c;try{var u,f,h;const[m,x]=i,v=uj((u=(f=x==null?void 0:x.method)!==null&&f!==void 0?f:m==null?void 0:m.method)!==null&&u!==void 0?u:"GET",(h=m==null?void 0:m.url)!==null&&h!==void 0?h:m);return c.then(b=>(W0(e,v,b==null?void 0:b.status,a,t),b),b=>{throw W0(e,v,void 0,a,t),b})}catch(m){return ch.error("Failed to observe fetch",m),c}}):dj,CA=(e,t)=>{var n;const i=te==null||(n=te.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!i)return dj;const a=new WeakMap,c=ku(i,"open",f=>function(...h){try{Hk.has(this)||a.set(this,uj(h[0],h[1]))}catch(m){ch.error("Failed to observe XHR open",m)}return f.apply(this,h)}),u=ku(i,"send",f=>function(...h){let m;try{const x=a.get(this);if(x&&t()){const v=$x();m=()=>{this.removeEventListener("loadend",m),W0(e,x,this.status,v,t)},yt(this,"loadend",m)}}catch(x){ch.error("Failed to observe XHR send",x)}try{return f.apply(this,h)}catch(x){throw m&&this.removeEventListener("loadend",m),x}});return()=>{c(),u()}},Sh={featureFlags:class{constructor(e){this.name="featureFlags",this.Gc=!1,this.featureFlagEventHandlers=[],this.$=a5,this.Zc={},this.Qc={},this.Jc=[],this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.ed=!1,this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.sn=()=>{const t=this.ld();this.rd=0,t&&this.reloadFeatureFlags()},this.ad=()=>{var t,n;const i=this.ud,a=(t=this.hd)!==null&&t!==void 0?t:i;ue(i)||ue(a)||this.Mr.remoteRequestsDisabled||!fe||fe.visibilityState==="hidden"||Date.now()-((n=this.dd)!==null&&n!==void 0?n:0)<a||(this.hd=this.od||!this.Mr.idleRefreshBackoff?i:Math.min(2*a,36e5),this.od=!1,this.reloadFeatureFlags(),this.vd())},this.fd=()=>{this.od&&this.hd===this.ud||this.pd()},this.an=()=>{(fe==null?void 0:fe.visibilityState)==="visible"&&this.pd()},"get"in e?this.yo=e:(this._instance=e,this.gd=new vA(e.config,e.Xl()),this.yo=this.gd)}updateConfig(e,t){var n;(n=this.gd)===null||n===void 0||n.update(e,t),this.po&&this.md()}setup(e){return this.Mh=e,this.$=e.logger.createLogger("[FeatureFlags]"),oj(e.kv.initialize(),()=>{this.Mh===e&&(this.Mh=void 0,this.po=e,this.yd(e))})}yd(e){var t;if(this.po===e)return te&&yt(te,"online",this.sn),this.md(),this.bd=e.registerDynamicEventProperties(()=>this._d()?this.Zc:this.Qc),this.wd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.kd(),this.Sd(),this.xd()}),this.Sd(),this.initialize()}pd(){this.od=!0,this.hd=this.ud,this.ad()}md(){const e=this.Mr.refreshIntervalMs,t=!this.Mr.remoteRequestsDisabled&&fe&&!ue(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.hd=t),t!==this.ud&&(this.Cd(),ue(t)||(this.ud=t,this.hd=t,this.vd(),fe!=null&&fe.addEventListener&&(yt(fe,bu,this.an),uo(l5,n=>{yt(fe,n,this.fd,{capture:!0})}))))}vd(){ue(this.ud)||(ue(this.$d)||clearInterval(this.$d),this.dd=Date.now(),this.$d=setInterval(this.ad,this.ud))}Cd(){var e;ue(this.$d)||(clearInterval(this.$d),this.$d=void 0,fe==null||(e=fe.removeEventListener)===null||e===void 0||e.call(fe,"visibilitychange",this.an),uo(l5,t=>{var n;fe==null||(n=fe.removeEventListener)===null||n===void 0||n.call(fe,t,this.fd,{capture:!0})})),this.ud=void 0,this.hd=void 0,this.od=!1,this.dd=void 0}destroy(){this.Td()}dispose(){this.Td()}Td(){var e,t;this.Cd(),this.Yc++,this.ed=!1,this.Mh=void 0,this.po&&(this.Id(),(e=this.bd)===null||e===void 0||e.dispose(),this.bd=void 0,(t=this.wd)===null||t===void 0||t.call(this),this.wd=void 0,this.Jc=[],te==null||te.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}Md(e){var t;return this.Ed&&e in this.Ed?this.Ed[e]:(t=this.po)===null||t===void 0?void 0:t.kv.get(e)}kd(){return!!this.Ed&&(this.Ed=void 0,!0)}Pd(){var e;return!ue((e=this.po)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.kd()}At(e){this.Rd(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.set(e)})}Ad(e,t,n){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const a=this.Md("$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&&!Fe(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(c)])),x=this.Md("$feature_flag_payloads")||{},v=e.$feature_flag_payloads||{},b=h||n?m:Array.from(new Set([...Object.keys(x),...Object.keys(v)])),y=!h&&!n,w=!!y||m,j=!!y||b,N={[cr]:w,[ci]:w,[sa]:j};e.$feature_flag_details&&(N[el]=w);for(const S of[tl,la,iu])ue(e[S])||(N[S]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(N)}Lt(e){this.Rd(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.remove(e)})}Rd(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Sd(){const e={};for(const i of[cr,sa,tl,Ti]){const a=this.Md(i);ue(a)||(e[i]=a)}this.Zc=e;const t=F({},e),n=this.Md(ci);if(n)for(const[i,a]of Object.entries(n))t[`$feature/${i}`]=a;this.Qc=t}_d(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Md(la);return typeof t!="number"||Date.now()-t>e}Fd(){return!!this._d()&&(this.sd||this.Xc||(this.sd=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Od(){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}):[]}Dd(){const e=this.Mr.flagKeys;if(!ue(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=>!ue(i[m])).reduce((m,x)=>(m[x]=i[x],m),{}),h=Object.keys(u).filter(m=>f[m]).reduce((m,x)=>(m[x]=u[x],m),{});return this.Ld({featureFlags:f,featureFlagPayloads:h},void 0,{persist:!1})}}updateFlags(e,t,n){var i,a;const c=n!=null&&n.merge&&(i=this.Md("$enabled_feature_flags"))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.Md("$feature_flag_payloads"))!==null&&a!==void 0?a:{},f=F(F({},c),e),h=F(F({},u),t),m={};for(const[x,v]of Object.entries(f))m[x]={key:x,enabled:nw(v),variant:sw(v),reason:void 0,metadata:ue(h==null?void 0:h[x])?void 0:{id:0,version:void 0,description:void 0,payload:h[x]}};this.Ld({flags:m})}get hasLoadedFlags(){return this.Kc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Md(el),t=this.Md(Ti),n=this.Md(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],x=ue(m)?(c=h==null?void 0:h.enabled)!==null&&c!==void 0&&c:!!m,v=ue(m)?h==null?void 0:h.variant:typeof m=="string"?m:void 0,b=n==null?void 0:n[f],y=F(F({},h),{},{enabled:x,variant:x?v??(h==null?void 0:h.variant):void 0});var u;x!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=F(F({},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.Gc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Gc=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const i=e[n];return{key:n,enabled:nw(i),variant:sw(i),payload:tw(t[n])}})}getFlagVariants(){const e=this.Md(ci),t=this.Md(Ti);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.Gc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Gc=!0),n}getFlagPayloads(){const e=this.Md(sa),t=this.Md(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.Gc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Gc=!0),n}reloadFeatureFlags(){this.td||this.Mr.featureFlagsDisabled||this.ld()||(this.Xc&&(this.ed=!0),this.Nd||(this.Jc.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Nd=setTimeout(()=>{this.qd()},5)))}Id(){clearTimeout(this.Nd),this.Nd=void 0}onReloading(e){return this.Jc.push(e),()=>{this.Jc=this.Jc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Kc||this.Xc||this.Nd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.td=e}resetFlagCallReported(){this.Lt(aa)}qd(e){this.Id();const t=this.po;if(!t||this.Mr.remoteRequestsDisabled||this.ld())return;if(this.Xc)return void(this.ed=!0);const n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:F(F(F({},t.initialPersonProperties),this.Md("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Md(ra),timezone:Dk()};ue(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(n.disable_flags=!0);const i=this.Od();i.length&&(n.evaluation_contexts=i);const a=this.Dd();ue(a)||(n.flag_keys=a);const c=this.Mr.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(c?"&only_evaluate_survey_feature_flags=true":""),f=this.Yc;this.Xc=!0;const h=()=>{this.ed&&(this.ed=!1,this.qd())},m=v=>{var b,y;const w=(b=v.json)!==null&&b!==void 0?b:{},j=v.statusCode!==200;if(this.Xc=!1,f!==this.Yc)return void h();if(this.jd(v.statusCode),j||this.ed||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ed)return;this.nd=!j;const N=[];v.error?N.push(v.error instanceof Error&&v.error.name==="AbortError"?"timeout":v.error instanceof Error?o5:"unknown_error"):v.statusCode!==200&&N.push(`api_error_${v.statusCode}`),w.errorsWhileComputingFlags&&N.push("errors_while_computing_flags");const S=!!(!((y=w.quotaLimited)===null||y===void 0)&&y.includes("feature_flags"));S&&N.push("quota_limited"),this.At({[vu]: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.Ld(w,j,{partialResponse:c}),h()},x=v=>{this.Xc=!1,f===this.Yc&&(this.At({[vu]:[o5]}),this.$.error("Feature flag request failed",v),this.Pd()&&this.xd(!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(x)}catch(v){x(v)}}ld(){return Nk(this.rd,3)}jd(e){this.rd=Ck(e,this.rd,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.nd)return;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Ig);if(this.Fd())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.nd)return;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Ig);if(this.Fd())return;const n=this.getFlagVariants(),i=e in n,a=n[e],c=this.getFlagPayloads()[e],u=String(a),f=this.Md("$feature_flag_request_id")||void 0,h=this.Md("$feature_flag_evaluated_at")||void 0;let m,x=this.Md("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var v;const X=(v=this.po)===null||v===void 0?void 0:v.session.sessionId,P=this.Md(Xc);X&&X!==P&&(x={},m=X)}if(t.send_event||!("send_event"in t))if(e in x&&x[e].includes(u))m&&this.At({[aa]:x,[Xc]:m});else{var b,y,w,j,N,S,C,E,L,O,R,U;Fe(x[e])?x[e].push(u):x[e]=[u],this.At(F({[aa]:x},m?{[Xc]:m}:{}));const X=this.getFeatureFlagDetails(e),P=[...(b=this.Md("$feature_flag_errors"))!==null&&b!==void 0?b:[]];ue(a)&&P.push("flag_missing");const Q={$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=(w=this.Mr.bootstrap)===null||w===void 0||(w=w.featureFlags)===null||w===void 0?void 0:w[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.nd};ue(X==null||(S=X.metadata)===null||S===void 0?void 0:S.has_experiment)||(Q.$feature_flag_has_experiment=X.metadata.has_experiment),ue(X==null||(C=X.metadata)===null||C===void 0?void 0:C.version)||(Q.$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&&(Q.$feature_flag_reason=A),!(X==null||(R=X.metadata)===null||R===void 0)&&R.id&&(Q.$feature_flag_id=X.metadata.id),ue(X==null?void 0:X.original_variant)&&ue(X==null?void 0:X.original_enabled)||(Q.$feature_flag_original_response=ue(X.original_variant)?X.original_enabled:X.original_variant),!(X==null||(U=X.metadata)===null||U===void 0)&&U.original_payload&&(Q.$feature_flag_original_payload=X==null||(D=X.metadata)===null||D===void 0?void 0:D.original_payload),P.length&&(Q.$feature_flag_error=P.join(",")),this.Bd(Q)}else m&&this.At({[aa]:x,[Xc]:m});return i?{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:tw(c)}:void 0}Bd(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.Hd(e,t)}Hd(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.Od();c.length&&(a.evaluation_contexts=c);const u=n.Dd();let f;ue(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.nd)return t.defaultValue;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Ig),t.defaultValue;const n=this.getFeatureFlag(e,t);return ue(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.Ld(e,t,n)}Ld(e,t,n){if(!this.po)return;this.Kc=!0;const i=((a,c={},u={},f={},h,m=a5)=>{const x=((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]})),U=Object.fromEntries(Object.keys(O).filter(D=>O[D].enabled).filter(D=>{var X;return!ue((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 F(F({},E),{},{featureFlags:R,featureFlagPayloads:U})}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),v=x.flags,b=x.featureFlags,y=x.featureFlagPayloads;if(!b)return;const w=a.requestId,j=a.evaluatedAt;if(Fe(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{[cr]:b,[ci]:E,[iu]:!1}}let N=b,S=y,C=v;if(h!=null&&h.partialResponse){const E=Object.keys(N),L=S||{};N=F(F({},c),N),S=F(F({},u),L),E.forEach(O=>{O in L||S==null||delete S[O]}),C=F(F({},f),C)}else if(a.errorsWhileComputingFlags)if(v){const E=new Set(Object.keys(v).filter(O=>{var R;return!(!((R=v[O])===null||R===void 0)&&R.failed)}));N=F(F({},c),Object.fromEntries(Object.entries(N).filter(([O])=>E.has(O))));const L=Object.fromEntries(Object.entries(S||{}).filter(([O])=>E.has(O)));S=F(F({},u),L),E.forEach(O=>{O in L||S==null||delete S[O]}),C=F(F({},f),Object.fromEntries(Object.entries(C||{}).filter(([O])=>E.has(O))))}else N=F(F({},c),N),S=F(F({},u),S),C=F(F({},f),C);return F(F({[cr]:Object.keys(u5(N)),[ci]:N||{},[sa]:S||{},[el]:C||{},[iu]:a.minimalFlagCalledEvents===!0},w?{[tl]:w}:{}),j?{[la]:j}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(i)if((n==null?void 0:n.persist)===!1){const a=!ue(this.po.kv.get(ci));this.Ed=i,a||this.At(i)}else this.kd(),this.Ad(i,e,!!(n!=null&&n.partialResponse)),this.At(i);else t&&this.Pd();t||(this.sd=!1),this.xd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.zd(e)}zd(e){if(this.po){if(e===!1)return this.Lt([Ti,Wa]),this.xd(),void Ga.info("All overrides cleared");if(Fe(e))return this.At({[Ti]:c5(e)}),this.xd(),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.Gc=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const i={},a=n.flags,c=n.payloads;return a&&(i[Ti]=Fe(a)?c5(a):a),c&&(i[Wa]=c),Object.keys(i).length&&this.At(i),a===!1&&c===!1?this.Lt([Ti,Wa]):a===!1?this.Lt(Ti):c===!1&&this.Lt(Wa),this.xd(),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({[Ti]:e}),this.xd(),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.Kc){const{flags:t,flagVariants:n}=this.Ud();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.Md("$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=F(F({},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({[cr]:Object.keys(u5(f)),[ci]:f,[ia]:F(F({},this.Md("$stored_person_properties")||{}),c)}),this.xd();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.Md(D0);!i||t?this.Wd(e,n):e(i)}Wd(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({[D0]: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)}})()}Ud(){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),{})}}xd(e){this.Sd();const{flags:t,flagVariants:n}=this.Ud();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.Vd(e,t)}Vd(e,t=!0){const n=this.Md("$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({[ia]:F(F(F({},n),c),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=F({},this.Md("$stored_person_properties")||{});e.forEach(i=>{delete n[i]}),this.At({[ia]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(ia),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this.Md("$stored_group_properties")||{},i=F({},n);for(const a of Object.keys(e))i[a]=F(F({},n[a]),e[a]);this.At({[ra]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Md("$stored_group_properties")||{};this.At({[ra]:F(F({},t),{},{[e]:{}})})}else this.Lt(ra)}reset(){this.Yc++,this.ed=!1,this.Zc={},this.Qc={},this.Ed=void 0,this.Kc=!1,this.td=!1,this.nd=!1,this.$anon_distinct_id=void 0,this.Id(),this.Gc=!1,this.rd=0}}},EA={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Gd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.Zd==="awaiting_config"||this.Zd==="missing_config"?this.Zd:(e=(t=this.Gd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.Zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Zd=Pg,this.Qd=void 0,this.Jd=!1,this.Ke=(()=>{var t,n;if(!(fe!=null&&fe.visibilityState)||fe.visibilityState==="visible")return!0;const i=te==null||(t=te.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;(fe==null?void 0:fe.visibilityState)==="visible"&&(this.Ke=!0,(t=this.Gd)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw ir.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"');fe!=null&&fe.addEventListener&&yt(fe,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Jd=!0,fe==null||(t=fe.removeEventListener)===null||t===void 0||t.call(fe,"visibilitychange",this.an),e?this.Kd(!0):this.stopRecording()}get Xd(){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 te&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(this.Jd||this.Xd&&(!((t=this.Gd)===null||t===void 0)&&t.isStarted))return;const n=!ue(Object.assign)&&!ue(Array.from);this.Xd&&n?(this.Yd(e),ir.info("starting")):(this.Zd=Pg,this.stopRecording())}Yd(e){var t,n;if(this.Xd)if(this.Zd!=="awaiting_config"&&this.Zd!=="missing_config"&&(this.Zd=e5),($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.tv(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.ev,u=>{if(!this.Jd&&this.Xd&&this._instance.sessionManager===c)return u?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),ir.error("could not load recorder",u)):void this.tv(e);this.Zd="disabled"})}}stopRecording(){var e,t;(e=this.Qd)===null||e===void 0||e.call(this),this.Qd=void 0,(t=this.Gd)===null||t===void 0||t.stop()}Kd(e=!1){var t,n;(t=this.Qd)===null||t===void 0||t.call(this),this.Qd=void 0,(n=this.Gd)===null||n===void 0||n.discard({discardProducerEvents:e})}iv(){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")}nv(e,t){if(Ve(e))return null;const n=Jt(e)?e:parseFloat(e);return typeof(i=n)!="number"||!Number.isFinite(i)||0>i||i>1?(ir.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var i}sv(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.nv((c=this.Mr.session_recording)===null||c===void 0?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.nv(u==null?void 0:u.sampleRate,"remote config sampleRate"),m=f??h;Ve(m)&&this.iv();const x=u==null?void 0:u.minimumDurationMilliseconds;i.register({[su]:F(F({cache_timestamp:Date.now(),enabled:!!u},u),{},{networkPayloadCapture:F({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:ue(x)?null:x,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.Qd)===null||t===void 0||t.call(this),this.Qd=(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.sv(t),void this.Kd()):(this.sv(t),void this.startIfEnabledOrStop()):(this.Zd==="awaiting_config"&&(this.Zd="missing_config",ir.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.Gd)===null||n===void 0)&&n.log?this.Gd.log(e,t):ir.warn("log called before recorder was ready")}get ev(){var e,t;const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(su);return(n==null||(t=n.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}rv(){const e=this._instance.get_property(su);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return ir.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}tv(e){var t,n,i;if(!this.Jd&&this.Xd&&this._instance.sessionManager){if(!(!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return ir.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[uk]:!0});var a;if(this.Gd||(this.Gd=(a=$e.__PosthogExtensions__)===null||a===void 0?void 0:a.initSessionRecording(this._instance,this.Ke),this.Gd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.rv())return this.Zd==="missing_config"||this.Zd==="awaiting_config"?void 0:(this.Zd="awaiting_config",ir.info("persisted remote config is stale, requesting fresh config before starting"),void new $k(this._instance).load());this.Zd=e5,(n=(i=this.Gd).setDocumentWasEverVisible)===null||n===void 0||n.call(i,this.Ke),this.Gd.start(e)}else this.Zd=Pg}onRRwebEmit(e){var t,n;(t=this.Gd)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.Gd||(t=this.xa)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Gd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Gd||(t=this.xa)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Gd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.Gd||(n=this.xa)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Gd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Gd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!!(!((n=this.Gd)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Gd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},TA={autocapture:class extends iA{constructor(e){super(new rA(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.ov=this.lv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.av();return!!(e.path||e.search||this.uv(e))}startIfEnabled(){this.isEnabled&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ov=this.lv(),this.startIfEnabled()}stop(){this.hv&&this.hv(),this.hv=void 0,this.dv&&this.dv(),this.dv=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this.vv("pushState"),this.vv("replaceState"),this.fv(),this.uv()&&this.pv())}vv(e){var t;if(!te||!((t=te.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;ku(te.history,e,i=>function(a,c,u){i.call(this,a,c,u),n.gv(e)})}lv(){const e=te==null?void 0:te.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}av(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:st(e)?e:{}}uv(e=this.av()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}mv(e){const t=this.av(),n=this.ov;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.uv(t)&&e.hash!==n.hash))}gv(e){try{const t=this.lv();if(!t)return;this.mv(t)&&this._instance.capture(Tx,{navigation_type:e}),this.ov=t}catch(t){ye.error(`Error capturing ${e} pageview`,t)}}fv(){if(this.hv)return;const e=()=>{this.gv("popstate")};yt(te,"popstate",e),this.hv=()=>{te&&te.removeEventListener("popstate",e)}}pv(){if(this.dv)return;const e=()=>{this.gv("hashchange")};yt(te,"hashchange",e),this.dv=()=>{te&&te.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.yv=!1,this.bo=!1,this.bv=null,this.instance=e,this.yv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[A0]),this.rageclicks=new lj(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return st(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.yv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.bo)return;cA.info("starting..."),this._v(),this.an()}else{var e;clearInterval((e=this.bv)!==null&&e!==void 0?e:void 0),this.wv(),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({[A0]:n}),this.yv=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Sv(e){Fg(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}an(){this.bv&&clearInterval(this.bv),this.bv=(fe==null?void 0:fe.visibilityState)==="visible"?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}_v(){te&&fe&&(this.xv=this.fa.bind(this),yt(te,th,this.xv),this.Cv=e=>this.Cr(e||(te==null?void 0:te.event)),yt(fe,"click",this.Cv,{capture:!0}),this.$v=e=>this.Tv(e||(te==null?void 0:te.event)),yt(fe,"mousemove",this.$v,{capture:!0}),this.Iv=new Ew(this.instance,fM,this.Sv.bind(this)),this.Iv.startIfEnabledOrStop(),this.Mv=this.an.bind(this),yt(fe,bu,this.Mv),this.bo=!0)}wv(){var e;te&&fe&&(this.xv&&te.removeEventListener(th,this.xv),this.Cv&&fe.removeEventListener("click",this.Cv,{capture:!0}),this.$v&&fe.removeEventListener("mousemove",this.$v,{capture:!0}),this.Mv&&fe.removeEventListener(bu,this.Mv),clearTimeout(this.Ev),(e=this.Iv)===null||e===void 0||e.stop(),this.bo=!1)}Pv(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&&Li(m)&&!Pn(m,"body");){if(m===h)return!1;let y;try{var x,v,b;y=(x=(v=(b=m.ownerDocument)===null||b===void 0?void 0:b.defaultView)!==null&&v!==void 0?v:te)===null||x===void 0?void 0:x.getComputedStyle(m).position}catch{return!1}if(Ie(f,y))return!0;m=bk(m)}return!1})(ru(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(vw(e.target)||!Fg(e))return;const i=this.Pv(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&_k(ru(e),this.instance.config.rageclick)&&this.Zs(F(F({},i),{},{type:"rageclick"})),this.Zs(i)}Tv(e){!vw(e.target)&&Fg(e)&&(clearTimeout(this.Ev),this.Ev=setTimeout(()=>{this.Zs(this.Pv(e,"mousemove"))},500))}Zs(e){if(!te)return;const t=this.Mr.disable_capture_url_hashes?ca(te.location.href):te.location.href,n=this.Mr.custom_personal_data_properties,i=this.Mr.mask_personal_data_properties?[...wo,...n||[]]:[],a=wu(t,i,Su);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}fa(){this.Rt&&!ms(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ew,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.yv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Rv=()=>{clearTimeout(this.Av),this.Av=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",F({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,i)=>F(F({},n),{},{[`$web_vitals_${i.name}_event`]:F({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Fv=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.Ov(a);if(ue(c))return;const u=Jt(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${c}`;if(this.Dv&&n.value>=this.Dv)return void Va.error("Ignoring metric with value >= "+this.Dv,n);this.Rt.navigationKey!==u&&(this.Rv(),this.Av=setTimeout(this.Rv,this.flushToCaptureTimeoutMs)),ue(this.Rt.navigationKey)&&(this.Rt.navigationKey=u,this.Rt.url=c),this.Rt.firstMetricTimestamp=ue(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const f=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),h=F(F(F({},n),a?{navigationURL:c}:{}),{},{$current_url:c,timestamp:Date.now()});if(delete h.entries,st(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const m={};for(const x of oA){const v=x==="url"&&typeof n.attribution[x]=="string"?this.Ov(n.attribution[x]):n.attribution[x];ue(v)||(m[x]=v)}h.attribution=m}else delete h.attribution;ue(f)||(h.$session_id=f.sessionId,h.$window_id=f.windowId),this.Rt.metrics.push(h),this.Rt.metrics.length===this.allowedMetrics.length&&this.Rv()},this.Lv=()=>{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.Nv])||(this.Nv==="web-vitals"&&ue(h)?f==null?void 0:f.postHogWebVitalsCallbacks:void 0);if(!ue(m)){const b=m.withoutAttribution,y=this.attributionMetrics;u=!ue(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 x={reportSoftNavs:this.useSoftNavs},v=u&&this.attributionMetrics.indexOf("INP")>-1?F(F({},x),{},{includeProcessedEventEntries:!1}):x;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Fv.bind(this),x),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Fv.bind(this),x),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Fv.bind(this),x),this.allowedMetrics.indexOf("INP")>-1&&c(this.Fv.bind(this),v),this.bo=!0},this.yv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[L0]),this.startIfEnabled()}get qv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=st(this.qv)?(e=this.qv)===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)||Jw:n}get flushToCaptureTimeoutMs(){return(st(this.qv)?this.qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=st(this.qv)?this.qv.web_vitals_attribution:void 0;return ns(e)?e?Jw:[]:Fe(e)?e:lA}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=st(this.qv)?this.qv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Dv(){const e=st(this.qv)&&Jt(this.qv.__web_vitals_max_value)?this.qv.__web_vitals_max_value:Zw;return e>0&&6e4>=e?Zw: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=st(this.qv)?this.qv.web_vitals:ns(this.qv)?this.qv:void 0;return ns(t)?t:this.yv}startIfEnabled(){this.isEnabled&&!this.bo&&(Va.info("enabled, starting..."),this.No(this.Lv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const n=st(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=st(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[L0]:n}),this._instance.persistence.register({[JS]:i})),this.yv=n,this.startIfEnabled()}get Nv(){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.Nv,a=n==null?void 0:n.postHogWebVitalsCallbacksByFlavor;a!=null&&a[i]||i==="web-vitals"&&ue(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()})}Ov(e){const t=e||(te==null?void 0:te.location.href);if(!t)return void Va.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?ca(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...wo,...i||[]]:[];return wu(n,a,Su)}}},MA={exceptionObserver:class{constructor(e){var t;this.Lv=()=>{var n;if(!te||!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.jv&&this.Mr.capture_unhandled_errors&&(this.jv=i(this.captureException.bind(this))),!this.Bv&&this.Mr.capture_unhandled_rejections&&(this.Bv=a(this.captureException.bind(this))),!this.Hv&&this.Mr.capture_console_errors&&(this.Hv=c(this.captureException.bind(this)))}catch(u){Hc.error("failed to start",u),this.zv()}},this._instance=e,this.Uv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[R0]),this.wt=new jT(F(F({},(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,$:Hc})),this.Mr=this.Wv(),this.startIfEnabledOrStop()}Wv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return st(e)?t=F(F({},t),e):(ue(e)?this.Uv:e)&&(t=F(F({},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?(Hc.info("enabled"),this.zv(),this.No(this.Lv)):this.zv()}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 Hc.error("failed to load script",a);e()})}zv(){var e,t,n;(e=this.jv)===null||e===void 0||e.call(this),this.jv=void 0,(t=this.Bv)===null||t===void 0||t.call(this),this.Bv=void 0,(n=this.Hv)===null||n===void 0||n.call(this),this.Hv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.Uv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[R0]:this.Uv}),this.Mr=this.Wv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.Wv()}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 Hc.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.Vv=[],this.Gv=new $T([new ZT,new l6,new e6,new JT,new r6,new i6,new n6,new a6],(function(i,...a){return(c,u=0)=>{const f=[],h=c.split(`
|
|
68
|
-
`),m=Math.min(h.length,u+1e3),x=[];for(let y=u;m>y;y++){const w=h[y];if(w.length>1024)continue;const j=ew.test(w)?w.replace(ew,"$1"):w;if(!j.match(/\S*Error: /)){for(const N of a){const S=N(j,i);if(S){f.push(S);const C=QT(f);if(C){for(let E=x.length-1;E>=0;E--){const L=x[E];if(C.start>=L.start+L.length)break;x.pop()}x.push(C)}break}}if(KT(f,x)>=50)break}}const v=[...x].sort((y,w)=>w.start-y.start),b=v[v.length-1];if(b){const y=DS(f,b);f.splice(b.start-y,y);for(const w of v)w.start-=y}for(const y of v)XT(f,y);return x.some(y=>y.start===0&&f.length===y.length)&&(function(y){const w=y.map(N=>`${N.function}|${N.filename}|${N.lineno}|${N.colno}|${N.module}`);let j=0;for(let N=1;w.length>N;N++)WT(w,N,j)&&(j=N);y.push(...y.splice(0,j))})(f),(function(y){if(!y.length)return[];const w=Array.from(y);return w.reverse(),w.slice(0,50).map(j=>{return F(F({},j),{},{filename:j.filename||(N=w,N[N.length-1]||{}).filename,function:j.function||"?"});var N})})(f)}})("web:javascript",qT,YT)),this._instance=e,this.Vv=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.Zv=Kf(this.Qv()),this.Jv=new c6(this.Zv)}onConfigChange(){this.Zv=Kf(this.Qv()),this.Jv.setConfig(this.Zv)}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.Vv=c,this._instance.persistence&&this._instance.persistence.register({[WS]:this.Vv,[O0]:u})}get Kv(){var e;const t=!!this._instance.get_property(O0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Gv.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.Zv.enabled)try{if(!Je(e)||e.trim().length===0)return void li.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)=>o6.has(f)?(c.push(f),u):(u[f]=a[f],u),{}),droppedKeys:c}})(this.Xv(t));i.length>0&&li.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Jv.add(F({[Qf]:e,[Xf]:new Date().toISOString()},n))}catch(n){li.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.Yv(t)){if(this.tf(t))return this.ef("Exception dropped: matched a suppression rule"),void li.info("Skipping exception capture because a suppression rule matched");if(!this.Kv&&this.if(t))return this.ef("Exception dropped: thrown by a browser extension"),void li.info("Skipping exception capture because it was thrown by an extension");if(!this.Kv&&this.nf(t))return this.ef("Exception dropped: thrown by an injected browser script"),void li.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.sf(t))return this.ef("Exception dropped: thrown by the PostHog SDK"),void li.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.Zv.enabled&&Ve(e.$exception_steps)?this.rf(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",oh:!0});return a&&this.Jv.clear(),a}catch(a){return d5(a)||li.error("Failed to capture exception event. Dropping this exception.",a),void this.Jv.clear()}}catch(t){return void(d5(t)||li.error("Failed to process exception event. Ignoring this exception.",t))}}rf(e){try{const t=this.Jv.getAttachable();return t.length===0?e:F(F({},e),{},{$exception_steps:t})}catch(t){return li.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}ef(e){this.Zv.enabled&&this.Jv.add({[Qf]:e,[Xf]:new Date().toISOString()})}Xv(e){return st(e)?F({},e):{}}Qv(){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:{}}tf(e){if(e.length===0)return!1;try{const t=e.reduce((n,{type:i,value:a})=>(Je(i)&&i.length>0&&n.$exception_types.push(i),Je(a)&&a.length>0&&n.$exception_values.push(a),n),{$exception_types:[],$exception_values:[]});return this.Vv.some(n=>{const i=n.values.map(a=>{const c=sj[a.operator],u=t[a.key];if(!c||!u)return!1;const f=Fe(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 li.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}if(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&&yA.some(a=>i.startsWith(a)));return n.length!==0&&(!n.every(({filename:i})=>!!i&&i.startsWith(K0))||e.some(({type:i,value:a})=>i==="NoResponse"||Je(a)&&bA.some(({value:c,exact:u})=>u?a===c:a.includes(c)))&&!t.some(({in_app:i,filename:a})=>i&&!(a!=null&&a.startsWith(K0))))}nf(e){return e.some(({value:t})=>Je(t)&&_A.some(n=>t.includes(n)))}sf(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}Yv(e){return!Ve(e)&&Fe(e)}}},AA=F({productTours:class{get xa(){return this._instance.persistence}constructor(e){this.lf=null,this.af=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({[Nx]:!!t.productTours}),!Ug(this._instance))return!this.lf&&Ve((n=this.xa)===null||n===void 0?void 0:n.props.ph_product_tours)||vf.info("product tours disabled; stopping and clearing cached tours"),(i=this.lf)===null||i===void 0||i.stop(),this.lf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.lf&&Ug(this._instance)&&this.No(()=>this.uf())}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?vf.error("Could not load product tours script",a):e()})}uf(){var e;!this.lf&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.lf=$e.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Fe(this.af)&&!t)return void e(this.af,{isLoaded:!0});const n=this.xa;if(n){const i=n.props[$0];if(Fe(i)&&!t)return this.af=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(!Ug(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||vf.warn(u):vf.error(u),void e([],{isLoaded:!1,error:u})}const c=Fe(i.json.product_tours)?i.json.product_tours:[];this.af=c,n&&n.register({[$0]:c}),e(c,{isLoaded:!0})}})}getActiveProductTours(e){Ve(this.lf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.lf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.lf)===null||t===void 0||t.showTourById(e)}previewTour(e){this.lf?this.lf.previewTour(e):this.No(()=>{var t;this.uf(),(t=this.lf)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.lf)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.lf)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.lf)===null||e===void 0||e.previousStep()}clearCache(){var e;this.af=null,(e=this.xa)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.lf)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.lf)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.lf)===null||t===void 0||t.cancelPendingTour(e)}}},Sh),RA={siteApps:class{constructor(e){this._instance=e,this.hf=0,this.cf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}df(e,t){if(!t)return;const n=this.globalsForEvent(t);this.cf.push(n),this.cf.length>1e3&&(this.cf=this.cf.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.df.bind(this));this.vf=()=>{e(),this.cf=[],this.vf=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")||[],x=this._instance.get_property("$stored_group_properties")||{};for(const[y,w]of Object.entries(x))h[y]={id:m[y],type:y,properties:w};const{$set_once:v,$set:b}=e;return{event:F(F({},PS(e,uA)),{},{properties:F(F(F({},e.properties),b?{$set:F(F({},(t=(n=e.properties)===null||n===void 0?void 0:n.$set)!==null&&t!==void 0?t:{}),b)}:{}),v?{$set_once:F(F({},(i=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&i!==void 0?i:{}),v)}:{}),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}}ff(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)||(Ci.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)||(Ci.error("prepare_external_dependency_script returned null"),null):e}pf(){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=fe==null?void 0:fe.defaultView,m=h==null||(e=h.Node)===null||e===void 0?void 0:e.prototype;if(!h||!m)return()=>{};if(this.hf++,this.gf)return this.mf();const x=[],v=this,b=new WeakSet,y=(N,S,C)=>{if(!(N!=null&&N[S]))return;const E=N[S];N[S]=C(E),x.push(()=>{N[S]=E})},w=N=>{if(b.has(N))return N;const S=v.ff(N);return S&&b.add(S),S},j=N=>N.map(S=>typeof S=="string"?S:w(S)).filter(S=>!Zt(S));return y(m,"appendChild",N=>function(S){const C=w(S);return C?N.call(this,C):S}),y(m,"insertBefore",N=>function(S,C){const E=w(S);return E?N.call(this,E,C):S}),y(m,"replaceChild",N=>function(S,C){const E=w(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=w(C);return E?N.call(this,S,E):null}),this.gf=()=>{x.forEach(N=>N()),this.gf=void 0},this.mf()}mf(){let e=!1;return()=>{var t;e||(e=!0,this.hf--,this.hf===0&&((t=this.gf)===null||t===void 0||t.call(this)))}}yf(e,t=!0){const n=this.pf();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.cf.length&&(Ci.info(`Processing ${this.cf.length} events for site app with id ${e.id}`),this.cf.forEach(u=>this.yf(()=>{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.vf)===null||c===void 0||c.call(this))};let i=!1;const a=c=>{t.errored=!c,t.loaded=!0,Ci.info(`Site app with id ${e.id} ${c?"loaded":"errored"}`),i&&n()};try{const{processEvent:c}=this.yf(u=>e.init({posthog:this._instance,callback(f){u(),a(f)}}),!1);c&&(t.processEvent=c),i=!0}catch(c){Ci.error(t5+e.id,c),a(!1)}if(i&&t.loaded)try{n()}catch(c){Ci.error(`Error while processing buffered events PostHog app with config id ${e.id}`,c),t.errored=!0}}bf(){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)}_f(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.yf(()=>{var i;return(i=n.processEvent)===null||i===void 0?void 0:i.call(n,t)})}catch(i){Ci.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.bf(),void this._instance.on("eventCaptured",f=>this._f(f))):void Ci.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.vf)===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 Ci.error(t5+f,m)})}else Ci.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},OA={tracingHeaders:class{constructor(e){this._instance=e,this.wf=void 0,this.kf=void 0,this.Sf=void 0,this.Lv=()=>{const t=this.xf();var n,i;t?(ue(this.wf)&&(this.wf=(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)),ue(this.kf)&&(this.kf=(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.zv()}}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 aA.error("failed to load script",a);e()})}Cf(){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}xf(){const e=this.Cf();return Fe(e)?(Fe(this.Sf)?this.Sf.splice(0,this.Sf.length,...e):this.Sf=[...e],e.length>0?this.Sf:void 0):(Fe(this.Sf)&&this.Sf.splice(0),this.Sf=e||void 0,this.Sf)}zv(){var e,t;(e=this.wf)===null||e===void 0||e.call(this),(t=this.kf)===null||t===void 0||t.call(this),this.wf=void 0,this.kf=void 0}startIfEnabledOrStop(){this.xf()?this.No(this.Lv):this.zv()}}},LA=F({surveys:class extends dA{constructor(e){var t;super(new gA(e),(t=e,{get projectToken(){return t.config.token},kv:new mA(t)})),this._instance=e}Fh(e,t){const n=t.query?Au(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})})}}},Sh),DA={toolbar:class{constructor(e){this.instance=e}$f(e){$e.ph_toolbar_state=e}Tf(){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(P0(this.instance.config)||!te||!fe)return!1;e=(i=e)!==null&&i!==void 0?i:te.location,n=(a=n)!==null&&a!==void 0?a:te.history;try{if(!t){try{te.localStorage.setItem("test","test"),te.localStorage.removeItem("test")}catch{return!1}t=te==null?void 0:te.localStorage}const c=xA||ih(e.hash,"__posthog")||ih(e.hash,"state");let u;const f=c?K_(()=>JSON.parse(atob(decodeURIComponent(c))))||K_(()=>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(s5)||"{}"),u.source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token||(this.loadToolbar(u),0))}catch{return!1}}If(e){const t=$e.ph_load_toolbar||$e.ph_load_editor;!Ve(t)&&kn(t)?t(e,this.instance):i5.warn("No toolbar load function found")}loadToolbar(e){const t=!!(fe!=null&&fe.getElementById("__POSTHOG_TOOLBAR__"));if(!te||t)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=F(F({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(te.localStorage.setItem(s5,JSON.stringify(F(F({},i),{},{source:void 0}))),this.Tf()===2)this.If(i);else if(this.Tf()===0){var a,c;this.$f(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 i5.error("[Toolbar] Failed to load",u),void this.$f(0);this.$f(2),this.If(i)}),yt(te,"turbolinks:load",()=>{this.$f(0),this.loadToolbar(i)})}return!0}Mf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},zA=F({experiments:class Jn{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(i=>{Jn.Ef("retrieved web experiments from the server"),this.Pf=new Map,i.forEach(a=>{if(a.feature_flag_key){var c;this.Pf&&(Jn.Ef("setting flag key ",a.feature_flag_key," to web experiment ",a),(c=this.Pf)===null||c===void 0||c.set(a.feature_flag_key,a));const u=this._instance.getFeatureFlag(a.feature_flag_key);Je(u)&&a.variants[u]&&this.Rf(a.name,u,a.variants[u].transforms)}else if(a.variants)for(const u in a.variants){const f=a.variants[u];Jn.Af(f,this._instance)&&this.Rf(a.name,u,f.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())Jn.Ef(f5);else if(!this.Mr.disable_web_experiments){if(Ve(this.Pf))return this.Pf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Jn.Ef("applying feature flags",t),t.forEach(n=>{var i;if(this.Pf&&(!((i=this.Pf)===null||i===void 0)&&i.has(n))){var a;const c=this._instance.getFeatureFlag(n),u=(a=this.Pf)===null||a===void 0?void 0:a.get(n);c&&(u!=null&&u.variants[c])&&this.Rf(u.name,c,u.variants[c].transforms)}})}}previewWebExperiment(){const t=Jn.getWindowLocation();if(t!=null&&t.search){const n=_o(t==null?void 0:t.search,"__experiment_id"),i=_o(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Jn.Ef(`previewing web experiments ${n} && ${i}`),this.getWebExperiments(a=>{this.Ff(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||[])})}Ff(t,n,i){const a=i.filter(c=>c.id===t);a&&a.length>0&&(Jn.Ef(`Previewing web experiment [${a[0].name}] with variant [${n}]`),this.Rf(a[0].name,n,a[0].variants[n].transforms))}static Af(t,n){return!Ve(t.conditions)&&Jn.Of(t,n)&&Jn.Df(t)}static Of(t,n){var i;if(Ve(t.conditions)||Ve((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const a=Jn.getWindowLocation();if(a){var c,u,f;const h=gk(n,a.href);return!(!((c=t.conditions)===null||c===void 0)&&c.url)||wA[(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 te==null?void 0:te.location}static Df(t){var n;if(Ve(t.conditions)||Ve((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const i=Ek();if(i.utm_source){var a,c,u,f,h,m,x,v;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,w=!(!((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=!(!((x=t.conditions)===null||x===void 0||(x=x.utm)===null||x===void 0)&&x.utm_term)||((v=t.conditions)===null||v===void 0||(v=v.utm)===null||v===void 0?void 0:v.utm_term)==i.utm_term;return b&&w&&j&&y}return!1}static Ef(t,...n){ye.info(`[WebExperiments] ${t}`,n)}Rf(t,n,i){this._is_bot()?Jn.Ef(f5):n!=="control"?i.forEach(a=>{if(a.selector){var c;Jn.Ef(`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)})}}):Jn.Ef("Control variants leave the page unmodified.")}_is_bot(){return jn&&this._instance?ej(jn,this.Mr.custom_blocked_useragents):void 0}}},Sh),$A={conversations:class{constructor(e){this._instance=e,this.Lf=void 0,this._conversationsManager=null,this.Nf=!1,this.ne=null,this.qf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.jf=e.ok,!e.ok))return;const t=e.config.conversations;Ve(t)||(ns(t)?this.Lf=t:(this.Lf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Lf=void 0,this.ne=null,this.jf=void 0,this.qf=!1}loadIfEnabled(){if(this._conversationsManager||this.Nf||this._instance.config.disable_conversations||P0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(e&&!ue(this.Lf)&&this.Lf)if(this.ne&&this.ne.token){this.Nf=!0;try{const t=e.initConversations;if(t)return this.Bf(t),void(this.Nf=!1);const n=e.loadExternalDependency;if(!n)return void this.Hf(Ex);n(this._instance,"conversations",i=>{i||!e.initConversations?this.Hf("Could not load conversations script",i):this.Bf(e.initConversations),this.Nf=!1})}catch(t){this.Hf("Error initializing conversations",t),this.Nf=!1}}else qs.error("Conversations enabled but missing token in remote config.")}Bf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.qf=!1,qs.info("Conversations loaded successfully")}catch(t){this.Hf("Error completing conversations initialization",t)}else qs.error("Cannot complete initialization: remote config is null")}Hf(e,t){qs.error(e,t),this._conversationsManager=null,this.Nf=!1,this.qf=!0}show(){this._conversationsManager?this._conversationsManager.show():qs.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Lf===!0&&!Zt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":P0(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.jf===!1?"remote_config_failed":ue(this.Lf)?this.jf?"disabled_in_project":"remote_config_pending":this.Lf?Ve(this.ne)||!this.ne.token?"missing_token":$e!=null&&$e.__PosthogExtensions__?this.Nf?"initializing":this.qf?"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):(qs.warn(Ya),null)})()}getMessages(e,t){var n=this;return zt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(qs.warn(Ya),null)})()}markAsRead(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(qs.warn(Ya),null)})()}getTickets(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(qs.warn(Ya),null)})()}requestRestoreLink(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(qs.warn(Ya),null)})()}restoreFromToken(e){var t=this;return zt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(qs.warn(Ya),null)})()}restoreFromUrlToken(){var e=this;return zt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qs.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}yh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}bh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},BA={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.zf=!1,this.Uf=!1,this.Wf=!1,this.$=Xt("[logs]"),this.Vf=F(F({},this.$),{},{error:(...n)=>{n.some(m5)||this.$.error(...n)}}),this.ia=[],this.Gf=[],this.rd=0,this.So=!1,this.Zf=[],this.Qf=[],this.Jf=!1,this.Kf=!1,this.Xf=()=>{var n,i;this.So||(this.rd=0,(n=this.Yf)===null||n===void 0||n.onReconnect(),(i=this.tp)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.zf=!0),te&&yt(te,"online",this.Xf)}ep(e,t,n,i){var a;const c=h5((a=this._instance)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.logs,n);return[new b6(this.np(e,t),c,this.Vf,()=>this.sp(),u=>u(),void 0,i),c]}rp(){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.Yf&&this.op===t||((n=this.Yf)===null||n===void 0||n.reset(),this.op=t,[this.Yf,this.lp]=this.ep(()=>this.ia,i=>{this.ia=i})),this.Yf}ap(){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.tp&&this.up===t||((n=this.tp)===null||n===void 0||n.reset(),this.up=t,[this.tp,this.hp]=this.ep(()=>this.Gf,i=>{this.Gf=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},p5)),this.tp}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.zf=!0),(this.zf||this.cp()&&this.dp())&&this.vp();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.fp(),(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.po=void 0,this.Wf=!1,te==null||te.removeEventListener("online",this.Xf),(t=this.pp)===null||t===void 0||t.call(this),this.pp=void 0,(n=this.Yf)===null||n===void 0||n.reset(),(i=this.tp)===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.gp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!i}),i?(this.zf=!0,this.Uf||this.vp(),this.loadIfEnabled()):this.gp())}reset(){var e,t,n,i;this.fp(),(e=this.Yf)===null||e===void 0||e.clearQueue(),this.ia=[],(t=this.Yf)===null||t===void 0||t.reset(),(n=this.tp)===null||n===void 0||n.clearQueue(),this.Gf=[],(i=this.tp)===null||i===void 0||i.reset(),this.rd=0}captureLog(e){this.So||this.rp().captureLog(e)}captureConsoleLog(e){this.So||this.ap().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.So||this.ap().captureLog(e,{context:t,occurredAtMs:n})}dp(){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])}cp(){var e,t,n;return!(!((e=this._instance)===null||e===void 0||(t=e.Xl)===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)}wh(){var e;this.fp(),(e=this.tp)===null||e===void 0||e.clearQueue(),this.Gf=[]}gp(){this.zf||this.fp()}vp(){var e;if(this.Jf||!($e!=null&&$e.console))return;const t=h5((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let n=!0;this.Qf.push(()=>{n=!1});for(const i of SA){let a;try{a=kA($e.console[i])}catch{continue}a&&this.Qf.push(ku($e.console,i,c=>{const u=(...f)=>{try{n&&this.mp(i,f,t)}catch{}return c.apply($e.console,f)};return u.__rrweb_original__=a,u}))}this.Jf=!0,this.yp=setTimeout(()=>{this.fp()},3e4)}mp(e,t,n){var i;if(this.Jf&&!this.Kf&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(n>this.Zf.length){this.Kf=!0;try{this.Zf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.sp()})}finally{this.Kf=!1}}}else this.fp()}fp(){if(this.Zf=[],this.Jf){this.Jf=!1,this.yp&&(clearTimeout(this.yp),this.yp=void 0);for(const e of this.Qf)e();this.Qf=[]}}bp(){const e=this.Zf;return this.fp(),e}get logger(){return this._p||(this._p={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._p}flushLogs(e){e?this.wp(e):(this.Yf&&this.Yf.flush().catch(t=>this.kp(t)),this.tp&&this.tp.flush().catch(t=>this.kp(t)))}kp(e){m5(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.So||!this.zf||this.Uf||this.Wf)return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.fp();const t=e.loadExternalDependency;if(!t)return this.$.error(Ex),void this.fp();this.Wf=!0;try{t(this._instance,"logs",n=>{if(this.Wf=!1,this.So||!this.zf)return;const i=e.logs;if(n||!(i!=null&&i.initializeLogs))this.$.error("Could not load logs script",n),this.fp();else{var a;const f=this.bp();var c,u;this.pp=i.initializeLogs((a=this.po)!==null&&a!==void 0?a:this._instance),this.Uf=!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.Wf=!1,n}}np(e,t){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Mi.LogsQueue?e():void 0,setPersistedProperty(i,a){var c;i===Mi.LogsQueue&&t((c=a)!==null&&c!==void 0?c:[])},js:i=>this.js(i),getLibraryId:()=>yn.LIB_NAME,getLibraryVersion:()=>yn.LIB_VERSION}}js(e){return new Promise(t=>{if(Nk(this.rd,3))return void t({kind:"fatal",error:Hg(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:Hg(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Sp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:c=>{const u=c.statusCode;if(this.xp(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:Hg(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}`)})}}})})}xp(e){(e!==0||this._instance.__loaded)&&(this.rd=Ck(e,this.rd,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.")))}wp(e){this.ia.length>0&&this.Cp(e,this.ia,this.lp,yn.LIB_NAME,t=>{this.ia=t}),this.Gf.length>0&&this.Cp(e,this.Gf,this.hp,p5,t=>{this.Gf=t})}Cp(e,t,n,i,a){if(t.length===0)return;const c=t.map(f=>f.record);a([]);const u=VS(c,qS(n,yn.LIB_NAME,yn.LIB_VERSION),i,yn.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Sp(),data:u,compression:"best-available",batchKey:"logs",transport:e})}Sp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}sp(){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?ca($e.location.href):$e.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(t.activeFeatureFlags=n)}return t}}},PA={metrics:class{constructor(e){this._instance=e,this.$=Xt("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.So)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.$p?this.$p=(n=>{let i=!0;const a=()=>i?(f=>{var h;const m=(h=f.config.metrics)===null||h===void 0?void 0:h.network;return m===!0?{}:m||void 0})(n):void 0,c=NA(n,a),u=CA(n,a);return()=>{i=!1,c(),u()}})(this._instance):!t&&this.$p&&(this.$p(),this.$p=void 0)}rp(){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.Yf&&this.op===t||((n=this.Yf)===null||n===void 0||n.reset(),this.op=t,this.Yf=new y6(this.np(),(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.Yf}count(e,t=1,n){this.rp().count(e,t,n)}gauge(e,t,n){this.rp().gauge(e,t,n)}histogram(e,t,n){this.rp().histogram(e,t,n)}flush(e){if(!this.Yf)return Promise.resolve();if(e){const t=this.Yf.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.Yf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Yf)===null||e===void 0||e.reset()}dispose(){var e,t;this.So=!0,(e=this.$p)===null||e===void 0||e.call(this),this.$p=void 0,(t=this.Yf)===null||t===void 0||t.reset()}np(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:n=>t.Ys(n),getLibraryId:()=>yn.LIB_NAME,getLibraryVersion:()=>yn.LIB_VERSION}}Ys(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(F(F({method:"POST",url:this.Tp(),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}`)})}}}))})}Tp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};uu.__defaultExtensionClasses=F({},F(F(F(F(F(F(F(F(F(F(F(F(F({},Sh),EA),TA),MA),AA),RA),LA),OA),DA),zA),$A),BA),PA));const FA=(function(){yn.SDK_DIST_CHANNEL="npm";const e=ou[Kc]=new uu;return(function(){function t(){t.done||(t.done=!0,Zk=!1,jt(ou,function(n){n._dom_loaded()}))}fe!=null&&fe.addEventListener?fe.readyState==="complete"?t():yt(fe,"DOMContentLoaded",t,{capture:!1}):te&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var ju=FA;const UA="https://us.i.posthog.com",fj="cc-telemetry-enabled";let Z0=!1,Nu=!1;function IA(){return UA}function HA(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(fj);return e===null?!0:e==="true"}function hj(e){Z0&&(e?(ju.opt_in_capturing({captureEventName:null}),Nu=!0):(ju.opt_out_capturing(),Nu=!1))}function ZB(e){typeof localStorage<"u"&&localStorage.setItem(fj,String(e)),hj(e)}function qA(){const e=void 0;return e?(ju.init(e,{api_host:IA(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),Z0=!0,hj(HA()),!0):(Z0=!1,Nu=!1,!1)}function Bx(e,t){Nu&&ju.capture(e,t)}function da(e,t){Nu&&ju.captureException(e,t)}function VA(e){Bx("$pageview",{$current_url:e})}const Di="/api",pj="companion_auth_token";function fa(){if(typeof window>"u")return{};const e=localStorage.getItem(pj);return e?{Authorization:`Bearer ${e}`}:{}}function rl(e){e===401&&typeof window<"u"&&(localStorage.removeItem(pj),Vn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>o4);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function _n(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ru(e,t,n,i){Bx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function zi(e,t,n,i,a){Bx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),da(i,{method:e,path:t,status:a})}async function He(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...fa()},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 zi("POST",e,_n()-n,u,a.status),i=!0,u}return Ru("POST",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("POST",e,_n()-n,a),a}}async function ze(e){const t=_n();let n=!1;try{const i=await fetch(`${Di}${e}`,{headers:{...fa()}});if(!i.ok){rl(i.status);const a=await i.json().catch(()=>({error:i.statusText})),c=new Error(a.error||i.statusText);throw zi("GET",e,_n()-t,c,i.status),n=!0,c}return Ru("GET",e,_n()-t,i.status),i.json()}catch(i){throw n||zi("GET",e,_n()-t,i),i}}async function Vs(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...fa()},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 zi("PUT",e,_n()-n,u,a.status),i=!0,u}return Ru("PUT",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("PUT",e,_n()-n,a),a}}async function GA(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...fa()},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 zi("PATCH",e,_n()-n,u,a.status),i=!0,u}return Ru("PATCH",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("PATCH",e,_n()-n,a),a}}async function Gs(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...fa()},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 zi("DELETE",e,_n()-n,u,a.status),i=!0,u}return Ru("DELETE",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("DELETE",e,_n()-n,a),a}}async function YA(e,t){const n=await fetch(`${Di}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...fa()},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 x of m){if(!x.trim())continue;let v="",b="";for(const w of x.split(`
|
|
71
|
-
`))w.startsWith("event:")?v=w.slice(6).trim():w.startsWith("data:")&&(b=w.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(v==="progress")t(y);else if(v==="done")u=y;else if(v==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function QA(){try{const e=await fetch(`${Di}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function g5(e){try{const t=await fetch(`${Di}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const 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=>Gs(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${Di}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...fa()}});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)=>GA(`/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)=>Vs(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Gs(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>ze("/sandboxes"),getSandbox:e=>ze(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Vs(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Gs(`/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=>Vs("/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)=>Vs(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Gs(`/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=>Vs("/linear/project-mappings",e),removeLinearProjectMapping:e=>Gs("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Vs(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Gs(`/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)=>Gs("/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(`${Di}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...fa()}});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)=>Vs("/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)=>Vs("/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)=>Vs(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Gs(`/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)=>Vs(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Gs(`/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=>Gs(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>ze("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Vs(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Gs(`/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)=>Vs(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Gs(`/prompts/${encodeURIComponent(e)}`)};let x5=!1;function v5(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 b5(){return new Promise(()=>{})}function XA(){if(x5||typeof window>"u")return;x5=!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 v5(i)}catch{return b5()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await v5(n)}catch{return b5()}}}})}catch{}}const y5="#/session/",_5="#/agents/";let w5=!1;function Px(){w5||(XA(),w5=!0)}function Fx(e){if(Px(),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(_5)){const n=e.slice(_5.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(y5)){const n=e.slice(y5.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function KA(e){return`#/session/${e}`}function Ux(e,t=!1){Px();const n=KA(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function qg(e=!1){Px(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function WA(){const[e,t]=k.useState(""),[n,i]=k.useState(null),[a,c]=k.useState(!1),u=W(x=>x.setAuthToken),f=k.useCallback(async x=>{x.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}c(!0),i(null),await g5(v)?u(v):i("Invalid token"),c(!1)},[e,u]);k.useEffect(()=>{QA().then(x=>{if(x){u(x);return}const b=new URLSearchParams(window.location.search).get("token");b&&(c(!0),g5(b).then(y=>{if(y){u(b);const w=new URL(window.location.href);w.searchParams.delete("token"),window.history.replaceState({},"",w.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:x=>{t(x.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 Eo=O2();function ZA({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,m]=k.useState("none");return Eo.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:x=>x.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 JA(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function e8({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 t8({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 Bf({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:v,editingSessionId:b,editingName:y,setEditingName:w,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),U=k.useRef(null),D=k.useRef(null),X=n?"exited":JA(e,a),P=e.cwd||"";k.useEffect(()=>{if(!O)return;function A(K){var q;U.current&&!U.current.contains(K.target)&&D.current&&!D.current.contains(K.target)&&(R(!1),(q=D.current)==null||q.focus())}function de(K){var q,H,I;if(K.key==="Escape"){R(!1),(q=D.current)==null||q.focus();return}if(K.key==="Tab"){R(!1);return}if((K.key==="ArrowDown"||K.key==="ArrowUp")&&((H=U.current)!=null&&H.contains(document.activeElement)||D.current===document.activeElement)){K.preventDefault();const re=(I=U.current)==null?void 0:I.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const ve=document.activeElement,M=Array.from(re).indexOf(ve);K.key==="ArrowDown"?re[M<re.length-1?M+1:0].focus():re[M>0?M-1:re.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",de),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",de)}},[O]),k.useEffect(()=>{O&&requestAnimationFrame(()=>{var A,de;(de=(A=U.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||de.focus()})},[O]);const Q=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(e8,{status:X}),L?l.jsx("input",{ref:S,value:y,onChange:A=>w(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:()=>v(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(t8,{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:U,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>Q(()=>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=>Q(()=>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=>Q(()=>x(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=>Q(()=>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 n8({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:m,onUnarchive:x,onDelete:v,onClearRecentlyRenamed:b,editingSessionId:y,editingName:w,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 U;const R=((U=c.get(O.id))==null?void 0:U.size)??0;return l.jsx(Bf,{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:x,onDelete:v,onClearRecentlyRenamed:b,editingSessionId:y,editingName:w,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:C},O.id)})})]})}function s8(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function i8(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function r8(e){const t=new Map;for(const i of e){const a=s8(i.cwd,i.repoRoot||void 0,i.isContainerized),c=i8(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 a8=[{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"}],l8=[{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"}],o8=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],c8=new Map(l8.map(e=>[e.id,e]));function u8(){var xr,Bi;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),[x,v]=k.useState(null),[b,y]=k.useState(!1),[w,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=W(le=>le.sessions),U=W(le=>le.sdkSessions),D=W(le=>le.currentSessionId),X=W(le=>le.cliConnected),P=W(le=>le.cliReconnecting),Q=W(le=>le.sessionStatus),A=W(le=>le.removeSession),de=W(le=>le.sessionNames),K=W(le=>le.recentlyRenamed),q=W(le=>le.clearRecentlyRenamed),H=W(le=>le.pendingPermissions),I=W(le=>le.linkedLinearIssues),re=W(le=>le.collapsedProjects),ve=W(le=>le.toggleProjectCollapse),M=Fx(C);k.useEffect(()=>{let le=!0;async function xe(){try{const rt=await ke.listSessions();if(le){const It=W.getState();It.setSdkSessions(rt);const wn=W.getState(),Nn=new Set(rt.map(xt=>xt.sessionId));for(const xt of wn.sessions.keys())!Nn.has(xt)&&wn.connectionStatus.get(xt)!=="connected"&&wn.removeSession(xt);dT(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{}}xe();const we=setInterval(xe,5e3);return()=>{le=!1,clearInterval(we)}},[]),k.useEffect(()=>{const le=()=>E(window.location.hash);return window.addEventListener("hashchange",le),()=>window.removeEventListener("hashchange",le)},[]);function Ee(le){Ux(le),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}function Ae(){qg(),W.getState().newSession(),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function z(){e&&n.trim()&&(W.getState().setSessionName(e,n.trim()),ke.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function B(){t(null),i("")}function oe(le,xe){t(le),i(xe)}const _e=k.useCallback((le,xe)=>{le.stopPropagation(),j(xe)},[]),Ne=k.useCallback(async le=>{try{y0(le),await ke.deleteSession(le)}catch{}W.getState().currentSessionId===le&&qg(),A(le)},[A]),Me=k.useCallback(()=>{w&&(Ne(w),j(null))},[w,Ne]),Le=k.useCallback(()=>{j(null)},[]),De=k.useCallback(()=>{S(!0)},[]),Ce=k.useCallback(async()=>{S(!1);const le=W.getState(),xe=new Set;for(const rt of le.sessions.keys())xe.add(rt);for(const rt of le.sdkSessions)xe.add(rt.sessionId);const we=Array.from(xe).filter(rt=>{const It=le.sdkSessions.find(wn=>wn.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(!w&&!N)return;requestAnimationFrame(()=>{var xe,we;(we=(xe=O.current)==null?void 0:xe.querySelector("button"))==null||we.focus()});function le(xe){var wn;if(xe.key==="Escape"){N?Re():Le();return}if(xe.key!=="Tab")return;const we=(wn=O.current)==null?void 0:wn.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];xe.shiftKey&&document.activeElement===rt?(xe.preventDefault(),It.focus()):!xe.shiftKey&&document.activeElement===It&&(xe.preventDefault(),rt.focus())}return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[w,N,Le,Re]);const Ft=k.useCallback(async(le,xe)=>{le.stopPropagation();const we=U.find(rn=>rn.sessionId===xe),rt=R.get(xe),It=(rt==null?void 0:rt.is_containerized)||!!(we!=null&&we.containerId)||!1,wn=I.get(xe),Nn=((wn==null?void 0:wn.stateType)||"").toLowerCase();if(wn&&!(Nn==="completed"||Nn==="canceled"||Nn==="cancelled"))try{const rn=await ke.getArchiveInfo(xe);if(rn.issueNotDone){m(xe),v(rn),y(It);return}}catch{}if(It){f(xe);return}Kt(xe)},[U,R,I]),Kt=k.useCallback(async(le,xe,we)=>{try{y0(le);const rt={};xe&&(rt.force=!0),we&&we!=="none"&&(rt.linearTransition=we),await ke.archiveSession(le,Object.keys(rt).length>0?rt:void 0)}catch{}W.getState().currentSessionId===le&&(qg(),W.getState().newSession());try{const rt=await ke.listSessions();W.getState().setSdkSessions(rt)}catch{}},[]),Ut=k.useCallback(()=>{u&&(Kt(u,!0),f(null))},[u,Kt]),Nt=k.useCallback(()=>{f(null)},[]),wt=k.useCallback((le,xe)=>{h&&(Kt(h,xe,le),m(null),v(null))},[h,Kt]),Xe=k.useCallback(()=>{m(null),v(null)},[]),St=k.useCallback(async(le,xe)=>{le.stopPropagation();try{await ke.unarchiveSession(xe)}catch{}try{const we=await ke.listSessions();W.getState().setSdkSessions(we)}catch{}},[]),nn=new Set;for(const le of R.keys())nn.add(le);for(const le of U)nn.add(le.sessionId);const se=Array.from(nn).map(le=>{var rt;const xe=R.get(le),we=U.find(It=>It.sessionId===le);return{id:le,model:(xe==null?void 0:xe.model)||(we==null?void 0:we.model)||"",cwd:(xe==null?void 0:xe.cwd)||(we==null?void 0:we.cwd)||"",gitBranch:(xe==null?void 0:xe.git_branch)||(we==null?void 0:we.gitBranch)||"",isContainerized:(xe==null?void 0:xe.is_containerized)||!!(we!=null&&we.containerId)||!1,gitAhead:(xe==null?void 0:xe.git_ahead)||(we==null?void 0:we.gitAhead)||0,gitBehind:(xe==null?void 0:xe.git_behind)||(we==null?void 0:we.gitBehind)||0,linesAdded:(xe==null?void 0:xe.total_lines_added)||(we==null?void 0:we.totalLinesAdded)||0,linesRemoved:(xe==null?void 0:xe.total_lines_removed)||(we==null?void 0:we.totalLinesRemoved)||0,isConnected:X.get(le)??!1,isReconnecting:P.get(le)??!1,status:Q.get(le)??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:(xe==null?void 0:xe.backend_type)||(we==null?void 0:we.backendType)||"claude",repoRoot:(xe==null?void 0:xe.repo_root)||"",permCount:((rt=H.get(le))==null?void 0:rt.size)??0,cronJobId:(xe==null?void 0:xe.cronJobId)||(we==null?void 0:we.cronJobId),cronJobName:(xe==null?void 0:xe.cronJobName)||(we==null?void 0:we.cronJobName),agentId:(xe==null?void 0:xe.agentId)||(we==null?void 0:we.agentId),agentName:(xe==null?void 0:xe.agentName)||(we==null?void 0:we.agentName),userName:we==null?void 0:we.userName}}).sort((le,xe)=>xe.createdAt-le.createdAt),je=k.useMemo(()=>Array.from(new Set(se.map(le=>le.userName).filter(le=>!!le))).sort(),[se]),[Qe,et]=k.useState("__all__"),un=le=>Qe==="__all__"?!0:Qe==="__none__"?!le.userName:le.userName===Qe,ce=se.some(le=>!le.userName),be=se.filter(un),G=be.filter(le=>!le.archived&&!le.cronJobId&&!le.agentId),me=be.filter(le=>!le.archived&&!!le.cronJobId),Pe=be.filter(le=>!le.archived&&!!le.agentId),We=be.filter(le=>le.archived),at=D?se.find(le=>le.id===D):null,ft=(at==null?void 0:at.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[hn,is]=k.useState(!0),[Ct,vs]=k.useState(!0),Fn=k.useMemo(()=>r8(G),[G]),sn={onSelect:Ee,onStartRename:oe,onArchive:Ft,onUnarchive:St,onDelete:_e,onClearRecentlyRenamed:q,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:Ae,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:()=>W.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:Qe,onChange:le=>et(le.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(le=>l.jsx("option",{value:le,children:le},le)),ce&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:Nt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:Ut,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:G.length===0&&me.length===0&&We.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[Fn.map((le,xe)=>l.jsx(n8,{group:le,isCollapsed:re.has(le.key),onToggleCollapse:ve,currentSessionId:D,sessionNames:de,pendingPermissions:H,recentlyRenamed:K,isFirst:xe===0,...sn},le.key)),me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>is(!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 (",me.length,")"]}),hn&&l.jsx("div",{className:"mt-0.5",children:me.map(le=>{var xe;return l.jsx(Bf,{session:le,isActive:D===le.id,sessionName:de.get(le.id),permCount:((xe=H.get(le.id))==null?void 0:xe.size)??0,isRecentlyRenamed:K.has(le.id),...sn},le.id)})})]}),Pe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>vs(!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(le=>{var xe;return l.jsx(Bf,{session:le,isActive:D===le.id,sessionName:de.get(le.id),permCount:((xe=H.get(le.id))==null?void 0:xe.size)??0,isRecentlyRenamed:K.has(le.id),...sn},le.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(le=>{var xe;return l.jsx(Bf,{session:le,isActive:D===le.id,isArchived:!0,sessionName:de.get(le.id),permCount:((xe=H.get(le.id))==null?void 0:xe.size)??0,isRecentlyRenamed:K.has(le.id),...sn},le.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Ae,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:o8.map(le=>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:le.label}),l.jsx("div",{className:"flex flex-col",children:le.itemIds.map(xe=>{const we=c8.get(xe);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&&W.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)})})]},le.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:a8.map(le=>l.jsx("a",{href:le.url,target:"_blank",rel:"noopener noreferrer",title:le.label,"aria-label":`Open ${le.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:le.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:le.iconPath})})},le.label))})]})})]}),(w||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:le=>le.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?Ce:Me,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&&x&&l.jsx(ZA,{issueIdentifier:((xr=x.issue)==null?void 0:xr.identifier)||"",issueStateName:((Bi=x.issue)==null?void 0:Bi.stateName)||"",isContainerized:b,archiveTransitionConfigured:x.archiveTransitionConfigured||!1,archiveTransitionStateName:x.archiveTransitionStateName,hasBacklogState:x.hasBacklogState||!1,onConfirm:wt,onCancel:Xe})]})}function d8(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const f8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p8={};function S5(e,t){return(p8.jsx?h8:f8).test(e)}const m8=/[ \t\n\f\r]/g;function g8(e){return typeof e=="object"?e.type==="text"?k5(e.value):!1:k5(e)}function k5(e){return e.replace(m8,"")===""}class Ou{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Ou.prototype.normal={};Ou.prototype.property={};Ou.prototype.space=void 0;function mj(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Ou(n,i,t)}function J0(e){return e.toLowerCase()}class xs{constructor(t,n){this.attribute=n,this.property=t}}xs.prototype.attribute="";xs.prototype.booleanish=!1;xs.prototype.boolean=!1;xs.prototype.commaOrSpaceSeparated=!1;xs.prototype.commaSeparated=!1;xs.prototype.defined=!1;xs.prototype.mustUseProperty=!1;xs.prototype.number=!1;xs.prototype.overloadedBoolean=!1;xs.prototype.property="";xs.prototype.spaceSeparated=!1;xs.prototype.space=void 0;let x8=0;const Ze=ll(),bn=ll(),ex=ll(),Se=ll(),Bt=ll(),nl=ll(),Rs=ll();function ll(){return 2**++x8}const tx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:bn,commaOrSpaceSeparated:Rs,commaSeparated:nl,number:Se,overloadedBoolean:ex,spaceSeparated:Bt},Symbol.toStringTag,{value:"Module"})),Vg=Object.keys(tx);class Ix extends xs{constructor(t,n,i,a){let c=-1;if(super(t,n),j5(this,"space",a),typeof i=="number")for(;++c<Vg.length;){const u=Vg[c];j5(this,Vg[c],(i&tx[u])===tx[u])}}}Ix.prototype.defined=!0;function j5(e,t,n){n&&(e[t]=n)}function To(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const c=new Ix(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[J0(i)]=i,n[J0(c.attribute)]=i}return new Ou(t,n,e.space)}const gj=To({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Bt,ariaCurrent:null,ariaDescribedBy:Bt,ariaDetails:null,ariaDisabled:bn,ariaDropEffect:Bt,ariaErrorMessage:null,ariaExpanded:bn,ariaFlowTo:Bt,ariaGrabbed:bn,ariaHasPopup:null,ariaHidden:bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bt,ariaLevel:Se,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:Bt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:Bt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:bn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function xj(e,t){return t in e?e[t]:t}function vj(e,t){return xj(e,t.toLowerCase())}const v8=To({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:bn,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:ex,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Bt,height:Se,hidden:ex,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:bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:bn,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:bn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ze,disablePictureInPicture:Ze,disableRemotePlayback:Ze,exportParts:nl,part:Bt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:vj}),b8=To({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:Rs,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:Rs,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:Rs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rs,rev:Rs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rs,requiredFeatures:Rs,requiredFonts:Rs,requiredFormats:Rs,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:Rs,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:Rs,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:Rs,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:xj}),bj=To({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()}}),yj=To({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vj}),_j=To({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),y8={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"},_8=/[A-Z]/g,N5=/-[a-z]/g,w8=/^data[-\w.:]+$/i;function S8(e,t){const n=J0(t);let i=t,a=xs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&w8.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(N5,j8);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!N5.test(c)){let u=c.replace(_8,k8);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Ix}return new a(i,t)}function k8(e){return"-"+e.toLowerCase()}function j8(e){return e.charAt(1).toUpperCase()}const N8=mj([gj,v8,bj,yj,_j],"html"),Hx=mj([gj,b8,bj,yj,_j],"svg");function C8(e){return e.join(" ").trim()}var io={},Gg,C5;function E8(){if(C5)return Gg;C5=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="/",x="*",v="",b="comment",y="declaration";function w(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(K){var q=K.match(t);q&&(C+=q.length);var H=K.lastIndexOf(h);E=~H?K.length-H:E+K.length}function O(){var K={line:C,column:E};return function(q){return q.position=new R(K),X(),q}}function R(K){this.start=K,this.end={line:C,column:E},this.source=S.source}R.prototype.content=N;function U(K){var q=new Error(S.source+":"+C+":"+E+": "+K);if(q.reason=K,q.filename=S.source,q.line=C,q.column=E,q.source=N,!S.silent)throw q}function D(K){var q=K.exec(N);if(q){var H=q[0];return L(H),N=N.slice(H.length),q}}function X(){D(n)}function P(K){var q;for(K=K||[];q=Q();)q!==!1&&K.push(q);return K}function Q(){var K=O();if(!(m!=N.charAt(0)||x!=N.charAt(1))){for(var q=2;v!=N.charAt(q)&&(x!=N.charAt(q)||m!=N.charAt(q+1));)++q;if(q+=2,v===N.charAt(q-1))return U("End of comment missing");var H=N.slice(2,q-2);return E+=2,L(H),N=N.slice(q),E+=2,K({type:b,comment:H})}}function A(){var K=O(),q=D(i);if(q){if(Q(),!D(a))return U("property missing ':'");var H=D(c),I=K({type:y,property:j(q[0].replace(e,v)),value:H?j(H[0].replace(e,v)):v});return D(u),I}}function de(){var K=[];P(K);for(var q;q=A();)q!==!1&&(K.push(q),P(K));return K}return X(),de()}function j(N){return N?N.replace(f,v):v}return Gg=w,Gg}var E5;function T8(){if(E5)return io;E5=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(E8());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:x}=h;f?a(m,x,h):x&&(c=c||{},c[m]=x)}),c}return io}var qc={},T5;function M8(){if(T5)return qc;T5=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.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,x){return x.toUpperCase()},f=function(m,x){return"".concat(x,"-")},h=function(m,x){return x===void 0&&(x={}),c(m)?m:(m=m.toLowerCase(),x.reactCompat?m=m.replace(a,f):m=m.replace(i,f),m.replace(t,u))};return qc.camelCase=h,qc}var Vc,M5;function A8(){if(M5)return Vc;M5=1;var e=Vc&&Vc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(T8()),n=M8();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,Vc=i,Vc}var R8=A8();const O8=px(R8),wj=Sj("end"),qx=Sj("start");function Sj(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 L8(e){const t=qx(e),n=wj(e);if(t&&n)return{start:t,end:n}}function du(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?A5(e.position):"start"in e||"end"in e?A5(e):"line"in e||"column"in e?nx(e):""}function nx(e){return R5(e&&e.line)+":"+R5(e&&e.column)}function A5(e){return nx(e&&e.start)+"-"+nx(e&&e.end)}function R5(e){return e&&typeof e=="number"?e:1}class Gn 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=du(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}}Gn.prototype.file="";Gn.prototype.name="";Gn.prototype.reason="";Gn.prototype.message="";Gn.prototype.stack="";Gn.prototype.column=void 0;Gn.prototype.line=void 0;Gn.prototype.ancestors=void 0;Gn.prototype.cause=void 0;Gn.prototype.fatal=void 0;Gn.prototype.place=void 0;Gn.prototype.ruleId=void 0;Gn.prototype.source=void 0;const Vx={}.hasOwnProperty,D8=new Map,z8=/[A-Z]/g,$8=new Set(["table","tbody","thead","tfoot","tr"]),B8=new Set(["td","th"]),kj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function P8(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=Y8(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=G8(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"?Hx:N8,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=jj(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function jj(e,t,n){if(t.type==="element")return F8(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return U8(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return H8(e,t,n);if(t.type==="mdxjsEsm")return I8(e,t);if(t.type==="root")return q8(e,t,n);if(t.type==="text")return V8(e,t)}function F8(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=Hx,e.schema=a),e.ancestors.push(t);const c=Cj(e,t.tagName,!1),u=Q8(e,t);let f=Yx(e,t);return $8.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!g8(h):!0})),Nj(e,u,c,t),Gx(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function U8(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)}Cu(e,t.position)}function I8(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cu(e,t.position)}function H8(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=Hx,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Cj(e,t.name,!0),u=X8(e,t),f=Yx(e,t);return Nj(e,u,c,t),Gx(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function q8(e,t,n){const i={};return Gx(i,Yx(e,t)),e.create(t,e.Fragment,i,n)}function V8(e,t){return t.value}function Nj(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Gx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function G8(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 Y8(e,t){return n;function n(i,a,c,u){const f=Array.isArray(c.children),h=qx(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 Q8(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&Vx.call(t.properties,a)){const c=K8(e,a,t.properties[a]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&B8.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 X8(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 Cu(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 Cu(e,t.position);else c=i.value===null?!0:i.value;n[a]=c}return n}function Yx(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=jj(e,c,u);f!==void 0&&n.push(f)}return n}function K8(e,t,n){const i=S8(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?d8(n):C8(n)),i.property==="style"){let a=typeof n=="object"?n:W8(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Z8(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?y8[i.property]||i.property:i.attribute,n]}}function W8(e,t){try{return O8(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Gn("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=kj+"#cannot-parse-style-attribute",a}}function Cj(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=S5(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=S5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return Vx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Cu(e)}function Cu(e,t){const n=new Gn("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=kj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Z8(e){const t={};let n;for(n in e)Vx.call(e,n)&&(t[J8(n)]=e[n]);return t}function J8(e){let t=e.replace(z8,eR);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eR(e){return"-"+e.toLowerCase()}const Yg={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"]},tR={};function Qx(e,t){const n=tR,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ej(e,i,a)}function Ej(e,t,n){if(nR(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 O5(e.children,t,n)}return Array.isArray(e)?O5(e,t,n):""}function O5(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=Ej(e[a],t,n);return i.join("")}function nR(e){return!!(e&&typeof e=="object")}const L5=document.createElement("i");function Xx(e){const t="&"+e+";";L5.innerHTML=t;const n=L5.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ls(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 Ys(e,t){return e.length>0?(Ls(e,e.length,0,t),e):t}const D5={}.hasOwnProperty;function Tj(e){const t={};let n=-1;for(;++n<e.length;)sR(t,e[n]);return t}function sR(e,t){let n;for(n in t){const a=(D5.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){D5.call(a,u)||(a[u]=[]);const f=c[u];iR(a[u],Array.isArray(f)?f:f?[f]:[])}}}function iR(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Ls(e,0,0,i)}function Mj(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 fi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ss=pa(/[A-Za-z]/),qn=pa(/[\dA-Za-z]/),rR=pa(/[#-'*+\--9=?A-Z^-~]/);function uh(e){return e!==null&&(e<32||e===127)}const sx=pa(/\d/),aR=pa(/[\dA-Fa-f]/),lR=pa(/[!-/:-@[-`{-~]/);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 kh=pa(new RegExp("\\p{P}|\\p{S}","u")),al=pa(/\s/);function pa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mo(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&qn(e.charCodeAt(n+1))&&qn(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 oR={tokenize:cR};function cR(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 uR={tokenize:dR},z5={tokenize:fR};function dR(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 U=L;for(;U<t.events.length;)t.events[U][1].end={...R},U++;return Ls(t.events,O+1,0,t.events.slice(L)),t.events.length=U,m(E)}return f(E)}function m(E){if(i===n.length){if(!a)return b(E);if(a.currentConstruct&&a.currentConstruct.concrete)return w(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(z5,x,v)(E)}function x(E){return a&&C(),S(i),b(E)}function v(E){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,w(E)}function b(E){return t.containerState={},e.attempt(z5,y,w)(E)}function y(E){return i++,n.push([t.currentConstruct,t.containerState]),b(E)}function w(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 U=t.events.length;let D=U,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=U;R<t.events.length;)t.events[R][1].end={...P},R++;Ls(t.events,D+1,0,t.events.slice(U)),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 fR(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 ko(e){if(e===null||Pt(e)||al(e))return 1;if(kh(e))return 2}function jh(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 ix={name:"attention",resolveAll:hR,tokenize:pR};function hR(e,t){let n=-1,i,a,c,u,f,h,m,x;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 v={...e[i][1].end},b={...e[n][1].start};$5(v,-h),$5(b,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,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=Ys(m,[["enter",e[i][1],t],["exit",e[i][1],t]])),m=Ys(m,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",c,t]]),m=Ys(m,jh(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),m=Ys(m,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(x=2,m=Ys(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):x=0,Ls(e,i-1,n-i+3,m),n=i+m.length-x-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function pR(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=ko(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"),x=ko(h),v=!x||x===2&&a||n.includes(h),b=!a||a===2&&x||n.includes(i);return m._open=!!(c===42?v:v&&(a||!b)),m._close=!!(c===42?b:b&&(x||!v)),t(h)}}function $5(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mR={name:"autolink",tokenize:gR};function gR(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 ss(y)?(e.consume(y),u):y===64?n(y):m(y)}function u(y){return y===43||y===45||y===46||qn(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||qn(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||uh(y)?n(y):(e.consume(y),h)}function m(y){return y===64?(e.consume(y),x):rR(y)?(e.consume(y),m):n(y)}function x(y){return qn(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),i=0,x):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||qn(y))&&i++<63){const w=y===45?b:v;return e.consume(y),w}return n(y)}}const Lu={partial:!0,tokenize:xR};function xR(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 Aj={continuation:{tokenize:bR},exit:yR,name:"blockQuote",tokenize:vR};function vR(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 bR(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(Aj,t,n)(u)}}function yR(e){e.exit("blockQuote")}const Rj={name:"characterEscape",tokenize:_R};function _R(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 lR(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Oj={name:"characterReference",tokenize:wR};function wR(e,t,n){const i=this;let a=0,c,u;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),c=31,u=qn,x(v))}function m(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=aR,x):(e.enter("characterReferenceValue"),c=7,u=sx,x(v))}function x(v){if(v===59&&a){const b=e.exit("characterReferenceValue");return u===qn&&!Xx(i.sliceSerialize(b))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<c?(e.consume(v),x):n(v)}}const B5={partial:!0,tokenize:kR},P5={concrete:!0,name:"codeFenced",tokenize:SR};function SR(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 U=i.events[i.events.length-1];return c=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(R)}function x(R){return R===f?(u++,e.consume(R),x):u<3?n(R):(e.exit("codeFencedFenceSequence"),dt(R)?_t(e,v,"whitespace")(R):v(R))}function v(R){return R===null||qe(R)?(e.exit("codeFencedFence"),i.interrupt?t(R):e.check(B5,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"),v(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)?v(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(R))}function w(R){return R===null||qe(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(R)):R===96&&R===f?n(R):(e.consume(R),w)}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(B5,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,U,D){let X=0;return P;function P(q){return R.enter("lineEnding"),R.consume(q),R.exit("lineEnding"),Q}function Q(q){return R.enter("codeFencedFence"),dt(q)?_t(R,A,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):A(q)}function A(q){return q===f?(R.enter("codeFencedFenceSequence"),de(q)):D(q)}function de(q){return q===f?(X++,R.consume(q),de):X>=u?(R.exit("codeFencedFenceSequence"),dt(q)?_t(R,K,"whitespace")(q):K(q)):D(q)}function K(q){return q===null||qe(q)?(R.exit("codeFencedFence"),U(q)):D(q)}}}function kR(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 Qg={name:"codeIndented",tokenize:NR},jR={partial:!0,tokenize:CR};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 x=i.events[i.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?u(m):n(m)}function u(m){return m===null?h(m):qe(m)?e.attempt(jR,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 CR(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 ER={name:"codeText",previous:MR,resolve:TR,tokenize:AR};function TR(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 MR(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function AR(e,t,n){let i=0,a,c;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),i++,f):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(c=e.enter("codeTextSequence"),a=0,x(v)):qe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(v))}function m(v){return v===null||v===32||v===96||qe(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),m)}function x(v){return v===96?(e.consume(v),a++,x):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",m(v))}}class RR{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&&Gc(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),Gc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Gc(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);Gc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Gc(this.left,n.reverse())}}}function Gc(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 Lj(e){const t={};let n=-1,i,a,c,u,f,h,m;const x=new RR(e);for(;++n<x.length;){for(;n in t;)n=t[n];if(i=x.get(n),n&&i[1].type==="chunkFlow"&&x.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,OR(x,n)),n=t[n],m=!0);else if(i[1]._container){for(c=n,a=void 0;c--;)if(u=x.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(x.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={...x.get(a)[1].start},f=x.slice(a,n),f.unshift(i),x.splice(a,n-a+1,f))}}return Ls(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!m}function OR(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 x,v,b=-1,y=n,w=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);c.push(a),y._tokenizer||(x=i.sliceStream(y),y.next||x.push(null),v&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(x),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=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[w+h[b][0]]=w+h[b][1],w+=h[b][1]-h[b][0]-1;return m}const LR={resolve:zR,tokenize:$R},DR={partial:!0,tokenize:BR};function zR(e){return Lj(e),e}function $R(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 BR(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 Dj(e,t,n,i,a,c,u,f,h){const m=h||Number.POSITIVE_INFINITY;let x=0;return v;function v(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||uh(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?w:y)}function w(S){return S===60||S===62||S===92?(e.consume(S),y):y(S)}function j(S){return!x&&(S===null||S===41||Pt(S))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(S)):x<m&&S===40?(e.consume(S),x++,j):S===41?(e.consume(S),x--,j):S===null||S===32||S===40||uh(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 zj(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),x}function x(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"),x):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||qe(y)||f++>999?(e.exit("chunkString"),x(y)):(e.consume(y),h||(h=!dt(y)),y===92?b:v)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,v):v(y)}}function $j(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"}),x(b))}function x(b){return b===u||b===null||qe(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?v:x)}function v(b){return b===u||b===92?(e.consume(b),x):x(b)}}function fu(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 PR={name:"definition",tokenize:UR},FR={partial:!0,tokenize:IR};function UR(e,t,n){const i=this;let a;return c;function c(y){return e.enter("definition"),u(y)}function u(y){return zj.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=fi(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)?fu(e,m)(y):m(y)}function m(y){return Dj(e,x,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function x(y){return e.attempt(FR,v,v)(y)}function v(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 IR(e,t,n){return i;function i(f){return Pt(f)?fu(e,a)(f):n(f)}function a(f){return $j(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 HR={name:"hardBreakEscape",tokenize:qR};function qR(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 VR={name:"headingAtx",resolve:GR,tokenize:YR};function GR(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"},Ls(e,i,n-i+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function YR(e,t,n){let i=0;return a;function a(x){return e.enter("atxHeading"),c(x)}function c(x){return e.enter("atxHeadingSequence"),u(x)}function u(x){return x===35&&i++<6?(e.consume(x),u):x===null||Pt(x)?(e.exit("atxHeadingSequence"),f(x)):n(x)}function f(x){return x===35?(e.enter("atxHeadingSequence"),h(x)):x===null||qe(x)?(e.exit("atxHeading"),t(x)):dt(x)?_t(e,f,"whitespace")(x):(e.enter("atxHeadingText"),m(x))}function h(x){return x===35?(e.consume(x),h):(e.exit("atxHeadingSequence"),f(x))}function m(x){return x===null||x===35||Pt(x)?(e.exit("atxHeadingText"),f(x)):(e.consume(x),m)}}const QR=["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"],F5=["pre","script","style","textarea"],XR={concrete:!0,name:"htmlFlow",resolveTo:ZR,tokenize:JR},KR={partial:!0,tokenize:t7},WR={partial:!0,tokenize:e7};function ZR(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 JR(e,t,n){const i=this;let a,c,u,f,h;return m;function m(z){return x(z)}function x(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),v}function v(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):ss(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,w):ss(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 w(z){const B="CDATA[";return z===B.charCodeAt(f++)?(e.consume(z),f===B.length?i.interrupt?t:A:w):n(z)}function j(z){return ss(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,oe=u.toLowerCase();return!B&&!c&&F5.includes(oe)?(a=1,i.interrupt?t(z):A(z)):QR.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||qn(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||ss(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||qn(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,U):dt(z)?(e.consume(z),R):D(z)}function U(z){return z===h?(e.consume(z),h=null,X):z===null||qe(z)?n(z):(e.consume(z),U)}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),Q):n(z)}function Q(z){return z===null||qe(z)?A(z):dt(z)?(e.consume(z),Q):n(z)}function A(z){return z===45&&a===2?(e.consume(z),H):z===60&&a===1?(e.consume(z),I):z===62&&a===4?(e.consume(z),Ee):z===63&&a===3?(e.consume(z),M):z===93&&a===5?(e.consume(z),ve):qe(z)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(KR,Ae,de)(z)):z===null||qe(z)?(e.exit("htmlFlowData"),de(z)):(e.consume(z),A)}function de(z){return e.check(WR,K,Ae)(z)}function K(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),q}function q(z){return z===null||qe(z)?de(z):(e.enter("htmlFlowData"),A(z))}function H(z){return z===45?(e.consume(z),M):A(z)}function I(z){return z===47?(e.consume(z),u="",re):A(z)}function re(z){if(z===62){const B=u.toLowerCase();return F5.includes(B)?(e.consume(z),Ee):A(z)}return ss(z)&&u.length<8?(e.consume(z),u+=String.fromCharCode(z),re):A(z)}function ve(z){return z===93?(e.consume(z),M):A(z)}function M(z){return z===62?(e.consume(z),Ee):z===45&&a===2?(e.consume(z),M):A(z)}function Ee(z){return z===null||qe(z)?(e.exit("htmlFlowData"),Ae(z)):(e.consume(z),Ee)}function Ae(z){return e.exit("htmlFlow"),t(z)}}function e7(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 t7(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Lu,t,n)}}const n7={name:"htmlText",tokenize:s7};function s7(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):ss(M)?(e.consume(M),D):n(M)}function m(M){return M===45?(e.consume(M),x):M===91?(e.consume(M),c=0,w):ss(M)?(e.consume(M),C):n(M)}function x(M){return M===45?(e.consume(M),y):n(M)}function v(M){return M===null?n(M):M===45?(e.consume(M),b):qe(M)?(u=v,I(M)):(e.consume(M),v)}function b(M){return M===45?(e.consume(M),y):v(M)}function y(M){return M===62?H(M):M===45?b(M):v(M)}function w(M){const Ee="CDATA[";return M===Ee.charCodeAt(c++)?(e.consume(M),c===Ee.length?j:w):n(M)}function j(M){return M===null?n(M):M===93?(e.consume(M),N):qe(M)?(u=j,I(M)):(e.consume(M),j)}function N(M){return M===93?(e.consume(M),S):j(M)}function S(M){return M===62?H(M):M===93?(e.consume(M),S):j(M)}function C(M){return M===null||M===62?H(M):qe(M)?(u=C,I(M)):(e.consume(M),C)}function E(M){return M===null?n(M):M===63?(e.consume(M),L):qe(M)?(u=E,I(M)):(e.consume(M),E)}function L(M){return M===62?H(M):E(M)}function O(M){return ss(M)?(e.consume(M),R):n(M)}function R(M){return M===45||qn(M)?(e.consume(M),R):U(M)}function U(M){return qe(M)?(u=U,I(M)):dt(M)?(e.consume(M),U):H(M)}function D(M){return M===45||qn(M)?(e.consume(M),D):M===47||M===62||Pt(M)?X(M):n(M)}function X(M){return M===47?(e.consume(M),H):M===58||M===95||ss(M)?(e.consume(M),P):qe(M)?(u=X,I(M)):dt(M)?(e.consume(M),X):H(M)}function P(M){return M===45||M===46||M===58||M===95||qn(M)?(e.consume(M),P):Q(M)}function Q(M){return M===61?(e.consume(M),A):qe(M)?(u=Q,I(M)):dt(M)?(e.consume(M),Q):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,de):qe(M)?(u=A,I(M)):dt(M)?(e.consume(M),A):(e.consume(M),K)}function de(M){return M===a?(e.consume(M),a=void 0,q):M===null?n(M):qe(M)?(u=de,I(M)):(e.consume(M),de)}function K(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),K)}function q(M){return M===47||M===62||Pt(M)?X(M):n(M)}function H(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function I(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),re}function re(M){return dt(M)?_t(e,ve,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ve(M)}function ve(M){return e.enter("htmlTextData"),u(M)}}const Kx={name:"labelEnd",resolveAll:l7,resolveTo:o7,tokenize:c7},i7={tokenize:u7},r7={tokenize:d7},a7={tokenize:f7};function l7(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&&Ls(e,0,e.length,n),e}function o7(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}},x={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",m,t]],f=Ys(f,e.slice(c+1,c+i+3)),f=Ys(f,[["enter",x,t]]),f=Ys(f,jh(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),f=Ys(f,[["exit",x,t],e[u-2],e[u-1],["exit",m,t]]),f=Ys(f,e.slice(u+1)),f=Ys(f,[["exit",h,t]]),Ls(e,c,e.length,f),e}function c7(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?v(b):(u=i.parser.defined.includes(fi(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(i7,x,u?x:v)(b):b===91?e.attempt(r7,x,u?m:v)(b):u?x(b):v(b)}function m(b){return e.attempt(a7,x,v)(b)}function x(b){return t(b)}function v(b){return c._balanced=!0,n(b)}}function u7(e,t,n){return i;function i(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return Pt(v)?fu(e,c)(v):c(v)}function c(v){return v===41?x(v):Dj(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Pt(v)?fu(e,h)(v):x(v)}function f(v){return n(v)}function h(v){return v===34||v===39||v===40?$j(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):x(v)}function m(v){return Pt(v)?fu(e,x)(v):x(v)}function x(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function d7(e,t,n){const i=this;return a;function a(f){return zj.call(i,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes(fi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function f7(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 h7={name:"labelStartImage",resolveAll:Kx.resolveAll,tokenize:p7};function p7(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 m7={name:"labelStartLink",resolveAll:Kx.resolveAll,tokenize:g7};function g7(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 Xg={name:"lineEnding",tokenize:x7};function x7(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),_t(e,t,"linePrefix")}}const Pf={name:"thematicBreak",tokenize:v7};function v7(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 ps={continuation:{tokenize:w7},exit:k7,name:"list",tokenize:_7},b7={partial:!0,tokenize:j7},y7={partial:!0,tokenize:S7};function _7(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 w=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:sx(y)){if(i.containerState.type||(i.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Pf,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 sx(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(Lu,i.interrupt?n:x,e.attempt(b7,b,v))}function x(y){return i.containerState.initialBlankLine=!0,c++,b(y)}function v(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 w7(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Lu,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(y7,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,_t(e,e.attempt(ps,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function S7(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 k7(e){e.exit(this.containerState.type)}function j7(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 U5={name:"setextUnderline",resolveTo:N7,tokenize:C7};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 C7(e,t,n){const i=this;let a;return c;function c(m){let x=i.events.length,v;for(;x--;)if(i.events[x][1].type!=="lineEnding"&&i.events[x][1].type!=="linePrefix"&&i.events[x][1].type!=="content"){v=i.events[x][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(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 E7={tokenize:T7};function T7(e){const t=this,n=e.attempt(Lu,i,e.attempt(this.parser.constructs.flowInitial,a,_t(e,e.attempt(this.parser.constructs.flow,a,e.attempt(LR,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 M7={resolveAll:Pj()},A7=Bj("string"),R7=Bj("text");function Bj(e){return{resolveAll:Pj(e==="text"?O7: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(x){return m(x)?c(x):f(x)}function f(x){if(x===null){n.consume(x);return}return n.enter("data"),n.consume(x),h}function h(x){return m(x)?(n.exit("data"),c(x)):(n.consume(x),h)}function m(x){if(x===null)return!0;const v=a[x];let b=-1;if(v)for(;++b<v.length;){const y=v[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function Pj(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 O7(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 L7={42:ps,43:ps,45:ps,48:ps,49:ps,50:ps,51:ps,52:ps,53:ps,54:ps,55:ps,56:ps,57:ps,62:Aj},D7={91:PR},z7={[-2]:Qg,[-1]:Qg,32:Qg},$7={35:VR,42:Pf,45:[U5,Pf],60:XR,61:U5,95:Pf,96:P5,126:P5},B7={38:Oj,92:Rj},P7={[-5]:Xg,[-4]:Xg,[-3]:Xg,33:h7,38:Oj,42:ix,60:[mR,n7],91:m7,92:[HR,Rj],93:Kx,95:ix,96:ER},F7={null:[ix,M7]},U7={null:[42,95]},I7={null:[]},H7=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:U7,contentInitial:D7,disable:I7,document:L7,flow:$7,flowInitial:z7,insideSpan:F7,string:B7,text:P7},Symbol.toStringTag,{value:"Module"}));function q7(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:U(O),check:U(R),consume:C,enter:E,exit:L,interrupt:U(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:w,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:v};let x=t.tokenize.call(m,h);return t.resolveAll&&c.push(t),m;function v(Q){return u=Ys(u,Q),N(),u[u.length-1]!==null?[]:(D(t,0),m.events=jh(c,m.events,m),m.events)}function b(Q,A){return G7(y(Q),A)}function y(Q){return V7(u,Q)}function w(){const{_bufferIndex:Q,_index:A,line:de,column:K,offset:q}=i;return{_bufferIndex:Q,_index:A,line:de,column:K,offset:q}}function j(Q){a[Q.line]=Q.column,P()}function N(){let Q;for(;i._index<u.length;){const A=u[i._index];if(typeof A=="string")for(Q=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Q&&i._bufferIndex<A.length;)S(A.charCodeAt(i._bufferIndex));else S(A)}}function S(Q){x=x(Q)}function C(Q){qe(Q)?(i.line++,i.column=1,i.offset+=Q===-3?2:1,P()):Q!==-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=Q}function E(Q,A){const de=A||{};return de.type=Q,de.start=w(),m.events.push(["enter",de,m]),f.push(de),de}function L(Q){const A=f.pop();return A.end=w(),m.events.push(["exit",A,m]),A}function O(Q,A){D(Q,A.from)}function R(Q,A){A.restore()}function U(Q,A){return de;function de(K,q,H){let I,re,ve,M;return Array.isArray(K)?Ae(K):"tokenize"in K?Ae([K]):Ee(K);function Ee(_e){return Ne;function Ne(Me){const Le=Me!==null&&_e[Me],De=Me!==null&&_e.null,Ce=[...Array.isArray(Le)?Le:Le?[Le]:[],...Array.isArray(De)?De:De?[De]:[]];return Ae(Ce)(Me)}}function Ae(_e){return I=_e,re=0,_e.length===0?H:z(_e[re])}function z(_e){return Ne;function Ne(Me){return M=X(),ve=_e,_e.partial||(m.currentConstruct=_e),_e.name&&m.parser.constructs.disable.null.includes(_e.name)?oe():_e.tokenize.call(A?Object.assign(Object.create(m),A):m,h,B,oe)(Me)}}function B(_e){return Q(ve,M),q}function oe(_e){return M.restore(),++re<I.length?z(I[re]):H}}}function D(Q,A){Q.resolveAll&&!c.includes(Q)&&c.push(Q),Q.resolve&&Ls(m.events,A,m.events.length-A,Q.resolve(m.events.slice(A),m)),Q.resolveTo&&(m.events=Q.resolveTo(m.events,m))}function X(){const Q=w(),A=m.previous,de=m.currentConstruct,K=m.events.length,q=Array.from(f);return{from:K,restore:H};function H(){i=Q,m.previous=A,m.currentConstruct=de,m.events.length=K,f=q,P()}}function P(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function V7(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 G7(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 Y7(e){const i={constructs:Tj([H7,...(e||{}).extensions||[]]),content:a(oR),defined:[],document:a(uR),flow:a(E7),lazy:{},string:a(A7),text:a(R7)};return i;function a(c){return u;function u(f){return q7(i,c,f)}}}function Q7(e){for(;!Lj(e););return e}const I5=/[\0\t\n\r]/g;function X7(){let e=1,t="",n=!0,i;return a;function a(c,u,f){const h=[];let m,x,v,b,y;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(I5.lastIndex=v,m=I5.exec(c),b=m&&m.index!==void 0?m.index:c.length,y=c.charCodeAt(b),!m){t=c.slice(v);break}if(y===10&&v===b&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),v<b&&(h.push(c.slice(v,b)),e+=b-v),y){case 0:{h.push(65533),e++;break}case 9:{for(x=Math.ceil(e/4)*4,h.push(-2);e++<x;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}v=b+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const K7=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function W7(e){return e.replace(K7,Z7)}function Z7(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return Mj(n.slice(c?2:1),c?16:10)}return Xx(n)||e}const Fj={}.hasOwnProperty;function J7(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),eO(n)(Q7(Y7(n).document().write(X7()(e,t,!0))))}function eO(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(St),autolinkProtocol:X,autolinkEmail:X,atxHeading:c(Ut),blockQuote:c(De),characterEscape:X,characterReference:X,codeFenced:c(Ce),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Ce,u),codeText:c(Re,u),codeTextData:X,data:X,codeFlowValue:X,definition:c(Ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Kt),hardBreakEscape:c(Nt),hardBreakTrailing:c(Nt),htmlFlow:c(wt,u),htmlFlowData:X,htmlText:c(wt,u),htmlTextData:X,image:c(Xe),label:u,link:c(St),listItem:c(se),listItemValue:b,listOrdered:c(nn,v),listUnordered:c(nn),paragraph:c(je),reference:z,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Ut),strong:c(Qe),thematicBreak:c(un)},exit:{atxHeading:h(),atxHeadingSequence:O,autolink:h(),autolinkEmail:Le,autolinkProtocol:Me,blockQuote:h(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:_e,characterReference:Ne,codeFenced:h(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:P,codeIndented:h(S),codeText:h(q),codeTextData:P,data:P,definition:h(),definitionDestinationString:L,definitionLabelString:C,definitionTitleString:E,emphasis:h(),hardBreakEscape:h(A),hardBreakTrailing:h(A),htmlFlow:h(de),htmlFlowData:P,htmlText:h(K),htmlTextData:P,image:h(I),label:ve,labelText:re,lineEnding:Q,link:h(H),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:B,resourceDestinationString:M,resourceTitleString:Ee,resource:Ae,setextHeading:h(D),setextHeadingLineSequence:U,setextHeadingText:R,strong:h(),thematicBreak:h()}};Uj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ce){let be={type:"root",children:[]};const G={stack:[be],tokenStack:[],config:t,enter:f,exit:m,buffer:u,resume:x,data:n},me=[];let Pe=-1;for(;++Pe<ce.length;)if(ce[Pe][1].type==="listOrdered"||ce[Pe][1].type==="listUnordered")if(ce[Pe][0]==="enter")me.push(Pe);else{const We=me.pop();Pe=a(ce,We,Pe)}for(Pe=-1;++Pe<ce.length;){const We=t[ce[Pe][0]];Fj.call(We,ce[Pe][1].type)&&We[ce[Pe][1].type].call(Object.assign({sliceSerialize:ce[Pe][2].sliceSerialize},G),ce[Pe][1])}if(G.tokenStack.length>0){const We=G.tokenStack[G.tokenStack.length-1];(We[1]||H5).call(G,void 0,We[0])}for(be.position={start:ea(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ea(ce.length>0?ce[ce.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(ce,be,G){let me=be-1,Pe=-1,We=!1,at,ft,hn,is;for(;++me<=G;){const Ct=ce[me];switch(Ct[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ct[0]==="enter"?Pe++:Pe--,is=void 0;break}case"lineEndingBlank":{Ct[0]==="enter"&&(at&&!is&&!Pe&&!hn&&(hn=me),is=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:is=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 vs=me;for(ft=void 0;vs--;){const Fn=ce[vs];if(Fn[1].type==="lineEnding"||Fn[1].type==="lineEndingBlank"){if(Fn[0]==="exit")continue;ft&&(ce[ft][1].type="lineEndingBlank",We=!0),Fn[1].type="lineEnding",ft=vs}else if(!(Fn[1].type==="linePrefix"||Fn[1].type==="blockQuotePrefix"||Fn[1].type==="blockQuotePrefixWhitespace"||Fn[1].type==="blockQuoteMarker"||Fn[1].type==="listItemIndent"))break}hn&&(!ft||hn<ft)&&(at._spread=!0),at.end=Object.assign({},ft?ce[ft][1].start:Ct[1].end),ce.splice(ft||me,0,["exit",at,Ct[2]]),me++,G++}if(Ct[1].type==="listItemPrefix"){const vs={type:"listItem",_spread:!1,start:Object.assign({},Ct[1].start),end:void 0};at=vs,ce.splice(me,0,["enter",vs,Ct[2]]),me++,G++,hn=void 0,is=!0}}}return ce[be][1]._spread=We,G}function c(ce,be){return G;function G(me){f.call(this,ce(me),me),be&&be.call(this,me)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ce,be,G){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([be,G||void 0]),ce.position={start:ea(be.start),end:void 0}}function h(ce){return be;function be(G){ce&&ce.call(this,G),m.call(this,G)}}function m(ce,be){const G=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==ce.type&&(be?be.call(this,ce,me[0]):(me[1]||H5).call(this,ce,me[0]));else throw new Error("Cannot close `"+ce.type+"` ("+du({start:ce.start,end:ce.end})+"): it’s not open");G.position.end=ea(ce.end)}function x(){return Qx(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function b(ce){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.lang=ce}function w(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.meta=ce}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/(\r?\n|\r)$/g,"")}function C(ce){const be=this.resume(),G=this.stack[this.stack.length-1];G.label=be,G.identifier=fi(this.sliceSerialize(ce)).toLowerCase()}function E(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function L(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function O(ce){const be=this.stack[this.stack.length-1];if(!be.depth){const G=this.sliceSerialize(ce).length;be.depth=G}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function U(ce){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function X(ce){const G=this.stack[this.stack.length-1].children;let me=G[G.length-1];(!me||me.type!=="text")&&(me=et(),me.position={start:ea(ce.start),end:void 0},G.push(me)),this.stack.push(me)}function P(ce){const be=this.stack.pop();be.value+=this.sliceSerialize(ce),be.position.end=ea(ce.end)}function Q(ce){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const G=be.children[be.children.length-1];G.position.end=ea(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(X.call(this,ce),P.call(this,ce))}function A(){this.data.atHardBreak=!0}function de(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function K(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function q(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function H(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function I(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function re(ce){const be=this.sliceSerialize(ce),G=this.stack[this.stack.length-2];G.label=W7(be),G.identifier=fi(be).toLowerCase()}function ve(){const ce=this.stack[this.stack.length-1],be=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){const me=ce.children;G.children=me}else G.alt=be}function M(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function Ee(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function Ae(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function B(ce){const be=this.resume(),G=this.stack[this.stack.length-1];G.label=be,G.identifier=fi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function oe(ce){this.data.characterReferenceType=ce.type}function _e(ce){const be=this.sliceSerialize(ce),G=this.data.characterReferenceType;let me;G?(me=Mj(be,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Xx(be);const Pe=this.stack[this.stack.length-1];Pe.value+=me}function Ne(ce){const be=this.stack.pop();be.position.end=ea(ce.end)}function Me(ce){P.call(this,ce);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ce)}function Le(ce){P.call(this,ce);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ce)}function De(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function Ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Kt(){return{type:"emphasis",children:[]}}function Ut(){return{type:"heading",depth:0,children:[]}}function Nt(){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(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function se(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function je(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function un(){return{type:"thematicBreak"}}}function ea(e){return{line:e.line,column:e.column,offset:e.offset}}function Uj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Uj(e,i):tO(e,i)}}function tO(e,t){let n;for(n in t)if(Fj.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 H5(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+du({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+du({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+du({start:t.start,end:t.end})+") is still open")}function nO(e){const t=this;t.parser=n;function n(i){return J7(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function sO(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 iO(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
-
`}]}function rO(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 aO(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lO(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oO(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Mo(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 cO(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 uO(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ij(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 dO(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Ij(e,t);const a={src:Mo(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 fO(e,t){const n={src:Mo(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 hO(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 pO(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Ij(e,t);const a={href:Mo(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 mO(e,t){const n={href:Mo(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 gO(e,t,n){const i=e.all(t),a=n?xO(n):Hj(t),c={},u=[];if(typeof t.checked=="boolean"){const x=i[0];let v;x&&x.type==="element"&&x.tagName==="p"?v=x:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const x=i[f];(a||f!==0||x.type!=="element"||x.tagName!=="p")&&u.push({type:"text",value:`
|
|
77
|
-
`}),x.type==="element"&&x.tagName==="p"&&!a?u.push(...x.children):u.push(x)}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 xO(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=Hj(n[i])}return t}function Hj(e){const t=e.spread;return t??e.children.length>1}function vO(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 bO(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yO(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function _O(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wO(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=qx(t.children[1]),h=wj(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 SO(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 v=t.children[h],b={},y=u?u[h]:void 0;y&&(b.align=y);let w={type:"element",tagName:c,properties:b,children:[]};v&&(w.children=e.all(v),e.patch(v,w),w=e.applyData(v,w)),m.push(w)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,x),e.applyData(t,x)}function kO(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const q5=9,V5=32;function jO(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const c=[];for(;i;)c.push(G5(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return c.push(G5(t.slice(a),a>0,!1)),c.join("")}function G5(e,t,n){let i=0,a=e.length;if(t){let c=e.codePointAt(i);for(;c===q5||c===V5;)i++,c=e.codePointAt(i)}if(n){let c=e.codePointAt(a-1);for(;c===q5||c===V5;)a--,c=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function NO(e,t){const n={type:"text",value:jO(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function CO(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const EO={blockquote:sO,break:iO,code:rO,delete:aO,emphasis:lO,footnoteReference:oO,heading:cO,html:uO,imageReference:dO,image:fO,inlineCode:hO,linkReference:pO,link:mO,listItem:gO,list:vO,paragraph:bO,root:yO,strong:_O,table:wO,tableCell:kO,tableRow:SO,text:NO,thematicBreak:CO,toml:bf,yaml:bf,definition:bf,footnoteDefinition:bf};function bf(){}const qj=-1,Nh=0,hu=1,dh=2,Wx=3,Zx=4,Jx=5,ev=6,Vj=7,Gj=8,{defineProperty:TO}=Object,Yj=typeof self=="object"?self:globalThis,Y5=(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 Yj[e](t)},MO=(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 Nh:case qj:return n(u,a);case hu:{const f=n([],a);for(const h of u)f.push(i(h));return f}case dh:{const f=n({},a);for(const[h,m]of u){const x=i(h),v=i(m);x==="__proto__"?TO(f,x,{value:v,configurable:!0,enumerable:!0,writable:!0}):f[x]=v}return f}case Wx:return n(new Date(u),a);case Zx:{const{source:f,flags:h}=u;return n(new RegExp(f,h),a)}case Jx:{const f=n(new Map,a);for(const[h,m]of u)f.set(i(h),i(m));return f}case ev:{const f=n(new Set,a);for(const h of u)f.add(i(h));return f}case Vj:{const{name:f,message:h}=u;return n(typeof Yj[f]=="function"?Y5(f,h):new Error(h),a)}case Gj: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(Y5(c,u),a)};return i},Q5=e=>MO(new Map,e)(0),Ja="",{toString:AO}={},{keys:RO,is:OO}=Object,Yc=e=>{const t=typeof e;if(t!=="object"||!e)return[Nh,t];const n=AO.call(e).slice(8,-1);switch(n){case"Array":return[hu,Ja];case"Object":return[dh,Ja];case"Date":return[Wx,Ja];case"RegExp":return[Zx,Ja];case"Map":return[Jx,Ja];case"Set":return[ev,Ja];case"DataView":return[hu,n]}return n.includes("Array")?[hu,n]:e instanceof Error?[Vj,e.name||"Error"]:[dh,n]},yf=([e,t])=>e===Nh&&(t==="function"||t==="symbol"),LO=(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]=Yc(u);switch(f){case Nh:{let x=u;switch(h){case"bigint":f=Gj,x=u.toString();break;case"number":if(!u&&OO(u,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);x=null;break;case"undefined":return a([qj],u)}return a([f,x],u)}case hu:{if(h){let b=u;return h==="DataView"?b=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(u)),a([h,[...b]],u)}const x=[],v=a([f,x],u);for(const b of u)x.push(c(b));return v}case dh:{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 x=[],v=a([f,x],u);for(const b of RO(u))(e||!yf(Yc(u[b])))&&x.push([c(b),c(u[b])]);return v}case Wx:return a([f,isNaN(u.getTime())?Ja:u.toISOString()],u);case Zx:{const{source:x,flags:v}=u;return a([f,{source:x,flags:v}],u)}case Jx:{const x=[],v=a([f,x],u);for(const[b,y]of u)(e||!(yf(Yc(b))||yf(Yc(y))))&&x.push([c(b),c(y)]);return v}case ev:{const x=[],v=a([f,x],u);for(const b of u)(e||!yf(Yc(b)))&&x.push(c(b));return v}}const{message:m}=u;return a([f,{name:h,message:m}],u)};return c},X5=(e,{json:t,lossy:n}={})=>{const i=[];return LO(!(t||n),!!t,new Map,i)(e),i},fh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Q5(X5(e,t)):structuredClone(e):(e,t)=>Q5(X5(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 zO(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function $O(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||DO,i=e.options.footnoteBackLabel||zO,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 x=e.all(m),v=String(m.identifier).toUpperCase(),b=Mo(v.toLowerCase());let y=0;const w=[],j=e.footnoteCounts.get(v);for(;j!==void 0&&++y<=j;){w.length>0&&w.push({type:"text",value:" "});let C=typeof n=="string"?n:n(h,y);typeof C=="string"&&(C={type:"text",value:C}),w.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=x[x.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(...w)}else x.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(x,!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:{...fh(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 Ch=(function(e){if(e==null)return UO;if(typeof e=="function")return Eh(e);if(typeof e=="object")return Array.isArray(e)?BO(e):PO(e);if(typeof e=="string")return FO(e);throw new Error("Expected function, string, or object as test")});function BO(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ch(e[n]);return Eh(i);function i(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function PO(e){const t=e;return Eh(n);function n(i){const a=i;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function FO(e){return Eh(t);function t(n){return n&&n.type===e}}function Eh(e){return t;function t(n,i,a){return!!(IO(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function UO(){return!0}function IO(e){return e!==null&&typeof e=="object"&&"type"in e}const Qj=[],HO=!0,rx=!1,qO="skip";function Xj(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const c=Ch(a),u=i?-1:1;f(e,void 0,[])();function f(h,m,x){const v=h&&typeof h=="object"?h:{};if(typeof v.type=="string"){const y=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=Qj,w,j,N;if((!t||c(h,m,x[x.length-1]||void 0))&&(y=VO(n(h,x)),y[0]===rx))return y;if("children"in h&&h.children){const S=h;if(S.children&&y[0]!==qO)for(j=(i?S.children.length:-1)+u,N=x.concat(S);j>-1&&j<S.children.length;){const C=S.children[j];if(w=f(C,j,N)(),w[0]===rx)return w;j=typeof w[1]=="number"?w[1]:j+u}}return y}}}function VO(e){return Array.isArray(e)?e:typeof e=="number"?[HO,e]:e==null?Qj:[e]}function tv(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),Xj(e,c,f,a);function f(h,m){const x=m[m.length-1],v=x?x.children.indexOf(h):void 0;return u(h,v,x)}}const ax={}.hasOwnProperty,GO={};function YO(e,t){const n=t||GO,i=new Map,a=new Map,c=new Map,u={...EO,...n.handlers},f={all:m,applyData:XO,definitionById:i,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:u,one:h,options:n,patch:QO,wrap:WO};return tv(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const v=x.type==="definition"?i:a,b=String(x.identifier).toUpperCase();v.has(b)||v.set(b,x)}}),f;function h(x,v){const b=x.type,y=f.handlers[b];if(ax.call(f.handlers,b)&&y)return y(f,x,v);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in x){const{children:j,...N}=x,S=fh(N);return S.children=f.all(x),S}return fh(x)}return(f.options.unknownHandler||KO)(f,x,v)}function m(x){const v=[];if("children"in x){const b=x.children;let y=-1;for(;++y<b.length;){const w=f.one(b[y],x);if(w){if(y&&b[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=K5(w.value)),!Array.isArray(w)&&w.type==="element")){const j=w.children[0];j&&j.type==="text"&&(j.value=K5(j.value))}Array.isArray(w)?v.push(...w):v.push(w)}}}return v}}function QO(e,t){e.position&&(t.position=L8(e))}function XO(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,fh(c)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function KO(e,t){const n=t.data||{},i="value"in t&&!(ax.call(n,"hProperties")||ax.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 WO(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 K5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function W5(e,t){const n=YO(e,t),i=n.one(e,void 0),a=$O(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 ZO(e,t){return e&&"run"in e?async function(n,i){const a=W5(n,{file:i,...t});await e.run(a,i)}:function(n,i){return W5(n,{file:i,...e||t})}}function Z5(e){if(e)throw e}var Kg,J5;function JO(){if(J5)return Kg;J5=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 x=e.call(m,"constructor"),v=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!x&&!v)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},u=function(m,x){n&&x.name==="__proto__"?n(m,x.name,{enumerable:!0,configurable:!0,value:x.newValue,writable:!0}):m[x.name]=x.newValue},f=function(m,x){if(x==="__proto__")if(e.call(m,x)){if(i)return i(m,x).value}else return;return m[x]};return Kg=function h(){var m,x,v,b,y,w,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(x in m)v=f(j,x),b=f(m,x),j!==b&&(C&&b&&(c(b)||(y=a(b)))?(y?(y=!1,w=v&&a(v)?v:[]):w=v&&c(v)?v:{},u(j,{name:x,newValue:h(C,w,b)})):typeof b<"u"&&u(j,{name:x,newValue:b}));return j},Kg}var eL=JO();const Wg=px(eL);function lx(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 tL(){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 x=e[++c];let v=-1;if(h){u(h);return}for(;++v<a.length;)(m[v]===null||m[v]===void 0)&&(m[v]=a[v]);a=m,x?nL(x,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 nL(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 x=m;if(f&&n)throw x;return a(x)}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 Ai={basename:sL,dirname:iL,extname:rL,join:aL,sep:"/"};function sL(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Du(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 iL(e){if(Du(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 rL(e){Du(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 aL(...e){let t=-1,n;for(;++t<e.length;)Du(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":lL(n)}function lL(e){Du(e);const t=e.codePointAt(0)===47;let n=oL(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function oL(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 Du(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const cL={cwd:uL};function uL(){return"/"}function ox(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function dL(e){if(typeof e=="string")e=new URL(e);else if(!ox(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 fL(e)}function fL(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 Zg=["history","path","basename","stem","extname","dirname"];class Kj{constructor(t){let n;t?ox(t)?n={path:t}:typeof t=="string"||hL(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":cL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Zg.length;){const c=Zg[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)Zg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ai.basename(this.path):void 0}set basename(t){e0(t,"basename"),Jg(t,"basename"),this.path=Ai.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ai.dirname(this.path):void 0}set dirname(t){e2(this.basename,"dirname"),this.path=Ai.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ai.extname(this.path):void 0}set extname(t){if(Jg(t,"extname"),e2(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=Ai.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ox(t)&&(t=dL(t)),e0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ai.basename(this.path,this.extname):void 0}set stem(t){e0(t,"stem"),Jg(t,"stem"),this.path=Ai.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 Gn(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 Jg(e,t){if(e&&e.includes(Ai.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ai.sep+"`")}function e0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function e2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function hL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pL=(function(e){const i=this.constructor.prototype,a=i[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),mL={}.hasOwnProperty;class nv extends pL{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=tL()}copy(){const t=new nv;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Wg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(s0("data",this.frozen),this.namespace[t]=n,this):mL.call(this.namespace,t)&&this.namespace[t]||void 0:t?(s0("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=_f(t),i=this.parser||this.Parser;return t0("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),t0("process",this.parser||this.Parser),n0("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(c,u){const f=_f(t),h=i.parse(f);i.run(h,f,function(x,v,b){if(x||!v||!b)return m(x);const y=v,w=i.stringify(y,b);vL(w)?b.value=w:b.result=w,m(x,b)});function m(x,v){x||!v?u(x):c?c(v):n(void 0,v)}}}processSync(t){let n=!1,i;return this.freeze(),t0("processSync",this.parser||this.Parser),n0("processSync",this.compiler||this.Compiler),this.process(t,a),n2("processSync","process",n),i;function a(c,u){n=!0,Z5(c),i=u}}run(t,n,i){t2(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=_f(n);a.run(t,h,m);function m(x,v,b){const y=v||t;x?f(x):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,c),n2("runSync","run",i),a;function c(u,f){Z5(u),a=f,i=!0}}stringify(t,n){this.freeze();const i=_f(n),a=this.compiler||this.Compiler;return n0("stringify",a),t2(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(s0("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[x,...v]=m;h(x,v)}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=Wg(!0,a.settings,m.settings))}function f(m){let x=-1;if(m!=null)if(Array.isArray(m))for(;++x<m.length;){const v=m[x];c(v)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function h(m,x){let v=-1,b=-1;for(;++v<i.length;)if(i[v][0]===m){b=v;break}if(b===-1)i.push([m,...x]);else if(x.length>0){let[y,...w]=x;const j=i[b][1];lx(j)&&lx(y)&&(y=Wg(!0,j,y)),i[b]=[m,y,...w]}}}}const gL=new nv().freeze();function t0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function n0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function s0(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 t2(e){if(!lx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function n2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function _f(e){return xL(e)?e:new Kj(e)}function xL(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function vL(e){return typeof e=="string"||bL(e)}function bL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",s2=[],i2={allowDangerousHtml:!0},_L=/^(https?|ircs?|mailto|xmpp)$/i,wL=[{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 sv(e){const t=SL(e),n=kL(e);return jL(t.runSync(t.parse(n),n),e)}function SL(e){const t=e.rehypePlugins||s2,n=e.remarkPlugins||s2,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...i2}:i2;return gL().use(nO).use(n).use(ZO,i).use(t)}function kL(e){const t=e.children||"",n=new Kj;return typeof t=="string"&&(n.value=t),n}function jL(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 x of wL)Object.hasOwn(t,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+yL+x.id,void 0);return tv(e,m),P8(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function m(x,v,b){if(x.type==="raw"&&b&&typeof v=="number")return u?b.children.splice(v,1):b.children[v]={type:"text",value:x.value},v;if(x.type==="element"){let y;for(y in Yg)if(Object.hasOwn(Yg,y)&&Object.hasOwn(x.properties,y)){const w=x.properties[y],j=Yg[y];(j===null||j.includes(x.tagName))&&(x.properties[y]=h(String(w||""),y,x))}}if(x.type==="element"){let y=n?!n.includes(x.tagName):c?c.includes(x.tagName):!1;if(!y&&i&&typeof v=="number"&&(y=!i(x,v,b)),y&&b&&typeof v=="number")return f&&x.children?b.children.splice(v,1,...x.children):b.children.splice(v,1),v}}}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||_L.test(e.slice(0,t))?e:""}function r2(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 CL(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function EL(e,t,n){const a=Ch((n||{}).ignore||[]),c=TL(t);let u=-1;for(;++u<c.length;)Xj(e,"text",f);function f(m,x){let v=-1,b;for(;++v<x.length;){const y=x[v],w=b?b.children:void 0;if(a(y,w?w.indexOf(y):void 0,b))return;b=y}if(b)return h(m,x)}function h(m,x){const v=x[x.length-1],b=c[u][0],y=c[u][1];let w=0;const N=v.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:[...x,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:(w!==L&&C.push({type:"text",value:m.value.slice(w,L)}),Array.isArray(R)?C.push(...R):R&&C.push(R),w=L+E[0].length,S=!0),!b.global)break;E=b.exec(m.value)}return S?(w<m.value.length&&C.push({type:"text",value:m.value.slice(w)}),v.children.splice(N,1,...C)):C=[m],N+C.length}}function TL(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([ML(a[0]),AL(a[1])])}return t}function ML(e){return typeof e=="string"?new RegExp(CL(e),"g"):e}function AL(e){return typeof e=="function"?e:function(){return e}}const i0="phrasing",r0=["autolink","link","image","label"];function RL(){return{transforms:[PL],enter:{literalAutolink:LL,literalAutolinkEmail:a0,literalAutolinkHttp:a0,literalAutolinkWww:a0},exit:{literalAutolink:BL,literalAutolinkEmail:$L,literalAutolinkHttp:DL,literalAutolinkWww:zL}}}function OL(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:i0,notInConstruct:r0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:i0,notInConstruct:r0},{character:":",before:"[ps]",after:"\\/",inConstruct:i0,notInConstruct:r0}]}}function LL(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function a0(e){this.config.enter.autolinkProtocol.call(this,e)}function DL(e){this.config.exit.autolinkProtocol.call(this,e)}function zL(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 $L(e){this.config.exit.autolinkEmail.call(this,e)}function BL(e){this.exit(e)}function PL(e){EL(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),UL]],{ignore:["link","linkReference"]})}function FL(e,t,n,i,a){let c="";if(!Wj(a)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!IL(n)))return!1;const u=HL(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 UL(e,t,n,i){return!Wj(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function IL(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 HL(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=r2(e,"(");let c=r2(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 Wj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||al(n)||kh(n))&&(!t||n!==47)}Zj.peek=ZL;function qL(){this.buffer()}function VL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function GL(){this.buffer()}function YL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function QL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function XL(e){this.exit(e)}function KL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function WL(e){this.exit(e)}function ZL(){return"["}function Zj(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 JL(){return{enter:{gfmFootnoteCallString:qL,gfmFootnoteCall:VL,gfmFootnoteDefinitionLabelString:GL,gfmFootnoteDefinition:YL},exit:{gfmFootnoteCallString:QL,gfmFootnoteCall:XL,gfmFootnoteDefinitionLabelString:KL,gfmFootnoteDefinition:WL}}}function eD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Zj},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"),x=c.enter("label");return h+=f.move(c.safe(c.associationId(i),{before:h,after:"]"})),x(),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?Jj:tD))),m(),h}}function tD(e,t,n){return t===0?e:Jj(e,t,n)}function Jj(e,t,n){return(n?"":" ")+e}const nD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];eN.peek=lD;function sD(){return{canContainEols:["delete"],enter:{strikethrough:rD},exit:{strikethrough:aD}}}function iD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:nD}],handlers:{delete:eN}}}function rD(e){this.enter({type:"delete",children:[]},e)}function aD(e){this.exit(e)}function eN(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 lD(){return"~"}function oD(e){return e.length}function cD(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||oD,c=[],u=[],f=[],h=[];let m=0,x=-1;for(;++x<e.length;){const j=[],N=[];let S=-1;for(e[x].length>m&&(m=e[x].length);++S<e[x].length;){const C=uD(e[x][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[x]=j,f[x]=N}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<m;)c[v]=a2(i[v]);else{const j=a2(i);for(;++v<m;)c[v]=j}v=-1;const b=[],y=[];for(;++v<m;){const j=c[v];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let C=n.alignDelimiters===!1?1:Math.max(1,h[v]-N.length-S.length);const E=N+"-".repeat(C)+S;n.alignDelimiters!==!1&&(C=N.length+C+S.length,C>h[v]&&(h[v]=C),y[v]=C),b[v]=E}u.splice(1,0,b),f.splice(1,0,y),x=-1;const w=[];for(;++x<u.length;){const j=u[x],N=f[x];v=-1;const S=[];for(;++v<m;){const C=j[v]||"";let E="",L="";if(n.alignDelimiters!==!1){const O=h[v]-(N[v]||0),R=c[v];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&&!v&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||v)&&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||v!==m-1)&&S.push("|")}w.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return w.join(`
|
|
86
|
-
`)}function uD(e){return e==null?"":String(e)}function a2(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 dD(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()),fD);return a(),u}function fD(e,t,n){return">"+(n?"":" ")+e}function hD(e,t){return l2(e,t.inConstruct,!0)&&!l2(e,t.notInConstruct,!1)}function l2(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 o2(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
87
|
-
`&&hD(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
88
|
-
`}function pD(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 mD(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 gD(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 xD(e,t,n,i){const a=gD(n),c=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(mD(e,n)){const v=n.enter("codeIndented"),b=n.indentLines(c,vD);return v(),b}const f=n.createTracker(i),h=a.repeat(Math.max(pD(c,a)+1,3)),m=n.enter("codeFenced");let x=f.move(h);if(e.lang){const v=n.enter(`codeFencedLang${u}`);x+=f.move(n.safe(e.lang,{before:x,after:" ",encode:["`"],...f.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${u}`);x+=f.move(" "),x+=f.move(n.safe(e.meta,{before:x,after:`
|
|
89
|
-
`,encode:["`"],...f.current()})),v()}return x+=f.move(`
|
|
90
|
-
`),c&&(x+=f.move(c+`
|
|
91
|
-
`)),x+=f.move(h),m(),x}function vD(e,t,n){return(n?"":" ")+e}function iv(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 bD(e,t,n,i){const a=iv(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 yD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Eu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hh(e,t,n){const i=ko(e),a=ko(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}}tN.peek=_D;function tN(e,t,n,i){const a=yD(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),x=hh(i.before.charCodeAt(i.before.length-1),m,a);x.inside&&(h=Eu(m)+h.slice(1));const v=h.charCodeAt(h.length-1),b=hh(i.after.charCodeAt(0),v,a);b.inside&&(h=h.slice(0,-1)+Eu(v));const y=u.move(a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},f+h+y}function _D(e,t,n){return n.options.emphasis||"*"}function wD(e,t){let n=!1;return tv(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,rx}),!!((!e.depth||e.depth<3)&&Qx(e)&&(t.options.setext||n))}function SD(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(i);if(wD(e,n)){const x=n.enter("headingSetext"),v=n.enter("phrasing"),b=n.containerPhrasing(e,{...c.current(),before:`
|
|
93
|
-
`,after:`
|
|
94
|
-
`});return v(),x(),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=Eu(m.charCodeAt(0))+m.slice(1)),m=m?u+" "+m:u,n.options.closeAtx&&(m+=" "+u),h(),f(),m}nN.peek=kD;function nN(e){return e.value||""}function kD(){return"<"}sN.peek=jD;function sN(e,t,n,i){const a=iv(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 jD(){return"!"}iN.peek=ND;function iN(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 x=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=x,c(),a==="full"||!m||m!==v?h+=f.move(v+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function ND(){return"!"}rN.peek=CD;function rN(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 CD(){return"`"}function aN(e,t){const n=Qx(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))}lN.peek=ED;function lN(e,t,n,i){const a=iv(n),c=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let f,h;if(aN(e,n)){const x=n.stack;n.stack=[],f=n.enter("autolink");let v=u.move("<");return v+=u.move(n.containerPhrasing(e,{before:v,after:">",...u.current()})),v+=u.move(">"),f(),n.stack=x,v}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 ED(e,t,n){return aN(e,n)?"<":"["}oN.peek=TD;function oN(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 x=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=x,c(),a==="full"||!m||m!==v?h+=f.move(v+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function TD(){return"["}function rv(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 MD(e){const t=rv(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 AD(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 cN(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 RD(e,t,n,i){const a=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?AD(n):rv(n);const f=e.ordered?u==="."?")":".":MD(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const x=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&x&&(!x.children||!x.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),cN(n)===u&&x){let v=-1;for(;++v<e.children.length;){const b=e.children[v];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 OD(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 LD(e,t,n,i){const a=OD(n);let c=n.bulletCurrent||rv(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()),x);return h(),m;function x(v,b,y){return b?(y?"":" ".repeat(u))+v:(y?c:c+" ".repeat(u-c.length))+v}}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 zD=Ch(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $D(e,t,n,i){return(e.children.some(function(u){return zD(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function BD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}uN.peek=PD;function uN(e,t,n,i){const a=BD(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),x=hh(i.before.charCodeAt(i.before.length-1),m,a);x.inside&&(h=Eu(m)+h.slice(1));const v=h.charCodeAt(h.length-1),b=hh(i.after.charCodeAt(0),v,a);b.inside&&(h=h.slice(0,-1)+Eu(v));const y=u.move(a+a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},f+h+y}function PD(e,t,n){return n.options.strong||"*"}function FD(e,t,n,i){return n.safe(e.value,i)}function UD(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 ID(e,t,n){const i=(cN(n)+(n.options.ruleSpaces?" ":"")).repeat(UD(n));return n.options.ruleSpaces?i.slice(0,-1):i}const dN={blockquote:dD,break:o2,code:xD,definition:bD,emphasis:tN,hardBreak:o2,heading:SD,html:nN,image:sN,imageReference:iN,inlineCode:rN,link:lN,linkReference:oN,list:RD,listItem:LD,paragraph:DD,root:$D,strong:uN,text:FD,thematicBreak:ID};function HD(){return{enter:{table:qD,tableData:c2,tableHeader:c2,tableRow:GD},exit:{codeText:YD,table:VD,tableData:l0,tableHeader:l0,tableRow:l0}}}function qD(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 VD(e){this.exit(e),this.data.inTable=void 0}function GD(e){this.enter({type:"tableRow",children:[]},e)}function l0(e){this.exit(e)}function c2(e){this.enter({type:"tableCell",children:[]},e)}function YD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,QD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function QD(e,t){return t==="|"?t:e}function XD(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,w,j,N){return m(x(y,j,N),y.align)}function f(y,w,j,N){const S=v(y,j,N),C=m([S]);return C.slice(0,C.indexOf(`
|
|
99
|
-
`))}function h(y,w,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,w){return cD(y,{align:w,alignDelimiters:i,padding:n,stringLength:a})}function x(y,w,j){const N=y.children;let S=-1;const C=[],E=w.enter("table");for(;++S<N.length;)C[S]=v(N[S],w,j);return E(),C}function v(y,w,j){const N=y.children;let S=-1;const C=[],E=w.enter("tableRow");for(;++S<N.length;)C[S]=h(N[S],y,w,j);return E(),C}function b(y,w,j){let N=dN.inlineCode(y,w,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function KD(){return{exit:{taskListCheckValueChecked:u2,taskListCheckValueUnchecked:u2,paragraph:ZD}}}function WD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:JD}}}function u2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ZD(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 JD(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=dN.listItem(e,t,n,{...i,...f.current()});return c&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),h;function m(x){return x+u}}function ez(){return[RL(),JL(),sD(),HD(),KD()]}function tz(e){return{extensions:[OL(),eD(e),iD(),XD(e),WD()]}}const nz={tokenize:oz,partial:!0},fN={tokenize:cz,partial:!0},hN={tokenize:uz,partial:!0},pN={tokenize:dz,partial:!0},sz={tokenize:fz,partial:!0},mN={name:"wwwAutolink",tokenize:az,previous:xN},gN={name:"protocolAutolink",tokenize:lz,previous:vN},gr={name:"emailAutolink",tokenize:rz,previous:bN},$i={};function iz(){return{text:$i}}let Qa=48;for(;Qa<123;)$i[Qa]=gr,Qa++,Qa===58?Qa=65:Qa===91&&(Qa=97);$i[43]=gr;$i[45]=gr;$i[46]=gr;$i[95]=gr;$i[72]=[gr,gN];$i[104]=[gr,gN];$i[87]=[gr,mN];$i[119]=[gr,mN];function rz(e,t,n){const i=this;let a,c;return u;function u(v){return!cx(v)||!bN.call(i,i.previous)||av(i.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(v))}function f(v){return cx(v)?(e.consume(v),f):v===64?(e.consume(v),h):n(v)}function h(v){return v===46?e.check(sz,x,m)(v):v===45||v===95||qn(v)?(c=!0,e.consume(v),h):x(v)}function m(v){return e.consume(v),a=!0,h}function x(v){return c&&a&&ss(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function az(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!xN.call(i,i.previous)||av(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(nz,e.attempt(fN,e.attempt(hN,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function lz(e,t,n){const i=this;let a="",c=!1;return u;function u(v){return(v===72||v===104)&&vN.call(i,i.previous)&&!av(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),f):n(v)}function f(v){if(ss(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),f;if(v===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(v),h}return n(v)}function h(v){return v===47?(e.consume(v),c?m:(c=!0,h)):n(v)}function m(v){return v===null||uh(v)||Pt(v)||al(v)||kh(v)?n(v):e.attempt(fN,e.attempt(hN,x),n)(v)}function x(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function oz(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 cz(e,t,n){let i,a,c;return u;function u(m){return m===46||m===95?e.check(pN,h,f)(m):m===null||Pt(m)||al(m)||m!==45&&kh(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 uz(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(pN,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 dz(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 ss(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),i):ss(f)?(e.consume(f),u):n(f)}}function fz(e,t,n){return i;function i(c){return e.consume(c),a}function a(c){return qn(c)?n(c):t(c)}}function xN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function vN(e){return!ss(e)}function bN(e){return!(e===47||cx(e))}function cx(e){return e===43||e===45||e===46||e===95||qn(e)}function av(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 hz={tokenize:_z,partial:!0};function pz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vz,continuation:{tokenize:bz},exit:yz}},text:{91:{name:"gfmFootnoteCall",tokenize:xz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:mz,resolveTo:gz}}}}function mz(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=fi(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 gz(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 xz(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,u;return f;function f(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),h}function h(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(v){if(c>999||v===93&&!u||v===null||v===91||Pt(v))return n(v);if(v===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(fi(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Pt(v)||(u=!0),c++,e.consume(v),v===92?x:m}function x(v){return v===91||v===92||v===93?(e.consume(v),c++,m):m(v)}}function vz(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,u=0,f;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",x):n(w)}function x(w){if(u>999||w===93&&!f||w===null||w===91||Pt(w))return n(w);if(w===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=fi(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Pt(w)||(f=!0),u++,e.consume(w),w===92?v:x}function v(w){return w===91||w===92||w===93?(e.consume(w),u++,x):x(w)}function b(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(c)||a.push(c),_t(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function bz(e,t,n){return e.check(Lu,t,e.attempt(hz,t,n))}function yz(e){e.exit("gfmFootnoteDefinition")}function _z(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 wz(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 x={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[h][1].end)},v={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[h][1].start)},b=[["enter",x,f],["enter",u[m][1],f],["exit",u[m][1],f],["enter",v,f]],y=f.parser.constructs.insideSpan.null;y&&Ls(b,b.length,0,jh(y,u.slice(m+1,h),f)),Ls(b,b.length,0,[["exit",v,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",x,f]]),Ls(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,x=this.events;let v=0;return b;function b(w){return m===126&&x[x.length-1][1].type!=="characterEscape"?h(w):(u.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const j=ko(m);if(w===126)return v>1?h(w):(u.consume(w),v++,y);if(v<2&&!n)return h(w);const N=u.exit("strikethroughSequenceTemporary"),S=ko(w);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,f(w)}}}class Sz{constructor(){this.map=[],this.index=new Map}add(t,n,i){kz(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,this.index.clear()}}function kz(e,t,n,i){if(n===0&&i.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,a[2].push(...i);return}const c=[t,n,i];e.map.push(c),e.index.set(t,c)}function jz(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:Cz,resolveAll:Ez}}}}function Cz(e,t,n){const i=this;let a=0,c=0,u;return f;function f(P){let Q=i.events.length-1;for(;Q>-1;){const{type:K}=i.events[Q][1];if(K==="lineEnding"||K==="linePrefix")Q--;else break}const A=Q>-1?i.events[Q][1].type:null,de=A==="tableHead"||A==="tableRow"?R:h;return de===R&&i.parser.lazy[i.now().line]?n(P):de(P)}function h(P){return e.enter("tableHead"),e.enter("tableRow"),m(P)}function m(P){return P===124||(u=!0,c+=1),x(P)}function x(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,x,"whitespace")(P):(c+=1,u&&(u=!1,a+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),u=!0,x):(e.enter("data"),v(P)))}function v(P){return P===null||P===124||Pt(P)?(e.exit("data"),x(P)):(e.consume(P),P===92?b:v)}function b(P){return P===92||P===124?(e.consume(P),v):v(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,w,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):w(P))}function w(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?w(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"),U(P)}function U(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),U):P===null||qe(P)?(e.exit("tableRow"),t(P)):dt(P)?_t(e,U,"whitespace")(P):(e.enter("data"),D(P))}function D(P){return P===null||P===124||Pt(P)?(e.exit("data"),U(P)):(e.consume(P),P===92?X:D)}function X(P){return P===92||P===124?(e.consume(P),D):D(P)}}function Ez(e,t){let n=-1,i=!0,a=0,c=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,m,x,v;const b=new Sz;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(f=!1,h!==0&&(d2(b,t,h,m,x),x=void 0,h=0),m={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},b.add(n,0,[["enter",m,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(i=!0,v=void 0,c=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,x={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},b.add(n,0,[["enter",x,t]])),a=w.type==="tableDelimiterRow"?2:x?3:1):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],v=wf(b,t,c,a,void 0,v),c=[0,0,0,0]),u[2]=n)):w.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(u[0]=u[1],v=wf(b,t,c,a,void 0,v)),c=u,u=[c[1],n,0,0])):w.type==="tableHead"?(f=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,c[1]!==0?(u[0]=u[1],v=wf(b,t,c,a,n,v)):u[1]!==0&&(v=wf(b,t,u,a,n,v)),a=0):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&d2(b,t,h,m,x),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=jz(t.events,n))}return e}function wf(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]),x=ao(t.events,n[3]),v={type:f,start:Object.assign({},m),end:Object.assign({},x)};if(e.add(n[2],0,[["enter",v,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 w=n[2]+1,j=n[3]-n[2]-1;e.add(w,j,[])}}e.add(n[3]+1,0,[["exit",v,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 d2(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 Tz={name:"tasklistCheck",tokenize:Az};function Mz(){return{text:{91:Tz}}}function Az(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:Rz},t,n)(h):n(h)}}function Rz(e,t,n){return _t(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function Oz(e){return Tj([iz(),pz(),wz(e),Nz(),Mz()])}const Lz={};function lv(e){const t=this,n=e||Lz,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(Oz(n)),c.push(ez()),u.push(tz(n))}const Dz=1500;async function zz(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 Th({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 zz(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 ph(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(ph).join(""):typeof e=="object"&&e!==null&&"props"in e?ph((t=e.props)==null?void 0:t.children):""}const o0=/https?:\/\/[^\s<>"'`]+/gi,$z=`.,;:!?]}>'"`;function Bz(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($z.includes(n)){t--;continue}break}return e.slice(0,t)}function Pz(e){return/^https?:\/\/[^\s/]/i.test(e)}function Fz(e){if(!e)return[];const t=[];let n=0;o0.lastIndex=0;let i;for(;(i=o0.exec(e))!==null;){const a=Bz(i[0]);!a||!Pz(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,o0.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const f2=40;function Uz(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>f2?`${t.slice(0,f2-1)}…`:t}`:"Copy"}function yN({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const i=ph(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=Fz(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(Th,{text:i,label:Uz(i),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const mh=25*1024*1024,gh=100*1024*1024;function _N(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 oa(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 wN(e){return e.startsWith("image/")}function SN({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 kN({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:c="w-12 h-12"}){const u=wN(t);return l.jsxs("div",{className:"relative group",title:`${e} (${oa(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(SN,{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 Iz({name:e,mediaType:t,data:n,size:i}){return wN(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(SN,{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:oa(i)})]})]})}function Hz({message:e}){const t=ha(),[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 qz({message:e}){return e.role==="system"?l.jsx(Hz,{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(Iz,{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(ov,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(Xz,{message:e})})}function Vz(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 Gz(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 Yz(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function Qz({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 Xz({message:e}){var u;const t=e.contentBlocks||[],n=ha(),i=k.useMemo(()=>Vz(t),[t]),a=k.useMemo(()=>Gz(t),[t]),c=k.useMemo(()=>n?i.filter(f=>!Yz(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(Ff,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(Qz,{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(Ff,{}),l.jsx("div",{className:"flex-1 min-w-0",children:f?l.jsx(NN,{text:e.content}):l.jsx(ov,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Ff,{}),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(Kz,{block:f.block,toolUseById:a},h);if(f.items.length===1){const m=f.items[0];return l.jsx(I2,{name:m.name,input:m.input,toolUseId:m.id},h)}return l.jsx(Jz,{name:f.name,items:f.items},h)})})]})}function Ff(){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 ov({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(sv,{remarkPlugins:[lv],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=ph(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(Th,{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(yN,{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 Kz({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(ov,{text:e.text});if(e.type==="thinking")return l.jsx(NN,{text:e.thinking});if(e.type==="tool_use")return l.jsx(I2,{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(Wz,{text:n,isError:c}):l.jsx(Zz,{content:n,isError:c})}return null}function jN(e){return`${e} ${e===1?"line":"lines"}`}function Wz({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,c]=k.useState(!1),u=ha(),[f,h]=k.useState(!1),m=a||!i?e:n.slice(-20).join(`
|
|
101
|
-
`),x=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Th,{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(vh,{open:f,onToggle:()=>h(!f),marker:"›",label:t?"Error output":"Output",meta:jN(n.length),labelClassName:t?"text-cc-error/70":""}),f&&l.jsx("div",{className:"mt-1",children:x})]}):x}function Zz({content:e,isError:t}){const n=ha(),[i,a]=k.useState(!1),c=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Th,{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(vh,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:jN(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:c})]}):c}function Jz({name:e,items:t}){const[n,i]=k.useState(!1),a=No(e),c=Oi(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=go(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 NN({text:e}){const t=e.trim(),n=ha(),[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(sv,{remarkPlugins:[lv],components:{p:({children:x})=>l.jsx("p",{className:"mb-2 last:mb-0",children:x}),ul:({children:x})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:x}),ol:({children:x})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:x}),li:({children:x})=>l.jsx("li",{children:x}),code:({children:x})=>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:x})},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 Wc(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 h2(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":e$(t):"N/A"}catch{return"N/A"}}function ux(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 p2(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function e$(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 t$({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:No(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:Oi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function n$({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:`${Oi(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(s$,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function s$({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:No(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Oi(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 i$(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 r$(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:i$(t)}function a$(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 l$(e){if(e.length>=2)return!0;const t=e[0];return!(t.kind==="message"&&t.msg.role==="system")}function o$(e){const t=[];let n=[];const i=()=>{n.length!==0&&(l$(n)?t.push({kind:"activity_run",key:a$(n[0]),children:n}):t.push(...n),n=[])};for(const a of e)a.kind==="activity_run"||r$(a)?(i(),t.push(a)):n.push(a);return i(),t}const m2=160;function dx(e){const t=e.split(`
|
|
104
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>m2?`${t.slice(0,m2)}…`:t:""}function CN(e,t){const n=go(e,t);return{label:n?`${Oi(e)} · ${n}`:Oi(e),toolName:e}}function c$(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="tool_use")return CN(n.name,n.input);if(n.type==="text"&&n.text.trim())return{label:dx(n.text),italic:!0};if(n.type==="thinking"&&n.thinking.trim())return{label:dx(n.thinking),italic:!0}}return null}function u$(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?CN(n.name,n.input):null}case"activity_run":return Mh(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?c$(i)??{label:"Thinking…",italic:!0}:(t=n.content)!=null&&t.trim()?{label:dx(n.content),italic:!0}:{label:"Thinking…",italic:!0}}}}function EN(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]=EN(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=Mh(e);return[t.startedAt,t.endedAt]}}}function Mh(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 v of h.msg.contentBlocks??[])v.type==="tool_use"&&n++,v.type==="tool_result"&&v.is_error&&a++;else{const v=Mh(h);n+=v.toolCalls,i+=v.subagents,a+=v.errors}const[m,x]=EN(h);m!==null&&(c===null||m<c)&&(c=m),x!==null&&(u===null||x>u)&&(u=x)}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?u$(f):null}}function d$({run:e,live:t,children:n}){const[i,a]=k.useState(!1),c=t?Date.now():void 0,u=k.useMemo(()=>Mh(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",x=`${u.steps} step${u.steps===1?"":"s"}`,v=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(Ff,{}),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}: ${x}, ${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":x})]}),!i&&v&&l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 pl-4 py-0.5 text-[11px] min-w-0",children:[v.toolName&&l.jsx(sl,{type:No(v.toolName)}),l.jsx("span",{className:`truncate min-w-0 ${v.italic?"italic text-cc-muted/60":"font-mono-code text-cc-muted/70"}`,children:v.label})]})]})]}),i&&l.jsx("div",{className:"mt-4 space-y-5 sm:space-y-7 animate-[fadeSlideIn_0.2s_ease-out]",children:n})]})}const Sf=100,f$=40,h$=120,g2=1e4,p$=15*6e4,c0=new Map,m$=[],g$=[];function x$(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function v$(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 x2(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function b$(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 TN(e){const t=[];for(const n of e){const i=v$(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(...x2(n)),a.endedAt=Math.max(a.endedAt,n.timestamp);continue}t.push({kind:"tool_msg_group",toolName:i,items:x2(n),firstId:n.id,startedAt:n.timestamp,endedAt:n.timestamp})}else t.push({kind:"message",msg:n})}return t}function MN(e,t,n){const i=TN(e),a=[];for(const c of i){a.push(c);const u=b$(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const m=t.get(f)||{description:"Subagent",agentType:""},x=MN(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:x})}}}return a}function y$(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,x=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||x!==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:v?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:m,senderThreadId:x,receiverThreadIds:h})}}if(t.size===0)return TN(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 MN(i,t,n)}function _$({group:e}){const[t,n]=k.useState(!1),i=No(e.toolName),a=Oi(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(v2,{}),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:go(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(v2,{}),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=go(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 cv({entries:e,toolActivity:t,liveRunKey:n}){return l.jsx(l.Fragment,{children:e.map((i,a)=>{if(i.kind==="activity_run")return l.jsx(d$,{run:i,live:i.key===n,children:l.jsx(cv,{entries:i.children,toolActivity:t})},i.key);if(i.kind==="tool_msg_group")return l.jsx(_$,{group:i},i.firstId||a);if(i.kind==="subagent")return l.jsx(k$,{group:i},i.taskToolUseId);const c=i.msg,u=w$(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(qz,{message:c}),h&&l.jsx(n$,{entries:f})]},c.id)})})}function w$(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function S$(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 k$({group:e}){const[t,n]=k.useState(!1),i=e.description||"Subagent",a=e.agentType,c=e.children.length,u=S$(e.status),f=e.receiverCount,h=e.senderThreadId,m=e.receiverThreadIds||[],x=e.backend||"claude",v=e.children[e.children.length-1],b=k.useMemo(()=>{var y,w;if(!v)return"";if(v.kind==="tool_msg_group")return`${Oi(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const j=(y=v.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const N=(w=v.msg.contentBlocks)==null?void 0:w.find(S=>S.type==="tool_use");if(N)return Oi(N.name)}return""},[v]);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:x==="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(cv,{entries:e.children})]})]})})}function v2(){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 j$({sessionId:e}){var nn;const t=W(se=>se.messages.get(e)??m$),n=W(se=>(se.sdkSessions||g$).find(je=>je.sessionId===e)),i=W(se=>se.streamingStartedAt.get(e)),a=W(se=>se.streamingOutputTokens.get(e)),c=W(se=>se.sessionStatus.get(e)),u=W(se=>se.lastActivityAt.get(e)),f=W(se=>se.sessionProcesses.get(e)),h=W(se=>se.toolProgress.get(e)),m=W(se=>se.toolActivity.get(e)),x=k.useRef(null),v=k.useRef(null),b=k.useRef(!0),[y,w]=k.useState(0),[j,N]=k.useState(Sf),[S,C]=k.useState([]),[E,L]=k.useState(0),[O,R]=k.useState(!1),[U,D]=k.useState(!1),[X,P]=k.useState(!1),[Q,A]=k.useState(""),de=k.useRef(new Set),K=W(se=>se.chatTabReentryTickBySession.get(e)??0),q=k.useMemo(()=>t.some(se=>se.role==="assistant"&&se.isStreaming),[t]),H=k.useMemo(()=>(f??[]).filter(se=>se.status==="running"),[f]),I=H.length>0,re=k.useMemo(()=>{const se=m??[];for(let je=se.length-1;je>=0;je--)if(!se[je].completedAt)return se[je]},[m]),ve=k.useMemo(()=>H.length>0?Math.min(...H.map(se=>se.startedAt)):null,[H]),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]),Ee=M.length>0,Ae=n!=null&&n.forkSession?"Forked from":"Continuing from",z=k.useMemo(()=>{if(S.length===0)return t;const se=[],je=new Set;for(const Qe of S)je.has(Qe.id)||(je.add(Qe.id),se.push(Qe));for(const Qe of t)je.has(Qe.id)||(je.add(Qe.id),se.push(Qe));return se},[S,t]),B=k.useMemo(()=>y$(z),[z]);k.useEffect(()=>{N(Sf),C([]),L(0),R(!1),D(!1),P(!1),A(""),de.current=new Set},[e,M]);const oe=B.length,_e=oe>j,Ne=k.useMemo(()=>_e?B.slice(oe-j):B,[B,_e,oe,j]),Me=oe-Ne.length,Le=ha(),De=k.useMemo(()=>Le?o$(Ne):Ne,[Le,Ne]),Ce=De[De.length-1],Re=c==="running"&&(Ce==null?void 0:Ce.kind)==="activity_run"?Ce.key:void 0,Ft=k.useCallback(()=>{const se=v.current,je=(se==null?void 0:se.scrollHeight)??0;N(Qe=>Qe+Sf),requestAnimationFrame(()=>{if(se){const Qe=se.scrollHeight;se.scrollTop+=Qe-je}})},[]),Kt=k.useCallback(async(se={})=>{if(!Ee||!M||X)return;const je=v.current,Qe=(je==null?void 0:je.scrollHeight)??0,et=U?E:0;P(!0),A("");try{const un=await ke.getClaudeSessionHistory(M,{cursor:et,limit:f$}),ce=un.messages.map(G=>({id:G.id,role:G.role,content:G.content,contentBlocks:G.role==="assistant"?G.contentBlocks:void 0,timestamp:G.timestamp||Date.now(),model:G.role==="assistant"?G.model:void 0,stopReason:G.role==="assistant"?G.stopReason:void 0})),be=[];for(const G of ce)de.current.has(G.id)||(de.current.add(G.id),be.push(G));C(G=>[...be,...G]),L(un.nextCursor),R(un.hasMore),D(!0),be.length>0&&N(G=>G+be.length),se.preserveScroll!==!1&&je&&requestAnimationFrame(()=>{const G=je.scrollHeight;je.scrollTop+=G-Qe})}catch(un){const ce=un instanceof Error?un.message:String(un);A(ce||"Failed to load previous history"),U||(C([]),L(0),R(!1))}finally{P(!1)}},[Ee,M,X,U,E]);k.useEffect(()=>{if(!i&&c!=="running"&&!I){w(0);return}const se=i||Date.now();w(Date.now()-se);const je=setInterval(()=>w(Date.now()-se),1e3);return()=>clearInterval(je)},[i,c,I]);function Ut(){const se=v.current;if(!se)return;b.current=se.scrollHeight-se.scrollTop-se.clientHeight<120;const je=Math.max(0,se.scrollHeight-se.clientHeight-se.scrollTop);c0.set(e,je),Ee&&U&&O&&!X&&se.scrollTop<=h$&&Kt({preserveScroll:!0})}const Nt=k.useCallback(()=>{const se=v.current;if(!se)return;const je=se.style.scrollBehavior;se.style.scrollBehavior="auto",se.scrollTop=se.scrollHeight,se.style.scrollBehavior=je},[]),wt=k.useCallback(()=>{const se=v.current;if(!se)return;const je=se.style.scrollBehavior;se.style.scrollBehavior="auto";const Qe=c0.get(e);typeof Qe=="number"?se.scrollTop=Math.max(0,se.scrollHeight-se.clientHeight-Qe):se.scrollTop=se.scrollHeight,se.style.scrollBehavior=je},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>wt())},[e,wt]),k.useEffect(()=>()=>{const se=v.current;if(!se)return;const je=Math.max(0,se.scrollHeight-se.clientHeight-se.scrollTop);c0.set(e,je)},[e]),k.useEffect(()=>{K&&requestAnimationFrame(()=>Nt())},[K,Nt]),k.useEffect(()=>{var se;b.current&&((se=x.current)==null||se.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:Ee?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:[Ae," ",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 Kt({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"]}),Q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:Q})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const Xe=c==="running"&&u!=null?Math.max(0,Date.now()-u):0,St=I&&(c!=="running"||Xe>=g2)?"background":Xe>=p$&&!re?"stalled":Xe>=g2?"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:v,onScroll:Ut,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:[Ee&&!U&&l.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[Ae," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[M," ",n!=null&&n.cwd?`· ${x$(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Kt({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"})]}),Q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:Q})]}),Ee&&U&&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"})}),_e&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Ft,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(Sf,Me)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Me," hidden)"]})]})}),l.jsx(cv,{entries:De,toolActivity:m,liveRunKey:Re}),h&&h.size>0&&!q&&l.jsx(t$,{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"||I)&&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:H.length===1?"Background process running":`${H.length} background processes running`}),ve!=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()-ve))})]}),((nn=H[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:H[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:re?`Running ${re.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:re?lo(Math.max(0,Date.now()-re.startedAt)):`no update for ${lo(Xe)}`}),(re==null?void 0:re.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:re.preview})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children: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:[Wc(a)," tokens"]})]})]})]}),l.jsx("div",{ref:x})]})})]})}const N$={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function C$(e,t){for(const[i,a]of Object.entries(N$))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function E$(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:C$(t.value,n)}))}const AN=[{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:""}],RN=[{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:"●"}],uv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],dv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],T$=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],ON=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],LN=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function DN(e){return e==="codex"?RN:AN}function b2(e){return e==="codex"?dv:uv}function JB(e){return e==="codex"?LN:ON}function y2(e){return e==="codex"?RN[0].value:AN[0].value}function _2(e){return e==="codex"?dv[0].value:uv[0].value}function eP(e){return e==="codex"?LN[0].value:ON[0].value}function M$(e){return e==="codex"?[]:T$}function w2({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=W(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),c=W(b=>b.sessions.get(e)),u=W(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=DN(f),x=m.find(b=>b.value===h)||(h?{label:h,icon:"?"}:null),v=k.useCallback(b=>{if(n(!1),b===h)return;In(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:w}=W.getState();w(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||!x?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: ${x.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[x.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:x.icon}),l.jsx("span",{children:x.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:()=>v(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 zN({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 $N({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,c]=k.useState(!1),[u,f]=k.useState(0),[h,m]=k.useState([]),[x,v]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{v(!0);try{const S=await ke.listPrompts(n);m(S.filter(C=>!!C.name.trim()))}catch{m([])}finally{v(!1)}},[n]);k.useEffect(()=>{y()},[y]);const w=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||!w)return[];const S=w.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,w,h]);k.useEffect(()=>{const S=i&&!!w;S&&!a?(c(!0),f(0)):!S&&a&&c(!1)},[i,w,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(!w)return{nextText:e,nextCursor:t};const C=`${S.content} `,E=`${e.slice(0,w.start)}${C}${e.slice(w.end)}`,L=w.start+C.length;return{nextText:E,nextCursor:L}},[w,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:w,filteredPrompts:j,promptsLoading:x,savedPrompts:h,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const A$=[];function S2({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 kf({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 k2(){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 j2({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 R$({sessionId:e}){var ce,be;const[t,n]=k.useState(""),[i,a]=k.useState([]),[c,u]=k.useState(null),[f,h]=k.useState(!1),[m,x]=k.useState(!1),[v,b]=k.useState(0),[y,w]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState("global"),[E,L]=k.useState(null),[O,R]=k.useState(0),U=k.useRef(null),D=k.useRef(null),X=k.useRef(null),P=k.useRef(null),Q=W(G=>G.cliConnected),A=W(G=>G.sessions.get(e)),de=W(G=>G.previousPermissionMode.get(e)||"acceptEdits"),K=Q.get(e)??!1,q=(A==null?void 0:A.permissionMode)||"acceptEdits",H=q==="plan",I=(A==null?void 0:A.backend_type)==="codex",ve=((be=(ce=(I?dv:uv).find(G=>G.value===q))==null?void 0:ce.label)==null?void 0:be.toLowerCase())||q,M=$N({text:t,caretPos:O,cwd:A==null?void 0:A.cwd,enabled:!m}),Ee=k.useMemo(()=>{const G=[];if(A!=null&&A.slash_commands)for(const me of A.slash_commands)G.push({name:me,type:"command"});if(A!=null&&A.skills)for(const me of A.skills)G.push({name:me,type:"skill"});return G},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),Ae=k.useMemo(()=>{if(!m)return[];const G=t.match(/^\/(\S*)$/);if(!G)return[];const me=G[1].toLowerCase();return me===""?Ee:Ee.filter(Pe=>Pe.name.toLowerCase().includes(me))},[t,m,Ee]);k.useEffect(()=>{const G=t.startsWith("/")&&/^\/\S*$/.test(t)&&Ee.length>0;G&&!m?(x(!0),b(0)):!G&&m&&x(!1)},[t,Ee.length,m]),k.useEffect(()=>{v>=Ae.length&&b(Math.max(0,Ae.length-1))},[Ae.length,v]),k.useEffect(()=>{if(!X.current||!m)return;const me=X.current.querySelectorAll("[data-cmd-index]")[v];me&&me.scrollIntoView({block:"nearest"})},[v,m]),k.useEffect(()=>{if(P.current===null||!U.current)return;const G=P.current;U.current.setSelectionRange(G,G),P.current=null},[t]);const z=k.useCallback(G=>{var me;n(`/${G.name} `),x(!1),(me=U.current)==null||me.focus()},[]),B=k.useCallback(G=>{var Pe;const me=M.selectPrompt(G);P.current=me.nextCursor,n(me.nextText),M.setMentionMenuOpen(!1),R(me.nextCursor),(Pe=U.current)==null||Pe.focus(),U.current&&(U.current.style.height="auto",U.current.style.height=Math.min(U.current.scrollHeight,200)+"px")},[M]);function oe(){var at;const G=t.trim();if(!G||!K)return;const me=x0(),Pe=i.length>0?i.map(ft=>({name:ft.name,media_type:ft.mediaType,data:ft.base64,size:ft.size})):void 0;In(e,{type:"user_message",content:G,session_id:e,attachments:Pe,client_msg_id:me});const We=W.getState();We.appendMessage(e,{id:me,role:"user",content:G,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),x(!1),M.setMentionMenuOpen(!1),U.current&&(U.current.style.height="auto"),(at=U.current)==null||at.focus()}function _e(G){if(m&&Ae.length>0){if(G.key==="ArrowDown"){G.preventDefault(),b(me=>(me+1)%Ae.length);return}if(G.key==="ArrowUp"){G.preventDefault(),b(me=>(me-1+Ae.length)%Ae.length);return}if(G.key==="Tab"&&!G.shiftKey){G.preventDefault(),z(Ae[v]);return}if(G.key==="Enter"&&!G.shiftKey){G.preventDefault(),z(Ae[v]);return}if(G.key==="Escape"){G.preventDefault(),x(!1);return}}if(M.mentionMenuOpen&&G.key==="Escape"){G.preventDefault(),M.setMentionMenuOpen(!1);return}if(M.mentionMenuOpen&&M.filteredPrompts.length>0){if(G.key==="ArrowDown"){G.preventDefault(),M.setMentionMenuIndex(me=>(me+1)%M.filteredPrompts.length);return}if(G.key==="ArrowUp"){G.preventDefault(),M.setMentionMenuIndex(me=>(me-1+M.filteredPrompts.length)%M.filteredPrompts.length);return}if(G.key==="Tab"&&!G.shiftKey||G.key==="Enter"&&!G.shiftKey){G.preventDefault(),B(M.filteredPrompts[M.mentionMenuIndex]);return}}if(M.mentionMenuOpen&&M.filteredPrompts.length===0&&(G.key==="Enter"&&!G.shiftKey||G.key==="Tab"&&!G.shiftKey)){G.preventDefault();return}if(G.key==="Tab"&&G.shiftKey){G.preventDefault(),Xe();return}G.key==="Enter"&&!G.shiftKey&&(G.preventDefault(),oe())}function Ne(G){n(G.target.value),R(G.target.selectionStart??G.target.value.length);const me=G.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,200)+"px"}function Me(){U.current&&R(U.current.selectionStart??0)}function Le(){In(e,{type:"interrupt"})}async function De(G){if(G.length===0)return;const me=[],Pe=[];let We=i.reduce((at,ft)=>at+ft.size,0);for(const at of G){if(at.size>mh){Pe.push(`${at.name} is too large (${oa(at.size)}, max ${oa(mh)})`);continue}if(We+at.size>gh){Pe.push(`${at.name} would exceed the per-message limit (${oa(gh)})`);continue}const{base64:ft,mediaType:hn}=await _N(at);me.push({name:at.name,base64:ft,mediaType:hn,size:at.size}),We+=at.size}me.length>0&&a(at=>[...at,...me]),u(Pe.length>0?Pe.join("; "):null)}async function Ce(G){const me=G.target.files;me&&(await De(Array.from(me)),G.target.value="")}function Re(G){a(me=>me.filter((Pe,We)=>We!==G))}async function Ft(G){var We;const me=(We=G.clipboardData)==null?void 0:We.items;if(!me)return;const Pe=[];for(const at of Array.from(me)){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&&(G.preventDefault(),await De(Pe))}function Kt(G){G.dataTransfer.types.includes("Files")&&(G.preventDefault(),G.stopPropagation(),h(!0))}function Ut(G){G.currentTarget===G.target&&h(!1)}async function Nt(G){if(!G.dataTransfer.types.includes("Files"))return;G.preventDefault(),G.stopPropagation(),h(!1);const me=Array.from(G.dataTransfer.files);me.length>0&&await De(me)}function wt(){const G=t.trim().slice(0,32);N(G||""),L(null),w(me=>!me)}function Xe(){if(!K)return;const G=W.getState();if(!H)G.setPreviousPermissionMode(e,q),In(e,{type:"set_permission_mode",mode:"plan"}),G.updateSession(e,{permissionMode:"plan"});else{const me=de||(I?"bypassPermissions":"acceptEdits");In(e,{type:"set_permission_mode",mode:me}),G.updateSession(e,{permissionMode:me})}}async function St(){const G=t.trim(),me=j.trim();if(!G||!me)return;if(S==="project"&&!(A!=null&&A.cwd)){L("No project folder available for this session");return}const Pe={name:me,content:G,scope:S};S==="project"&&(Pe.projectPaths=[A.cwd]);try{await ke.createPrompt(Pe),await M.refreshPrompts(),w(!1),N(""),C("global"),L(null)}catch(We){const at=We instanceof Error&&We.message?We.message:"Could not save prompt.";L(at)}}const se=W(G=>G.promptSuggestions.get(e))??A$,je=W(G=>G.clearPromptSuggestions),et=W(G=>G.sessionStatus).get(e)==="running",un=t.trim().length>0&&K;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:Kt,onDragLeave:Ut,onDrop:Nt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((G,me)=>l.jsx(kN,{name:G.name,mediaType:G.mediaType,base64:G.base64,size:G.size,onRemove:()=>Re(me)},me))}),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:Ce,className:"hidden","aria-label":"Attach files"}),se.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:se.map((G,me)=>l.jsx("button",{onClick:()=>{if(!K||et)return;const Pe=x0();In(e,{type:"user_message",content:G,session_id:e,client_msg_id:Pe}),W.getState().appendMessage(e,{id:Pe,role:"user",content:G,timestamp:Date.now()}),je(e)},disabled:!K||et,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:G,children:G},me))}),l.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${H?"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&&Ae.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:Ae.map((G,me)=>l.jsxs("button",{"data-cmd-index":me,onClick:()=>z(G),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${me===v?"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:G.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:["/",G.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:G.type})]})]},`${G.type}-${G.name}`))}),l.jsx(zN,{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:G=>{N(G.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:()=>{w(!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(S2,{isPlan:H,isConnected:K,onToggle:Xe,modeLabel:ve,size:"mobile"}),l.jsx(w2,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(kf,{onClick:wt,disabled:!K||!t.trim(),active:K&&!!t.trim(),title:"Save as prompt",children:l.jsx(k2,{})}),l.jsx(kf,{onClick:()=>{var G;return(G=D.current)==null?void 0:G.click()},disabled:!K,active:K,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:U,value:t,onChange:Ne,onKeyDown:_e,onClick:Me,onKeyUp:Me,onPaste:Ft,"aria-label":"Message input",placeholder:K?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!K,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(j2,{isRunning:et,canSend:un,onSend:oe,onInterrupt:Le,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(kf,{onClick:()=>{var G;return(G=D.current)==null?void 0:G.click()},disabled:!K,active:K,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(kf,{onClick:wt,disabled:!K||!t.trim(),active:K&&!!t.trim(),title:"Save as prompt",children:l.jsx(k2,{})}),l.jsx(S2,{isPlan:H,isConnected:K,onToggle:Xe,modeLabel:ve,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(w2,{sessionId:e}),l.jsx(j2,{isRunning:et,canSend:un,onSend:oe,onInterrupt:Le,size:"desktop"})]})]})]})})}function O$(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 L$(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=W(m=>m.removePermission);function c(m,x){i(!0),In(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:m,...x!=null&&x.length?{updated_permissions:x}:{}}),a(t,e.request_id)}function u(){i(!0),In(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(F$,{input:e.input,onSelect:m=>c({...e.input,answers:m}),disabled:n}):l.jsx(B$,{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($$,{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,x)=>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"})}),O$(m)]},x)),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 z$(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 $$({validation:e}){const t=e.verdict==="uncertain"&&z$(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 B$({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(P$,{input:t}):e==="Edit"?l.jsx(U$,{input:t}):e==="Write"?l.jsx(I$,{input:t}):e==="Read"?l.jsx(H$,{input:t}):e==="Glob"?l.jsx(q$,{input:t}):e==="Grep"?l.jsx(V$,{input:t}):e==="ExitPlanMode"?l.jsx(G$,{input:t}):l.jsx(BN,{input:t,description:n})}function P$({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 F$({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 x(N){return L$(i,N)}function v(N,S){const C=String(N);c(E=>({...E,[C]:S})),m(E=>({...E,[C]:!1})),i.length<=1&&t(x({[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(x({[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 w(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(x(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(BN,{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],U=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),Q=typeof D.description=="string"?D.description:"",A=R===P;return l.jsx("button",{onClick:()=>v(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}),Q&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:Q})]})]})},X)}),l.jsx("button",{onClick:()=>w(S),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${U?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${U?"border-cc-primary":"border-cc-muted/40"}`,children:U&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),U&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[O]||"",onChange: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 U$({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(jo,{oldText:n,newText:i,fileName:t,mode:"compact"})}function I$({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(jo,{newText:n,fileName:t,mode:"compact"})}function H$({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 q$({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 V$({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 G$({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(sv,{remarkPlugins:[lv],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(yN,{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 BN({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 Y$({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 Q$=[],X$=[],N2="activity-tray-panel";function K$(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 W$(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 Z$(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 J$({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 e9({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(J$,{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:K$(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 t9({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 n9({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=k.useRef(null),c=W(E=>E.sessionTasks.get(e)??Q$),u=W(E=>E.sessionBackgroundAgents.get(e)??X$),f=W$(c,u),h=u.some(E=>E.status==="running"),m=Z$(h),x=u.filter(E=>E.status==="running").length,v=c.length,b=c.filter(E=>E.status==="completed").length,y=c.filter(E=>E.status==="in_progress").length,w=c.length>0||u.length>0,j=x>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(()=>{w&&C(!1)},[w,c.length,u.length]),!w||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:N2,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(e9,{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(t9,{task:E},E.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":N2,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: ${x} agents running, ${b}/${v} 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:x>0?`${x} agent${x!==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,"/",v]}),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 s9({sessionId:e}){const t=W(w=>w.pendingPermissions.get(e)),n=W(w=>w.aiResolvedPermissions.get(e)),i=W(w=>w.clearAiResolvedPermissions),a=W(w=>w.connectionStatus.get(e)??"disconnected"),c=W(w=>w.cliConnected.get(e)??!1),u=W(w=>w.cliReconnecting.get(e)??!1),f=W(w=>w.setCliReconnecting),[h,m]=k.useState(null),x=k.useRef(void 0);k.useEffect(()=>{m(null),clearTimeout(x.current)},[e,c]),k.useEffect(()=>()=>clearTimeout(x.current),[]);const v=k.useCallback(async()=>{m(null),clearTimeout(x.current),f(e,!0);try{await ke.relaunchSession(e)}catch(w){da(w),f(e,!1);const j=w instanceof Error?w.message:"Reconnection failed";m(j),x.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:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?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:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),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(j$,{sessionId:e}),l.jsx(n9,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(Y$,{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(w=>l.jsx(D$,{permission:w,sessionId:e},w.request_id))}),l.jsx(R$,{sessionId:e})]})}function i9({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=W(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(x){i.current&&!i.current.contains(x.target)&&n(!1)}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t]);function h(m,x){const v=!x,b={[m]:v};W.getState().setSessionAiValidation(e,b),mT(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 r9({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=v=>{f.current&&!f.current.contains(v.target)&&n(!1)},x=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",m),window.addEventListener("keydown",x),()=>{window.removeEventListener("pointerdown",m),window.removeEventListener("keydown",x)}},[t]);const h=k.useCallback(async m=>{a(m),u(!1);try{const{blob:x,filename:v}=await ke.exportSession(e,m),b=URL.createObjectURL(x),y=document.createElement("a");y.href=b,y.download=v,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(x){da(x),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 a9({sessionId:e}){const t=W(x=>x.density),n=W(x=>x.magicUiAvailable),i=W(x=>{var v;return!!e&&((v=x.sessions.get(e))==null?void 0:v.magicUiActive)===!0}),a=k.useCallback(()=>{var v;if(!e)return;const x=W.getState();((v=x.sessions.get(e))==null?void 0:v.magicUiActive)===!0&&(x.setSessionMagicUi(e,!1),I_(e,!1))},[e]),c=k.useCallback(()=>{W.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{W.getState().setDensity("compact"),a()},[a]),f=k.useCallback(()=>{e&&(W.getState().setSessionMagicUi(e,!0),I_(e,!0))},[e]);if(!n||!e)return l.jsx(l9,{});const h=t==="compact",m=[{key:"standard",label:"Standard view",active:!i&&!h,onClick:c,icon:l.jsx(PN,{})},{key:"compact",label:"Compact view",active:!i&&h,onClick:u,icon:l.jsx(FN,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:f,icon:l.jsx(o9,{})}];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(x=>l.jsx("button",{onClick:x.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${x.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:x.label,"aria-label":x.label,"aria-pressed":x.active,children:x.icon},x.key))})}function l9(){const e=W(a=>a.density),t=k.useCallback(()=>W.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(FN,{}):l.jsx(PN,{})})}function PN(){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 FN(){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 o9(){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 c9(){var U;const e=k.useSyncExternalStore(D=>(window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)),()=>window.location.hash),t=k.useMemo(()=>Fx(e),[e]),n=t.page==="session"||t.page==="home",i=W(D=>D.currentSessionId),a=W(D=>D.cliConnected),c=W(D=>D.sessionStatus),u=W(D=>D.sessionNames),f=W(D=>D.sdkSessions),h=W(D=>D.sidebarOpen),m=W(D=>D.setSidebarOpen),x=W(D=>D.taskPanelOpen),v=W(D=>D.setTaskPanelOpen),b=W(D=>D.activeTab),y=W(D=>D.setActiveTab),w=W(D=>D.markChatTabReentry),j=W(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))||((U=f.find(D=>D.sessionId===i))==null?void 0:U.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&&w(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 Q=Math.max(0,O.indexOf(b)),A=X.shiftKey?-1:1,de=(Q+A+O.length)%O.length;R(O[de])};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[E,O,b,y,w,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(i9,{sessionId:i}),E&&i&&l.jsx(r9,{sessionId:i}),E&&l.jsx(a9,{sessionId:i??null}),l.jsx(u9,{}),L&&l.jsx("button",{onClick:()=>v(!x),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${x?"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 u9(){const e=W(n=>n.darkMode),t=k.useCallback(()=>W.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 UN="cc-recent-dirs";function xh(){try{return JSON.parse(localStorage.getItem(UN)||"[]")}catch{return[]}}function IN(e){const t=xh().filter(n=>n!==e);t.unshift(e),localStorage.setItem(UN,JSON.stringify(t.slice(0,5)))}function d9(){return!1}function HN({onClose:e,embedded:t=!1}){const[n,i]=k.useState([]),[a,c]=k.useState(!0),[u,f]=k.useState(null),[h,m]=k.useState(""),[x,v]=k.useState([]),[b,y]=k.useState(""),[w,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 U(q){f(q.slug),m(q.name);const H=Object.entries(q.variables).map(([I,re])=>({key:I,value:re}));H.length===0&&H.push({key:"",value:""}),v(H),y("")}function D(){f(null),y("")}async function X(){if(!u)return;const q={};for(const H of x){const I=H.key.trim();I&&(q[I]=H.value)}try{await ke.updateEnv(u,{name:h.trim()||void 0,variables:q}),f(null),y(""),R()}catch(H){y(H instanceof Error?H.message:String(H))}}async function P(q){try{await ke.deleteEnv(q),u===q&&f(null),R()}catch(H){y(H instanceof Error?H.message:String(H))}}async function Q(){const q=N.trim();if(!q)return;O(!0);const H={};for(const I of C){const re=I.key.trim();re&&(H[re]=I.value)}try{await ke.createEnv(q,H),S(""),E([{key:"",value:""}]),j(!1),y(""),R()}catch(I){y(I instanceof Error?I.message:String(I))}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(!w),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 ${w?"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:w?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:w?"Cancel":"New Environment"})]})]}),w&&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:q=>S(q.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:q=>{q.key==="Enter"&&N.trim()&&Q()}}),l.jsx(jf,{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:Q,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(q=>{const H=u===q.slug,I=Object.keys(q.variables).length;return H?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:re=>m(re.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(jf,{rows:x,onChange:v})]})}),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"})]})]},q.slug):l.jsx(f9,{env:q,varCount:I,onStartEdit:()=>U(q),onDelete:()=>void P(q.slug)},q.slug)})}),b&&!w&&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:q=>S(q.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:q=>{q.key==="Enter"&&N.trim()&&Q()}}),l.jsx(jf,{rows:C,onChange:E}),l.jsx("button",{onClick:Q,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]}),de=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(q=>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:q.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(q.variables).length," var",Object.keys(q.variables).length!==1?"s":""]}),u===q.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:()=>U(q),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(q.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===q.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:H=>m(H.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(jf,{rows:x,onChange:v})]})}),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!==q.slug&&Object.keys(q.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(q.variables).map(([H,I])=>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:H}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:I})]},H))})]},q.slug))}),K=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:q=>q.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}),de,A]})]});return Eo.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:K}),document.body)}function f9({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 jf({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 h9=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:HN},Symbol.toStringTag,{value:"Module"}));function p9(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 m9({initialPath:e,onSelect:t,onClose:n}){const[i,a]=k.useState(""),[c,u]=k.useState([]),[f,h]=k.useState(!0),[m,x]=k.useState(""),[v,b]=k.useState(""),[y,w]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState(-1),[E,L]=k.useState(!1),[O,R]=k.useState(()=>xh()),U=k.useRef(null),D=k.useRef(null),X=k.useRef(null),P=k.useRef(new Map),Q=k.useMemo(()=>{if(!j)return c;const I=j.toLowerCase();return c.filter(re=>re.name.toLowerCase().includes(I))},[c,j]),A=k.useCallback(async I=>{h(!0),x(""),N(""),C(-1);try{const re=await ke.listDirs(I);a(re.path),u(re.dirs)}catch{x("Could not load directory"),u([])}finally{h(!1)}},[]);k.useEffect(()=>{A(e||void 0)},[]),k.useEffect(()=>{const I=U.current;if(!I)return;function re(M){if(M.key!=="Tab")return;const Ee=I.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(Ee.length===0)return;const Ae=Ee[0],z=Ee[Ee.length-1];M.shiftKey&&document.activeElement===Ae?(M.preventDefault(),z.focus()):!M.shiftKey&&document.activeElement===z&&(M.preventDefault(),Ae.focus())}document.addEventListener("keydown",re);const ve=setTimeout(()=>{var M;(M=X.current)==null||M.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(ve)}},[]);const de=k.useCallback(()=>{E||(L(!0),setTimeout(n,150))},[n,E]);k.useEffect(()=>{function I(re){if(re.key==="Escape"){if(y)return;de()}}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[y,de]),k.useEffect(()=>{function I(re){var M,Ee;if(y)return;if(re.key==="Backspace"&&document.activeElement!==X.current){if(i&&i!=="/"){re.preventDefault();const Ae=i.split("/").slice(0,-1).join("/")||"/";A(Ae)}return}const ve=Q.length;if(ve!==0){if(re.key==="ArrowDown"){re.preventDefault();const Ae=S<ve-1?S+1:0;C(Ae),(M=P.current.get(Ae))==null||M.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Ae=S>0?S-1:ve-1;C(Ae),(Ee=P.current.get(Ae))==null||Ee.focus()}}}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[y,Q.length,S,i,A]),k.useEffect(()=>{var I;S>=0&&((I=P.current.get(S))==null||I.scrollIntoView({block:"nearest"}))},[S]);function K(I){IN(I),R(xh()),t(I),n()}const q=p9(i),H=i.split("/").pop()||"/";return Eo.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:de,children:l.jsxs("div",{ref:U,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${E?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:I=>I.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:de,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(I=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>K(I),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:I.split("/").pop()||I}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:I})]})},I))})]}),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:v,onChange:I=>b(I.target.value),onKeyDown:I=>{I.key==="Enter"&&v.trim()&&K(v.trim()),I.key==="Escape"&&(I.stopPropagation(),w(!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:q.map((I,re)=>{const ve=re===q.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[re>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{ve||A(I.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ve?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ve?"location":void 0,tabIndex:ve?-1:0,children:I.label})]},I.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{w(!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:I=>{N(I.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:()=>K(i),"aria-label":`Select ${H}`,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:H})]})]}),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((I,re)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+re*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${re*.1}s infinite`}})]},re))}):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"})]}):Q.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:Q.map((I,re)=>l.jsxs("li",{className:`flex items-center transition-colors ${S===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ve=>{ve?P.current.set(re,ve):P.current.delete(re)},onClick:()=>A(I.path),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),K(I.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:I.path,"aria-label":`Navigate into ${I.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:I.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:()=>K(I.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 ${I.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"})})})]},I.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 g9(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function x9(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():g9(e.identifier,e.title)}function pu({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 v9({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,c]=k.useState(""),[u,f]=k.useState(""),[h,m]=k.useState(""),[x,v]=k.useState(0),[b,y]=k.useState(!0),[w,j]=k.useState([]),[N,S]=k.useState(""),[C,E]=k.useState(""),[L,O]=k.useState(!0),[R,U]=k.useState(!1),[D,X]=k.useState("");k.useEffect(()=>{let Q=!0;return Promise.all([ke.getLinearStates(t),ke.getLinearConnection(t)]).then(([A,de])=>{var q;if(!Q)return;j(A.teams),S(de.viewerId);const K=((q=A.teams[0])==null?void 0:q.id)||"";m(K)}).catch(A=>{Q&&X(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{Q&&O(!1)}),()=>{Q=!1}},[t]),k.useEffect(()=>{if(!h||w.length===0){E("");return}const Q=w.find(de=>de.id===h),A=Q==null?void 0:Q.states.find(de=>de.type==="backlog");E((A==null?void 0:A.id)||"")},[h,w]);async function P(){if(!(!a.trim()||!h)){U(!0),X("");try{const Q=await ke.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:x,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:C||void 0,connectionId:t});n(Q.issue)}catch(Q){X(Q instanceof Error?Q.message:"Failed to create issue")}finally{U(!1)}}}return Eo.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:Q=>Q.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick: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:Q=>c(Q.target.value),onKeyDown:Q=>{Q.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:Q=>f(Q.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:Q=>m(Q.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:w.map(Q=>l.jsxs("option",{value:Q.id,children:[Q.name," (",Q.key,")"]},Q.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:x,onChange:Q=>v(Number(Q.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:Q=>y(Q.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick: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 b9({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=k.useState([]),[m,x]=k.useState(null),[v,b]=k.useState(!1),[y,w]=k.useState(""),[j,N]=k.useState([]),[S,C]=k.useState(!1),[E,L]=k.useState(!1),[O,R]=k.useState(""),[U,D]=k.useState(!1),[X,P]=k.useState(null),[Q,A]=k.useState([]),[de,K]=k.useState(!1),[q,H]=k.useState(""),[I,re]=k.useState(!1),[ve,M]=k.useState([]),[Ee,Ae]=k.useState(!1),[z,B]=k.useState(""),[oe,_e]=k.useState(!1),[Ne,Me]=k.useState([]),[Le,De]=k.useState(!1),[Ce,Re]=k.useState(!1),Ft=k.useRef(null);k.useEffect(()=>{function se(je){Ft.current&&!Ft.current.contains(je.target)&&(C(!1),re(!1))}return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[]),k.useEffect(()=>{if(!n){h([]),x(null),b(!1),u(null);return}let se=!0;return ke.listLinearConnections().then(({connections:je})=>{se&&(h(je),b(!0),je.length>0?(x(je[0].id),u(je[0].id)):(x(null),u(null)))}).catch(()=>{se&&b(!0)}),()=>{se=!1}},[n]);const Kt=k.useCallback(se=>{x(se),u(se),a(null),N([]),w(""),R(""),Me([]),B(""),M([]),X&&(K(!0),H(""),ke.getLinearProjectIssues(X.projectId,10,se).then(({issues:je})=>{A(je)}).catch(je=>{H(je instanceof Error?je.message:String(je))}).finally(()=>{K(!1)}))},[X,u,a]);k.useEffect(()=>{if(!t||!n){P(null),A([]);return}let se=!0;return K(!0),H(""),(async()=>{try{const{mapping:je}=await ke.getLinearProjectMapping(t.repoRoot);if(!se)return;if(P(je),je){const{issues:Qe}=await ke.getLinearProjectIssues(je.projectId,10,m??void 0);if(!se)return;A(Qe)}else A([])}catch(je){if(!se)return;H(je instanceof Error?je.message:String(je))}finally{se&&K(!1)}})(),()=>{se=!1}},[t,n,m]),k.useEffect(()=>{if(!n)return;const se=y.trim();if(se.length<2){N([]),R(""),L(!1);return}let je=!0;L(!0),R("");const Qe=setTimeout(()=>{ke.searchLinearIssues(se,8,m??void 0).then(et=>{je&&N(et.issues)}).catch(et=>{je&&(N([]),R(et instanceof Error?et.message:String(et)))}).finally(()=>{je&&L(!1)})},400);return()=>{je=!1,clearTimeout(Qe)}},[n,y,m]),k.useEffect(()=>{if(!n||!oe){Me([]),De(!1);return}const se=z.trim();if(se.length<2){Me([]),De(!1);return}let je=!0;De(!0);const Qe=setTimeout(()=>{ke.searchLinearIssues(se,10,m??void 0).then(et=>{je&&Me(et.issues)}).catch(()=>{je&&Me([])}).finally(()=>{je&&De(!1)})},400);return()=>{je=!1,clearTimeout(Qe)}},[n,oe,z,m]);function Ut(se,je=!1){a(se),w(`${se.identifier} - ${se.title}`);const Qe=x9(se);c(Qe,!0),je&&C(!1)}function Nt(){a(null),w(""),N([]),R("")}async function wt(se){if(t)try{const{mapping:je}=await ke.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:se.id,projectName:se.name});P(je),re(!1),K(!0),H("");const{issues:Qe}=await ke.getLinearProjectIssues(se.id,10,m??void 0);A(Qe)}catch(je){H(je instanceof Error?je.message:String(je))}finally{K(!1)}}async function Xe(){if(t){try{await ke.removeLinearProjectMapping(t.repoRoot)}catch{}P(null),A([]),a(null),w("")}}function St(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),ve.length===0&&(Ae(!0),ke.listLinearProjects(m??void 0).then(({projects:se})=>M(se)).catch(()=>{}).finally(()=>Ae(!1)))}function nn(se){Re(!1),Ut(se),X&&(K(!0),ke.getLinearProjectIssues(X.projectId,10,m??void 0).then(({issues:je})=>A(je)).catch(()=>{}).finally(()=>K(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Ft,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"}),v&&f.length>1&&l.jsx("select",{value:m??"",onChange:se=>Kt(se.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(se=>l.jsx("option",{value:se.id,children:se.workspaceName||se.name},se.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(pu,{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(pu,{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 se=z.trim().toLowerCase(),je=!oe&&se?Q.filter(et=>et.identifier.toLowerCase().includes(se)||et.title.toLowerCase().includes(se)):oe?[]:Q,Qe=oe?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:Nt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:z,onChange:et=>B(et.target.value),placeholder:oe?"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"}),de?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):q?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:q}):Le?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):oe&&se.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..."}):Qe.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:se?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:Qe.map(et=>l.jsxs("button",{type:"button",onClick:()=>Ut(et),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===et.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:et.identifier})," ",et.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[et.stateName,et.priorityLabel].filter(Boolean).join(" - ")})]},et.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:oe,onChange:et=>{_e(et.target.checked),et.target.checked||Me([])},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"})]})]})})(),I&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>re(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),Ee?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ve.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:ve.map(se=>l.jsx("button",{type:"button",onClick:()=>wt(se),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:se.name})},se.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:se=>{w(se.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(se=>l.jsxs("button",{type:"button",onClick:()=>Ut(se,!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:se.identifier})," - ",se.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[se.stateName,se.teamName].filter(Boolean).join(" • ")})]},se.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),U&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{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"})})]}),Ce&&l.jsx(v9,{defaultProjectId:X==null?void 0:X.projectId,connectionId:m??void 0,onCreated:nn,onClose:()=>Re(!1)})]}):null}function y9({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,m]=k.useState([]),[x,v]=k.useState(!1),[b,y]=k.useState(""),w=k.useRef(null);return k.useEffect(()=>{function j(N){w.current&&!w.current.contains(N.target)&&v(!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:w,children:[l.jsxs("button",{"aria-expanded":x,onClick:()=>{!x&&t&&ke.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{ke.listBranches(t.repoRoot).then(j=>{m(j),f(j)}).catch(()=>{m([]),f([])})}),v(!x),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"})})]}),x&&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"&&v(!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),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${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),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${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),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[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 _9=336*60*60*1e3,Xa=12,w9=24;function fx(e){return e.split("/").filter(Boolean).pop()||e}function C2(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||fx(e.cwd)}function S9(e){return e.length>8?e.slice(0,8):e}function k9(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function j9(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`}const Nf="cc-draft-prompt";function N9(){var qi;const[e,t]=k.useState(()=>localStorage.getItem(Nf)||"");k.useEffect(()=>{e?localStorage.setItem(Nf,e):localStorage.removeItem(Nf)},[e]);const[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,x]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,b]=k.useState([]),[y,w]=k.useState(()=>y2(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>_2(localStorage.getItem("cc-backend")||"claude")),[S,C]=k.useState(()=>localStorage.getItem("cc-effort")||""),[E,L]=k.useState(()=>xh()[0]||""),[O,R]=k.useState([]),[U,D]=k.useState(null),[X,P]=k.useState(!1),[Q,A]=k.useState(""),[de,K]=k.useState(null),[q,H]=k.useState(!1),[I,re]=k.useState(null),[ve,M]=k.useState(null),[Ee,Ae]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),z=de||DN(m),B=b2(m),oe=M$(m),[_e,Ne]=k.useState([]),[Me,Le]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[De,Ce]=k.useState(!1),[Re,Ft]=k.useState(!1),Kt=d9(),[Ut,Nt]=k.useState(()=>Kt),[wt,Xe]=k.useState([]),[St,nn]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[se,je]=k.useState(!1),Qe=k.useRef(null),[et,un]=k.useState(null),ce=k.useRef(null),be=k.useRef(null),[G,me]=k.useState(!1),[Pe,We]=k.useState(!1),[at,ft]=k.useState(!1),[hn,is]=k.useState(!1),[Ct,vs]=k.useState(!1),[Fn,sn]=k.useState(""),[xr,Bi]=k.useState(!0),[le,xe]=k.useState([]),[we,rt]=k.useState(!1),[It,wn]=k.useState(""),[Nn,xt]=k.useState(!1),[rn,en]=k.useState(Xa),[Ao,$u]=k.useState(""),[bs,vr]=k.useState(null),[ma,ga]=k.useState(!1),[Xs,Ks]=k.useState(""),[br,Pi]=k.useState(!1),[Ah,Bu]=k.useState([]),[Fi,hi]=k.useState(null),[ol,xa]=k.useState(!1),[Ro,pi]=k.useState(""),[Oo,va]=k.useState(0),ba=k.useRef(null),rs=k.useRef(null),ys=k.useRef(null),dn=k.useRef(null),Cn=k.useRef(null),mi=k.useRef(null),Lo=W(Y=>Y.currentSessionId),an=$N({text:e,caretPos:Oo,cwd:E||void 0});k.useEffect(()=>{if(ba.current===null||!rs.current)return;const Y=ba.current;rs.current.setSelectionRange(Y,Y),ba.current=null},[e]),k.useEffect(()=>{var ge;window.matchMedia("(min-width: 640px)").matches&&((ge=rs.current)==null||ge.focus())},[]),k.useEffect(()=>{ke.getHome().then(({home:Y,cwd:ge})=>{E||L(ge||Y)}).catch(()=>{}),ke.listEnvs().then(Ne).catch(()=>{}),ke.listSandboxes().then(Xe).catch(()=>{}),ke.getBackends().then(b).catch(()=>{}),ke.getSettings().then(Y=>{H(Y.linearApiKeyConfigured)}).catch(()=>{})},[]);function Rh(Y){x(Y),localStorage.setItem("cc-backend",Y),K(null),w(y2(Y)),N(_2(Y)),Y!=="claude"&&(vs(!1),xe([]),wn(""),rt(!1),xt(!1),en(Xa),$u(""))}k.useEffect(()=>{if(m!=="codex"){K(null);return}ke.getBackendModels(m).then(Y=>{if(Y.length>0){const ge=E$(Y);K(ge),ge.some(it=>it.value===y)||w(ge[0].value)}}).catch(()=>{})},[m]),k.useEffect(()=>{if(ce.current&&(clearInterval(ce.current),ce.current=null),un(null),!Ut)return;const Y="the-companion:latest",ge=()=>{ke.getImageStatus(Y).then(it=>{un(it),it.status==="idle"&&ke.pullImage(Y).catch(()=>{}),(it.status==="ready"||it.status==="error")&&ce.current&&(clearInterval(ce.current),ce.current=null)}).catch(()=>{})};return ge(),ce.current=setInterval(ge,2e3),()=>{ce.current&&(clearInterval(ce.current),ce.current=null)}},[Ut]),k.useEffect(()=>{function Y(ge){ys.current&&!ys.current.contains(ge.target)&&me(!1),dn.current&&!dn.current.contains(ge.target)&&We(!1),Cn.current&&!Cn.current.contains(ge.target)&&ft(!1),mi.current&&!mi.current.contains(ge.target)&&Ce(!1),Qe.current&&!Qe.current.contains(ge.target)&&je(!1)}return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[]),k.useEffect(()=>{if(!E){vr(null);return}ke.getRepoInfo(E).then(Y=>{vr(Y),Ks(Y.currentBranch),Pi(!1)}).catch(()=>{vr(null),Ks(""),Pi(!1)})},[E]);const Do=z.find(Y=>Y.value===y)||z[0],ya=B.find(Y=>Y.value===j)||B[0],cl=oe.find(Y=>Y.value===S)||oe[0],ul=m==="codex"?"/logo-codex.svg":"/logo.svg",Ui=E?E.split("/").pop()||E:"Select folder",gi=k.useMemo(()=>Fn.trim(),[Fn]),yr=m==="claude"&&Ct&&gi.length>0,as=k.useMemo(()=>{const Y=Date.now()-_9;return le.filter(ge=>ge.createdAt>=Y)},[le]),ln=k.useMemo(()=>Nn?le:as.length>0?as:le,[Nn,as,le]),_s=k.useMemo(()=>Ao.trim().toLowerCase(),[Ao]),Ws=k.useMemo(()=>_s?ln.filter(Y=>{const ge=C2(Y).toLowerCase(),it=fx(Y.cwd).toLowerCase(),mt=(Y.gitBranch||"").toLowerCase(),gt=Y.cwd.toLowerCase(),Ge=Y.resumeSessionId.toLowerCase();return ge.includes(_s)||it.includes(_s)||mt.includes(_s)||gt.includes(_s)||Ge.includes(_s)}):ln,[ln,_s]),dl=k.useMemo(()=>Ws.slice(0,rn),[Ws,rn]),Ii=rn<Ws.length,Hi=Math.max(0,le.length-as.length),Oh=!Nn&&as.length>0,fl=k.useCallback(async()=>{if(m==="claude"){rt(!0),wn("");try{const[Y,ge]=await Promise.all([ke.listSessions(),ke.discoverClaudeSessions(400).then(Ge=>Ge.sessions)]),it=new Map,mt=Ge=>{const Rn=it.get(Ge.resumeSessionId);(!Rn||Ge.createdAt>Rn.createdAt)&&it.set(Ge.resumeSessionId,Ge)};for(const Ge of Y)Ge.backendType!=="codex"&&Ge.cliSessionId&&mt({resumeSessionId:Ge.cliSessionId,sessionId:Ge.sessionId,name:Ge.name,model:Ge.model,createdAt:Ge.createdAt,cwd:Ge.cwd,gitBranch:Ge.gitBranch,source:"companion"});for(const Ge of ge)mt({resumeSessionId:Ge.sessionId,sessionId:Ge.sessionId,slug:Ge.slug,createdAt:Ge.lastActivityAt,cwd:Ge.cwd,gitBranch:Ge.gitBranch,source:"claude_disk"});const gt=Array.from(it.values()).sort((Ge,Rn)=>{const Qn=E&&Ge.cwd===E?0:1,Sr=E&&Rn.cwd===E?0:1;return Qn!==Sr?Qn-Sr:Rn.createdAt-Ge.createdAt});xe(gt),xt(!1),en(Xa)}catch(Y){const ge=Y instanceof Error?Y.message:String(Y);wn(ge||"Failed to load existing sessions"),xe([]),en(Xa)}finally{rt(!1)}}},[m,E]);k.useEffect(()=>{m==="claude"&&Ct&&fl()},[m,Ct,fl]),k.useEffect(()=>{en(Xa)},[_s,Nn]);async function zo(Y){if(Y.length===0)return;const ge=[],it=[];let mt=O.reduce((gt,Ge)=>gt+Ge.size,0);for(const gt of Y){if(gt.size>mh){it.push(`${gt.name} is too large (${oa(gt.size)}, max ${oa(mh)})`);continue}if(mt+gt.size>gh){it.push(`${gt.name} would exceed the per-message limit (${oa(gh)})`);continue}const{base64:Ge,mediaType:Rn}=await _N(gt);ge.push({name:gt.name,base64:Ge,mediaType:Rn,size:gt.size}),mt+=gt.size}ge.length>0&&R(gt=>[...gt,...ge]),D(it.length>0?it.join("; "):null)}async function Lh(Y){const ge=Y.target.files;ge&&(await zo(Array.from(ge)),Y.target.value="")}function vt(Y){R(ge=>ge.filter((it,mt)=>mt!==Y))}async function Pu(Y){var mt;const ge=(mt=Y.clipboardData)==null?void 0:mt.items;if(!ge)return;const it=[];for(const gt of Array.from(ge)){if(gt.kind!=="file")continue;const Ge=gt.getAsFile();if(!Ge)continue;const Rn=Ge.name&&Ge.name.length>0?Ge.name:`pasted-${Date.now()}.${(Ge.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;it.push(new File([Ge],Rn,{type:Ge.type,lastModified:Ge.lastModified}))}it.length>0&&(Y.preventDefault(),await zo(it))}function hl(Y){t(Y.target.value),va(Y.target.selectionStart??Y.target.value.length);const ge=Y.target;ge.style.height="auto",ge.style.height=Math.min(ge.scrollHeight,200)+"px"}function _a(){rs.current&&va(rs.current.selectionStart??0)}function Ds(Y){var it;const ge=an.selectPrompt(Y);ba.current=ge.nextCursor,t(ge.nextText),an.setMentionMenuOpen(!1),va(ge.nextCursor),(it=rs.current)==null||it.focus(),rs.current&&(rs.current.style.height="auto",rs.current.style.height=Math.min(rs.current.scrollHeight,200)+"px")}function Yn(Y){if(an.mentionMenuOpen&&Y.key==="Escape"){Y.preventDefault(),an.setMentionMenuOpen(!1);return}if(an.mentionMenuOpen&&an.filteredPrompts.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),an.setMentionMenuIndex(ge=>(ge+1)%an.filteredPrompts.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),an.setMentionMenuIndex(ge=>(ge-1+an.filteredPrompts.length)%an.filteredPrompts.length);return}if(Y.key==="Tab"&&!Y.shiftKey||Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault(),Ds(an.filteredPrompts[an.mentionMenuIndex]);return}}if(an.mentionMenuOpen&&an.filteredPrompts.length===0&&(Y.key==="Enter"&&!Y.shiftKey||Y.key==="Tab"&&!Y.shiftKey)){Y.preventDefault();return}if(Y.key==="Tab"&&Y.shiftKey){Y.preventDefault();const ge=b2(m),mt=(ge.findIndex(gt=>gt.value===j)+1)%ge.length;N(ge[mt].value);return}Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),Uu())}function Fu(Y){const ge=i.trim(),it=ge?`[${ge}]: ${Y}`:Y;if(!I)return it;const mt=(I.description??"").trim();return`${["Linear issue context:",`- Identifier: ${I.identifier}`,`- Title: ${I.title}`,I.stateName?`- State: ${I.stateName}`:"",I.priorityLabel?`- Priority: ${I.priorityLabel}`:"",I.teamName?`- Team: ${I.teamName}`:"",`- URL: ${I.url}`,mt?`- Description:
|
|
113
|
-
${mt}`:""].filter(Boolean).join(`
|
|
114
|
-
`)}
|
|
115
|
-
|
|
116
|
-
User request:
|
|
117
|
-
${it}`}async function Uu(){const Y=e.trim();if(!(!Y||X)){if(n&&!i.trim()){A("Please enter your name before starting a session.");return}if(P(!0),A(""),pi(""),bs){const ge=Xs||bs.currentBranch;if(ge&&ge===bs.currentBranch){const it=Ah.find(mt=>mt.name===ge&&!mt.isRemote);if(it&&it.behind>0){hi({behind:it.behind,branchName:ge});return}}}await _r(Y)}}async function _r(Y,ge){const it=W.getState();it.clearCreation(),it.setSessionCreating(!0,m);try{Lo&&y0(Lo);const mt=(ge==null?void 0:ge.resumeSessionAt)||(yr?gi:void 0),gt=mt?(ge==null?void 0:ge.forkSession)??(yr?xr:void 0):void 0,Ge=(ge==null?void 0:ge.cwd)||E,Rn=(ge==null?void 0:ge.branch)!==void 0?ge.branch.trim()||void 0:Xs.trim()||void 0,Qn=(ge==null?void 0:ge.useWorktree)!==void 0?ge.useWorktree:ma,Sr=(ge==null?void 0:ge.createBranch)!==void 0?ge.createBranch:!!(Rn&&br),pl=Y.trim(),ws=pl.length>0?Fu(pl):null,Zs=ws?x0():null,Io=O.length>0?O.map(ks=>({name:ks.name,media_type:ks.mediaType,data:ks.base64,size:ks.size})):void 0,kr=await YA({initialMessage:ws&&Zs?{content:ws,attachments:Io,clientMsgId:Zs}:void 0,model:y,permissionMode:j,effort:m==="claude"&&S?S:void 0,cwd:Ge||void 0,envSlug:Me||void 0,sandboxEnabled:Ut?!0:void 0,sandboxSlug:Ut&&St?St:void 0,branch:Rn,createBranch:Sr?!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:I&&ve||void 0,linearIssue:I?{identifier:I.identifier,title:I.title,stateName:I.stateName,teamName:I.teamName,url:I.url}:void 0},ks=>{W.getState().addCreationProgress(ks)}),Ss=kr.sessionId,jr=W.getState(),Js=jr.sdkSessions.filter(ks=>ks.sessionId!==Ss);jr.setSdkSessions([...Js,{sessionId:Ss,state:kr.state,cwd:kr.cwd,createdAt:Date.now(),backendType:kr.backendType||m,model:y,permissionMode:j,userName:i.trim()||void 0,resumeSessionAt:mt,forkSession:mt?gt===!0:void 0}]);const Ho=new Set(W.getState().sessionNames.values()),wa=$2(Ho),ei=c.trim()||i.trim(),Sa=f.trim()||wa,qo=ei?`${ei}_${Sa}`:Sa;W.getState().setSessionName(Ss,qo),ke.renameSession(Ss,qo).catch(()=>{}),h(""),Ge&&IN(Ge),W.getState().setPreviousPermissionMode(Ss,j),ws&&(localStorage.removeItem(Nf),t("")),Ux(Ss,!0),Co(Ss),ws&&Zs&&W.getState().appendMessage(Ss,{id:Zs,role:"user",content:ws,attachments:Io,timestamp:Date.now()}),I&&(ke.linkLinearIssue(Ss,I,ve||void 0).then(()=>W.getState().setLinkedLinearIssue(Ss,I)).catch(()=>{}),ke.transitionLinearIssue(I.id,ve||void 0).catch(()=>{})),W.getState().clearCreation()}catch(mt){const gt=mt instanceof Error?mt.message:String(mt);A(gt);const Ge=Y.trim();W.getState().setCreationError(gt,Ge?{text:Ge}:null),P(!1)}}async function $o(Y,ge){X||(P(!0),A(""),pi(""),L(Y.cwd),ga(!1),Pi(!1),Ks(Y.gitBranch||""),sn(Y.resumeSessionId),Bi(ge),await _r("",{resumeSessionAt:Y.resumeSessionId,forkSession:ge,cwd:Y.cwd,branch:Y.gitBranch,useWorktree:!1,createBranch:!1}))}async function Dh(){if(Fi){xa(!0),pi("");try{const Y=E||(bs==null?void 0:bs.repoRoot);if(!Y)throw new Error("No working directory");const ge=await ke.gitPull(Y);if(!ge.success){pi(ge.output||"Pull failed"),xa(!1),P(!1);return}hi(null),xa(!1),await _r(e.trim())}catch(Y){pi(Y instanceof Error?Y.message:String(Y)),xa(!1)}}}function ls(){const Y=e.trim();hi(null),pi(""),_r(Y)}function Bo(){hi(null),pi(""),P(!1)}const Iu=k.useCallback((Y,ge)=>{Ks(Y),Pi(ge)},[]),Po=k.useCallback((Y,ge)=>{Ks(Y),Pi(ge)},[]),wr=k.useCallback(Y=>{Bu(Y)},[]),Fo=k.useCallback(Y=>{re(Y),!Y&&bs&&(Ks(bs.currentBranch),Pi(!1))},[bs]),Uo=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:Y=>{const ge=Y.target.value;a(ge),localStorage.setItem("cc-user-name",ge)},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:Y=>{const ge=Y.target.value;u(ge),localStorage.setItem("cc-session-prefix",ge)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:f,onChange:Y=>h(Y.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:Lh,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(zN,{open:an.mentionMenuOpen,loading:an.promptsLoading,prompts:an.filteredPrompts,selectedIndex:an.mentionMenuIndex,onSelect:Ds,menuRef:an.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(I||O.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[I&&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:I.identifier}),l.jsx("span",{className:"truncate",children:I.title}),l.jsx("button",{type:"button",onClick:()=>Fo(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((Y,ge)=>l.jsx(kN,{name:Y.name,mediaType:Y.mediaType,base64:Y.base64,size:Y.size,onRemove:()=>vt(ge),className:"w-10 h-10"},ge))]}),U&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:U}),l.jsx("textarea",{ref:rs,value:e,onChange:hl,onKeyDown:Yn,onClick:_a,onKeyUp:_a,onPaste:Pu,"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:ys,children:[l.jsxs("button",{onClick:()=>me(!G),"aria-expanded":G,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:Do.icon}),l.jsx("span",{children:Do.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"})})]}),G&&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(Y=>l.jsxs("button",{onClick:()=>{w(Y.value),me(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${Y.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:Y.icon}),Y.label]},Y.value))})]}),oe.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:oe.map(Y=>l.jsx("button",{onClick:()=>{C(Y.value),localStorage.setItem("cc-effort",Y.value),ft(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Y.value===S?"text-cc-primary font-medium":"text-cc-fg"}`,children:Y.label},Y.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"})}),ya.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(Y=>l.jsx("button",{onClick:()=>{N(Y.value),We(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Y.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:Y.label},Y.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:()=>is(!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(m9,{initialPath:E||"",onSelect:Y=>{L(Y)},onClose:()=>is(!1)})]}),l.jsx(y9,{cwd:E,gitRepoInfo:bs,selectedBranch:Xs,isNewBranch:br,useWorktree:ma,onBranchChange:Iu,onWorktreeChange:ga,onBranchesLoaded:wr}),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:mi,children:[l.jsxs("button",{onClick:()=>{De||ke.listEnvs().then(Ne).catch(()=>{}),Ce(!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:Me?((qi=_e.find(Y=>Y.slug===Me))==null?void 0:qi.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",""),Ce(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Me?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),_e.map(Y=>l.jsxs("button",{onClick:()=>{Le(Y.slug),localStorage.setItem("cc-selected-env",Y.slug),Ce(!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 ${Y.slug===Me?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:Y.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]})]},Y.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{Ft(!0),Ce(!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..."})})]})]}),Kt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var Y;return(Y=be.current)==null?void 0:Y.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:Uu,disabled:!Uo,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Uo?"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:[v.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:v.map(Y=>l.jsxs("button",{onClick:()=>Y.available&&Rh(Y.id),disabled:!Y.available,title:Y.available?Y.name:`${Y.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${Y.available?m===Y.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:[Y.name,!Y.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"})]})]},Y.id))})}),m==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>vs(Y=>!Y),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"}),le.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",dl.length," of ",Ws.length," ",_s?"matching":Oh?"recent":"detected"," Claude session",Ws.length!==1?"s":"","."]}),!Nn&&Hi>0&&as.length>0&&l.jsxs("button",{type:"button",onClick:()=>{xt(!0),en(Xa)},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 (",Hi,")"]}),Nn&&as.length>0&&l.jsx("button",{type:"button",onClick:()=>{xt(!1),en(Xa)},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:Ao,onChange:Y=>$u(Y.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&&Ws.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:_s?"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(Y=>{const ge=C2(Y),it=fx(Y.cwd),mt=Y.source==="companion"?"Companion":"Claude",gt=gi===Y.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:ge}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:S9(Y.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:Y.cwd,children:[l.jsx("div",{className:"truncate",children:it}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:Y.cwd,children:k9(Y.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:Y.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:j9(Y.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{sn(Y.resumeSessionId),Bi(!0),$o(Y,!0)},"aria-label":`Fork and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&xr?"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
|
-
${Y.cwd}${Y.gitBranch?` (${Y.gitBranch})`:""}
|
|
119
|
-
${Y.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{sn(Y.resumeSessionId),Bi(!1),$o(Y,!1)},"aria-label":`Continue and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&!xr?"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
|
-
${Y.resumeSessionId}`,children:"Continue"})]})]},`${Y.resumeSessionId}-row-${Y.sessionId}`)})}),Ii&&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(Y=>Math.min(Y+w9,Ws.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 (",Ws.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."})]})})})]}),Ee&&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:()=>{Ae(!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(b9,{cwd:E,gitRepoInfo:bs,linearConfigured:q,selectedLinearIssue:I,onIssueSelect:Fo,onBranchFromIssue:Po,onConnectionSelect:M})]}),Fi&&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:Fi.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Fi.behind," commit",Fi.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Ro&&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:Ro}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Bo,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:ls,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:Dh,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"})]})]})]})}),Q&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:Q})]})]}),Re&&l.jsx(HN,{onClose:()=>{Ft(!1),ke.listEnvs().then(Ne).catch(()=>{})}})]})}const C9=[],E9=[],T9={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"}},M9={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function A9({server:e,sessionId:t}){var f,h;const[n,i]=k.useState(!1),a=T9[e.status]||M9,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:()=>fT(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:()=>hT(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(([,x])=>x).map(([x])=>x).join(", ")||void 0,children:m.name},m.name))})]})]})]})}function R9({sessionId:e,onDone:t}){const[n,i]=k.useState(""),[a,c]=k.useState("stdio"),[u,f]=k.useState(""),[h,m]=k.useState(""),[x,v]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():x.trim());function y(w){if(w.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=x.trim(),pT(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:w=>i(w.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(w=>l.jsx("button",{type:"button",onClick:()=>c(w),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===w?"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:w},w))})]}),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:w=>f(w.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:w=>m(w.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:x,onChange:w=>v(w.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 O9({sessionId:e}){const t=W(f=>f.mcpServers.get(e)||C9),n=W(f=>f.cliConnected.get(e)??!1),[i,a]=k.useState(!1),c=W(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??E9});k.useEffect(()=>{n&&U_(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:()=>U_(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(R9,{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(A9,{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 L9({cwd:e,open:t,onClose:n}){var Q;const[i,a]=k.useState([]),[c,u]=k.useState(!0),[f,h]=k.useState(0),[m,x]=k.useState(""),[v,b]=k.useState(!1),[y,w]=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),x(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=>{v&&!confirm("Discard unsaved changes?")||(h(A),x(i[A].content),b(!1),C(null))},O=async()=>{var de;const A=S||((de=i[f])==null?void 0:de.path);if(A){w(!0),N(null);try{await ke.saveClaudeMd(A,m),b(!1),S?E():a(K=>K.map((q,H)=>H===f?{...q,content:m}:q))}catch(K){N(K instanceof Error?K.message:"Failed to save")}finally{w(!1)}}},R=A=>{const de=A==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(de),x(`# CLAUDE.md
|
|
121
|
-
|
|
122
|
-
`),b(!0)},U=()=>{v&&!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:U}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),l.jsx("button",{onClick:U,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 flex min-h-0",children: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,de)=>l.jsxs("button",{onClick:()=>L(de),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!S&&f===de?"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||(((Q=i[f])==null?void 0:Q.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[v&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:O,disabled:!v||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!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=>{x(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 E2({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 rr({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 z9({path:e,label:t,onClose:n}){const[i,a]=k.useState(""),[c,u]=k.useState(!0),[f,h]=k.useState(!1),[m,x]=k.useState(!1),[v,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()=>{x(!0),b(null);try{await ke.writeFile(e,i),h(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{x(!1)}},w=()=>{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:w}),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:w,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..."})]}),v&&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:v})]})]})}function $9({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(L9,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(z9,{path:e.path,label:e.label,onClose:n})}function B9({sessionId:e}){const t=W(S=>S.sessions.get(e)),n=W(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),[x,v]=k.useState(!1),[b,y]=k.useState(null),w=k.useCallback(async()=>{if(i)try{const S=await ke.getClaudeConfig(i);c(S)}catch{}finally{f(!1)}},[i]);if(k.useEffect(()=>{w()},[w]),!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(E2,{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(rr,{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(rr,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(rr,{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(rr,{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(E2,{icon:"user",title:`User (${N})`,expanded:x,onToggle:()=>v(S=>!S)}),x&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(rr,{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(rr,{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(rr,{label:S.name,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.settings&&l.jsx(rr,{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(rr,{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&&Eo.createPortal(l.jsx($9,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function P9(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 F9 extends k.Component{constructor(){super(...arguments);l_(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){da(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 qN=[],fv=3e4,U9=6e4,I9=5*6e4;let T2=null,M2=new Map;function H9(e){return e!==T2&&(T2=e,M2=new Map(e.map(t=>[t.sessionId,t]))),M2}function zu(e){return W(k.useCallback(t=>H9(t.sdkSessions).get(e),[e]))}const VN="cc-panel-collapsed";function A2(){try{const e=localStorage.getItem(VN);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function q9(e){try{localStorage.setItem(VN,JSON.stringify([...e]))}catch{}}function GN({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[c,u]=k.useState(()=>A2().has(e)?!0:!i),f=k.useRef(!0);k.useEffect(()=>{if(f.current){f.current=!1;return}const m=A2();c?m.add(e):m.delete(e),q9(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 V9(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(GN,{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 YN(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function QN(e){return e>80?"critical":e>50?"elevated":"normal"}function mr({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 — ${QN(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 ${YN(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function G9({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(x=>x?{...x}:null)},fv);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(mr,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?h2(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(mr,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?h2(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 — ${QN(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 ${YN(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function Cf(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function Y9(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,U9);return()=>{i=!0,clearInterval(c)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(mr,{label:"Memory",pct:t.used_percent,detail:`${Cf(t.used_bytes)} / ${Cf(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(mr,{label:"Swap",pct:t.swap_used_percent,detail:`${Cf(t.swap_used_bytes)} / ${Cf(t.swap_total_bytes)}`})]}):null}function Q9(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 X9(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,I9);return()=>{i=!0,clearInterval(c)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(mr,{label:"Disk",pct:t.used_percent,detail:`${Q9(t.available_bytes)} free`})}):null}function K9({sessionId:e}){const t=W(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),fv);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(mr,{label:`${p2(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?ux(i.resetsAt):void 0}),a&&l.jsx(mr,{label:`${p2(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?ux(a.resetsAt):void 0})]})}function W9({sessionId:e}){const t=W(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=W(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:Wc(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:Wc(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:Wc(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:Wc(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(mr,{label:"Context",pct:n})]}):null}function Z9(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 J9({pr:e}){const t=Z9(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 eB({sessionId:e}){const t=W(u=>u.sessions.get(e)),n=zu(e),i=W(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=>{W.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,c,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(J9,{pr:i.pr})}const tB=6e4;function u0(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 nB({sessionId:e}){const t=W(A=>A.linkedLinearIssues.get(e)),[n,i]=k.useState([]),[a,c]=k.useState(null),[u,f]=k.useState([]),[h,m]=k.useState(""),[x,v]=k.useState(!1),[b,y]=k.useState(!1),[w,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&&W.getState().setLinkedLinearIssue(e,A.issue)}).catch(()=>{})},[e]);const U=k.useCallback(async()=>{if(t)try{const A=await ke.getLinkedLinearIssue(e,!0);A.issue&&(W.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;U();const A=setInterval(U,tB);return()=>clearInterval(A)},[U,t]),k.useEffect(()=>{if(!w)return;const A=N.trim();if(A.length<2){E([]);return}let de=!0;O(!0);const K=setTimeout(()=>{ke.searchLinearIssues(A,6).then(q=>{de&&E(q.issues)}).catch(()=>{de&&E([])}).finally(()=>{de&&O(!1)})},400);return()=>{de=!1,clearTimeout(K)}},[N,w]),k.useEffect(()=>{w&&setTimeout(()=>{var A;return(A=R.current)==null?void 0:A.focus()},50)},[w]);async function D(){if(!(!t||!h.trim()||x)){v(!0);try{const A=await ke.addLinearComment(t.id,h.trim());i(de=>[...de,A.comment]),m("")}catch{}finally{v(!1)}}}async function X(){try{await ke.unlinkLinearIssue(e),W.getState().setLinkedLinearIssue(e,null),i([]),c(null),f([]),y(!1)}catch{}}async function P(A){try{await ke.linkLinearIssue(e,A),W.getState().setLinkedLinearIssue(e,A),j(!1),S(""),E([])}catch{}}if(!t)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:w?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(pu,{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] ${u0(A.stateType,A.stateName).cls}`,children:u0(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(pu,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const Q=u0(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(pu,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${Q.cls}`,children:Q.label}),l.jsx("button",{onClick: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),W.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:P9(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()||x,"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 sB({sessionId:e}){const t=W(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(f=>f+1),fv);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?ux(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(mr,{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 iB({sessionId:e}){const t=W(a=>a.sessions.get(e)),n=zu(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(K9,{sessionId:e}),l.jsx(W9,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(sB,{sessionId:e}),l.jsx(G9,{sessionId:e})]})}function rB({sessionId:e}){const t=W(m=>m.sessions.get(e)),n=zu(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=>{W.getState().updateSession(e,{git_ahead:m.git_ahead,git_behind:m.git_behind}),m.success||da(new Error(`git pull failed: ${m.output}`))}).catch(m=>da(m))},title:"Pull latest changes",children:"Pull"})]})]}):null}function aB({sessionId:e}){const t=W(c=>c.sessionTasks.get(e)||qN),n=W(c=>c.sessions.get(e)),i=zu(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(fB,{task:c},c.id))})})}const lB={"usage-limits":iB,"server-memory":Y9,"server-disk":X9,"git-branch":rB,"github-pr":eB,"linear-issue":nB,"mcp-servers":O9,tasks:aB};function oB(e,t){const n=W(i=>i.sessionTasks.get(t)||qN);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 cB({isCodex:e}){const t=W(m=>m.taskPanelConfig),n=W(m=>m.toggleSectionEnabled),i=W(m=>m.moveSectionUp),a=W(m=>m.moveSectionDown),c=W(m=>m.resetTaskPanelConfig),u=W(m=>m.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(m=>{const x=pr.find(v=>v.id===m);return!(!x||x.backends&&!x.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,x)=>{const v=pr.find(j=>j.id===m),b=t.enabled[m]??!0,y=x===0,w=x===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:w,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:v.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.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 uB({sectionId:e,sessionId:t,children:n}){var c;const i=((c=pr.find(u=>u.id===e))==null?void 0:c.label)??e,a=oB(e,t);return l.jsx(GN,{id:e,label:i,badge:a,children:n})}function dB({sessionId:e}){const t=W(x=>x.sessions.get(e)),n=zu(e),i=W(x=>x.taskPanelOpen),a=W(x=>x.setTaskPanelOpen),c=W(x=>x.taskPanelConfigMode),u=W(x=>x.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(x=>{const v=pr.find(b=>b.id===x);return!(!v||v.backends&&!v.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?W.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(cB,{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(V9,{}),l.jsx(B9,{sessionId:e}),m.filter(x=>u.enabled[x]!==!1).map(x=>{var b;const v=lB[x];return v?l.jsx(uB,{sectionId:x,sessionId:e,children:l.jsx(F9,{label:(b=pr.find(y=>y.id===x))==null?void 0:b.label,children:l.jsx(v,{sessionId:e})})},x):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>W.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 fB({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 hB({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 pB({sessionId:e}){const t=W(O=>O.sessions.get(e)),n=W(O=>O.sdkSessions.find(R=>R.sessionId===e)),i=W(O=>O.diffPanelSelectedFile.get(e)??null),a=W(O=>O.setDiffPanelSelectedFile),c=W(O=>O.diffBase),u=W(O=>O.setDiffBase),f=W(O=>O.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[m,x]=k.useState(""),[v,b]=k.useState(!1),[y,w]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),S=W(O=>O.setGitChangedFilesCount);k.useEffect(()=>{if(!h)return;let O=!1;return ke.getChangedFiles(h,c).then(({files:R})=>{if(O)return;const U=`${h}/`,D=R.filter(X=>X.path===h||X.path.startsWith(U)).map(X=>({abs:X.path,rel:X.path.startsWith(U)?X.path.slice(U.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){x("");return}let O=!1;return b(!0),ke.getFileDiff(i,c).then(R=>{O||(x(R.diff),b(!1))}).catch(()=>{O||(x(""),b(!1))}),()=>{O=!0}},[i,c]);const E=k.useCallback(O=>{a(e,O),typeof window<"u"&&window.innerWidth<640&&w(!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:()=>w(!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:()=>w(!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:U})=>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(hB,{status:U}),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:()=>w(!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:v?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(jo,{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:()=>w(!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 mB(){const e=W(h=>h.updateInfo),t=W(h=>h.updateDismissedVersion),n=W(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(),W.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),da(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 gB({text:e}){const[t,n]=k.useState(!1);k.useEffect(()=>{if(!t)return;const a=setTimeout(()=>n(!1),1500);return()=>clearTimeout(a)},[t]);async function i(){try{await navigator.clipboard.writeText(e),n(!0)}catch{}}return l.jsx("div",{className:"mt-3 w-full max-w-xs px-4","data-testid":"unsent-prompt",children:l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-card/80",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-cc-border/60",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-fg",children:"Your prompt was not sent"}),l.jsx("button",{type:"button",onClick:i,className:"px-2 py-1 min-h-[28px] text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:t?"Copied":"Copy"})]}),l.jsx("pre",{className:"px-3 py-2 max-h-40 overflow-auto text-[11px] text-cc-fg whitespace-pre-wrap break-words font-mono-code leading-relaxed select-text",children:e}),l.jsx("p",{className:"px-3 pb-2 text-[10px] text-cc-muted",children:"It is still in the composer — dismiss to edit and retry."})]})})}function xB({steps:e,error:t,unsentPrompt:n,backend:i,onCancel:a}){const c=i==="codex"?"/logo-codex.svg":"/logo.svg",u=e.some(b=>b.status==="in_progress"),f=e.length>0&&e.every(b=>b.status==="done"),h=e.some(b=>b.status==="error")||!!t,m=[...e].reverse().find(b=>b.status==="in_progress"),x=[...e].reverse().find(b=>b.status==="done"),v=h?"Something went wrong":f?"Launching session...":(m==null?void 0:m.label)||(x==null?void 0:x.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:[u&&!h&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:c,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${u&&!h?"scale-110":""} ${h?"opacity-40 grayscale":""}`}),u&&!h&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),f&&!h&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${h?"text-cc-error":"text-cc-fg"}`,children:v}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((b,y)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${y*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[b.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"}),b.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"})})}),b.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 ${b.status==="in_progress"?"text-cc-fg font-medium":b.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:b.label}),b.detail&&b.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:b.detail})]},b.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),h&&n&&l.jsx(gB,{text:n}),(h||u)&&a&&l.jsx("button",{onClick:a,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:h?"Dismiss":"Cancel"}),!h&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(b=>b.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function vB(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const bB={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function yB(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:vB()}).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 XN({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:bB[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 _B({active:e}){const t=yB(e);return e?l.jsx(XN,{phase:t,className:"fixed inset-0 z-[100]"}):null}function tP({phase:e}){return l.jsx(XN,{phase:e,className:"absolute inset-0"})}function wB(){const e=W(j=>j.dockerUpdateDialogOpen),t=W(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 x(){m()}function v(){y()}function b(){y()}function y(){i("prompt"),f(null),t(!1)}async function w(){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:w,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:v,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),l.jsx("button",{type:"button",onClick:x,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:x,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 nP({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 SB=2e3;function kB(){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),x=k.useRef(null),v=k.useCallback(async()=>{try{t(await ke.getCodexAccount())}catch(L){f(L instanceof Error?L.message:String(L))}},[]),b=k.useCallback(()=>{x.current&&(clearInterval(x.current),x.current=null)},[]),y=k.useCallback(()=>{b(),x.current=setInterval(async()=>{try{const L=await ke.getCodexLoginStatus();i(L),L.state!=="pending"&&(b(),L.state==="success"&&v())}catch{}},SB)},[v,b]);k.useEffect(()=>(v(),ke.getCodexLoginStatus().then(L=>{i(L),L.state==="pending"&&y()}).catch(()=>{}),b),[v,y,b]);const w=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 v()}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:w,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 d0=["welcome","claude","codex","done"],R2='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function hx(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function jB({onComplete:e}){const[t,n]=k.useState("welcome"),[i,a]=k.useState(""),[c,u]=k.useState(""),[f,h]=k.useState(!1),[m,x]=k.useState(""),[v,b]=k.useState(!1),[y,w]=k.useState(!1),[j,N]=k.useState(hx),S=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const Q=S.current;if(!Q)return;function A(K){if(K.key==="Escape"){K.preventDefault();return}if(K.key!=="Tab")return;const q=Q.querySelectorAll(R2);if(q.length===0)return;const H=q[0],I=q[q.length-1];K.shiftKey?document.activeElement===H&&(K.preventDefault(),I.focus()):document.activeElement===I&&(K.preventDefault(),H.focus())}document.addEventListener("keydown",A);const de=Q.querySelector(R2);return de==null||de.focus(),()=>document.removeEventListener("keydown",A)},[t]);const C=k.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),x("");try{await ke.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(Q){x(Q instanceof Error?Q.message:"Failed to save token")}finally{h(!1)}},[i]),E=k.useCallback(async()=>{h(!0),x("");try{(await ke.getSettings()).codexDeviceAuthConfigured?(w(!0),await O()):x("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(Q){x(Q instanceof Error?Q.message:"Failed to check auth status")}finally{h(!1)}},[]),L=k.useCallback(async()=>{h(!0),x("");try{await ke.updateSettings({openaiApiKey:c.trim()}),w(!0),await O()}catch(Q){x(Q instanceof Error?Q.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]),U=k.useCallback(async()=>{await O(),e()},[O,e]),D=k.useCallback(Q=>{x(""),n(Q)},[]),X=d0.indexOf(t),P=hx();return Eo.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 ${d0.length-1}`,children:d0.slice(0,3).map((Q,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}},Q))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(NB,{onSetupClaude:()=>D("claude"),onSetupCodex:()=>D("codex")}),t==="claude"&&l.jsx(CB,{token:i,onTokenChange:a,onSave:C,onSkip:()=>D("codex"),saving:f,error:m}),t==="codex"&&l.jsx(EB,{apiKey:c,onApiKeyChange:u,onCheckAuth:E,onSaveApiKey:L,onSkip:()=>O(),onBack:()=>D("claude"),saving:f,error:m}),t==="done"&&l.jsx(TB,{claudeConfigured:v,codexConfigured:y,onDone:R})]}),t==="welcome"&&l.jsx("button",{onClick:U,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function NB({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 CB({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(MB,{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 EB({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:c,saving:u,error:f}){const[h,m]=k.useState(!1),x="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(kB,{}),f&&l.jsxs("div",{id:x,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:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?x: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 TB({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=hx(),[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 MB({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 W(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const RB=k.lazy(()=>Vn(()=>import("./Playground-C-hSwNGZ.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),OB=k.lazy(()=>Vn(()=>import("./SettingsPage-lBpx5wZP.js"),[]).then(e=>({default:e.SettingsPage}))),LB=k.lazy(()=>Vn(()=>import("./IntegrationsPage-CeFJD8qq.js"),[]).then(e=>({default:e.IntegrationsPage}))),DB=k.lazy(()=>Vn(()=>import("./LinearSettingsPage-6lZfxn4O.js"),[]).then(e=>({default:e.LinearSettingsPage}))),zB=k.lazy(()=>Vn(()=>import("./LinearOAuthSettingsPage-DRlRTVfQ.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),$B=k.lazy(()=>Vn(()=>import("./TailscalePage-DRdnrf6G.js"),[]).then(e=>({default:e.TailscalePage}))),BB=k.lazy(()=>Vn(()=>import("./PromptsPage-CdmFkzMP.js"),[]).then(e=>({default:e.PromptsPage}))),PB=k.lazy(()=>Vn(()=>Promise.resolve().then(()=>h9),void 0).then(e=>({default:e.EnvManager}))),FB=k.lazy(()=>Vn(()=>import("./SandboxManager-Bl4PXenO.js"),[]).then(e=>({default:e.SandboxManager}))),UB=k.lazy(()=>Vn(()=>import("./CronManager-S0nmTpnB.js"),[]).then(e=>({default:e.CronManager}))),IB=k.lazy(()=>Vn(()=>import("./AgentsPage-BksCBN61.js"),[]).then(e=>({default:e.AgentsPage}))),HB=k.lazy(()=>Vn(()=>import("./RunsPage-bXFgnAju.js"),[]).then(e=>({default:e.RunsPage}))),qB=k.lazy(()=>Vn(()=>import("./DashboardPage-DzdjTocu.js"),[]).then(e=>({default:e.DashboardPage}))),VB=k.lazy(()=>Vn(()=>import("./MagicUIView-CbB9S_lC.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function hs(){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 GB(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function YB(){const e=W(M=>M.isAuthenticated),t=W(M=>M.darkMode),n=W(M=>M.currentSessionId),i=W(M=>M.sidebarOpen),a=W(M=>M.taskPanelOpen),c=W(M=>M.homeResetKey),u=W(M=>M.activeTab),f=AB(n),h=W(M=>M.sessionCreating),m=W(M=>M.sessionCreatingBackend),x=W(M=>M.creationProgress),v=W(M=>M.creationError),b=W(M=>M.creationDraft),y=W(M=>M.updateOverlayActive),w=GB(),j=k.useMemo(()=>Fx(w),[w]),N=j.page==="settings",S=j.page==="prompts",C=j.page==="integrations",E=j.page==="integration-linear",L=j.page==="integration-linear-oauth",O=j.page==="integration-tailscale",R=j.page==="environments",U=j.page==="sandboxes",D=j.page==="scheduled",X=j.page==="agents"||j.page==="agent-detail",P=j.page==="runs",Q=j.page==="dashboard",A=j.page==="session"||j.page==="home";k.useEffect(()=>{VA(w||"#/")},[w]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const de=k.useRef(W.getState().currentSessionId);k.useEffect(()=>{if(de.current!==null&&j.page==="home"){Ux(de.current,!0),de.current=null;return}if(de.current=null,j.page==="session"){const M=W.getState();M.currentSessionId!==j.sessionId&&M.setCurrentSession(j.sessionId),Co(j.sessionId)}else if(j.page==="home"){const M=W.getState();M.currentSessionId!==null&&M.setCurrentSession(null)}},[j]);const K=W(M=>n?M.changedFilesTick.get(n)??0:0),q=W(M=>M.diffBase),H=W(M=>M.setGitChangedFilesCount),I=W(M=>{var Ee,Ae;return n&&(((Ee=M.sessions.get(n))==null?void 0:Ee.cwd)||((Ae=M.sdkSessions.find(z=>z.sessionId===n))==null?void 0:Ae.cwd))||null});k.useEffect(()=>{if(!n||!I)return;let M=!1;return ke.getChangedFiles(I,q).then(({files:Ee})=>{if(M)return;const Ae=`${I}/`,z=Ee.filter(B=>B.path===I||B.path.startsWith(Ae)).length;H(n,z)}).catch(()=>{}),()=>{M=!0}},[n,I,q,K,H]),k.useEffect(()=>{const M=()=>{ke.checkForUpdate().then(Ae=>{W.getState().setUpdateInfo(Ae)}).catch(()=>{})};M();const Ee=setInterval(M,300*1e3);return()=>clearInterval(Ee)},[]),k.useEffect(()=>{const M=()=>{ke.getClaudeCompat().then(Ae=>{W.getState().setClaudeCompatInfo(Ae)}).catch(()=>{})};M();const Ee=setInterval(M,300*1e3);return()=>clearInterval(Ee)},[]);const[re,ve]=k.useState(!1);return k.useEffect(()=>{e&&ke.getSettings().then(M=>{M.publicUrl&&W.getState().setPublicUrl(M.publicUrl),W.getState().setMagicUiAvailable(!!M.magicUiEnabled&&!!M.claudeCliAvailable),M.onboardingCompleted||ve(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?j.page==="playground"?l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(RB,{})}):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:()=>W.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(u8,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(c9,{}),l.jsx(mB,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(OB,{embedded:!0})})}),S&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(BB,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(LB,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(DB,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(zB,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx($B,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(PB,{embedded:!0})})}),U&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(FB,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(UB,{embedded:!0})})}),X&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(IB,{route:j})})}),P&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(HB,{})})}),Q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(qB,{})})}),A&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(pB,{sessionId:n}):f?l.jsx(k.Suspense,{fallback:l.jsx(hs,{}),children:l.jsx(VB,{sessionId:n})}):l.jsx(s9,{sessionId:n}):l.jsx(N9,{},c)}),h&&x&&x.length>0&&l.jsx(xB,{steps:x,error:v,unsentPrompt:(b==null?void 0:b.text)??null,backend:m??void 0,onCancel:()=>W.getState().clearCreation()})]})]})]}),n&&A&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>W.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:()=>W.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(dB,{sessionId:n})})]}),l.jsx(_B,{active:y}),l.jsx(wB,{}),re&&l.jsx(jB,{onComplete:()=>ve(!1)})]}):l.jsx(WA,{})}class QB extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){da(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}}qA();$E.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(QB,{children:l.jsx(YB,{})})}));Vn(()=>import("./sw-register-DhsOPkya.js"),[]).catch(()=>{});export{Y$ as A,go as B,kB as C,KB as D,L9 as E,m9 as F,J9 as G,Bf as H,No as I,Eo as J,y2 as K,pu as L,j$ as M,DN as N,E$ as O,D$ as P,L$ as Q,O$ as R,xB as S,I2 as T,mB as U,WB as V,eP as W,JB as X,Vn as _,ke as a,qg as b,In as c,R$ as d,i8 as e,s9 as f,HA as g,qz as h,d9 as i,l as j,d$ as k,jo as l,tP as m,Ux as n,nP as o,t$ as p,n$ as q,k as r,ZB as s,P9 as t,W as u,i9 as v,K9 as w,W9 as x,Oi as y,sl as z};
|